From xen-changelog-bounces@lists.xenproject.org Thu Aug 01 07:44:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Aug 2024 07:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.769410.1180280 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZQTl-0001nP-Kt; Thu, 01 Aug 2024 07:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 769410.1180280; Thu, 01 Aug 2024 07:44: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 1sZQTl-0001nH-IF; Thu, 01 Aug 2024 07:44:05 +0000
Received: by outflank-mailman (input) for mailman id 769410;
 Thu, 01 Aug 2024 07:44:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQTj-0001nB-Qr
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:44:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQTj-0007zY-MT
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:44:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQTj-00062y-LN
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=L0XrOF+pcTCKhuZeuyFbIOi1TiRL4W2siY+U36Zly+o=; b=U0aKJKykVSsENjHUgga4uiEhl0
	sGppApW5bLKJlEWRoXMc86D188ghVeN8ro+pN9VjeoTGSSe1vyc40JyTgwBSa+oA/eTS5u4kCs2TA
	OiXAmnpnb36kh6Op6Q40aIAy1XAxM8d+v+E4O/9JWVPa9OrUPj7PsQyqttNTP5utXCe8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/ocaml: Fix mixed tabs/spaces
Message-Id: <E1sZQTj-00062y-LN@xenbits.xenproject.org>
Date: Thu, 01 Aug 2024 07:44:03 +0000

commit 8d5507beeb717f6f91c3970a03993b354ff4c40b
Author:     Petr Beneš <w1benny@gmail.com>
AuthorDate: Thu Aug 1 09:36:54 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 09:36:54 2024 +0200

    tools/ocaml: Fix mixed tabs/spaces
    
    No functional change.
    
    Signed-off-by: Petr Beneš <w1benny@gmail.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index c6da9bb091..e86c455802 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -138,12 +138,12 @@ static void domain_handle_of_uuid_string(xen_domain_handle_t h,
  * integers in the Ocaml ABI for more idiomatic handling.
  */
 static value c_bitmap_to_ocaml_list
-             /* ! */
-             /*
+	     /* ! */
+	     /*
 	      * All calls to this function must be in a form suitable
 	      * for xenctrl_abi_check.  The parsing there is ad-hoc.
 	      */
-             (unsigned int bitmap)
+	         (unsigned int bitmap)
 {
 	CAMLparam0();
 	CAMLlocal2(list, tmp);
@@ -180,8 +180,8 @@ static value c_bitmap_to_ocaml_list
 }
 
 static unsigned int ocaml_list_to_c_bitmap(value l)
-             /* ! */
-             /*
+	     /* ! */
+	     /*
 	      * All calls to this function must be in a form suitable
 	      * for xenctrl_abi_check.  The parsing there is ad-hoc.
 	      */
@@ -259,7 +259,7 @@ CAMLprim value stub_xc_domain_create(value xch_val, value wanted_domid, value co
 		/* Quick & dirty check for ABI changes. */
 		BUILD_BUG_ON(sizeof(cfg) != 68);
 
-        /* Mnemonics for the named fields inside xen_x86_arch_domainconfig */
+		/* Mnemonics for the named fields inside xen_x86_arch_domainconfig */
 #define VAL_EMUL_FLAGS          Field(arch_domconfig, 0)
 #define VAL_MISC_FLAGS          Field(arch_domconfig, 1)
 
@@ -351,7 +351,7 @@ static value dom_op(value xch_val, value domid,
 	caml_enter_blocking_section();
 	result = fn(xch, c_domid);
 	caml_leave_blocking_section();
-        if (result)
+	if (result)
 		failwith_xc(xch);
 	CAMLreturn(Val_unit);
 }
@@ -383,7 +383,7 @@ CAMLprim value stub_xc_domain_resume_fast(value xch_val, value domid)
 	caml_enter_blocking_section();
 	result = xc_domain_resume(xch, c_domid, 1);
 	caml_leave_blocking_section();
-        if (result)
+	if (result)
 		failwith_xc(xch);
 	CAMLreturn(Val_unit);
 }
@@ -426,7 +426,7 @@ static value alloc_domaininfo(xc_domaininfo_t * info)
 	Store_field(result, 13, Val_int(info->max_vcpu_id));
 	Store_field(result, 14, caml_copy_int32(info->ssidref));
 
-        tmp = caml_alloc_small(16, 0);
+	tmp = caml_alloc_small(16, 0);
 	for (i = 0; i < 16; i++) {
 		Field(tmp, i) = Val_int(info->handle[i]);
 	}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 01 07:44:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Aug 2024 07:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.769411.1180283 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZQTu-0001p6-MC; Thu, 01 Aug 2024 07:44:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 769411.1180283; Thu, 01 Aug 2024 07: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 1sZQTu-0001ox-Je; Thu, 01 Aug 2024 07:44:14 +0000
Received: by outflank-mailman (input) for mailman id 769411;
 Thu, 01 Aug 2024 07:44:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQTt-0001oi-Qi
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:44:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQTt-0007zc-Pm
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:44:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQTt-00063h-On
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bB5CjiPeSbzTkcDTqNN54kEQzNOlKPGvrPzLyP38J3M=; b=D5FAkY5CoLfJqddz4C8HrcXp/+
	lOYDFbRTsb6Oi5Bo8uwsWHKMlIdeu5Nc2/A/esF84x1kYi+FSqHQP2CLtr2xJjvMufgL+rC4XbOtt
	m/KRKOc8jtoB8AL2ohhBivUPeUPErp4LXB0GfZrTFZFdhat0ZQdKxk+o0gXn2nkhTVuY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/ocaml: Add missing ocaml bindings for altp2m_opts
Message-Id: <E1sZQTt-00063h-On@xenbits.xenproject.org>
Date: Thu, 01 Aug 2024 07:44:13 +0000

commit fb45a35ad7832ea606fa741e10bacd5691b1dd65
Author:     Petr Beneš <w1benny@gmail.com>
AuthorDate: Thu Aug 1 09:37:32 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 09:37:32 2024 +0200

    tools/ocaml: Add missing ocaml bindings for altp2m_opts
    
    Fixes: 0291089f6ea8 ("xen: enable altp2m at create domain domctl")
    Signed-off-by: Petr Beneš <w1benny@gmail.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
---
 tools/ocaml/libs/xc/xenctrl.ml      | 1 +
 tools/ocaml/libs/xc/xenctrl.mli     | 1 +
 tools/ocaml/libs/xc/xenctrl_stubs.c | 9 ++++++---
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml
index 55923857ec..2690f9a923 100644
--- a/tools/ocaml/libs/xc/xenctrl.ml
+++ b/tools/ocaml/libs/xc/xenctrl.ml
@@ -85,6 +85,7 @@ type domctl_create_config =
     max_grant_frames: int;
     max_maptrack_frames: int;
     max_grant_version: int;
+    altp2m_opts: int32;
     vmtrace_buf_kb: int32;
     cpupool_id: int32;
     arch: arch_domainconfig;
diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.mli
index 9b4b45db3a..febbe1f6ae 100644
--- a/tools/ocaml/libs/xc/xenctrl.mli
+++ b/tools/ocaml/libs/xc/xenctrl.mli
@@ -77,6 +77,7 @@ type domctl_create_config = {
   max_grant_frames: int;
   max_maptrack_frames: int;
   max_grant_version: int;
+  altp2m_opts: int32;
   vmtrace_buf_kb: int32;
   cpupool_id: int32;
   arch: arch_domainconfig;
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index e86c455802..a529080129 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -210,9 +210,10 @@ CAMLprim value stub_xc_domain_create(value xch_val, value wanted_domid, value co
 #define VAL_MAX_GRANT_FRAMES    Field(config, 6)
 #define VAL_MAX_MAPTRACK_FRAMES Field(config, 7)
 #define VAL_MAX_GRANT_VERSION   Field(config, 8)
-#define VAL_VMTRACE_BUF_KB      Field(config, 9)
-#define VAL_CPUPOOL_ID          Field(config, 10)
-#define VAL_ARCH                Field(config, 11)
+#define VAL_ALTP2M_OPTS         Field(config, 9)
+#define VAL_VMTRACE_BUF_KB      Field(config, 10)
+#define VAL_CPUPOOL_ID          Field(config, 11)
+#define VAL_ARCH                Field(config, 12)
 
 	uint32_t domid = Int_val(wanted_domid);
 	uint64_t vmtrace_size = Int32_val(VAL_VMTRACE_BUF_KB);
@@ -230,6 +231,7 @@ CAMLprim value stub_xc_domain_create(value xch_val, value wanted_domid, value co
 		.max_maptrack_frames = Int_val(VAL_MAX_MAPTRACK_FRAMES),
 		.grant_opts =
 		    XEN_DOMCTL_GRANT_version(Int_val(VAL_MAX_GRANT_VERSION)),
+		.altp2m_opts = Int32_val(VAL_ALTP2M_OPTS),
 		.vmtrace_size = vmtrace_size,
 		.cpupool_id = Int32_val(VAL_CPUPOOL_ID),
 	};
@@ -288,6 +290,7 @@ CAMLprim value stub_xc_domain_create(value xch_val, value wanted_domid, value co
 #undef VAL_ARCH
 #undef VAL_CPUPOOL_ID
 #undef VAL_VMTRACE_BUF_KB
+#undef VAL_ALTP2M_OPTS
 #undef VAL_MAX_GRANT_VERSION
 #undef VAL_MAX_MAPTRACK_FRAMES
 #undef VAL_MAX_GRANT_FRAMES
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 01 07:44:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Aug 2024 07:44:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.769412.1180288 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZQU4-0001rf-Ng; Thu, 01 Aug 2024 07:44:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 769412.1180288; Thu, 01 Aug 2024 07: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 1sZQU4-0001rX-L9; Thu, 01 Aug 2024 07:44:24 +0000
Received: by outflank-mailman (input) for mailman id 769412;
 Thu, 01 Aug 2024 07:44:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQU3-0001rP-UQ
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:44:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQU3-0007zn-TY
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:44:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQU3-00064V-SH
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ogmec7ECD7PNTEr6mIblYBoiC87Dw1KFwaEmMFrqDTc=; b=QDUmmRYV9UYEjRMuxu6Yx2vD1o
	H58yWkJwP+U0uDJ9nAdDGcuQSSj41eYUV4sgQGMzo3VesWm97/5IiLg84rYfaWUff2XAsFa9WpH6S
	pDThfxQGJJq9UhioC1lVrr6zhEX+bHCDfS2TmKP6QvduSUKY2+Jtge11/n8uVRb9V6Dw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/intel: optional build of TSX support
Message-Id: <E1sZQU3-00064V-SH@xenbits.xenproject.org>
Date: Thu, 01 Aug 2024 07:44:23 +0000

commit b1b017ffb7ad135ff7e726f85a870817c140406e
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Thu Aug 1 09:38:00 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 09:38:00 2024 +0200

    x86/intel: optional build of TSX support
    
    Transactional Synchronization Extensions are supported on certain Intel's
    CPUs only, hence can be put under CONFIG_INTEL build option.
    
    The whole TSX support, even if supported by CPU, may need to be disabled via
    options, by microcode or through spec-ctrl, depending on a set of specific
    conditions. To make sure nothing gets accidentally runtime-broken all
    modifications of global TSX configuration variables is secured by #ifdef's,
    while variables themselves redefined to 0, so that ones can't mistakenly be
    written to.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/xen-command-line.pandoc    | 2 +-
 xen/arch/x86/Makefile                | 2 +-
 xen/arch/x86/include/asm/processor.h | 6 ++++++
 xen/arch/x86/spec_ctrl.c             | 4 ++++
 4 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 98a4521155..0a66e1ee2d 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2586,7 +2586,7 @@ pages) must also be specified via the tbuf_size parameter.
 ### tsx
     = <bool>
 
-    Applicability: x86
+    Applicability: x86 with CONFIG_INTEL active
     Default: false on parts vulnerable to TAA, true otherwise
 
 Controls for the use of Transactional Synchronization eXtensions.
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index d902fb7acc..286c003ec3 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -67,7 +67,7 @@ obj-y += srat.o
 obj-y += string.o
 obj-y += time.o
 obj-y += traps.o
-obj-y += tsx.o
+obj-$(CONFIG_INTEL) += tsx.o
 obj-y += usercopy.o
 obj-y += x86_emulate.o
 obj-$(CONFIG_TBOOT) += tboot.o
diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/asm/processor.h
index c26ef9090c..66463f6a6d 100644
--- a/xen/arch/x86/include/asm/processor.h
+++ b/xen/arch/x86/include/asm/processor.h
@@ -503,9 +503,15 @@ static inline uint8_t get_cpu_family(uint32_t raw, uint8_t *model,
     return fam;
 }
 
+#ifdef CONFIG_INTEL
 extern int8_t opt_tsx;
 extern bool rtm_disabled;
 void tsx_init(void);
+#else
+#define opt_tsx      0     /* explicitly indicate TSX is off */
+#define rtm_disabled false /* RTM was not force-disabled */
+static inline void tsx_init(void) {}
+#endif
 
 void update_mcu_opt_ctrl(void);
 void set_in_mcu_opt_ctrl(uint32_t mask, uint32_t val);
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 40f6ae0170..6b3631e375 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -116,8 +116,10 @@ static int __init cf_check parse_spec_ctrl(const char *s)
             if ( opt_pv_l1tf_domu < 0 )
                 opt_pv_l1tf_domu = 0;
 
+#ifdef CONFIG_INTEL
             if ( opt_tsx == -1 )
                 opt_tsx = -3;
+#endif
 
         disable_common:
             opt_rsb_pv = false;
@@ -2264,6 +2266,7 @@ void __init init_speculation_mitigations(void)
      * plausibly value TSX higher than Hyperthreading...), disable TSX to
      * mitigate TAA.
      */
+#ifdef CONFIG_INTEL
     if ( opt_tsx == -1 && cpu_has_bug_taa && cpu_has_tsx_ctrl &&
          ((hw_smt_enabled && opt_smt) ||
           !boot_cpu_has(X86_FEATURE_SC_VERW_IDLE)) )
@@ -2271,6 +2274,7 @@ void __init init_speculation_mitigations(void)
         opt_tsx = 0;
         tsx_init();
     }
+#endif
 
     /*
      * On some SRBDS-affected hardware, it may be safe to relax srb-lock by
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 01 07:44:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Aug 2024 07:44:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.769413.1180292 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZQUE-0001v4-Pc; Thu, 01 Aug 2024 07:44:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 769413.1180292; Thu, 01 Aug 2024 07:44: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 1sZQUE-0001uu-Md; Thu, 01 Aug 2024 07:44:34 +0000
Received: by outflank-mailman (input) for mailman id 769413;
 Thu, 01 Aug 2024 07:44:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQUE-0001ui-1j
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:44:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQUE-000801-0u
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:44:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQUD-00065n-Vt
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iEbMhHRwsTi/d299SR2M96H6x2GjikZWOdiiBSjS5Ko=; b=S32Rk6Nny9VhgnSwHc4ExRa5zl
	iYiAKWk3OhZmpw/4zVeuZjdlmxmhri9siqAFouS3ZYi9+SR48oa3+xusE7IbWJR8W0oWBeD5VL54Z
	/j+hQJhEGkbASnjKLTPv/0u1n2mlIiXPpYhW6OM/5fj/ZWDLQdBYSeZR1WerNUKJ6Nug=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/fpu: Create a typedef for the x87/SSE area inside "struct xsave_struct"
Message-Id: <E1sZQUD-00065n-Vt@xenbits.xenproject.org>
Date: Thu, 01 Aug 2024 07:44:33 +0000

commit 4fe446a42910cb6bf53ca3a8b7c2c6a64e2f192c
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Thu Aug 1 09:39:11 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 09:39:11 2024 +0200

    x86/fpu: Create a typedef for the x87/SSE area inside "struct xsave_struct"
    
    Making the union non-anonymous would cause a lot of headaches, because a lot of
    code relies on it being so, but it's possible to make a typedef of the anonymous
    union so all callsites currently relying on typeof() can stop doing so directly.
    
    This commit creates a `fpusse_t` typedef to the anonymous union at the head of
    the XSAVE area and uses it instead of typeof().
    
    No functional change.
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/emulate.c        | 5 ++---
 xen/arch/x86/i387.c               | 8 ++++----
 xen/arch/x86/include/asm/xstate.h | 2 ++
 xen/arch/x86/xstate.c             | 2 +-
 4 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index b6ca5cb9d1..feb4792cc5 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2363,8 +2363,7 @@ static int cf_check hvmemul_get_fpu(
         alternative_vcall(hvm_funcs.fpu_dirty_intercept);
     else if ( type == X86EMUL_FPU_fpu )
     {
-        const typeof(curr->arch.xsave_area->fpu_sse) *fpu_ctxt =
-            curr->arch.fpu_ctxt;
+        const fpusse_t *fpu_ctxt = curr->arch.fpu_ctxt;
 
         /*
          * Latch current register state so that we can back out changes
@@ -2404,7 +2403,7 @@ static void cf_check hvmemul_put_fpu(
 
     if ( aux )
     {
-        typeof(curr->arch.xsave_area->fpu_sse) *fpu_ctxt = curr->arch.fpu_ctxt;
+        fpusse_t *fpu_ctxt = curr->arch.fpu_ctxt;
         bool dval = aux->dval;
         int mode = hvm_guest_x86_mode(curr);
 
diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index 400c70114a..134e0bece5 100644
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -39,7 +39,7 @@ static inline void fpu_xrstor(struct vcpu *v, uint64_t mask)
 /* Restore x87 FPU, MMX, SSE and SSE2 state */
 static inline void fpu_fxrstor(struct vcpu *v)
 {
-    const typeof(v->arch.xsave_area->fpu_sse) *fpu_ctxt = v->arch.fpu_ctxt;
+    const fpusse_t *fpu_ctxt = v->arch.fpu_ctxt;
 
     /*
      * Some CPUs don't save/restore FDP/FIP/FOP unless an exception
@@ -151,7 +151,7 @@ static inline void fpu_xsave(struct vcpu *v)
 /* Save x87 FPU, MMX, SSE and SSE2 state */
 static inline void fpu_fxsave(struct vcpu *v)
 {
-    typeof(v->arch.xsave_area->fpu_sse) *fpu_ctxt = v->arch.fpu_ctxt;
+    fpusse_t *fpu_ctxt = v->arch.fpu_ctxt;
     unsigned int fip_width = v->domain->arch.x87_fip_width;
 
     if ( fip_width != 4 )
@@ -315,7 +315,7 @@ int vcpu_init_fpu(struct vcpu *v)
                                     __alignof(v->arch.xsave_area->fpu_sse));
         if ( v->arch.fpu_ctxt )
         {
-            typeof(v->arch.xsave_area->fpu_sse) *fpu_sse = v->arch.fpu_ctxt;
+            fpusse_t *fpu_sse = v->arch.fpu_ctxt;
 
             fpu_sse->fcw = FCW_DEFAULT;
             fpu_sse->mxcsr = MXCSR_DEFAULT;
@@ -336,7 +336,7 @@ void vcpu_setup_fpu(struct vcpu *v, struct xsave_struct *xsave_area,
      * accesses through both pointers alias one another, and the shorter form
      * is used here.
      */
-    typeof(xsave_area->fpu_sse) *fpu_sse = v->arch.fpu_ctxt;
+    fpusse_t *fpu_sse = v->arch.fpu_ctxt;
 
     ASSERT(!xsave_area || xsave_area == v->arch.xsave_area);
 
diff --git a/xen/arch/x86/include/asm/xstate.h b/xen/arch/x86/include/asm/xstate.h
index f0eeb13b87..ebeb2a3dca 100644
--- a/xen/arch/x86/include/asm/xstate.h
+++ b/xen/arch/x86/include/asm/xstate.h
@@ -82,6 +82,8 @@ struct __attribute__((aligned (64))) xsave_struct
     char data[];                             /* Variable layout states */
 };
 
+typedef typeof(((struct xsave_struct){}).fpu_sse) fpusse_t;
+
 struct xstate_bndcsr {
     uint64_t bndcfgu;
     uint64_t bndstatus;
diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 68cdd8fcf0..5c4144d55e 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -846,7 +846,7 @@ void xstate_init(struct cpuinfo_x86 *c)
 
     if ( bsp )
     {
-        static typeof(current->arch.xsave_area->fpu_sse) __initdata ctxt;
+        static fpusse_t __initdata ctxt;
 
         asm ( "fxsave %0" : "=m" (ctxt) );
         if ( ctxt.mxcsr_mask )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 01 07:44:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Aug 2024 07:44:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.769414.1180296 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZQUO-0001yT-SF; Thu, 01 Aug 2024 07:44:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 769414.1180296; Thu, 01 Aug 2024 07: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 1sZQUO-0001yL-PS; Thu, 01 Aug 2024 07:44:44 +0000
Received: by outflank-mailman (input) for mailman id 769414;
 Thu, 01 Aug 2024 07:44:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQUO-0001yE-5V
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:44:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQUO-00080P-4d
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:44:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQUO-00066h-3C
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DeY4XZPPEZ/rudc3D687PpDXOHOPXWlNrX6uvOV0j1A=; b=ytV+P6Ha0AnTDzB4bBxB1UlEYz
	ldzEEd121cIyu/OKt6KvrK3cZctkuDRo2CHC4GDygrRgDDopacumKlKs0IT1HZpx5K2lo2ZyXyxbQ
	ThBPc3ELKHVesHzkQEU6hs1I+W3Fgi3kwlFzdIo4vy9cH+Bn7mFBbyFQx1hyL1VhxRgc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/cpufreq: move ACPI cpufreq driver into separate file
Message-Id: <E1sZQUO-00066h-3C@xenbits.xenproject.org>
Date: Thu, 01 Aug 2024 07:44:44 +0000

commit aed2b87eeb502c32533c2ebba6dad4ef205787b8
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Thu Aug 1 09:40:12 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 09:40:12 2024 +0200

    x86/cpufreq: move ACPI cpufreq driver into separate file
    
    Separate ACPI driver from generic initialization cpufreq code.
    This way acpi-cpufreq can become optional in the future and be disabled
    from non-Intel builds.
    
    no changes to code were introduced, except:
      acpi_cpufreq_register() helper added
      clean up a list of included headers
      license transformed into an SPDX line
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/cpufreq/Makefile  |   1 +
 xen/arch/x86/acpi/cpufreq/acpi.c    | 518 ++++++++++++++++++++++++++++++++++++
 xen/arch/x86/acpi/cpufreq/cpufreq.c | 506 +----------------------------------
 xen/include/acpi/cpufreq/cpufreq.h  |   2 +
 4 files changed, 523 insertions(+), 504 deletions(-)

diff --git a/xen/arch/x86/acpi/cpufreq/Makefile b/xen/arch/x86/acpi/cpufreq/Makefile
index db83aa6b14..44d4c0b497 100644
--- a/xen/arch/x86/acpi/cpufreq/Makefile
+++ b/xen/arch/x86/acpi/cpufreq/Makefile
@@ -1,3 +1,4 @@
+obj-y += acpi.o
 obj-y += cpufreq.o
 obj-y += hwp.o
 obj-y += powernow.o
diff --git a/xen/arch/x86/acpi/cpufreq/acpi.c b/xen/arch/x86/acpi/cpufreq/acpi.c
new file mode 100644
index 0000000000..c6d7d02faa
--- /dev/null
+++ b/xen/arch/x86/acpi/cpufreq/acpi.c
@@ -0,0 +1,518 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ *  cpufreq.c - ACPI Processor P-States Driver ($Revision: 1.4 $)
+ *
+ *  Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
+ *  Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
+ *  Copyright (C) 2002 - 2004 Dominik Brodowski <linux@brodo.de>
+ *  Copyright (C) 2006        Denis Sadykov <denis.m.sadykov@intel.com>
+ *
+ *  Feb 2008 - Liu Jinsong <jinsong.liu@intel.com>
+ *      porting acpi-cpufreq.c from Linux 2.6.23 to Xen hypervisor
+ */
+
+#include <xen/errno.h>
+#include <xen/delay.h>
+#include <xen/param.h>
+#include <xen/types.h>
+
+#include <acpi/acpi.h>
+#include <acpi/cpufreq/cpufreq.h>
+
+enum {
+    UNDEFINED_CAPABLE = 0,
+    SYSTEM_INTEL_MSR_CAPABLE,
+    SYSTEM_IO_CAPABLE,
+};
+
+#define INTEL_MSR_RANGE         (0xffffull)
+
+static bool __read_mostly acpi_pstate_strict;
+boolean_param("acpi_pstate_strict", acpi_pstate_strict);
+
+static unsigned extract_io(u32 value, struct acpi_cpufreq_data *data)
+{
+    struct processor_performance *perf;
+    int i;
+
+    perf = data->acpi_data;
+
+    for (i=0; i<perf->state_count; i++) {
+        if (value == perf->states[i].status)
+            return data->freq_table[i].frequency;
+    }
+    return 0;
+}
+
+static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data)
+{
+    int i;
+    struct processor_performance *perf;
+
+    msr &= INTEL_MSR_RANGE;
+    perf = data->acpi_data;
+
+    for (i=0; data->freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
+        if (msr == perf->states[data->freq_table[i].index].status)
+            return data->freq_table[i].frequency;
+    }
+    return data->freq_table[0].frequency;
+}
+
+static unsigned extract_freq(u32 val, struct acpi_cpufreq_data *data)
+{
+    switch (data->arch_cpu_flags) {
+    case SYSTEM_INTEL_MSR_CAPABLE:
+        return extract_msr(val, data);
+    case SYSTEM_IO_CAPABLE:
+        return extract_io(val, data);
+    default:
+        return 0;
+    }
+}
+
+struct msr_addr {
+    u32 reg;
+};
+
+struct io_addr {
+    u16 port;
+    u8 bit_width;
+};
+
+typedef union {
+    struct msr_addr msr;
+    struct io_addr io;
+} drv_addr_union;
+
+struct drv_cmd {
+    unsigned int type;
+    const cpumask_t *mask;
+    drv_addr_union addr;
+    u32 val;
+};
+
+static void cf_check do_drv_read(void *drvcmd)
+{
+    struct drv_cmd *cmd;
+
+    cmd = (struct drv_cmd *)drvcmd;
+
+    switch (cmd->type) {
+    case SYSTEM_INTEL_MSR_CAPABLE:
+        rdmsrl(cmd->addr.msr.reg, cmd->val);
+        break;
+    case SYSTEM_IO_CAPABLE:
+        acpi_os_read_port((acpi_io_address)cmd->addr.io.port,
+            &cmd->val, (u32)cmd->addr.io.bit_width);
+        break;
+    default:
+        break;
+    }
+}
+
+static void cf_check do_drv_write(void *drvcmd)
+{
+    struct drv_cmd *cmd;
+    uint64_t msr_content;
+
+    cmd = (struct drv_cmd *)drvcmd;
+
+    switch (cmd->type) {
+    case SYSTEM_INTEL_MSR_CAPABLE:
+        rdmsrl(cmd->addr.msr.reg, msr_content);
+        msr_content = (msr_content & ~INTEL_MSR_RANGE)
+            | (cmd->val & INTEL_MSR_RANGE);
+        wrmsrl(cmd->addr.msr.reg, msr_content);
+        break;
+    case SYSTEM_IO_CAPABLE:
+        acpi_os_write_port((acpi_io_address)cmd->addr.io.port,
+            cmd->val, (u32)cmd->addr.io.bit_width);
+        break;
+    default:
+        break;
+    }
+}
+
+static void drv_read(struct drv_cmd *cmd)
+{
+    cmd->val = 0;
+
+    ASSERT(cpumask_weight(cmd->mask) == 1);
+
+    /* to reduce IPI for the sake of performance */
+    if (likely(cpumask_test_cpu(smp_processor_id(), cmd->mask)))
+        do_drv_read((void *)cmd);
+    else
+        on_selected_cpus(cmd->mask, do_drv_read, cmd, 1);
+}
+
+static void drv_write(struct drv_cmd *cmd)
+{
+    if (cpumask_equal(cmd->mask, cpumask_of(smp_processor_id())))
+        do_drv_write((void *)cmd);
+    else
+        on_selected_cpus(cmd->mask, do_drv_write, cmd, 1);
+}
+
+static u32 get_cur_val(const cpumask_t *mask)
+{
+    struct cpufreq_policy *policy;
+    struct processor_performance *perf;
+    struct drv_cmd cmd;
+    unsigned int cpu = smp_processor_id();
+
+    if (unlikely(cpumask_empty(mask)))
+        return 0;
+
+    if (!cpumask_test_cpu(cpu, mask))
+        cpu = cpumask_first(mask);
+    if (cpu >= nr_cpu_ids || !cpu_online(cpu))
+        return 0;
+
+    policy = per_cpu(cpufreq_cpu_policy, cpu);
+    if (!policy || !cpufreq_drv_data[policy->cpu])
+        return 0;
+
+    switch (cpufreq_drv_data[policy->cpu]->arch_cpu_flags) {
+    case SYSTEM_INTEL_MSR_CAPABLE:
+        cmd.type = SYSTEM_INTEL_MSR_CAPABLE;
+        cmd.addr.msr.reg = MSR_IA32_PERF_STATUS;
+        break;
+    case SYSTEM_IO_CAPABLE:
+        cmd.type = SYSTEM_IO_CAPABLE;
+        perf = cpufreq_drv_data[policy->cpu]->acpi_data;
+        cmd.addr.io.port = perf->control_register.address;
+        cmd.addr.io.bit_width = perf->control_register.bit_width;
+        break;
+    default:
+        return 0;
+    }
+
+    cmd.mask = cpumask_of(cpu);
+
+    drv_read(&cmd);
+    return cmd.val;
+}
+
+static unsigned int cf_check get_cur_freq_on_cpu(unsigned int cpu)
+{
+    struct cpufreq_policy *policy;
+    struct acpi_cpufreq_data *data;
+
+    if (!cpu_online(cpu))
+        return 0;
+
+    policy = per_cpu(cpufreq_cpu_policy, cpu);
+    if (!policy)
+        return 0;
+
+    data = cpufreq_drv_data[policy->cpu];
+    if (unlikely(data == NULL ||
+        data->acpi_data == NULL || data->freq_table == NULL))
+        return 0;
+
+    return extract_freq(get_cur_val(cpumask_of(cpu)), data);
+}
+
+void intel_feature_detect(struct cpufreq_policy *policy)
+{
+    unsigned int eax;
+
+    eax = cpuid_eax(6);
+    if (eax & 0x2) {
+        policy->turbo = CPUFREQ_TURBO_ENABLED;
+        if (cpufreq_verbose)
+            printk(XENLOG_INFO "CPU%u: Turbo Mode detected and enabled\n",
+                   smp_processor_id());
+    }
+}
+
+static void cf_check feature_detect(void *info)
+{
+    intel_feature_detect(info);
+}
+
+static unsigned int check_freqs(const cpumask_t *mask, unsigned int freq,
+                                struct acpi_cpufreq_data *data)
+{
+    unsigned int cur_freq;
+    unsigned int i;
+
+    for (i=0; i<100; i++) {
+        cur_freq = extract_freq(get_cur_val(mask), data);
+        if (cur_freq == freq)
+            return 1;
+        udelay(10);
+    }
+    return 0;
+}
+
+static int cf_check acpi_cpufreq_target(
+    struct cpufreq_policy *policy,
+    unsigned int target_freq, unsigned int relation)
+{
+    struct acpi_cpufreq_data *data = cpufreq_drv_data[policy->cpu];
+    struct processor_performance *perf;
+    struct cpufreq_freqs freqs;
+    cpumask_t online_policy_cpus;
+    struct drv_cmd cmd;
+    unsigned int next_state = 0; /* Index into freq_table */
+    unsigned int next_perf_state = 0; /* Index into perf table */
+    unsigned int j;
+    int result = 0;
+
+    if (unlikely(data == NULL ||
+        data->acpi_data == NULL || data->freq_table == NULL)) {
+        return -ENODEV;
+    }
+
+    if (policy->turbo == CPUFREQ_TURBO_DISABLED)
+        if (target_freq > policy->cpuinfo.second_max_freq)
+            target_freq = policy->cpuinfo.second_max_freq;
+
+    perf = data->acpi_data;
+    result = cpufreq_frequency_table_target(policy,
+                                            data->freq_table,
+                                            target_freq,
+                                            relation, &next_state);
+    if (unlikely(result))
+        return -ENODEV;
+
+    cpumask_and(&online_policy_cpus, &cpu_online_map, policy->cpus);
+
+    next_perf_state = data->freq_table[next_state].index;
+    if (perf->state == next_perf_state) {
+        if (unlikely(policy->resume))
+            policy->resume = 0;
+        else
+            return 0;
+    }
+
+    switch (data->arch_cpu_flags) {
+    case SYSTEM_INTEL_MSR_CAPABLE:
+        cmd.type = SYSTEM_INTEL_MSR_CAPABLE;
+        cmd.addr.msr.reg = MSR_IA32_PERF_CTL;
+        cmd.val = (u32) perf->states[next_perf_state].control;
+        break;
+    case SYSTEM_IO_CAPABLE:
+        cmd.type = SYSTEM_IO_CAPABLE;
+        cmd.addr.io.port = perf->control_register.address;
+        cmd.addr.io.bit_width = perf->control_register.bit_width;
+        cmd.val = (u32) perf->states[next_perf_state].control;
+        break;
+    default:
+        return -ENODEV;
+    }
+
+    if (policy->shared_type != CPUFREQ_SHARED_TYPE_ANY)
+        cmd.mask = &online_policy_cpus;
+    else
+        cmd.mask = cpumask_of(policy->cpu);
+
+    freqs.old = perf->states[perf->state].core_frequency * 1000;
+    freqs.new = data->freq_table[next_state].frequency;
+
+    drv_write(&cmd);
+
+    if (acpi_pstate_strict && !check_freqs(cmd.mask, freqs.new, data)) {
+        printk(KERN_WARNING "Fail transfer to new freq %d\n", freqs.new);
+        return -EAGAIN;
+    }
+
+    for_each_cpu(j, &online_policy_cpus)
+        cpufreq_statistic_update(j, perf->state, next_perf_state);
+
+    perf->state = next_perf_state;
+    policy->cur = freqs.new;
+
+    return result;
+}
+
+static int cf_check acpi_cpufreq_verify(struct cpufreq_policy *policy)
+{
+    struct acpi_cpufreq_data *data;
+    struct processor_performance *perf;
+
+    if (!policy || !(data = cpufreq_drv_data[policy->cpu]) ||
+        !processor_pminfo[policy->cpu])
+        return -EINVAL;
+
+    perf = &processor_pminfo[policy->cpu]->perf;
+
+    cpufreq_verify_within_limits(policy, 0,
+        perf->states[perf->platform_limit].core_frequency * 1000);
+
+    return cpufreq_frequency_table_verify(policy, data->freq_table);
+}
+
+static unsigned long
+acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu)
+{
+    struct processor_performance *perf = data->acpi_data;
+
+    if (cpu_khz) {
+        /* search the closest match to cpu_khz */
+        unsigned int i;
+        unsigned long freq;
+        unsigned long freqn = perf->states[0].core_frequency * 1000;
+
+        for (i=0; i<(perf->state_count-1); i++) {
+            freq = freqn;
+            freqn = perf->states[i+1].core_frequency * 1000;
+            if ((2 * cpu_khz) > (freqn + freq)) {
+                perf->state = i;
+                return freq;
+            }
+        }
+        perf->state = perf->state_count-1;
+        return freqn;
+    } else {
+        /* assume CPU is at P0... */
+        perf->state = 0;
+        return perf->states[0].core_frequency * 1000;
+    }
+}
+
+static int cf_check acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
+{
+    unsigned int i;
+    unsigned int valid_states = 0;
+    unsigned int cpu = policy->cpu;
+    struct acpi_cpufreq_data *data;
+    unsigned int result = 0;
+    struct cpuinfo_x86 *c = &cpu_data[policy->cpu];
+    struct processor_performance *perf;
+
+    data = xzalloc(struct acpi_cpufreq_data);
+    if (!data)
+        return -ENOMEM;
+
+    cpufreq_drv_data[cpu] = data;
+
+    data->acpi_data = &processor_pminfo[cpu]->perf;
+
+    perf = data->acpi_data;
+    policy->shared_type = perf->shared_type;
+
+    switch (perf->control_register.space_id) {
+    case ACPI_ADR_SPACE_SYSTEM_IO:
+        if (cpufreq_verbose)
+            printk("xen_pminfo: @acpi_cpufreq_cpu_init,"
+                   "SYSTEM IO addr space\n");
+        data->arch_cpu_flags = SYSTEM_IO_CAPABLE;
+        break;
+    case ACPI_ADR_SPACE_FIXED_HARDWARE:
+        if (cpufreq_verbose)
+            printk("xen_pminfo: @acpi_cpufreq_cpu_init,"
+                   "HARDWARE addr space\n");
+        if (!cpu_has(c, X86_FEATURE_EIST)) {
+            result = -ENODEV;
+            goto err_unreg;
+        }
+        data->arch_cpu_flags = SYSTEM_INTEL_MSR_CAPABLE;
+        break;
+    default:
+        result = -ENODEV;
+        goto err_unreg;
+    }
+
+    data->freq_table = xmalloc_array(struct cpufreq_frequency_table,
+                                    (perf->state_count+1));
+    if (!data->freq_table) {
+        result = -ENOMEM;
+        goto err_unreg;
+    }
+
+    /* detect transition latency */
+    policy->cpuinfo.transition_latency = 0;
+    for (i=0; i<perf->state_count; i++) {
+        if ((perf->states[i].transition_latency * 1000) >
+            policy->cpuinfo.transition_latency)
+            policy->cpuinfo.transition_latency =
+                perf->states[i].transition_latency * 1000;
+    }
+
+    policy->governor = cpufreq_opt_governor ? : CPUFREQ_DEFAULT_GOVERNOR;
+
+    /* table init */
+    for (i=0; i<perf->state_count; i++) {
+        if (i>0 && perf->states[i].core_frequency >=
+            data->freq_table[valid_states-1].frequency / 1000)
+            continue;
+
+        data->freq_table[valid_states].index = i;
+        data->freq_table[valid_states].frequency =
+            perf->states[i].core_frequency * 1000;
+        valid_states++;
+    }
+    data->freq_table[valid_states].frequency = CPUFREQ_TABLE_END;
+    perf->state = 0;
+
+    result = cpufreq_frequency_table_cpuinfo(policy, data->freq_table);
+    if (result)
+        goto err_freqfree;
+
+    switch (perf->control_register.space_id) {
+    case ACPI_ADR_SPACE_SYSTEM_IO:
+        /* Current speed is unknown and not detectable by IO port */
+        policy->cur = acpi_cpufreq_guess_freq(data, policy->cpu);
+        break;
+    case ACPI_ADR_SPACE_FIXED_HARDWARE:
+        cpufreq_driver.get = get_cur_freq_on_cpu;
+        policy->cur = get_cur_freq_on_cpu(cpu);
+        break;
+    default:
+        break;
+    }
+
+    /* Check for APERF/MPERF support in hardware
+     * also check for boost support */
+    if (c->x86_vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6)
+        on_selected_cpus(cpumask_of(cpu), feature_detect, policy, 1);
+
+    /*
+     * the first call to ->target() should result in us actually
+     * writing something to the appropriate registers.
+     */
+    policy->resume = 1;
+
+    return result;
+
+err_freqfree:
+    xfree(data->freq_table);
+err_unreg:
+    xfree(data);
+    cpufreq_drv_data[cpu] = NULL;
+
+    return result;
+}
+
+static int cf_check acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy)
+{
+    struct acpi_cpufreq_data *data = cpufreq_drv_data[policy->cpu];
+
+    if (data) {
+        cpufreq_drv_data[policy->cpu] = NULL;
+        xfree(data->freq_table);
+        xfree(data);
+    }
+
+    return 0;
+}
+
+static const struct cpufreq_driver __initconst_cf_clobber
+acpi_cpufreq_driver = {
+    .name   = "acpi-cpufreq",
+    .verify = acpi_cpufreq_verify,
+    .target = acpi_cpufreq_target,
+    .init   = acpi_cpufreq_cpu_init,
+    .exit   = acpi_cpufreq_cpu_exit,
+    .get    = get_cur_freq_on_cpu,
+};
+
+
+int __init acpi_cpufreq_register(void)
+{
+    return cpufreq_register_driver(&acpi_cpufreq_driver);
+}
diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufreq/cpufreq.c
index a341f2f020..6244d29496 100644
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c
@@ -26,200 +26,14 @@
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  */
-
 #include <xen/types.h>
 #include <xen/errno.h>
-#include <xen/delay.h>
-#include <xen/cpumask.h>
 #include <xen/param.h>
 #include <xen/sched.h>
-#include <xen/timer.h>
-#include <xen/xmalloc.h>
-#include <asm/msr.h>
-#include <asm/io.h>
-#include <asm/processor.h>
-#include <asm/cpufeature.h>
-#include <acpi/acpi.h>
 #include <acpi/cpufreq/cpufreq.h>
 
-enum {
-    UNDEFINED_CAPABLE = 0,
-    SYSTEM_INTEL_MSR_CAPABLE,
-    SYSTEM_IO_CAPABLE,
-};
-
-#define INTEL_MSR_RANGE         (0xffffull)
-
 struct acpi_cpufreq_data *cpufreq_drv_data[NR_CPUS];
 
-static bool __read_mostly acpi_pstate_strict;
-boolean_param("acpi_pstate_strict", acpi_pstate_strict);
-
-static unsigned extract_io(u32 value, struct acpi_cpufreq_data *data)
-{
-    struct processor_performance *perf;
-    int i;
-
-    perf = data->acpi_data;
-
-    for (i=0; i<perf->state_count; i++) {
-        if (value == perf->states[i].status)
-            return data->freq_table[i].frequency;
-    }
-    return 0;
-}
-
-static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data)
-{
-    int i;
-    struct processor_performance *perf;
-
-    msr &= INTEL_MSR_RANGE;
-    perf = data->acpi_data;
-
-    for (i=0; data->freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
-        if (msr == perf->states[data->freq_table[i].index].status)
-            return data->freq_table[i].frequency;
-    }
-    return data->freq_table[0].frequency;
-}
-
-static unsigned extract_freq(u32 val, struct acpi_cpufreq_data *data)
-{
-    switch (data->arch_cpu_flags) {
-    case SYSTEM_INTEL_MSR_CAPABLE:
-        return extract_msr(val, data);
-    case SYSTEM_IO_CAPABLE:
-        return extract_io(val, data);
-    default:
-        return 0;
-    }
-}
-
-struct msr_addr {
-    u32 reg;
-};
-
-struct io_addr {
-    u16 port;
-    u8 bit_width;
-};
-
-typedef union {
-    struct msr_addr msr;
-    struct io_addr io;
-} drv_addr_union;
-
-struct drv_cmd {
-    unsigned int type;
-    const cpumask_t *mask;
-    drv_addr_union addr;
-    u32 val;
-};
-
-static void cf_check do_drv_read(void *drvcmd)
-{
-    struct drv_cmd *cmd;
-
-    cmd = (struct drv_cmd *)drvcmd;
-
-    switch (cmd->type) {
-    case SYSTEM_INTEL_MSR_CAPABLE:
-        rdmsrl(cmd->addr.msr.reg, cmd->val);
-        break;
-    case SYSTEM_IO_CAPABLE:
-        acpi_os_read_port((acpi_io_address)cmd->addr.io.port,
-            &cmd->val, (u32)cmd->addr.io.bit_width);
-        break;
-    default:
-        break;
-    }
-}
-
-static void cf_check do_drv_write(void *drvcmd)
-{
-    struct drv_cmd *cmd;
-    uint64_t msr_content;
-
-    cmd = (struct drv_cmd *)drvcmd;
-
-    switch (cmd->type) {
-    case SYSTEM_INTEL_MSR_CAPABLE:
-        rdmsrl(cmd->addr.msr.reg, msr_content);
-        msr_content = (msr_content & ~INTEL_MSR_RANGE)
-            | (cmd->val & INTEL_MSR_RANGE);
-        wrmsrl(cmd->addr.msr.reg, msr_content);
-        break;
-    case SYSTEM_IO_CAPABLE:
-        acpi_os_write_port((acpi_io_address)cmd->addr.io.port,
-            cmd->val, (u32)cmd->addr.io.bit_width);
-        break;
-    default:
-        break;
-    }
-}
-
-static void drv_read(struct drv_cmd *cmd)
-{
-    cmd->val = 0;
-
-    ASSERT(cpumask_weight(cmd->mask) == 1);
-
-    /* to reduce IPI for the sake of performance */
-    if (likely(cpumask_test_cpu(smp_processor_id(), cmd->mask)))
-        do_drv_read((void *)cmd);
-    else
-        on_selected_cpus(cmd->mask, do_drv_read, cmd, 1);
-}
-
-static void drv_write(struct drv_cmd *cmd)
-{
-    if (cpumask_equal(cmd->mask, cpumask_of(smp_processor_id())))
-        do_drv_write((void *)cmd);
-    else
-        on_selected_cpus(cmd->mask, do_drv_write, cmd, 1);
-}
-
-static u32 get_cur_val(const cpumask_t *mask)
-{
-    struct cpufreq_policy *policy;
-    struct processor_performance *perf;
-    struct drv_cmd cmd;
-    unsigned int cpu = smp_processor_id();
-
-    if (unlikely(cpumask_empty(mask)))
-        return 0;
-
-    if (!cpumask_test_cpu(cpu, mask))
-        cpu = cpumask_first(mask);
-    if (cpu >= nr_cpu_ids || !cpu_online(cpu))
-        return 0;
-
-    policy = per_cpu(cpufreq_cpu_policy, cpu);
-    if (!policy || !cpufreq_drv_data[policy->cpu])
-        return 0;    
-
-    switch (cpufreq_drv_data[policy->cpu]->arch_cpu_flags) {
-    case SYSTEM_INTEL_MSR_CAPABLE:
-        cmd.type = SYSTEM_INTEL_MSR_CAPABLE;
-        cmd.addr.msr.reg = MSR_IA32_PERF_STATUS;
-        break;
-    case SYSTEM_IO_CAPABLE:
-        cmd.type = SYSTEM_IO_CAPABLE;
-        perf = cpufreq_drv_data[policy->cpu]->acpi_data;
-        cmd.addr.io.port = perf->control_register.address;
-        cmd.addr.io.bit_width = perf->control_register.bit_width;
-        break;
-    default:
-        return 0;
-    }
-
-    cmd.mask = cpumask_of(cpu);
-
-    drv_read(&cmd);
-    return cmd.val;
-}
-
 struct perf_pair {
     union {
         struct {
@@ -255,7 +69,7 @@ static void cf_check read_measured_perf_ctrs(void *_readin)
  */
 unsigned int get_measured_perf(unsigned int cpu, unsigned int flag)
 {
-    struct cpufreq_policy *policy;    
+    struct cpufreq_policy *policy;
     struct perf_pair readin, cur, *saved;
     unsigned int perf_percent;
 
@@ -308,322 +122,6 @@ unsigned int get_measured_perf(unsigned int cpu, unsigned int flag)
     return policy->cpuinfo.perf_freq * perf_percent / 100;
 }
 
-static unsigned int cf_check get_cur_freq_on_cpu(unsigned int cpu)
-{
-    struct cpufreq_policy *policy;
-    struct acpi_cpufreq_data *data;
-
-    if (!cpu_online(cpu))
-        return 0;
-
-    policy = per_cpu(cpufreq_cpu_policy, cpu);
-    if (!policy)
-        return 0;
-
-    data = cpufreq_drv_data[policy->cpu];
-    if (unlikely(data == NULL ||
-        data->acpi_data == NULL || data->freq_table == NULL))
-        return 0;
-
-    return extract_freq(get_cur_val(cpumask_of(cpu)), data);
-}
-
-void intel_feature_detect(struct cpufreq_policy *policy)
-{
-    unsigned int eax;
-
-    eax = cpuid_eax(6);
-    if (eax & 0x2) {
-        policy->turbo = CPUFREQ_TURBO_ENABLED;
-        if (cpufreq_verbose)
-            printk(XENLOG_INFO "CPU%u: Turbo Mode detected and enabled\n",
-                   smp_processor_id());
-    }
-}
-
-static void cf_check feature_detect(void *info)
-{
-    intel_feature_detect(info);
-}
-
-static unsigned int check_freqs(const cpumask_t *mask, unsigned int freq,
-                                struct acpi_cpufreq_data *data)
-{
-    unsigned int cur_freq;
-    unsigned int i;
-
-    for (i=0; i<100; i++) {
-        cur_freq = extract_freq(get_cur_val(mask), data);
-        if (cur_freq == freq)
-            return 1;
-        udelay(10);
-    }
-    return 0;
-}
-
-static int cf_check acpi_cpufreq_target(
-    struct cpufreq_policy *policy,
-    unsigned int target_freq, unsigned int relation)
-{
-    struct acpi_cpufreq_data *data = cpufreq_drv_data[policy->cpu];
-    struct processor_performance *perf;
-    struct cpufreq_freqs freqs;
-    cpumask_t online_policy_cpus;
-    struct drv_cmd cmd;
-    unsigned int next_state = 0; /* Index into freq_table */
-    unsigned int next_perf_state = 0; /* Index into perf table */
-    unsigned int j;
-    int result = 0;
-
-    if (unlikely(data == NULL ||
-        data->acpi_data == NULL || data->freq_table == NULL)) {
-        return -ENODEV;
-    }
-
-    if (policy->turbo == CPUFREQ_TURBO_DISABLED)
-        if (target_freq > policy->cpuinfo.second_max_freq)
-            target_freq = policy->cpuinfo.second_max_freq;
-
-    perf = data->acpi_data;
-    result = cpufreq_frequency_table_target(policy,
-                                            data->freq_table,
-                                            target_freq,
-                                            relation, &next_state);
-    if (unlikely(result))
-        return -ENODEV;
-
-    cpumask_and(&online_policy_cpus, &cpu_online_map, policy->cpus);
-
-    next_perf_state = data->freq_table[next_state].index;
-    if (perf->state == next_perf_state) {
-        if (unlikely(policy->resume))
-            policy->resume = 0;
-        else
-            return 0;
-    }
-
-    switch (data->arch_cpu_flags) {
-    case SYSTEM_INTEL_MSR_CAPABLE:
-        cmd.type = SYSTEM_INTEL_MSR_CAPABLE;
-        cmd.addr.msr.reg = MSR_IA32_PERF_CTL;
-        cmd.val = (u32) perf->states[next_perf_state].control;
-        break;
-    case SYSTEM_IO_CAPABLE:
-        cmd.type = SYSTEM_IO_CAPABLE;
-        cmd.addr.io.port = perf->control_register.address;
-        cmd.addr.io.bit_width = perf->control_register.bit_width;
-        cmd.val = (u32) perf->states[next_perf_state].control;
-        break;
-    default:
-        return -ENODEV;
-    }
-
-    if (policy->shared_type != CPUFREQ_SHARED_TYPE_ANY)
-        cmd.mask = &online_policy_cpus;
-    else
-        cmd.mask = cpumask_of(policy->cpu);
-
-    freqs.old = perf->states[perf->state].core_frequency * 1000;
-    freqs.new = data->freq_table[next_state].frequency;
-
-    drv_write(&cmd);
-
-    if (acpi_pstate_strict && !check_freqs(cmd.mask, freqs.new, data)) {
-        printk(KERN_WARNING "Fail transfer to new freq %d\n", freqs.new);
-        return -EAGAIN;
-    }
-
-    for_each_cpu(j, &online_policy_cpus)
-        cpufreq_statistic_update(j, perf->state, next_perf_state);
-
-    perf->state = next_perf_state;
-    policy->cur = freqs.new;
-
-    return result;
-}
-
-static int cf_check acpi_cpufreq_verify(struct cpufreq_policy *policy)
-{
-    struct acpi_cpufreq_data *data;
-    struct processor_performance *perf;
-
-    if (!policy || !(data = cpufreq_drv_data[policy->cpu]) ||
-        !processor_pminfo[policy->cpu])
-        return -EINVAL;
-
-    perf = &processor_pminfo[policy->cpu]->perf;
-
-    cpufreq_verify_within_limits(policy, 0, 
-        perf->states[perf->platform_limit].core_frequency * 1000);
-
-    return cpufreq_frequency_table_verify(policy, data->freq_table);
-}
-
-static unsigned long
-acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu)
-{
-    struct processor_performance *perf = data->acpi_data;
-
-    if (cpu_khz) {
-        /* search the closest match to cpu_khz */
-        unsigned int i;
-        unsigned long freq;
-        unsigned long freqn = perf->states[0].core_frequency * 1000;
-
-        for (i=0; i<(perf->state_count-1); i++) {
-            freq = freqn;
-            freqn = perf->states[i+1].core_frequency * 1000;
-            if ((2 * cpu_khz) > (freqn + freq)) {
-                perf->state = i;
-                return freq;
-            }
-        }
-        perf->state = perf->state_count-1;
-        return freqn;
-    } else {
-        /* assume CPU is at P0... */
-        perf->state = 0;
-        return perf->states[0].core_frequency * 1000;
-    }
-}
-
-static int cf_check acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
-{
-    unsigned int i;
-    unsigned int valid_states = 0;
-    unsigned int cpu = policy->cpu;
-    struct acpi_cpufreq_data *data;
-    unsigned int result = 0;
-    struct cpuinfo_x86 *c = &cpu_data[policy->cpu];
-    struct processor_performance *perf;
-
-    data = xzalloc(struct acpi_cpufreq_data);
-    if (!data)
-        return -ENOMEM;
-
-    cpufreq_drv_data[cpu] = data;
-
-    data->acpi_data = &processor_pminfo[cpu]->perf;
-
-    perf = data->acpi_data;
-    policy->shared_type = perf->shared_type;
-
-    switch (perf->control_register.space_id) {
-    case ACPI_ADR_SPACE_SYSTEM_IO:
-        if (cpufreq_verbose)
-            printk("xen_pminfo: @acpi_cpufreq_cpu_init,"
-                   "SYSTEM IO addr space\n");
-        data->arch_cpu_flags = SYSTEM_IO_CAPABLE;
-        break;
-    case ACPI_ADR_SPACE_FIXED_HARDWARE:
-        if (cpufreq_verbose)
-            printk("xen_pminfo: @acpi_cpufreq_cpu_init,"
-                   "HARDWARE addr space\n");
-        if (!cpu_has(c, X86_FEATURE_EIST)) {
-            result = -ENODEV;
-            goto err_unreg;
-        }
-        data->arch_cpu_flags = SYSTEM_INTEL_MSR_CAPABLE;
-        break;
-    default:
-        result = -ENODEV;
-        goto err_unreg;
-    }
-
-    data->freq_table = xmalloc_array(struct cpufreq_frequency_table, 
-                                    (perf->state_count+1));
-    if (!data->freq_table) {
-        result = -ENOMEM;
-        goto err_unreg;
-    }
-
-    /* detect transition latency */
-    policy->cpuinfo.transition_latency = 0;
-    for (i=0; i<perf->state_count; i++) {
-        if ((perf->states[i].transition_latency * 1000) >
-            policy->cpuinfo.transition_latency)
-            policy->cpuinfo.transition_latency =
-                perf->states[i].transition_latency * 1000;
-    }
-
-    policy->governor = cpufreq_opt_governor ? : CPUFREQ_DEFAULT_GOVERNOR;
-
-    /* table init */
-    for (i=0; i<perf->state_count; i++) {
-        if (i>0 && perf->states[i].core_frequency >=
-            data->freq_table[valid_states-1].frequency / 1000)
-            continue;
-
-        data->freq_table[valid_states].index = i;
-        data->freq_table[valid_states].frequency =
-            perf->states[i].core_frequency * 1000;
-        valid_states++;
-    }
-    data->freq_table[valid_states].frequency = CPUFREQ_TABLE_END;
-    perf->state = 0;
-
-    result = cpufreq_frequency_table_cpuinfo(policy, data->freq_table);
-    if (result)
-        goto err_freqfree;
-
-    switch (perf->control_register.space_id) {
-    case ACPI_ADR_SPACE_SYSTEM_IO:
-        /* Current speed is unknown and not detectable by IO port */
-        policy->cur = acpi_cpufreq_guess_freq(data, policy->cpu);
-        break;
-    case ACPI_ADR_SPACE_FIXED_HARDWARE:
-        cpufreq_driver.get = get_cur_freq_on_cpu;
-        policy->cur = get_cur_freq_on_cpu(cpu);
-        break;
-    default:
-        break;
-    }
-
-    /* Check for APERF/MPERF support in hardware
-     * also check for boost support */
-    if (c->x86_vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6)
-        on_selected_cpus(cpumask_of(cpu), feature_detect, policy, 1);
-
-    /*
-     * the first call to ->target() should result in us actually
-     * writing something to the appropriate registers.
-     */
-    policy->resume = 1;
-
-    return result;
-
-err_freqfree:
-    xfree(data->freq_table);
-err_unreg:
-    xfree(data);
-    cpufreq_drv_data[cpu] = NULL;
-
-    return result;
-}
-
-static int cf_check acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy)
-{
-    struct acpi_cpufreq_data *data = cpufreq_drv_data[policy->cpu];
-
-    if (data) {
-        cpufreq_drv_data[policy->cpu] = NULL;
-        xfree(data->freq_table);
-        xfree(data);
-    }
-
-    return 0;
-}
-
-static const struct cpufreq_driver __initconst_cf_clobber
-acpi_cpufreq_driver = {
-    .name   = "acpi-cpufreq",
-    .verify = acpi_cpufreq_verify,
-    .target = acpi_cpufreq_target,
-    .init   = acpi_cpufreq_cpu_init,
-    .exit   = acpi_cpufreq_cpu_exit,
-    .get    = get_cur_freq_on_cpu,
-};
-
 static int __init cf_check cpufreq_driver_init(void)
 {
     int ret = 0;
@@ -640,7 +138,7 @@ static int __init cf_check cpufreq_driver_init(void)
                 switch ( cpufreq_xen_opts[i] )
                 {
                 case CPUFREQ_xen:
-                    ret = cpufreq_register_driver(&acpi_cpufreq_driver);
+                    ret = acpi_cpufreq_register();
                     break;
                 case CPUFREQ_hwp:
                     ret = hwp_register_driver();
diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h
index 443427153b..ec7e139000 100644
--- a/xen/include/acpi/cpufreq/cpufreq.h
+++ b/xen/include/acpi/cpufreq/cpufreq.h
@@ -260,4 +260,6 @@ int get_hwp_para(unsigned int cpu,
 int set_hwp_para(struct cpufreq_policy *policy,
                  struct xen_set_cppc_para *set_cppc);
 
+int acpi_cpufreq_register(void);
+
 #endif /* __XEN_CPUFREQ_PM_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 01 07:44:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Aug 2024 07:44:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.769415.1180300 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZQUY-00021c-VA; Thu, 01 Aug 2024 07:44:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 769415.1180300; Thu, 01 Aug 2024 07: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 1sZQUY-00021U-SV; Thu, 01 Aug 2024 07:44:54 +0000
Received: by outflank-mailman (input) for mailman id 769415;
 Thu, 01 Aug 2024 07:44:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQUY-00021N-91
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:44:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQUY-00080Z-88
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:44:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQUY-00067m-7G
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vsLjRTcfZ8RzfbBFVrwpI4G7U8tlGpc4wEBMNmbQvyc=; b=Bf2jSpN2xqayfKg1tWBsSLdV2y
	ddreFdhbcn1Y8pnUOejwFkWmFCpEqszE+iTFtAVhfSiVpDsquMA+maKO8FLRCx5KeLpBZLP9T2eNg
	ojb7zPypYFErQD7ynDpmGkkCzhzgP7+0qe2geUF1QIKEwBKl/FPmXi1pHJq2LQ8KBF10=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/cpufreq: separate powernow/hwp/acpi cpufreq code
Message-Id: <E1sZQUY-00067m-7G@xenbits.xenproject.org>
Date: Thu, 01 Aug 2024 07:44:54 +0000

commit f96d008fb006751385a2c381d4ad0b9526a89a1e
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Thu Aug 1 09:41:03 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 09:41:03 2024 +0200

    x86/cpufreq: separate powernow/hwp/acpi cpufreq code
    
    Build AMD Architectural P-state driver when CONFIG_AMD is on, and
    Intel Hardware P-States driver together with ACPI Processor P-States driver
    when CONFIG_INTEL is on respectively, allowing for a platform-specific build.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/cpufreq/Makefile  | 6 +++---
 xen/arch/x86/acpi/cpufreq/cpufreq.c | 8 +++++---
 xen/drivers/acpi/pmstat.c           | 5 +++--
 xen/drivers/cpufreq/cpufreq.c       | 3 ++-
 xen/include/acpi/cpufreq/cpufreq.h  | 5 +++++
 5 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/acpi/cpufreq/Makefile b/xen/arch/x86/acpi/cpufreq/Makefile
index 44d4c0b497..e7dbe434a8 100644
--- a/xen/arch/x86/acpi/cpufreq/Makefile
+++ b/xen/arch/x86/acpi/cpufreq/Makefile
@@ -1,4 +1,4 @@
-obj-y += acpi.o
+obj-$(CONFIG_INTEL) += acpi.o
 obj-y += cpufreq.o
-obj-y += hwp.o
-obj-y += powernow.o
+obj-$(CONFIG_INTEL) += hwp.o
+obj-$(CONFIG_AMD) += powernow.o
diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufreq/cpufreq.c
index 6244d29496..61e98b67bd 100644
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c
@@ -138,10 +138,12 @@ static int __init cf_check cpufreq_driver_init(void)
                 switch ( cpufreq_xen_opts[i] )
                 {
                 case CPUFREQ_xen:
-                    ret = acpi_cpufreq_register();
+                    ret = IS_ENABLED(CONFIG_INTEL) ?
+                          acpi_cpufreq_register() : -ENODEV;
                     break;
                 case CPUFREQ_hwp:
-                    ret = hwp_register_driver();
+                    ret = IS_ENABLED(CONFIG_INTEL) ?
+                          hwp_register_driver() : -ENODEV;
                     break;
                 case CPUFREQ_none:
                     ret = 0;
@@ -155,7 +157,7 @@ static int __init cf_check cpufreq_driver_init(void)
 
         case X86_VENDOR_AMD:
         case X86_VENDOR_HYGON:
-            ret = powernow_register_driver();
+            ret = IS_ENABLED(CONFIG_AMD) ? powernow_register_driver() : -ENODEV;
             break;
         }
     }
diff --git a/xen/drivers/acpi/pmstat.c b/xen/drivers/acpi/pmstat.c
index 998d2e3c65..df309e27b4 100644
--- a/xen/drivers/acpi/pmstat.c
+++ b/xen/drivers/acpi/pmstat.c
@@ -254,8 +254,9 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
     else
         strlcpy(op->u.get_para.scaling_driver, "Unknown", CPUFREQ_NAME_LEN);
 
-    if ( !strncmp(op->u.get_para.scaling_driver, XEN_HWP_DRIVER_NAME,
-                      CPUFREQ_NAME_LEN) )
+    if ( IS_ENABLED(CONFIG_INTEL) &&
+         !strncmp(op->u.get_para.scaling_driver, XEN_HWP_DRIVER_NAME,
+                  CPUFREQ_NAME_LEN) )
         ret = get_hwp_para(policy->cpu, &op->u.get_para.u.cppc_para);
     else
     {
diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c
index 8659ad3aee..4a103c6de9 100644
--- a/xen/drivers/cpufreq/cpufreq.c
+++ b/xen/drivers/cpufreq/cpufreq.c
@@ -120,7 +120,8 @@ static int __init cf_check setup_cpufreq_option(const char *str)
             if ( arg[0] && arg[1] )
                 ret = cpufreq_cmdline_parse(arg + 1, end);
         }
-        else if ( choice < 0 && !cmdline_strcmp(str, "hwp") )
+        else if ( IS_ENABLED(CONFIG_INTEL) && choice < 0 &&
+                  !cmdline_strcmp(str, "hwp") )
         {
             xen_processor_pmbits |= XEN_PROCESSOR_PM_PX;
             cpufreq_controller = FREQCTL_xen;
diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h
index ec7e139000..b6cff825ce 100644
--- a/xen/include/acpi/cpufreq/cpufreq.h
+++ b/xen/include/acpi/cpufreq/cpufreq.h
@@ -254,7 +254,12 @@ void intel_feature_detect(struct cpufreq_policy *policy);
 
 int hwp_cmdline_parse(const char *s, const char *e);
 int hwp_register_driver(void);
+#ifdef CONFIG_INTEL
 bool hwp_active(void);
+#else
+static inline bool hwp_active(void) { return false; }
+#endif
+
 int get_hwp_para(unsigned int cpu,
                  struct xen_cppc_para *cppc_para);
 int set_hwp_para(struct cpufreq_policy *policy,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 01 07:45:05 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Aug 2024 07:45:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.769416.1180305 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZQUj-000244-13; Thu, 01 Aug 2024 07:45:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 769416.1180305; Thu, 01 Aug 2024 07:45: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 1sZQUi-00023w-Tz; Thu, 01 Aug 2024 07:45:04 +0000
Received: by outflank-mailman (input) for mailman id 769416;
 Thu, 01 Aug 2024 07:45:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQUi-00023q-C6
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:45:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQUi-000819-B3
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:45:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQUi-00068W-AH
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:45: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bS//YG37fG/Y/RaCL83ngEgonz+MU4wrsChSQPIz2+E=; b=DPBNJtWq3jXhzuXAA3BKSVEvQx
	mRm0Xpa47inRoEVeEeRh3ImQpmbziLMqkjiaA+6TDVqJ8cNG/nPh4rvmOzI8h5BDzH+1nLG5WjD7z
	8r14CkmoqCHhaQX2xGRRKIEZTs/tKpJrbtZ+79LXN+10GTq/FzcVq23aOJnamJxGpblk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: use printk() instead of early_printk()
Message-Id: <E1sZQUi-00068W-AH@xenbits.xenproject.org>
Date: Thu, 01 Aug 2024 07:45:04 +0000

commit b07e1e079406c063750fb5795e260a7a2ea7bbde
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Aug 1 09:41:25 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 09:41:25 2024 +0200

    xen/riscv: use printk() instead of early_printk()
    
    As common code is available it is better to use printk() instead
    of early_printk().
    
    Also the printing of "Hello from RISC-V world" is dropped as
    it is useless and "All set up is enough".
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/setup.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index 8bb5bdb2ae..e3cb0866d5 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -23,9 +23,7 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
 {
     remove_identity_mapping();
 
-    early_printk("Hello from C env\n");
-
-    early_printk("All set up\n");
+    printk("All set up\n");
 
     for ( ;; )
         asm volatile ("wfi");
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 01 07:45:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Aug 2024 07:45:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.769417.1180307 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZQUt-00026j-2G; Thu, 01 Aug 2024 07:45:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 769417.1180307; Thu, 01 Aug 2024 07:45: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 1sZQUs-00026b-Vs; Thu, 01 Aug 2024 07:45:14 +0000
Received: by outflank-mailman (input) for mailman id 769417;
 Thu, 01 Aug 2024 07:45:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQUs-00026V-Ek
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:45:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQUs-00081I-Dv
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:45:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQUs-000690-D9
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:45: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qHFnSsFd5Q9mPlt4EWDfOKyT89K1XX0plE+wrmQcK/M=; b=x9x+MX1HSQzAgktGa93UZdqC/V
	QneOhK0btRyyqUYLnkAkZ3Fw6VFdrm9s6zvsarklqBm3TDf1FioJT2/0pyST5/pdc9bgXZHSvM24i
	Eddw6vng6bZSYGUGIXsG/Gzp9ye1nT5VI3Metk8u78KfgQoCFy/zVVAQmiaG1pneviSQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: introduce decode_cause() stuff
Message-Id: <E1sZQUs-000690-D9@xenbits.xenproject.org>
Date: Thu, 01 Aug 2024 07:45:14 +0000

commit 38e767010524fec09bb50abccefc44379f043cf5
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Aug 1 09:42:27 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 09:42:27 2024 +0200

    xen/riscv: introduce decode_cause() stuff
    
    The patch introduces stuff needed to decode a reason of an
    exception.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Alistair Francis <alistair.francis@wdc.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/traps.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 79 insertions(+), 1 deletion(-)

diff --git a/xen/arch/riscv/traps.c b/xen/arch/riscv/traps.c
index 5415cf8d90..37cec40dfa 100644
--- a/xen/arch/riscv/traps.c
+++ b/xen/arch/riscv/traps.c
@@ -9,13 +9,91 @@
 #include <xen/sched.h>
 
 #include <asm/processor.h>
+#include <asm/riscv_encoding.h>
 #include <asm/traps.h>
 
-void do_trap(struct cpu_user_regs *cpu_regs)
+static const char *decode_trap_cause(unsigned long cause)
+{
+    static const char *const trap_causes[] = {
+        [CAUSE_MISALIGNED_FETCH] = "Instruction Address Misaligned",
+        [CAUSE_FETCH_ACCESS] = "Instruction Access Fault",
+        [CAUSE_ILLEGAL_INSTRUCTION] = "Illegal Instruction",
+        [CAUSE_BREAKPOINT] = "Breakpoint",
+        [CAUSE_MISALIGNED_LOAD] = "Load Address Misaligned",
+        [CAUSE_LOAD_ACCESS] = "Load Access Fault",
+        [CAUSE_MISALIGNED_STORE] = "Store/AMO Address Misaligned",
+        [CAUSE_STORE_ACCESS] = "Store/AMO Access Fault",
+        [CAUSE_USER_ECALL] = "Environment Call from U-Mode",
+        [CAUSE_SUPERVISOR_ECALL] = "Environment Call from S-Mode",
+        [CAUSE_MACHINE_ECALL] = "Environment Call from M-Mode",
+        [CAUSE_FETCH_PAGE_FAULT] = "Instruction Page Fault",
+        [CAUSE_LOAD_PAGE_FAULT] = "Load Page Fault",
+        [CAUSE_STORE_PAGE_FAULT] = "Store/AMO Page Fault",
+        [CAUSE_FETCH_GUEST_PAGE_FAULT] = "Instruction Guest Page Fault",
+        [CAUSE_LOAD_GUEST_PAGE_FAULT] = "Load Guest Page Fault",
+        [CAUSE_VIRTUAL_INST_FAULT] = "Virtualized Instruction Fault",
+        [CAUSE_STORE_GUEST_PAGE_FAULT] = "Guest Store/AMO Page Fault",
+    };
+
+    if ( cause < ARRAY_SIZE(trap_causes) && trap_causes[cause] )
+        return trap_causes[cause];
+    return "UNKNOWN";
+}
+
+static const char *decode_reserved_interrupt_cause(unsigned long irq_cause)
+{
+    switch ( irq_cause )
+    {
+    case IRQ_M_SOFT:
+        return "M-mode Software Interrupt";
+    case IRQ_M_TIMER:
+        return "M-mode Timer Interrupt";
+    case IRQ_M_EXT:
+        return "M-mode External Interrupt";
+    default:
+        return "UNKNOWN IRQ type";
+    }
+}
+
+static const char *decode_interrupt_cause(unsigned long cause)
+{
+    unsigned long irq_cause = cause & ~CAUSE_IRQ_FLAG;
+
+    switch ( irq_cause )
+    {
+    case IRQ_S_SOFT:
+        return "Supervisor Software Interrupt";
+    case IRQ_S_TIMER:
+        return "Supervisor Timer Interrupt";
+    case IRQ_S_EXT:
+        return "Supervisor External Interrupt";
+    default:
+        return decode_reserved_interrupt_cause(irq_cause);
+    }
+}
+
+static const char *decode_cause(unsigned long cause)
+{
+    if ( cause & CAUSE_IRQ_FLAG )
+        return decode_interrupt_cause(cause);
+
+    return decode_trap_cause(cause);
+}
+
+static void do_unexpected_trap(const struct cpu_user_regs *regs)
 {
+    unsigned long cause = csr_read(CSR_SCAUSE);
+
+    printk("Unhandled exception: %s\n", decode_cause(cause));
+
     die();
 }
 
+void do_trap(struct cpu_user_regs *cpu_regs)
+{
+    do_unexpected_trap(cpu_regs);
+}
+
 void vcpu_show_execution_state(struct vcpu *v)
 {
     BUG_ON("unimplemented");
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 01 07:45:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Aug 2024 07:45:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.769418.1180311 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZQV3-00029S-3c; Thu, 01 Aug 2024 07:45:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 769418.1180311; Thu, 01 Aug 2024 07:45: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 1sZQV3-00029L-1A; Thu, 01 Aug 2024 07:45:25 +0000
Received: by outflank-mailman (input) for mailman id 769418;
 Thu, 01 Aug 2024 07:45:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQV2-00029B-Hb
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:45:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQV2-00081V-Gk
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:45:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQV2-00069h-G4
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 07:45: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=u95K8Uwy97efPi2sFb1108gYZyvSviAHlG8c8HC66nE=; b=XSzGg18yGBWyrgxtP2qHEqVUHy
	QX9QzlpWR4mKdXUs7vjYut4TNsofoBWwkDtAwxVPcPhS+Rr3PPtKk7QaBqjD4+Sv3wZY3VC8vvN5f
	KHLCGQ+BdRqkMl5Y6DqtQpvB5vxRHlAQ9L50LqWPszTgmj/iicjdGdjJm4kKZMCS5qdA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: introduce trap_init()
Message-Id: <E1sZQV2-00069h-G4@xenbits.xenproject.org>
Date: Thu, 01 Aug 2024 07:45:24 +0000

commit f2dc25686b6c90fc631525e4b9e6537154ee4b0b
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Aug 1 09:42:54 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 09:42:54 2024 +0200

    xen/riscv: introduce trap_init()
    
    Note that trap_init() isn't declared with the __init attribute to
    avoid removing __init when multi-CPU support for Xen is added.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/traps.h |  1 +
 xen/arch/riscv/setup.c             |  3 +++
 xen/arch/riscv/traps.c             | 12 ++++++++++++
 3 files changed, 16 insertions(+)

diff --git a/xen/arch/riscv/include/asm/traps.h b/xen/arch/riscv/include/asm/traps.h
index 3fef318478..c30118e095 100644
--- a/xen/arch/riscv/include/asm/traps.h
+++ b/xen/arch/riscv/include/asm/traps.h
@@ -9,6 +9,7 @@
 
 void do_trap(struct cpu_user_regs *cpu_regs);
 void handle_trap(void);
+void trap_init(void);
 
 #endif /* __ASSEMBLY__ */
 
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index e3cb0866d5..a6a29a1508 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -8,6 +8,7 @@
 #include <public/version.h>
 
 #include <asm/early_printk.h>
+#include <asm/traps.h>
 
 void arch_get_xen_caps(xen_capabilities_info_t *info)
 {
@@ -23,6 +24,8 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
 {
     remove_identity_mapping();
 
+    trap_init();
+
     printk("All set up\n");
 
     for ( ;; )
diff --git a/xen/arch/riscv/traps.c b/xen/arch/riscv/traps.c
index 37cec40dfa..cb18b30ff2 100644
--- a/xen/arch/riscv/traps.c
+++ b/xen/arch/riscv/traps.c
@@ -12,6 +12,18 @@
 #include <asm/riscv_encoding.h>
 #include <asm/traps.h>
 
+/*
+ * Initialize the trap handling.
+ *
+ * The function is called after MMU is enabled.
+ */
+void trap_init(void)
+{
+    unsigned long addr = (unsigned long)&handle_trap;
+
+    csr_write(CSR_STVEC, addr);
+}
+
 static const char *decode_trap_cause(unsigned long cause)
 {
     static const char *const trap_causes[] = {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 01 08:11:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Aug 2024 08:11:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.769437.1180326 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZQtr-0007R9-6Y; Thu, 01 Aug 2024 08:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 769437.1180326; Thu, 01 Aug 2024 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 1sZQtr-0007R1-3h; Thu, 01 Aug 2024 08:11:03 +0000
Received: by outflank-mailman (input) for mailman id 769437;
 Thu, 01 Aug 2024 08:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQtp-0007Qt-VE
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 08:11:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQtp-0000dR-Tv
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 08:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQtp-0008Cf-Sv
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 08: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=072Ujbnr8mloH79w+WOynNpirGsooNfVaGwJOvE9UMw=; b=jc5TA+84uNvlYPvj6EY/KXPGPo
	DU/ZgVpomXzzjJUjTWG6D3o0ohw79vZJUk97e8jDGSEHUBDhGm671G6YvH3qN+shq95rajjmDQNJq
	hjKftikt6T8QmAZa35KC39Kza6lAkiRsq7YMqqN2ZANgtP49ZA8qvpBBEfBrWGE+gd7c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/event: address violation of MISRA C Rule 13.6
Message-Id: <E1sZQtp-0008Cf-Sv@xenbits.xenproject.org>
Date: Thu, 01 Aug 2024 08:11:01 +0000

commit 04c031d9a10e99bdcdb736d4c84454b9c79d1144
Author:     Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
AuthorDate: Tue Jun 25 12:14:20 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Jul 30 15:14:31 2024 -0700

    xen/event: address violation of MISRA C Rule 13.6
    
    In the file include/xen/event.h macro set_bit is called with argument
    current->pause_flags.
    Once expanded this set_bit's argument is used in sizeof operations
    and thus 'current', being a macro that expands to a function
    call with potential side effects, generates a violation.
    
    To address this violation the value of current is therefore stored in a
    variable called 'v' before passing it to macro set_bit.
    
    No functional change.
    
    Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/include/xen/event.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/xen/include/xen/event.h b/xen/include/xen/event.h
index f1472ea1eb..48b79f3d62 100644
--- a/xen/include/xen/event.h
+++ b/xen/include/xen/event.h
@@ -183,13 +183,14 @@ static bool evtchn_usable(const struct evtchn *evtchn)
 /* Wait on a Xen-attached event channel. */
 #define wait_on_xen_event_channel(port, condition)                      \
     do {                                                                \
+        struct vcpu *v = current;                                       \
         if ( condition )                                                \
             break;                                                      \
-        set_bit(_VPF_blocked_in_xen, &current->pause_flags);            \
+        set_bit(_VPF_blocked_in_xen, &v->pause_flags);                  \
         smp_mb(); /* set blocked status /then/ re-evaluate condition */ \
         if ( condition )                                                \
         {                                                               \
-            clear_bit(_VPF_blocked_in_xen, &current->pause_flags);      \
+            clear_bit(_VPF_blocked_in_xen, &v->pause_flags);            \
             break;                                                      \
         }                                                               \
         raise_softirq(SCHEDULE_SOFTIRQ);                                \
@@ -198,7 +199,8 @@ static bool evtchn_usable(const struct evtchn *evtchn)
 
 #define prepare_wait_on_xen_event_channel(port)                         \
     do {                                                                \
-        set_bit(_VPF_blocked_in_xen, &current->pause_flags);            \
+        struct vcpu *v = current;                                       \
+        set_bit(_VPF_blocked_in_xen, &v->pause_flags);                  \
         raise_softirq(SCHEDULE_SOFTIRQ);                                \
         smp_mb(); /* set blocked status /then/ caller does his work */  \
     } while ( 0 )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 01 08:11:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Aug 2024 08:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.769438.1180329 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZQu1-0007TK-81; Thu, 01 Aug 2024 08:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 769438.1180329; Thu, 01 Aug 2024 08: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 1sZQu1-0007TC-5B; Thu, 01 Aug 2024 08:11:13 +0000
Received: by outflank-mailman (input) for mailman id 769438;
 Thu, 01 Aug 2024 08:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQu0-0007T4-1W
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 08:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQu0-0000dZ-0h
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 08:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQtz-0008DV-W5
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 08: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=otCGhDPVtwiuDT0ZvvREitOvRTW5oCwtvg0V3g60LQI=; b=G/SIUJdNEBBDpea9iZ5TV6Vxlw
	/YmiPNx4pp27Gn53qjwZYkzWvSKuqm5u8R9TU+yiYym+d2TxZnc5MGWZ9BucrDKXxrxGENaZ7huFm
	cCQVa51Z2qAJ9NBGFduADbc5VJ0HZ2laAe2XGmqdt1oJ8vLF1FLErviCSrOdaKT6oa2w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs/misra: rules for mass adoption
Message-Id: <E1sZQtz-0008DV-W5@xenbits.xenproject.org>
Date: Thu, 01 Aug 2024 08:11:11 +0000

commit 7d60eaf28d86a09bf7c41dee06cb3bc5e7aae89f
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Tue Jun 25 18:39:22 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Jul 30 15:14:31 2024 -0700

    docs/misra: rules for mass adoption
    
    This patch adds a bunch of rules to rules.rst that are uncontroversial
    and have zero violations in Xen. As such, they have been approved for
    adoption.
    
    All the ones that regard the standard library have the link to the
    existing footnote in the notes.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 docs/misra/rules.rst | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 104 insertions(+)

diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index 80e5e972ad..2e11566e20 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -580,6 +580,11 @@ maintainers if you want to suggest a change.
      - The relational operators > >= < and <= shall not be applied to objects of pointer type except where they point into the same object
      -
 
+   * - `Rule 18.8 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_18_08.c>`_
+     - Required
+     - Variable-length array types shall not be used
+     -
+
    * - `Rule 19.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_19_01.c>`_
      - Mandatory
      - An object shall not be assigned or copied to an overlapping
@@ -589,11 +594,29 @@ maintainers if you want to suggest a change.
        instances where Eclair is unable to verify that the code is valid
        in regard to Rule 19.1. Caution reports are not violations.
 
+   * - `Rule 20.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_20_02.c>`_
+     - Required
+     - The ', " or \ characters and the /* or // character sequences
+       shall not occur in a header file name
+     -
+
+   * - `Rule 20.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_20_03.c>`_
+     - Required
+     - The #include directive shall be followed by either a <filename>
+       or "filename" sequence
+     -
+
    * - `Rule 20.4 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_20_04.c>`_
      - Required
      - A macro shall not be defined with the same name as a keyword
      -
 
+   * - `Rule 20.6 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_20_06.c>`_
+     - Required
+     - Tokens that look like a preprocessing directive shall not occur
+       within a macro argument
+     -
+
    * - `Rule 20.7 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_20_07.c>`_
      - Required
      - Expressions resulting from the expansion of macro parameters
@@ -609,6 +632,12 @@ maintainers if you want to suggest a change.
        evaluation
      -
 
+   * - `Rule 20.11 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_20_11.c>`_
+     - Required
+     - A macro parameter immediately following a # operator shall not
+       immediately be followed by a ## operator
+     -
+
    * - `Rule 20.12 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_20_12.c>`_
      - Required
      - A macro parameter used as an operand to the # or ## operators,
@@ -651,11 +680,39 @@ maintainers if you want to suggest a change.
        declared
      - See comment for Rule 21.1
 
+   * - `Rule 21.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_03.c>`_
+     - Required
+     - The memory allocation and deallocation functions of <stdlib.h>
+       shall not be used
+     - Xen doesn't provide, use, or link against a Standard Library [#xen-stdlib]_
+
+   * - `Rule 21.4 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_04.c>`_
+     - Required
+     - The standard header file <setjmp.h> shall not be used
+     - Xen doesn't provide, use, or link against a Standard Library [#xen-stdlib]_
+
+   * - `Rule 21.5 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_05.c>`_
+     - Required
+     - The standard header file <signal.h> shall not be used
+     - Xen doesn't provide, use, or link against a Standard Library [#xen-stdlib]_
+
    * - `Rule 21.6 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_06.c>`_
      - Required
      - The Standard Library input/output routines shall not be used
      - Xen doesn't provide, use, or link against a Standard Library [#xen-stdlib]_
 
+   * - `Rule 21.7 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_07.c>`_
+     - Required
+     - The Standard Library functions atof, atoi, atol and atoll of
+       <stdlib.h> shall not be used
+     - Xen doesn't provide, use, or link against a Standard Library [#xen-stdlib]_
+
+   * - `Rule 21.8 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_08.c>`_
+     - Required
+     - The Standard Library functions abort, exit and system of
+       <stdlib.h> shall not be used
+     - Xen doesn't provide, use, or link against a Standard Library [#xen-stdlib]_
+
    * - `Rule 21.9 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_09.c>`_
      - Required
      - The library functions bsearch and qsort of <stdlib.h> shall not be used
@@ -666,6 +723,16 @@ maintainers if you want to suggest a change.
      - The Standard Library time and date routines shall not be used
      - Xen doesn't provide, use, or link against a Standard Library [#xen-stdlib]_
 
+   * - `Rule 21.11 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_11.c>`_
+     - Required
+     - The standard header file <tgmath.h> shall not be used
+     - Xen doesn't provide, use, or link against a Standard Library [#xen-stdlib]_
+
+   * - `Rule 21.12 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_12.c>`_
+     - Advisory
+     - The exception handling features of <fenv.h> should not be used
+     - Xen doesn't provide, use, or link against a Standard Library [#xen-stdlib]_
+
    * - `Rule 21.13 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_21_13.c>`_
      - Mandatory
      - Any value passed to a function in <ctype.h> shall be representable as an
@@ -725,12 +792,24 @@ maintainers if you want to suggest a change.
      - The Standard Library function system of <stdlib.h> shall not be used
      -
 
+   * - `Rule 22.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_22_01.c>`_
+     - Required
+     - All resources obtained dynamically by means of Standard Library
+       functions shall be explicitly released
+     - Xen doesn't provide, use, or link against a Standard Library [#xen-stdlib]_
+
    * - `Rule 22.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_22_02.c>`_
      - Mandatory
      - A block of memory shall only be freed if it was allocated by means of a
        Standard Library function
      -
 
+   * - `Rule 22.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_22_03.c>`_
+     - Required
+     - The same file shall not be open for read and write access at the
+       same time on different streams 
+     - Xen doesn't provide, use, or link against a Standard Library [#xen-stdlib]_
+
    * - `Rule 22.4 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_22_04.c>`_
      - Mandatory
      - There shall be no attempt to write to a stream which has been opened as
@@ -748,6 +827,31 @@ maintainers if you want to suggest a change.
        stream has been closed
      -
 
+   * - `Rule 22.7 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_22_07.c>`_
+     - Required
+     - The macro EOF shall only be compared with the unmodified return
+       value from any Standard Library function capable of returning EOF
+     - Xen doesn't provide, use, or link against a Standard Library [#xen-stdlib]_
+
+   * - `Rule 22.8 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_22_08.c>`_
+     - Required
+     - The value of errno shall be set to zero prior to a call to an
+       errno-setting-function
+     - Xen doesn't provide, use, or link against a Standard Library [#xen-stdlib]_
+
+   * - `Rule 22.9 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_22_09.c>`_
+     - Required
+     - The value of errno shall be tested against zero after calling an
+       errno-setting-function
+     - Xen doesn't provide, use, or link against a Standard Library [#xen-stdlib]_
+
+   * - `Rule 22.10 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_22_10.c>`_
+     - Required
+     - The value of errno shall only be tested when the last function to
+       be called was an errno-setting-function
+     - Xen doesn't provide, use, or link against a Standard Library [#xen-stdlib]_
+
+
 Terms & Definitions
 -------------------
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 01 08:11:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Aug 2024 08:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.769439.1180334 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZQuB-0007Wq-BC; Thu, 01 Aug 2024 08:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 769439.1180334; Thu, 01 Aug 2024 08: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 1sZQuB-0007Wi-8c; Thu, 01 Aug 2024 08:11:23 +0000
Received: by outflank-mailman (input) for mailman id 769439;
 Thu, 01 Aug 2024 08:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQuA-0007WU-4Y
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 08:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQuA-0000fH-3i
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 08:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQuA-0008EU-2w
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 08: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TcsKPYC9bl4ZJjoa0wxDN7kovjcjdvY412ERk53420I=; b=aifRMztePmSjhgV0M0UCGEcB1X
	S2hxPUOIVQVhL3sdug+F6t8d9TwKV1hIp1c5j0diMov5zZtmI30G/sZWC70lhLfOKnG7aJxPhp+cG
	9M29xU5frVaUXgVvWnrioBYIohQe52uLCyV68Av6AXm4U6yOXt0RCeMcJtBA8E1QC9Gg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs/misra: add rule 12.2
Message-Id: <E1sZQuA-0008EU-2w@xenbits.xenproject.org>
Date: Thu, 01 Aug 2024 08:11:22 +0000

commit 404135d408b562dd73a57ff7d070a407651bfa66
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Fri Jul 12 15:45:54 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Jul 30 15:14:31 2024 -0700

    docs/misra: add rule 12.2
    
    As discussed during the last MISRA C meeting, add Rule 12.2 to the list
    of MISRA C rules we accept, together with an explanation that we use gcc
    -fsanitize=undefined to check for violations.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misra/rules.rst | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index 2e11566e20..bb7e1ea396 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -443,6 +443,14 @@ maintainers if you want to suggest a change.
      - The macro NULL shall be the only permitted form of null pointer constant
      -
 
+   * - `Rule 12.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_12_02.c>`_
+     - Required
+     - The right hand operand of a shift operator shall lie in the range
+       zero to one less than the width in bits of the essential type of
+       the left hand operand
+     - We rely on gcc -fsanitize=undefined to check for dangerious
+       violations to this rule and to ensure compliance
+
    * - `Rule 12.5 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_12_05.c>`_
      - Mandatory
      - The sizeof operator shall not have an operand which is a function
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 01 08:11:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Aug 2024 08:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.769440.1180338 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZQuL-0007Ze-Cm; Thu, 01 Aug 2024 08:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 769440.1180338; Thu, 01 Aug 2024 08: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 1sZQuL-0007ZX-A9; Thu, 01 Aug 2024 08:11:33 +0000
Received: by outflank-mailman (input) for mailman id 769440;
 Thu, 01 Aug 2024 08:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQuK-0007ZQ-7i
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 08:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQuK-0000fP-6o
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 08:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQuK-0008Ff-5p
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 08: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=F0fyI2tNHGiupBucB2uCpyfyihhJi9huWGV1k+tg2w0=; b=bqveWYvD5F+fJCofvSdXTDric5
	3uGskV7p2vkO5Ogd+tHqHBtlHFAYDRGqU1yzOvgcpydbjavHjsSKk5n1O1IacQXsPKIptmSumN68X
	G2EYTdKYKtIdYmV7hKG3sUn2A1udxIgN/ZL7Fdb0tn0MC/ZerzC3kKp82Vy/yM4HCju4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs/misra: add R18.6 to rules.rst
Message-Id: <E1sZQuK-0008Ff-5p@xenbits.xenproject.org>
Date: Thu, 01 Aug 2024 08:11:32 +0000

commit 682ffdbda496c9565ecec7074835153e0bf66d6d
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Wed Jul 24 15:44:14 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Jul 30 15:14:31 2024 -0700

    docs/misra: add R18.6 to rules.rst
    
    In practice, we are already following R18.6 and we have zero violations
    reported by ECLAIR (there are some cautions being reported.)
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/misra/rules.rst | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index bb7e1ea396..7b366edb07 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -593,6 +593,13 @@ maintainers if you want to suggest a change.
      - Variable-length array types shall not be used
      -
 
+   * - `Rule 18.6 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_18_06_1.c>`_
+     - Required
+     - The address of an object with automatic storage shall not be
+       copied to another object that persists after the first object has
+       ceased to exist
+     -
+
    * - `Rule 19.1 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_19_01.c>`_
      - Mandatory
      - An object shall not be assigned or copied to an overlapping
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 01 08:11:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Aug 2024 08:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.769441.1180342 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZQuV-0007cB-EQ; Thu, 01 Aug 2024 08:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 769441.1180342; Thu, 01 Aug 2024 08: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 1sZQuV-0007c3-Bi; Thu, 01 Aug 2024 08:11:43 +0000
Received: by outflank-mailman (input) for mailman id 769441;
 Thu, 01 Aug 2024 08:11:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQuU-0007bq-Cv
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 08:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQuU-0000fY-B1
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 08:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZQuU-0008GY-8y
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 08: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vpFXWvPha0VC0aM7qO4juoT1mAxe8V7sP331xugz8Kk=; b=m77YR+I7pSldKgQ3pymucS6pWv
	YQ34rkh7ZojwNwFcEGZlU0bcTJaZK5tJBvxO3BCYDsnOYFes0Y26Lj+gbbAHU+lhsC/cgF6iMTzzO
	8AFpaKHvWGUQo4nr256ozSaa5DXtzHTJnWtwfRelrcy3Fmx5q2sPbxQA96GntHzlm+9I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: add x86_64 xilinx smoke test
Message-Id: <E1sZQuU-0008GY-8y@xenbits.xenproject.org>
Date: Thu, 01 Aug 2024 08:11:42 +0000

commit 6979e17b3f8a18d2ba5dbd4f0623c4061dae0dfc
Author:     Victor Lira <victorm.lira@amd.com>
AuthorDate: Fri Jul 26 18:56:39 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Jul 30 15:14:31 2024 -0700

    automation: add x86_64 xilinx smoke test
    
    Add a test script and related job for running x86_64 dom0 tests.
    
    Signed-off-by: Victor Lira <victorm.lira@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/test.yaml                 |  24 +++++
 automation/scripts/xilinx-smoke-dom0-x86_64.sh | 144 +++++++++++++++++++++++++
 2 files changed, 168 insertions(+)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index d89e41f244..4e74946419 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -96,6 +96,22 @@
   tags:
     - xilinx
 
+.xilinx-x86_64:
+  extends: .test-jobs-common
+  variables:
+    CONTAINER: ubuntu:xenial-xilinx
+    LOGFILE: xilinx-smoke-x86_64.log
+  artifacts:
+    paths:
+      - smoke.serial
+      - '*.log'
+    when: always
+  only:
+    variables:
+      - $XILINX_JOBS == "true" && $CI_COMMIT_REF_PROTECTED == "true"
+  tags:
+    - xilinx
+
 .adl-x86-64:
   extends: .test-jobs-common
   variables:
@@ -159,6 +175,14 @@ xilinx-smoke-dom0less-arm64-gcc-debug-gem-passthrough:
     - *arm64-test-needs
     - alpine-3.18-gcc-debug-arm64
 
+xilinx-smoke-dom0-x86_64-gcc-debug:
+  extends: .xilinx-x86_64
+  script:
+    - ./automation/scripts/xilinx-smoke-dom0-x86_64.sh ping 2>&1 | tee ${LOGFILE}
+  needs:
+    - *x86-64-test-needs
+    - alpine-3.18-gcc-debug
+
 adl-smoke-x86-64-gcc-debug:
   extends: .adl-x86-64
   script:
diff --git a/automation/scripts/xilinx-smoke-dom0-x86_64.sh b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
new file mode 100755
index 0000000000..e6e6fac6a5
--- /dev/null
+++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
@@ -0,0 +1,144 @@
+#!/bin/sh
+
+# Run x86_64 dom0 tests on hardware.
+
+set -ex
+
+fatal() {
+    echo "$(basename "$0") $*" >&2
+    exit 1
+}
+
+# Test parameter defaults.
+TEST="$1"
+PASS_MSG="Test passed: ${TEST}"
+XEN_CMD_CONSOLE="console=com1 com1=115200,8n1,0x3F8,4"
+XEN_CMD_DOM0="dom0=pvh dom0_max_vcpus=4 dom0_mem=4G"
+XEN_CMD_XEN="sched=null loglvl=all guest_loglvl=all console_timestamps=boot"
+XEN_CMD_EXTRA=""
+DOM0_CMD=""
+DOMU_CMD=""
+DOMU_CFG='
+type = "pvh"
+name = "domU"
+kernel = "/boot/vmlinuz"
+ramdisk = "/boot/initrd-domU"
+extra = "root=/dev/ram0 console=hvc0"
+memory = 512
+vif = [ "bridge=xenbr0", ]
+disk = [ ]
+'
+TIMEOUT_SECONDS=120
+
+# Select test variant.
+if [ "${TEST}" = "ping" ]; then
+    DOMU_MSG="domU online"
+    DOMU_CMD="
+ifconfig eth0 192.168.0.2
+until ping -c 10 192.168.0.1; do
+    sleep 1
+done
+echo \"${DOMU_MSG}\"
+"
+    DOM0_CMD="
+set +x
+until grep -q \"${DOMU_MSG}\" /var/log/xen/console/guest-domU.log; do
+    sleep 1
+done
+set -x
+echo \"${PASS_MSG}\"
+"
+else
+    fatal "Unknown test: ${TEST}"
+fi
+
+# Set up domU rootfs.
+mkdir -p rootfs
+cd rootfs
+tar xzf ../binaries/initrd.tar.gz
+mkdir proc
+mkdir run
+mkdir srv
+mkdir sys
+rm var/run
+echo "#!/bin/sh
+
+${DOMU_CMD}
+" > etc/local.d/xen.start
+chmod +x etc/local.d/xen.start
+echo "rc_verbose=yes" >> etc/rc.conf
+sed -i -e 's/^Welcome/domU \0/' etc/issue
+find . | cpio -H newc -o | gzip > ../binaries/domU-rootfs.cpio.gz
+cd ..
+rm -rf rootfs
+
+# Set up dom0 rootfs.
+mkdir -p rootfs
+cd rootfs
+tar xzf ../binaries/initrd.tar.gz
+mkdir boot
+mkdir proc
+mkdir run
+mkdir srv
+mkdir sys
+rm var/run
+cp -ar ../binaries/dist/install/* .
+echo "#!/bin/bash
+
+export LD_LIBRARY_PATH=/usr/local/lib
+bash /etc/init.d/xencommons start
+
+brctl addbr xenbr0
+brctl addif xenbr0 eth0
+ifconfig eth0 up
+ifconfig xenbr0 up
+ifconfig xenbr0 192.168.0.1
+
+# get domU console content into test log
+tail -F /var/log/xen/console/guest-domU.log 2>/dev/null | sed -e \"s/^/(domU) /\" &
+xl create /etc/xen/domU.cfg
+${DOM0_CMD}
+" > etc/local.d/xen.start
+chmod +x etc/local.d/xen.start
+echo "${DOMU_CFG}" > etc/xen/domU.cfg
+echo "rc_verbose=yes" >> etc/rc.conf
+echo "XENCONSOLED_TRACE=all" >> etc/default/xencommons
+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
+cd ..
+
+# Load software into TFTP server directory.
+TFTP="/scratch/gitlab-runner/tftp"
+XEN_CMDLINE="${XEN_CMD_CONSOLE} ${XEN_CMD_XEN} ${XEN_CMD_DOM0} ${XEN_CMD_EXTRA}"
+cp -f binaries/xen ${TFTP}/pxelinux.cfg/xen
+cp -f binaries/bzImage ${TFTP}/pxelinux.cfg/vmlinuz
+cp -f binaries/dom0-rootfs.cpio.gz ${TFTP}/pxelinux.cfg/initrd-dom0
+echo "
+net_default_server=10.0.6.1
+multiboot2 (tftp)/pxelinux.cfg/xen ${XEN_CMDLINE}
+module2 (tftp)/pxelinux.cfg/vmlinuz console=hvc0 root=/dev/ram0 earlyprintk=xen
+module2 (tftp)/pxelinux.cfg/initrd-dom0
+boot
+" > ${TFTP}/pxelinux.cfg/grub.cfg
+
+# Power cycle board and collect serial port output.
+SERIAL_CMD="cat /dev/ttyUSB9 | tee smoke.serial | sed 's/\r//'"
+sh /scratch/gitlab-runner/v2000a.sh 2
+sleep 5
+sh /scratch/gitlab-runner/v2000a.sh 1
+sleep 5
+set +e
+stty -F /dev/ttyUSB9 115200
+timeout -k 1 ${TIMEOUT_SECONDS} nohup sh -c "${SERIAL_CMD}"
+sh /scratch/gitlab-runner/v2000a.sh 2
+
+set -e
+
+if grep -q "${PASS_MSG}" smoke.serial; then
+    exit 0
+fi
+
+fatal "Test failed"
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 01 12:00:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Aug 2024 12:00:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.769649.1180543 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZUTU-0007Tg-M8; Thu, 01 Aug 2024 12:00:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 769649.1180543; Thu, 01 Aug 2024 12: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 1sZUTU-0007TG-IU; Thu, 01 Aug 2024 12:00:04 +0000
Received: by outflank-mailman (input) for mailman id 769649;
 Thu, 01 Aug 2024 12:00:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUTT-0007Lf-Ro
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:00:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUTT-0004ZJ-L4
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:00:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUTT-0000Kq-JW
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=74lCg0tzrNUMSJGCwin+Www+x0aL+VQ/sXOJTWEARkk=; b=AHpbB+MJHMOv3VkHIQK5LQV0ny
	Sv4zD8t7xzkO7SPnoRQFt9/xK1ScmoS4YODlHzR4CHEVSs5QWXcH/g9IqEkcUp2YBaARiGOiX3gYf
	wvxQM8MYJ2B34sF+tMZ0cMPNuw7jKdft1jL7g/ts6++1QJ65Ec6guEcEBnB832lIfNGA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: introduce AMD-V and Intel VT-x Kconfig options
Message-Id: <E1sZUTT-0000Kq-JW@xenbits.xenproject.org>
Date: Thu, 01 Aug 2024 12:00:03 +0000

commit c1a13ad302e6da97fc426d37a770fcc6b68ba5d6
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Thu Aug 1 13:53:37 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 13:53:37 2024 +0200

    x86: introduce AMD-V and Intel VT-x Kconfig options
    
    Introduce two new Kconfig options, AMD_SVM and INTEL_VMX, to allow code
    specific to each virtualization technology to be separated and, when not
    required, stripped.
    CONFIG_AMD_SVM will be used to enable virtual machine extensions on platforms
    that implement the AMD Virtualization Technology (AMD-V).
    CONFIG_INTEL_VMX will be used to enable virtual machine extensions on platforms
    that implement the Intel Virtualization Technology (Intel VT-x).
    
    Both features depend on HVM support.
    
    Since, at this point, disabling any of them would cause Xen to not compile,
    the options are enabled by default if HVM and are not selectable by the user.
    
    No functional change intended.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/Kconfig         | 6 ++++++
 xen/arch/x86/hvm/Makefile    | 4 ++--
 xen/arch/x86/mm/Makefile     | 3 ++-
 xen/arch/x86/mm/hap/Makefile | 2 +-
 4 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 7e03e4bc55..fa5405e0d3 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -122,6 +122,12 @@ config HVM
 
 	  If unsure, say Y.
 
+config AMD_SVM
+	def_bool HVM
+
+config INTEL_VMX
+	def_bool HVM
+
 config XEN_SHSTK
 	bool "Supervisor Shadow Stacks"
 	depends on HAS_AS_CET_SS
diff --git a/xen/arch/x86/hvm/Makefile b/xen/arch/x86/hvm/Makefile
index 3464191544..4c1fa5c6c2 100644
--- a/xen/arch/x86/hvm/Makefile
+++ b/xen/arch/x86/hvm/Makefile
@@ -1,5 +1,5 @@
-obj-y += svm/
-obj-y += vmx/
+obj-$(CONFIG_AMD_SVM) += svm/
+obj-$(CONFIG_INTEL_VMX) += vmx/
 obj-y += viridian/
 
 obj-y += asid.o
diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile
index 0803ac9297..52c5abdfee 100644
--- a/xen/arch/x86/mm/Makefile
+++ b/xen/arch/x86/mm/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_MEM_SHARING) += mem_sharing.o
 obj-$(CONFIG_HVM) += nested.o
 obj-$(CONFIG_HVM) += p2m.o
 obj-y += p2m-basic.o
-obj-$(CONFIG_HVM) += p2m-ept.o p2m-pod.o p2m-pt.o
+obj-$(CONFIG_INTEL_VMX) += p2m-ept.o
+obj-$(CONFIG_HVM) += p2m-pod.o p2m-pt.o
 obj-y += paging.o
 obj-y += physmap.o
diff --git a/xen/arch/x86/mm/hap/Makefile b/xen/arch/x86/mm/hap/Makefile
index 8ef54b1faa..67c29b2162 100644
--- a/xen/arch/x86/mm/hap/Makefile
+++ b/xen/arch/x86/mm/hap/Makefile
@@ -3,4 +3,4 @@ obj-y += guest_walk_2.o
 obj-y += guest_walk_3.o
 obj-y += guest_walk_4.o
 obj-y += nested_hap.o
-obj-y += nested_ept.o
+obj-$(CONFIG_INTEL_VMX) += nested_ept.o
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 01 12:00:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Aug 2024 12:00:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.769656.1180546 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZUTe-00081P-MV; Thu, 01 Aug 2024 12:00:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 769656.1180546; Thu, 01 Aug 2024 12: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 1sZUTe-00081H-Jz; Thu, 01 Aug 2024 12:00:14 +0000
Received: by outflank-mailman (input) for mailman id 769656;
 Thu, 01 Aug 2024 12:00:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUTd-00080w-Ox
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:00:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUTd-0004ZS-OB
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:00:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUTd-0000OP-NH
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FIRDapJWBfLOLrJOPOslvNYdFwXYV95iyEVUPnSziJc=; b=NkAvYG/9NAuvNdtTc8U3k+tyUv
	qvz4um27fFusnzVjeQkswRKEdTjXTPi45JGRkBbPgvKSWr7fJ9nl7vIrYIabibaAz6EHcCovXttQT
	TdJkN6toeB9iLXjmEvhoYWa49kP6LVNcBFpjPC8xHQkhi9Ph8MVk+tYRBjxlbbhZqhUM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/monitor: guard altp2m usage
Message-Id: <E1sZUTd-0000OP-NH@xenbits.xenproject.org>
Date: Thu, 01 Aug 2024 12:00:13 +0000

commit 55c01d28f47d5e57bed746ba4e226c7ecbaa2bd1
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Thu Aug 1 13:54:23 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 13:54:23 2024 +0200

    x86/monitor: guard altp2m usage
    
    Explicitly check whether altp2m is on for domain when getting altp2m index.
    If explicit call to altp2m_active() always returns false, DCE will remove
    call to altp2m_vcpu_idx().
    
    p2m_get_mem_access() expects 0 as altp2m_idx parameter when altp2m not active
    or not supported, so 0 is a fallback value then.
    
    The purpose of that is later to be able to disable altp2m support and
    exclude its code from the build completely, when not supported by target
    platform (as of now it's supported for VT-x only).
    
    Also all other calls to altp2m_vcpu_idx() are guarded by altp2m_active(), so
    this change puts usage of this routine in line with the rest of code.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
---
 xen/arch/x86/hvm/monitor.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/monitor.c b/xen/arch/x86/hvm/monitor.c
index 2a8ff07ec9..74621000b2 100644
--- a/xen/arch/x86/hvm/monitor.c
+++ b/xen/arch/x86/hvm/monitor.c
@@ -262,6 +262,8 @@ bool hvm_monitor_check_p2m(unsigned long gla, gfn_t gfn, uint32_t pfec,
     struct vcpu *curr = current;
     vm_event_request_t req = {};
     paddr_t gpa = (gfn_to_gaddr(gfn) | (gla & ~PAGE_MASK));
+    unsigned int altp2m_idx = altp2m_active(curr->domain) ?
+                              altp2m_vcpu_idx(curr) : 0;
     int rc;
 
     ASSERT(curr->arch.vm_event->send_event);
@@ -270,7 +272,7 @@ bool hvm_monitor_check_p2m(unsigned long gla, gfn_t gfn, uint32_t pfec,
      * p2m_get_mem_access() can fail from a invalid MFN and return -ESRCH
      * in which case access must be restricted.
      */
-    rc = p2m_get_mem_access(curr->domain, gfn, &access, altp2m_vcpu_idx(curr));
+    rc = p2m_get_mem_access(curr->domain, gfn, &access, altp2m_idx);
 
     if ( rc == -ESRCH )
         access = XENMEM_access_n;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 01 12:00:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Aug 2024 12:00:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.769660.1180550 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZUTo-000897-O2; Thu, 01 Aug 2024 12:00:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 769660.1180550; Thu, 01 Aug 2024 12: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 1sZUTo-00088z-LO; Thu, 01 Aug 2024 12:00:24 +0000
Received: by outflank-mailman (input) for mailman id 769660;
 Thu, 01 Aug 2024 12:00:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUTn-00088U-Sc
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:00:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUTn-0004Za-Rl
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:00:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUTn-0000Pf-QU
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RQKST7VokNxPBNnRnq0YRmvuZQMNSSlQp6Va8pZMLmY=; b=XaAcDleITpFf5/880PPmdWwCPU
	o1E6eIDMWPXJmanz5ZFp1VZ3foQaG+4+HSbsqSp9aDSXZmMfPQaE6W9jAOhnTFxTNwYq1Ncytd27d
	jdGTKrfjFACQjv87MIJGBj3memQ7kTCPatW9gSqtxll1PlJf6SIL0WzPj288oMosfiU4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: introduce CONFIG_ALTP2M Kconfig option
Message-Id: <E1sZUTn-0000Pf-QU@xenbits.xenproject.org>
Date: Thu, 01 Aug 2024 12:00:23 +0000

commit e96831ece81985c40d35fd9b24fc5f21d2bf41a2
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Thu Aug 1 13:55:08 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 13:55:08 2024 +0200

    x86: introduce CONFIG_ALTP2M Kconfig option
    
    Add new option to make altp2m code inclusion optional.
    Currently altp2m implemented for Intel EPT only, so option is dependant on VMX.
    Also the prompt itself depends on EXPERT=y, so that option is available
    for fine-tuning, if one want to play around with it.
    
    Use this option instead of more generic CONFIG_HVM option.
    That implies the possibility to build hvm code without altp2m support,
    hence we need to declare altp2m routines for hvm code to compile successfully
    (altp2m_vcpu_initialise(), altp2m_vcpu_destroy(), altp2m_vcpu_enable_ve())
    
    Also guard altp2m routines, so that they can be disabled completely in the
    build -- when target platform does not actually support altp2m
    (AMD-V & ARM as of now).
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/Kconfig               | 11 +++++++++++
 xen/arch/x86/include/asm/altp2m.h  |  5 ++++-
 xen/arch/x86/include/asm/hvm/hvm.h |  2 +-
 xen/arch/x86/include/asm/p2m.h     | 23 ++++++++++++++++++-----
 xen/arch/x86/mm/Makefile           |  2 +-
 5 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index fa5405e0d3..7ef5c8bc48 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -358,6 +358,17 @@ config REQUIRE_NX
 	  was unavailable. However, if enabled, Xen will no longer boot on
 	  any CPU which is lacking NX support.
 
+config ALTP2M
+	bool "Alternate P2M support" if EXPERT
+	depends on INTEL_VMX
+	default y
+	help
+	  Alternate-p2m allows a guest to manage multiple p2m guest physical
+	  "memory views" (as opposed to a single p2m).
+	  Useful for memory introspection.
+
+	  If unsure, stay with defaults.
+
 endmenu
 
 source "common/Kconfig"
diff --git a/xen/arch/x86/include/asm/altp2m.h b/xen/arch/x86/include/asm/altp2m.h
index e5e59cbd68..c57a8c5588 100644
--- a/xen/arch/x86/include/asm/altp2m.h
+++ b/xen/arch/x86/include/asm/altp2m.h
@@ -7,7 +7,7 @@
 #ifndef __ASM_X86_ALTP2M_H
 #define __ASM_X86_ALTP2M_H
 
-#ifdef CONFIG_HVM
+#ifdef CONFIG_ALTP2M
 
 #include <xen/types.h>
 #include <xen/sched.h>         /* for struct vcpu, struct domain */
@@ -39,6 +39,9 @@ static inline bool altp2m_active(const struct domain *d)
 
 /* Only declaration is needed. DCE will optimise it out when linking. */
 uint16_t altp2m_vcpu_idx(const struct vcpu *v);
+void altp2m_vcpu_initialise(struct vcpu *v);
+void altp2m_vcpu_destroy(struct vcpu *v);
+int altp2m_vcpu_enable_ve(struct vcpu *v, gfn_t gfn);
 void altp2m_vcpu_disable_ve(struct vcpu *v);
 
 #endif
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 277648dd18..34824af6df 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -670,7 +670,7 @@ static inline bool hvm_hap_supported(void)
 /* returns true if hardware supports alternate p2m's */
 static inline bool hvm_altp2m_supported(void)
 {
-    return hvm_funcs.caps.altp2m;
+    return IS_ENABLED(CONFIG_ALTP2M) && hvm_funcs.caps.altp2m;
 }
 
 /* Returns true if we have the minimum hardware requirements for nested virt */
diff --git a/xen/arch/x86/include/asm/p2m.h b/xen/arch/x86/include/asm/p2m.h
index c1478ffc36..e6de37f108 100644
--- a/xen/arch/x86/include/asm/p2m.h
+++ b/xen/arch/x86/include/asm/p2m.h
@@ -577,7 +577,7 @@ static inline gfn_t mfn_to_gfn(const struct domain *d, mfn_t mfn)
         return _gfn(mfn_x(mfn));
 }
 
-#ifdef CONFIG_HVM
+#ifdef CONFIG_ALTP2M
 #define AP2MGET_prepopulate true
 #define AP2MGET_query false
 
@@ -589,6 +589,16 @@ static inline gfn_t mfn_to_gfn(const struct domain *d, mfn_t mfn)
 int altp2m_get_effective_entry(struct p2m_domain *ap2m, gfn_t gfn, mfn_t *mfn,
                                p2m_type_t *t, p2m_access_t *a,
                                bool prepopulate);
+#else
+static inline int _altp2m_get_effective_entry(struct p2m_domain *ap2m,
+                                             gfn_t gfn, mfn_t *mfn,
+                                             p2m_type_t *t, p2m_access_t *a)
+{
+    ASSERT_UNREACHABLE();
+    return -EOPNOTSUPP;
+}
+#define altp2m_get_effective_entry(ap2m, gfn, mfn, t, a, prepopulate) \
+        _altp2m_get_effective_entry(ap2m, gfn, mfn, t, a)
 #endif
 
 /* Init the datastructures for later use by the p2m code */
@@ -914,9 +924,6 @@ static inline bool p2m_set_altp2m(struct vcpu *v, unsigned int idx)
 /* Switch alternate p2m for a single vcpu */
 bool p2m_switch_vcpu_altp2m_by_id(struct vcpu *v, unsigned int idx);
 
-/* Check to see if vcpu should be switched to a different p2m. */
-void p2m_altp2m_check(struct vcpu *v, uint16_t idx);
-
 /* Flush all the alternate p2m's for a domain */
 void p2m_flush_altp2m(struct domain *d);
 
@@ -952,9 +959,15 @@ int p2m_set_altp2m_view_visibility(struct domain *d, unsigned int altp2m_idx,
                                    uint8_t visible);
 #else /* !CONFIG_HVM */
 struct p2m_domain *p2m_get_altp2m(struct vcpu *v);
-static inline void p2m_altp2m_check(struct vcpu *v, uint16_t idx) {}
 #endif /* CONFIG_HVM */
 
+#ifdef CONFIG_ALTP2M
+/* Check to see if vcpu should be switched to a different p2m. */
+void p2m_altp2m_check(struct vcpu *v, uint16_t idx);
+#else
+static inline void p2m_altp2m_check(struct vcpu *v, uint16_t idx) {}
+#endif
+
 /* p2m access to IOMMU flags */
 static inline unsigned int p2m_access_to_iommu_flags(p2m_access_t p2ma)
 {
diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile
index 52c5abdfee..0345388359 100644
--- a/xen/arch/x86/mm/Makefile
+++ b/xen/arch/x86/mm/Makefile
@@ -1,7 +1,7 @@
 obj-y += shadow/
 obj-$(CONFIG_HVM) += hap/
 
-obj-$(CONFIG_HVM) += altp2m.o
+obj-$(CONFIG_ALTP2M) += altp2m.o
 obj-$(CONFIG_HVM) += guest_walk_2.o guest_walk_3.o guest_walk_4.o
 obj-$(CONFIG_SHADOW_PAGING) += guest_walk_4.o
 obj-$(CONFIG_MEM_ACCESS) += mem_access.o
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 01 12:00:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Aug 2024 12:00:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.769663.1180554 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZUTy-0008Fw-Pl; Thu, 01 Aug 2024 12:00:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 769663.1180554; Thu, 01 Aug 2024 12: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 1sZUTy-0008Fo-Mn; Thu, 01 Aug 2024 12:00:34 +0000
Received: by outflank-mailman (input) for mailman id 769663;
 Thu, 01 Aug 2024 12:00:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUTy-0008Fe-02
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:00:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUTx-0004Zl-VT
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:00:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUTx-0000RA-UT
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ywg51LDjYqqnSQ7rvQJLoI20t/ir6ofzGPimiXtr2Ek=; b=1mveSqmGNqRTMPc6ejagEsISOj
	ZFsUI2uDB2CrOiZ0fDh1peeIH+8Cbz+Wgo4fkn7TfTniIoQnG6IioDk3gRsS2ccA6BG1vnQuTNadA
	8Vk7M37epjKzU7bZHevOu4fKEbEPDSFRo0OcjZ9/x2dhwVsm30V4upKhg5qteE7BRNLI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: introduce using_{svm,vmx}() helpers
Message-Id: <E1sZUTx-0000RA-UT@xenbits.xenproject.org>
Date: Thu, 01 Aug 2024 12:00:33 +0000

commit 3f7efa20e4f31601657b16e32d1289002aa8ee25
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Thu Aug 1 13:55:39 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 13:55:39 2024 +0200

    x86: introduce using_{svm,vmx}() helpers
    
    As we now have AMD_SVM/INTEL_VMX config options for enabling/disabling these
    features completely in the build, we need some build-time checks to ensure that
    vmx/svm code can be used and things compile. Macros cpu_has_{svm,vmx} used to be
    doing such checks at runtime, however they do not check if SVM/VMX support is
    enabled in the build.
    
    Also cpu_has_{svm,vmx} can potentially be called from non-{VMX,SVM} build
    yet running on {VMX,SVM}-enabled CPU, so would correctly indicate that VMX/SVM
    is indeed supported by CPU, but code to drive it can't be used.
    
    New routines using_{vmx,svm}() indicate that both CPU _and_ build provide
    corresponding technology support, while cpu_has_{vmx,svm} still remains for
    informational runtime purpose, just as their naming suggests.
    
    These new helpers are used right away in several sites, namely guard calls to
    start_nested_{svm,vmx} and start_{svm,vmx} to fix a build when INTEL_VMX=n or
    AMD_SVM=n.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c             |  4 ++--
 xen/arch/x86/hvm/nestedhvm.c       |  4 ++--
 xen/arch/x86/include/asm/hvm/hvm.h | 10 ++++++++++
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index d7f195ba9a..9f37db494d 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -155,9 +155,9 @@ static int __init cf_check hvm_enable(void)
 {
     const struct hvm_function_table *fns = NULL;
 
-    if ( cpu_has_vmx )
+    if ( using_vmx() )
         fns = start_vmx();
-    else if ( cpu_has_svm )
+    else if ( using_svm() )
         fns = start_svm();
 
     if ( fns == NULL )
diff --git a/xen/arch/x86/hvm/nestedhvm.c b/xen/arch/x86/hvm/nestedhvm.c
index d895a73844..bddd77d810 100644
--- a/xen/arch/x86/hvm/nestedhvm.c
+++ b/xen/arch/x86/hvm/nestedhvm.c
@@ -155,9 +155,9 @@ static int __init cf_check nestedhvm_setup(void)
      * done, so that if (for example) HAP is disabled, nested virt is
      * disabled as well.
      */
-    if ( cpu_has_vmx )
+    if ( using_vmx() )
         start_nested_vmx(&hvm_funcs);
-    else if ( cpu_has_svm )
+    else if ( using_svm() )
         start_nested_svm(&hvm_funcs);
 
     return 0;
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 34824af6df..518ba5319b 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -363,6 +363,16 @@ int hvm_copy_context_and_params(struct domain *dst, struct domain *src);
 
 int hvm_get_param(struct domain *d, uint32_t index, uint64_t *value);
 
+static inline bool using_vmx(void)
+{
+    return IS_ENABLED(CONFIG_INTEL_VMX) && cpu_has_vmx;
+}
+
+static inline bool using_svm(void)
+{
+    return IS_ENABLED(CONFIG_AMD_SVM) && cpu_has_svm;
+}
+
 #ifdef CONFIG_HVM
 
 #define hvm_get_guest_tsc(v) hvm_get_guest_tsc_fixed(v, 0)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 01 12:00:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Aug 2024 12:00:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.769664.1180558 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZUU8-0008LY-Qn; Thu, 01 Aug 2024 12:00:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 769664.1180558; Thu, 01 Aug 2024 12: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 1sZUU8-0008LQ-OB; Thu, 01 Aug 2024 12:00:44 +0000
Received: by outflank-mailman (input) for mailman id 769664;
 Thu, 01 Aug 2024 12:00:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUU8-0008LI-4G
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:00:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUU8-0004Zw-2O
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:00:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUU8-0000SL-1b
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Zjy5kKgmnlm24wqWGh7GA9yai+0Np5fmlKUu5P4TbV4=; b=AywMendMuRXKHoChzzUqJUkWzL
	JWhUsqJvQ908Wcb3yZeRCHTGxwt0ezFQ/iFTE8DP4DSXr8ta1afu66x5GGjNB+v3IAEmSnwYzFXGv
	TyWbSA6rLQq3Qq5gxJG1WzLTrGMVi/4m87W8fWhjnU2srpCvRl45C7eC18QAwacdrkwo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/p2m: guard EPT functions with using_vmx() check
Message-Id: <E1sZUU8-0000SL-1b@xenbits.xenproject.org>
Date: Thu, 01 Aug 2024 12:00:44 +0000

commit e961970ae2d6aec1dc826b29df7045192e9ee9ec
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Thu Aug 1 13:56:09 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 13:56:09 2024 +0200

    x86/p2m: guard EPT functions with using_vmx() check
    
    Replace cpu_has_vmx check with using_vmx(), so that DCE would remove calls
    to functions ept_p2m_init() and ept_p2m_uninit() on non-VMX build.
    Since currently Intel EPT implementation depends on CONFIG_INTEL_VMX config
    option, when VMX is off these functions are unavailable.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm/p2m-basic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-basic.c b/xen/arch/x86/mm/p2m-basic.c
index 08007a687c..e126fda267 100644
--- a/xen/arch/x86/mm/p2m-basic.c
+++ b/xen/arch/x86/mm/p2m-basic.c
@@ -40,7 +40,7 @@ static int p2m_initialise(struct domain *d, struct p2m_domain *p2m)
     p2m_pod_init(p2m);
     p2m_nestedp2m_init(p2m);
 
-    if ( hap_enabled(d) && cpu_has_vmx )
+    if ( hap_enabled(d) && using_vmx() )
         ret = ept_p2m_init(p2m);
     else
         p2m_pt_init(p2m);
@@ -72,7 +72,7 @@ struct p2m_domain *p2m_init_one(struct domain *d)
 void p2m_free_one(struct p2m_domain *p2m)
 {
     p2m_free_logdirty(p2m);
-    if ( hap_enabled(p2m->domain) && cpu_has_vmx )
+    if ( hap_enabled(p2m->domain) && using_vmx() )
         ept_p2m_uninit(p2m);
     free_cpumask_var(p2m->dirty_cpumask);
     xfree(p2m);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 01 12:00:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Aug 2024 12:00:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.769665.1180562 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZUUI-0008Ql-SK; Thu, 01 Aug 2024 12:00:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 769665.1180562; Thu, 01 Aug 2024 12: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 1sZUUI-0008Qc-PZ; Thu, 01 Aug 2024 12:00:54 +0000
Received: by outflank-mailman (input) for mailman id 769665;
 Thu, 01 Aug 2024 12:00:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUUI-0008QU-7o
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:00:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUUI-0004aK-74
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:00:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUUI-0000Tm-4v
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=r/Hm/SA0WXwoVUwGFnhlwXkcvaAt2TV0RJk1ijRPv3s=; b=5HNDkx0SwGMosaSsAmi+Z50syj
	3S2k+obgFVTACB/XeocD0X0VRPPihMM8wovl8VYuRo5GLyMuCc5tbSSmtZIj5D7zUvL5EDy8fVwV0
	9OLLYVpDEqvVSsTDyZUlSm2KTf82U6GAONVmg+vv6uCH7FJTkoFx54TUsgJxSLV80SDA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/traps: guard vmx specific functions with usinc_vmx() check
Message-Id: <E1sZUUI-0000Tm-4v@xenbits.xenproject.org>
Date: Thu, 01 Aug 2024 12:00:54 +0000

commit 6b70f0ba99122424c5dce48f94f8226a6557a69b
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Thu Aug 1 13:56:34 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 13:56:34 2024 +0200

    x86/traps: guard vmx specific functions with usinc_vmx() check
    
    Replace cpu_has_vmx check with using_vmx(), so that not only VMX support in CPU
    is being checked at runtime, but also at build time we ensure the availability
    of functions vmx_vmcs_enter() & vmx_vmcs_exit().
    
    Also since CONFIG_VMX is checked in using_vmx and it depends on CONFIG_HVM,
    we can drop #ifdef CONFIG_HVM lines around using_vmx.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/traps.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index a981b6c2e8..552a07e6aa 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -676,7 +676,6 @@ void vcpu_show_execution_state(struct vcpu *v)
 
     vcpu_pause(v); /* acceptably dangerous */
 
-#ifdef CONFIG_HVM
     /*
      * For VMX special care is needed: Reading some of the register state will
      * require VMCS accesses. Engaging foreign VMCSes involves acquiring of a
@@ -684,12 +683,11 @@ void vcpu_show_execution_state(struct vcpu *v)
      * region. Despite this being a layering violation, engage the VMCS right
      * here. This then also avoids doing so several times in close succession.
      */
-    if ( cpu_has_vmx && is_hvm_vcpu(v) )
+    if ( using_vmx() && is_hvm_vcpu(v) )
     {
         ASSERT(!in_irq());
         vmx_vmcs_enter(v);
     }
-#endif
 
     /* Prevent interleaving of output. */
     flags = console_lock_recursive_irqsave();
@@ -714,10 +712,8 @@ void vcpu_show_execution_state(struct vcpu *v)
         console_unlock_recursive_irqrestore(flags);
     }
 
-#ifdef CONFIG_HVM
-    if ( cpu_has_vmx && is_hvm_vcpu(v) )
+    if ( using_vmx() && is_hvm_vcpu(v) )
         vmx_vmcs_exit(v);
-#endif
 
     vcpu_unpause(v);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 01 12:01:05 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Aug 2024 12:01:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.769669.1180565 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZUUS-0008VX-VG; Thu, 01 Aug 2024 12:01:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 769669.1180565; Thu, 01 Aug 2024 12: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 1sZUUS-0008VP-Sc; Thu, 01 Aug 2024 12:01:04 +0000
Received: by outflank-mailman (input) for mailman id 769669;
 Thu, 01 Aug 2024 12:01:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUUS-0008VH-Aw
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:01:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUUS-0004af-A5
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:01:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUUS-0000VJ-9M
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:01: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zzrg/kopjwdRisi0zWILIVZUSoCEbBg+pkQiH4dCm2M=; b=gFSb0YAE27sR76iS7UIvS9BcJj
	sA9Yrc+3ZDrIG+IMcpYTyfhABaG0l+iu9ehXeqOZ1sNHPA30JOPzhgriGN6Cei4xEgAHSf5Upi+ik
	pK6VyAaeIVHD7bKIJWj834Kt2+O6t3Hss9TvrI5XunQQNmmz53H5tyGrjAkgx7qyZS3I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/PV: guard svm specific functions with using_svm() check
Message-Id: <E1sZUUS-0000VJ-9M@xenbits.xenproject.org>
Date: Thu, 01 Aug 2024 12:01:04 +0000

commit 23bb8addf28b9f405aaa3a07aa840b2856340e41
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Thu Aug 1 13:57:09 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 13:57:09 2024 +0200

    x86/PV: guard svm specific functions with using_svm() check
    
    Replace cpu_has_svm check with using_svm(), so that not only SVM support in CPU
    is being checked at runtime, but also at build time we ensure the availability
    of functions svm_load_segs() and svm_load_segs_prefetch().
    
    Since SVM depends on HVM, it can be used alone.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domain.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index c71b9023cb..d977ec71ca 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1720,11 +1720,9 @@ static void load_segments(struct vcpu *n)
         if ( !(n->arch.flags & TF_kernel_mode) )
             SWAP(gsb, gss);
 
-#ifdef CONFIG_HVM
-        if ( cpu_has_svm && (uregs->fs | uregs->gs) <= 3 )
+        if ( using_svm() && (uregs->fs | uregs->gs) <= 3 )
             fs_gs_done = svm_load_segs(n->arch.pv.ldt_ents, LDT_VIRT_START(n),
                                        n->arch.pv.fs_base, gsb, gss);
-#endif
     }
 
     if ( !fs_gs_done )
@@ -2037,9 +2035,9 @@ static void __context_switch(void)
 
     write_ptbase(n);
 
-#if defined(CONFIG_PV) && defined(CONFIG_HVM)
+#ifdef CONFIG_PV
     /* Prefetch the VMCB if we expect to use it later in the context switch */
-    if ( cpu_has_svm && is_pv_64bit_domain(nd) && !is_idle_domain(nd) )
+    if ( using_svm() && is_pv_64bit_domain(nd) && !is_idle_domain(nd) )
         svm_load_segs_prefetch();
 #endif
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 01 12:01:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Aug 2024 12:01:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.769671.1180570 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZUUd-00007Z-0j; Thu, 01 Aug 2024 12:01:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 769671.1180570; Thu, 01 Aug 2024 12: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 1sZUUc-00007S-U7; Thu, 01 Aug 2024 12:01:14 +0000
Received: by outflank-mailman (input) for mailman id 769671;
 Thu, 01 Aug 2024 12:01:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUUc-00007I-Di
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:01:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUUc-0004b0-Cv
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:01:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUUc-0000WN-CD
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:01: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+vfeg4Of3VvYo/eIZbs/BJFERxvncuGaZE4Vv6Tmv3Q=; b=ZH/4O4Ppd8lOj/Jv44OGyqQq7H
	5lXz3SHsj9eQdKiH27ij8NcIo5cTb0mFQGJYGBzu6GkvXflRcfVgAU9jgLrFJGMh8SdokdCABuYZm
	hHMCQqhaXXB99h0G9YWaONYLe8UbofMAZWDQNFqfT7YLD7pa5lmOhV7rb4YxHwHrYKlE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/oprofile: guard svm specific symbols with CONFIG_AMD_SVM
Message-Id: <E1sZUUc-0000WN-CD@xenbits.xenproject.org>
Date: Thu, 01 Aug 2024 12:01:14 +0000

commit 29fce29d892e1b760e32d5f4615a95914b701cf4
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Thu Aug 1 13:57:28 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 13:57:28 2024 +0200

    x86/oprofile: guard svm specific symbols with CONFIG_AMD_SVM
    
    The symbol svm_stgi_label is AMD-V specific so guard its usage in common code
    with CONFIG_AMD_SVM.
    
    Since SVM depends on HVM, it can be used alone.
    Also, use #ifdef instead of #if.
    
    No functional change intended.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/oprofile/op_model_athlon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/oprofile/op_model_athlon.c b/xen/arch/x86/oprofile/op_model_athlon.c
index 69fd3fcc86..782fa606ee 100644
--- a/xen/arch/x86/oprofile/op_model_athlon.c
+++ b/xen/arch/x86/oprofile/op_model_athlon.c
@@ -320,7 +320,7 @@ static int cf_check athlon_check_ctrs(
 	struct vcpu *v = current;
 	unsigned int const nr_ctrs = model->num_counters;
 
-#if CONFIG_HVM
+#ifdef CONFIG_AMD_SVM
 	struct cpu_user_regs *guest_regs = guest_cpu_user_regs();
 
 	if (!guest_mode(regs) &&
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 01 12:01:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 01 Aug 2024 12:01:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.769673.1180574 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZUUn-0000Co-1w; Thu, 01 Aug 2024 12:01:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 769673.1180574; Thu, 01 Aug 2024 12:01:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZUUm-0000Cf-Ve; Thu, 01 Aug 2024 12:01:24 +0000
Received: by outflank-mailman (input) for mailman id 769673;
 Thu, 01 Aug 2024 12:01:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUUm-0000CV-Gb
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:01:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUUm-0004ci-Ft
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:01:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZUUm-0000XR-F5
 for xen-changelog@lists.xenproject.org; Thu, 01 Aug 2024 12:01: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=npPt3rx5el/WCaLVatIZViDTB4oUkcpvNhKDh7hsWN8=; b=XcujM57qFDDng8HNLvZABF7SeI
	BOuGN0s5tQmviEFeRvIFYfThFWXFfxA+ajc0byEzmgqVex2l8IRwD8qUfVYCx+3IEpP5TEQ2iCThF
	IlZYFgH6vUn4MG2MO/1szwhQRC0rDN/RkAQp6Ckr+A6oSzLeCGaqIRN7XSSheK/ztMd4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vmx: replace CONFIG_HVM with CONFIG_INTEL_VMX in vmx.h
Message-Id: <E1sZUUm-0000XR-F5@xenbits.xenproject.org>
Date: Thu, 01 Aug 2024 12:01:24 +0000

commit 1c4fb9bb49b7babbcaa0b62384841ba4acb49356
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Thu Aug 1 13:57:52 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 13:57:52 2024 +0200

    x86/vmx: replace CONFIG_HVM with CONFIG_INTEL_VMX in vmx.h
    
    As now we got a separate config option for VMX which itself depends on
    CONFIG_HVM, we need to use it to provide vmx_pi_hooks_{assign,deassign}
    stubs for case when VMX is disabled while HVM is enabled.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/hvm/vmx/vmx.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmx.h b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
index 1489dd05c2..f0ec459622 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
@@ -599,7 +599,7 @@ void vmx_pi_desc_fixup(unsigned int cpu);
 
 void vmx_sync_exit_bitmap(struct vcpu *v);
 
-#ifdef CONFIG_HVM
+#ifdef CONFIG_INTEL_VMX
 void vmx_pi_hooks_assign(struct domain *d);
 void vmx_pi_hooks_deassign(struct domain *d);
 #else
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 03:55:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 03:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770091.1180948 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjNp-0006q8-5t; Fri, 02 Aug 2024 03:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770091.1180948; Fri, 02 Aug 2024 03: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 1sZjNp-0006q0-3G; Fri, 02 Aug 2024 03:55:13 +0000
Received: by outflank-mailman (input) for mailman id 770091;
 Fri, 02 Aug 2024 03:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjNn-0006ps-VM
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjNn-0002rn-U6
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjNn-0004re-Sf
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nbKo1bMcaFCSHTH/HtEiL1DVAv4Mf7aYWfhlYf2mKZ0=; b=2nqss1sWuvxBFYzt+AA7BXOl2r
	yqQ3zW9ouNI74/gx5VtRCH+sN6YYPldjrhGfsCtXErDg4EVKXy0UZT3YQIXZmMJJTB3KtVGRQyE8K
	fJw8jOtLl9iuAMJiTdAjwk64u0qNi00Mt6sa+IPDsYaIi6a+AJIuJ2/hlm/vOZZueMyo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/domain: Implement arch_init_idle_domain()
Message-Id: <E1sZjNn-0004re-Sf@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 03:55:11 +0000

commit fdb4d76ff3c44752d067fe598c0c021389030c63
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jul 18 21:12:31 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jul 31 11:14:50 2024 +0100

    x86/domain: Implement arch_init_idle_domain()
    
    The idle domain needs d->arch.ctxt_switch initialised on x86.  Implement the
    new arch_init_idle_domain() in order to do this.
    
    Intentionally remove cpu_policy's initialisation to ZERO_BLOCK_PTR.  It has
    never tripped since it's introduction, and is weird to have in isolation
    without a similar approach on other pointers.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domain.c             | 21 +++++++++++----------
 xen/arch/x86/include/asm/domain.h |  3 +++
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index ccadfe0c9e..a6cb7a98ed 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -768,6 +768,17 @@ static bool emulation_flags_ok(const struct domain *d, uint32_t emflags)
     return true;
 }
 
+void __init arch_init_idle_domain(struct domain *d)
+{
+    static const struct arch_csw idle_csw = {
+        .from = paravirt_ctxt_switch_from,
+        .to   = paravirt_ctxt_switch_to,
+        .tail = idle_loop,
+    };
+
+    d->arch.ctxt_switch = &idle_csw;
+}
+
 int arch_domain_create(struct domain *d,
                        struct xen_domctl_createdomain *config,
                        unsigned int flags)
@@ -783,16 +794,6 @@ int arch_domain_create(struct domain *d,
     /* Minimal initialisation for the idle domain. */
     if ( unlikely(is_idle_domain(d)) )
     {
-        static const struct arch_csw idle_csw = {
-            .from = paravirt_ctxt_switch_from,
-            .to   = paravirt_ctxt_switch_to,
-            .tail = idle_loop,
-        };
-
-        d->arch.ctxt_switch = &idle_csw;
-
-        d->arch.cpu_policy = ZERO_BLOCK_PTR; /* Catch stray misuses. */
-
         return 0;
     }
 
diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index f5daeb182b..bca3258d69 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -779,6 +779,9 @@ struct arch_vcpu_io {
 /* Maxphysaddr supportable by the paging infrastructure. */
 unsigned int domain_max_paddr_bits(const struct domain *d);
 
+#define arch_init_idle_domain arch_init_idle_domain
+void arch_init_idle_domain(struct domain *d);
+
 #endif /* __ASM_DOMAIN_H__ */
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 03:55:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 03:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770090.1180944 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjNg-0006om-4c; Fri, 02 Aug 2024 03:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770090.1180944; Fri, 02 Aug 2024 03: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 1sZjNg-0006oe-1s; Fri, 02 Aug 2024 03:55:04 +0000
Received: by outflank-mailman (input) for mailman id 770090;
 Fri, 02 Aug 2024 03:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjNe-0006oY-7L
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjNd-0002rj-QJ
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjNd-0004qh-P2
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eOpoWSFIxQqrq6LMDqy+YxVLpPYH3gJkgnrtnvoq9Es=; b=eR3aG3O+aVnEXSSW/S4BBuGpaM
	LkxpTCze0AdCo4bEWbaRW8yvOqk0TRI+0CrMLi7Otk16JihA8o8zGublQlQeWI3er1fU+xovU7QPV
	SsvylTxDFTF3+RcoFAXCCJyrekVsu5mLn7SePsOSskJzTY8l3PVwrNFSknDGWBaEvDk8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/domain: Introduce arch_init_idle_domain()
Message-Id: <E1sZjNd-0004qh-P2@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 03:55:01 +0000

commit 694ce812e7cb643236e8e677aca763c5f2aa4f4b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jul 18 20:54:05 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jul 31 11:14:50 2024 +0100

    xen/domain: Introduce arch_init_idle_domain()
    
    The idle domain causes a large amount of complexity in domain_create() because
    of x86's need to initialise d->arch.ctxt_switch in arch_domain_create().
    
    In order to address this, introduce an optional hook to perform extra
    initialisation of the idle domain.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/domain.c     | 3 +++
 xen/include/xen/sched.h | 5 +++++
 2 files changed, 8 insertions(+)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 7b47696dd3..f1d54845ec 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -686,6 +686,9 @@ struct domain *domain_create(domid_t domid,
 
     rangeset_domain_initialise(d);
 
+    if ( is_idle_domain(d) )
+        arch_init_idle_domain(d);
+
     /* DOMID_{XEN,IO,etc} (other than IDLE) are sufficiently constructed. */
     if ( is_system_domain(d) && !is_idle_domain(d) )
         return d;
diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h
index 2dcd1d1a4f..90666576c2 100644
--- a/xen/include/xen/sched.h
+++ b/xen/include/xen/sched.h
@@ -728,6 +728,11 @@ struct domain *domain_create(domid_t domid,
                              struct xen_domctl_createdomain *config,
                              unsigned int flags);
 
+#ifndef arch_init_idle_domain
+/* Optional, if there's any construction necessary for DOMID_IDLE */
+static inline void arch_init_idle_domain(struct domain *d) {}
+#endif
+
 /*
  * rcu_lock_domain_by_id() is more efficient than get_domain_by_id().
  * This is the preferred function if the returned domain reference
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 03:55:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 03:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770092.1180951 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjNz-0006sh-78; Fri, 02 Aug 2024 03:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770092.1180951; Fri, 02 Aug 2024 03: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 1sZjNz-0006sa-4h; Fri, 02 Aug 2024 03:55:23 +0000
Received: by outflank-mailman (input) for mailman id 770092;
 Fri, 02 Aug 2024 03:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjNy-0006sG-1p
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjNy-0002rz-0z
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjNy-0004sG-03
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fSa/fgbm898p8dYEJXwInwkHN+ziiFXo8+5pm8rE1jI=; b=xecpBIWtOIpecOo8fsVJl9ihZy
	+3A/aP/Kk9maDmpVMBDXrSC2ZqFrx2YmLrSgOzlSBcQXtv6RExGGubSC+ar8UBKWgiOKTD+i/5nF5
	/6US4wliBcqXdiJt1wp1941kI9Q2TMicTiFXa/gR0bzoDhwdPqwXlsqUn6IDLTjfx/DM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/domain: Simpliy domain_create() now the idle domain is complete earlier
Message-Id: <E1sZjNy-0004sG-03@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 03:55:22 +0000

commit a259a658f203e3b17734c42f2ca6e75344e2de22
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jul 18 21:20:52 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jul 31 11:14:50 2024 +0100

    xen/domain: Simpliy domain_create() now the idle domain is complete earlier
    
    With x86 implementing arch_init_idle_domain(), there is no longer any need to
    call arch_domain_create() with the idle domain.
    
    Have the idle domain exit early with all other system domains.  Move the
    static-analysis ASSERT() earlier.  Then, remove the !is_idle_domain()
    protections around the majority of domain_create() and remove one level of
    indentation.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/domain.c | 127 +++++++++++++++++++++++++---------------------------
 1 file changed, 60 insertions(+), 67 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index f1d54845ec..2566604738 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -689,95 +689,88 @@ struct domain *domain_create(domid_t domid,
     if ( is_idle_domain(d) )
         arch_init_idle_domain(d);
 
-    /* DOMID_{XEN,IO,etc} (other than IDLE) are sufficiently constructed. */
-    if ( is_system_domain(d) && !is_idle_domain(d) )
+    /* DOMID_{XEN,IO,IDLE,etc} are sufficiently constructed. */
+    if ( is_system_domain(d) )
         return d;
 
+    /*
+     * This assertion helps static analysis tools infer that config cannot be
+     * NULL in this branch, which in turn means that it can be safely
+     * dereferenced. Therefore, this assertion is not redundant.
+     */
+    ASSERT(config);
+
 #ifdef CONFIG_HAS_PIRQ
-    if ( !is_idle_domain(d) )
-    {
-        if ( !is_hardware_domain(d) )
-            d->nr_pirqs = nr_static_irqs + extra_domU_irqs;
-        else
-            d->nr_pirqs = extra_hwdom_irqs ? nr_static_irqs + extra_hwdom_irqs
-                                           : arch_hwdom_irqs(d);
-        d->nr_pirqs = min(d->nr_pirqs, nr_irqs);
+    if ( !is_hardware_domain(d) )
+        d->nr_pirqs = nr_static_irqs + extra_domU_irqs;
+    else
+        d->nr_pirqs = extra_hwdom_irqs ? nr_static_irqs + extra_hwdom_irqs
+                                       : arch_hwdom_irqs(d);
+    d->nr_pirqs = min(d->nr_pirqs, nr_irqs);
 
-        radix_tree_init(&d->pirq_tree);
-    }
+    radix_tree_init(&d->pirq_tree);
 #endif
 
     if ( (err = arch_domain_create(d, config, flags)) != 0 )
         goto fail;
     init_status |= INIT_arch;
 
-    if ( !is_idle_domain(d) )
-    {
-        /*
-         * The assertion helps static analysis tools infer that config cannot
-         * be NULL in this branch, which in turn means that it can be safely
-         * dereferenced. Therefore, this assertion is not redundant.
-         */
-        ASSERT(config);
-
-        watchdog_domain_init(d);
-        init_status |= INIT_watchdog;
+    watchdog_domain_init(d);
+    init_status |= INIT_watchdog;
 
-        err = -ENOMEM;
-        d->iomem_caps = rangeset_new(d, "I/O Memory", RANGESETF_prettyprint_hex);
-        d->irq_caps   = rangeset_new(d, "Interrupts", 0);
-        if ( !d->iomem_caps || !d->irq_caps )
-            goto fail;
+    err = -ENOMEM;
+    d->iomem_caps = rangeset_new(d, "I/O Memory", RANGESETF_prettyprint_hex);
+    d->irq_caps   = rangeset_new(d, "Interrupts", 0);
+    if ( !d->iomem_caps || !d->irq_caps )
+        goto fail;
 
-        if ( (err = xsm_domain_create(XSM_HOOK, d, config->ssidref)) != 0 )
-            goto fail;
+    if ( (err = xsm_domain_create(XSM_HOOK, d, config->ssidref)) != 0 )
+        goto fail;
 
-        d->controller_pause_count = 1;
-        atomic_inc(&d->pause_count);
+    d->controller_pause_count = 1;
+    atomic_inc(&d->pause_count);
 
-        if ( (err = evtchn_init(d, config->max_evtchn_port)) != 0 )
-            goto fail;
-        init_status |= INIT_evtchn;
+    if ( (err = evtchn_init(d, config->max_evtchn_port)) != 0 )
+        goto fail;
+    init_status |= INIT_evtchn;
 
-        if ( (err = grant_table_init(d, config->max_grant_frames,
-                                     config->max_maptrack_frames,
-                                     config->grant_opts)) != 0 )
-            goto fail;
-        init_status |= INIT_gnttab;
+    if ( (err = grant_table_init(d, config->max_grant_frames,
+                                 config->max_maptrack_frames,
+                                 config->grant_opts)) != 0 )
+        goto fail;
+    init_status |= INIT_gnttab;
 
-        if ( (err = argo_init(d)) != 0 )
-            goto fail;
+    if ( (err = argo_init(d)) != 0 )
+        goto fail;
 
-        err = -ENOMEM;
+    err = -ENOMEM;
+    d->pbuf = xzalloc_array(char, DOMAIN_PBUF_SIZE);
+    if ( !d->pbuf )
+        goto fail;
 
-        d->pbuf = xzalloc_array(char, DOMAIN_PBUF_SIZE);
-        if ( !d->pbuf )
-            goto fail;
+    if ( (err = sched_init_domain(d, config->cpupool_id)) != 0 )
+        goto fail;
 
-        if ( (err = sched_init_domain(d, config->cpupool_id)) != 0 )
-            goto fail;
+    if ( (err = late_hwdom_init(d)) != 0 )
+        goto fail;
 
-        if ( (err = late_hwdom_init(d)) != 0 )
-            goto fail;
+    /*
+     * Must not fail beyond this point, as our caller doesn't know whether
+     * the domain has been entered into domain_list or not.
+     */
 
-        /*
-         * Must not fail beyond this point, as our caller doesn't know whether
-         * the domain has been entered into domain_list or not.
-         */
+    spin_lock(&domlist_update_lock);
+    pd = &domain_list; /* NB. domain_list maintained in order of domid. */
+    for ( pd = &domain_list; *pd != NULL; pd = &(*pd)->next_in_list )
+        if ( (*pd)->domain_id > d->domain_id )
+            break;
+    d->next_in_list = *pd;
+    d->next_in_hashbucket = domain_hash[DOMAIN_HASH(domid)];
+    rcu_assign_pointer(*pd, d);
+    rcu_assign_pointer(domain_hash[DOMAIN_HASH(domid)], d);
+    spin_unlock(&domlist_update_lock);
 
-        spin_lock(&domlist_update_lock);
-        pd = &domain_list; /* NB. domain_list maintained in order of domid. */
-        for ( pd = &domain_list; *pd != NULL; pd = &(*pd)->next_in_list )
-            if ( (*pd)->domain_id > d->domain_id )
-                break;
-        d->next_in_list = *pd;
-        d->next_in_hashbucket = domain_hash[DOMAIN_HASH(domid)];
-        rcu_assign_pointer(*pd, d);
-        rcu_assign_pointer(domain_hash[DOMAIN_HASH(domid)], d);
-        spin_unlock(&domlist_update_lock);
-
-        memcpy(d->handle, config->handle, sizeof(d->handle));
-    }
+    memcpy(d->handle, config->handle, sizeof(d->handle));
 
     return d;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 03:55:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 03:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770093.1180956 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjO9-0006wW-9P; Fri, 02 Aug 2024 03:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770093.1180956; Fri, 02 Aug 2024 03: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 1sZjO9-0006wP-6E; Fri, 02 Aug 2024 03:55:33 +0000
Received: by outflank-mailman (input) for mailman id 770093;
 Fri, 02 Aug 2024 03:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjO8-0006w8-4w
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjO8-0002s7-46
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjO8-0004sr-3K
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NPaysQrM1A3kInv3Jvy9p+8YfMXuChQrA0NlItA0cgs=; b=lWLdkldXselaKlCTZj8iBubNt1
	/vJp6rbCenJmlb0Irpxmct/S2V+0pbV+HieigoNs24SOykzXtmBY77MTrVWIJ6bej4AWpGIW/OPas
	rxibx0TZBqoSY7CB1Rj6pUqofCTYsJY8RGWIT4XLCZ3pPAqF8SGFYMWpDyObqUBIYmgk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] arch/domain: Clean up the idle domain remnants in arch_domain_create()
Message-Id: <E1sZjO8-0004sr-3K@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 03:55:32 +0000

commit a5b8e72e9e2e59941cc76978725bb9ee04eba722
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Jul 18 21:22:41 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jul 31 11:14:50 2024 +0100

    arch/domain: Clean up the idle domain remnants in arch_domain_create()
    
    With arch_domain_create() no longer being called with the idle domain, drop
    the last remaining logic.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/domain.c |  6 ------
 xen/arch/x86/domain.c | 13 -------------
 2 files changed, 19 deletions(-)

diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 7cfcefd279..3ba959f866 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -706,12 +706,6 @@ int arch_domain_create(struct domain *d,
 
     BUILD_BUG_ON(GUEST_MAX_VCPUS < MAX_VIRT_CPUS);
 
-    /* Idle domains do not need this setup */
-    if ( is_idle_domain(d) )
-        return 0;
-
-    ASSERT(config != NULL);
-
 #ifdef CONFIG_IOREQ_SERVER
     ioreq_domain_init(d);
 #endif
diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index a6cb7a98ed..c71b9023cb 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -791,19 +791,6 @@ int arch_domain_create(struct domain *d,
 
     spin_lock_init(&d->arch.e820_lock);
 
-    /* Minimal initialisation for the idle domain. */
-    if ( unlikely(is_idle_domain(d)) )
-    {
-        return 0;
-    }
-
-    if ( !config )
-    {
-        /* Only IDLE is allowed with no config. */
-        ASSERT_UNREACHABLE();
-        return -EINVAL;
-    }
-
     if ( d->domain_id && cpu_has_amd_erratum(&boot_cpu_data, AMD_ERRATUM_121) )
     {
         if ( !opt_allow_unsafe )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 03:55:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 03:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770094.1180959 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjOJ-000700-Bt; Fri, 02 Aug 2024 03:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770094.1180959; Fri, 02 Aug 2024 03: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 1sZjOJ-0006zs-9Q; Fri, 02 Aug 2024 03:55:43 +0000
Received: by outflank-mailman (input) for mailman id 770094;
 Fri, 02 Aug 2024 03:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjOI-0006zk-7n
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjOI-0002sH-72
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjOI-0004tL-6H
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=W/UKoFKaUWpDYJD1PL7KehGocPXRUsJ5qqJEhWkCfww=; b=Vy4hb9hIfmfsa6Yx8T8EKjkd/X
	iboXB6RJh7zwE1p9539g5cEArH+FjtsVvetKTSzn9XdsMiy/3i58wT/fGXqqdxiUuk7y88xC22hAR
	W5Tij5r4g8leA/VFXtIvott7UMySWqmlmbwwnFI4+vQxHiPEbkfDimvqaQRNzXmLugUk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86+Arm: drop (rename) __virt_to_maddr() / __maddr_to_virt()
Message-Id: <E1sZjOI-0004tL-6H@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 03:55:42 +0000

commit 96f35de69e593a9d9c348ae33ba17cf3cc5a9a79
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jul 31 12:36:14 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jul 31 12:36:14 2024 +0200

    x86+Arm: drop (rename) __virt_to_maddr() / __maddr_to_virt()
    
    There's no use of them anymore except in the definitions of the non-
    underscore-prefixed aliases.
    
    On Arm convert the (renamed) inline function to a macro.
    
    On x86 rename the inline functions, adjust the virt_to_maddr() #define,
    and purge the maddr_to_virt() one, thus eliminating a bogus cast which
    would have allowed the passing of a pointer type variable into
    maddr_to_virt() to go silently.
    
    No functional change intended.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/mm.h          | 10 ++++------
 xen/arch/x86/hvm/nestedhvm.c           |  2 +-
 xen/arch/x86/include/asm/page.h        |  2 --
 xen/arch/x86/include/asm/x86_64/page.h |  5 +++--
 4 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h
index 48538b5337..f6ba611f01 100644
--- a/xen/arch/arm/include/asm/mm.h
+++ b/xen/arch/arm/include/asm/mm.h
@@ -256,12 +256,10 @@ static inline void __iomem *ioremap_wc(paddr_t start, size_t len)
 /* Page-align address and convert to frame number format */
 #define paddr_to_pfn_aligned(paddr)    paddr_to_pfn(PAGE_ALIGN(paddr))
 
-static inline paddr_t __virt_to_maddr(vaddr_t va)
-{
-    uint64_t par = va_to_par(va);
-    return (par & PADDR_MASK & PAGE_MASK) | (va & ~PAGE_MASK);
-}
-#define virt_to_maddr(va)   __virt_to_maddr((vaddr_t)(va))
+#define virt_to_maddr(va) ({                                        \
+    vaddr_t va_ = (vaddr_t)(va);                                    \
+    (va_to_par(va_) & PADDR_MASK & PAGE_MASK) | (va_ & ~PAGE_MASK); \
+})
 
 #ifdef CONFIG_ARM_32
 /**
diff --git a/xen/arch/x86/hvm/nestedhvm.c b/xen/arch/x86/hvm/nestedhvm.c
index 451c4da6d4..d895a73844 100644
--- a/xen/arch/x86/hvm/nestedhvm.c
+++ b/xen/arch/x86/hvm/nestedhvm.c
@@ -125,7 +125,7 @@ static int __init cf_check nestedhvm_setup(void)
     /* shadow_io_bitmaps can't be declared static because
      *   they must fulfill hw requirements (page aligned section)
      *   and doing so triggers the ASSERT(va >= XEN_VIRT_START)
-     *   in __virt_to_maddr()
+     *   in virt_to_maddr()
      *
      * So as a compromise pre-allocate them when xen boots.
      * This function must be called from within start_xen() when
diff --git a/xen/arch/x86/include/asm/page.h b/xen/arch/x86/include/asm/page.h
index e48571de93..e01af28916 100644
--- a/xen/arch/x86/include/asm/page.h
+++ b/xen/arch/x86/include/asm/page.h
@@ -256,8 +256,6 @@ void copy_page_sse2(void *to, const void *from);
 #define mfn_valid(mfn)      __mfn_valid(mfn_x(mfn))
 #define virt_to_mfn(va)     __virt_to_mfn(va)
 #define mfn_to_virt(mfn)    __mfn_to_virt(mfn)
-#define virt_to_maddr(va)   __virt_to_maddr((unsigned long)(va))
-#define maddr_to_virt(ma)   __maddr_to_virt((unsigned long)(ma))
 #define maddr_to_page(ma)   __maddr_to_page(ma)
 #define page_to_maddr(pg)   __page_to_maddr(pg)
 #define virt_to_page(va)    __virt_to_page(va)
diff --git a/xen/arch/x86/include/asm/x86_64/page.h b/xen/arch/x86/include/asm/x86_64/page.h
index 465a707312..201b79f99e 100644
--- a/xen/arch/x86/include/asm/x86_64/page.h
+++ b/xen/arch/x86/include/asm/x86_64/page.h
@@ -34,7 +34,7 @@ static inline unsigned long canonicalise_addr(unsigned long addr)
 #define pdx_to_virt(pdx) ((void *)(DIRECTMAP_VIRT_START + \
                                    ((unsigned long)(pdx) << PAGE_SHIFT)))
 
-static inline unsigned long __virt_to_maddr(unsigned long va)
+static inline unsigned long virt_to_maddr(unsigned long va)
 {
     ASSERT(va < DIRECTMAP_VIRT_END);
     if ( va >= DIRECTMAP_VIRT_START )
@@ -47,8 +47,9 @@ static inline unsigned long __virt_to_maddr(unsigned long va)
 
     return xen_phys_start + va - XEN_VIRT_START;
 }
+#define virt_to_maddr(va) virt_to_maddr((unsigned long)(va))
 
-static inline void *__maddr_to_virt(unsigned long ma)
+static inline void *maddr_to_virt(unsigned long ma)
 {
     /* Offset in the direct map, accounting for pdx compression */
     unsigned long va_offset = maddr_to_directmapoff(ma);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 03:55:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 03:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770095.1180963 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjOU-00072n-DV; Fri, 02 Aug 2024 03:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770095.1180963; Fri, 02 Aug 2024 03: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 1sZjOU-00072f-Aw; Fri, 02 Aug 2024 03:55:54 +0000
Received: by outflank-mailman (input) for mailman id 770095;
 Fri, 02 Aug 2024 03:55:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjOS-00072N-CI
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:55:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjOS-0002sP-B6
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjOS-0004tv-9F
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xZE5SoS9ds3eLwLiyQiLQxIwuyU44+j0f7W2us2kLPo=; b=K/1cFTZQlh6QYOIYAwTlRb4ap0
	ov6kd+c+OB2YoTMMtaI3qsoiICTP1H0K1KkON/sXuKulq3XBYB2sUHwkH31Z9YeoZIuhnW+A3Bs42
	Zk7q8f3el4Ihkhyyxa39ipl0NqpWNZALiCaS0E8O1uAJFBqEj5esFQQAwh3ObQvLgVdk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] public/x86: don't include common xen.h from arch-specific one
Message-Id: <E1sZjOS-0004tv-9F@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 03:55:52 +0000

commit ce6c6a697edf40763a8512369672a399821b17bf
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jul 31 12:39:35 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jul 31 12:39:35 2024 +0200

    public/x86: don't include common xen.h from arch-specific one
    
    No other arch-*.h does so, and arch-x86/xen.h really just takes the role
    of arch-x86_32.h and arch-x86_64.h (by those two forwarding there). With
    xen.h itself including the per-arch headers, doing so is also kind of
    backwards anyway, and just calling for problems. There's exactly one
    place where arch-x86/xen.h is included when really xen.h is meant (for
    wanting XEN_GUEST_HANDLE_64() to be made available, the default
    definition of which lives in the common xen.h).
    
    This then addresses a violation of Misra C:2012 Directive 4.10
    ("Precautions shall be taken in order to prevent the contents of a
    header file being included more than once").
    
    Reported-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/include/public/arch-x86/xen.h    | 2 --
 xen/include/xen/lib/x86/cpu-policy.h | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/include/public/arch-x86/xen.h b/xen/include/public/arch-x86/xen.h
index a9a87d9b50..fc24879866 100644
--- a/xen/include/public/arch-x86/xen.h
+++ b/xen/include/public/arch-x86/xen.h
@@ -7,8 +7,6 @@
  * Copyright (c) 2004-2006, K A Fraser
  */
 
-#include "../xen.h"
-
 #ifndef __XEN_PUBLIC_ARCH_X86_XEN_H__
 #define __XEN_PUBLIC_ARCH_X86_XEN_H__
 
diff --git a/xen/include/xen/lib/x86/cpu-policy.h b/xen/include/xen/lib/x86/cpu-policy.h
index d26012c6da..f43e1a3b21 100644
--- a/xen/include/xen/lib/x86/cpu-policy.h
+++ b/xen/include/xen/lib/x86/cpu-policy.h
@@ -439,7 +439,7 @@ void x86_cpu_policy_fill_native(struct cpu_policy *p);
 void x86_cpu_policy_clear_out_of_range_leaves(struct cpu_policy *p);
 
 #ifdef __XEN__
-#include <public/arch-x86/xen.h>
+#include <public/xen.h>
 typedef XEN_GUEST_HANDLE_64(xen_cpuid_leaf_t) cpuid_leaf_buffer_t;
 typedef XEN_GUEST_HANDLE_64(xen_msr_entry_t) msr_entry_buffer_t;
 #else
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 03:56:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 03:56:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770096.1180967 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjOe-000752-Ez; Fri, 02 Aug 2024 03:56:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770096.1180967; Fri, 02 Aug 2024 03: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 1sZjOe-00074v-CO; Fri, 02 Aug 2024 03:56:04 +0000
Received: by outflank-mailman (input) for mailman id 770096;
 Fri, 02 Aug 2024 03:56:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjOc-00074l-Eo
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:56:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjOc-0002t3-E4
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjOc-0004v2-DH
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:56:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DOrT1kjk6MD9qQekK7jnkPRklLW2xQ2+D4IIOJpmx5A=; b=CdeDlMvO8BGNyZk44TWFr+bDsO
	E8u8qqmgDEi089CloQMZoveRGSAm8uZ+PH7J5CiDU9Kqnc3hngYfjdPovknTXCCXW4YijGZT8AXhK
	3XRZxEa2s34saH7FvjpIF6a05TY1jiJs2kcZQTzF7muoPYpBEfnCD168YnyxBREG9+xg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: get_pat_flags() is needed only by shadow code
Message-Id: <E1sZjOc-0004v2-DH@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 03:56:02 +0000

commit 157c693e9a488fe125ffe7adfb807b783a7d1757
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Jul 31 12:40:19 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jul 31 12:40:19 2024 +0200

    x86/HVM: get_pat_flags() is needed only by shadow code
    
    Therefore with SHADOW_PAGING=n this is better compiled out, to avoid
    leaving around unreachable/dead code.
    
    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/arch/x86/hvm/mtrr.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/hvm/mtrr.c b/xen/arch/x86/hvm/mtrr.c
index 4620ed427c..797f2ae7fd 100644
--- a/xen/arch/x86/hvm/mtrr.c
+++ b/xen/arch/x86/hvm/mtrr.c
@@ -271,6 +271,8 @@ int mtrr_get_type(const struct mtrr_state *m, paddr_t pa, unsigned int order)
    return overlap_mtrr_pos;
 }
 
+#ifdef CONFIG_SHADOW_PAGING
+
 /*
  * return the memory type from PAT.
  * NOTE: valid only when paging is enabled.
@@ -359,6 +361,8 @@ uint32_t get_pat_flags(struct vcpu *v,
     return pat_type_2_pte_flags(pat_entry_value);
 }
 
+#endif /* CONFIG_SHADOW_PAGING */
+
 static inline bool valid_mtrr_type(uint8_t type)
 {
     switch ( type )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 03:56:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 03:56:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770097.1180972 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjOo-000797-Ga; Fri, 02 Aug 2024 03:56:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770097.1180972; Fri, 02 Aug 2024 03: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 1sZjOo-00078z-Ds; Fri, 02 Aug 2024 03:56:14 +0000
Received: by outflank-mailman (input) for mailman id 770097;
 Fri, 02 Aug 2024 03:56:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjOm-00078p-Iz
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:56:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjOm-0002tA-Gz
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:56:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjOm-0004vf-GE
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:56:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ksWZl3vFl36bdX14GhjydQAQNCHZacmq5Nw7bRjYwJs=; b=fTZDdIJRKlgRkJEajP0pk9OxXJ
	3KSYSwnWH7G2AnQbBv3UZyZO6xChsv7o8EFQ1OVAPqSPZulB1emjbsUHyXO0kAN8c1CekMtfwJPvf
	3Ipzv6Wvmir4kDNgdUryEqAitWI54aUEt5FVDsHLHNHAefbxHOkE4eBam669l4lLAdtQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/dom0: fix restoring %cr3 and the mapcache override on PV build error
Message-Id: <E1sZjOm-0004vf-GE@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 03:56:12 +0000

commit 1fc3f77113dd43b14fa7ef5936dcdba120c0b63f
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jul 31 12:41:02 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jul 31 12:41:02 2024 +0200

    x86/dom0: fix restoring %cr3 and the mapcache override on PV build error
    
    One of the error paths in the PV dom0 builder section that runs on the guest
    page-tables wasn't restoring the Xen value of %cr3, neither removing the
    mapcache override.
    
    Fixes: 079ff2d32c3d ('libelf-loader: introduce elf_load_image')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/pv/dom0_build.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index d8043fa58a..57e58a02e7 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -825,6 +825,8 @@ int __init dom0_construct_pv(struct domain *d,
     rc = elf_load_binary(&elf);
     if ( rc < 0 )
     {
+        mapcache_override_current(NULL);
+        switch_cr3_cr4(current->arch.cr3, read_cr4());
         printk("Failed to load the kernel binary\n");
         goto out;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 03:56:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 03:56:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770098.1180975 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjOy-0007Bl-Hq; Fri, 02 Aug 2024 03:56:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770098.1180975; Fri, 02 Aug 2024 03: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 1sZjOy-0007Be-FL; Fri, 02 Aug 2024 03:56:24 +0000
Received: by outflank-mailman (input) for mailman id 770098;
 Fri, 02 Aug 2024 03:56:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjOw-0007BW-Lu
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:56:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjOw-0002us-LD
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:56:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjOw-0004wH-JK
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:56:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7dF5+sC9PcQVtLE+ttG6RZDnJUqkxXBcO+iumFH+jPM=; b=UyfeG6SOMZSCkDJhfNj5Ea8FqJ
	KBu/wgyDFEuiPdCG49vVRrCq6xn3tPLUVNWuiImqIwvhGrnXYN+Q603XA7BlgJbmWyJ2Ol/ydKoLo
	Mp4rcusb717MraFRr3Bmj3AfokHX47ENp54zMi+NHACKN24f4rk+Rpo0HzhCgjNkyFnY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/altcall: further refine clang workaround
Message-Id: <E1sZjOw-0004wH-JK@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 03:56:22 +0000

commit 561cba38ff551383a628dc93e64ab0691cfc92bf
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Jul 31 12:41:22 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jul 31 12:41:22 2024 +0200

    x86/altcall: further refine clang workaround
    
    The current code in ALT_CALL_ARG() won't successfully workaround the clang
    code-generation issue if the arg parameter has a size that's not a power of 2.
    While there are no such sized parameters at the moment, improve the workaround
    to also be effective when such sizes are used.
    
    Instead of using a union with a long use an unsigned long that's first
    initialized to 0 and afterwards set to the argument value.
    
    Reported-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Suggested-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/alternative.h | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/include/asm/alternative.h b/xen/arch/x86/include/asm/alternative.h
index e63b459276..a86eadfaec 100644
--- a/xen/arch/x86/include/asm/alternative.h
+++ b/xen/arch/x86/include/asm/alternative.h
@@ -169,27 +169,25 @@ extern void alternative_branches(void);
 
 #ifdef CONFIG_CC_IS_CLANG
 /*
- * Use a union with an unsigned long in order to prevent clang from
- * skipping a possible truncation of the value.  By using the union any
- * truncation is carried before the call instruction, in turn covering
- * for ABI-non-compliance in that the necessary clipping / extension of
- * the value is supposed to be carried out in the callee.
+ * Clang doesn't follow the psABI and doesn't truncate parameter values at the
+ * callee.  This can lead to bad code being generated when using alternative
+ * calls.
  *
- * Note this behavior is not mandated by the standard, and hence could
- * stop being a viable workaround, or worse, could cause a different set
- * of code-generation issues in future clang versions.
+ * Workaround it by using a temporary intermediate variable that's zeroed
+ * before being assigned the parameter value, as that forces clang to zero the
+ * register at the caller.
  *
  * This has been reported upstream:
  * https://github.com/llvm/llvm-project/issues/12579
  * https://github.com/llvm/llvm-project/issues/82598
  */
 #define ALT_CALL_ARG(arg, n)                                            \
-    register union {                                                    \
-        typeof(arg) e[sizeof(long) / sizeof(arg)];                      \
-        unsigned long r;                                                \
-    } a ## n ## _ asm ( ALT_CALL_arg ## n ) = {                         \
-        .e[0] = ({ BUILD_BUG_ON(sizeof(arg) > sizeof(void *)); (arg); })\
-    }
+    register unsigned long a ## n ## _ asm ( ALT_CALL_arg ## n ) = ({   \
+        unsigned long tmp = 0;                                          \
+        BUILD_BUG_ON(sizeof(arg) > sizeof(unsigned long));              \
+        *(typeof(arg) *)&tmp = (arg);                                   \
+        tmp;                                                            \
+    })
 #else
 #define ALT_CALL_ARG(arg, n) \
     register typeof(arg) a ## n ## _ asm ( ALT_CALL_arg ## n ) = \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 03:56:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 03:56:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770099.1180980 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjP8-0007EM-Jh; Fri, 02 Aug 2024 03:56:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770099.1180980; Fri, 02 Aug 2024 03: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 1sZjP8-0007EF-Gt; Fri, 02 Aug 2024 03:56:34 +0000
Received: by outflank-mailman (input) for mailman id 770099;
 Fri, 02 Aug 2024 03:56:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjP6-0007E6-PR
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:56:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjP6-0002uz-OD
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:56:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjP6-0004wx-NW
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:56:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=P1IH/Sbsq79KsBVCB6bJafM+ZpsdkY2HacIETtqKcI0=; b=aif+PPJGmVInjmY49TtD7y4q8B
	ckxdOUG+LAvsxiZFzYYQyMVTDDvrHG8qRh/IRQCYKS6GTlMZkb/RFWZeN9IRaJzDgZgArmVjECsie
	OKXd0zEfY7lukpH7jU3Q+9gznVY7Y/r9Exzhj+E6Z5CY7zq7m1jMBkmjyworria8QWBk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: introduce generic non-atomic test_*bit()
Message-Id: <E1sZjP6-0004wx-NW@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 03:56:32 +0000

commit f1879b2c2584194fd54085033548911a840c9597
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Jul 31 13:04:20 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jul 31 13:04:20 2024 +0200

    xen: introduce generic non-atomic test_*bit()
    
    The following generic functions were introduced:
    * test_bit
    * generic__test_and_set_bit
    * generic__test_and_clear_bit
    * generic__test_and_change_bit
    
    These functions and macros can be useful for architectures
    that don't have corresponding arch-specific instructions.
    
    Also, the patch introduces the following generics which are
    used by the functions mentioned above:
    * BITOP_BITS_PER_WORD
    * BITOP_MASK
    * BITOP_WORD
    * BITOP_TYPE
    
    The following approach was chosen for generic*() and arch*() bit
    operation functions:
    If the bit operation function that is going to be generic starts
    with the prefix "__", then the corresponding generic/arch function
    will also contain the "__" prefix. For example:
     * test_bit() will be defined using arch_test_bit() and
       generic_test_bit().
     * __test_and_set_bit() will be defined using
       arch__test_and_set_bit() and generic__test_and_set_bit().
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/include/asm/bitops.h |  67 --------------
 xen/arch/ppc/include/asm/bitops.h |  52 -----------
 xen/arch/ppc/include/asm/page.h   |   2 +-
 xen/arch/ppc/mm-radix.c           |   2 +-
 xen/arch/x86/include/asm/bitops.h |  31 ++-----
 xen/include/xen/bitops.h          | 180 ++++++++++++++++++++++++++++++++++++++
 6 files changed, 191 insertions(+), 143 deletions(-)

diff --git a/xen/arch/arm/include/asm/bitops.h b/xen/arch/arm/include/asm/bitops.h
index 8f4bdc09d1..3c023103f7 100644
--- a/xen/arch/arm/include/asm/bitops.h
+++ b/xen/arch/arm/include/asm/bitops.h
@@ -22,9 +22,6 @@
 #define __set_bit(n,p)            set_bit(n,p)
 #define __clear_bit(n,p)          clear_bit(n,p)
 
-#define BITOP_BITS_PER_WORD     32
-#define BITOP_MASK(nr)          (1UL << ((nr) % BITOP_BITS_PER_WORD))
-#define BITOP_WORD(nr)          ((nr) / BITOP_BITS_PER_WORD)
 #define BITS_PER_BYTE           8
 
 #define ADDR (*(volatile int *) addr)
@@ -76,70 +73,6 @@ bool test_and_change_bit_timeout(int nr, volatile void *p,
 bool clear_mask16_timeout(uint16_t mask, volatile void *p,
                           unsigned int max_try);
 
-/**
- * __test_and_set_bit - Set a bit and return its old value
- * @nr: Bit to set
- * @addr: Address to count from
- *
- * This operation is non-atomic and can be reordered.
- * If two examples of this operation race, one can appear to succeed
- * but actually fail.  You must protect multiple accesses with a lock.
- */
-static inline int __test_and_set_bit(int nr, volatile void *addr)
-{
-        unsigned int mask = BITOP_MASK(nr);
-        volatile unsigned int *p =
-                ((volatile unsigned int *)addr) + BITOP_WORD(nr);
-        unsigned int old = *p;
-
-        *p = old | mask;
-        return (old & mask) != 0;
-}
-
-/**
- * __test_and_clear_bit - Clear a bit and return its old value
- * @nr: Bit to clear
- * @addr: Address to count from
- *
- * This operation is non-atomic and can be reordered.
- * If two examples of this operation race, one can appear to succeed
- * but actually fail.  You must protect multiple accesses with a lock.
- */
-static inline int __test_and_clear_bit(int nr, volatile void *addr)
-{
-        unsigned int mask = BITOP_MASK(nr);
-        volatile unsigned int *p =
-                ((volatile unsigned int *)addr) + BITOP_WORD(nr);
-        unsigned int old = *p;
-
-        *p = old & ~mask;
-        return (old & mask) != 0;
-}
-
-/* WARNING: non atomic and it can be reordered! */
-static inline int __test_and_change_bit(int nr,
-                                            volatile void *addr)
-{
-        unsigned int mask = BITOP_MASK(nr);
-        volatile unsigned int *p =
-                ((volatile unsigned int *)addr) + BITOP_WORD(nr);
-        unsigned int old = *p;
-
-        *p = old ^ mask;
-        return (old & mask) != 0;
-}
-
-/**
- * test_bit - Determine whether a bit is set
- * @nr: bit number to test
- * @addr: Address to start counting from
- */
-static inline int test_bit(int nr, const volatile void *addr)
-{
-        const volatile unsigned int *p = (const volatile unsigned int *)addr;
-        return 1UL & (p[BITOP_WORD(nr)] >> (nr & (BITOP_BITS_PER_WORD-1)));
-}
-
 #define arch_ffs(x)  ((x) ? 1 + __builtin_ctz(x) : 0)
 #define arch_ffsl(x) ((x) ? 1 + __builtin_ctzl(x) : 0)
 #define arch_fls(x)  ((x) ? 32 - __builtin_clz(x) : 0)
diff --git a/xen/arch/ppc/include/asm/bitops.h b/xen/arch/ppc/include/asm/bitops.h
index 8119b5ace8..eb3355812e 100644
--- a/xen/arch/ppc/include/asm/bitops.h
+++ b/xen/arch/ppc/include/asm/bitops.h
@@ -15,9 +15,6 @@
 #define __set_bit(n, p)         set_bit(n, p)
 #define __clear_bit(n, p)       clear_bit(n, p)
 
-#define BITOP_BITS_PER_WORD     32
-#define BITOP_MASK(nr)          (1U << ((nr) % BITOP_BITS_PER_WORD))
-#define BITOP_WORD(nr)          ((nr) / BITOP_BITS_PER_WORD)
 #define BITS_PER_BYTE           8
 
 /* PPC bit number conversion */
@@ -69,17 +66,6 @@ static inline void clear_bit(int nr, volatile void *addr)
     clear_bits(BITOP_MASK(nr), (volatile unsigned int *)addr + BITOP_WORD(nr));
 }
 
-/**
- * test_bit - Determine whether a bit is set
- * @nr: bit number to test
- * @addr: Address to start counting from
- */
-static inline int test_bit(int nr, const volatile void *addr)
-{
-    const volatile unsigned int *p = addr;
-    return 1 & (p[BITOP_WORD(nr)] >> (nr & (BITOP_BITS_PER_WORD - 1)));
-}
-
 static inline unsigned int test_and_clear_bits(
     unsigned int mask,
     volatile unsigned int *p)
@@ -133,44 +119,6 @@ static inline int test_and_set_bit(unsigned int nr, volatile void *addr)
         (volatile unsigned int *)addr + BITOP_WORD(nr)) != 0;
 }
 
-/**
- * __test_and_set_bit - Set a bit and return its old value
- * @nr: Bit to set
- * @addr: Address to count from
- *
- * This operation is non-atomic and can be reordered.
- * If two examples of this operation race, one can appear to succeed
- * but actually fail.  You must protect multiple accesses with a lock.
- */
-static inline int __test_and_set_bit(int nr, volatile void *addr)
-{
-    unsigned int mask = BITOP_MASK(nr);
-    volatile unsigned int *p = (volatile unsigned int *)addr + BITOP_WORD(nr);
-    unsigned int old = *p;
-
-    *p = old | mask;
-    return (old & mask) != 0;
-}
-
-/**
- * __test_and_clear_bit - Clear a bit and return its old value
- * @nr: Bit to clear
- * @addr: Address to count from
- *
- * This operation is non-atomic and can be reordered.
- * If two examples of this operation race, one can appear to succeed
- * but actually fail.  You must protect multiple accesses with a lock.
- */
-static inline int __test_and_clear_bit(int nr, volatile void *addr)
-{
-    unsigned int mask = BITOP_MASK(nr);
-    volatile unsigned int *p = (volatile unsigned int *)addr + BITOP_WORD(nr);
-    unsigned int old = *p;
-
-    *p = old & ~mask;
-    return (old & mask) != 0;
-}
-
 #define arch_ffs(x)  ((x) ? 1 + __builtin_ctz(x) : 0)
 #define arch_ffsl(x) ((x) ? 1 + __builtin_ctzl(x) : 0)
 #define arch_fls(x)  ((x) ? 32 - __builtin_clz(x) : 0)
diff --git a/xen/arch/ppc/include/asm/page.h b/xen/arch/ppc/include/asm/page.h
index 890e285051..6d4cd2611c 100644
--- a/xen/arch/ppc/include/asm/page.h
+++ b/xen/arch/ppc/include/asm/page.h
@@ -2,9 +2,9 @@
 #ifndef _ASM_PPC_PAGE_H
 #define _ASM_PPC_PAGE_H
 
+#include <xen/bitops.h>
 #include <xen/types.h>
 
-#include <asm/bitops.h>
 #include <asm/byteorder.h>
 
 #define PDE_VALID     PPC_BIT(0)
diff --git a/xen/arch/ppc/mm-radix.c b/xen/arch/ppc/mm-radix.c
index 0a47959e64..24232f3907 100644
--- a/xen/arch/ppc/mm-radix.c
+++ b/xen/arch/ppc/mm-radix.c
@@ -1,4 +1,5 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
+#include <xen/bitops.h>
 #include <xen/init.h>
 #include <xen/kernel.h>
 #include <xen/mm.h>
@@ -6,7 +7,6 @@
 #include <xen/types.h>
 #include <xen/lib.h>
 
-#include <asm/bitops.h>
 #include <asm/byteorder.h>
 #include <asm/early_printk.h>
 #include <asm/page.h>
diff --git a/xen/arch/x86/include/asm/bitops.h b/xen/arch/x86/include/asm/bitops.h
index aa71542e7b..f9aa60111f 100644
--- a/xen/arch/x86/include/asm/bitops.h
+++ b/xen/arch/x86/include/asm/bitops.h
@@ -19,9 +19,6 @@
 #define ADDR (*(volatile int *) addr)
 #define CONST_ADDR (*(const volatile int *) addr)
 
-extern void __bitop_bad_size(void);
-#define bitop_bad_size(addr) (sizeof(*(addr)) < 4)
-
 /**
  * set_bit - Atomically set a bit in memory
  * @nr: the bit to set
@@ -175,7 +172,7 @@ static inline int test_and_set_bit(int nr, volatile void *addr)
 })
 
 /**
- * __test_and_set_bit - Set a bit and return its old value
+ * arch__test_and_set_bit - Set a bit and return its old value
  * @nr: Bit to set
  * @addr: Address to count from
  *
@@ -183,7 +180,7 @@ static inline int test_and_set_bit(int nr, volatile void *addr)
  * If two examples of this operation race, one can appear to succeed
  * but actually fail.  You must protect multiple accesses with a lock.
  */
-static inline int __test_and_set_bit(int nr, void *addr)
+static inline int arch__test_and_set_bit(int nr, volatile void *addr)
 {
     int oldbit;
 
@@ -194,10 +191,7 @@ static inline int __test_and_set_bit(int nr, void *addr)
 
     return oldbit;
 }
-#define __test_and_set_bit(nr, addr) ({                 \
-    if ( bitop_bad_size(addr) ) __bitop_bad_size();     \
-    __test_and_set_bit(nr, addr);                       \
-})
+#define arch__test_and_set_bit arch__test_and_set_bit
 
 /**
  * test_and_clear_bit - Clear a bit and return its old value
@@ -224,7 +218,7 @@ static inline int test_and_clear_bit(int nr, volatile void *addr)
 })
 
 /**
- * __test_and_clear_bit - Clear a bit and return its old value
+ * arch__test_and_clear_bit - Clear a bit and return its old value
  * @nr: Bit to set
  * @addr: Address to count from
  *
@@ -232,7 +226,7 @@ static inline int test_and_clear_bit(int nr, volatile void *addr)
  * If two examples of this operation race, one can appear to succeed
  * but actually fail.  You must protect multiple accesses with a lock.
  */
-static inline int __test_and_clear_bit(int nr, void *addr)
+static inline int arch__test_and_clear_bit(int nr, volatile void *addr)
 {
     int oldbit;
 
@@ -243,13 +237,10 @@ static inline int __test_and_clear_bit(int nr, void *addr)
 
     return oldbit;
 }
-#define __test_and_clear_bit(nr, addr) ({               \
-    if ( bitop_bad_size(addr) ) __bitop_bad_size();     \
-    __test_and_clear_bit(nr, addr);                     \
-})
+#define arch__test_and_clear_bit arch__test_and_clear_bit
 
 /* WARNING: non atomic and it can be reordered! */
-static inline int __test_and_change_bit(int nr, void *addr)
+static inline int arch__test_and_change_bit(int nr, volatile void *addr)
 {
     int oldbit;
 
@@ -260,10 +251,7 @@ static inline int __test_and_change_bit(int nr, void *addr)
 
     return oldbit;
 }
-#define __test_and_change_bit(nr, addr) ({              \
-    if ( bitop_bad_size(addr) ) __bitop_bad_size();     \
-    __test_and_change_bit(nr, addr);                    \
-})
+#define arch__test_and_change_bit arch__test_and_change_bit
 
 /**
  * test_and_change_bit - Change a bit and return its new value
@@ -307,8 +295,7 @@ static inline int variable_test_bit(int nr, const volatile void *addr)
     return oldbit;
 }
 
-#define test_bit(nr, addr) ({                           \
-    if ( bitop_bad_size(addr) ) __bitop_bad_size();     \
+#define arch_test_bit(nr, addr) ({                      \
     __builtin_constant_p(nr) ?                          \
         constant_test_bit(nr, addr) :                   \
         variable_test_bit(nr, addr);                    \
diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index 6a5e28730a..3d88d2f3f1 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -4,6 +4,17 @@
 #include <xen/compiler.h>
 #include <xen/types.h>
 
+#define BITOP_BITS_PER_WORD 32
+typedef uint32_t bitop_uint_t;
+
+#define BITOP_MASK(nr)  ((bitop_uint_t)1 << ((nr) % BITOP_BITS_PER_WORD))
+
+#define BITOP_WORD(nr)  ((nr) / BITOP_BITS_PER_WORD)
+
+extern void __bitop_bad_size(void);
+
+#define bitop_bad_size(addr) (sizeof(*(addr)) < sizeof(bitop_uint_t))
+
 #include <asm/bitops.h>
 
 /*
@@ -24,6 +35,175 @@
 unsigned int __pure generic_ffsl(unsigned long x);
 unsigned int __pure generic_flsl(unsigned long x);
 
+/**
+ * generic__test_and_set_bit - Set a bit and return its old value
+ * @nr: Bit to set
+ * @addr: Address to count from
+ *
+ * This operation is non-atomic and can be reordered.
+ * If two examples of this operation race, one can appear to succeed
+ * but actually fail.  You must protect multiple accesses with a lock.
+ */
+static always_inline bool
+generic__test_and_set_bit(int nr, volatile void *addr)
+{
+    bitop_uint_t mask = BITOP_MASK(nr);
+    volatile bitop_uint_t *p = (volatile bitop_uint_t *)addr + BITOP_WORD(nr);
+    bitop_uint_t old = *p;
+
+    *p = old | mask;
+    return (old & mask);
+}
+
+/**
+ * generic__test_and_clear_bit - Clear a bit and return its old value
+ * @nr: Bit to clear
+ * @addr: Address to count from
+ *
+ * This operation is non-atomic and can be reordered.
+ * If two examples of this operation race, one can appear to succeed
+ * but actually fail.  You must protect multiple accesses with a lock.
+ */
+static always_inline bool
+generic__test_and_clear_bit(int nr, volatile void *addr)
+{
+    bitop_uint_t mask = BITOP_MASK(nr);
+    volatile bitop_uint_t *p = (volatile bitop_uint_t *)addr + BITOP_WORD(nr);
+    bitop_uint_t old = *p;
+
+    *p = old & ~mask;
+    return (old & mask);
+}
+
+/**
+ * generic__test_and_change_bit - Change a bit and return its old value
+ * @nr: Bit to change
+ * @addr: Address to count from
+ *
+ * This operation is non-atomic and can be reordered.
+ * If two examples of this operation race, one can appear to succeed
+ * but actually fail.  You must protect multiple accesses with a lock.
+ */
+static always_inline bool
+generic__test_and_change_bit(int nr, volatile void *addr)
+{
+    bitop_uint_t mask = BITOP_MASK(nr);
+    volatile bitop_uint_t *p = (volatile bitop_uint_t *)addr + BITOP_WORD(nr);
+    bitop_uint_t old = *p;
+
+    *p = old ^ mask;
+    return (old & mask);
+}
+
+/**
+ * generic_test_bit - Determine whether a bit is set
+ * @nr: bit number to test
+ * @addr: Address to start counting from
+ *
+ * This operation is non-atomic and can be reordered.
+ * If two examples of this operation race, one can appear to succeed
+ * but actually fail.  You must protect multiple accesses with a lock.
+ */
+static always_inline bool generic_test_bit(int nr, const volatile void *addr)
+{
+    bitop_uint_t mask = BITOP_MASK(nr);
+    const volatile bitop_uint_t *p =
+        (const volatile bitop_uint_t *)addr + BITOP_WORD(nr);
+
+    return (*p & mask);
+}
+
+/**
+ * __test_and_set_bit - Set a bit and return its old value
+ * @nr: Bit to set
+ * @addr: Address to count from
+ *
+ * This operation is non-atomic and can be reordered.
+ * If two examples of this operation race, one can appear to succeed
+ * but actually fail.  You must protect multiple accesses with a lock.
+ */
+static always_inline bool
+__test_and_set_bit(int nr, volatile void *addr)
+{
+#ifndef arch__test_and_set_bit
+#define arch__test_and_set_bit generic__test_and_set_bit
+#endif
+
+    return arch__test_and_set_bit(nr, addr);
+}
+#define __test_and_set_bit(nr, addr) ({             \
+    if ( bitop_bad_size(addr) ) __bitop_bad_size(); \
+    __test_and_set_bit(nr, addr);                   \
+})
+
+/**
+ * __test_and_clear_bit - Clear a bit and return its old value
+ * @nr: Bit to clear
+ * @addr: Address to count from
+ *
+ * This operation is non-atomic and can be reordered.
+ * If two examples of this operation race, one can appear to succeed
+ * but actually fail.  You must protect multiple accesses with a lock.
+ */
+static always_inline bool
+__test_and_clear_bit(int nr, volatile void *addr)
+{
+#ifndef arch__test_and_clear_bit
+#define arch__test_and_clear_bit generic__test_and_clear_bit
+#endif
+
+    return arch__test_and_clear_bit(nr, addr);
+}
+#define __test_and_clear_bit(nr, addr) ({           \
+    if ( bitop_bad_size(addr) ) __bitop_bad_size(); \
+    __test_and_clear_bit(nr, addr);                 \
+})
+
+/**
+ * __test_and_change_bit - Change a bit and return its old value
+ * @nr: Bit to change
+ * @addr: Address to count from
+ *
+ * This operation is non-atomic and can be reordered.
+ * If two examples of this operation race, one can appear to succeed
+ * but actually fail.  You must protect multiple accesses with a lock.
+ */
+static always_inline bool
+__test_and_change_bit(int nr, volatile void *addr)
+{
+#ifndef arch__test_and_change_bit
+#define arch__test_and_change_bit generic__test_and_change_bit
+#endif
+
+    return arch__test_and_change_bit(nr, addr);
+}
+#define __test_and_change_bit(nr, addr) ({              \
+    if ( bitop_bad_size(addr) ) __bitop_bad_size();     \
+    __test_and_change_bit(nr, addr);                    \
+})
+
+/**
+ * test_bit - Determine whether a bit is set
+ * @nr: bit number to test
+ * @addr: Address to start counting from
+ *
+ * This operation is non-atomic and can be reordered.
+ * If two examples of this operation race, one can appear to succeed
+ * but actually fail.  You must protect multiple accesses with a lock.
+ */
+static always_inline bool test_bit(int nr, const volatile void *addr)
+{
+#ifndef arch_test_bit
+#define arch_test_bit generic_test_bit
+#endif
+
+    return arch_test_bit(nr, addr);
+}
+#define test_bit(nr, addr) ({                           \
+    if ( bitop_bad_size(addr) ) __bitop_bad_size();     \
+    test_bit(nr, addr);                                 \
+})
+
 static always_inline __pure unsigned int ffs(unsigned int x)
 {
     if ( __builtin_constant_p(x) )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 03:56:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 03:56:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770103.1180995 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjPH-0007WK-VW; Fri, 02 Aug 2024 03:56:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770103.1180995; Fri, 02 Aug 2024 03:56: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 1sZjPH-0007WB-S4; Fri, 02 Aug 2024 03:56:43 +0000
Received: by outflank-mailman (input) for mailman id 770103;
 Fri, 02 Aug 2024 03:56:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjPG-0007Vs-Rq
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:56:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjPG-0002vD-RA
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:56:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjPG-0004xg-QL
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:56:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=O1g4doGjmeLzB1khgL8XQjgpEMlZvuxyaIk85yfYi7c=; b=lQPmsBluUHv4SGuDiNzqtuiwmb
	n6VGMlWLt0v7HfzqJRu1iOE4jB08O0HvjY63kCIrcYCWto8xMlPEQETKFRWlf7k3FnFHdq+bFrMVg
	yUnF0dqgytbE2Y818RWQ8EV2TYq+5Roia/2V55XsxXgda2k1mbRpvJzOjW+er7QC+D/s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: introduce bitops.h
Message-Id: <E1sZjPG-0004xg-QL@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 03:56:42 +0000

commit bf34f99c3351b21f8b66227b31502726bc59c7cd
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Jul 31 13:05:49 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jul 31 13:05:49 2024 +0200

    xen/riscv: introduce bitops.h
    
    Taken from Linux-6.4.0-rc1
    
    Xen's bitops.h consists of several Linux's headers:
    * linux/arch/include/asm/bitops.h:
      * The following function were removed as they aren't used in Xen:
            * test_and_set_bit_lock
            * clear_bit_unlock
            * __clear_bit_unlock
      * The following functions were renamed in the way how they are
        used by common code:
            * __test_and_set_bit
            * __test_and_clear_bit
      * The declaration and implementation of the following functios
        were updated to make Xen build happy:
            * clear_bit
            * set_bit
            * __test_and_clear_bit
            * __test_and_set_bit
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/bitops.h | 137 ++++++++++++++++++++++++++++++++++++
 1 file changed, 137 insertions(+)

diff --git a/xen/arch/riscv/include/asm/bitops.h b/xen/arch/riscv/include/asm/bitops.h
new file mode 100644
index 0000000000..7f7af3fda1
--- /dev/null
+++ b/xen/arch/riscv/include/asm/bitops.h
@@ -0,0 +1,137 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright (C) 2012 Regents of the University of California */
+
+#ifndef _ASM_RISCV_BITOPS_H
+#define _ASM_RISCV_BITOPS_H
+
+#include <asm/system.h>
+
+#if BITOP_BITS_PER_WORD == 64
+#define __AMO(op)   "amo" #op ".d"
+#elif BITOP_BITS_PER_WORD == 32
+#define __AMO(op)   "amo" #op ".w"
+#else
+#error "Unexpected BITOP_BITS_PER_WORD"
+#endif
+
+/* Based on linux/arch/include/asm/bitops.h */
+
+/*
+ * Non-atomic bit manipulation.
+ *
+ * Implemented using atomics to be interrupt safe. Could alternatively
+ * implement with local interrupt masking.
+ */
+#define __set_bit(n, p)      set_bit(n, p)
+#define __clear_bit(n, p)    clear_bit(n, p)
+
+#define test_and_op_bit_ord(op, mod, nr, addr, ord)     \
+({                                                      \
+    bitop_uint_t res, mask;                             \
+    mask = BITOP_MASK(nr);                              \
+    asm volatile (                                      \
+        __AMO(op) #ord " %0, %2, %1"                    \
+        : "=r" (res), "+A" (addr[BITOP_WORD(nr)])       \
+        : "r" (mod(mask))                               \
+        : "memory");                                    \
+    ((res & mask) != 0);                                \
+})
+
+#define op_bit_ord(op, mod, nr, addr, ord)      \
+    asm volatile (                              \
+        __AMO(op) #ord " zero, %1, %0"          \
+        : "+A" (addr[BITOP_WORD(nr)])           \
+        : "r" (mod(BITOP_MASK(nr)))             \
+        : "memory");
+
+#define test_and_op_bit(op, mod, nr, addr)    \
+    test_and_op_bit_ord(op, mod, nr, addr, .aqrl)
+#define op_bit(op, mod, nr, addr) \
+    op_bit_ord(op, mod, nr, addr, )
+
+/* Bitmask modifiers */
+#define NOP(x)    (x)
+#define NOT(x)    (~(x))
+
+/**
+ * test_and_set_bit - Set a bit and return its old value
+ * @nr: Bit to set
+ * @addr: Address to count from
+ */
+static inline bool test_and_set_bit(int nr, volatile void *p)
+{
+    volatile bitop_uint_t *addr = p;
+
+    return test_and_op_bit(or, NOP, nr, addr);
+}
+
+/**
+ * test_and_clear_bit - Clear a bit and return its old value
+ * @nr: Bit to clear
+ * @addr: Address to count from
+ */
+static inline bool test_and_clear_bit(int nr, volatile void *p)
+{
+    volatile bitop_uint_t *addr = p;
+
+    return test_and_op_bit(and, NOT, nr, addr);
+}
+
+/**
+ * test_and_change_bit - Toggle (change) a bit and return its old value
+ * @nr: Bit to change
+ * @addr: Address to count from
+ *
+ * This operation is atomic and cannot be reordered.
+ * It also implies a memory barrier.
+ */
+static inline bool test_and_change_bit(int nr, volatile void *p)
+{
+    volatile bitop_uint_t *addr = p;
+
+    return test_and_op_bit(xor, NOP, nr, addr);
+}
+
+/**
+ * set_bit - Atomically set a bit in memory
+ * @nr: the bit to set
+ * @addr: the address to start counting from
+ *
+ * Note that @nr may be almost arbitrarily large; this function is not
+ * restricted to acting on a single-word quantity.
+ */
+static inline void set_bit(int nr, volatile void *p)
+{
+    volatile bitop_uint_t *addr = p;
+
+    op_bit(or, NOP, nr, addr);
+}
+
+/**
+ * clear_bit - Clears a bit in memory
+ * @nr: Bit to clear
+ * @addr: Address to start counting from
+ */
+static inline void clear_bit(int nr, volatile void *p)
+{
+    volatile bitop_uint_t *addr = p;
+
+    op_bit(and, NOT, nr, addr);
+}
+
+#undef test_and_op_bit
+#undef op_bit
+#undef NOP
+#undef NOT
+#undef __AMO
+
+#endif /* _ASM_RISCV_BITOPS_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 03:56:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 03:56:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770104.1180998 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjPR-0007cK-WD; Fri, 02 Aug 2024 03:56:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770104.1180998; Fri, 02 Aug 2024 03:56: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 1sZjPR-0007cA-TV; Fri, 02 Aug 2024 03:56:53 +0000
Received: by outflank-mailman (input) for mailman id 770104;
 Fri, 02 Aug 2024 03:56:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjPQ-0007bj-Uu
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:56:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjPQ-0002vW-U8
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:56:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjPQ-0004yn-TJ
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:56: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=83DfqA16hXF84d/6GpIMThvXLhSHb3iuRsdX9DfKJOk=; b=VYsN+dD8DzbfUBvDKvgj/cfmZ5
	4CIemR4SYYkABQkh9Dbi0SwfuYFQS7Eo/9vK/kLuO2UH9ezTPYpf0+aFyKdxoWFItxpx6lMRUoc0U
	N1I72RiP2DQY3dx/Kk1J0f4CPIjQvzajfuBiGuxzCGfETG2R67fdjufbgK5xNxOcdNIA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: add minimal stuff to mm.h to build full Xen
Message-Id: <E1sZjPQ-0004yn-TJ@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 03:56:52 +0000

commit 7db8d2bd9b9b087d9e51dcdef9bee3ce5220b9a2
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Jul 31 13:06:18 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jul 31 13:06:18 2024 +0200

    xen/riscv: add minimal stuff to mm.h to build full Xen
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/mm.h | 235 ++++++++++++++++++++++++++++++++++++++++
 xen/arch/riscv/mm.c             |   2 +-
 xen/arch/riscv/setup.c          |   2 +-
 3 files changed, 237 insertions(+), 2 deletions(-)

diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/mm.h
index 07c7a0abba..25af9e1aaa 100644
--- a/xen/arch/riscv/include/asm/mm.h
+++ b/xen/arch/riscv/include/asm/mm.h
@@ -3,11 +3,241 @@
 #ifndef _ASM_RISCV_MM_H
 #define _ASM_RISCV_MM_H
 
+#include <public/xen.h>
+#include <xen/bug.h>
+#include <xen/mm-frame.h>
+#include <xen/pdx.h>
+#include <xen/types.h>
+
 #include <asm/page-bits.h>
 
 #define pfn_to_paddr(pfn) ((paddr_t)(pfn) << PAGE_SHIFT)
 #define paddr_to_pfn(pa)  ((unsigned long)((pa) >> PAGE_SHIFT))
 
+#define paddr_to_pdx(pa)    mfn_to_pdx(maddr_to_mfn(pa))
+#define gfn_to_gaddr(gfn)   pfn_to_paddr(gfn_x(gfn))
+#define gaddr_to_gfn(ga)    _gfn(paddr_to_pfn(ga))
+#define mfn_to_maddr(mfn)   pfn_to_paddr(mfn_x(mfn))
+#define maddr_to_mfn(ma)    _mfn(paddr_to_pfn(ma))
+#define vmap_to_mfn(va)     maddr_to_mfn(virt_to_maddr((vaddr_t)(va)))
+#define vmap_to_page(va)    mfn_to_page(vmap_to_mfn(va))
+
+static inline void *maddr_to_virt(paddr_t ma)
+{
+    BUG_ON("unimplemented");
+    return NULL;
+}
+
+#define virt_to_maddr(va) ({ BUG_ON("unimplemented"); 0; })
+
+/* Convert between Xen-heap virtual addresses and machine frame numbers. */
+#define __virt_to_mfn(va)  mfn_x(maddr_to_mfn(virt_to_maddr(va)))
+#define __mfn_to_virt(mfn) maddr_to_virt(mfn_to_maddr(_mfn(mfn)))
+
+/*
+ * We define non-underscored wrappers for above conversion functions.
+ * These are overriden in various source files while underscored version
+ * remain intact.
+ */
+#define virt_to_mfn(va)     __virt_to_mfn(va)
+#define mfn_to_virt(mfn)    __mfn_to_virt(mfn)
+
+struct page_info
+{
+    /* Each frame can be threaded onto a doubly-linked list. */
+    struct page_list_entry list;
+
+    /* Reference count and various PGC_xxx flags and fields. */
+    unsigned long count_info;
+
+    /* Context-dependent fields follow... */
+    union {
+        /* Page is in use: ((count_info & PGC_count_mask) != 0). */
+        struct {
+            /* Type reference count and various PGT_xxx flags and fields. */
+            unsigned long type_info;
+        } inuse;
+
+        /* Page is on a free list: ((count_info & PGC_count_mask) == 0). */
+        union {
+            struct {
+                /*
+                 * Index of the first *possibly* unscrubbed page in the buddy.
+                 * One more bit than maximum possible order to accommodate
+                 * INVALID_DIRTY_IDX.
+                 */
+#define INVALID_DIRTY_IDX ((1UL << (MAX_ORDER + 1)) - 1)
+                unsigned long first_dirty:MAX_ORDER + 1;
+
+                /* Do TLBs need flushing for safety before next page use? */
+                bool need_tlbflush:1;
+
+#define BUDDY_NOT_SCRUBBING    0
+#define BUDDY_SCRUBBING        1
+#define BUDDY_SCRUB_ABORT      2
+                unsigned long scrub_state:2;
+            };
+
+            unsigned long val;
+        } free;
+    } u;
+
+    union {
+        /* Page is in use */
+        struct {
+            /* Owner of this page (NULL if page is anonymous). */
+            struct domain *domain;
+        } inuse;
+
+        /* Page is on a free list. */
+        struct {
+            /* Order-size of the free chunk this page is the head of. */
+            unsigned int order;
+        } free;
+    } v;
+
+    union {
+        /*
+         * Timestamp from 'TLB clock', used to avoid extra safety flushes.
+         * Only valid for: a) free pages, and b) pages with zero type count
+         */
+        uint32_t tlbflush_timestamp;
+    };
+};
+
+#define frame_table ((struct page_info *)FRAMETABLE_VIRT_START)
+
+/* Convert between machine frame numbers and page-info structures. */
+#define mfn_to_page(mfn)    (frame_table + mfn_x(mfn))
+#define page_to_mfn(pg)     _mfn((pg) - frame_table)
+
+static inline void *page_to_virt(const struct page_info *pg)
+{
+    return mfn_to_virt(mfn_x(page_to_mfn(pg)));
+}
+
+/* Convert between Xen-heap virtual addresses and page-info structures. */
+static inline struct page_info *virt_to_page(const void *v)
+{
+    BUG_ON("unimplemented");
+    return NULL;
+}
+
+/*
+ * Common code requires get_page_type and put_page_type.
+ * We don't care about typecounts so we just do the minimum to make it
+ * happy.
+ */
+static inline int get_page_type(struct page_info *page, unsigned long type)
+{
+    return 1;
+}
+
+static inline void put_page_type(struct page_info *page)
+{
+}
+
+static inline void put_page_and_type(struct page_info *page)
+{
+    put_page_type(page);
+    put_page(page);
+}
+
+/*
+ * RISC-V does not have an M2P, but common code expects a handful of
+ * M2P-related defines and functions. Provide dummy versions of these.
+ */
+#define INVALID_M2P_ENTRY        (~0UL)
+#define SHARED_M2P_ENTRY         (~0UL - 1UL)
+#define SHARED_M2P(_e)           ((_e) == SHARED_M2P_ENTRY)
+
+#define set_gpfn_from_mfn(mfn, pfn) do { (void)(mfn), (void)(pfn); } while (0)
+#define mfn_to_gfn(d, mfn) ((void)(d), _gfn(mfn_x(mfn)))
+
+#define PDX_GROUP_SHIFT (PAGE_SHIFT + VPN_BITS)
+
+static inline unsigned long domain_get_maximum_gpfn(struct domain *d)
+{
+    BUG_ON("unimplemented");
+    return 0;
+}
+
+static inline long arch_memory_op(int op, XEN_GUEST_HANDLE_PARAM(void) arg)
+{
+    BUG_ON("unimplemented");
+    return 0;
+}
+
+/*
+ * On RISCV, all the RAM is currently direct mapped in Xen.
+ * Hence return always true.
+ */
+static inline bool arch_mfns_in_directmap(unsigned long mfn, unsigned long nr)
+{
+    return true;
+}
+
+#define PG_shift(idx)   (BITS_PER_LONG - (idx))
+#define PG_mask(x, idx) (x ## UL << PG_shift(idx))
+
+#define PGT_none          PG_mask(0, 1)  /* no special uses of this page   */
+#define PGT_writable_page PG_mask(1, 1)  /* has writable mappings?         */
+#define PGT_type_mask     PG_mask(1, 1)  /* Bits 31 or 63.                 */
+
+/* Count of uses of this frame as its current type. */
+#define PGT_count_width   PG_shift(2)
+#define PGT_count_mask    ((1UL << PGT_count_width) - 1)
+
+/*
+ * Page needs to be scrubbed. Since this bit can only be set on a page that is
+ * free (i.e. in PGC_state_free) we can reuse PGC_allocated bit.
+ */
+#define _PGC_need_scrub   _PGC_allocated
+#define PGC_need_scrub    PGC_allocated
+
+/* Cleared when the owning guest 'frees' this page. */
+#define _PGC_allocated    PG_shift(1)
+#define PGC_allocated     PG_mask(1, 1)
+/* Page is Xen heap? */
+#define _PGC_xen_heap     PG_shift(2)
+#define PGC_xen_heap      PG_mask(1, 2)
+/* Page is broken? */
+#define _PGC_broken       PG_shift(7)
+#define PGC_broken        PG_mask(1, 7)
+/* Mutually-exclusive page states: { inuse, offlining, offlined, free }. */
+#define PGC_state         PG_mask(3, 9)
+#define PGC_state_inuse   PG_mask(0, 9)
+#define PGC_state_offlining PG_mask(1, 9)
+#define PGC_state_offlined PG_mask(2, 9)
+#define PGC_state_free    PG_mask(3, 9)
+#define page_state_is(pg, st) (((pg)->count_info&PGC_state) == PGC_state_##st)
+
+/* Count of references to this frame. */
+#define PGC_count_width   PG_shift(9)
+#define PGC_count_mask    ((1UL << PGC_count_width) - 1)
+
+#define _PGC_extra        PG_shift(10)
+#define PGC_extra         PG_mask(1, 10)
+
+#define is_xen_heap_page(page) ((page)->count_info & PGC_xen_heap)
+#define is_xen_heap_mfn(mfn) \
+    (mfn_valid(mfn) && is_xen_heap_page(mfn_to_page(mfn)))
+
+#define is_xen_fixed_mfn(mfn)                                   \
+    ((mfn_to_maddr(mfn) >= virt_to_maddr((vaddr_t)_start)) &&   \
+     (mfn_to_maddr(mfn) <= virt_to_maddr((vaddr_t)_end - 1)))
+
+#define page_get_owner(p)    (p)->v.inuse.domain
+#define page_set_owner(p, d) ((p)->v.inuse.domain = (d))
+
+/* TODO: implement */
+#define mfn_valid(mfn) ({ (void)(mfn); 0; })
+
+#define domain_set_alloc_bitsize(d) ((void)(d))
+#define domain_clamp_alloc_bitsize(d, b) ((void)(d), (b))
+
+#define PFN_ORDER(pg) ((pg)->v.free.order)
+
 extern unsigned char cpu0_boot_stack[];
 
 void setup_initial_pagetables(void);
@@ -20,4 +250,9 @@ unsigned long calc_phys_offset(void);
 
 void turn_on_mmu(unsigned long ra);
 
+static inline unsigned int arch_get_dma_bitsize(void)
+{
+    return 32; /* TODO */
+}
+
 #endif /* _ASM_RISCV_MM_H */
diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c
index 3ebaf6da01..ae381e9581 100644
--- a/xen/arch/riscv/mm.c
+++ b/xen/arch/riscv/mm.c
@@ -4,13 +4,13 @@
 #include <xen/init.h>
 #include <xen/kernel.h>
 #include <xen/macros.h>
+#include <xen/mm.h>
 #include <xen/pfn.h>
 #include <xen/sections.h>
 
 #include <asm/early_printk.h>
 #include <asm/csr.h>
 #include <asm/current.h>
-#include <asm/mm.h>
 #include <asm/page.h>
 #include <asm/processor.h>
 
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index 6593f601c1..98a94c4c48 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -2,9 +2,9 @@
 
 #include <xen/compile.h>
 #include <xen/init.h>
+#include <xen/mm.h>
 
 #include <asm/early_printk.h>
-#include <asm/mm.h>
 
 /* Xen stack for bringing up the first CPU. */
 unsigned char __initdata cpu0_boot_stack[STACK_SIZE]
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 03:57:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 03:57:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770108.1181002 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjPc-0007mp-1E; Fri, 02 Aug 2024 03:57:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770108.1181002; Fri, 02 Aug 2024 03:57:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjPb-0007mh-Uy; Fri, 02 Aug 2024 03:57:03 +0000
Received: by outflank-mailman (input) for mailman id 770108;
 Fri, 02 Aug 2024 03:57:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjPb-0007mT-1i
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:57:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjPb-0002w7-0q
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:57:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjPb-0004zs-01
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:57:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=emy78AZtkPw0YbwBtoxjzETroQ1+jp20NAaE5QUC7Ts=; b=Nnm3fo2BAMdNRZ0JLR+WsWQP0U
	xhZQHFAkiA49knl73aUshUhWVhUMnjhBOw4SknkjvXn8Lu3Ok8H8z1LX8dhDnZ5vney849e6SyUOl
	EjF2a5zNU5pcBOJXcumn8kEH6U36lpqo2E0lhltvRwpWVTiPiaVDTd3/dY35+a8YG7x0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: add minimal amount of stubs to build full Xen
Message-Id: <E1sZjPb-0004zs-01@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 03:57:03 +0000

commit 2fc390242d3e64e01a2e60bbd4977190ee8827f8
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Jul 31 13:06:35 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jul 31 13:07:02 2024 +0200

    xen/riscv: add minimal amount of stubs to build full Xen
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/Makefile |   1 +
 xen/arch/riscv/mm.c     |  41 +++++
 xen/arch/riscv/setup.c  |   8 +
 xen/arch/riscv/stubs.c  | 418 ++++++++++++++++++++++++++++++++++++++++++++++++
 xen/arch/riscv/traps.c  |  25 +++
 5 files changed, 493 insertions(+)

diff --git a/xen/arch/riscv/Makefile b/xen/arch/riscv/Makefile
index 1ed1a8369b..60afbc0ad9 100644
--- a/xen/arch/riscv/Makefile
+++ b/xen/arch/riscv/Makefile
@@ -4,6 +4,7 @@ obj-y += mm.o
 obj-$(CONFIG_RISCV_64) += riscv64/
 obj-y += sbi.o
 obj-y += setup.o
+obj-y += stubs.o
 obj-y += traps.o
 obj-y += vm_event.o
 
diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c
index ae381e9581..7d09e781bf 100644
--- a/xen/arch/riscv/mm.c
+++ b/xen/arch/riscv/mm.c
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
+#include <xen/bug.h>
 #include <xen/compiler.h>
 #include <xen/init.h>
 #include <xen/kernel.h>
@@ -294,3 +295,43 @@ unsigned long __init calc_phys_offset(void)
     phys_offset = load_start - XEN_VIRT_START;
     return phys_offset;
 }
+
+void put_page(struct page_info *page)
+{
+    BUG_ON("unimplemented");
+}
+
+void arch_dump_shared_mem_info(void)
+{
+    BUG_ON("unimplemented");
+}
+
+int populate_pt_range(unsigned long virt, unsigned long nr_mfns)
+{
+    BUG_ON("unimplemented");
+    return -1;
+}
+
+int xenmem_add_to_physmap_one(struct domain *d, unsigned int space,
+                              union add_to_physmap_extra extra,
+                              unsigned long idx, gfn_t gfn)
+{
+    BUG_ON("unimplemented");
+
+    return 0;
+}
+
+int destroy_xen_mappings(unsigned long s, unsigned long e)
+{
+    BUG_ON("unimplemented");
+    return -1;
+}
+
+int map_pages_to_xen(unsigned long virt,
+                     mfn_t mfn,
+                     unsigned long nr_mfns,
+                     unsigned int flags)
+{
+    BUG_ON("unimplemented");
+    return -1;
+}
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index 98a94c4c48..8bb5bdb2ae 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -1,11 +1,19 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
+#include <xen/bug.h>
 #include <xen/compile.h>
 #include <xen/init.h>
 #include <xen/mm.h>
 
+#include <public/version.h>
+
 #include <asm/early_printk.h>
 
+void arch_get_xen_caps(xen_capabilities_info_t *info)
+{
+    BUG_ON("unimplemented");
+}
+
 /* Xen stack for bringing up the first CPU. */
 unsigned char __initdata cpu0_boot_stack[STACK_SIZE]
     __aligned(STACK_SIZE);
diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c
new file mode 100644
index 0000000000..b67d99729f
--- /dev/null
+++ b/xen/arch/riscv/stubs.c
@@ -0,0 +1,418 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#include <xen/cpumask.h>
+#include <xen/domain.h>
+#include <xen/irq.h>
+#include <xen/nodemask.h>
+#include <xen/sections.h>
+#include <xen/time.h>
+#include <public/domctl.h>
+
+#include <asm/current.h>
+
+/* smpboot.c */
+
+cpumask_t cpu_online_map;
+cpumask_t cpu_present_map;
+cpumask_t cpu_possible_map;
+
+/* ID of the PCPU we're running on */
+DEFINE_PER_CPU(unsigned int, cpu_id);
+/* XXX these seem awfully x86ish... */
+/* representing HT siblings of each logical CPU */
+DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_sibling_mask);
+/* representing HT and core siblings of each logical CPU */
+DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_core_mask);
+
+nodemask_t __read_mostly node_online_map = { { [0] = 1UL } };
+
+/* time.c */
+
+unsigned long __ro_after_init cpu_khz;  /* CPU clock frequency in kHz. */
+
+s_time_t get_s_time(void)
+{
+    BUG_ON("unimplemented");
+}
+
+int reprogram_timer(s_time_t timeout)
+{
+    BUG_ON("unimplemented");
+}
+
+void send_timer_event(struct vcpu *v)
+{
+    BUG_ON("unimplemented");
+}
+
+void domain_set_time_offset(struct domain *d, int64_t time_offset_seconds)
+{
+    BUG_ON("unimplemented");
+}
+
+/* shutdown.c */
+
+void machine_restart(unsigned int delay_millisecs)
+{
+    BUG_ON("unimplemented");
+}
+
+void machine_halt(void)
+{
+    BUG_ON("unimplemented");
+}
+
+/* domctl.c */
+
+long arch_do_domctl(struct xen_domctl *domctl, struct domain *d,
+                    XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
+{
+    BUG_ON("unimplemented");
+}
+
+void arch_get_domain_info(const struct domain *d,
+                          struct xen_domctl_getdomaininfo *info)
+{
+    BUG_ON("unimplemented");
+}
+
+void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
+{
+    BUG_ON("unimplemented");
+}
+
+/* monitor.c */
+
+int arch_monitor_domctl_event(struct domain *d,
+                              struct xen_domctl_monitor_op *mop)
+{
+    BUG_ON("unimplemented");
+}
+
+/* smp.c */
+
+void arch_flush_tlb_mask(const cpumask_t *mask)
+{
+    BUG_ON("unimplemented");
+}
+
+void smp_send_event_check_mask(const cpumask_t *mask)
+{
+    BUG_ON("unimplemented");
+}
+
+void smp_send_call_function_mask(const cpumask_t *mask)
+{
+    BUG_ON("unimplemented");
+}
+
+/* irq.c */
+
+struct pirq *alloc_pirq_struct(struct domain *d)
+{
+    BUG_ON("unimplemented");
+}
+
+int pirq_guest_bind(struct vcpu *v, struct pirq *pirq, int will_share)
+{
+    BUG_ON("unimplemented");
+}
+
+void pirq_guest_unbind(struct domain *d, struct pirq *pirq)
+{
+    BUG_ON("unimplemented");
+}
+
+void pirq_set_affinity(struct domain *d, int pirq, const cpumask_t *mask)
+{
+    BUG_ON("unimplemented");
+}
+
+void irq_ack_none(struct irq_desc *desc)
+{
+    BUG_ON("unimplemented");
+}
+
+int arch_init_one_irq_desc(struct irq_desc *desc)
+{
+    BUG_ON("unimplemented");
+}
+
+void smp_send_state_dump(unsigned int cpu)
+{
+    BUG_ON("unimplemented");
+}
+
+/* domain.c */
+
+DEFINE_PER_CPU(struct vcpu *, curr_vcpu);
+unsigned long __per_cpu_offset[NR_CPUS];
+
+void context_switch(struct vcpu *prev, struct vcpu *next)
+{
+    BUG_ON("unimplemented");
+}
+
+void continue_running(struct vcpu *same)
+{
+    BUG_ON("unimplemented");
+}
+
+void sync_local_execstate(void)
+{
+    BUG_ON("unimplemented");
+}
+
+void sync_vcpu_execstate(struct vcpu *v)
+{
+    BUG_ON("unimplemented");
+}
+
+void startup_cpu_idle_loop(void)
+{
+    BUG_ON("unimplemented");
+}
+
+void free_domain_struct(struct domain *d)
+{
+    BUG_ON("unimplemented");
+}
+
+void dump_pageframe_info(struct domain *d)
+{
+    BUG_ON("unimplemented");
+}
+
+void free_vcpu_struct(struct vcpu *v)
+{
+    BUG_ON("unimplemented");
+}
+
+int arch_vcpu_create(struct vcpu *v)
+{
+    BUG_ON("unimplemented");
+}
+
+void arch_vcpu_destroy(struct vcpu *v)
+{
+    BUG_ON("unimplemented");
+}
+
+void vcpu_switch_to_aarch64_mode(struct vcpu *v)
+{
+    BUG_ON("unimplemented");
+}
+
+int arch_sanitise_domain_config(struct xen_domctl_createdomain *config)
+{
+    BUG_ON("unimplemented");
+}
+
+int arch_domain_create(struct domain *d,
+                       struct xen_domctl_createdomain *config,
+                       unsigned int flags)
+{
+    BUG_ON("unimplemented");
+}
+
+int arch_domain_teardown(struct domain *d)
+{
+    BUG_ON("unimplemented");
+}
+
+void arch_domain_destroy(struct domain *d)
+{
+    BUG_ON("unimplemented");
+}
+
+void arch_domain_shutdown(struct domain *d)
+{
+    BUG_ON("unimplemented");
+}
+
+void arch_domain_pause(struct domain *d)
+{
+    BUG_ON("unimplemented");
+}
+
+void arch_domain_unpause(struct domain *d)
+{
+    BUG_ON("unimplemented");
+}
+
+int arch_domain_soft_reset(struct domain *d)
+{
+    BUG_ON("unimplemented");
+}
+
+void arch_domain_creation_finished(struct domain *d)
+{
+    BUG_ON("unimplemented");
+}
+
+int arch_set_info_guest(struct vcpu *v, vcpu_guest_context_u c)
+{
+    BUG_ON("unimplemented");
+}
+
+int arch_initialise_vcpu(struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg)
+{
+    BUG_ON("unimplemented");
+}
+
+int arch_vcpu_reset(struct vcpu *v)
+{
+    BUG_ON("unimplemented");
+}
+
+int domain_relinquish_resources(struct domain *d)
+{
+    BUG_ON("unimplemented");
+}
+
+void arch_dump_domain_info(struct domain *d)
+{
+    BUG_ON("unimplemented");
+}
+
+void arch_dump_vcpu_info(struct vcpu *v)
+{
+    BUG_ON("unimplemented");
+}
+
+void vcpu_mark_events_pending(struct vcpu *v)
+{
+    BUG_ON("unimplemented");
+}
+
+void vcpu_update_evtchn_irq(struct vcpu *v)
+{
+    BUG_ON("unimplemented");
+}
+
+void vcpu_block_unless_event_pending(struct vcpu *v)
+{
+    BUG_ON("unimplemented");
+}
+
+void vcpu_kick(struct vcpu *v)
+{
+    BUG_ON("unimplemented");
+}
+
+struct domain *alloc_domain_struct(void)
+{
+    BUG_ON("unimplemented");
+}
+
+struct vcpu *alloc_vcpu_struct(const struct domain *d)
+{
+    BUG_ON("unimplemented");
+}
+
+unsigned long
+hypercall_create_continuation(unsigned int op, const char *format, ...)
+{
+    BUG_ON("unimplemented");
+}
+
+int __init parse_arch_dom0_param(const char *s, const char *e)
+{
+    BUG_ON("unimplemented");
+}
+
+/* guestcopy.c */
+
+unsigned long raw_copy_to_guest(void *to, const void *from, unsigned int len)
+{
+    BUG_ON("unimplemented");
+}
+
+unsigned long raw_copy_from_guest(void *to, const void __user *from,
+                                  unsigned int len)
+{
+    BUG_ON("unimplemented");
+}
+
+/* sysctl.c */
+
+long arch_do_sysctl(struct xen_sysctl *sysctl,
+                    XEN_GUEST_HANDLE_PARAM(xen_sysctl_t) u_sysctl)
+{
+    BUG_ON("unimplemented");
+}
+
+void arch_do_physinfo(struct xen_sysctl_physinfo *pi)
+{
+    BUG_ON("unimplemented");
+}
+
+/* p2m.c */
+
+int arch_set_paging_mempool_size(struct domain *d, uint64_t size)
+{
+    BUG_ON("unimplemented");
+}
+
+int unmap_mmio_regions(struct domain *d,
+                       gfn_t start_gfn,
+                       unsigned long nr,
+                       mfn_t mfn)
+{
+    BUG_ON("unimplemented");
+}
+
+int map_mmio_regions(struct domain *d,
+                     gfn_t start_gfn,
+                     unsigned long nr,
+                     mfn_t mfn)
+{
+    BUG_ON("unimplemented");
+}
+
+int set_foreign_p2m_entry(struct domain *d, const struct domain *fd,
+                          unsigned long gfn, mfn_t mfn)
+{
+    BUG_ON("unimplemented");
+}
+
+/* Return the size of the pool, in bytes. */
+int arch_get_paging_mempool_size(struct domain *d, uint64_t *size)
+{
+    BUG_ON("unimplemented");
+}
+
+/* delay.c */
+
+void udelay(unsigned long usecs)
+{
+    BUG_ON("unimplemented");
+}
+
+/* guest_access.h */
+
+static inline unsigned long raw_clear_guest(void *to, unsigned int len)
+{
+    BUG_ON("unimplemented");
+}
+
+/* smpboot.c */
+
+int __cpu_up(unsigned int cpu)
+{
+    BUG_ON("unimplemented");
+}
+
+void __cpu_disable(void)
+{
+    BUG_ON("unimplemented");
+}
+
+void __cpu_die(unsigned int cpu)
+{
+    BUG_ON("unimplemented");
+}
+
+unsigned long get_upper_mfn_bound(void)
+{
+    BUG_ON("unimplemented");
+}
diff --git a/xen/arch/riscv/traps.c b/xen/arch/riscv/traps.c
index ccd3593f5a..5415cf8d90 100644
--- a/xen/arch/riscv/traps.c
+++ b/xen/arch/riscv/traps.c
@@ -4,6 +4,10 @@
  *
  * RISC-V Trap handlers
  */
+
+#include <xen/lib.h>
+#include <xen/sched.h>
+
 #include <asm/processor.h>
 #include <asm/traps.h>
 
@@ -11,3 +15,24 @@ void do_trap(struct cpu_user_regs *cpu_regs)
 {
     die();
 }
+
+void vcpu_show_execution_state(struct vcpu *v)
+{
+    BUG_ON("unimplemented");
+}
+
+void show_execution_state(const struct cpu_user_regs *regs)
+{
+    printk("implement show_execution_state(regs)\n");
+}
+
+void arch_hypercall_tasklet_result(struct vcpu *v, long res)
+{
+    BUG_ON("unimplemented");
+}
+
+enum mc_disposition arch_do_multicall_call(struct mc_state *state)
+{
+    BUG_ON("unimplemented");
+    return mc_continue;
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 03:57:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 03:57:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770111.1181006 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjPm-0007sg-4O; Fri, 02 Aug 2024 03:57:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770111.1181006; Fri, 02 Aug 2024 03:57:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjPm-0007sY-1c; Fri, 02 Aug 2024 03:57:14 +0000
Received: by outflank-mailman (input) for mailman id 770111;
 Fri, 02 Aug 2024 03:57:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjPl-0007sM-4S
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:57:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjPl-0002wH-3i
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:57:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjPl-00050R-2z
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:57:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=99Pidp3nDvZg9CyQRTAq7yFuku+6dGjFrWoFiA7yEl4=; b=Lz6/AIfpkwSAuQag2PCODMS5BA
	Zu/hr4jCN1H2RlDM0/hpm6Nmz8Lhhik5EpNgpMaAlgT1fhcjjtRha3LMXm9kFb8QMa/gniJCf2D6t
	jmkUOXG+kJ6fhJ6+7F8WkqQ5DfOrAw1w/XsWjUNM37EQdEvHsCo+BzqtQyIiaeMNDhco=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: enable full Xen build
Message-Id: <E1sZjPl-00050R-2z@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 03:57:13 +0000

commit ed31c78ce0de11558a205b0703b9507f5b79be2e
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Jul 31 13:07:45 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jul 31 13:07:45 2024 +0200

    xen/riscv: enable full Xen build
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/Makefile       |  16 +++-
 xen/arch/riscv/arch.mk        |   4 -
 xen/arch/riscv/early_printk.c | 168 ------------------------------------------
 3 files changed, 15 insertions(+), 173 deletions(-)

diff --git a/xen/arch/riscv/Makefile b/xen/arch/riscv/Makefile
index 60afbc0ad9..81b77b13d6 100644
--- a/xen/arch/riscv/Makefile
+++ b/xen/arch/riscv/Makefile
@@ -12,10 +12,24 @@ $(TARGET): $(TARGET)-syms
 	$(OBJCOPY) -O binary -S $< $@
 
 $(TARGET)-syms: $(objtree)/prelink.o $(obj)/xen.lds
-	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) -o $@
+	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \
+	    $(objtree)/common/symbols-dummy.o -o $(dot-target).0
+	$(NM) -pa --format=sysv $(dot-target).0 \
+		| $(objtree)/tools/symbols $(all_symbols) --sysv --sort \
+		> $(dot-target).0.S
+	$(MAKE) $(build)=$(@D) $(dot-target).0.o
+	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< \
+	    $(dot-target).0.o -o $(dot-target).1
+	$(NM) -pa --format=sysv $(dot-target).1 \
+		| $(objtree)/tools/symbols $(all_symbols) --sysv --sort \
+		> $(dot-target).1.S
+	$(MAKE) $(build)=$(@D) $(dot-target).1.o
+	$(LD) $(XEN_LDFLAGS) -T $(obj)/xen.lds -N $< $(build_id_linker) \
+	    $(dot-target).1.o -o $@
 	$(NM) -pa --format=sysv $@ \
 		| $(objtree)/tools/symbols --all-symbols --xensyms --sysv --sort \
 		> $@.map
+	rm -f $(@D)/.$(@F).[0-9]*
 
 $(obj)/xen.lds: $(src)/xen.lds.S FORCE
 	$(call if_changed_dep,cpp_lds_S)
diff --git a/xen/arch/riscv/arch.mk b/xen/arch/riscv/arch.mk
index 8c071aff65..17827c302c 100644
--- a/xen/arch/riscv/arch.mk
+++ b/xen/arch/riscv/arch.mk
@@ -38,7 +38,3 @@ extensions := $(subst $(space),,$(extensions))
 # -mcmodel=medlow would force Xen into the lower half.
 
 CFLAGS += $(riscv-generic-flags)$(extensions) -mstrict-align -mcmodel=medany
-
-# TODO: Drop override when more of the build is working
-override ALL_OBJS-y = arch/$(SRCARCH)/built_in.o
-override ALL_LIBS-y =
diff --git a/xen/arch/riscv/early_printk.c b/xen/arch/riscv/early_printk.c
index 60742a042d..610c814f54 100644
--- a/xen/arch/riscv/early_printk.c
+++ b/xen/arch/riscv/early_printk.c
@@ -40,171 +40,3 @@ void early_printk(const char *str)
         str++;
     }
 }
-
-/*
- * The following #if 1 ... #endif should be removed after printk
- * and related stuff are ready.
- */
-#if 1
-
-#include <xen/stdarg.h>
-#include <xen/string.h>
-
-/**
- * strlen - Find the length of a string
- * @s: The string to be sized
- */
-size_t (strlen)(const char * s)
-{
-    const char *sc;
-
-    for (sc = s; *sc != '\0'; ++sc)
-        /* nothing */;
-    return sc - s;
-}
-
-/**
- * memcpy - Copy one area of memory to another
- * @dest: Where to copy to
- * @src: Where to copy from
- * @count: The size of the area.
- *
- * You should not use this function to access IO space, use memcpy_toio()
- * or memcpy_fromio() instead.
- */
-void *(memcpy)(void *dest, const void *src, size_t count)
-{
-    char *tmp = (char *) dest, *s = (char *) src;
-
-    while (count--)
-        *tmp++ = *s++;
-
-    return dest;
-}
-
-int vsnprintf(char* str, size_t size, const char* format, va_list args)
-{
-    size_t i = 0; /* Current position in the output string */
-    size_t written = 0; /* Total number of characters written */
-    char* dest = str;
-
-    while ( format[i] != '\0' && written < size - 1 )
-    {
-        if ( format[i] == '%' )
-        {
-            i++;
-
-            if ( format[i] == '\0' )
-                break;
-
-            if ( format[i] == '%' )
-            {
-                if ( written < size - 1 )
-                {
-                    dest[written] = '%';
-                    written++;
-                }
-                i++;
-                continue;
-            }
-
-            /*
-             * Handle format specifiers.
-             * For simplicity, only %s and %d are implemented here.
-             */
-
-            if ( format[i] == 's' )
-            {
-                char* arg = va_arg(args, char*);
-                size_t arglen = strlen(arg);
-
-                size_t remaining = size - written - 1;
-
-                if ( arglen > remaining )
-                    arglen = remaining;
-
-                memcpy(dest + written, arg, arglen);
-
-                written += arglen;
-                i++;
-            }
-            else if ( format[i] == 'd' )
-            {
-                int arg = va_arg(args, int);
-
-                /* Convert the integer to string representation */
-                char numstr[32]; /* Assumes a maximum of 32 digits */
-                int numlen = 0;
-                int num = arg;
-                size_t remaining;
-
-                if ( arg < 0 )
-                {
-                    if ( written < size - 1 )
-                    {
-                        dest[written] = '-';
-                        written++;
-                    }
-
-                    num = -arg;
-                }
-
-                do
-                {
-                    numstr[numlen] = '0' + num % 10;
-                    num = num / 10;
-                    numlen++;
-                } while ( num > 0 );
-
-                /* Reverse the string */
-                for (int j = 0; j < numlen / 2; j++)
-                {
-                    char tmp = numstr[j];
-                    numstr[j] = numstr[numlen - 1 - j];
-                    numstr[numlen - 1 - j] = tmp;
-                }
-
-                remaining = size - written - 1;
-
-                if ( numlen > remaining )
-                    numlen = remaining;
-
-                memcpy(dest + written, numstr, numlen);
-
-                written += numlen;
-                i++;
-            }
-        }
-        else
-        {
-            if ( written < size - 1 )
-            {
-                dest[written] = format[i];
-                written++;
-            }
-            i++;
-        }
-    }
-
-    if ( size > 0 )
-        dest[written] = '\0';
-
-    return written;
-}
-
-void printk(const char *format, ...)
-{
-    static char buf[1024];
-
-    va_list args;
-    va_start(args, format);
-
-    (void)vsnprintf(buf, sizeof(buf), format, args);
-
-    early_printk(buf);
-
-    va_end(args);
-}
-
-#endif
-
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 03:57:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 03:57:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770112.1181009 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjPw-0007yW-5z; Fri, 02 Aug 2024 03:57:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770112.1181009; Fri, 02 Aug 2024 03:57:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjPw-0007yP-3M; Fri, 02 Aug 2024 03:57:24 +0000
Received: by outflank-mailman (input) for mailman id 770112;
 Fri, 02 Aug 2024 03:57:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjPv-0007y6-7N
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:57:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjPv-0002wU-6Z
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:57:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjPv-00050y-5o
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:57:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EwjBb5dADoaFG9+FJ8txQtX8EkYt2JA/LjCgMrdJWK4=; b=qp8kmO1AZk9vXihiDuSc4PV68k
	CLNBcF8Zr4XVexJ2E8mmZ/zL4Mi6VgSyt0/afmYK4balSZJOuo09UU0bjmgKQtrm563i6fgjRMCzP
	qS2i3KU0KZxeJD8YuWigonVtu+5E0z+GX4G9hIe+5jVK99FeZExHAtoJzhStEZkE32fw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/x86: drop constanst_test_bit() in asm/bitops.h
Message-Id: <E1sZjPv-00050y-5o@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 03:57:23 +0000

commit 846472780d825fd04fa5df5b65c669848b028e08
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Jul 31 13:08:16 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jul 31 13:08:16 2024 +0200

    xen/x86: drop constanst_test_bit() in asm/bitops.h
    
    constant_test_bit() is functionally the same as generic_test_bit(),
    so constant_test_bit() can be dropped and replaced with
    generic_test_bit().
    
    Requested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/bitops.h | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/xen/arch/x86/include/asm/bitops.h b/xen/arch/x86/include/asm/bitops.h
index f9aa60111f..8c0403405a 100644
--- a/xen/arch/x86/include/asm/bitops.h
+++ b/xen/arch/x86/include/asm/bitops.h
@@ -277,12 +277,6 @@ static inline int test_and_change_bit(int nr, volatile void *addr)
     test_and_change_bit(nr, addr);                      \
 })
 
-static inline int constant_test_bit(int nr, const volatile void *addr)
-{
-    return ((1U << (nr & 31)) &
-            (((const volatile unsigned int *)addr)[nr >> 5])) != 0;
-}
-
 static inline int variable_test_bit(int nr, const volatile void *addr)
 {
     int oldbit;
@@ -297,7 +291,7 @@ static inline int variable_test_bit(int nr, const volatile void *addr)
 
 #define arch_test_bit(nr, addr) ({                      \
     __builtin_constant_p(nr) ?                          \
-        constant_test_bit(nr, addr) :                   \
+        generic_test_bit(nr, addr) :                    \
         variable_test_bit(nr, addr);                    \
 })
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 03:57:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 03:57:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770114.1181014 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjQ6-00081k-7Y; Fri, 02 Aug 2024 03:57:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770114.1181014; Fri, 02 Aug 2024 03:57:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjQ6-00081c-4o; Fri, 02 Aug 2024 03:57:34 +0000
Received: by outflank-mailman (input) for mailman id 770114;
 Fri, 02 Aug 2024 03:57:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjQ5-00081M-AJ
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:57:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjQ5-0002wY-9Y
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:57:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjQ5-00051T-8o
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:57:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rtl0AOMs519WDGFmTwYjyIdq0TnoDSMBkM3myLuILF4=; b=HAvBrq/UJDcFl8XMzM6YzplxoR
	XCGudSsSPogNyyR4UTF6vFZh/6yZKka182aaWRglNmpyOCDhD/tYLAlU8DaoMCcZ/MmWB2OTcRBT+
	353NQIRHa1EDB9NU2Zm77fYlf/HdAt36cBMqPcl3vlZEJE2RAGphKn/cAc9QlNibL57I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/ucode: Introduce XENPF_microcode_update2 with flags parameter
Message-Id: <E1sZjQ5-00051T-8o@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 03:57:33 +0000

commit c0b379294217f7a288d7369df7568d221cb9b03c
Author:     Fouad Hilly <fouad.hilly@cloud.com>
AuthorDate: Wed Jul 31 13:09:02 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jul 31 13:09:02 2024 +0200

    x86/ucode: Introduce XENPF_microcode_update2 with flags parameter
    
    Refactor microcode_update() by adding flags field.
    struct xenpf_microcode_update2 added with uint32_t flags field.
    Introduce XENPF_microcode_update2 hypercall with flags field.
    
    Signed-off-by: Fouad Hilly <fouad.hilly@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/cpu/microcode/core.c    | 11 ++++++++---
 xen/arch/x86/include/asm/microcode.h |  3 ++-
 xen/arch/x86/platform_hypercall.c    | 13 ++++++++++++-
 xen/include/public/platform.h        | 14 ++++++++++++++
 4 files changed, 36 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index e90055772a..8a9e744489 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -40,6 +40,8 @@
 #include <asm/processor.h>
 #include <asm/setup.h>
 
+#include <public/platform.h>
+
 #include "private.h"
 
 /*
@@ -570,6 +572,7 @@ static int cf_check do_microcode_update(void *patch)
 }
 
 struct ucode_buf {
+    unsigned int flags;
     unsigned int len;
     char buffer[];
 };
@@ -708,13 +711,14 @@ static long cf_check microcode_update_helper(void *data)
     return ret;
 }
 
-int microcode_update(XEN_GUEST_HANDLE(const_void) buf, unsigned long len)
+int microcode_update(XEN_GUEST_HANDLE(const_void) buf,
+                     unsigned long len, unsigned int flags)
 {
     int ret;
     struct ucode_buf *buffer;
 
-    if ( len != (uint32_t)len )
-        return -E2BIG;
+    if ( flags & ~XENPF_UCODE_FORCE )
+        return -EINVAL;
 
     if ( !ucode_ops.apply_microcode )
         return -EINVAL;
@@ -730,6 +734,7 @@ int microcode_update(XEN_GUEST_HANDLE(const_void) buf, unsigned long len)
         return -EFAULT;
     }
     buffer->len = len;
+    buffer->flags = flags;
 
     /*
      * Always queue microcode_update_helper() on CPU0.  Most of the logic
diff --git a/xen/arch/x86/include/asm/microcode.h b/xen/arch/x86/include/asm/microcode.h
index 8f59b20b02..57c08205d4 100644
--- a/xen/arch/x86/include/asm/microcode.h
+++ b/xen/arch/x86/include/asm/microcode.h
@@ -22,7 +22,8 @@ struct cpu_signature {
 DECLARE_PER_CPU(struct cpu_signature, cpu_sig);
 
 void microcode_set_module(unsigned int idx);
-int microcode_update(XEN_GUEST_HANDLE(const_void) buf, unsigned long len);
+int microcode_update(XEN_GUEST_HANDLE(const_void) buf,
+                     unsigned long len, unsigned int flags);
 int early_microcode_init(unsigned long *module_map,
                          const struct multiboot_info *mbi);
 int microcode_init_cache(unsigned long *module_map,
diff --git a/xen/arch/x86/platform_hypercall.c b/xen/arch/x86/platform_hypercall.c
index 95467b88ab..7e32781093 100644
--- a/xen/arch/x86/platform_hypercall.c
+++ b/xen/arch/x86/platform_hypercall.c
@@ -311,7 +311,18 @@ ret_t do_platform_op(
 
         guest_from_compat_handle(data, op->u.microcode.data);
 
-        ret = microcode_update(data, op->u.microcode.length);
+        ret = microcode_update(data, op->u.microcode.length, 0);
+        break;
+    }
+
+    case XENPF_microcode_update2:
+    {
+        XEN_GUEST_HANDLE(const_void) data;
+
+        guest_from_compat_handle(data, op->u.microcode2.data);
+
+        ret = microcode_update(data, op->u.microcode2.length,
+                               op->u.microcode2.flags);
         break;
     }
 
diff --git a/xen/include/public/platform.h b/xen/include/public/platform.h
index 15777b5416..2725b8d104 100644
--- a/xen/include/public/platform.h
+++ b/xen/include/public/platform.h
@@ -624,6 +624,19 @@ struct xenpf_ucode_revision {
 typedef struct xenpf_ucode_revision xenpf_ucode_revision_t;
 DEFINE_XEN_GUEST_HANDLE(xenpf_ucode_revision_t);
 
+/* Hypercall to microcode_update with flags */
+#define XENPF_microcode_update2    66
+struct xenpf_microcode_update2 {
+    /* IN variables. */
+    uint32_t flags;                   /* Flags to be passed with ucode. */
+/* Force to skip microcode version check */
+#define XENPF_UCODE_FORCE           1
+    uint32_t length;                  /* Length of microcode data. */
+    XEN_GUEST_HANDLE(const_void) data;/* Pointer to microcode data */
+};
+typedef struct xenpf_microcode_update2 xenpf_microcode_update2_t;
+DEFINE_XEN_GUEST_HANDLE(xenpf_microcode_update2_t);
+
 /*
  * ` enum neg_errnoval
  * ` HYPERVISOR_platform_op(const struct xen_platform_op*);
@@ -656,6 +669,7 @@ struct xen_platform_op {
         xenpf_symdata_t               symdata;
         xenpf_dom0_console_t          dom0_console;
         xenpf_ucode_revision_t        ucode_revision;
+        xenpf_microcode_update2_t     microcode2;
         uint8_t                       pad[128];
     } u;
 };
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 03:57:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 03:57:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770115.1181018 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjQG-00084p-97; Fri, 02 Aug 2024 03:57:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770115.1181018; Fri, 02 Aug 2024 03:57: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 1sZjQG-00084h-6E; Fri, 02 Aug 2024 03:57:44 +0000
Received: by outflank-mailman (input) for mailman id 770115;
 Fri, 02 Aug 2024 03:57:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjQF-00084Z-E2
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:57:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjQF-0002wf-DF
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:57:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjQF-00051u-CX
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:57: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9XF10TCCmRLQ14P6D8oHDn7wMcXMDj/pMupvcHWYN90=; b=I5Wdfr/bgW/QUOeowVsY8E9U9e
	O4VkwxNqvbK95m2eladD7zq+3L53gnuoXnQsQjRcozN2V6/7B9CRV8IPSifVSDw0fv8fNzzoQQ1sE
	L2Pw4epjrYJuU6pyscyIfApfUExWH1OQOC7QKmAl4YT2f2q1958qmqMe+6NCG3DF27WI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvm: address violations of MISRA C Rule 16.3
Message-Id: <E1sZjQF-00051u-CX@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 03:57:43 +0000

commit 4cf7e1311613f8357d5f9c929ea379517927e241
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Wed Jul 31 13:09:33 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jul 31 13:09:33 2024 +0200

    x86/hvm: address violations of MISRA C Rule 16.3
    
    MISRA C Rule 16.3 states that "An unconditional `break' statement shall
    terminate every switch-clause".
    
    Add pseudo keyword fallthrough or missing break statement
    to address violations of the rule.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/emulate.c   | 11 ++++++-----
 xen/arch/x86/hvm/hvm.c       |  1 +
 xen/arch/x86/hvm/hypercall.c |  2 +-
 xen/arch/x86/hvm/irq.c       |  1 +
 xen/arch/x86/hvm/pmtimer.c   |  1 +
 xen/arch/x86/hvm/svm/svm.c   |  2 ++
 xen/arch/x86/hvm/vlapic.c    |  1 +
 xen/arch/x86/hvm/vmx/vmx.c   |  3 ++-
 xen/arch/x86/hvm/vmx/vvmx.c  |  1 +
 xen/arch/x86/hvm/vpic.c      |  1 +
 xen/arch/x86/hvm/vpt.c       |  3 +--
 11 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 02e378365b..135aa6fc22 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -339,7 +339,7 @@ static int hvmemul_do_io(
     }
     case X86EMUL_UNIMPLEMENTED:
         ASSERT_UNREACHABLE();
-        /* Fall-through */
+        fallthrough;
     default:
         BUG();
     }
@@ -396,8 +396,7 @@ static int hvmemul_acquire_page(unsigned long gmfn, struct page_info **page)
 
     default:
         ASSERT_UNREACHABLE();
-        /* Fallthrough */
-
+        fallthrough;
     case -EINVAL:
         return X86EMUL_UNHANDLEABLE;
     }
@@ -2764,6 +2763,7 @@ int hvm_emulate_one_mmio(unsigned long mfn, unsigned long gla)
         /* fallthrough */
     default:
         hvm_emulate_writeback(&ctxt);
+        break;
     }
 
     return rc;
@@ -2799,10 +2799,11 @@ void hvm_emulate_one_vm_event(enum emul_kind kind, unsigned int trapnr,
         memcpy(hvio->mmio_insn, curr->arch.vm_event->emul.insn.data,
                hvio->mmio_insn_bytes);
     }
-    /* Fall-through */
+        fallthrough;
     default:
         ctx.set_context = (kind == EMUL_KIND_SET_CONTEXT_DATA);
         rc = hvm_emulate_one(&ctx, VIO_no_completion);
+        break;
     }
 
     switch ( rc )
@@ -2818,7 +2819,7 @@ void hvm_emulate_one_vm_event(enum emul_kind kind, unsigned int trapnr,
     case X86EMUL_UNIMPLEMENTED:
         if ( hvm_monitor_emul_unimplemented() )
             return;
-        /* fall-through */
+        fallthrough;
     case X86EMUL_UNHANDLEABLE:
         hvm_dump_emulation_state(XENLOG_G_DEBUG, "Mem event", &ctx, rc);
         hvm_inject_hw_exception(trapnr, errcode);
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 7f4b627b1f..1d32f473a4 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -5283,6 +5283,7 @@ void hvm_get_segment_register(struct vcpu *v, enum x86_segment seg,
          * %cs and %tr are unconditionally present.  SVM ignores these present
          * bits and will happily run without them set.
          */
+        fallthrough;
     case x86_seg_cs:
         reg->p = 1;
         break;
diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
index 7fb3136f0c..c1bd17571e 100644
--- a/xen/arch/x86/hvm/hypercall.c
+++ b/xen/arch/x86/hvm/hypercall.c
@@ -110,7 +110,7 @@ int hvm_hypercall(struct cpu_user_regs *regs)
     {
     case 8:
         eax = regs->rax;
-        /* Fallthrough to permission check. */
+        fallthrough;
     case 4:
     case 2:
         if ( currd->arch.monitor.guest_request_userspace_enabled &&
diff --git a/xen/arch/x86/hvm/irq.c b/xen/arch/x86/hvm/irq.c
index 210cebb0e6..1eab44defc 100644
--- a/xen/arch/x86/hvm/irq.c
+++ b/xen/arch/x86/hvm/irq.c
@@ -282,6 +282,7 @@ static void hvm_set_callback_irq_level(struct vcpu *v)
             __hvm_pci_intx_assert(d, pdev, pintx);
         else
             __hvm_pci_intx_deassert(d, pdev, pintx);
+        break;
     default:
         break;
     }
diff --git a/xen/arch/x86/hvm/pmtimer.c b/xen/arch/x86/hvm/pmtimer.c
index 97099ac305..87a7a01c9f 100644
--- a/xen/arch/x86/hvm/pmtimer.c
+++ b/xen/arch/x86/hvm/pmtimer.c
@@ -185,6 +185,7 @@ static int cf_check handle_evt_io(
                 gdprintk(XENLOG_WARNING, 
                          "Bad ACPI PM register write: %x bytes (%x) at %x\n", 
                          bytes, *val, port);
+                break;
             }
         }
         /* Fix up the SCI state to match the new register state */
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 988250dbc1..92bb10c504 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -681,6 +681,7 @@ static void cf_check svm_get_segment_register(
         ASSERT_UNREACHABLE();
         domain_crash(v->domain);
         *reg = (struct segment_register){};
+        break;
     }
 }
 
@@ -2416,6 +2417,7 @@ static void cf_check svm_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
                __func__, v, reg, val);
         domain_crash(d);
+        break;
     }
 }
 
diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 9cfc82666a..2ec9594271 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -367,6 +367,7 @@ static void vlapic_accept_irq(struct vcpu *v, uint32_t icr_low)
         gdprintk(XENLOG_ERR, "TODO: unsupported delivery mode in ICR %x\n",
                  icr_low);
         domain_crash(v->domain);
+        break;
     }
 }
 
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index f16faa6a61..46911c3e1c 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2745,6 +2745,7 @@ static void cf_check vmx_set_reg(struct vcpu *v, unsigned int reg, uint64_t val)
         printk(XENLOG_G_ERR "%s(%pv, 0x%08x, 0x%016"PRIx64") Bad register\n",
                __func__, v, reg, val);
         domain_crash(d);
+        break;
     }
     vmx_vmcs_exit(v);
 }
@@ -3393,7 +3394,7 @@ static int cf_check vmx_msr_read_intercept(
         *msr_content |= MSR_IA32_MISC_ENABLE_BTS_UNAVAIL |
                        MSR_IA32_MISC_ENABLE_PEBS_UNAVAIL;
         /* Perhaps vpmu will change some bits. */
-        /* FALLTHROUGH */
+        fallthrough;
     case MSR_P6_PERFCTR(0)...MSR_P6_PERFCTR(7):
     case MSR_P6_EVNTSEL(0)...MSR_P6_EVNTSEL(3):
     case MSR_CORE_PERF_FIXED_CTR0...MSR_CORE_PERF_FIXED_CTR2:
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index 39290c9861..c05e0e9326 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -2768,6 +2768,7 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs,
         gprintk(XENLOG_ERR, "Unhandled nested vmexit: reason %u\n",
                 exit_reason);
         domain_crash(v->domain);
+        break;
     }
 
     return ( nvcpu->nv_vmexit_pending == 1 );
diff --git a/xen/arch/x86/hvm/vpic.c b/xen/arch/x86/hvm/vpic.c
index 7c3b5c7254..6427b08086 100644
--- a/xen/arch/x86/hvm/vpic.c
+++ b/xen/arch/x86/hvm/vpic.c
@@ -309,6 +309,7 @@ static void vpic_ioport_write(
             if ( !(vpic->init_state & 8) )
                 break; /* CASCADE mode: wait for write to ICW3. */
             /* SNGL mode: fall through (no ICW3). */
+            fallthrough;
         case 2:
             /* ICW3 */
             vpic->init_state++;
diff --git a/xen/arch/x86/hvm/vpt.c b/xen/arch/x86/hvm/vpt.c
index e1d6845a28..5e7b9a9f66 100644
--- a/xen/arch/x86/hvm/vpt.c
+++ b/xen/arch/x86/hvm/vpt.c
@@ -119,8 +119,7 @@ static int pt_irq_masked(struct periodic_time *pt)
 
         gsi = hvm_isa_irq_to_gsi(pt->irq);
     }
-
-    /* Fallthrough to check if the interrupt is masked on the IO APIC. */
+        fallthrough;
     case PTSRC_ioapic:
     {
         int mask = vioapic_get_mask(v->domain, gsi);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 03:57:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 03:57:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770116.1181022 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjQQ-00087t-AR; Fri, 02 Aug 2024 03:57:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770116.1181022; Fri, 02 Aug 2024 03:57: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 1sZjQQ-00087m-7g; Fri, 02 Aug 2024 03:57:54 +0000
Received: by outflank-mailman (input) for mailman id 770116;
 Fri, 02 Aug 2024 03:57:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjQP-00087X-HE
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:57:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjQP-0002wj-GV
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:57:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjQP-00052N-Fl
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:57: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lb0BdkRCXw7Cg0p6e052dI6dIisna8BVQgWtdJXpmZU=; b=YoGw6j9pG52KVYxPsLNVy+Y36w
	knjB+DAbGn+xa2TvhIT6DFZ54L/cHTx6hwDw/gM5Ihy1aTw6bIfjXgX8dWtW4DhPetr5Rz/7OHCmN
	L5v3RRGIlYvcwsu/9l861uSHX2oE/neA/KTR5UCLSd0SUUj8enBzQ4y4//FpCBTqymbs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvm: add defensive statements in unreachable program points
Message-Id: <E1sZjQP-00052N-Fl@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 03:57:53 +0000

commit 643c2b6bc7df1971559855de854a80aee3b878e6
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Wed Jul 31 13:09:58 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jul 31 13:09:58 2024 +0200

    x86/hvm: add defensive statements in unreachable program points
    
    As a defensive measure, make sure to signal an error to the caller
    if an unreachable program point is reached.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/emulate.c  | 1 +
 xen/arch/x86/hvm/hvm.c      | 4 ++++
 xen/arch/x86/hvm/vmx/vmcs.c | 2 ++
 3 files changed, 7 insertions(+)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index 135aa6fc22..b6ca5cb9d1 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2673,6 +2673,7 @@ static int _hvm_emulate_one(struct hvm_emulate_ctxt *hvmemul_ctxt,
 
     default:
         ASSERT_UNREACHABLE();
+        return X86EMUL_UNHANDLEABLE;
     }
 
     if ( hvmemul_ctxt->ctxt.retire.singlestep )
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 1d32f473a4..d7f195ba9a 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -4919,6 +4919,8 @@ static int do_altp2m_op(
 
     default:
         ASSERT_UNREACHABLE();
+        rc = -EOPNOTSUPP;
+        break;
     }
 
  out:
@@ -5020,6 +5022,8 @@ static int compat_altp2m_op(
 
     default:
         ASSERT_UNREACHABLE();
+        rc = -EOPNOTSUPP;
+        break;
     }
 
     return rc;
diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 9b6dc51f36..5787110a56 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -1446,6 +1446,7 @@ struct vmx_msr_entry *vmx_find_msr(const struct vcpu *v, uint32_t msr,
 
     default:
         ASSERT_UNREACHABLE();
+        break;
     }
 
     if ( !start )
@@ -1598,6 +1599,7 @@ int vmx_del_msr(struct vcpu *v, uint32_t msr, enum vmx_msr_list_type type)
 
     default:
         ASSERT_UNREACHABLE();
+        return -EINVAL;
     }
 
     if ( !start )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 03:58:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 03:58:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770117.1181026 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjQa-0008Bg-D9; Fri, 02 Aug 2024 03:58:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770117.1181026; Fri, 02 Aug 2024 03:58: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 1sZjQa-0008BY-AT; Fri, 02 Aug 2024 03:58:04 +0000
Received: by outflank-mailman (input) for mailman id 770117;
 Fri, 02 Aug 2024 03:58:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjQZ-0008BN-K5
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:58:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjQZ-0002xT-JP
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:58:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjQZ-00053O-In
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:58: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=seIrh1Txo6lf3rXZtquLpCAcjoEtt70FvsFGMl2/slw=; b=RQDaruFBU3DoefyoGGTaudE6IK
	/4HGwhJKyzQkDesvUSvqnPYbwIDFE3FGmGqWOQ6RlFYkOKydcixjI1fE2oANPd1RfXV9oIzpuH2xh
	I6EsVhik6sOS5DisZP0HTVa8AbxjktQ5HKpEkk9QvADCfgFr0G4l+kERh275YrKCH1c4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/sched: fix error handling in cpu_schedule_up()
Message-Id: <E1sZjQZ-00053O-In@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 03:58:03 +0000

commit 44a7d4f0a5e9eae41a44a162e54ff6d2ebe5b7d6
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Jul 31 14:50:18 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jul 31 14:50:18 2024 +0200

    xen/sched: fix error handling in cpu_schedule_up()
    
    In case cpu_schedule_up() is failing, it needs to undo all externally
    visible changes it has done before.
    
    Reason is that cpu_schedule_callback() won't be called with the
    CPU_UP_CANCELED notifier in case cpu_schedule_up() did fail.
    
    Fixes: 207589dbacd4 ("xen/sched: move per cpu scheduler private data into struct sched_resource")
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/sched/core.c | 63 ++++++++++++++++++++++++++-----------------------
 1 file changed, 33 insertions(+), 30 deletions(-)

diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index 1a3ff5ae4d..d6296d99fd 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -2756,6 +2756,36 @@ static struct sched_resource *sched_alloc_res(void)
     return sr;
 }
 
+static void cf_check sched_res_free(struct rcu_head *head)
+{
+    struct sched_resource *sr = container_of(head, struct sched_resource, rcu);
+
+    free_cpumask_var(sr->cpus);
+    if ( sr->sched_unit_idle )
+        sched_free_unit_mem(sr->sched_unit_idle);
+    xfree(sr);
+}
+
+static void cpu_schedule_down(unsigned int cpu)
+{
+    struct sched_resource *sr;
+
+    rcu_read_lock(&sched_res_rculock);
+
+    sr = get_sched_res(cpu);
+
+    kill_timer(&sr->s_timer);
+
+    cpumask_clear_cpu(cpu, &sched_res_mask);
+    set_sched_res(cpu, NULL);
+
+    /* Keep idle unit. */
+    sr->sched_unit_idle = NULL;
+    call_rcu(&sr->rcu, sched_res_free);
+
+    rcu_read_unlock(&sched_res_rculock);
+}
+
 static int cpu_schedule_up(unsigned int cpu)
 {
     struct sched_resource *sr;
@@ -2795,7 +2825,10 @@ static int cpu_schedule_up(unsigned int cpu)
         idle_vcpu[cpu]->sched_unit->res = sr;
 
     if ( idle_vcpu[cpu] == NULL )
+    {
+        cpu_schedule_down(cpu);
         return -ENOMEM;
+    }
 
     idle_vcpu[cpu]->sched_unit->rendezvous_in_cnt = 0;
 
@@ -2813,36 +2846,6 @@ static int cpu_schedule_up(unsigned int cpu)
     return 0;
 }
 
-static void cf_check sched_res_free(struct rcu_head *head)
-{
-    struct sched_resource *sr = container_of(head, struct sched_resource, rcu);
-
-    free_cpumask_var(sr->cpus);
-    if ( sr->sched_unit_idle )
-        sched_free_unit_mem(sr->sched_unit_idle);
-    xfree(sr);
-}
-
-static void cpu_schedule_down(unsigned int cpu)
-{
-    struct sched_resource *sr;
-
-    rcu_read_lock(&sched_res_rculock);
-
-    sr = get_sched_res(cpu);
-
-    kill_timer(&sr->s_timer);
-
-    cpumask_clear_cpu(cpu, &sched_res_mask);
-    set_sched_res(cpu, NULL);
-
-    /* Keep idle unit. */
-    sr->sched_unit_idle = NULL;
-    call_rcu(&sr->rcu, sched_res_free);
-
-    rcu_read_unlock(&sched_res_rculock);
-}
-
 void sched_rm_cpu(unsigned int cpu)
 {
     int rc;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 03:58:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 03:58:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770118.1181030 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjQl-0008EZ-Ec; Fri, 02 Aug 2024 03:58:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770118.1181030; Fri, 02 Aug 2024 03:58: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 1sZjQl-0008ER-Bz; Fri, 02 Aug 2024 03:58:15 +0000
Received: by outflank-mailman (input) for mailman id 770118;
 Fri, 02 Aug 2024 03:58:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjQj-0008EC-Mu
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:58:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjQj-0002xb-MD
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:58:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjQj-00054e-LX
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:58: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=q5LHUptdxAVy+D1oJEMguW+ZAjhbC5ShA2dGrO+fono=; b=NqqCd6HmEOC595+iwGqfx+T3Tn
	mk9TQIBGwu/lf57T8qOb8XzAgSBd3BoMTwXX32f5SYcrnFjGMxVNMXAO4rCI56Dr0ypkzz4IhiDAt
	pXvEtIgwu91XChIDUz4DWdcSP2XnwQWM6sPVwEDRdq/APpHpBH290i/rY5e9kyYP93eE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/e820 address violations of MISRA C:2012 Rule 5.3
Message-Id: <E1sZjQj-00054e-LX@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 03:58:13 +0000

commit b5fd405aa381e587d90465829b94023ef243a080
Author:     Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
AuthorDate: Wed Jul 31 14:50:48 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jul 31 14:50:48 2024 +0200

    x86/e820 address violations of MISRA C:2012 Rule 5.3
    
    This addresses violations of MISRA C:2012 Rule 5.3 which states as
    following: An identifier declared in an inner scope shall not hide an
    identifier declared in an outer scope. Right here the conflict is with
    the global named "e820".
    
    No functional change.
    
    Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/e820.c | 74 ++++++++++++++++++++++++++---------------------------
 1 file changed, 37 insertions(+), 37 deletions(-)

diff --git a/xen/arch/x86/e820.c b/xen/arch/x86/e820.c
index 6a3ce7e0a0..3726823e88 100644
--- a/xen/arch/x86/e820.c
+++ b/xen/arch/x86/e820.c
@@ -593,79 +593,79 @@ int __init e820_add_range(uint64_t s, uint64_t e, uint32_t type)
 }
 
 int __init e820_change_range_type(
-    struct e820map *e820, uint64_t s, uint64_t e,
+    struct e820map *map, uint64_t s, uint64_t e,
     uint32_t orig_type, uint32_t new_type)
 {
     uint64_t rs = 0, re = 0;
     unsigned int i;
 
-    for ( i = 0; i < e820->nr_map; i++ )
+    for ( i = 0; i < map->nr_map; i++ )
     {
         /* Have we found the e820 region that includes the specified range? */
-        rs = e820->map[i].addr;
-        re = rs + e820->map[i].size;
+        rs = map->map[i].addr;
+        re = rs + map->map[i].size;
         if ( (s >= rs) && (e <= re) )
             break;
     }
 
-    if ( (i == e820->nr_map) || (e820->map[i].type != orig_type) )
+    if ( (i == map->nr_map) || (map->map[i].type != orig_type) )
         return 0;
 
     if ( (s == rs) && (e == re) )
     {
-        e820->map[i].type = new_type;
+        map->map[i].type = new_type;
     }
     else if ( (s == rs) || (e == re) )
     {
-        if ( (e820->nr_map + 1) > ARRAY_SIZE(e820->map) )
+        if ( (map->nr_map + 1) > ARRAY_SIZE(map->map) )
             goto overflow;
 
-        memmove(&e820->map[i+1], &e820->map[i],
-                (e820->nr_map-i) * sizeof(e820->map[0]));
-        e820->nr_map++;
+        memmove(&map->map[i+1], &map->map[i],
+                (map->nr_map-i) * sizeof(map->map[0]));
+        map->nr_map++;
 
         if ( s == rs )
         {
-            e820->map[i].size = e - s;
-            e820->map[i].type = new_type;
-            e820->map[i+1].addr = e;
-            e820->map[i+1].size = re - e;
+            map->map[i].size = e - s;
+            map->map[i].type = new_type;
+            map->map[i+1].addr = e;
+            map->map[i+1].size = re - e;
         }
         else
         {
-            e820->map[i].size = s - rs;
-            e820->map[i+1].addr = s;
-            e820->map[i+1].size = e - s;
-            e820->map[i+1].type = new_type;
+            map->map[i].size = s - rs;
+            map->map[i+1].addr = s;
+            map->map[i+1].size = e - s;
+            map->map[i+1].type = new_type;
         }
     }
     else
     {
-        if ( (e820->nr_map + 2) > ARRAY_SIZE(e820->map) )
+        if ( (map->nr_map + 2) > ARRAY_SIZE(map->map) )
             goto overflow;
 
-        memmove(&e820->map[i+2], &e820->map[i],
-                (e820->nr_map-i) * sizeof(e820->map[0]));
-        e820->nr_map += 2;
+        memmove(&map->map[i+2], &map->map[i],
+                (map->nr_map-i) * sizeof(map->map[0]));
+        map->nr_map += 2;
 
-        e820->map[i].size = s - rs;
-        e820->map[i+1].addr = s;
-        e820->map[i+1].size = e - s;
-        e820->map[i+1].type = new_type;
-        e820->map[i+2].addr = e;
-        e820->map[i+2].size = re - e;
+        map->map[i].size = s - rs;
+        map->map[i+1].addr = s;
+        map->map[i+1].size = e - s;
+        map->map[i+1].type = new_type;
+        map->map[i+2].addr = e;
+        map->map[i+2].size = re - e;
     }
 
     /* Finally, look for any opportunities to merge adjacent e820 entries. */
-    for ( i = 0; i < (e820->nr_map - 1); i++ )
+    for ( i = 0; i < (map->nr_map - 1); i++ )
     {
-        if ( (e820->map[i].type != e820->map[i+1].type) ||
-             ((e820->map[i].addr + e820->map[i].size) != e820->map[i+1].addr) )
+        if ( (map->map[i].type != map->map[i+1].type) ||
+             ((map->map[i].addr + map->map[i].size) != map->map[i+1].addr) )
             continue;
-        e820->map[i].size += e820->map[i+1].size;
-        memmove(&e820->map[i+1], &e820->map[i+2],
-                (e820->nr_map-i-2) * sizeof(e820->map[0]));
-        e820->nr_map--;
+        map->map[i].size += map->map[i+1].size;
+        memmove(&map->map[i+1], &map->map[i+2],
+                (map->nr_map-i-2) * sizeof(map->map[0]));
+        map->nr_map--;
         i--;
     }
 
@@ -678,9 +678,9 @@ int __init e820_change_range_type(
 }
 
 /* Set E820_RAM area (@s,@e) as RESERVED in specified e820 map. */
-int __init reserve_e820_ram(struct e820map *e820, uint64_t s, uint64_t e)
+int __init reserve_e820_ram(struct e820map *map, uint64_t s, uint64_t e)
 {
-    return e820_change_range_type(e820, s, e, E820_RAM, E820_RESERVED);
+    return e820_change_range_type(map, s, e, E820_RAM, E820_RESERVED);
 }
 
 unsigned long __init init_e820(const char *str, struct e820map *raw)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 03:58:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 03:58:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770119.1181033 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjQv-0008J2-Fk; Fri, 02 Aug 2024 03:58:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770119.1181033; Fri, 02 Aug 2024 03:58: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 1sZjQv-0008Iv-DL; Fri, 02 Aug 2024 03:58:25 +0000
Received: by outflank-mailman (input) for mailman id 770119;
 Fri, 02 Aug 2024 03:58:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjQt-0008Id-Pt
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:58:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjQt-0002xi-P8
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:58:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjQt-00056B-OW
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:58: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=86X75/K4I54DaSX14cZqfVTwd4CV7dwDgaVYqdMa0+g=; b=SOwzfZbbHaBTRcDpllzR0xGc22
	qKo157VJLerMM+L5eZoSSxM/iOJIZQKPzfxLmvRjQcu2vIhu9yzWWDAPX0ONBpw+I8EcUZB9oRxj8
	bLqPv/OAmb8i5dWZ9p5Ctn04Ep67xvV2YxZxkGQWs++G0879V56FPUQfsB2CQRmCkaII=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: add deviations for MISRA C 2012 Dir D4.10
Message-Id: <E1sZjQt-00056B-OW@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 03:58:23 +0000

commit d2b91faec4d905acebbc80aaec4def825e2f7280
Author:     Maria Celeste Cesario <maria.celeste.cesario@bugseng.com>
AuthorDate: Wed Jul 31 14:51:13 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jul 31 14:51:13 2024 +0200

    xen: add deviations for MISRA C 2012 Dir D4.10
    
    Add safe deviation for *.c files, as estabilished in past discussion.
    
    Signed-off-by: Maria Celeste Cesario  <maria.celeste.cesario@bugseng.com>
    Signed-off-by: Simone Ballarin  <simone.ballarin@bugseng.com>
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Signed-off-by: Alessandro Zucchelli <alessandro.zucchelli@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 5 +++++
 docs/misra/deviations.rst                        | 6 ++++++
 2 files changed, 11 insertions(+)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index 31b2ec669a..1aa8277066 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -78,6 +78,11 @@ conform to the directive."
 -config=MC3R1.D4.10,reports+={safe, "first_area(text(^/\\* Generated file, do not edit! \\*/$, begin-3))"}
 -doc_end
 
+-doc_begin="Including multiple times a .c file is safe because every function or data item
+it defines would (in the common case) be already defined. Peer reviewed by the community."
+-config=MC3R1.D4.10,reports+={safe, "all_area(all_loc(^.*\\.c$))"}
+-doc_end
+
 #
 # Series 5.
 #
diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
index 1ecce1469a..d51aa422b5 100644
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -30,6 +30,12 @@ Deviations related to MISRA C:2012 Directives:
        not to add an additional encapsulation layer.
      - Tagged as `deliberate` for ECLAIR.
 
+   * - D4.10
+     - Including multiple times a .c file is safe because every function or data item
+       it defines would in (the common case) be already defined.
+       Peer reviewed by the community.
+     - Tagged as `safe` for ECLAIR.
+
 Deviations related to MISRA C:2012 Rules:
 -----------------------------------------
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 03:58:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 03:58:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770120.1181038 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjR5-0008MH-Hd; Fri, 02 Aug 2024 03:58:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770120.1181038; Fri, 02 Aug 2024 03:58: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 1sZjR5-0008MA-En; Fri, 02 Aug 2024 03:58:35 +0000
Received: by outflank-mailman (input) for mailman id 770120;
 Fri, 02 Aug 2024 03:58:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjR3-0008Ln-Sl
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:58:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjR3-0002xp-S6
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:58:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjR3-000571-RR
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:58: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xeELTjyEbIOcovWohs2QuRXZjiuPA5yD7iKsizLBKSo=; b=pZuP2s1xvUYRR50ZCsVeu9KsxT
	nOyIctKls/x3zOrURvq0kSdN/jm3S9ZOH/w5tUvdAQjfmyUJrTzPMTAGS48PkvbkzZHR6oETlpF/4
	WKBvM/WQXl6QFl7+TrVl3Y7eLM11VHoSh7Eu8uSkpFLqJlL68h96wNBODCYbdLGF3VuQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/domain: Factor domlist_{insert,remove}() out of domain_{create,destroy}()
Message-Id: <E1sZjR3-000571-RR@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 03:58:33 +0000

commit 19995bc70cc6f26e0af84a4a178f971bdcc3ccbe
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Apr 23 15:02:54 2021 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jul 31 15:28:43 2024 +0100

    xen/domain: Factor domlist_{insert,remove}() out of domain_{create,destroy}()
    
    These are opencoded linked list and hashtable manipulations.  Factor them out
    into static inline helpers, and discuss the consequence for the domain.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/domain.c | 81 ++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 56 insertions(+), 25 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 2566604738..8d8f40ccb2 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -64,6 +64,58 @@ DEFINE_RCU_READ_LOCK(domlist_read_lock);
 static struct domain *domain_hash[DOMAIN_HASH_SIZE];
 struct domain *domain_list;
 
+/*
+ * Insert a domain into the domlist/hash.  This allows the domain to be looked
+ * up by domid, and therefore to be the subject of hypercalls/etc.
+ */
+static void domlist_insert(struct domain *d)
+{
+    struct domain **pd, *bucket;
+
+    spin_lock(&domlist_update_lock);
+
+    /* domain_list is maintained in domid order. */
+    for ( pd = &domain_list; *pd != NULL; pd = &(*pd)->next_in_list )
+        if ( (*pd)->domain_id > d->domain_id )
+            break;
+
+    bucket = domain_hash[DOMAIN_HASH(d->domain_id)];
+
+    d->next_in_list = *pd;
+    d->next_in_hashbucket = bucket;
+    rcu_assign_pointer(*pd, d);
+    rcu_assign_pointer(bucket, d);
+
+    spin_unlock(&domlist_update_lock);
+}
+
+/*
+ * Remove a domain from the domlist/hash.  This means the domain can no longer
+ * be looked up by domid, and therefore can no longer be the subject of
+ * *subsequent* hypercalls/etc.  In-progress hypercalls/etc can still operate
+ * on the domain.
+ */
+static void domlist_remove(struct domain *d)
+{
+    struct domain **pd;
+
+    spin_lock(&domlist_update_lock);
+
+    pd = &domain_list;
+    while ( *pd != d )
+        pd = &(*pd)->next_in_list;
+
+    rcu_assign_pointer(*pd, d->next_in_list);
+
+    pd = &domain_hash[DOMAIN_HASH(d->domain_id)];
+    while ( *pd != d )
+        pd = &(*pd)->next_in_hashbucket;
+
+    rcu_assign_pointer(*pd, d->next_in_hashbucket);
+
+    spin_unlock(&domlist_update_lock);
+}
+
 struct domain *hardware_domain __read_mostly;
 
 #ifdef CONFIG_LATE_HWDOM
@@ -589,7 +641,7 @@ struct domain *domain_create(domid_t domid,
                              struct xen_domctl_createdomain *config,
                              unsigned int flags)
 {
-    struct domain *d, **pd, *old_hwdom = NULL;
+    struct domain *d, *old_hwdom = NULL;
     enum { INIT_watchdog = 1u<<1,
            INIT_evtchn = 1u<<3, INIT_gnttab = 1u<<4, INIT_arch = 1u<<5 };
     int err, init_status = 0;
@@ -758,17 +810,7 @@ struct domain *domain_create(domid_t domid,
      * Must not fail beyond this point, as our caller doesn't know whether
      * the domain has been entered into domain_list or not.
      */
-
-    spin_lock(&domlist_update_lock);
-    pd = &domain_list; /* NB. domain_list maintained in order of domid. */
-    for ( pd = &domain_list; *pd != NULL; pd = &(*pd)->next_in_list )
-        if ( (*pd)->domain_id > d->domain_id )
-            break;
-    d->next_in_list = *pd;
-    d->next_in_hashbucket = domain_hash[DOMAIN_HASH(domid)];
-    rcu_assign_pointer(*pd, d);
-    rcu_assign_pointer(domain_hash[DOMAIN_HASH(domid)], d);
-    spin_unlock(&domlist_update_lock);
+    domlist_insert(d);
 
     memcpy(d->handle, config->handle, sizeof(d->handle));
 
@@ -1232,8 +1274,6 @@ static void cf_check complete_domain_destroy(struct rcu_head *head)
 /* Release resources belonging to task @p. */
 void domain_destroy(struct domain *d)
 {
-    struct domain **pd;
-
     BUG_ON(!d->is_dying);
 
     /* May be already destroyed, or get_domain() can race us. */
@@ -1242,17 +1282,8 @@ void domain_destroy(struct domain *d)
 
     TRACE_TIME(TRC_DOM0_DOM_REM, d->domain_id);
 
-    /* Delete from task list and task hashtable. */
-    spin_lock(&domlist_update_lock);
-    pd = &domain_list;
-    while ( *pd != d ) 
-        pd = &(*pd)->next_in_list;
-    rcu_assign_pointer(*pd, d->next_in_list);
-    pd = &domain_hash[DOMAIN_HASH(d->domain_id)];
-    while ( *pd != d ) 
-        pd = &(*pd)->next_in_hashbucket;
-    rcu_assign_pointer(*pd, d->next_in_hashbucket);
-    spin_unlock(&domlist_update_lock);
+    /* Remove from the domlist/hash. */
+    domlist_remove(d);
 
     /* Schedule RCU asynchronous completion of domain destroy. */
     call_rcu(&d->rcu, complete_domain_destroy);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 03:58:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 03:58:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770121.1181042 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjRF-0008P1-Jv; Fri, 02 Aug 2024 03:58:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770121.1181042; Fri, 02 Aug 2024 03:58: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 1sZjRF-0008Ot-GV; Fri, 02 Aug 2024 03:58:45 +0000
Received: by outflank-mailman (input) for mailman id 770121;
 Fri, 02 Aug 2024 03:58:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjRD-0008Oi-VX
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:58:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjRD-0002xx-Ur
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:58:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjRD-00057e-UC
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:58: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DYqnuGsDzNc93x5a7BS+Q6dGBjw/CPZyTzbP4DvSxBw=; b=gUu/2yXxrWvnTnmYF1aCAqCllx
	ngvBSUDg1tawDZU8cJOvQPPi77rgV+1oLkKJx7I9Z6hw9Xu4pI2uveGli9URE1KJpSIV4DFnGxo5F
	EnQrsqrW/X3ClRThxp9hAEwN5tZvEbU3Hi04X/mT1EJV0nLLqkHnkaur2RebbJPlN/tA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: fix build issue for bullseye-riscv64 container
Message-Id: <E1sZjRD-00057e-UC@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 03:58:43 +0000

commit e05e3cedb6dbe50e43b1d6a647c16a47219fde1d
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Jul 31 17:21:49 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Jul 31 17:21:49 2024 +0200

    xen/riscv: fix build issue for bullseye-riscv64 container
    
    Address compilation error on bullseye-riscv64 container:
       undefined reference to `guest_physmap_remove_page`
    
    Since there is no current implementation of `guest_physmap_remove_page()`,
    a stub function has been added.
    
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/stubs.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c
index b67d99729f..3285d18899 100644
--- a/xen/arch/riscv/stubs.c
+++ b/xen/arch/riscv/stubs.c
@@ -381,6 +381,12 @@ int arch_get_paging_mempool_size(struct domain *d, uint64_t *size)
     BUG_ON("unimplemented");
 }
 
+int guest_physmap_remove_page(struct domain *d, gfn_t gfn, mfn_t mfn,
+                              unsigned int page_order)
+{
+    BUG_ON("unimplemented");
+}
+
 /* delay.c */
 
 void udelay(unsigned long usecs)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 03:58:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 03:58:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770122.1181045 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZjRP-0008Rj-L0; Fri, 02 Aug 2024 03:58:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770122.1181045; Fri, 02 Aug 2024 03:58: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 1sZjRP-0008Rb-Ib; Fri, 02 Aug 2024 03:58:55 +0000
Received: by outflank-mailman (input) for mailman id 770122;
 Fri, 02 Aug 2024 03:58:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjRO-0008RM-2D
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:58:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjRO-0002y4-1S
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:58:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZjRO-00058D-0m
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 03:58: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iF9OChKMxXqAnCzj7fmPET08QOJNeciD/KCVhBSxyyk=; b=kWRgEc2RkOjt3Qy7SJzzQBt7Qg
	dBKAhrLMgu+LdcgMhNEL2Qm1NpTp61GOP2SHEJLKbUiMDS5qXyFxC1YYAyhSIqlKbHjhlESz9ZrtY
	8lpJVI50hKUUQviNt6B58OpON3guMcQ3j/ZtkD3KSi9jFq5ZQ+tmGUWaamX+FvbEjf4s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/domain: Fix domlist_insert() updating the domain hash
Message-Id: <E1sZjRO-00058D-0m@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 03:58:54 +0000

commit 36f75d39b38d94a0d17119a4178c08de994ead23
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jul 31 20:05:21 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Jul 31 23:19:42 2024 +0100

    x86/domain: Fix domlist_insert() updating the domain hash
    
    A last minute review request was to dedup the expression calculating the
    domain hash bucket.
    
    While the code reads correctly, it is buggy because rcu_assign_pointer() is a
    deeply misleading API assigning by name not value, and - contrary to it's name
    - does not hide an indirection.
    
    Therefore, rcu_assign_pointer(bucket, d); updates the local bucket variable on
    the stack, not domain_hash[], causing all subsequent domid lookups to fail.
    
    Rework the logic to use pd in the same way that domlist_remove() does.
    
    Fixes: 19995bc70cc6 ("xen/domain: Factor domlist_{insert,remove}() out of domain_{create,destroy}()")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/domain.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 8d8f40ccb2..92263a4fbd 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -70,7 +70,7 @@ struct domain *domain_list;
  */
 static void domlist_insert(struct domain *d)
 {
-    struct domain **pd, *bucket;
+    struct domain **pd;
 
     spin_lock(&domlist_update_lock);
 
@@ -79,12 +79,12 @@ static void domlist_insert(struct domain *d)
         if ( (*pd)->domain_id > d->domain_id )
             break;
 
-    bucket = domain_hash[DOMAIN_HASH(d->domain_id)];
-
     d->next_in_list = *pd;
-    d->next_in_hashbucket = bucket;
     rcu_assign_pointer(*pd, d);
-    rcu_assign_pointer(bucket, d);
+
+    pd = &domain_hash[DOMAIN_HASH(d->domain_id)];
+    d->next_in_hashbucket = *pd;
+    rcu_assign_pointer(*pd, d);
 
     spin_unlock(&domlist_update_lock);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 06:55:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 06:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770211.1181149 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZmBs-0005vM-VP; Fri, 02 Aug 2024 06:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770211.1181149; Fri, 02 Aug 2024 06: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 1sZmBs-0005vE-Sq; Fri, 02 Aug 2024 06:55:04 +0000
Received: by outflank-mailman (input) for mailman id 770211;
 Fri, 02 Aug 2024 06:55:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZmBr-0005v8-N5
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 06:55:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZmBr-0006Yh-BQ
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 06:55:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZmBr-0000ip-8z
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 06:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=a62mil1x3JAuMyo2ZGn1A0diYKMdPhIGtmaqj/qmsmc=; b=3zY2ZAqr6SmshRFrkveGO2c9rr
	DeuLKdbIk0o2nHMWaMsPr+G3D66dkK3ACbs+Hrkn3oYJU+W0kQ+1WPMdeOB4nGw2tw77fqoh/SI9D
	ml1m/AcyGWxWVslIGf8+O/6hkgijG+KbnSjOf1g8KG5xpNnoJUNiBL52FNSe3O2m7S6Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/hvm: Don't skip MSR_READ trace record
Message-Id: <E1sZmBr-0000ip-8z@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 06:55:03 +0000

commit bc8a43fff61ae4162a95d84f4e148d6773667cd2
Author:     George Dunlap <george.dunlap@cloud.com>
AuthorDate: Fri Aug 2 08:42:09 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 2 08:42:09 2024 +0200

    xen/hvm: Don't skip MSR_READ trace record
    
    Commit 37f074a3383 ("x86/msr: introduce guest_rdmsr()") introduced a
    function to combine the MSR_READ handling between PV and HVM.
    Unfortunately, by returning directly, it skipped the trace generation,
    leading to gaps in the trace record, as well as xenalyze errors like
    this:
    
    hvm_generic_postprocess: d2v0 Strange, exit 7c(VMEXIT_MSR) missing a handler
    
    Replace the `return` with `goto out`.
    
    Fixes: 37f074a3383 ("x86/msr: introduce guest_rdmsr()")
    Signed-off-by: George Dunlap <george.dunlap@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 9f37db494d..f49e29faf7 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3557,7 +3557,7 @@ int hvm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
     fixed_range_base = (uint64_t *)v->arch.hvm.mtrr.fixed_ranges;
 
     if ( (ret = guest_rdmsr(v, msr, msr_content)) != X86EMUL_UNHANDLEABLE )
-        return ret;
+        goto out;
 
     ret = X86EMUL_OKAY;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 06:55:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 06:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770212.1181154 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZmC2-0005xA-0n; Fri, 02 Aug 2024 06:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770212.1181154; Fri, 02 Aug 2024 06: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 1sZmC1-0005x3-UJ; Fri, 02 Aug 2024 06:55:13 +0000
Received: by outflank-mailman (input) for mailman id 770212;
 Fri, 02 Aug 2024 06:55:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZmC1-0005wv-H7
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 06:55:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZmC1-0006Yl-GG
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 06:55:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZmC1-0000jR-Es
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 06:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oqs+mu45boQ0LugoF1zxf5ebGsEEMKaSio0erY84xqM=; b=rNmMyAyUDGHBU1VcOg3NLh1GPG
	Xg0TJU3UsO9l/wjFjiCNNhRb0nFrtgJVq0pyc1b0k27qVSLQvSHMceWpFJq3wDvqLxg7XDZOP6esH
	JIRzV82Rngj16NY7y7ES7I26c70+SkY9Kvc43Lr4mAiFAoug5k6ZibVX441XjJFH/xlI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: drop Xeon Phi support
Message-Id: <E1sZmC1-0000jR-Es@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 06:55:13 +0000

commit 85191cf32180c920b292963053774e4540284d66
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Aug 2 08:43:25 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 2 08:43:25 2024 +0200

    x86: drop Xeon Phi support
    
    Do as was decided in Lisbon. Reportedly Xen hasn't been working very
    well on those processors anyway.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 CHANGELOG.md                                 |   2 +
 SUPPORT.md                                   |   1 +
 tools/tests/x86_emulator/Makefile            |   5 +-
 tools/tests/x86_emulator/evex-disp8.c        |  36 --------
 tools/tests/x86_emulator/test_x86_emulator.c |  85 -----------------
 tools/tests/x86_emulator/x86-emulate.c       |   1 -
 tools/tests/x86_emulator/x86-emulate.h       |   3 -
 xen/arch/x86/acpi/cpu_idle.c                 |  13 ---
 xen/arch/x86/cpu/mcheck/mce_intel.c          |   2 -
 xen/arch/x86/cpu/mwait-idle.c                |  22 -----
 xen/arch/x86/hvm/vmx/vmx.c                   |  11 ---
 xen/arch/x86/include/asm/cpufeature.h        |   3 -
 xen/arch/x86/include/asm/intel-family.h      |   9 +-
 xen/arch/x86/spec_ctrl.c                     |  23 -----
 xen/arch/x86/x86_emulate/private.h           |   4 -
 xen/arch/x86/x86_emulate/x86_emulate.c       | 132 ---------------------------
 xen/include/public/arch-x86/cpufeatureset.h  |   8 +-
 17 files changed, 10 insertions(+), 350 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 92f5825bff..eeaaa8b274 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ### Added
 
 ### Removed
+ - On x86:
+   - Support for running on Xeon Phi processors.
 
 ## [4.19.0](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.19.0) - 2024-07-29
 
diff --git a/SUPPORT.md b/SUPPORT.md
index bd4316523d..0c36cb2ed4 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -30,6 +30,7 @@ supported in this document.
 ### x86-64
 
     Status: Supported
+    Status, Xeon Phi: Not supported.
 
 ### ARM v7 + Virtualization Extensions
 
diff --git a/tools/tests/x86_emulator/Makefile b/tools/tests/x86_emulator/Makefile
index 834b2112e7..294d27ebaa 100644
--- a/tools/tests/x86_emulator/Makefile
+++ b/tools/tests/x86_emulator/Makefile
@@ -16,7 +16,7 @@ vpath %.c $(XEN_ROOT)/xen/lib/x86
 
 CFLAGS += $(CFLAGS_xeninclude)
 
-SIMD := 3dnow sse sse2 sse4 avx avx2 xop avx512f avx512bw avx512dq avx512er avx512vbmi avx512fp16
+SIMD := 3dnow sse sse2 sse4 avx avx2 xop avx512f avx512bw avx512dq avx512vbmi avx512fp16
 FMA := fma4 fma
 SG := avx2-sg avx512f-sg
 AES := ssse3-aes avx-aes avx2-vaes avx512bw-vaes
@@ -80,9 +80,6 @@ avx512bw-flts :=
 avx512dq-vecs := $(avx512f-vecs)
 avx512dq-ints := $(avx512f-ints)
 avx512dq-flts := $(avx512f-flts)
-avx512er-vecs := 64
-avx512er-ints :=
-avx512er-flts := 4 8
 avx512vbmi-vecs := $(avx512bw-vecs)
 avx512vbmi-ints := $(avx512bw-ints)
 avx512vbmi-flts := $(avx512bw-flts)
diff --git a/tools/tests/x86_emulator/evex-disp8.c b/tools/tests/x86_emulator/evex-disp8.c
index 9984e6d714..902e157bd4 100644
--- a/tools/tests/x86_emulator/evex-disp8.c
+++ b/tools/tests/x86_emulator/evex-disp8.c
@@ -524,37 +524,6 @@ static const struct test avx512dq_512[] = {
     INSN(inserti32x8,    66, 0f3a, 3a, el_8, d, vl),
 };
 
-static const struct test avx512er_512[] = {
-    INSN(exp2,    66, 0f38, c8, vl, sd, vl),
-    INSN(rcp28,   66, 0f38, ca, vl, sd, vl),
-    INSN(rcp28,   66, 0f38, cb, el, sd, el),
-    INSN(rsqrt28, 66, 0f38, cc, vl, sd, vl),
-    INSN(rsqrt28, 66, 0f38, cd, el, sd, el),
-};
-
-static const struct test avx512pf_512[] = {
-    INSNX(gatherpf0d,  66, 0f38, c6, 1, vl, sd, el),
-    INSNX(gatherpf0q,  66, 0f38, c7, 1, vl, sd, el),
-    INSNX(gatherpf1d,  66, 0f38, c6, 2, vl, sd, el),
-    INSNX(gatherpf1q,  66, 0f38, c7, 2, vl, sd, el),
-    INSNX(scatterpf0d, 66, 0f38, c6, 5, vl, sd, el),
-    INSNX(scatterpf0q, 66, 0f38, c7, 5, vl, sd, el),
-    INSNX(scatterpf1d, 66, 0f38, c6, 6, vl, sd, el),
-    INSNX(scatterpf1q, 66, 0f38, c7, 6, vl, sd, el),
-};
-
-static const struct test avx512_4fmaps_512[] = {
-    INSN(4fmaddps,  f2, 0f38, 9a, el_4, d, vl),
-    INSN(4fmaddss,  f2, 0f38, 9b, el_4, d, vl),
-    INSN(4fnmaddps, f2, 0f38, aa, el_4, d, vl),
-    INSN(4fnmaddss, f2, 0f38, ab, el_4, d, vl),
-};
-
-static const struct test avx512_4vnniw_512[] = {
-    INSN(p4dpwssd,  f2, 0f38, 52, el_4, d, vl),
-    INSN(p4dpwssds, f2, 0f38, 53, el_4, d, vl),
-};
-
 static const struct test avx512_bf16_all[] = {
     INSN(cvtne2ps2bf16, f2, 0f38, 72, vl, d, vl),
     INSN(cvtneps2bf16,  f3, 0f38, 72, vl, d, vl),
@@ -1110,11 +1079,6 @@ void evex_disp8_test(void *instr, struct x86_emulate_ctxt *ctxt,
     RUN(avx512dq, 128);
     RUN(avx512dq, no128);
     RUN(avx512dq, 512);
-    RUN(avx512er, 512);
-#define cpu_has_avx512pf cpu_has_avx512f
-    RUN(avx512pf, 512);
-    RUN(avx512_4fmaps, 512);
-    RUN(avx512_4vnniw, 512);
     RUN(avx512_bf16, all);
     RUN(avx512_bitalg, all);
     RUN(avx512_ifma, all);
diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index 41002909f5..2d52d21742 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -39,7 +39,6 @@ asm ( ".pushsection .test, \"ax\", @progbits; .popsection" );
 #include "avx512bw-vpclmulqdq.h"
 #include "avx512bw-gf.h"
 #include "avx512dq.h"
-#include "avx512er.h"
 #include "avx512vbmi.h"
 #include "avx512vbmi2-vpclmulqdq.h"
 #include "avx512fp16.h"
@@ -147,11 +146,6 @@ static bool simd_check_avx512dq_vl(void)
     return cpu_has_avx512dq && cpu_has_avx512vl;
 }
 
-static bool simd_check_avx512er(void)
-{
-    return cpu_has_avx512er;
-}
-
 static bool simd_check_avx512bw(void)
 {
     return cpu_has_avx512bw;
@@ -507,10 +501,6 @@ static const struct {
     AVX512VL(DQ+VL u64x2,    avx512dq,      16u8),
     AVX512VL(DQ+VL s64x4,    avx512dq,      32i8),
     AVX512VL(DQ+VL u64x4,    avx512dq,      32u8),
-    SIMD(AVX512ER f32 scalar,avx512er,        f4),
-    SIMD(AVX512ER f32x16,    avx512er,      64f4),
-    SIMD(AVX512ER f64 scalar,avx512er,        f8),
-    SIMD(AVX512ER f64x8,     avx512er,      64f8),
     SIMD(AVX512_VBMI s8x64,  avx512vbmi,    64i1),
     SIMD(AVX512_VBMI u8x64,  avx512vbmi,    64u1),
     SIMD(AVX512_VBMI s16x32, avx512vbmi,    64i2),
@@ -4983,81 +4973,6 @@ int main(int argc, char **argv)
     }
 #endif
 
-    printf("%-40s", "Testing v4fmaddps 32(%ecx),%zmm4,%zmm4{%k5}...");
-    if ( stack_exec && cpu_has_avx512_4fmaps )
-    {
-        decl_insn(v4fmaddps);
-        static const struct {
-            float f[16];
-        } in = {{
-            1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
-        }}, out = {{
-            1 + 1 * 9 + 2 * 10 + 3 * 11 + 4 * 12,
-            2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
-            16 + 16 * 9 + 17 * 10 + 18 * 11 + 19 * 12
-        }};
-
-        asm volatile ( "vmovups %1, %%zmm4\n\t"
-                       "vbroadcastss %%xmm4, %%zmm7\n\t"
-                       "vaddps %%zmm4, %%zmm7, %%zmm5\n\t"
-                       "vaddps %%zmm5, %%zmm7, %%zmm6\n\t"
-                       "vaddps %%zmm6, %%zmm7, %%zmm7\n\t"
-                       "kmovw %2, %%k5\n"
-                       put_insn(v4fmaddps,
-                                "v4fmaddps 32(%0), %%zmm4, %%zmm4%{%%k5%}")
-                       :: "c" (NULL), "m" (in), "rmk" (0x8001) );
-
-        set_insn(v4fmaddps);
-        regs.ecx = (unsigned long)&in;
-        rc = x86_emulate(&ctxt, &emulops);
-        if ( rc != X86EMUL_OKAY || !check_eip(v4fmaddps) )
-            goto fail;
-
-        asm ( "vcmpeqps %1, %%zmm4, %%k0\n\t"
-              "kmovw %%k0, %0" : "=g" (rc) : "m" (out) );
-        if ( rc != 0xffff )
-            goto fail;
-        printf("okay\n");
-    }
-    else
-        printf("skipped\n");
-
-    printf("%-40s", "Testing v4fnmaddss 16(%edx),%zmm4,%zmm4{%k3}...");
-    if ( stack_exec && cpu_has_avx512_4fmaps )
-    {
-        decl_insn(v4fnmaddss);
-        static const struct {
-            float f[16];
-        } in = {{
-            1, 2, 3, 4, 5, 6, 7, 8
-        }}, out = {{
-            1 - 1 * 5 - 2 * 6 - 3 * 7 - 4 * 8, 2, 3, 4
-        }};
-
-        asm volatile ( "vmovups %1, %%xmm4\n\t"
-                       "vaddss %%xmm4, %%xmm4, %%xmm5\n\t"
-                       "vaddss %%xmm5, %%xmm4, %%xmm6\n\t"
-                       "vaddss %%xmm6, %%xmm4, %%xmm7\n\t"
-                       "kmovw %2, %%k3\n"
-                       put_insn(v4fnmaddss,
-                                "v4fnmaddss 16(%0), %%xmm4, %%xmm4%{%%k3%}")
-                       :: "d" (NULL), "m" (in), "rmk" (1) );
-
-        set_insn(v4fnmaddss);
-        regs.edx = (unsigned long)&in;
-        rc = x86_emulate(&ctxt, &emulops);
-        if ( rc != X86EMUL_OKAY || !check_eip(v4fnmaddss) )
-            goto fail;
-
-        asm ( "vcmpeqps %1, %%zmm4, %%k0\n\t"
-              "kmovw %%k0, %0" : "=g" (rc) : "m" (out) );
-        if ( rc != 0xffff )
-            goto fail;
-        printf("okay\n");
-    }
-    else
-        printf("skipped\n");
-
     if ( stack_exec && cpu_has_avx512_bf16 )
     {
         decl_insn(vcvtne2ps2bf16);
diff --git a/tools/tests/x86_emulator/x86-emulate.c b/tools/tests/x86_emulator/x86-emulate.c
index d3baaef1d0..70ce15be50 100644
--- a/tools/tests/x86_emulator/x86-emulate.c
+++ b/tools/tests/x86_emulator/x86-emulate.c
@@ -84,7 +84,6 @@ bool emul_test_init(void)
     cp.basic.movbe = true;
     cp.feat.invpcid = true;
     cp.feat.adx = true;
-    cp.feat.avx512pf = cp.feat.avx512f;
     cp.feat.rdpid = true;
     cp.feat.wrmsrns = true;
     cp.extd.clzero = true;
diff --git a/tools/tests/x86_emulator/x86-emulate.h b/tools/tests/x86_emulator/x86-emulate.h
index 8f8accfe3e..d2012ab767 100644
--- a/tools/tests/x86_emulator/x86-emulate.h
+++ b/tools/tests/x86_emulator/x86-emulate.h
@@ -156,7 +156,6 @@ void wrpkru(unsigned int val);
 #define cpu_has_avx512f   (cp.feat.avx512f  && xcr0_mask(0xe6))
 #define cpu_has_avx512dq  (cp.feat.avx512dq && xcr0_mask(0xe6))
 #define cpu_has_avx512_ifma (cp.feat.avx512_ifma && xcr0_mask(0xe6))
-#define cpu_has_avx512er  (cp.feat.avx512er && xcr0_mask(0xe6))
 #define cpu_has_avx512cd  (cp.feat.avx512cd && xcr0_mask(0xe6))
 #define cpu_has_sha        cp.feat.sha
 #define cpu_has_avx512bw  (cp.feat.avx512bw && xcr0_mask(0xe6))
@@ -171,8 +170,6 @@ void wrpkru(unsigned int val);
 #define cpu_has_avx512_vpopcntdq (cp.feat.avx512_vpopcntdq && xcr0_mask(0xe6))
 #define cpu_has_movdiri    cp.feat.movdiri
 #define cpu_has_movdir64b  cp.feat.movdir64b
-#define cpu_has_avx512_4vnniw (cp.feat.avx512_4vnniw && xcr0_mask(0xe6))
-#define cpu_has_avx512_4fmaps (cp.feat.avx512_4fmaps && xcr0_mask(0xe6))
 #define cpu_has_avx512_vp2intersect (cp.feat.avx512_vp2intersect && xcr0_mask(0xe6))
 #define cpu_has_serialize  cp.feat.serialize
 #define cpu_has_avx512_fp16 (cp.feat.avx512_fp16 && xcr0_mask(0xe6))
diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 57ac984790..f175e4d7d3 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -73,7 +73,6 @@
 #define GET_CC3_RES(val)  GET_HW_RES_IN_NS(0x3FC, val)
 #define GET_CC6_RES(val)  GET_HW_RES_IN_NS(0x3FD, val)
 #define GET_CC7_RES(val)  GET_HW_RES_IN_NS(0x3FE, val) /* SNB onwards */
-#define PHI_CC6_RES(val)  GET_HW_RES_IN_NS(0x3FF, val) /* Xeon Phi only */
 
 static void cf_check lapic_timer_nop(void) { }
 void (*__read_mostly lapic_timer_off)(void);
@@ -222,18 +221,6 @@ static void cf_check do_get_hw_residencies(void *arg)
         GET_CC6_RES(hw_res->cc6);
         GET_CC7_RES(hw_res->cc7);
         break;
-    /* Xeon Phi Knights Landing */
-    case 0x57:
-    /* Xeon Phi Knights Mill */
-    case 0x85:
-        GET_CC3_RES(hw_res->mc0); /* abusing GET_CC3_RES */
-        GET_CC6_RES(hw_res->mc6); /* abusing GET_CC6_RES */
-        GET_PC2_RES(hw_res->pc2);
-        GET_PC3_RES(hw_res->pc3);
-        GET_PC6_RES(hw_res->pc6);
-        GET_PC7_RES(hw_res->pc7);
-        PHI_CC6_RES(hw_res->cc6);
-        break;
     /* various Atoms */
     case 0x27:
         GET_PC3_RES(hw_res->pc2); /* abusing GET_PC3_RES */
diff --git a/xen/arch/x86/cpu/mcheck/mce_intel.c b/xen/arch/x86/cpu/mcheck/mce_intel.c
index 9574dedbfd..07b50f8793 100644
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c
@@ -875,10 +875,8 @@ static void intel_init_ppin(const struct cpuinfo_x86 *c)
     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 */
 
         if ( (c != &boot_cpu_data && !ppin_msr) ||
diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index ae69871171..9c16cc166a 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -778,22 +778,6 @@ static const struct cpuidle_state avn_cstates[] = {
 	{}
 };
 
-static const struct cpuidle_state knl_cstates[] = {
-	{
-		.name = "C1",
-		.flags = MWAIT2flg(0x00),
-		.exit_latency = 1,
-		.target_residency = 2,
-	},
-	{
-		.name = "C6",
-		.flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED,
-		.exit_latency = 120,
-		.target_residency = 500,
-	},
-	{}
-};
-
 static struct cpuidle_state __read_mostly bxt_cstates[] = {
 	{
 		.name = "C1",
@@ -1121,10 +1105,6 @@ static const struct idle_cpu idle_cpu_avn = {
 	.c1e_promotion = C1E_PROMOTION_DISABLE,
 };
 
-static const struct idle_cpu idle_cpu_knl = {
-	.state_table = knl_cstates,
-};
-
 static const struct idle_cpu idle_cpu_bxt = {
 	.state_table = bxt_cstates,
 	.c1e_promotion = C1E_PROMOTION_DISABLE,
@@ -1181,8 +1161,6 @@ static const struct x86_cpu_id intel_idle_ids[] __initconstrel = {
 	ICPU(ALDERLAKE,			adl),
 	ICPU(ALDERLAKE_L,		adl_l),
 	ICPU(SAPPHIRERAPIDS_X,		spr),
-	ICPU(XEON_PHI_KNL,		knl),
-	ICPU(XEON_PHI_KNM,		knl),
 	ICPU(ATOM_GOLDMONT,		bxt),
 	ICPU(ATOM_GOLDMONT_PLUS,	bxt),
 	ICPU(ATOM_GOLDMONT_D,		dnv),
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 46911c3e1c..2f7add834a 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -533,10 +533,6 @@ static const struct lbr_info *__init get_model_specific_lbr(void)
             return at_lbr;
         /* Silvermont */
         case 0x37: case 0x4a: case 0x4d: case 0x5a: case 0x5d:
-        /* Xeon Phi Knights Landing */
-        case 0x57:
-        /* Xeon Phi Knights Mill */
-        case 0x85:
         /* Airmont */
         case 0x4c:
             return sm_lbr;
@@ -2985,13 +2981,6 @@ static bool __init has_if_pschange_mc(void)
     case 0x7a: /* Gemini Lake */
     case 0x86: /* Jacobsville */
 
-        /*
-         * Knights processors are not vulnerable.
-         */
-    case 0x57: /* Knights Landing */
-    case 0x85: /* Knights Mill */
-        return false;
-
     default:
         printk("Unrecognised CPU model %#x - assuming vulnerable to IF_PSCHANGE_MC\n",
                boot_cpu_data.x86_model);
diff --git a/xen/arch/x86/include/asm/cpufeature.h b/xen/arch/x86/include/asm/cpufeature.h
index 9bc553681f..dad9ed68aa 100644
--- a/xen/arch/x86/include/asm/cpufeature.h
+++ b/xen/arch/x86/include/asm/cpufeature.h
@@ -140,7 +140,6 @@ static inline bool boot_cpu_has(unsigned int feat)
 #define cpu_has_avx512_ifma     boot_cpu_has(X86_FEATURE_AVX512_IFMA)
 #define cpu_has_clflushopt      boot_cpu_has(X86_FEATURE_CLFLUSHOPT)
 #define cpu_has_clwb            boot_cpu_has(X86_FEATURE_CLWB)
-#define cpu_has_avx512er        boot_cpu_has(X86_FEATURE_AVX512ER)
 #define cpu_has_avx512cd        boot_cpu_has(X86_FEATURE_AVX512CD)
 #define cpu_has_proc_trace      boot_cpu_has(X86_FEATURE_PROC_TRACE)
 #define cpu_has_sha             boot_cpu_has(X86_FEATURE_SHA)
@@ -174,8 +173,6 @@ static inline bool boot_cpu_has(unsigned int feat)
 #define cpu_has_auto_ibrs       boot_cpu_has(X86_FEATURE_AUTO_IBRS)
 
 /* CPUID level 0x00000007:0.edx */
-#define cpu_has_avx512_4vnniw   boot_cpu_has(X86_FEATURE_AVX512_4VNNIW)
-#define cpu_has_avx512_4fmaps   boot_cpu_has(X86_FEATURE_AVX512_4FMAPS)
 #define cpu_has_avx512_vp2intersect boot_cpu_has(X86_FEATURE_AVX512_VP2INTERSECT)
 #define cpu_has_srbds_ctrl      boot_cpu_has(X86_FEATURE_SRBDS_CTRL)
 #define cpu_has_md_clear        boot_cpu_has(X86_FEATURE_MD_CLEAR)
diff --git a/xen/arch/x86/include/asm/intel-family.h b/xen/arch/x86/include/asm/intel-family.h
index b65e9c46b9..d44dd3f69f 100644
--- a/xen/arch/x86/include/asm/intel-family.h
+++ b/xen/arch/x86/include/asm/intel-family.h
@@ -13,8 +13,8 @@
  *	INTEL_FAM6{OPTFAMILY}_{MICROARCH}{OPTDIFF}
  * where:
  * OPTFAMILY	Describes the family of CPUs that this belongs to. Default
- *		is assumed to be "_CORE" (and should be omitted). Other values
- *		currently in use are _ATOM and _XEON_PHI
+ *		is assumed to be "_CORE" (and should be omitted). The other
+ *		value currently in use is _ATOM.
  * MICROARCH	Is the code name for the micro-architecture for this core.
  *		N.B. Not the platform name.
  * OPTDIFF	If needed, a short string to differentiate by market segment.
@@ -164,11 +164,6 @@
 
 #define INTEL_FAM6_ATOM_DARKMONT_X	0xDD /* Clearwater Forest */
 
-/* Xeon Phi */
-
-#define INTEL_FAM6_XEON_PHI_KNL		0x57 /* Knights Landing */
-#define INTEL_FAM6_XEON_PHI_KNM		0x85 /* Knights Mill */
-
 /* Family 5 */
 #define INTEL_FAM5_QUARK_X1000		0x09 /* Quark X1000 SoC */
 
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 6b3631e375..92405b8be7 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -889,11 +889,9 @@ static bool __init retpoline_calculations(void)
     case 0x4d: /* Avaton / Rangely (Silvermont) */
     case 0x4c: /* Cherrytrail / Brasswell */
     case 0x4a: /* Merrifield */
-    case 0x57: /* Knights Landing */
     case 0x5a: /* Moorefield */
     case 0x5c: /* Goldmont */
     case 0x5f: /* Denverton */
-    case 0x85: /* Knights Mill */
         safe = true;
         break;
 
@@ -1007,13 +1005,6 @@ static bool __init should_use_eager_fpu(void)
     case 0x7a: /* Gemini Lake */
         return false;
 
-        /*
-         * Knights processors are not vulnerable.
-         */
-    case 0x57: /* Knights Landing */
-    case 0x85: /* Knights Mill */
-        return false;
-
     default:
         printk("Unrecognised CPU model %#x - assuming vulnerable to LazyFPU\n",
                boot_cpu_data.x86_model);
@@ -1261,13 +1252,6 @@ static __init void l1tf_calculations(void)
         case 0x7a: /* Gemini Lake */
             break;
 
-            /*
-             * Knights processors are not vulnerable.
-             */
-        case 0x57: /* Knights Landing */
-        case 0x85: /* Knights Mill */
-            break;
-
         default:
             /* Defer printk() until we've accounted for RDCL_NO. */
             hit_default = true;
@@ -1418,13 +1402,6 @@ static __init void mds_calculations(void)
     case 0x65: /* SoFIA LTE AOSP */
     case 0x6e: /* Cougar Mountain */
     case 0x75: /* Lightning Mountain */
-        /*
-         * Knights processors (which are based on the Silvermont/Airmont
-         * microarchitecture) are similarly only affected by the Store Buffer
-         * aspect.
-         */
-    case 0x57: /* Knights Landing */
-    case 0x85: /* Knights Mill */
         cpu_has_bug_msbds_only = true;
         break;
 
diff --git a/xen/arch/x86/x86_emulate/private.h b/xen/arch/x86/x86_emulate/private.h
index 0fa26ba00a..a2faa8b29b 100644
--- a/xen/arch/x86/x86_emulate/private.h
+++ b/xen/arch/x86/x86_emulate/private.h
@@ -564,8 +564,6 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 #define vcpu_has_avx512_ifma() (ctxt->cpuid->feat.avx512_ifma)
 #define vcpu_has_clflushopt()  (ctxt->cpuid->feat.clflushopt)
 #define vcpu_has_clwb()        (ctxt->cpuid->feat.clwb)
-#define vcpu_has_avx512pf()    (ctxt->cpuid->feat.avx512pf)
-#define vcpu_has_avx512er()    (ctxt->cpuid->feat.avx512er)
 #define vcpu_has_avx512cd()    (ctxt->cpuid->feat.avx512cd)
 #define vcpu_has_sha()         (ctxt->cpuid->feat.sha)
 #define vcpu_has_avx512bw()    (ctxt->cpuid->feat.avx512bw)
@@ -582,8 +580,6 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 #define vcpu_has_movdiri()     (ctxt->cpuid->feat.movdiri)
 #define vcpu_has_movdir64b()   (ctxt->cpuid->feat.movdir64b)
 #define vcpu_has_enqcmd()      (ctxt->cpuid->feat.enqcmd)
-#define vcpu_has_avx512_4vnniw() (ctxt->cpuid->feat.avx512_4vnniw)
-#define vcpu_has_avx512_4fmaps() (ctxt->cpuid->feat.avx512_4fmaps)
 #define vcpu_has_avx512_vp2intersect() (ctxt->cpuid->feat.avx512_vp2intersect)
 #define vcpu_has_serialize()   (ctxt->cpuid->feat.serialize)
 #define vcpu_has_tsxldtrk()    (ctxt->cpuid->feat.tsxldtrk)
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 2d5c1de8ec..bf388b7b1e 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6029,7 +6029,6 @@ x86_emulate(
     case X86EMUL_OPC_EVEX_66(0x0f38, 0xbd): /* vfnmadd231s{s,d} xmm/mem,xmm,xmm{k} */
     case X86EMUL_OPC_EVEX_66(0x0f38, 0xbf): /* vfnmsub231s{s,d} xmm/mem,xmm,xmm{k} */
         host_and_vcpu_must_have(avx512f);
-    simd_zmm_scalar_sae:
         generate_exception_if(ea.type != OP_REG && evex.brs, X86_EXC_UD);
         if ( !evex.brs )
             avx512_vlen_check(true);
@@ -6123,15 +6122,6 @@ x86_emulate(
         avx512_vlen_check(true);
         goto simd_zmm;
 
-    case X86EMUL_OPC_EVEX_F2(0x0f38, 0x52): /* vp4dpwssd m128,zmm+3,zmm{k} */
-    case X86EMUL_OPC_EVEX_F2(0x0f38, 0x53): /* vp4dpwssds m128,zmm+3,zmm{k} */
-        host_and_vcpu_must_have(avx512_4vnniw);
-        generate_exception_if((ea.type != OP_MEM || evex.w || evex.brs ||
-                               evex.lr != 2),
-                              X86_EXC_UD);
-        op_mask = op_mask & 0xffff ? 0xf : 0;
-        goto simd_zmm;
-
     case X86EMUL_OPC_EVEX_66(0x0f38, 0x8f): /* vpshufbitqmb [xyz]mm/mem,[xyz]mm,k{k} */
         generate_exception_if(evex.w || !evex.r || !evex.R || evex.z, X86_EXC_UD);
         /* fall through */
@@ -6601,24 +6591,6 @@ x86_emulate(
         host_and_vcpu_must_have(fma);
         goto simd_0f_ymm;
 
-    case X86EMUL_OPC_EVEX_F2(0x0f38, 0x9a): /* v4fmaddps m128,zmm+3,zmm{k} */
-    case X86EMUL_OPC_EVEX_F2(0x0f38, 0xaa): /* v4fnmaddps m128,zmm+3,zmm{k} */
-        host_and_vcpu_must_have(avx512_4fmaps);
-        generate_exception_if((ea.type != OP_MEM || evex.w || evex.brs ||
-                               evex.lr != 2),
-                              X86_EXC_UD);
-        op_mask = op_mask & 0xffff ? 0xf : 0;
-        goto simd_zmm;
-
-    case X86EMUL_OPC_EVEX_F2(0x0f38, 0x9b): /* v4fmaddss m128,xmm+3,xmm{k} */
-    case X86EMUL_OPC_EVEX_F2(0x0f38, 0xab): /* v4fnmaddss m128,xmm+3,xmm{k} */
-        host_and_vcpu_must_have(avx512_4fmaps);
-        generate_exception_if((ea.type != OP_MEM || evex.w || evex.brs ||
-                               evex.lr == 3),
-                              X86_EXC_UD);
-        op_mask = op_mask & 1 ? 0xf : 0;
-        goto simd_zmm;
-
     case X86EMUL_OPC_EVEX_66(0x0f38, 0xa0): /* vpscatterd{d,q} [xyz]mm,mem{k} */
     case X86EMUL_OPC_EVEX_66(0x0f38, 0xa1): /* vpscatterq{d,q} [xyz]mm,mem{k} */
     case X86EMUL_OPC_EVEX_66(0x0f38, 0xa2): /* vscatterdp{s,d} [xyz]mm,mem{k} */
@@ -6759,97 +6731,6 @@ x86_emulate(
         generate_exception_if(!evex.w, X86_EXC_UD);
         goto avx512f_no_sae;
 
-    case X86EMUL_OPC_EVEX_66(0x0f38, 0xc6):
-    case X86EMUL_OPC_EVEX_66(0x0f38, 0xc7):
-    {
-#ifndef __XEN__
-        typeof(evex) *pevex;
-        union {
-            int32_t dw[16];
-            int64_t qw[8];
-        } index;
-#endif
-
-        ASSERT(ea.type == OP_MEM);
-        generate_exception_if((!cpu_has_avx512f || !evex.opmsk || evex.brs ||
-                               evex.z || evex.reg != 0xf || evex.lr != 2),
-                              X86_EXC_UD);
-
-        switch ( modrm_reg & 7 )
-        {
-        case 1: /* vgatherpf0{d,q}p{s,d} mem{k} */
-        case 2: /* vgatherpf1{d,q}p{s,d} mem{k} */
-        case 5: /* vscatterpf0{d,q}p{s,d} mem{k} */
-        case 6: /* vscatterpf1{d,q}p{s,d} mem{k} */
-            vcpu_must_have(avx512pf);
-            break;
-        default:
-            generate_exception(X86_EXC_UD);
-        }
-
-        get_fpu(X86EMUL_FPU_zmm);
-
-#ifndef __XEN__
-        /*
-         * For the test harness perform zero byte memory accesses, such that
-         * in particular correct Disp8 scaling can be verified.
-         */
-        fail_if((modrm_reg & 4) && !ops->write);
-
-        /* Read index register. */
-        opc = init_evex(stub);
-        pevex = copy_EVEX(opc, evex);
-        pevex->opcx = vex_0f;
-        /* vmovdqu{32,64} */
-        opc[0] = 0x7f;
-        pevex->pfx = vex_f3;
-        pevex->w = b & 1;
-        /* Use (%rax) as destination and sib_index as source. */
-        pevex->b = 1;
-        opc[1] = (state->sib_index & 7) << 3;
-        pevex->r = !mode_64bit() || !(state->sib_index & 0x08);
-        pevex->R = !mode_64bit() || !(state->sib_index & 0x10);
-        pevex->RX = 1;
-        opc[2] = 0xc3;
-
-        invoke_stub("", "", "=m" (index) : "a" (&index));
-        put_stub(stub);
-
-        /* Clear untouched parts of the mask value. */
-        n = 1 << (4 - ((b & 1) | evex.w));
-        op_mask &= (1 << n) - 1;
-
-        for ( i = 0; rc == X86EMUL_OKAY && op_mask; ++i )
-        {
-            long idx = b & 1 ? index.qw[i] : index.dw[i];
-
-            if ( !(op_mask & (1 << i)) )
-                continue;
-
-            rc = (modrm_reg & 4
-                  ? ops->write
-                  : ops->read)(ea.mem.seg,
-                               truncate_ea(ea.mem.off +
-                                           idx * (1 << state->sib_scale)),
-                               NULL, 0, ctxt);
-            if ( rc == X86EMUL_EXCEPTION )
-            {
-                /* Squash memory access related exceptions. */
-                x86_emul_reset_event(ctxt);
-                rc = X86EMUL_OKAY;
-            }
-
-            op_mask &= ~(1 << i);
-        }
-
-        if ( rc != X86EMUL_OKAY )
-            goto done;
-#endif
-
-        state->simd_size = simd_none;
-        break;
-    }
-
     case X86EMUL_OPC(0x0f38, 0xc8):     /* sha1nexte xmm/m128,xmm */
     case X86EMUL_OPC(0x0f38, 0xc9):     /* sha1msg1 xmm/m128,xmm */
     case X86EMUL_OPC(0x0f38, 0xca):     /* sha1msg2 xmm/m128,xmm */
@@ -6860,19 +6741,6 @@ x86_emulate(
         op_bytes = 16;
         goto simd_0f38_common;
 
-    case X86EMUL_OPC_EVEX_66(0x0f38, 0xc8): /* vexp2p{s,d} zmm/mem,zmm{k} */
-    case X86EMUL_OPC_EVEX_66(0x0f38, 0xca): /* vrcp28p{s,d} zmm/mem,zmm{k} */
-    case X86EMUL_OPC_EVEX_66(0x0f38, 0xcc): /* vrsqrt28p{s,d} zmm/mem,zmm{k} */
-        host_and_vcpu_must_have(avx512er);
-        generate_exception_if((ea.type != OP_REG || !evex.brs) && evex.lr != 2,
-                              X86_EXC_UD);
-        goto simd_zmm;
-
-    case X86EMUL_OPC_EVEX_66(0x0f38, 0xcb): /* vrcp28s{s,d} xmm/mem,xmm,xmm{k} */
-    case X86EMUL_OPC_EVEX_66(0x0f38, 0xcd): /* vrsqrt28s{s,d} xmm/mem,xmm,xmm{k} */
-        host_and_vcpu_must_have(avx512er);
-        goto simd_zmm_scalar_sae;
-
     case X86EMUL_OPC_VEX_F2(0x0f38, 0xcb): /* vsha512rnds2 xmm,ymm,ymm */
     case X86EMUL_OPC_VEX_F2(0x0f38, 0xcc): /* vsha512msg1 xmm,ymm */
     case X86EMUL_OPC_VEX_F2(0x0f38, 0xcd): /* vsha512msg2 ymm,ymm */
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 3962ba9342..abab78fa86 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -208,8 +208,8 @@ XEN_CPUFEATURE(AVX512_IFMA,   5*32+21) /*A  AVX-512 Integer Fused Multiply Add *
 XEN_CPUFEATURE(CLFLUSHOPT,    5*32+23) /*A  CLFLUSHOPT instruction */
 XEN_CPUFEATURE(CLWB,          5*32+24) /*!A CLWB instruction */
 XEN_CPUFEATURE(PROC_TRACE,    5*32+25) /*   Processor Trace */
-XEN_CPUFEATURE(AVX512PF,      5*32+26) /*A  AVX-512 Prefetch Instructions */
-XEN_CPUFEATURE(AVX512ER,      5*32+27) /*A  AVX-512 Exponent & Reciprocal Instrs */
+XEN_CPUFEATURE(AVX512PF,      5*32+26) /*   Xeon Phi AVX-512 Prefetch Instructions */
+XEN_CPUFEATURE(AVX512ER,      5*32+27) /*   Xeon Phi AVX-512 Exponent & Reciprocal Instrs */
 XEN_CPUFEATURE(AVX512CD,      5*32+28) /*A  AVX-512 Conflict Detection Instrs */
 XEN_CPUFEATURE(SHA,           5*32+29) /*A  SHA1 & SHA256 instructions */
 XEN_CPUFEATURE(AVX512BW,      5*32+30) /*A  AVX-512 Byte and Word Instructions */
@@ -264,8 +264,8 @@ XEN_CPUFEATURE(BTC_NO,        8*32+29) /*A  Hardware not vulnerable to Branch Ty
 XEN_CPUFEATURE(IBPB_RET,      8*32+30) /*A  IBPB clears RSB/RAS too. */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:0.edx, word 9 */
-XEN_CPUFEATURE(AVX512_4VNNIW, 9*32+ 2) /*A  AVX512 Neural Network Instructions */
-XEN_CPUFEATURE(AVX512_4FMAPS, 9*32+ 3) /*A  AVX512 Multiply Accumulation Single Precision */
+XEN_CPUFEATURE(AVX512_4VNNIW, 9*32+ 2) /*   Xeon Phi AVX512 Neural Network Instructions */
+XEN_CPUFEATURE(AVX512_4FMAPS, 9*32+ 3) /*   Xeon Phi AVX512 Multiply Accumulation Single Precision */
 XEN_CPUFEATURE(FSRM,          9*32+ 4) /*A  Fast Short REP MOVS */
 XEN_CPUFEATURE(UINTR,         9*32+ 5) /*   User-mode Interrupts */
 XEN_CPUFEATURE(AVX512_VP2INTERSECT, 9*32+8) /*a  VP2INTERSECT{D,Q} insns */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 06:55:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 06:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770213.1181157 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZmCC-00060C-3K; Fri, 02 Aug 2024 06:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770213.1181157; Fri, 02 Aug 2024 06: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 1sZmCC-000605-0s; Fri, 02 Aug 2024 06:55:24 +0000
Received: by outflank-mailman (input) for mailman id 770213;
 Fri, 02 Aug 2024 06:55:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZmCB-0005zx-MI
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 06:55:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZmCB-0006Yy-L5
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 06:55:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZmCB-0000jt-IT
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 06:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uG+YEtHP43YpQx9LanQmz45ZpWkwci8qiGTu8cGHqjk=; b=lGsybrgqZe0yGaWfKBF+BpQtvw
	g2pGpegMiLcSf8RtQBXkV5zPPj4gf3gNQl/PcCCYZIG7OPmeZ97Le2cbyE4zITu1v3JeynYZ/NSqM
	/RLtQ+LB94+AXwd+Q3GlEMMx+fD4CBO6zrBW0NnZFyLEPGiPTaPc7s4YjkFckKcprHls=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/lsevtchn: Use errno macro to handle hypercall error cases
Message-Id: <E1sZmCB-0000jt-IT@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 06:55:23 +0000

commit e92a453c8db8bba62d6be3006079e2b9990c3978
Author:     Matthew Barnes <matthew.barnes@cloud.com>
AuthorDate: Fri Aug 2 08:43:57 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 2 08:43:57 2024 +0200

    tools/lsevtchn: Use errno macro to handle hypercall error cases
    
    Currently, lsevtchn aborts its event channel enumeration when it hits
    an event channel that is owned by Xen.
    
    lsevtchn does not distinguish between different hypercall errors, which
    results in lsevtchn missing potential relevant event channels with
    higher port numbers.
    
    Use the errno macro to distinguish between hypercall errors, and
    continue event channel enumeration if the hypercall error is not
    critical to enumeration.
    
    Signed-off-by: Matthew Barnes <matthew.barnes@cloud.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xcutils/lsevtchn.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/tools/xcutils/lsevtchn.c b/tools/xcutils/lsevtchn.c
index d1710613dd..30c8d847b8 100644
--- a/tools/xcutils/lsevtchn.c
+++ b/tools/xcutils/lsevtchn.c
@@ -3,6 +3,7 @@
 #include <stdint.h>
 #include <string.h>
 #include <stdio.h>
+#include <errno.h>
 
 #include <xenctrl.h>
 
@@ -24,7 +25,23 @@ int main(int argc, char **argv)
         status.port = port;
         rc = xc_evtchn_status(xch, &status);
         if ( rc < 0 )
-            break;
+        {
+            switch ( errno )
+            {
+            case EACCES: /* Xen-owned evtchn */
+                continue;
+
+            case EINVAL: /* Port enumeration has ended */
+                rc = 0;
+                break;
+
+            default:
+                perror("xc_evtchn_status");
+                rc = 1;
+                break;
+            }
+            goto out;
+        }
 
         if ( status.status == EVTCHNSTAT_closed )
             continue;
@@ -58,7 +75,8 @@ int main(int argc, char **argv)
         printf("\n");
     }
 
+ out:
     xc_interface_close(xch);
 
-    return 0;
+    return rc;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 06:55:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 06:55:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.770214.1181162 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZmCN-00063S-5L; Fri, 02 Aug 2024 06:55:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 770214.1181162; Fri, 02 Aug 2024 06:55: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 1sZmCN-00063K-2M; Fri, 02 Aug 2024 06:55:35 +0000
Received: by outflank-mailman (input) for mailman id 770214;
 Fri, 02 Aug 2024 06:55:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZmCL-00063A-R4
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 06:55:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZmCL-0006Z5-QG
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 06:55:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZmCL-0000kW-NF
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 06: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lwmCpzsNYvlCrVBl6sXqKgQzjVQMof+CARiwqobFJOM=; b=4YB+teb+2E+/JzJr/pjLpNXOAp
	H7tmkY+tjbo0SbaXK9vzA1zeSqovAV5sJI637AanQU+FSDikNamftt4iRquGrS1DpLXH8Ls/UWRA+
	BvolbZFUBIwbszHuu0OtmEwpAkKZ/Qbnv0PpmDC/1hfBCYSYxeIWggBVbB9+CGbpLV98=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] 9pfsd: fix release build with old gcc
Message-Id: <E1sZmCL-0000kW-NF@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 06:55:33 +0000

commit 984cb316cb27b53704c607e640a7dd2763b898ab
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Aug 2 08:44:22 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 2 08:44:22 2024 +0200

    9pfsd: fix release build with old gcc
    
    Being able to recognize that "par" is reliably initialized on the 1st
    loop iteration requires not overly old compilers.
    
    Fixes: 7809132b1a1d ("tools/xen-9pfsd: add 9pfs response generation support")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/9pfsd/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/9pfsd/io.c b/tools/9pfsd/io.c
index df1be3df7d..468e0241f5 100644
--- a/tools/9pfsd/io.c
+++ b/tools/9pfsd/io.c
@@ -196,7 +196,7 @@ static void fill_buffer_at(void **data, const char *fmt, ...);
 static void vfill_buffer_at(void **data, const char *fmt, va_list ap)
 {
     const char *f;
-    const void *par;
+    const void *par = NULL; /* old gcc */
     const char *str_val;
     const struct p9_qid *qid;
     const struct p9_stat *stat;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 16:55:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 16:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771287.1181845 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZvYU-0007rc-Sf; Fri, 02 Aug 2024 16:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771287.1181845; Fri, 02 Aug 2024 16: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 1sZvYU-0007rS-Pv; Fri, 02 Aug 2024 16:55:02 +0000
Received: by outflank-mailman (input) for mailman id 771287;
 Fri, 02 Aug 2024 16:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvYT-0007rM-Uo
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvYT-00022o-Tx
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvYT-0004zk-Rq
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FqLiF9OWXrmsXG4YMCFw3M3/RdF6bqv8XGt943fOYzw=; b=HSQFeOZLuczDzXtKHFhbbcb/QO
	MjzNuOa5cV4nnfZdrW+bApeipu2VnmBNu/WTEF5Q9kRwCSmX2GwkOKZ7Y9+ARWe4tNqrfm9S1wRUy
	n02/1/Ut0MfQV9TeSXURV6Rw+LOxvd2min+gkMVttco2zAl96s3Rdn5//L4bowmd1szk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml: Fix mixed tabs/spaces
Message-Id: <E1sZvYT-0004zk-Rq@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 16:55:01 +0000

commit 8d5507beeb717f6f91c3970a03993b354ff4c40b
Author:     Petr Beneš <w1benny@gmail.com>
AuthorDate: Thu Aug 1 09:36:54 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 09:36:54 2024 +0200

    tools/ocaml: Fix mixed tabs/spaces
    
    No functional change.
    
    Signed-off-by: Petr Beneš <w1benny@gmail.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index c6da9bb091..e86c455802 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -138,12 +138,12 @@ static void domain_handle_of_uuid_string(xen_domain_handle_t h,
  * integers in the Ocaml ABI for more idiomatic handling.
  */
 static value c_bitmap_to_ocaml_list
-             /* ! */
-             /*
+	     /* ! */
+	     /*
 	      * All calls to this function must be in a form suitable
 	      * for xenctrl_abi_check.  The parsing there is ad-hoc.
 	      */
-             (unsigned int bitmap)
+	         (unsigned int bitmap)
 {
 	CAMLparam0();
 	CAMLlocal2(list, tmp);
@@ -180,8 +180,8 @@ static value c_bitmap_to_ocaml_list
 }
 
 static unsigned int ocaml_list_to_c_bitmap(value l)
-             /* ! */
-             /*
+	     /* ! */
+	     /*
 	      * All calls to this function must be in a form suitable
 	      * for xenctrl_abi_check.  The parsing there is ad-hoc.
 	      */
@@ -259,7 +259,7 @@ CAMLprim value stub_xc_domain_create(value xch_val, value wanted_domid, value co
 		/* Quick & dirty check for ABI changes. */
 		BUILD_BUG_ON(sizeof(cfg) != 68);
 
-        /* Mnemonics for the named fields inside xen_x86_arch_domainconfig */
+		/* Mnemonics for the named fields inside xen_x86_arch_domainconfig */
 #define VAL_EMUL_FLAGS          Field(arch_domconfig, 0)
 #define VAL_MISC_FLAGS          Field(arch_domconfig, 1)
 
@@ -351,7 +351,7 @@ static value dom_op(value xch_val, value domid,
 	caml_enter_blocking_section();
 	result = fn(xch, c_domid);
 	caml_leave_blocking_section();
-        if (result)
+	if (result)
 		failwith_xc(xch);
 	CAMLreturn(Val_unit);
 }
@@ -383,7 +383,7 @@ CAMLprim value stub_xc_domain_resume_fast(value xch_val, value domid)
 	caml_enter_blocking_section();
 	result = xc_domain_resume(xch, c_domid, 1);
 	caml_leave_blocking_section();
-        if (result)
+	if (result)
 		failwith_xc(xch);
 	CAMLreturn(Val_unit);
 }
@@ -426,7 +426,7 @@ static value alloc_domaininfo(xc_domaininfo_t * info)
 	Store_field(result, 13, Val_int(info->max_vcpu_id));
 	Store_field(result, 14, caml_copy_int32(info->ssidref));
 
-        tmp = caml_alloc_small(16, 0);
+	tmp = caml_alloc_small(16, 0);
 	for (i = 0; i < 16; i++) {
 		Field(tmp, i) = Val_int(info->handle[i]);
 	}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 16:55:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 16:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771288.1181850 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZvYe-0007tP-Tv; Fri, 02 Aug 2024 16:55:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771288.1181850; Fri, 02 Aug 2024 16:55:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZvYe-0007tI-RS; Fri, 02 Aug 2024 16:55:12 +0000
Received: by outflank-mailman (input) for mailman id 771288;
 Fri, 02 Aug 2024 16:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvYe-0007tA-4g
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvYe-00023B-25
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvYd-00050t-WF
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2u63grjrkDJnaWJA1gjF7ZgtdBt6bkLueMxwSeF9Wsk=; b=dALn6VrycQXx3hX/SToZrZjMQa
	04eolJYnV6iyewFF7qbO5OEQQMoflws5rK1pVs6fmoDj0DrnYxPubRy+OTpmnVnSl9aLZ54RPU9IL
	scZrPzlhkOWAOJYR+1vqH6WOMKMtZGVKEhyTAppGSVDWncORC9l6ddR2EJN+vIUYWbuM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml: Add missing ocaml bindings for altp2m_opts
Message-Id: <E1sZvYd-00050t-WF@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 16:55:11 +0000

commit fb45a35ad7832ea606fa741e10bacd5691b1dd65
Author:     Petr Beneš <w1benny@gmail.com>
AuthorDate: Thu Aug 1 09:37:32 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 09:37:32 2024 +0200

    tools/ocaml: Add missing ocaml bindings for altp2m_opts
    
    Fixes: 0291089f6ea8 ("xen: enable altp2m at create domain domctl")
    Signed-off-by: Petr Beneš <w1benny@gmail.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
---
 tools/ocaml/libs/xc/xenctrl.ml      | 1 +
 tools/ocaml/libs/xc/xenctrl.mli     | 1 +
 tools/ocaml/libs/xc/xenctrl_stubs.c | 9 ++++++---
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml
index 55923857ec..2690f9a923 100644
--- a/tools/ocaml/libs/xc/xenctrl.ml
+++ b/tools/ocaml/libs/xc/xenctrl.ml
@@ -85,6 +85,7 @@ type domctl_create_config =
     max_grant_frames: int;
     max_maptrack_frames: int;
     max_grant_version: int;
+    altp2m_opts: int32;
     vmtrace_buf_kb: int32;
     cpupool_id: int32;
     arch: arch_domainconfig;
diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.mli
index 9b4b45db3a..febbe1f6ae 100644
--- a/tools/ocaml/libs/xc/xenctrl.mli
+++ b/tools/ocaml/libs/xc/xenctrl.mli
@@ -77,6 +77,7 @@ type domctl_create_config = {
   max_grant_frames: int;
   max_maptrack_frames: int;
   max_grant_version: int;
+  altp2m_opts: int32;
   vmtrace_buf_kb: int32;
   cpupool_id: int32;
   arch: arch_domainconfig;
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index e86c455802..a529080129 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -210,9 +210,10 @@ CAMLprim value stub_xc_domain_create(value xch_val, value wanted_domid, value co
 #define VAL_MAX_GRANT_FRAMES    Field(config, 6)
 #define VAL_MAX_MAPTRACK_FRAMES Field(config, 7)
 #define VAL_MAX_GRANT_VERSION   Field(config, 8)
-#define VAL_VMTRACE_BUF_KB      Field(config, 9)
-#define VAL_CPUPOOL_ID          Field(config, 10)
-#define VAL_ARCH                Field(config, 11)
+#define VAL_ALTP2M_OPTS         Field(config, 9)
+#define VAL_VMTRACE_BUF_KB      Field(config, 10)
+#define VAL_CPUPOOL_ID          Field(config, 11)
+#define VAL_ARCH                Field(config, 12)
 
 	uint32_t domid = Int_val(wanted_domid);
 	uint64_t vmtrace_size = Int32_val(VAL_VMTRACE_BUF_KB);
@@ -230,6 +231,7 @@ CAMLprim value stub_xc_domain_create(value xch_val, value wanted_domid, value co
 		.max_maptrack_frames = Int_val(VAL_MAX_MAPTRACK_FRAMES),
 		.grant_opts =
 		    XEN_DOMCTL_GRANT_version(Int_val(VAL_MAX_GRANT_VERSION)),
+		.altp2m_opts = Int32_val(VAL_ALTP2M_OPTS),
 		.vmtrace_size = vmtrace_size,
 		.cpupool_id = Int32_val(VAL_CPUPOOL_ID),
 	};
@@ -288,6 +290,7 @@ CAMLprim value stub_xc_domain_create(value xch_val, value wanted_domid, value co
 #undef VAL_ARCH
 #undef VAL_CPUPOOL_ID
 #undef VAL_VMTRACE_BUF_KB
+#undef VAL_ALTP2M_OPTS
 #undef VAL_MAX_GRANT_VERSION
 #undef VAL_MAX_MAPTRACK_FRAMES
 #undef VAL_MAX_GRANT_FRAMES
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 16:55:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 16:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771289.1181853 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZvYo-0007wF-Vm; Fri, 02 Aug 2024 16:55:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771289.1181853; Fri, 02 Aug 2024 16:55: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 1sZvYo-0007w7-T1; Fri, 02 Aug 2024 16:55:22 +0000
Received: by outflank-mailman (input) for mailman id 771289;
 Fri, 02 Aug 2024 16:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvYo-0007vx-79
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvYo-00023M-6M
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvYo-00051L-4U
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bRUhe3GRJi7dTeQpr7QkiWW5hYJCDRmgqEjIdu32Ssg=; b=cTG6mgdj470EycQtdEfiYxGUY+
	DhiUb/HYj+6fwsKCdEhzTYZQ6EetjwvbWaJP51GA4w2auAwUU/rFa/Vn+EWGVjwmrMSnzME1dN6s+
	CjREKa8xCLL4Elzm7L8MZx2UY2iATmm+fJDw2H4Lbjn3pS/1jLm8fwxTherZrXcfwQxk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/intel: optional build of TSX support
Message-Id: <E1sZvYo-00051L-4U@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 16:55:22 +0000

commit b1b017ffb7ad135ff7e726f85a870817c140406e
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Thu Aug 1 09:38:00 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 09:38:00 2024 +0200

    x86/intel: optional build of TSX support
    
    Transactional Synchronization Extensions are supported on certain Intel's
    CPUs only, hence can be put under CONFIG_INTEL build option.
    
    The whole TSX support, even if supported by CPU, may need to be disabled via
    options, by microcode or through spec-ctrl, depending on a set of specific
    conditions. To make sure nothing gets accidentally runtime-broken all
    modifications of global TSX configuration variables is secured by #ifdef's,
    while variables themselves redefined to 0, so that ones can't mistakenly be
    written to.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/xen-command-line.pandoc    | 2 +-
 xen/arch/x86/Makefile                | 2 +-
 xen/arch/x86/include/asm/processor.h | 6 ++++++
 xen/arch/x86/spec_ctrl.c             | 4 ++++
 4 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 98a4521155..0a66e1ee2d 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2586,7 +2586,7 @@ pages) must also be specified via the tbuf_size parameter.
 ### tsx
     = <bool>
 
-    Applicability: x86
+    Applicability: x86 with CONFIG_INTEL active
     Default: false on parts vulnerable to TAA, true otherwise
 
 Controls for the use of Transactional Synchronization eXtensions.
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index d902fb7acc..286c003ec3 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -67,7 +67,7 @@ obj-y += srat.o
 obj-y += string.o
 obj-y += time.o
 obj-y += traps.o
-obj-y += tsx.o
+obj-$(CONFIG_INTEL) += tsx.o
 obj-y += usercopy.o
 obj-y += x86_emulate.o
 obj-$(CONFIG_TBOOT) += tboot.o
diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/asm/processor.h
index c26ef9090c..66463f6a6d 100644
--- a/xen/arch/x86/include/asm/processor.h
+++ b/xen/arch/x86/include/asm/processor.h
@@ -503,9 +503,15 @@ static inline uint8_t get_cpu_family(uint32_t raw, uint8_t *model,
     return fam;
 }
 
+#ifdef CONFIG_INTEL
 extern int8_t opt_tsx;
 extern bool rtm_disabled;
 void tsx_init(void);
+#else
+#define opt_tsx      0     /* explicitly indicate TSX is off */
+#define rtm_disabled false /* RTM was not force-disabled */
+static inline void tsx_init(void) {}
+#endif
 
 void update_mcu_opt_ctrl(void);
 void set_in_mcu_opt_ctrl(uint32_t mask, uint32_t val);
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 40f6ae0170..6b3631e375 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -116,8 +116,10 @@ static int __init cf_check parse_spec_ctrl(const char *s)
             if ( opt_pv_l1tf_domu < 0 )
                 opt_pv_l1tf_domu = 0;
 
+#ifdef CONFIG_INTEL
             if ( opt_tsx == -1 )
                 opt_tsx = -3;
+#endif
 
         disable_common:
             opt_rsb_pv = false;
@@ -2264,6 +2266,7 @@ void __init init_speculation_mitigations(void)
      * plausibly value TSX higher than Hyperthreading...), disable TSX to
      * mitigate TAA.
      */
+#ifdef CONFIG_INTEL
     if ( opt_tsx == -1 && cpu_has_bug_taa && cpu_has_tsx_ctrl &&
          ((hw_smt_enabled && opt_smt) ||
           !boot_cpu_has(X86_FEATURE_SC_VERW_IDLE)) )
@@ -2271,6 +2274,7 @@ void __init init_speculation_mitigations(void)
         opt_tsx = 0;
         tsx_init();
     }
+#endif
 
     /*
      * On some SRBDS-affected hardware, it may be safe to relax srb-lock by
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 16:55:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 16:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771290.1181858 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZvYz-0007zK-1U; Fri, 02 Aug 2024 16:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771290.1181858; Fri, 02 Aug 2024 16: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 1sZvYy-0007zD-UW; Fri, 02 Aug 2024 16:55:32 +0000
Received: by outflank-mailman (input) for mailman id 771290;
 Fri, 02 Aug 2024 16:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvYy-0007z5-BU
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvYy-00023Y-Aj
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvYy-00051q-8g
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cpbjwvwy4CGUrJt2CazLwhClSNjdbWg5vkdiygK4Y/Y=; b=0TD7rvGOG8afnrwf0qUBZVYews
	HPVaZMTWj9wi7oU8bpnb+DBVl00VbbrYtGDHJ5kIXSNPqYg+tlJMfYje4k3QXSfKBNktjcJP2YDN6
	8983u0m2Q1b3bmFRo39SLu+exu9lbUZ9OLTix4u5lrrb4mJ9ZuQYCd4RAlpsrs+XsKNM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/fpu: Create a typedef for the x87/SSE area inside "struct xsave_struct"
Message-Id: <E1sZvYy-00051q-8g@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 16:55:32 +0000

commit 4fe446a42910cb6bf53ca3a8b7c2c6a64e2f192c
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Thu Aug 1 09:39:11 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 09:39:11 2024 +0200

    x86/fpu: Create a typedef for the x87/SSE area inside "struct xsave_struct"
    
    Making the union non-anonymous would cause a lot of headaches, because a lot of
    code relies on it being so, but it's possible to make a typedef of the anonymous
    union so all callsites currently relying on typeof() can stop doing so directly.
    
    This commit creates a `fpusse_t` typedef to the anonymous union at the head of
    the XSAVE area and uses it instead of typeof().
    
    No functional change.
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/emulate.c        | 5 ++---
 xen/arch/x86/i387.c               | 8 ++++----
 xen/arch/x86/include/asm/xstate.h | 2 ++
 xen/arch/x86/xstate.c             | 2 +-
 4 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index b6ca5cb9d1..feb4792cc5 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2363,8 +2363,7 @@ static int cf_check hvmemul_get_fpu(
         alternative_vcall(hvm_funcs.fpu_dirty_intercept);
     else if ( type == X86EMUL_FPU_fpu )
     {
-        const typeof(curr->arch.xsave_area->fpu_sse) *fpu_ctxt =
-            curr->arch.fpu_ctxt;
+        const fpusse_t *fpu_ctxt = curr->arch.fpu_ctxt;
 
         /*
          * Latch current register state so that we can back out changes
@@ -2404,7 +2403,7 @@ static void cf_check hvmemul_put_fpu(
 
     if ( aux )
     {
-        typeof(curr->arch.xsave_area->fpu_sse) *fpu_ctxt = curr->arch.fpu_ctxt;
+        fpusse_t *fpu_ctxt = curr->arch.fpu_ctxt;
         bool dval = aux->dval;
         int mode = hvm_guest_x86_mode(curr);
 
diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index 400c70114a..134e0bece5 100644
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -39,7 +39,7 @@ static inline void fpu_xrstor(struct vcpu *v, uint64_t mask)
 /* Restore x87 FPU, MMX, SSE and SSE2 state */
 static inline void fpu_fxrstor(struct vcpu *v)
 {
-    const typeof(v->arch.xsave_area->fpu_sse) *fpu_ctxt = v->arch.fpu_ctxt;
+    const fpusse_t *fpu_ctxt = v->arch.fpu_ctxt;
 
     /*
      * Some CPUs don't save/restore FDP/FIP/FOP unless an exception
@@ -151,7 +151,7 @@ static inline void fpu_xsave(struct vcpu *v)
 /* Save x87 FPU, MMX, SSE and SSE2 state */
 static inline void fpu_fxsave(struct vcpu *v)
 {
-    typeof(v->arch.xsave_area->fpu_sse) *fpu_ctxt = v->arch.fpu_ctxt;
+    fpusse_t *fpu_ctxt = v->arch.fpu_ctxt;
     unsigned int fip_width = v->domain->arch.x87_fip_width;
 
     if ( fip_width != 4 )
@@ -315,7 +315,7 @@ int vcpu_init_fpu(struct vcpu *v)
                                     __alignof(v->arch.xsave_area->fpu_sse));
         if ( v->arch.fpu_ctxt )
         {
-            typeof(v->arch.xsave_area->fpu_sse) *fpu_sse = v->arch.fpu_ctxt;
+            fpusse_t *fpu_sse = v->arch.fpu_ctxt;
 
             fpu_sse->fcw = FCW_DEFAULT;
             fpu_sse->mxcsr = MXCSR_DEFAULT;
@@ -336,7 +336,7 @@ void vcpu_setup_fpu(struct vcpu *v, struct xsave_struct *xsave_area,
      * accesses through both pointers alias one another, and the shorter form
      * is used here.
      */
-    typeof(xsave_area->fpu_sse) *fpu_sse = v->arch.fpu_ctxt;
+    fpusse_t *fpu_sse = v->arch.fpu_ctxt;
 
     ASSERT(!xsave_area || xsave_area == v->arch.xsave_area);
 
diff --git a/xen/arch/x86/include/asm/xstate.h b/xen/arch/x86/include/asm/xstate.h
index f0eeb13b87..ebeb2a3dca 100644
--- a/xen/arch/x86/include/asm/xstate.h
+++ b/xen/arch/x86/include/asm/xstate.h
@@ -82,6 +82,8 @@ struct __attribute__((aligned (64))) xsave_struct
     char data[];                             /* Variable layout states */
 };
 
+typedef typeof(((struct xsave_struct){}).fpu_sse) fpusse_t;
+
 struct xstate_bndcsr {
     uint64_t bndcfgu;
     uint64_t bndstatus;
diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 68cdd8fcf0..5c4144d55e 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -846,7 +846,7 @@ void xstate_init(struct cpuinfo_x86 *c)
 
     if ( bsp )
     {
-        static typeof(current->arch.xsave_area->fpu_sse) __initdata ctxt;
+        static fpusse_t __initdata ctxt;
 
         asm ( "fxsave %0" : "=m" (ctxt) );
         if ( ctxt.mxcsr_mask )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 16:55:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 16:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771291.1181862 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZvZ9-00082b-2j; Fri, 02 Aug 2024 16:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771291.1181862; Fri, 02 Aug 2024 16: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 1sZvZ9-00082U-00; Fri, 02 Aug 2024 16:55:43 +0000
Received: by outflank-mailman (input) for mailman id 771291;
 Fri, 02 Aug 2024 16:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvZ8-00082O-Ef
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvZ8-00023k-Dq
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvZ8-00052l-Cx
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Mo0Mz4Te6I+x437hItKDQ828LinOPK4TYV3y8GFgJso=; b=ujrWtmwIPcg1alLrovQg5u8vy2
	3CfU0Q0MlIK2HTyxqfowI9I5RlpnySSaZsP7XoHcmmLUjJ1Wi5ac1onjFJd33IwQUkP1gngbpXDzD
	edFTNIyaeDKLmgf1EIwqIoExy2fRKAANMOAQtUAS056Pb5jTOgucqQ92Xa5B4dgBlQlM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/cpufreq: move ACPI cpufreq driver into separate file
Message-Id: <E1sZvZ8-00052l-Cx@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 16:55:42 +0000

commit aed2b87eeb502c32533c2ebba6dad4ef205787b8
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Thu Aug 1 09:40:12 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 09:40:12 2024 +0200

    x86/cpufreq: move ACPI cpufreq driver into separate file
    
    Separate ACPI driver from generic initialization cpufreq code.
    This way acpi-cpufreq can become optional in the future and be disabled
    from non-Intel builds.
    
    no changes to code were introduced, except:
      acpi_cpufreq_register() helper added
      clean up a list of included headers
      license transformed into an SPDX line
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/cpufreq/Makefile  |   1 +
 xen/arch/x86/acpi/cpufreq/acpi.c    | 518 ++++++++++++++++++++++++++++++++++++
 xen/arch/x86/acpi/cpufreq/cpufreq.c | 506 +----------------------------------
 xen/include/acpi/cpufreq/cpufreq.h  |   2 +
 4 files changed, 523 insertions(+), 504 deletions(-)

diff --git a/xen/arch/x86/acpi/cpufreq/Makefile b/xen/arch/x86/acpi/cpufreq/Makefile
index db83aa6b14..44d4c0b497 100644
--- a/xen/arch/x86/acpi/cpufreq/Makefile
+++ b/xen/arch/x86/acpi/cpufreq/Makefile
@@ -1,3 +1,4 @@
+obj-y += acpi.o
 obj-y += cpufreq.o
 obj-y += hwp.o
 obj-y += powernow.o
diff --git a/xen/arch/x86/acpi/cpufreq/acpi.c b/xen/arch/x86/acpi/cpufreq/acpi.c
new file mode 100644
index 0000000000..c6d7d02faa
--- /dev/null
+++ b/xen/arch/x86/acpi/cpufreq/acpi.c
@@ -0,0 +1,518 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ *  cpufreq.c - ACPI Processor P-States Driver ($Revision: 1.4 $)
+ *
+ *  Copyright (C) 2001, 2002 Andy Grover <andrew.grover@intel.com>
+ *  Copyright (C) 2001, 2002 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
+ *  Copyright (C) 2002 - 2004 Dominik Brodowski <linux@brodo.de>
+ *  Copyright (C) 2006        Denis Sadykov <denis.m.sadykov@intel.com>
+ *
+ *  Feb 2008 - Liu Jinsong <jinsong.liu@intel.com>
+ *      porting acpi-cpufreq.c from Linux 2.6.23 to Xen hypervisor
+ */
+
+#include <xen/errno.h>
+#include <xen/delay.h>
+#include <xen/param.h>
+#include <xen/types.h>
+
+#include <acpi/acpi.h>
+#include <acpi/cpufreq/cpufreq.h>
+
+enum {
+    UNDEFINED_CAPABLE = 0,
+    SYSTEM_INTEL_MSR_CAPABLE,
+    SYSTEM_IO_CAPABLE,
+};
+
+#define INTEL_MSR_RANGE         (0xffffull)
+
+static bool __read_mostly acpi_pstate_strict;
+boolean_param("acpi_pstate_strict", acpi_pstate_strict);
+
+static unsigned extract_io(u32 value, struct acpi_cpufreq_data *data)
+{
+    struct processor_performance *perf;
+    int i;
+
+    perf = data->acpi_data;
+
+    for (i=0; i<perf->state_count; i++) {
+        if (value == perf->states[i].status)
+            return data->freq_table[i].frequency;
+    }
+    return 0;
+}
+
+static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data)
+{
+    int i;
+    struct processor_performance *perf;
+
+    msr &= INTEL_MSR_RANGE;
+    perf = data->acpi_data;
+
+    for (i=0; data->freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
+        if (msr == perf->states[data->freq_table[i].index].status)
+            return data->freq_table[i].frequency;
+    }
+    return data->freq_table[0].frequency;
+}
+
+static unsigned extract_freq(u32 val, struct acpi_cpufreq_data *data)
+{
+    switch (data->arch_cpu_flags) {
+    case SYSTEM_INTEL_MSR_CAPABLE:
+        return extract_msr(val, data);
+    case SYSTEM_IO_CAPABLE:
+        return extract_io(val, data);
+    default:
+        return 0;
+    }
+}
+
+struct msr_addr {
+    u32 reg;
+};
+
+struct io_addr {
+    u16 port;
+    u8 bit_width;
+};
+
+typedef union {
+    struct msr_addr msr;
+    struct io_addr io;
+} drv_addr_union;
+
+struct drv_cmd {
+    unsigned int type;
+    const cpumask_t *mask;
+    drv_addr_union addr;
+    u32 val;
+};
+
+static void cf_check do_drv_read(void *drvcmd)
+{
+    struct drv_cmd *cmd;
+
+    cmd = (struct drv_cmd *)drvcmd;
+
+    switch (cmd->type) {
+    case SYSTEM_INTEL_MSR_CAPABLE:
+        rdmsrl(cmd->addr.msr.reg, cmd->val);
+        break;
+    case SYSTEM_IO_CAPABLE:
+        acpi_os_read_port((acpi_io_address)cmd->addr.io.port,
+            &cmd->val, (u32)cmd->addr.io.bit_width);
+        break;
+    default:
+        break;
+    }
+}
+
+static void cf_check do_drv_write(void *drvcmd)
+{
+    struct drv_cmd *cmd;
+    uint64_t msr_content;
+
+    cmd = (struct drv_cmd *)drvcmd;
+
+    switch (cmd->type) {
+    case SYSTEM_INTEL_MSR_CAPABLE:
+        rdmsrl(cmd->addr.msr.reg, msr_content);
+        msr_content = (msr_content & ~INTEL_MSR_RANGE)
+            | (cmd->val & INTEL_MSR_RANGE);
+        wrmsrl(cmd->addr.msr.reg, msr_content);
+        break;
+    case SYSTEM_IO_CAPABLE:
+        acpi_os_write_port((acpi_io_address)cmd->addr.io.port,
+            cmd->val, (u32)cmd->addr.io.bit_width);
+        break;
+    default:
+        break;
+    }
+}
+
+static void drv_read(struct drv_cmd *cmd)
+{
+    cmd->val = 0;
+
+    ASSERT(cpumask_weight(cmd->mask) == 1);
+
+    /* to reduce IPI for the sake of performance */
+    if (likely(cpumask_test_cpu(smp_processor_id(), cmd->mask)))
+        do_drv_read((void *)cmd);
+    else
+        on_selected_cpus(cmd->mask, do_drv_read, cmd, 1);
+}
+
+static void drv_write(struct drv_cmd *cmd)
+{
+    if (cpumask_equal(cmd->mask, cpumask_of(smp_processor_id())))
+        do_drv_write((void *)cmd);
+    else
+        on_selected_cpus(cmd->mask, do_drv_write, cmd, 1);
+}
+
+static u32 get_cur_val(const cpumask_t *mask)
+{
+    struct cpufreq_policy *policy;
+    struct processor_performance *perf;
+    struct drv_cmd cmd;
+    unsigned int cpu = smp_processor_id();
+
+    if (unlikely(cpumask_empty(mask)))
+        return 0;
+
+    if (!cpumask_test_cpu(cpu, mask))
+        cpu = cpumask_first(mask);
+    if (cpu >= nr_cpu_ids || !cpu_online(cpu))
+        return 0;
+
+    policy = per_cpu(cpufreq_cpu_policy, cpu);
+    if (!policy || !cpufreq_drv_data[policy->cpu])
+        return 0;
+
+    switch (cpufreq_drv_data[policy->cpu]->arch_cpu_flags) {
+    case SYSTEM_INTEL_MSR_CAPABLE:
+        cmd.type = SYSTEM_INTEL_MSR_CAPABLE;
+        cmd.addr.msr.reg = MSR_IA32_PERF_STATUS;
+        break;
+    case SYSTEM_IO_CAPABLE:
+        cmd.type = SYSTEM_IO_CAPABLE;
+        perf = cpufreq_drv_data[policy->cpu]->acpi_data;
+        cmd.addr.io.port = perf->control_register.address;
+        cmd.addr.io.bit_width = perf->control_register.bit_width;
+        break;
+    default:
+        return 0;
+    }
+
+    cmd.mask = cpumask_of(cpu);
+
+    drv_read(&cmd);
+    return cmd.val;
+}
+
+static unsigned int cf_check get_cur_freq_on_cpu(unsigned int cpu)
+{
+    struct cpufreq_policy *policy;
+    struct acpi_cpufreq_data *data;
+
+    if (!cpu_online(cpu))
+        return 0;
+
+    policy = per_cpu(cpufreq_cpu_policy, cpu);
+    if (!policy)
+        return 0;
+
+    data = cpufreq_drv_data[policy->cpu];
+    if (unlikely(data == NULL ||
+        data->acpi_data == NULL || data->freq_table == NULL))
+        return 0;
+
+    return extract_freq(get_cur_val(cpumask_of(cpu)), data);
+}
+
+void intel_feature_detect(struct cpufreq_policy *policy)
+{
+    unsigned int eax;
+
+    eax = cpuid_eax(6);
+    if (eax & 0x2) {
+        policy->turbo = CPUFREQ_TURBO_ENABLED;
+        if (cpufreq_verbose)
+            printk(XENLOG_INFO "CPU%u: Turbo Mode detected and enabled\n",
+                   smp_processor_id());
+    }
+}
+
+static void cf_check feature_detect(void *info)
+{
+    intel_feature_detect(info);
+}
+
+static unsigned int check_freqs(const cpumask_t *mask, unsigned int freq,
+                                struct acpi_cpufreq_data *data)
+{
+    unsigned int cur_freq;
+    unsigned int i;
+
+    for (i=0; i<100; i++) {
+        cur_freq = extract_freq(get_cur_val(mask), data);
+        if (cur_freq == freq)
+            return 1;
+        udelay(10);
+    }
+    return 0;
+}
+
+static int cf_check acpi_cpufreq_target(
+    struct cpufreq_policy *policy,
+    unsigned int target_freq, unsigned int relation)
+{
+    struct acpi_cpufreq_data *data = cpufreq_drv_data[policy->cpu];
+    struct processor_performance *perf;
+    struct cpufreq_freqs freqs;
+    cpumask_t online_policy_cpus;
+    struct drv_cmd cmd;
+    unsigned int next_state = 0; /* Index into freq_table */
+    unsigned int next_perf_state = 0; /* Index into perf table */
+    unsigned int j;
+    int result = 0;
+
+    if (unlikely(data == NULL ||
+        data->acpi_data == NULL || data->freq_table == NULL)) {
+        return -ENODEV;
+    }
+
+    if (policy->turbo == CPUFREQ_TURBO_DISABLED)
+        if (target_freq > policy->cpuinfo.second_max_freq)
+            target_freq = policy->cpuinfo.second_max_freq;
+
+    perf = data->acpi_data;
+    result = cpufreq_frequency_table_target(policy,
+                                            data->freq_table,
+                                            target_freq,
+                                            relation, &next_state);
+    if (unlikely(result))
+        return -ENODEV;
+
+    cpumask_and(&online_policy_cpus, &cpu_online_map, policy->cpus);
+
+    next_perf_state = data->freq_table[next_state].index;
+    if (perf->state == next_perf_state) {
+        if (unlikely(policy->resume))
+            policy->resume = 0;
+        else
+            return 0;
+    }
+
+    switch (data->arch_cpu_flags) {
+    case SYSTEM_INTEL_MSR_CAPABLE:
+        cmd.type = SYSTEM_INTEL_MSR_CAPABLE;
+        cmd.addr.msr.reg = MSR_IA32_PERF_CTL;
+        cmd.val = (u32) perf->states[next_perf_state].control;
+        break;
+    case SYSTEM_IO_CAPABLE:
+        cmd.type = SYSTEM_IO_CAPABLE;
+        cmd.addr.io.port = perf->control_register.address;
+        cmd.addr.io.bit_width = perf->control_register.bit_width;
+        cmd.val = (u32) perf->states[next_perf_state].control;
+        break;
+    default:
+        return -ENODEV;
+    }
+
+    if (policy->shared_type != CPUFREQ_SHARED_TYPE_ANY)
+        cmd.mask = &online_policy_cpus;
+    else
+        cmd.mask = cpumask_of(policy->cpu);
+
+    freqs.old = perf->states[perf->state].core_frequency * 1000;
+    freqs.new = data->freq_table[next_state].frequency;
+
+    drv_write(&cmd);
+
+    if (acpi_pstate_strict && !check_freqs(cmd.mask, freqs.new, data)) {
+        printk(KERN_WARNING "Fail transfer to new freq %d\n", freqs.new);
+        return -EAGAIN;
+    }
+
+    for_each_cpu(j, &online_policy_cpus)
+        cpufreq_statistic_update(j, perf->state, next_perf_state);
+
+    perf->state = next_perf_state;
+    policy->cur = freqs.new;
+
+    return result;
+}
+
+static int cf_check acpi_cpufreq_verify(struct cpufreq_policy *policy)
+{
+    struct acpi_cpufreq_data *data;
+    struct processor_performance *perf;
+
+    if (!policy || !(data = cpufreq_drv_data[policy->cpu]) ||
+        !processor_pminfo[policy->cpu])
+        return -EINVAL;
+
+    perf = &processor_pminfo[policy->cpu]->perf;
+
+    cpufreq_verify_within_limits(policy, 0,
+        perf->states[perf->platform_limit].core_frequency * 1000);
+
+    return cpufreq_frequency_table_verify(policy, data->freq_table);
+}
+
+static unsigned long
+acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu)
+{
+    struct processor_performance *perf = data->acpi_data;
+
+    if (cpu_khz) {
+        /* search the closest match to cpu_khz */
+        unsigned int i;
+        unsigned long freq;
+        unsigned long freqn = perf->states[0].core_frequency * 1000;
+
+        for (i=0; i<(perf->state_count-1); i++) {
+            freq = freqn;
+            freqn = perf->states[i+1].core_frequency * 1000;
+            if ((2 * cpu_khz) > (freqn + freq)) {
+                perf->state = i;
+                return freq;
+            }
+        }
+        perf->state = perf->state_count-1;
+        return freqn;
+    } else {
+        /* assume CPU is at P0... */
+        perf->state = 0;
+        return perf->states[0].core_frequency * 1000;
+    }
+}
+
+static int cf_check acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
+{
+    unsigned int i;
+    unsigned int valid_states = 0;
+    unsigned int cpu = policy->cpu;
+    struct acpi_cpufreq_data *data;
+    unsigned int result = 0;
+    struct cpuinfo_x86 *c = &cpu_data[policy->cpu];
+    struct processor_performance *perf;
+
+    data = xzalloc(struct acpi_cpufreq_data);
+    if (!data)
+        return -ENOMEM;
+
+    cpufreq_drv_data[cpu] = data;
+
+    data->acpi_data = &processor_pminfo[cpu]->perf;
+
+    perf = data->acpi_data;
+    policy->shared_type = perf->shared_type;
+
+    switch (perf->control_register.space_id) {
+    case ACPI_ADR_SPACE_SYSTEM_IO:
+        if (cpufreq_verbose)
+            printk("xen_pminfo: @acpi_cpufreq_cpu_init,"
+                   "SYSTEM IO addr space\n");
+        data->arch_cpu_flags = SYSTEM_IO_CAPABLE;
+        break;
+    case ACPI_ADR_SPACE_FIXED_HARDWARE:
+        if (cpufreq_verbose)
+            printk("xen_pminfo: @acpi_cpufreq_cpu_init,"
+                   "HARDWARE addr space\n");
+        if (!cpu_has(c, X86_FEATURE_EIST)) {
+            result = -ENODEV;
+            goto err_unreg;
+        }
+        data->arch_cpu_flags = SYSTEM_INTEL_MSR_CAPABLE;
+        break;
+    default:
+        result = -ENODEV;
+        goto err_unreg;
+    }
+
+    data->freq_table = xmalloc_array(struct cpufreq_frequency_table,
+                                    (perf->state_count+1));
+    if (!data->freq_table) {
+        result = -ENOMEM;
+        goto err_unreg;
+    }
+
+    /* detect transition latency */
+    policy->cpuinfo.transition_latency = 0;
+    for (i=0; i<perf->state_count; i++) {
+        if ((perf->states[i].transition_latency * 1000) >
+            policy->cpuinfo.transition_latency)
+            policy->cpuinfo.transition_latency =
+                perf->states[i].transition_latency * 1000;
+    }
+
+    policy->governor = cpufreq_opt_governor ? : CPUFREQ_DEFAULT_GOVERNOR;
+
+    /* table init */
+    for (i=0; i<perf->state_count; i++) {
+        if (i>0 && perf->states[i].core_frequency >=
+            data->freq_table[valid_states-1].frequency / 1000)
+            continue;
+
+        data->freq_table[valid_states].index = i;
+        data->freq_table[valid_states].frequency =
+            perf->states[i].core_frequency * 1000;
+        valid_states++;
+    }
+    data->freq_table[valid_states].frequency = CPUFREQ_TABLE_END;
+    perf->state = 0;
+
+    result = cpufreq_frequency_table_cpuinfo(policy, data->freq_table);
+    if (result)
+        goto err_freqfree;
+
+    switch (perf->control_register.space_id) {
+    case ACPI_ADR_SPACE_SYSTEM_IO:
+        /* Current speed is unknown and not detectable by IO port */
+        policy->cur = acpi_cpufreq_guess_freq(data, policy->cpu);
+        break;
+    case ACPI_ADR_SPACE_FIXED_HARDWARE:
+        cpufreq_driver.get = get_cur_freq_on_cpu;
+        policy->cur = get_cur_freq_on_cpu(cpu);
+        break;
+    default:
+        break;
+    }
+
+    /* Check for APERF/MPERF support in hardware
+     * also check for boost support */
+    if (c->x86_vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6)
+        on_selected_cpus(cpumask_of(cpu), feature_detect, policy, 1);
+
+    /*
+     * the first call to ->target() should result in us actually
+     * writing something to the appropriate registers.
+     */
+    policy->resume = 1;
+
+    return result;
+
+err_freqfree:
+    xfree(data->freq_table);
+err_unreg:
+    xfree(data);
+    cpufreq_drv_data[cpu] = NULL;
+
+    return result;
+}
+
+static int cf_check acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy)
+{
+    struct acpi_cpufreq_data *data = cpufreq_drv_data[policy->cpu];
+
+    if (data) {
+        cpufreq_drv_data[policy->cpu] = NULL;
+        xfree(data->freq_table);
+        xfree(data);
+    }
+
+    return 0;
+}
+
+static const struct cpufreq_driver __initconst_cf_clobber
+acpi_cpufreq_driver = {
+    .name   = "acpi-cpufreq",
+    .verify = acpi_cpufreq_verify,
+    .target = acpi_cpufreq_target,
+    .init   = acpi_cpufreq_cpu_init,
+    .exit   = acpi_cpufreq_cpu_exit,
+    .get    = get_cur_freq_on_cpu,
+};
+
+
+int __init acpi_cpufreq_register(void)
+{
+    return cpufreq_register_driver(&acpi_cpufreq_driver);
+}
diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufreq/cpufreq.c
index a341f2f020..6244d29496 100644
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c
@@ -26,200 +26,14 @@
  *
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  */
-
 #include <xen/types.h>
 #include <xen/errno.h>
-#include <xen/delay.h>
-#include <xen/cpumask.h>
 #include <xen/param.h>
 #include <xen/sched.h>
-#include <xen/timer.h>
-#include <xen/xmalloc.h>
-#include <asm/msr.h>
-#include <asm/io.h>
-#include <asm/processor.h>
-#include <asm/cpufeature.h>
-#include <acpi/acpi.h>
 #include <acpi/cpufreq/cpufreq.h>
 
-enum {
-    UNDEFINED_CAPABLE = 0,
-    SYSTEM_INTEL_MSR_CAPABLE,
-    SYSTEM_IO_CAPABLE,
-};
-
-#define INTEL_MSR_RANGE         (0xffffull)
-
 struct acpi_cpufreq_data *cpufreq_drv_data[NR_CPUS];
 
-static bool __read_mostly acpi_pstate_strict;
-boolean_param("acpi_pstate_strict", acpi_pstate_strict);
-
-static unsigned extract_io(u32 value, struct acpi_cpufreq_data *data)
-{
-    struct processor_performance *perf;
-    int i;
-
-    perf = data->acpi_data;
-
-    for (i=0; i<perf->state_count; i++) {
-        if (value == perf->states[i].status)
-            return data->freq_table[i].frequency;
-    }
-    return 0;
-}
-
-static unsigned extract_msr(u32 msr, struct acpi_cpufreq_data *data)
-{
-    int i;
-    struct processor_performance *perf;
-
-    msr &= INTEL_MSR_RANGE;
-    perf = data->acpi_data;
-
-    for (i=0; data->freq_table[i].frequency != CPUFREQ_TABLE_END; i++) {
-        if (msr == perf->states[data->freq_table[i].index].status)
-            return data->freq_table[i].frequency;
-    }
-    return data->freq_table[0].frequency;
-}
-
-static unsigned extract_freq(u32 val, struct acpi_cpufreq_data *data)
-{
-    switch (data->arch_cpu_flags) {
-    case SYSTEM_INTEL_MSR_CAPABLE:
-        return extract_msr(val, data);
-    case SYSTEM_IO_CAPABLE:
-        return extract_io(val, data);
-    default:
-        return 0;
-    }
-}
-
-struct msr_addr {
-    u32 reg;
-};
-
-struct io_addr {
-    u16 port;
-    u8 bit_width;
-};
-
-typedef union {
-    struct msr_addr msr;
-    struct io_addr io;
-} drv_addr_union;
-
-struct drv_cmd {
-    unsigned int type;
-    const cpumask_t *mask;
-    drv_addr_union addr;
-    u32 val;
-};
-
-static void cf_check do_drv_read(void *drvcmd)
-{
-    struct drv_cmd *cmd;
-
-    cmd = (struct drv_cmd *)drvcmd;
-
-    switch (cmd->type) {
-    case SYSTEM_INTEL_MSR_CAPABLE:
-        rdmsrl(cmd->addr.msr.reg, cmd->val);
-        break;
-    case SYSTEM_IO_CAPABLE:
-        acpi_os_read_port((acpi_io_address)cmd->addr.io.port,
-            &cmd->val, (u32)cmd->addr.io.bit_width);
-        break;
-    default:
-        break;
-    }
-}
-
-static void cf_check do_drv_write(void *drvcmd)
-{
-    struct drv_cmd *cmd;
-    uint64_t msr_content;
-
-    cmd = (struct drv_cmd *)drvcmd;
-
-    switch (cmd->type) {
-    case SYSTEM_INTEL_MSR_CAPABLE:
-        rdmsrl(cmd->addr.msr.reg, msr_content);
-        msr_content = (msr_content & ~INTEL_MSR_RANGE)
-            | (cmd->val & INTEL_MSR_RANGE);
-        wrmsrl(cmd->addr.msr.reg, msr_content);
-        break;
-    case SYSTEM_IO_CAPABLE:
-        acpi_os_write_port((acpi_io_address)cmd->addr.io.port,
-            cmd->val, (u32)cmd->addr.io.bit_width);
-        break;
-    default:
-        break;
-    }
-}
-
-static void drv_read(struct drv_cmd *cmd)
-{
-    cmd->val = 0;
-
-    ASSERT(cpumask_weight(cmd->mask) == 1);
-
-    /* to reduce IPI for the sake of performance */
-    if (likely(cpumask_test_cpu(smp_processor_id(), cmd->mask)))
-        do_drv_read((void *)cmd);
-    else
-        on_selected_cpus(cmd->mask, do_drv_read, cmd, 1);
-}
-
-static void drv_write(struct drv_cmd *cmd)
-{
-    if (cpumask_equal(cmd->mask, cpumask_of(smp_processor_id())))
-        do_drv_write((void *)cmd);
-    else
-        on_selected_cpus(cmd->mask, do_drv_write, cmd, 1);
-}
-
-static u32 get_cur_val(const cpumask_t *mask)
-{
-    struct cpufreq_policy *policy;
-    struct processor_performance *perf;
-    struct drv_cmd cmd;
-    unsigned int cpu = smp_processor_id();
-
-    if (unlikely(cpumask_empty(mask)))
-        return 0;
-
-    if (!cpumask_test_cpu(cpu, mask))
-        cpu = cpumask_first(mask);
-    if (cpu >= nr_cpu_ids || !cpu_online(cpu))
-        return 0;
-
-    policy = per_cpu(cpufreq_cpu_policy, cpu);
-    if (!policy || !cpufreq_drv_data[policy->cpu])
-        return 0;    
-
-    switch (cpufreq_drv_data[policy->cpu]->arch_cpu_flags) {
-    case SYSTEM_INTEL_MSR_CAPABLE:
-        cmd.type = SYSTEM_INTEL_MSR_CAPABLE;
-        cmd.addr.msr.reg = MSR_IA32_PERF_STATUS;
-        break;
-    case SYSTEM_IO_CAPABLE:
-        cmd.type = SYSTEM_IO_CAPABLE;
-        perf = cpufreq_drv_data[policy->cpu]->acpi_data;
-        cmd.addr.io.port = perf->control_register.address;
-        cmd.addr.io.bit_width = perf->control_register.bit_width;
-        break;
-    default:
-        return 0;
-    }
-
-    cmd.mask = cpumask_of(cpu);
-
-    drv_read(&cmd);
-    return cmd.val;
-}
-
 struct perf_pair {
     union {
         struct {
@@ -255,7 +69,7 @@ static void cf_check read_measured_perf_ctrs(void *_readin)
  */
 unsigned int get_measured_perf(unsigned int cpu, unsigned int flag)
 {
-    struct cpufreq_policy *policy;    
+    struct cpufreq_policy *policy;
     struct perf_pair readin, cur, *saved;
     unsigned int perf_percent;
 
@@ -308,322 +122,6 @@ unsigned int get_measured_perf(unsigned int cpu, unsigned int flag)
     return policy->cpuinfo.perf_freq * perf_percent / 100;
 }
 
-static unsigned int cf_check get_cur_freq_on_cpu(unsigned int cpu)
-{
-    struct cpufreq_policy *policy;
-    struct acpi_cpufreq_data *data;
-
-    if (!cpu_online(cpu))
-        return 0;
-
-    policy = per_cpu(cpufreq_cpu_policy, cpu);
-    if (!policy)
-        return 0;
-
-    data = cpufreq_drv_data[policy->cpu];
-    if (unlikely(data == NULL ||
-        data->acpi_data == NULL || data->freq_table == NULL))
-        return 0;
-
-    return extract_freq(get_cur_val(cpumask_of(cpu)), data);
-}
-
-void intel_feature_detect(struct cpufreq_policy *policy)
-{
-    unsigned int eax;
-
-    eax = cpuid_eax(6);
-    if (eax & 0x2) {
-        policy->turbo = CPUFREQ_TURBO_ENABLED;
-        if (cpufreq_verbose)
-            printk(XENLOG_INFO "CPU%u: Turbo Mode detected and enabled\n",
-                   smp_processor_id());
-    }
-}
-
-static void cf_check feature_detect(void *info)
-{
-    intel_feature_detect(info);
-}
-
-static unsigned int check_freqs(const cpumask_t *mask, unsigned int freq,
-                                struct acpi_cpufreq_data *data)
-{
-    unsigned int cur_freq;
-    unsigned int i;
-
-    for (i=0; i<100; i++) {
-        cur_freq = extract_freq(get_cur_val(mask), data);
-        if (cur_freq == freq)
-            return 1;
-        udelay(10);
-    }
-    return 0;
-}
-
-static int cf_check acpi_cpufreq_target(
-    struct cpufreq_policy *policy,
-    unsigned int target_freq, unsigned int relation)
-{
-    struct acpi_cpufreq_data *data = cpufreq_drv_data[policy->cpu];
-    struct processor_performance *perf;
-    struct cpufreq_freqs freqs;
-    cpumask_t online_policy_cpus;
-    struct drv_cmd cmd;
-    unsigned int next_state = 0; /* Index into freq_table */
-    unsigned int next_perf_state = 0; /* Index into perf table */
-    unsigned int j;
-    int result = 0;
-
-    if (unlikely(data == NULL ||
-        data->acpi_data == NULL || data->freq_table == NULL)) {
-        return -ENODEV;
-    }
-
-    if (policy->turbo == CPUFREQ_TURBO_DISABLED)
-        if (target_freq > policy->cpuinfo.second_max_freq)
-            target_freq = policy->cpuinfo.second_max_freq;
-
-    perf = data->acpi_data;
-    result = cpufreq_frequency_table_target(policy,
-                                            data->freq_table,
-                                            target_freq,
-                                            relation, &next_state);
-    if (unlikely(result))
-        return -ENODEV;
-
-    cpumask_and(&online_policy_cpus, &cpu_online_map, policy->cpus);
-
-    next_perf_state = data->freq_table[next_state].index;
-    if (perf->state == next_perf_state) {
-        if (unlikely(policy->resume))
-            policy->resume = 0;
-        else
-            return 0;
-    }
-
-    switch (data->arch_cpu_flags) {
-    case SYSTEM_INTEL_MSR_CAPABLE:
-        cmd.type = SYSTEM_INTEL_MSR_CAPABLE;
-        cmd.addr.msr.reg = MSR_IA32_PERF_CTL;
-        cmd.val = (u32) perf->states[next_perf_state].control;
-        break;
-    case SYSTEM_IO_CAPABLE:
-        cmd.type = SYSTEM_IO_CAPABLE;
-        cmd.addr.io.port = perf->control_register.address;
-        cmd.addr.io.bit_width = perf->control_register.bit_width;
-        cmd.val = (u32) perf->states[next_perf_state].control;
-        break;
-    default:
-        return -ENODEV;
-    }
-
-    if (policy->shared_type != CPUFREQ_SHARED_TYPE_ANY)
-        cmd.mask = &online_policy_cpus;
-    else
-        cmd.mask = cpumask_of(policy->cpu);
-
-    freqs.old = perf->states[perf->state].core_frequency * 1000;
-    freqs.new = data->freq_table[next_state].frequency;
-
-    drv_write(&cmd);
-
-    if (acpi_pstate_strict && !check_freqs(cmd.mask, freqs.new, data)) {
-        printk(KERN_WARNING "Fail transfer to new freq %d\n", freqs.new);
-        return -EAGAIN;
-    }
-
-    for_each_cpu(j, &online_policy_cpus)
-        cpufreq_statistic_update(j, perf->state, next_perf_state);
-
-    perf->state = next_perf_state;
-    policy->cur = freqs.new;
-
-    return result;
-}
-
-static int cf_check acpi_cpufreq_verify(struct cpufreq_policy *policy)
-{
-    struct acpi_cpufreq_data *data;
-    struct processor_performance *perf;
-
-    if (!policy || !(data = cpufreq_drv_data[policy->cpu]) ||
-        !processor_pminfo[policy->cpu])
-        return -EINVAL;
-
-    perf = &processor_pminfo[policy->cpu]->perf;
-
-    cpufreq_verify_within_limits(policy, 0, 
-        perf->states[perf->platform_limit].core_frequency * 1000);
-
-    return cpufreq_frequency_table_verify(policy, data->freq_table);
-}
-
-static unsigned long
-acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu)
-{
-    struct processor_performance *perf = data->acpi_data;
-
-    if (cpu_khz) {
-        /* search the closest match to cpu_khz */
-        unsigned int i;
-        unsigned long freq;
-        unsigned long freqn = perf->states[0].core_frequency * 1000;
-
-        for (i=0; i<(perf->state_count-1); i++) {
-            freq = freqn;
-            freqn = perf->states[i+1].core_frequency * 1000;
-            if ((2 * cpu_khz) > (freqn + freq)) {
-                perf->state = i;
-                return freq;
-            }
-        }
-        perf->state = perf->state_count-1;
-        return freqn;
-    } else {
-        /* assume CPU is at P0... */
-        perf->state = 0;
-        return perf->states[0].core_frequency * 1000;
-    }
-}
-
-static int cf_check acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
-{
-    unsigned int i;
-    unsigned int valid_states = 0;
-    unsigned int cpu = policy->cpu;
-    struct acpi_cpufreq_data *data;
-    unsigned int result = 0;
-    struct cpuinfo_x86 *c = &cpu_data[policy->cpu];
-    struct processor_performance *perf;
-
-    data = xzalloc(struct acpi_cpufreq_data);
-    if (!data)
-        return -ENOMEM;
-
-    cpufreq_drv_data[cpu] = data;
-
-    data->acpi_data = &processor_pminfo[cpu]->perf;
-
-    perf = data->acpi_data;
-    policy->shared_type = perf->shared_type;
-
-    switch (perf->control_register.space_id) {
-    case ACPI_ADR_SPACE_SYSTEM_IO:
-        if (cpufreq_verbose)
-            printk("xen_pminfo: @acpi_cpufreq_cpu_init,"
-                   "SYSTEM IO addr space\n");
-        data->arch_cpu_flags = SYSTEM_IO_CAPABLE;
-        break;
-    case ACPI_ADR_SPACE_FIXED_HARDWARE:
-        if (cpufreq_verbose)
-            printk("xen_pminfo: @acpi_cpufreq_cpu_init,"
-                   "HARDWARE addr space\n");
-        if (!cpu_has(c, X86_FEATURE_EIST)) {
-            result = -ENODEV;
-            goto err_unreg;
-        }
-        data->arch_cpu_flags = SYSTEM_INTEL_MSR_CAPABLE;
-        break;
-    default:
-        result = -ENODEV;
-        goto err_unreg;
-    }
-
-    data->freq_table = xmalloc_array(struct cpufreq_frequency_table, 
-                                    (perf->state_count+1));
-    if (!data->freq_table) {
-        result = -ENOMEM;
-        goto err_unreg;
-    }
-
-    /* detect transition latency */
-    policy->cpuinfo.transition_latency = 0;
-    for (i=0; i<perf->state_count; i++) {
-        if ((perf->states[i].transition_latency * 1000) >
-            policy->cpuinfo.transition_latency)
-            policy->cpuinfo.transition_latency =
-                perf->states[i].transition_latency * 1000;
-    }
-
-    policy->governor = cpufreq_opt_governor ? : CPUFREQ_DEFAULT_GOVERNOR;
-
-    /* table init */
-    for (i=0; i<perf->state_count; i++) {
-        if (i>0 && perf->states[i].core_frequency >=
-            data->freq_table[valid_states-1].frequency / 1000)
-            continue;
-
-        data->freq_table[valid_states].index = i;
-        data->freq_table[valid_states].frequency =
-            perf->states[i].core_frequency * 1000;
-        valid_states++;
-    }
-    data->freq_table[valid_states].frequency = CPUFREQ_TABLE_END;
-    perf->state = 0;
-
-    result = cpufreq_frequency_table_cpuinfo(policy, data->freq_table);
-    if (result)
-        goto err_freqfree;
-
-    switch (perf->control_register.space_id) {
-    case ACPI_ADR_SPACE_SYSTEM_IO:
-        /* Current speed is unknown and not detectable by IO port */
-        policy->cur = acpi_cpufreq_guess_freq(data, policy->cpu);
-        break;
-    case ACPI_ADR_SPACE_FIXED_HARDWARE:
-        cpufreq_driver.get = get_cur_freq_on_cpu;
-        policy->cur = get_cur_freq_on_cpu(cpu);
-        break;
-    default:
-        break;
-    }
-
-    /* Check for APERF/MPERF support in hardware
-     * also check for boost support */
-    if (c->x86_vendor == X86_VENDOR_INTEL && c->cpuid_level >= 6)
-        on_selected_cpus(cpumask_of(cpu), feature_detect, policy, 1);
-
-    /*
-     * the first call to ->target() should result in us actually
-     * writing something to the appropriate registers.
-     */
-    policy->resume = 1;
-
-    return result;
-
-err_freqfree:
-    xfree(data->freq_table);
-err_unreg:
-    xfree(data);
-    cpufreq_drv_data[cpu] = NULL;
-
-    return result;
-}
-
-static int cf_check acpi_cpufreq_cpu_exit(struct cpufreq_policy *policy)
-{
-    struct acpi_cpufreq_data *data = cpufreq_drv_data[policy->cpu];
-
-    if (data) {
-        cpufreq_drv_data[policy->cpu] = NULL;
-        xfree(data->freq_table);
-        xfree(data);
-    }
-
-    return 0;
-}
-
-static const struct cpufreq_driver __initconst_cf_clobber
-acpi_cpufreq_driver = {
-    .name   = "acpi-cpufreq",
-    .verify = acpi_cpufreq_verify,
-    .target = acpi_cpufreq_target,
-    .init   = acpi_cpufreq_cpu_init,
-    .exit   = acpi_cpufreq_cpu_exit,
-    .get    = get_cur_freq_on_cpu,
-};
-
 static int __init cf_check cpufreq_driver_init(void)
 {
     int ret = 0;
@@ -640,7 +138,7 @@ static int __init cf_check cpufreq_driver_init(void)
                 switch ( cpufreq_xen_opts[i] )
                 {
                 case CPUFREQ_xen:
-                    ret = cpufreq_register_driver(&acpi_cpufreq_driver);
+                    ret = acpi_cpufreq_register();
                     break;
                 case CPUFREQ_hwp:
                     ret = hwp_register_driver();
diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h
index 443427153b..ec7e139000 100644
--- a/xen/include/acpi/cpufreq/cpufreq.h
+++ b/xen/include/acpi/cpufreq/cpufreq.h
@@ -260,4 +260,6 @@ int get_hwp_para(unsigned int cpu,
 int set_hwp_para(struct cpufreq_policy *policy,
                  struct xen_set_cppc_para *set_cppc);
 
+int acpi_cpufreq_register(void);
+
 #endif /* __XEN_CPUFREQ_PM_H__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 16:55:53 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 16:55:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771292.1181866 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZvZJ-00085w-63; Fri, 02 Aug 2024 16:55:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771292.1181866; Fri, 02 Aug 2024 16: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 1sZvZJ-00085o-3N; Fri, 02 Aug 2024 16:55:53 +0000
Received: by outflank-mailman (input) for mailman id 771292;
 Fri, 02 Aug 2024 16:55:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvZI-00085g-Hj
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:55:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvZI-00023t-Gz
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvZI-00053L-G7
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=c+kuX+8Cip4nkYl6mv59eNe/zI10wsc5d0k++EiyN2E=; b=uefZmal4HAe+kteKRnLVS5ZMQ+
	Ur7a5gsYQG8v6hPBuGPJzIsOtudVwXvR2qEg+0J+ztS8oUwotP1OP80gcAfws88ZNB8ovLwDcGXJH
	wBU2ri6FEU4eU+Udhe8YxARrkUxLctoUGDHDMwCMu3oP12ACp2LRTaeX0niOAHUx1pEg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/cpufreq: separate powernow/hwp/acpi cpufreq code
Message-Id: <E1sZvZI-00053L-G7@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 16:55:52 +0000

commit f96d008fb006751385a2c381d4ad0b9526a89a1e
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Thu Aug 1 09:41:03 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 09:41:03 2024 +0200

    x86/cpufreq: separate powernow/hwp/acpi cpufreq code
    
    Build AMD Architectural P-state driver when CONFIG_AMD is on, and
    Intel Hardware P-States driver together with ACPI Processor P-States driver
    when CONFIG_INTEL is on respectively, allowing for a platform-specific build.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/acpi/cpufreq/Makefile  | 6 +++---
 xen/arch/x86/acpi/cpufreq/cpufreq.c | 8 +++++---
 xen/drivers/acpi/pmstat.c           | 5 +++--
 xen/drivers/cpufreq/cpufreq.c       | 3 ++-
 xen/include/acpi/cpufreq/cpufreq.h  | 5 +++++
 5 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/acpi/cpufreq/Makefile b/xen/arch/x86/acpi/cpufreq/Makefile
index 44d4c0b497..e7dbe434a8 100644
--- a/xen/arch/x86/acpi/cpufreq/Makefile
+++ b/xen/arch/x86/acpi/cpufreq/Makefile
@@ -1,4 +1,4 @@
-obj-y += acpi.o
+obj-$(CONFIG_INTEL) += acpi.o
 obj-y += cpufreq.o
-obj-y += hwp.o
-obj-y += powernow.o
+obj-$(CONFIG_INTEL) += hwp.o
+obj-$(CONFIG_AMD) += powernow.o
diff --git a/xen/arch/x86/acpi/cpufreq/cpufreq.c b/xen/arch/x86/acpi/cpufreq/cpufreq.c
index 6244d29496..61e98b67bd 100644
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c
@@ -138,10 +138,12 @@ static int __init cf_check cpufreq_driver_init(void)
                 switch ( cpufreq_xen_opts[i] )
                 {
                 case CPUFREQ_xen:
-                    ret = acpi_cpufreq_register();
+                    ret = IS_ENABLED(CONFIG_INTEL) ?
+                          acpi_cpufreq_register() : -ENODEV;
                     break;
                 case CPUFREQ_hwp:
-                    ret = hwp_register_driver();
+                    ret = IS_ENABLED(CONFIG_INTEL) ?
+                          hwp_register_driver() : -ENODEV;
                     break;
                 case CPUFREQ_none:
                     ret = 0;
@@ -155,7 +157,7 @@ static int __init cf_check cpufreq_driver_init(void)
 
         case X86_VENDOR_AMD:
         case X86_VENDOR_HYGON:
-            ret = powernow_register_driver();
+            ret = IS_ENABLED(CONFIG_AMD) ? powernow_register_driver() : -ENODEV;
             break;
         }
     }
diff --git a/xen/drivers/acpi/pmstat.c b/xen/drivers/acpi/pmstat.c
index 998d2e3c65..df309e27b4 100644
--- a/xen/drivers/acpi/pmstat.c
+++ b/xen/drivers/acpi/pmstat.c
@@ -254,8 +254,9 @@ static int get_cpufreq_para(struct xen_sysctl_pm_op *op)
     else
         strlcpy(op->u.get_para.scaling_driver, "Unknown", CPUFREQ_NAME_LEN);
 
-    if ( !strncmp(op->u.get_para.scaling_driver, XEN_HWP_DRIVER_NAME,
-                      CPUFREQ_NAME_LEN) )
+    if ( IS_ENABLED(CONFIG_INTEL) &&
+         !strncmp(op->u.get_para.scaling_driver, XEN_HWP_DRIVER_NAME,
+                  CPUFREQ_NAME_LEN) )
         ret = get_hwp_para(policy->cpu, &op->u.get_para.u.cppc_para);
     else
     {
diff --git a/xen/drivers/cpufreq/cpufreq.c b/xen/drivers/cpufreq/cpufreq.c
index 8659ad3aee..4a103c6de9 100644
--- a/xen/drivers/cpufreq/cpufreq.c
+++ b/xen/drivers/cpufreq/cpufreq.c
@@ -120,7 +120,8 @@ static int __init cf_check setup_cpufreq_option(const char *str)
             if ( arg[0] && arg[1] )
                 ret = cpufreq_cmdline_parse(arg + 1, end);
         }
-        else if ( choice < 0 && !cmdline_strcmp(str, "hwp") )
+        else if ( IS_ENABLED(CONFIG_INTEL) && choice < 0 &&
+                  !cmdline_strcmp(str, "hwp") )
         {
             xen_processor_pmbits |= XEN_PROCESSOR_PM_PX;
             cpufreq_controller = FREQCTL_xen;
diff --git a/xen/include/acpi/cpufreq/cpufreq.h b/xen/include/acpi/cpufreq/cpufreq.h
index ec7e139000..b6cff825ce 100644
--- a/xen/include/acpi/cpufreq/cpufreq.h
+++ b/xen/include/acpi/cpufreq/cpufreq.h
@@ -254,7 +254,12 @@ void intel_feature_detect(struct cpufreq_policy *policy);
 
 int hwp_cmdline_parse(const char *s, const char *e);
 int hwp_register_driver(void);
+#ifdef CONFIG_INTEL
 bool hwp_active(void);
+#else
+static inline bool hwp_active(void) { return false; }
+#endif
+
 int get_hwp_para(unsigned int cpu,
                  struct xen_cppc_para *cppc_para);
 int set_hwp_para(struct cpufreq_policy *policy,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 16:56:03 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 16:56:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771293.1181870 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZvZT-00088c-7b; Fri, 02 Aug 2024 16:56:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771293.1181870; Fri, 02 Aug 2024 16:56:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZvZT-00088U-4o; Fri, 02 Aug 2024 16:56:03 +0000
Received: by outflank-mailman (input) for mailman id 771293;
 Fri, 02 Aug 2024 16:56:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvZS-00088M-KV
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:56:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvZS-00024G-Jl
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvZS-00054K-J1
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:56:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5VeQMemfM2GAPUlDqNfV9kdvJSaQs7zioOBjYpI/GsM=; b=ZsQaUD2FWUj+8F7miNViCk7SGi
	QRppAtuKarzLVUtK2BQ18LYYW/Opqp+yo0bw9295PT/1JC3SJJB1teDKiexQaE2sAKEebTZEG3ln6
	K1fxB14+7yQPOu15DeTMZN/MMPeHwAanjY6rSzf3tP6+o8+Fyt+O/7Jn1+o5LoRvDNtk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: use printk() instead of early_printk()
Message-Id: <E1sZvZS-00054K-J1@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 16:56:02 +0000

commit b07e1e079406c063750fb5795e260a7a2ea7bbde
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Aug 1 09:41:25 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 09:41:25 2024 +0200

    xen/riscv: use printk() instead of early_printk()
    
    As common code is available it is better to use printk() instead
    of early_printk().
    
    Also the printing of "Hello from RISC-V world" is dropped as
    it is useless and "All set up is enough".
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/setup.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index 8bb5bdb2ae..e3cb0866d5 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -23,9 +23,7 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
 {
     remove_identity_mapping();
 
-    early_printk("Hello from C env\n");
-
-    early_printk("All set up\n");
+    printk("All set up\n");
 
     for ( ;; )
         asm volatile ("wfi");
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 16:56:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 16:56:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771294.1181873 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZvZe-0008Vx-8u; Fri, 02 Aug 2024 16:56:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771294.1181873; Fri, 02 Aug 2024 16: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 1sZvZe-0008Vp-6G; Fri, 02 Aug 2024 16:56:14 +0000
Received: by outflank-mailman (input) for mailman id 771294;
 Fri, 02 Aug 2024 16:56:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvZc-0008Lh-OQ
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:56:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvZc-00024j-Ni
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:56:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvZc-00054r-Lp
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:56:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9BepgesW6Tcr2WUQsNKH2150TSS+AAUnTRGL5A+Xo5c=; b=0mkFUZDU+NjDtZrkn2UMAHJh0u
	OGwbM7cymlGahrNTbwJ7So3RLQhLn4ec8ZwmHelGUqCao6b/d1WLadKS5X0ZlMzQyCcQgyjabDsPT
	j12y8x1Brw6c1q1pmGChs9PF60yCGnM7zfWp9gUij2g5OaJJkz3fkq7km6gNrdUGe4lE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: introduce decode_cause() stuff
Message-Id: <E1sZvZc-00054r-Lp@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 16:56:12 +0000

commit 38e767010524fec09bb50abccefc44379f043cf5
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Aug 1 09:42:27 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 09:42:27 2024 +0200

    xen/riscv: introduce decode_cause() stuff
    
    The patch introduces stuff needed to decode a reason of an
    exception.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Alistair Francis <alistair.francis@wdc.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/traps.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 79 insertions(+), 1 deletion(-)

diff --git a/xen/arch/riscv/traps.c b/xen/arch/riscv/traps.c
index 5415cf8d90..37cec40dfa 100644
--- a/xen/arch/riscv/traps.c
+++ b/xen/arch/riscv/traps.c
@@ -9,13 +9,91 @@
 #include <xen/sched.h>
 
 #include <asm/processor.h>
+#include <asm/riscv_encoding.h>
 #include <asm/traps.h>
 
-void do_trap(struct cpu_user_regs *cpu_regs)
+static const char *decode_trap_cause(unsigned long cause)
+{
+    static const char *const trap_causes[] = {
+        [CAUSE_MISALIGNED_FETCH] = "Instruction Address Misaligned",
+        [CAUSE_FETCH_ACCESS] = "Instruction Access Fault",
+        [CAUSE_ILLEGAL_INSTRUCTION] = "Illegal Instruction",
+        [CAUSE_BREAKPOINT] = "Breakpoint",
+        [CAUSE_MISALIGNED_LOAD] = "Load Address Misaligned",
+        [CAUSE_LOAD_ACCESS] = "Load Access Fault",
+        [CAUSE_MISALIGNED_STORE] = "Store/AMO Address Misaligned",
+        [CAUSE_STORE_ACCESS] = "Store/AMO Access Fault",
+        [CAUSE_USER_ECALL] = "Environment Call from U-Mode",
+        [CAUSE_SUPERVISOR_ECALL] = "Environment Call from S-Mode",
+        [CAUSE_MACHINE_ECALL] = "Environment Call from M-Mode",
+        [CAUSE_FETCH_PAGE_FAULT] = "Instruction Page Fault",
+        [CAUSE_LOAD_PAGE_FAULT] = "Load Page Fault",
+        [CAUSE_STORE_PAGE_FAULT] = "Store/AMO Page Fault",
+        [CAUSE_FETCH_GUEST_PAGE_FAULT] = "Instruction Guest Page Fault",
+        [CAUSE_LOAD_GUEST_PAGE_FAULT] = "Load Guest Page Fault",
+        [CAUSE_VIRTUAL_INST_FAULT] = "Virtualized Instruction Fault",
+        [CAUSE_STORE_GUEST_PAGE_FAULT] = "Guest Store/AMO Page Fault",
+    };
+
+    if ( cause < ARRAY_SIZE(trap_causes) && trap_causes[cause] )
+        return trap_causes[cause];
+    return "UNKNOWN";
+}
+
+static const char *decode_reserved_interrupt_cause(unsigned long irq_cause)
+{
+    switch ( irq_cause )
+    {
+    case IRQ_M_SOFT:
+        return "M-mode Software Interrupt";
+    case IRQ_M_TIMER:
+        return "M-mode Timer Interrupt";
+    case IRQ_M_EXT:
+        return "M-mode External Interrupt";
+    default:
+        return "UNKNOWN IRQ type";
+    }
+}
+
+static const char *decode_interrupt_cause(unsigned long cause)
+{
+    unsigned long irq_cause = cause & ~CAUSE_IRQ_FLAG;
+
+    switch ( irq_cause )
+    {
+    case IRQ_S_SOFT:
+        return "Supervisor Software Interrupt";
+    case IRQ_S_TIMER:
+        return "Supervisor Timer Interrupt";
+    case IRQ_S_EXT:
+        return "Supervisor External Interrupt";
+    default:
+        return decode_reserved_interrupt_cause(irq_cause);
+    }
+}
+
+static const char *decode_cause(unsigned long cause)
+{
+    if ( cause & CAUSE_IRQ_FLAG )
+        return decode_interrupt_cause(cause);
+
+    return decode_trap_cause(cause);
+}
+
+static void do_unexpected_trap(const struct cpu_user_regs *regs)
 {
+    unsigned long cause = csr_read(CSR_SCAUSE);
+
+    printk("Unhandled exception: %s\n", decode_cause(cause));
+
     die();
 }
 
+void do_trap(struct cpu_user_regs *cpu_regs)
+{
+    do_unexpected_trap(cpu_regs);
+}
+
 void vcpu_show_execution_state(struct vcpu *v)
 {
     BUG_ON("unimplemented");
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 16:56:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 16:56:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771295.1181878 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZvZo-000070-AN; Fri, 02 Aug 2024 16:56:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771295.1181878; Fri, 02 Aug 2024 16: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 1sZvZo-00006s-7e; Fri, 02 Aug 2024 16:56:24 +0000
Received: by outflank-mailman (input) for mailman id 771295;
 Fri, 02 Aug 2024 16:56:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvZm-00006k-Rb
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:56:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvZm-00026S-Ql
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:56:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvZm-00055K-Pv
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:56:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0iPN7GdJqMcaH8K1rKJdYBww4T0ymko/m/X29WMly+g=; b=3vHoMgiUu7z89pAGwCiid0cYh2
	rPWdLSNmmfTknz0UYtR15jGQbo5KI6FG6+2bsEMKVYcekrGNc5FMxp4YUiqqlUS429oOn4DZV4g+p
	uf5+Kl3Hk6yfYRCeWmEhrru1l59oTt97lpx5ZOksN1iyv3+YyWYstoKB/hGEzFpfYM6o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: introduce trap_init()
Message-Id: <E1sZvZm-00055K-Pv@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 16:56:22 +0000

commit f2dc25686b6c90fc631525e4b9e6537154ee4b0b
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Aug 1 09:42:54 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 09:42:54 2024 +0200

    xen/riscv: introduce trap_init()
    
    Note that trap_init() isn't declared with the __init attribute to
    avoid removing __init when multi-CPU support for Xen is added.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/traps.h |  1 +
 xen/arch/riscv/setup.c             |  3 +++
 xen/arch/riscv/traps.c             | 12 ++++++++++++
 3 files changed, 16 insertions(+)

diff --git a/xen/arch/riscv/include/asm/traps.h b/xen/arch/riscv/include/asm/traps.h
index 3fef318478..c30118e095 100644
--- a/xen/arch/riscv/include/asm/traps.h
+++ b/xen/arch/riscv/include/asm/traps.h
@@ -9,6 +9,7 @@
 
 void do_trap(struct cpu_user_regs *cpu_regs);
 void handle_trap(void);
+void trap_init(void);
 
 #endif /* __ASSEMBLY__ */
 
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index e3cb0866d5..a6a29a1508 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -8,6 +8,7 @@
 #include <public/version.h>
 
 #include <asm/early_printk.h>
+#include <asm/traps.h>
 
 void arch_get_xen_caps(xen_capabilities_info_t *info)
 {
@@ -23,6 +24,8 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
 {
     remove_identity_mapping();
 
+    trap_init();
+
     printk("All set up\n");
 
     for ( ;; )
diff --git a/xen/arch/riscv/traps.c b/xen/arch/riscv/traps.c
index 37cec40dfa..cb18b30ff2 100644
--- a/xen/arch/riscv/traps.c
+++ b/xen/arch/riscv/traps.c
@@ -12,6 +12,18 @@
 #include <asm/riscv_encoding.h>
 #include <asm/traps.h>
 
+/*
+ * Initialize the trap handling.
+ *
+ * The function is called after MMU is enabled.
+ */
+void trap_init(void)
+{
+    unsigned long addr = (unsigned long)&handle_trap;
+
+    csr_write(CSR_STVEC, addr);
+}
+
 static const char *decode_trap_cause(unsigned long cause)
 {
     static const char *const trap_causes[] = {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 16:56:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 16:56:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771296.1181883 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZvZy-00009g-Cp; Fri, 02 Aug 2024 16:56:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771296.1181883; Fri, 02 Aug 2024 16: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 1sZvZy-00009Y-95; Fri, 02 Aug 2024 16:56:34 +0000
Received: by outflank-mailman (input) for mailman id 771296;
 Fri, 02 Aug 2024 16:56:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvZw-00009Q-UR
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:56:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvZw-00026d-Tj
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:56:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvZw-00055l-St
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:56:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zYPjr5er0D+ujjlm/EkAZmAihegO0qZXxc41U40sbv0=; b=eOw28gtoNWHCgXoFpI6Tfu9A+O
	YIsdXpT6i6bH2ANg0kZ5m2ThnZUywl6DgkkWOUzHEAAuwYxzuvssYHigES3FqTNoy2ddu9T6C5AjY
	o6Y5zJzoPKpE694aZZ10ECoJz5nzDDJm2tEurbO/hGnhuggdjZ+Q6C9j1L2My93VTtuk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: introduce AMD-V and Intel VT-x Kconfig options
Message-Id: <E1sZvZw-00055l-St@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 16:56:32 +0000

commit c1a13ad302e6da97fc426d37a770fcc6b68ba5d6
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Thu Aug 1 13:53:37 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 13:53:37 2024 +0200

    x86: introduce AMD-V and Intel VT-x Kconfig options
    
    Introduce two new Kconfig options, AMD_SVM and INTEL_VMX, to allow code
    specific to each virtualization technology to be separated and, when not
    required, stripped.
    CONFIG_AMD_SVM will be used to enable virtual machine extensions on platforms
    that implement the AMD Virtualization Technology (AMD-V).
    CONFIG_INTEL_VMX will be used to enable virtual machine extensions on platforms
    that implement the Intel Virtualization Technology (Intel VT-x).
    
    Both features depend on HVM support.
    
    Since, at this point, disabling any of them would cause Xen to not compile,
    the options are enabled by default if HVM and are not selectable by the user.
    
    No functional change intended.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/Kconfig         | 6 ++++++
 xen/arch/x86/hvm/Makefile    | 4 ++--
 xen/arch/x86/mm/Makefile     | 3 ++-
 xen/arch/x86/mm/hap/Makefile | 2 +-
 4 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 7e03e4bc55..fa5405e0d3 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -122,6 +122,12 @@ config HVM
 
 	  If unsure, say Y.
 
+config AMD_SVM
+	def_bool HVM
+
+config INTEL_VMX
+	def_bool HVM
+
 config XEN_SHSTK
 	bool "Supervisor Shadow Stacks"
 	depends on HAS_AS_CET_SS
diff --git a/xen/arch/x86/hvm/Makefile b/xen/arch/x86/hvm/Makefile
index 3464191544..4c1fa5c6c2 100644
--- a/xen/arch/x86/hvm/Makefile
+++ b/xen/arch/x86/hvm/Makefile
@@ -1,5 +1,5 @@
-obj-y += svm/
-obj-y += vmx/
+obj-$(CONFIG_AMD_SVM) += svm/
+obj-$(CONFIG_INTEL_VMX) += vmx/
 obj-y += viridian/
 
 obj-y += asid.o
diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile
index 0803ac9297..52c5abdfee 100644
--- a/xen/arch/x86/mm/Makefile
+++ b/xen/arch/x86/mm/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_MEM_SHARING) += mem_sharing.o
 obj-$(CONFIG_HVM) += nested.o
 obj-$(CONFIG_HVM) += p2m.o
 obj-y += p2m-basic.o
-obj-$(CONFIG_HVM) += p2m-ept.o p2m-pod.o p2m-pt.o
+obj-$(CONFIG_INTEL_VMX) += p2m-ept.o
+obj-$(CONFIG_HVM) += p2m-pod.o p2m-pt.o
 obj-y += paging.o
 obj-y += physmap.o
diff --git a/xen/arch/x86/mm/hap/Makefile b/xen/arch/x86/mm/hap/Makefile
index 8ef54b1faa..67c29b2162 100644
--- a/xen/arch/x86/mm/hap/Makefile
+++ b/xen/arch/x86/mm/hap/Makefile
@@ -3,4 +3,4 @@ obj-y += guest_walk_2.o
 obj-y += guest_walk_3.o
 obj-y += guest_walk_4.o
 obj-y += nested_hap.o
-obj-y += nested_ept.o
+obj-$(CONFIG_INTEL_VMX) += nested_ept.o
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 16:56:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 16:56:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771298.1181886 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZva8-0000Cu-DV; Fri, 02 Aug 2024 16:56:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771298.1181886; Fri, 02 Aug 2024 16:56:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZva8-0000Cl-AU; Fri, 02 Aug 2024 16:56:44 +0000
Received: by outflank-mailman (input) for mailman id 771298;
 Fri, 02 Aug 2024 16:56:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZva7-0000Ca-11
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:56:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZva7-00026m-0J
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:56:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZva6-00056M-Vm
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:56:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7tCW3z2YLEuPNjb/GmdoepSHZmWuBOkcYiINpA7ZSq8=; b=v+f1IOBAlwVkXuReIbEak2xroX
	BbahPhlY9Sw2kVEthfaIul+hQ0ZheK+H8zbUbXaIfcmFhDkkSdGm34ENjfpi3b6GfsgIu3eHOFpGT
	159L+rOSUhxMFFsUvGbTKggn6NZETHFd8y8z/am2EEQ4dhw6XzShrbrn6wZA9pE5xPpU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/monitor: guard altp2m usage
Message-Id: <E1sZva6-00056M-Vm@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 16:56:42 +0000

commit 55c01d28f47d5e57bed746ba4e226c7ecbaa2bd1
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Thu Aug 1 13:54:23 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 13:54:23 2024 +0200

    x86/monitor: guard altp2m usage
    
    Explicitly check whether altp2m is on for domain when getting altp2m index.
    If explicit call to altp2m_active() always returns false, DCE will remove
    call to altp2m_vcpu_idx().
    
    p2m_get_mem_access() expects 0 as altp2m_idx parameter when altp2m not active
    or not supported, so 0 is a fallback value then.
    
    The purpose of that is later to be able to disable altp2m support and
    exclude its code from the build completely, when not supported by target
    platform (as of now it's supported for VT-x only).
    
    Also all other calls to altp2m_vcpu_idx() are guarded by altp2m_active(), so
    this change puts usage of this routine in line with the rest of code.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
---
 xen/arch/x86/hvm/monitor.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/monitor.c b/xen/arch/x86/hvm/monitor.c
index 2a8ff07ec9..74621000b2 100644
--- a/xen/arch/x86/hvm/monitor.c
+++ b/xen/arch/x86/hvm/monitor.c
@@ -262,6 +262,8 @@ bool hvm_monitor_check_p2m(unsigned long gla, gfn_t gfn, uint32_t pfec,
     struct vcpu *curr = current;
     vm_event_request_t req = {};
     paddr_t gpa = (gfn_to_gaddr(gfn) | (gla & ~PAGE_MASK));
+    unsigned int altp2m_idx = altp2m_active(curr->domain) ?
+                              altp2m_vcpu_idx(curr) : 0;
     int rc;
 
     ASSERT(curr->arch.vm_event->send_event);
@@ -270,7 +272,7 @@ bool hvm_monitor_check_p2m(unsigned long gla, gfn_t gfn, uint32_t pfec,
      * p2m_get_mem_access() can fail from a invalid MFN and return -ESRCH
      * in which case access must be restricted.
      */
-    rc = p2m_get_mem_access(curr->domain, gfn, &access, altp2m_vcpu_idx(curr));
+    rc = p2m_get_mem_access(curr->domain, gfn, &access, altp2m_idx);
 
     if ( rc == -ESRCH )
         access = XENMEM_access_n;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 16:56:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 16:56:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771299.1181890 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZvaI-0000G4-F3; Fri, 02 Aug 2024 16:56:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771299.1181890; Fri, 02 Aug 2024 16:56:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZvaI-0000Fx-Bx; Fri, 02 Aug 2024 16:56:54 +0000
Received: by outflank-mailman (input) for mailman id 771299;
 Fri, 02 Aug 2024 16:56:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvaH-0000Fp-4J
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:56:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvaH-000271-3f
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:56:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvaH-00057E-2m
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:56:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=szzgtoRa5bM2XTh+ta0QZFXf/LdBSy/2kr788pf07nA=; b=RILpUMCqjQm4c9gV7nzUHFcXir
	/XQNuz9bOlEgMAfOcUOZzSdKKIEKhUtMo5APn1snnTlWDOXA0WulJpxpuvpMumtZL/BdHdUj87ptT
	XAcffwBy7Pvj89ih/TWnUBW8ijFANcnl4rw/EjNAY/9cMubwZy4VM+q4an/LeCjg5M34=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: introduce CONFIG_ALTP2M Kconfig option
Message-Id: <E1sZvaH-00057E-2m@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 16:56:53 +0000

commit e96831ece81985c40d35fd9b24fc5f21d2bf41a2
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Thu Aug 1 13:55:08 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 13:55:08 2024 +0200

    x86: introduce CONFIG_ALTP2M Kconfig option
    
    Add new option to make altp2m code inclusion optional.
    Currently altp2m implemented for Intel EPT only, so option is dependant on VMX.
    Also the prompt itself depends on EXPERT=y, so that option is available
    for fine-tuning, if one want to play around with it.
    
    Use this option instead of more generic CONFIG_HVM option.
    That implies the possibility to build hvm code without altp2m support,
    hence we need to declare altp2m routines for hvm code to compile successfully
    (altp2m_vcpu_initialise(), altp2m_vcpu_destroy(), altp2m_vcpu_enable_ve())
    
    Also guard altp2m routines, so that they can be disabled completely in the
    build -- when target platform does not actually support altp2m
    (AMD-V & ARM as of now).
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/Kconfig               | 11 +++++++++++
 xen/arch/x86/include/asm/altp2m.h  |  5 ++++-
 xen/arch/x86/include/asm/hvm/hvm.h |  2 +-
 xen/arch/x86/include/asm/p2m.h     | 23 ++++++++++++++++++-----
 xen/arch/x86/mm/Makefile           |  2 +-
 5 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index fa5405e0d3..7ef5c8bc48 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -358,6 +358,17 @@ config REQUIRE_NX
 	  was unavailable. However, if enabled, Xen will no longer boot on
 	  any CPU which is lacking NX support.
 
+config ALTP2M
+	bool "Alternate P2M support" if EXPERT
+	depends on INTEL_VMX
+	default y
+	help
+	  Alternate-p2m allows a guest to manage multiple p2m guest physical
+	  "memory views" (as opposed to a single p2m).
+	  Useful for memory introspection.
+
+	  If unsure, stay with defaults.
+
 endmenu
 
 source "common/Kconfig"
diff --git a/xen/arch/x86/include/asm/altp2m.h b/xen/arch/x86/include/asm/altp2m.h
index e5e59cbd68..c57a8c5588 100644
--- a/xen/arch/x86/include/asm/altp2m.h
+++ b/xen/arch/x86/include/asm/altp2m.h
@@ -7,7 +7,7 @@
 #ifndef __ASM_X86_ALTP2M_H
 #define __ASM_X86_ALTP2M_H
 
-#ifdef CONFIG_HVM
+#ifdef CONFIG_ALTP2M
 
 #include <xen/types.h>
 #include <xen/sched.h>         /* for struct vcpu, struct domain */
@@ -39,6 +39,9 @@ static inline bool altp2m_active(const struct domain *d)
 
 /* Only declaration is needed. DCE will optimise it out when linking. */
 uint16_t altp2m_vcpu_idx(const struct vcpu *v);
+void altp2m_vcpu_initialise(struct vcpu *v);
+void altp2m_vcpu_destroy(struct vcpu *v);
+int altp2m_vcpu_enable_ve(struct vcpu *v, gfn_t gfn);
 void altp2m_vcpu_disable_ve(struct vcpu *v);
 
 #endif
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 277648dd18..34824af6df 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -670,7 +670,7 @@ static inline bool hvm_hap_supported(void)
 /* returns true if hardware supports alternate p2m's */
 static inline bool hvm_altp2m_supported(void)
 {
-    return hvm_funcs.caps.altp2m;
+    return IS_ENABLED(CONFIG_ALTP2M) && hvm_funcs.caps.altp2m;
 }
 
 /* Returns true if we have the minimum hardware requirements for nested virt */
diff --git a/xen/arch/x86/include/asm/p2m.h b/xen/arch/x86/include/asm/p2m.h
index c1478ffc36..e6de37f108 100644
--- a/xen/arch/x86/include/asm/p2m.h
+++ b/xen/arch/x86/include/asm/p2m.h
@@ -577,7 +577,7 @@ static inline gfn_t mfn_to_gfn(const struct domain *d, mfn_t mfn)
         return _gfn(mfn_x(mfn));
 }
 
-#ifdef CONFIG_HVM
+#ifdef CONFIG_ALTP2M
 #define AP2MGET_prepopulate true
 #define AP2MGET_query false
 
@@ -589,6 +589,16 @@ static inline gfn_t mfn_to_gfn(const struct domain *d, mfn_t mfn)
 int altp2m_get_effective_entry(struct p2m_domain *ap2m, gfn_t gfn, mfn_t *mfn,
                                p2m_type_t *t, p2m_access_t *a,
                                bool prepopulate);
+#else
+static inline int _altp2m_get_effective_entry(struct p2m_domain *ap2m,
+                                             gfn_t gfn, mfn_t *mfn,
+                                             p2m_type_t *t, p2m_access_t *a)
+{
+    ASSERT_UNREACHABLE();
+    return -EOPNOTSUPP;
+}
+#define altp2m_get_effective_entry(ap2m, gfn, mfn, t, a, prepopulate) \
+        _altp2m_get_effective_entry(ap2m, gfn, mfn, t, a)
 #endif
 
 /* Init the datastructures for later use by the p2m code */
@@ -914,9 +924,6 @@ static inline bool p2m_set_altp2m(struct vcpu *v, unsigned int idx)
 /* Switch alternate p2m for a single vcpu */
 bool p2m_switch_vcpu_altp2m_by_id(struct vcpu *v, unsigned int idx);
 
-/* Check to see if vcpu should be switched to a different p2m. */
-void p2m_altp2m_check(struct vcpu *v, uint16_t idx);
-
 /* Flush all the alternate p2m's for a domain */
 void p2m_flush_altp2m(struct domain *d);
 
@@ -952,9 +959,15 @@ int p2m_set_altp2m_view_visibility(struct domain *d, unsigned int altp2m_idx,
                                    uint8_t visible);
 #else /* !CONFIG_HVM */
 struct p2m_domain *p2m_get_altp2m(struct vcpu *v);
-static inline void p2m_altp2m_check(struct vcpu *v, uint16_t idx) {}
 #endif /* CONFIG_HVM */
 
+#ifdef CONFIG_ALTP2M
+/* Check to see if vcpu should be switched to a different p2m. */
+void p2m_altp2m_check(struct vcpu *v, uint16_t idx);
+#else
+static inline void p2m_altp2m_check(struct vcpu *v, uint16_t idx) {}
+#endif
+
 /* p2m access to IOMMU flags */
 static inline unsigned int p2m_access_to_iommu_flags(p2m_access_t p2ma)
 {
diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile
index 52c5abdfee..0345388359 100644
--- a/xen/arch/x86/mm/Makefile
+++ b/xen/arch/x86/mm/Makefile
@@ -1,7 +1,7 @@
 obj-y += shadow/
 obj-$(CONFIG_HVM) += hap/
 
-obj-$(CONFIG_HVM) += altp2m.o
+obj-$(CONFIG_ALTP2M) += altp2m.o
 obj-$(CONFIG_HVM) += guest_walk_2.o guest_walk_3.o guest_walk_4.o
 obj-$(CONFIG_SHADOW_PAGING) += guest_walk_4.o
 obj-$(CONFIG_MEM_ACCESS) += mem_access.o
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 16:57:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 16:57:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771300.1181894 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZvaS-0000Jn-Hq; Fri, 02 Aug 2024 16:57:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771300.1181894; Fri, 02 Aug 2024 16:57:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZvaS-0000Jf-FB; Fri, 02 Aug 2024 16:57:04 +0000
Received: by outflank-mailman (input) for mailman id 771300;
 Fri, 02 Aug 2024 16:57:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvaR-0000JT-7X
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:57:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvaR-00027O-6k
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:57:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvaR-00058D-63
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:57:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8nPyUgxfvh7GchoUq4fQtXgvJ8majhrAGTGws/V10C0=; b=ViK0IT/QcYHN43qiVwRRJ/OZD1
	4CxC/MVRVNTiD0hsY2XgNnLEVEcBxo6Pzcpab6zJVJ+Ih63yN+AYvtWtDwkpkLtOtYE6Y9Ziz41fg
	0Hnxyjq8o2WeMTF57wUQVDQQ3O3HdgsD/a67NUy2Pzww8m/mZKCf9w7DbyMcEtcSQEKM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: introduce using_{svm,vmx}() helpers
Message-Id: <E1sZvaR-00058D-63@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 16:57:03 +0000

commit 3f7efa20e4f31601657b16e32d1289002aa8ee25
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Thu Aug 1 13:55:39 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 13:55:39 2024 +0200

    x86: introduce using_{svm,vmx}() helpers
    
    As we now have AMD_SVM/INTEL_VMX config options for enabling/disabling these
    features completely in the build, we need some build-time checks to ensure that
    vmx/svm code can be used and things compile. Macros cpu_has_{svm,vmx} used to be
    doing such checks at runtime, however they do not check if SVM/VMX support is
    enabled in the build.
    
    Also cpu_has_{svm,vmx} can potentially be called from non-{VMX,SVM} build
    yet running on {VMX,SVM}-enabled CPU, so would correctly indicate that VMX/SVM
    is indeed supported by CPU, but code to drive it can't be used.
    
    New routines using_{vmx,svm}() indicate that both CPU _and_ build provide
    corresponding technology support, while cpu_has_{vmx,svm} still remains for
    informational runtime purpose, just as their naming suggests.
    
    These new helpers are used right away in several sites, namely guard calls to
    start_nested_{svm,vmx} and start_{svm,vmx} to fix a build when INTEL_VMX=n or
    AMD_SVM=n.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c             |  4 ++--
 xen/arch/x86/hvm/nestedhvm.c       |  4 ++--
 xen/arch/x86/include/asm/hvm/hvm.h | 10 ++++++++++
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index d7f195ba9a..9f37db494d 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -155,9 +155,9 @@ static int __init cf_check hvm_enable(void)
 {
     const struct hvm_function_table *fns = NULL;
 
-    if ( cpu_has_vmx )
+    if ( using_vmx() )
         fns = start_vmx();
-    else if ( cpu_has_svm )
+    else if ( using_svm() )
         fns = start_svm();
 
     if ( fns == NULL )
diff --git a/xen/arch/x86/hvm/nestedhvm.c b/xen/arch/x86/hvm/nestedhvm.c
index d895a73844..bddd77d810 100644
--- a/xen/arch/x86/hvm/nestedhvm.c
+++ b/xen/arch/x86/hvm/nestedhvm.c
@@ -155,9 +155,9 @@ static int __init cf_check nestedhvm_setup(void)
      * done, so that if (for example) HAP is disabled, nested virt is
      * disabled as well.
      */
-    if ( cpu_has_vmx )
+    if ( using_vmx() )
         start_nested_vmx(&hvm_funcs);
-    else if ( cpu_has_svm )
+    else if ( using_svm() )
         start_nested_svm(&hvm_funcs);
 
     return 0;
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 34824af6df..518ba5319b 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -363,6 +363,16 @@ int hvm_copy_context_and_params(struct domain *dst, struct domain *src);
 
 int hvm_get_param(struct domain *d, uint32_t index, uint64_t *value);
 
+static inline bool using_vmx(void)
+{
+    return IS_ENABLED(CONFIG_INTEL_VMX) && cpu_has_vmx;
+}
+
+static inline bool using_svm(void)
+{
+    return IS_ENABLED(CONFIG_AMD_SVM) && cpu_has_svm;
+}
+
 #ifdef CONFIG_HVM
 
 #define hvm_get_guest_tsc(v) hvm_get_guest_tsc_fixed(v, 0)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 16:57:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 16:57:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771301.1181897 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZvac-0000Mj-JK; Fri, 02 Aug 2024 16:57:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771301.1181897; Fri, 02 Aug 2024 16:57:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZvac-0000Mb-Gr; Fri, 02 Aug 2024 16:57:14 +0000
Received: by outflank-mailman (input) for mailman id 771301;
 Fri, 02 Aug 2024 16:57:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvab-0000MP-AQ
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:57:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvab-00027o-9c
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:57:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvab-00058q-8p
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:57:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=chzNX13Ftj0Sy/C1NvuqB2KuUXHbS1+JOobYy6hQT+E=; b=xchyOVpo1aFJ1RYTa8iPHarUan
	ar2GfK1lQgEbeEAu+xgvWX9HdATD4isjDYpbOW7ooN3YtNxlND0y07r8i7PoSpkgnIi6g31pqDdMN
	o6UoU3ZqYvBWkGD65bWAuA96ACVcZ4xvvez+MR3F63Ga+AicND8g5Iic8kVUEOt9a4zA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/p2m: guard EPT functions with using_vmx() check
Message-Id: <E1sZvab-00058q-8p@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 16:57:13 +0000

commit e961970ae2d6aec1dc826b29df7045192e9ee9ec
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Thu Aug 1 13:56:09 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 13:56:09 2024 +0200

    x86/p2m: guard EPT functions with using_vmx() check
    
    Replace cpu_has_vmx check with using_vmx(), so that DCE would remove calls
    to functions ept_p2m_init() and ept_p2m_uninit() on non-VMX build.
    Since currently Intel EPT implementation depends on CONFIG_INTEL_VMX config
    option, when VMX is off these functions are unavailable.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm/p2m-basic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/p2m-basic.c b/xen/arch/x86/mm/p2m-basic.c
index 08007a687c..e126fda267 100644
--- a/xen/arch/x86/mm/p2m-basic.c
+++ b/xen/arch/x86/mm/p2m-basic.c
@@ -40,7 +40,7 @@ static int p2m_initialise(struct domain *d, struct p2m_domain *p2m)
     p2m_pod_init(p2m);
     p2m_nestedp2m_init(p2m);
 
-    if ( hap_enabled(d) && cpu_has_vmx )
+    if ( hap_enabled(d) && using_vmx() )
         ret = ept_p2m_init(p2m);
     else
         p2m_pt_init(p2m);
@@ -72,7 +72,7 @@ struct p2m_domain *p2m_init_one(struct domain *d)
 void p2m_free_one(struct p2m_domain *p2m)
 {
     p2m_free_logdirty(p2m);
-    if ( hap_enabled(p2m->domain) && cpu_has_vmx )
+    if ( hap_enabled(p2m->domain) && using_vmx() )
         ept_p2m_uninit(p2m);
     free_cpumask_var(p2m->dirty_cpumask);
     xfree(p2m);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 16:57:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 16:57:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771302.1181901 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZvam-0000R2-Kc; Fri, 02 Aug 2024 16:57:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771302.1181901; Fri, 02 Aug 2024 16:57:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZvam-0000Qv-IF; Fri, 02 Aug 2024 16:57:24 +0000
Received: by outflank-mailman (input) for mailman id 771302;
 Fri, 02 Aug 2024 16:57:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZval-0000Qm-DC
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:57:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZval-000283-CU
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:57:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZval-00059Q-Bp
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:57:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZHQQWHDlNgH7n59xj/389NEAcC5T1Oi09Ze/EJRZLfY=; b=MZn46oLK7bd3nWQi60lDZNHSdf
	sO7rwzNf+Lb2x/cMtoSRdN7BZf9SPLHNkijt0j03fHrE9BYo20tjimC1pWIJm2uaIOR4z09h8obwN
	4cGfbEJjOcbCe091Mldr4NNwSTIVOuOHC8C+SVAu8w35xHwLy/gHpXi3XYAssWpjuxmc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/traps: guard vmx specific functions with usinc_vmx() check
Message-Id: <E1sZval-00059Q-Bp@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 16:57:23 +0000

commit 6b70f0ba99122424c5dce48f94f8226a6557a69b
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Thu Aug 1 13:56:34 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 13:56:34 2024 +0200

    x86/traps: guard vmx specific functions with usinc_vmx() check
    
    Replace cpu_has_vmx check with using_vmx(), so that not only VMX support in CPU
    is being checked at runtime, but also at build time we ensure the availability
    of functions vmx_vmcs_enter() & vmx_vmcs_exit().
    
    Also since CONFIG_VMX is checked in using_vmx and it depends on CONFIG_HVM,
    we can drop #ifdef CONFIG_HVM lines around using_vmx.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/traps.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index a981b6c2e8..552a07e6aa 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -676,7 +676,6 @@ void vcpu_show_execution_state(struct vcpu *v)
 
     vcpu_pause(v); /* acceptably dangerous */
 
-#ifdef CONFIG_HVM
     /*
      * For VMX special care is needed: Reading some of the register state will
      * require VMCS accesses. Engaging foreign VMCSes involves acquiring of a
@@ -684,12 +683,11 @@ void vcpu_show_execution_state(struct vcpu *v)
      * region. Despite this being a layering violation, engage the VMCS right
      * here. This then also avoids doing so several times in close succession.
      */
-    if ( cpu_has_vmx && is_hvm_vcpu(v) )
+    if ( using_vmx() && is_hvm_vcpu(v) )
     {
         ASSERT(!in_irq());
         vmx_vmcs_enter(v);
     }
-#endif
 
     /* Prevent interleaving of output. */
     flags = console_lock_recursive_irqsave();
@@ -714,10 +712,8 @@ void vcpu_show_execution_state(struct vcpu *v)
         console_unlock_recursive_irqrestore(flags);
     }
 
-#ifdef CONFIG_HVM
-    if ( cpu_has_vmx && is_hvm_vcpu(v) )
+    if ( using_vmx() && is_hvm_vcpu(v) )
         vmx_vmcs_exit(v);
-#endif
 
     vcpu_unpause(v);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 16:57:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 16:57:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771303.1181906 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZvaw-0000Ta-Mc; Fri, 02 Aug 2024 16:57:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771303.1181906; Fri, 02 Aug 2024 16:57:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZvaw-0000TS-Jg; Fri, 02 Aug 2024 16:57:34 +0000
Received: by outflank-mailman (input) for mailman id 771303;
 Fri, 02 Aug 2024 16:57:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvav-0000TJ-G2
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:57:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvav-00028D-FH
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:57:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvav-0005A3-Eg
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:57:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Bicg2TC/KtEYIJLuOs0eMem7E6ww/je5blAbdY+vT18=; b=klxQCFik8NaEa40Yx+NcunpvfZ
	DxCmy/zYpurTPnfJ13d2VAztnmOrCkwDNsMaeAuoaQW+uKvKh3RY9ctiUBbAAGyXNWhKadwDSbXYn
	LZYtZhoAySdRMT4Q2BXwhIWC/xlc4TY1GMjF5KXwXeGAK3gAQDINkdxVpBwmyj46i09A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/PV: guard svm specific functions with using_svm() check
Message-Id: <E1sZvav-0005A3-Eg@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 16:57:33 +0000

commit 23bb8addf28b9f405aaa3a07aa840b2856340e41
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Thu Aug 1 13:57:09 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 13:57:09 2024 +0200

    x86/PV: guard svm specific functions with using_svm() check
    
    Replace cpu_has_svm check with using_svm(), so that not only SVM support in CPU
    is being checked at runtime, but also at build time we ensure the availability
    of functions svm_load_segs() and svm_load_segs_prefetch().
    
    Since SVM depends on HVM, it can be used alone.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domain.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index c71b9023cb..d977ec71ca 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1720,11 +1720,9 @@ static void load_segments(struct vcpu *n)
         if ( !(n->arch.flags & TF_kernel_mode) )
             SWAP(gsb, gss);
 
-#ifdef CONFIG_HVM
-        if ( cpu_has_svm && (uregs->fs | uregs->gs) <= 3 )
+        if ( using_svm() && (uregs->fs | uregs->gs) <= 3 )
             fs_gs_done = svm_load_segs(n->arch.pv.ldt_ents, LDT_VIRT_START(n),
                                        n->arch.pv.fs_base, gsb, gss);
-#endif
     }
 
     if ( !fs_gs_done )
@@ -2037,9 +2035,9 @@ static void __context_switch(void)
 
     write_ptbase(n);
 
-#if defined(CONFIG_PV) && defined(CONFIG_HVM)
+#ifdef CONFIG_PV
     /* Prefetch the VMCB if we expect to use it later in the context switch */
-    if ( cpu_has_svm && is_pv_64bit_domain(nd) && !is_idle_domain(nd) )
+    if ( using_svm() && is_pv_64bit_domain(nd) && !is_idle_domain(nd) )
         svm_load_segs_prefetch();
 #endif
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 16:57:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 16:57:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771304.1181909 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZvb6-0000WC-No; Fri, 02 Aug 2024 16:57:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771304.1181909; Fri, 02 Aug 2024 16:57: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 1sZvb6-0000W4-L6; Fri, 02 Aug 2024 16:57:44 +0000
Received: by outflank-mailman (input) for mailman id 771304;
 Fri, 02 Aug 2024 16:57:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvb5-0000Vw-Ju
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:57:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvb5-00028N-J8
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:57:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvb5-0005Af-HO
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:57: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ixAiWsCuIwGvdyvl+T3IXJIjm0cWmeHjZiujU0pU8Ss=; b=dweAGVxFQyyOwT42DfswAZNwHI
	vdgG7bxtZ/dam3v/fHpR308FRMOWaQRTWIkGetcSjj+K/QhNhCn7SPwF0wvIcP/sh1E5fSeHtlxut
	vb1VbrngkU4ZRLvrY9oYiwC5XWwpeqTWbYsxJM0YnGZ7qciV31MMjEfnCwksS7+I6JW8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/oprofile: guard svm specific symbols with CONFIG_AMD_SVM
Message-Id: <E1sZvb5-0005Af-HO@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 16:57:43 +0000

commit 29fce29d892e1b760e32d5f4615a95914b701cf4
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Thu Aug 1 13:57:28 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 13:57:28 2024 +0200

    x86/oprofile: guard svm specific symbols with CONFIG_AMD_SVM
    
    The symbol svm_stgi_label is AMD-V specific so guard its usage in common code
    with CONFIG_AMD_SVM.
    
    Since SVM depends on HVM, it can be used alone.
    Also, use #ifdef instead of #if.
    
    No functional change intended.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/oprofile/op_model_athlon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/oprofile/op_model_athlon.c b/xen/arch/x86/oprofile/op_model_athlon.c
index 69fd3fcc86..782fa606ee 100644
--- a/xen/arch/x86/oprofile/op_model_athlon.c
+++ b/xen/arch/x86/oprofile/op_model_athlon.c
@@ -320,7 +320,7 @@ static int cf_check athlon_check_ctrs(
 	struct vcpu *v = current;
 	unsigned int const nr_ctrs = model->num_counters;
 
-#if CONFIG_HVM
+#ifdef CONFIG_AMD_SVM
 	struct cpu_user_regs *guest_regs = guest_cpu_user_regs();
 
 	if (!guest_mode(regs) &&
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 16:57:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 16:57:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771305.1181914 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZvbG-0000Yu-PJ; Fri, 02 Aug 2024 16:57:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771305.1181914; Fri, 02 Aug 2024 16:57: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 1sZvbG-0000Ym-Mk; Fri, 02 Aug 2024 16:57:54 +0000
Received: by outflank-mailman (input) for mailman id 771305;
 Fri, 02 Aug 2024 16:57:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvbF-0000Ye-Nl
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:57:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvbF-00028W-Lx
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:57:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZvbF-0005BA-LE
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 16:57: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZsDp2WH98R8z/RjIl53/jd8K7SPUn53yoaoaFyZkGFE=; b=bT0P8L288SD1Vfl6jW8l0CIUVb
	oNYF6ix/QoZ4rc7eQcRx77XlJzynqxGWnLRiWDhiSupsEvpsswK5jZ0oeYaKD/GjBWMKlQIOpl7E3
	pW+bF+PMPEjeO454331jODJIat7t//ZfdY7Xsn82UrDjLiI0etMNC6BZ1BzJtzOB+8Js=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vmx: replace CONFIG_HVM with CONFIG_INTEL_VMX in vmx.h
Message-Id: <E1sZvbF-0005BA-LE@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 16:57:53 +0000

commit 1c4fb9bb49b7babbcaa0b62384841ba4acb49356
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Thu Aug 1 13:57:52 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 1 13:57:52 2024 +0200

    x86/vmx: replace CONFIG_HVM with CONFIG_INTEL_VMX in vmx.h
    
    As now we got a separate config option for VMX which itself depends on
    CONFIG_HVM, we need to use it to provide vmx_pi_hooks_{assign,deassign}
    stubs for case when VMX is disabled while HVM is enabled.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/hvm/vmx/vmx.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmx.h b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
index 1489dd05c2..f0ec459622 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
@@ -599,7 +599,7 @@ void vmx_pi_desc_fixup(unsigned int cpu);
 
 void vmx_sync_exit_bitmap(struct vcpu *v);
 
-#ifdef CONFIG_HVM
+#ifdef CONFIG_INTEL_VMX
 void vmx_pi_hooks_assign(struct domain *d);
 void vmx_pi_hooks_deassign(struct domain *d);
 #else
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 21:33:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 21:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771342.1181947 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZztY-0006Pm-SI; Fri, 02 Aug 2024 21:33:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771342.1181947; Fri, 02 Aug 2024 21:33: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 1sZztY-0006Pf-Po; Fri, 02 Aug 2024 21:33:04 +0000
Received: by outflank-mailman (input) for mailman id 771342;
 Fri, 02 Aug 2024 21:33:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZztX-0006PZ-Uz
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 21:33:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZztX-0006ol-J5
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 21:33:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZztX-0007Zb-H6
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 21:33: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hFnJys2aQgvjv+mVbU0xu1SxovT59SBSzHdj+GyFTck=; b=sojuYu0736h4jQ9HKXfA+3SB2q
	omkPFOFfBSTRML2ajR1MJSOxRYC3PYDiJuYqet2nfkcEN0mcFQmOQty6m4FTGi/lZqJoM2NC/h1S5
	1N1zUH5LwMaayXckEXZ9YD3k6tL4yQRLdrqKhrNkvxFt5Pk1M/8udH5RW7XjFAhV+sus=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation/eclair_analysis: add Rule 18.6 to the clean guidelines
Message-Id: <E1sZztX-0007Zb-H6@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 21:33:03 +0000

commit f2158c59245027abcebf72f250dac7ff8817ffaf
Author:     Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Wed Jul 31 14:41:52 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 2 14:24:30 2024 -0700

    automation/eclair_analysis: add Rule 18.6 to the clean guidelines
    
    MISRA C Rule 18.6 states: "The address of an object with automatic
    storage shall not be copied to another object that persists after
    the first object has ceased to exist."
    
    The rule is set as monitored and tagged clean, in order to block
    the CI on any violations that may arise, allowing the presence
    of cautions (currently there are no violations).
    
    No functional change.
    
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/monitored.ecl | 1 +
 automation/eclair_analysis/ECLAIR/tagging.ecl   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/automation/eclair_analysis/ECLAIR/monitored.ecl b/automation/eclair_analysis/ECLAIR/monitored.ecl
index 9ffaebbdc3..8a7e3f3cea 100644
--- a/automation/eclair_analysis/ECLAIR/monitored.ecl
+++ b/automation/eclair_analysis/ECLAIR/monitored.ecl
@@ -32,6 +32,7 @@
 -enable=MC3R1.R17.4
 -enable=MC3R1.R17.5
 -enable=MC3R1.R17.6
+-enable=MC3R1.R18.6
 -enable=MC3R1.R19.1
 -enable=MC3R1.R20.12
 -enable=MC3R1.R20.13
diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index b829655ca0..e7b32773e6 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -67,6 +67,7 @@ MC3R1.R17.3||
 MC3R1.R17.4||
 MC3R1.R17.5||
 MC3R1.R17.6||
+MC3R1.R18.6||
 MC3R1.R18.8||
 MC3R1.R20.2||
 MC3R1.R20.3||
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 02 21:33:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 02 Aug 2024 21:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771343.1181952 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sZzti-0006Rg-UN; Fri, 02 Aug 2024 21:33:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771343.1181952; Fri, 02 Aug 2024 21:33: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 1sZzti-0006RW-RN; Fri, 02 Aug 2024 21:33:14 +0000
Received: by outflank-mailman (input) for mailman id 771343;
 Fri, 02 Aug 2024 21:33:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZzth-0006RO-OM
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 21:33:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZzth-0006p8-NU
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 21:33:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sZzth-0007bI-LC
 for xen-changelog@lists.xenproject.org; Fri, 02 Aug 2024 21:33: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2/QBcw/Hhm77C7A42RfFMAeR0+1He2azhFxKOnFEkZc=; b=BnowJYtjO/nJZfFpO43x+fI+4H
	M9E7M3UpSqyxkYuKnzJNmi7jDd5PGwuJGCeErB9kaftwkuW9tFhmNd4Z162NX7xVWdryIWsoTfAym
	V1uHIc9DxW6Flw422WFJp942fNSui/JaKtUfEFd+Bz55V7cz/4S9hd7hDghxKoP9TrJY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs/misra: add R13.2 and R18.2 to rules.rst
Message-Id: <E1sZzth-0007bI-LC@xenbits.xenproject.org>
Date: Fri, 02 Aug 2024 21:33:13 +0000

commit ded5474718a84366dac80aae039a693b66fa7e2e
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Thu Aug 1 12:19:58 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 2 14:25:18 2024 -0700

    docs/misra: add R13.2 and R18.2 to rules.rst
    
    Add MISRA C rules 13.2 and 18.2 to rules.rst. Both rules have zero
    violations reported by Eclair but they have some cautions. We accept
    both rules and for now we'll enable scanning for them in Eclair but only
    violations will cause the Gitlab CI job to fail (cautions will not.)
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/misra/rules.rst | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index 7b366edb07..e99cb81089 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -462,6 +462,16 @@ maintainers if you want to suggest a change.
      - Initializer lists shall not contain persistent side effects
      -
 
+   * - `Rule 13.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_13_02.c>`_
+     - Required
+     - The value of an expression and its persistent side-effects shall
+       be the same under all permitted evaluation orders
+     - Be aware that the static analysis tool Eclair might report
+       several findings for Rule 13.2 of type "caution". These are
+       instances where Eclair is unable to verify that the code is valid
+       in regard to Rule 13.2. Caution reports might not be violations.
+       The rule should be followed in any case in new code submitted.
+
    * - `Rule 13.6 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_13_06.c>`_
      - Required
      - The operand of the sizeof operator shall not contain any
@@ -583,6 +593,16 @@ maintainers if you want to suggest a change.
        submitting new patches please try to decrease the number of
        violations when possible.
 
+   * - `Rule 18.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_18_02.c>`_
+     - Required
+     - Subtraction between pointers shall only be applied to pointers
+       that address elements of the same array
+     - Be aware that the static analysis tool Eclair might report
+       several findings for Rule 18.2 of type "caution". These are
+       instances where Eclair is unable to verify that the code is valid
+       in regard to Rule 18.2. Caution reports might not be violations.
+       The rule should be followed in any case in new code submitted.
+
    * - `Rule 18.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_18_03.c>`_
      - Required
      - The relational operators > >= < and <= shall not be applied to objects of pointer type except where they point into the same object
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Aug 03 07:55:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Aug 2024 07:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771436.1182010 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sa9be-0005EG-D4; Sat, 03 Aug 2024 07:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771436.1182010; Sat, 03 Aug 2024 07: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 1sa9be-0005E9-A3; Sat, 03 Aug 2024 07:55:14 +0000
Received: by outflank-mailman (input) for mailman id 771436;
 Sat, 03 Aug 2024 07:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sa9bc-0005E1-8M
 for xen-changelog@lists.xenproject.org; Sat, 03 Aug 2024 07:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sa9bc-0005G9-7P
 for xen-changelog@lists.xenproject.org; Sat, 03 Aug 2024 07:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sa9bc-0006jl-62
 for xen-changelog@lists.xenproject.org; Sat, 03 Aug 2024 07: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=I1V7mqMAmHasuM5yMkufgkscHUph8R1yNQX6sKFJIIE=; b=oZ55N0HaKsSLxKE3pDn6vOs7oT
	apidnmNRpeI+rZamlrWWIxeeaIPZcpR9cLEvYIpNaLE/FKkZYFW9T8XvEd4yzwsAmw/EhH8TdSPye
	sC29VuuIV3Cpui4IOVYNQcn7bVt6285By8JYkzUNs++ZnecMJ2iCubg/FDZeK3BWe3Gs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: drop Xeon Phi support
Message-Id: <E1sa9bc-0006jl-62@xenbits.xenproject.org>
Date: Sat, 03 Aug 2024 07:55:12 +0000

commit 85191cf32180c920b292963053774e4540284d66
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Aug 2 08:43:25 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 2 08:43:25 2024 +0200

    x86: drop Xeon Phi support
    
    Do as was decided in Lisbon. Reportedly Xen hasn't been working very
    well on those processors anyway.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 CHANGELOG.md                                 |   2 +
 SUPPORT.md                                   |   1 +
 tools/tests/x86_emulator/Makefile            |   5 +-
 tools/tests/x86_emulator/evex-disp8.c        |  36 --------
 tools/tests/x86_emulator/test_x86_emulator.c |  85 -----------------
 tools/tests/x86_emulator/x86-emulate.c       |   1 -
 tools/tests/x86_emulator/x86-emulate.h       |   3 -
 xen/arch/x86/acpi/cpu_idle.c                 |  13 ---
 xen/arch/x86/cpu/mcheck/mce_intel.c          |   2 -
 xen/arch/x86/cpu/mwait-idle.c                |  22 -----
 xen/arch/x86/hvm/vmx/vmx.c                   |  11 ---
 xen/arch/x86/include/asm/cpufeature.h        |   3 -
 xen/arch/x86/include/asm/intel-family.h      |   9 +-
 xen/arch/x86/spec_ctrl.c                     |  23 -----
 xen/arch/x86/x86_emulate/private.h           |   4 -
 xen/arch/x86/x86_emulate/x86_emulate.c       | 132 ---------------------------
 xen/include/public/arch-x86/cpufeatureset.h  |   8 +-
 17 files changed, 10 insertions(+), 350 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 92f5825bff..eeaaa8b274 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ### Added
 
 ### Removed
+ - On x86:
+   - Support for running on Xeon Phi processors.
 
 ## [4.19.0](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=RELEASE-4.19.0) - 2024-07-29
 
diff --git a/SUPPORT.md b/SUPPORT.md
index bd4316523d..0c36cb2ed4 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -30,6 +30,7 @@ supported in this document.
 ### x86-64
 
     Status: Supported
+    Status, Xeon Phi: Not supported.
 
 ### ARM v7 + Virtualization Extensions
 
diff --git a/tools/tests/x86_emulator/Makefile b/tools/tests/x86_emulator/Makefile
index 834b2112e7..294d27ebaa 100644
--- a/tools/tests/x86_emulator/Makefile
+++ b/tools/tests/x86_emulator/Makefile
@@ -16,7 +16,7 @@ vpath %.c $(XEN_ROOT)/xen/lib/x86
 
 CFLAGS += $(CFLAGS_xeninclude)
 
-SIMD := 3dnow sse sse2 sse4 avx avx2 xop avx512f avx512bw avx512dq avx512er avx512vbmi avx512fp16
+SIMD := 3dnow sse sse2 sse4 avx avx2 xop avx512f avx512bw avx512dq avx512vbmi avx512fp16
 FMA := fma4 fma
 SG := avx2-sg avx512f-sg
 AES := ssse3-aes avx-aes avx2-vaes avx512bw-vaes
@@ -80,9 +80,6 @@ avx512bw-flts :=
 avx512dq-vecs := $(avx512f-vecs)
 avx512dq-ints := $(avx512f-ints)
 avx512dq-flts := $(avx512f-flts)
-avx512er-vecs := 64
-avx512er-ints :=
-avx512er-flts := 4 8
 avx512vbmi-vecs := $(avx512bw-vecs)
 avx512vbmi-ints := $(avx512bw-ints)
 avx512vbmi-flts := $(avx512bw-flts)
diff --git a/tools/tests/x86_emulator/evex-disp8.c b/tools/tests/x86_emulator/evex-disp8.c
index 9984e6d714..902e157bd4 100644
--- a/tools/tests/x86_emulator/evex-disp8.c
+++ b/tools/tests/x86_emulator/evex-disp8.c
@@ -524,37 +524,6 @@ static const struct test avx512dq_512[] = {
     INSN(inserti32x8,    66, 0f3a, 3a, el_8, d, vl),
 };
 
-static const struct test avx512er_512[] = {
-    INSN(exp2,    66, 0f38, c8, vl, sd, vl),
-    INSN(rcp28,   66, 0f38, ca, vl, sd, vl),
-    INSN(rcp28,   66, 0f38, cb, el, sd, el),
-    INSN(rsqrt28, 66, 0f38, cc, vl, sd, vl),
-    INSN(rsqrt28, 66, 0f38, cd, el, sd, el),
-};
-
-static const struct test avx512pf_512[] = {
-    INSNX(gatherpf0d,  66, 0f38, c6, 1, vl, sd, el),
-    INSNX(gatherpf0q,  66, 0f38, c7, 1, vl, sd, el),
-    INSNX(gatherpf1d,  66, 0f38, c6, 2, vl, sd, el),
-    INSNX(gatherpf1q,  66, 0f38, c7, 2, vl, sd, el),
-    INSNX(scatterpf0d, 66, 0f38, c6, 5, vl, sd, el),
-    INSNX(scatterpf0q, 66, 0f38, c7, 5, vl, sd, el),
-    INSNX(scatterpf1d, 66, 0f38, c6, 6, vl, sd, el),
-    INSNX(scatterpf1q, 66, 0f38, c7, 6, vl, sd, el),
-};
-
-static const struct test avx512_4fmaps_512[] = {
-    INSN(4fmaddps,  f2, 0f38, 9a, el_4, d, vl),
-    INSN(4fmaddss,  f2, 0f38, 9b, el_4, d, vl),
-    INSN(4fnmaddps, f2, 0f38, aa, el_4, d, vl),
-    INSN(4fnmaddss, f2, 0f38, ab, el_4, d, vl),
-};
-
-static const struct test avx512_4vnniw_512[] = {
-    INSN(p4dpwssd,  f2, 0f38, 52, el_4, d, vl),
-    INSN(p4dpwssds, f2, 0f38, 53, el_4, d, vl),
-};
-
 static const struct test avx512_bf16_all[] = {
     INSN(cvtne2ps2bf16, f2, 0f38, 72, vl, d, vl),
     INSN(cvtneps2bf16,  f3, 0f38, 72, vl, d, vl),
@@ -1110,11 +1079,6 @@ void evex_disp8_test(void *instr, struct x86_emulate_ctxt *ctxt,
     RUN(avx512dq, 128);
     RUN(avx512dq, no128);
     RUN(avx512dq, 512);
-    RUN(avx512er, 512);
-#define cpu_has_avx512pf cpu_has_avx512f
-    RUN(avx512pf, 512);
-    RUN(avx512_4fmaps, 512);
-    RUN(avx512_4vnniw, 512);
     RUN(avx512_bf16, all);
     RUN(avx512_bitalg, all);
     RUN(avx512_ifma, all);
diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index 41002909f5..2d52d21742 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -39,7 +39,6 @@ asm ( ".pushsection .test, \"ax\", @progbits; .popsection" );
 #include "avx512bw-vpclmulqdq.h"
 #include "avx512bw-gf.h"
 #include "avx512dq.h"
-#include "avx512er.h"
 #include "avx512vbmi.h"
 #include "avx512vbmi2-vpclmulqdq.h"
 #include "avx512fp16.h"
@@ -147,11 +146,6 @@ static bool simd_check_avx512dq_vl(void)
     return cpu_has_avx512dq && cpu_has_avx512vl;
 }
 
-static bool simd_check_avx512er(void)
-{
-    return cpu_has_avx512er;
-}
-
 static bool simd_check_avx512bw(void)
 {
     return cpu_has_avx512bw;
@@ -507,10 +501,6 @@ static const struct {
     AVX512VL(DQ+VL u64x2,    avx512dq,      16u8),
     AVX512VL(DQ+VL s64x4,    avx512dq,      32i8),
     AVX512VL(DQ+VL u64x4,    avx512dq,      32u8),
-    SIMD(AVX512ER f32 scalar,avx512er,        f4),
-    SIMD(AVX512ER f32x16,    avx512er,      64f4),
-    SIMD(AVX512ER f64 scalar,avx512er,        f8),
-    SIMD(AVX512ER f64x8,     avx512er,      64f8),
     SIMD(AVX512_VBMI s8x64,  avx512vbmi,    64i1),
     SIMD(AVX512_VBMI u8x64,  avx512vbmi,    64u1),
     SIMD(AVX512_VBMI s16x32, avx512vbmi,    64i2),
@@ -4983,81 +4973,6 @@ int main(int argc, char **argv)
     }
 #endif
 
-    printf("%-40s", "Testing v4fmaddps 32(%ecx),%zmm4,%zmm4{%k5}...");
-    if ( stack_exec && cpu_has_avx512_4fmaps )
-    {
-        decl_insn(v4fmaddps);
-        static const struct {
-            float f[16];
-        } in = {{
-            1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16
-        }}, out = {{
-            1 + 1 * 9 + 2 * 10 + 3 * 11 + 4 * 12,
-            2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
-            16 + 16 * 9 + 17 * 10 + 18 * 11 + 19 * 12
-        }};
-
-        asm volatile ( "vmovups %1, %%zmm4\n\t"
-                       "vbroadcastss %%xmm4, %%zmm7\n\t"
-                       "vaddps %%zmm4, %%zmm7, %%zmm5\n\t"
-                       "vaddps %%zmm5, %%zmm7, %%zmm6\n\t"
-                       "vaddps %%zmm6, %%zmm7, %%zmm7\n\t"
-                       "kmovw %2, %%k5\n"
-                       put_insn(v4fmaddps,
-                                "v4fmaddps 32(%0), %%zmm4, %%zmm4%{%%k5%}")
-                       :: "c" (NULL), "m" (in), "rmk" (0x8001) );
-
-        set_insn(v4fmaddps);
-        regs.ecx = (unsigned long)&in;
-        rc = x86_emulate(&ctxt, &emulops);
-        if ( rc != X86EMUL_OKAY || !check_eip(v4fmaddps) )
-            goto fail;
-
-        asm ( "vcmpeqps %1, %%zmm4, %%k0\n\t"
-              "kmovw %%k0, %0" : "=g" (rc) : "m" (out) );
-        if ( rc != 0xffff )
-            goto fail;
-        printf("okay\n");
-    }
-    else
-        printf("skipped\n");
-
-    printf("%-40s", "Testing v4fnmaddss 16(%edx),%zmm4,%zmm4{%k3}...");
-    if ( stack_exec && cpu_has_avx512_4fmaps )
-    {
-        decl_insn(v4fnmaddss);
-        static const struct {
-            float f[16];
-        } in = {{
-            1, 2, 3, 4, 5, 6, 7, 8
-        }}, out = {{
-            1 - 1 * 5 - 2 * 6 - 3 * 7 - 4 * 8, 2, 3, 4
-        }};
-
-        asm volatile ( "vmovups %1, %%xmm4\n\t"
-                       "vaddss %%xmm4, %%xmm4, %%xmm5\n\t"
-                       "vaddss %%xmm5, %%xmm4, %%xmm6\n\t"
-                       "vaddss %%xmm6, %%xmm4, %%xmm7\n\t"
-                       "kmovw %2, %%k3\n"
-                       put_insn(v4fnmaddss,
-                                "v4fnmaddss 16(%0), %%xmm4, %%xmm4%{%%k3%}")
-                       :: "d" (NULL), "m" (in), "rmk" (1) );
-
-        set_insn(v4fnmaddss);
-        regs.edx = (unsigned long)&in;
-        rc = x86_emulate(&ctxt, &emulops);
-        if ( rc != X86EMUL_OKAY || !check_eip(v4fnmaddss) )
-            goto fail;
-
-        asm ( "vcmpeqps %1, %%zmm4, %%k0\n\t"
-              "kmovw %%k0, %0" : "=g" (rc) : "m" (out) );
-        if ( rc != 0xffff )
-            goto fail;
-        printf("okay\n");
-    }
-    else
-        printf("skipped\n");
-
     if ( stack_exec && cpu_has_avx512_bf16 )
     {
         decl_insn(vcvtne2ps2bf16);
diff --git a/tools/tests/x86_emulator/x86-emulate.c b/tools/tests/x86_emulator/x86-emulate.c
index d3baaef1d0..70ce15be50 100644
--- a/tools/tests/x86_emulator/x86-emulate.c
+++ b/tools/tests/x86_emulator/x86-emulate.c
@@ -84,7 +84,6 @@ bool emul_test_init(void)
     cp.basic.movbe = true;
     cp.feat.invpcid = true;
     cp.feat.adx = true;
-    cp.feat.avx512pf = cp.feat.avx512f;
     cp.feat.rdpid = true;
     cp.feat.wrmsrns = true;
     cp.extd.clzero = true;
diff --git a/tools/tests/x86_emulator/x86-emulate.h b/tools/tests/x86_emulator/x86-emulate.h
index 8f8accfe3e..d2012ab767 100644
--- a/tools/tests/x86_emulator/x86-emulate.h
+++ b/tools/tests/x86_emulator/x86-emulate.h
@@ -156,7 +156,6 @@ void wrpkru(unsigned int val);
 #define cpu_has_avx512f   (cp.feat.avx512f  && xcr0_mask(0xe6))
 #define cpu_has_avx512dq  (cp.feat.avx512dq && xcr0_mask(0xe6))
 #define cpu_has_avx512_ifma (cp.feat.avx512_ifma && xcr0_mask(0xe6))
-#define cpu_has_avx512er  (cp.feat.avx512er && xcr0_mask(0xe6))
 #define cpu_has_avx512cd  (cp.feat.avx512cd && xcr0_mask(0xe6))
 #define cpu_has_sha        cp.feat.sha
 #define cpu_has_avx512bw  (cp.feat.avx512bw && xcr0_mask(0xe6))
@@ -171,8 +170,6 @@ void wrpkru(unsigned int val);
 #define cpu_has_avx512_vpopcntdq (cp.feat.avx512_vpopcntdq && xcr0_mask(0xe6))
 #define cpu_has_movdiri    cp.feat.movdiri
 #define cpu_has_movdir64b  cp.feat.movdir64b
-#define cpu_has_avx512_4vnniw (cp.feat.avx512_4vnniw && xcr0_mask(0xe6))
-#define cpu_has_avx512_4fmaps (cp.feat.avx512_4fmaps && xcr0_mask(0xe6))
 #define cpu_has_avx512_vp2intersect (cp.feat.avx512_vp2intersect && xcr0_mask(0xe6))
 #define cpu_has_serialize  cp.feat.serialize
 #define cpu_has_avx512_fp16 (cp.feat.avx512_fp16 && xcr0_mask(0xe6))
diff --git a/xen/arch/x86/acpi/cpu_idle.c b/xen/arch/x86/acpi/cpu_idle.c
index 57ac984790..f175e4d7d3 100644
--- a/xen/arch/x86/acpi/cpu_idle.c
+++ b/xen/arch/x86/acpi/cpu_idle.c
@@ -73,7 +73,6 @@
 #define GET_CC3_RES(val)  GET_HW_RES_IN_NS(0x3FC, val)
 #define GET_CC6_RES(val)  GET_HW_RES_IN_NS(0x3FD, val)
 #define GET_CC7_RES(val)  GET_HW_RES_IN_NS(0x3FE, val) /* SNB onwards */
-#define PHI_CC6_RES(val)  GET_HW_RES_IN_NS(0x3FF, val) /* Xeon Phi only */
 
 static void cf_check lapic_timer_nop(void) { }
 void (*__read_mostly lapic_timer_off)(void);
@@ -222,18 +221,6 @@ static void cf_check do_get_hw_residencies(void *arg)
         GET_CC6_RES(hw_res->cc6);
         GET_CC7_RES(hw_res->cc7);
         break;
-    /* Xeon Phi Knights Landing */
-    case 0x57:
-    /* Xeon Phi Knights Mill */
-    case 0x85:
-        GET_CC3_RES(hw_res->mc0); /* abusing GET_CC3_RES */
-        GET_CC6_RES(hw_res->mc6); /* abusing GET_CC6_RES */
-        GET_PC2_RES(hw_res->pc2);
-        GET_PC3_RES(hw_res->pc3);
-        GET_PC6_RES(hw_res->pc6);
-        GET_PC7_RES(hw_res->pc7);
-        PHI_CC6_RES(hw_res->cc6);
-        break;
     /* various Atoms */
     case 0x27:
         GET_PC3_RES(hw_res->pc2); /* abusing GET_PC3_RES */
diff --git a/xen/arch/x86/cpu/mcheck/mce_intel.c b/xen/arch/x86/cpu/mcheck/mce_intel.c
index 9574dedbfd..07b50f8793 100644
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c
@@ -875,10 +875,8 @@ static void intel_init_ppin(const struct cpuinfo_x86 *c)
     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 */
 
         if ( (c != &boot_cpu_data && !ppin_msr) ||
diff --git a/xen/arch/x86/cpu/mwait-idle.c b/xen/arch/x86/cpu/mwait-idle.c
index ae69871171..9c16cc166a 100644
--- a/xen/arch/x86/cpu/mwait-idle.c
+++ b/xen/arch/x86/cpu/mwait-idle.c
@@ -778,22 +778,6 @@ static const struct cpuidle_state avn_cstates[] = {
 	{}
 };
 
-static const struct cpuidle_state knl_cstates[] = {
-	{
-		.name = "C1",
-		.flags = MWAIT2flg(0x00),
-		.exit_latency = 1,
-		.target_residency = 2,
-	},
-	{
-		.name = "C6",
-		.flags = MWAIT2flg(0x10) | CPUIDLE_FLAG_TLB_FLUSHED,
-		.exit_latency = 120,
-		.target_residency = 500,
-	},
-	{}
-};
-
 static struct cpuidle_state __read_mostly bxt_cstates[] = {
 	{
 		.name = "C1",
@@ -1121,10 +1105,6 @@ static const struct idle_cpu idle_cpu_avn = {
 	.c1e_promotion = C1E_PROMOTION_DISABLE,
 };
 
-static const struct idle_cpu idle_cpu_knl = {
-	.state_table = knl_cstates,
-};
-
 static const struct idle_cpu idle_cpu_bxt = {
 	.state_table = bxt_cstates,
 	.c1e_promotion = C1E_PROMOTION_DISABLE,
@@ -1181,8 +1161,6 @@ static const struct x86_cpu_id intel_idle_ids[] __initconstrel = {
 	ICPU(ALDERLAKE,			adl),
 	ICPU(ALDERLAKE_L,		adl_l),
 	ICPU(SAPPHIRERAPIDS_X,		spr),
-	ICPU(XEON_PHI_KNL,		knl),
-	ICPU(XEON_PHI_KNM,		knl),
 	ICPU(ATOM_GOLDMONT,		bxt),
 	ICPU(ATOM_GOLDMONT_PLUS,	bxt),
 	ICPU(ATOM_GOLDMONT_D,		dnv),
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 46911c3e1c..2f7add834a 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -533,10 +533,6 @@ static const struct lbr_info *__init get_model_specific_lbr(void)
             return at_lbr;
         /* Silvermont */
         case 0x37: case 0x4a: case 0x4d: case 0x5a: case 0x5d:
-        /* Xeon Phi Knights Landing */
-        case 0x57:
-        /* Xeon Phi Knights Mill */
-        case 0x85:
         /* Airmont */
         case 0x4c:
             return sm_lbr;
@@ -2985,13 +2981,6 @@ static bool __init has_if_pschange_mc(void)
     case 0x7a: /* Gemini Lake */
     case 0x86: /* Jacobsville */
 
-        /*
-         * Knights processors are not vulnerable.
-         */
-    case 0x57: /* Knights Landing */
-    case 0x85: /* Knights Mill */
-        return false;
-
     default:
         printk("Unrecognised CPU model %#x - assuming vulnerable to IF_PSCHANGE_MC\n",
                boot_cpu_data.x86_model);
diff --git a/xen/arch/x86/include/asm/cpufeature.h b/xen/arch/x86/include/asm/cpufeature.h
index 9bc553681f..dad9ed68aa 100644
--- a/xen/arch/x86/include/asm/cpufeature.h
+++ b/xen/arch/x86/include/asm/cpufeature.h
@@ -140,7 +140,6 @@ static inline bool boot_cpu_has(unsigned int feat)
 #define cpu_has_avx512_ifma     boot_cpu_has(X86_FEATURE_AVX512_IFMA)
 #define cpu_has_clflushopt      boot_cpu_has(X86_FEATURE_CLFLUSHOPT)
 #define cpu_has_clwb            boot_cpu_has(X86_FEATURE_CLWB)
-#define cpu_has_avx512er        boot_cpu_has(X86_FEATURE_AVX512ER)
 #define cpu_has_avx512cd        boot_cpu_has(X86_FEATURE_AVX512CD)
 #define cpu_has_proc_trace      boot_cpu_has(X86_FEATURE_PROC_TRACE)
 #define cpu_has_sha             boot_cpu_has(X86_FEATURE_SHA)
@@ -174,8 +173,6 @@ static inline bool boot_cpu_has(unsigned int feat)
 #define cpu_has_auto_ibrs       boot_cpu_has(X86_FEATURE_AUTO_IBRS)
 
 /* CPUID level 0x00000007:0.edx */
-#define cpu_has_avx512_4vnniw   boot_cpu_has(X86_FEATURE_AVX512_4VNNIW)
-#define cpu_has_avx512_4fmaps   boot_cpu_has(X86_FEATURE_AVX512_4FMAPS)
 #define cpu_has_avx512_vp2intersect boot_cpu_has(X86_FEATURE_AVX512_VP2INTERSECT)
 #define cpu_has_srbds_ctrl      boot_cpu_has(X86_FEATURE_SRBDS_CTRL)
 #define cpu_has_md_clear        boot_cpu_has(X86_FEATURE_MD_CLEAR)
diff --git a/xen/arch/x86/include/asm/intel-family.h b/xen/arch/x86/include/asm/intel-family.h
index b65e9c46b9..d44dd3f69f 100644
--- a/xen/arch/x86/include/asm/intel-family.h
+++ b/xen/arch/x86/include/asm/intel-family.h
@@ -13,8 +13,8 @@
  *	INTEL_FAM6{OPTFAMILY}_{MICROARCH}{OPTDIFF}
  * where:
  * OPTFAMILY	Describes the family of CPUs that this belongs to. Default
- *		is assumed to be "_CORE" (and should be omitted). Other values
- *		currently in use are _ATOM and _XEON_PHI
+ *		is assumed to be "_CORE" (and should be omitted). The other
+ *		value currently in use is _ATOM.
  * MICROARCH	Is the code name for the micro-architecture for this core.
  *		N.B. Not the platform name.
  * OPTDIFF	If needed, a short string to differentiate by market segment.
@@ -164,11 +164,6 @@
 
 #define INTEL_FAM6_ATOM_DARKMONT_X	0xDD /* Clearwater Forest */
 
-/* Xeon Phi */
-
-#define INTEL_FAM6_XEON_PHI_KNL		0x57 /* Knights Landing */
-#define INTEL_FAM6_XEON_PHI_KNM		0x85 /* Knights Mill */
-
 /* Family 5 */
 #define INTEL_FAM5_QUARK_X1000		0x09 /* Quark X1000 SoC */
 
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 6b3631e375..92405b8be7 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -889,11 +889,9 @@ static bool __init retpoline_calculations(void)
     case 0x4d: /* Avaton / Rangely (Silvermont) */
     case 0x4c: /* Cherrytrail / Brasswell */
     case 0x4a: /* Merrifield */
-    case 0x57: /* Knights Landing */
     case 0x5a: /* Moorefield */
     case 0x5c: /* Goldmont */
     case 0x5f: /* Denverton */
-    case 0x85: /* Knights Mill */
         safe = true;
         break;
 
@@ -1007,13 +1005,6 @@ static bool __init should_use_eager_fpu(void)
     case 0x7a: /* Gemini Lake */
         return false;
 
-        /*
-         * Knights processors are not vulnerable.
-         */
-    case 0x57: /* Knights Landing */
-    case 0x85: /* Knights Mill */
-        return false;
-
     default:
         printk("Unrecognised CPU model %#x - assuming vulnerable to LazyFPU\n",
                boot_cpu_data.x86_model);
@@ -1261,13 +1252,6 @@ static __init void l1tf_calculations(void)
         case 0x7a: /* Gemini Lake */
             break;
 
-            /*
-             * Knights processors are not vulnerable.
-             */
-        case 0x57: /* Knights Landing */
-        case 0x85: /* Knights Mill */
-            break;
-
         default:
             /* Defer printk() until we've accounted for RDCL_NO. */
             hit_default = true;
@@ -1418,13 +1402,6 @@ static __init void mds_calculations(void)
     case 0x65: /* SoFIA LTE AOSP */
     case 0x6e: /* Cougar Mountain */
     case 0x75: /* Lightning Mountain */
-        /*
-         * Knights processors (which are based on the Silvermont/Airmont
-         * microarchitecture) are similarly only affected by the Store Buffer
-         * aspect.
-         */
-    case 0x57: /* Knights Landing */
-    case 0x85: /* Knights Mill */
         cpu_has_bug_msbds_only = true;
         break;
 
diff --git a/xen/arch/x86/x86_emulate/private.h b/xen/arch/x86/x86_emulate/private.h
index 0fa26ba00a..a2faa8b29b 100644
--- a/xen/arch/x86/x86_emulate/private.h
+++ b/xen/arch/x86/x86_emulate/private.h
@@ -564,8 +564,6 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 #define vcpu_has_avx512_ifma() (ctxt->cpuid->feat.avx512_ifma)
 #define vcpu_has_clflushopt()  (ctxt->cpuid->feat.clflushopt)
 #define vcpu_has_clwb()        (ctxt->cpuid->feat.clwb)
-#define vcpu_has_avx512pf()    (ctxt->cpuid->feat.avx512pf)
-#define vcpu_has_avx512er()    (ctxt->cpuid->feat.avx512er)
 #define vcpu_has_avx512cd()    (ctxt->cpuid->feat.avx512cd)
 #define vcpu_has_sha()         (ctxt->cpuid->feat.sha)
 #define vcpu_has_avx512bw()    (ctxt->cpuid->feat.avx512bw)
@@ -582,8 +580,6 @@ amd_like(const struct x86_emulate_ctxt *ctxt)
 #define vcpu_has_movdiri()     (ctxt->cpuid->feat.movdiri)
 #define vcpu_has_movdir64b()   (ctxt->cpuid->feat.movdir64b)
 #define vcpu_has_enqcmd()      (ctxt->cpuid->feat.enqcmd)
-#define vcpu_has_avx512_4vnniw() (ctxt->cpuid->feat.avx512_4vnniw)
-#define vcpu_has_avx512_4fmaps() (ctxt->cpuid->feat.avx512_4fmaps)
 #define vcpu_has_avx512_vp2intersect() (ctxt->cpuid->feat.avx512_vp2intersect)
 #define vcpu_has_serialize()   (ctxt->cpuid->feat.serialize)
 #define vcpu_has_tsxldtrk()    (ctxt->cpuid->feat.tsxldtrk)
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 2d5c1de8ec..bf388b7b1e 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6029,7 +6029,6 @@ x86_emulate(
     case X86EMUL_OPC_EVEX_66(0x0f38, 0xbd): /* vfnmadd231s{s,d} xmm/mem,xmm,xmm{k} */
     case X86EMUL_OPC_EVEX_66(0x0f38, 0xbf): /* vfnmsub231s{s,d} xmm/mem,xmm,xmm{k} */
         host_and_vcpu_must_have(avx512f);
-    simd_zmm_scalar_sae:
         generate_exception_if(ea.type != OP_REG && evex.brs, X86_EXC_UD);
         if ( !evex.brs )
             avx512_vlen_check(true);
@@ -6123,15 +6122,6 @@ x86_emulate(
         avx512_vlen_check(true);
         goto simd_zmm;
 
-    case X86EMUL_OPC_EVEX_F2(0x0f38, 0x52): /* vp4dpwssd m128,zmm+3,zmm{k} */
-    case X86EMUL_OPC_EVEX_F2(0x0f38, 0x53): /* vp4dpwssds m128,zmm+3,zmm{k} */
-        host_and_vcpu_must_have(avx512_4vnniw);
-        generate_exception_if((ea.type != OP_MEM || evex.w || evex.brs ||
-                               evex.lr != 2),
-                              X86_EXC_UD);
-        op_mask = op_mask & 0xffff ? 0xf : 0;
-        goto simd_zmm;
-
     case X86EMUL_OPC_EVEX_66(0x0f38, 0x8f): /* vpshufbitqmb [xyz]mm/mem,[xyz]mm,k{k} */
         generate_exception_if(evex.w || !evex.r || !evex.R || evex.z, X86_EXC_UD);
         /* fall through */
@@ -6601,24 +6591,6 @@ x86_emulate(
         host_and_vcpu_must_have(fma);
         goto simd_0f_ymm;
 
-    case X86EMUL_OPC_EVEX_F2(0x0f38, 0x9a): /* v4fmaddps m128,zmm+3,zmm{k} */
-    case X86EMUL_OPC_EVEX_F2(0x0f38, 0xaa): /* v4fnmaddps m128,zmm+3,zmm{k} */
-        host_and_vcpu_must_have(avx512_4fmaps);
-        generate_exception_if((ea.type != OP_MEM || evex.w || evex.brs ||
-                               evex.lr != 2),
-                              X86_EXC_UD);
-        op_mask = op_mask & 0xffff ? 0xf : 0;
-        goto simd_zmm;
-
-    case X86EMUL_OPC_EVEX_F2(0x0f38, 0x9b): /* v4fmaddss m128,xmm+3,xmm{k} */
-    case X86EMUL_OPC_EVEX_F2(0x0f38, 0xab): /* v4fnmaddss m128,xmm+3,xmm{k} */
-        host_and_vcpu_must_have(avx512_4fmaps);
-        generate_exception_if((ea.type != OP_MEM || evex.w || evex.brs ||
-                               evex.lr == 3),
-                              X86_EXC_UD);
-        op_mask = op_mask & 1 ? 0xf : 0;
-        goto simd_zmm;
-
     case X86EMUL_OPC_EVEX_66(0x0f38, 0xa0): /* vpscatterd{d,q} [xyz]mm,mem{k} */
     case X86EMUL_OPC_EVEX_66(0x0f38, 0xa1): /* vpscatterq{d,q} [xyz]mm,mem{k} */
     case X86EMUL_OPC_EVEX_66(0x0f38, 0xa2): /* vscatterdp{s,d} [xyz]mm,mem{k} */
@@ -6759,97 +6731,6 @@ x86_emulate(
         generate_exception_if(!evex.w, X86_EXC_UD);
         goto avx512f_no_sae;
 
-    case X86EMUL_OPC_EVEX_66(0x0f38, 0xc6):
-    case X86EMUL_OPC_EVEX_66(0x0f38, 0xc7):
-    {
-#ifndef __XEN__
-        typeof(evex) *pevex;
-        union {
-            int32_t dw[16];
-            int64_t qw[8];
-        } index;
-#endif
-
-        ASSERT(ea.type == OP_MEM);
-        generate_exception_if((!cpu_has_avx512f || !evex.opmsk || evex.brs ||
-                               evex.z || evex.reg != 0xf || evex.lr != 2),
-                              X86_EXC_UD);
-
-        switch ( modrm_reg & 7 )
-        {
-        case 1: /* vgatherpf0{d,q}p{s,d} mem{k} */
-        case 2: /* vgatherpf1{d,q}p{s,d} mem{k} */
-        case 5: /* vscatterpf0{d,q}p{s,d} mem{k} */
-        case 6: /* vscatterpf1{d,q}p{s,d} mem{k} */
-            vcpu_must_have(avx512pf);
-            break;
-        default:
-            generate_exception(X86_EXC_UD);
-        }
-
-        get_fpu(X86EMUL_FPU_zmm);
-
-#ifndef __XEN__
-        /*
-         * For the test harness perform zero byte memory accesses, such that
-         * in particular correct Disp8 scaling can be verified.
-         */
-        fail_if((modrm_reg & 4) && !ops->write);
-
-        /* Read index register. */
-        opc = init_evex(stub);
-        pevex = copy_EVEX(opc, evex);
-        pevex->opcx = vex_0f;
-        /* vmovdqu{32,64} */
-        opc[0] = 0x7f;
-        pevex->pfx = vex_f3;
-        pevex->w = b & 1;
-        /* Use (%rax) as destination and sib_index as source. */
-        pevex->b = 1;
-        opc[1] = (state->sib_index & 7) << 3;
-        pevex->r = !mode_64bit() || !(state->sib_index & 0x08);
-        pevex->R = !mode_64bit() || !(state->sib_index & 0x10);
-        pevex->RX = 1;
-        opc[2] = 0xc3;
-
-        invoke_stub("", "", "=m" (index) : "a" (&index));
-        put_stub(stub);
-
-        /* Clear untouched parts of the mask value. */
-        n = 1 << (4 - ((b & 1) | evex.w));
-        op_mask &= (1 << n) - 1;
-
-        for ( i = 0; rc == X86EMUL_OKAY && op_mask; ++i )
-        {
-            long idx = b & 1 ? index.qw[i] : index.dw[i];
-
-            if ( !(op_mask & (1 << i)) )
-                continue;
-
-            rc = (modrm_reg & 4
-                  ? ops->write
-                  : ops->read)(ea.mem.seg,
-                               truncate_ea(ea.mem.off +
-                                           idx * (1 << state->sib_scale)),
-                               NULL, 0, ctxt);
-            if ( rc == X86EMUL_EXCEPTION )
-            {
-                /* Squash memory access related exceptions. */
-                x86_emul_reset_event(ctxt);
-                rc = X86EMUL_OKAY;
-            }
-
-            op_mask &= ~(1 << i);
-        }
-
-        if ( rc != X86EMUL_OKAY )
-            goto done;
-#endif
-
-        state->simd_size = simd_none;
-        break;
-    }
-
     case X86EMUL_OPC(0x0f38, 0xc8):     /* sha1nexte xmm/m128,xmm */
     case X86EMUL_OPC(0x0f38, 0xc9):     /* sha1msg1 xmm/m128,xmm */
     case X86EMUL_OPC(0x0f38, 0xca):     /* sha1msg2 xmm/m128,xmm */
@@ -6860,19 +6741,6 @@ x86_emulate(
         op_bytes = 16;
         goto simd_0f38_common;
 
-    case X86EMUL_OPC_EVEX_66(0x0f38, 0xc8): /* vexp2p{s,d} zmm/mem,zmm{k} */
-    case X86EMUL_OPC_EVEX_66(0x0f38, 0xca): /* vrcp28p{s,d} zmm/mem,zmm{k} */
-    case X86EMUL_OPC_EVEX_66(0x0f38, 0xcc): /* vrsqrt28p{s,d} zmm/mem,zmm{k} */
-        host_and_vcpu_must_have(avx512er);
-        generate_exception_if((ea.type != OP_REG || !evex.brs) && evex.lr != 2,
-                              X86_EXC_UD);
-        goto simd_zmm;
-
-    case X86EMUL_OPC_EVEX_66(0x0f38, 0xcb): /* vrcp28s{s,d} xmm/mem,xmm,xmm{k} */
-    case X86EMUL_OPC_EVEX_66(0x0f38, 0xcd): /* vrsqrt28s{s,d} xmm/mem,xmm,xmm{k} */
-        host_and_vcpu_must_have(avx512er);
-        goto simd_zmm_scalar_sae;
-
     case X86EMUL_OPC_VEX_F2(0x0f38, 0xcb): /* vsha512rnds2 xmm,ymm,ymm */
     case X86EMUL_OPC_VEX_F2(0x0f38, 0xcc): /* vsha512msg1 xmm,ymm */
     case X86EMUL_OPC_VEX_F2(0x0f38, 0xcd): /* vsha512msg2 ymm,ymm */
diff --git a/xen/include/public/arch-x86/cpufeatureset.h b/xen/include/public/arch-x86/cpufeatureset.h
index 3962ba9342..abab78fa86 100644
--- a/xen/include/public/arch-x86/cpufeatureset.h
+++ b/xen/include/public/arch-x86/cpufeatureset.h
@@ -208,8 +208,8 @@ XEN_CPUFEATURE(AVX512_IFMA,   5*32+21) /*A  AVX-512 Integer Fused Multiply Add *
 XEN_CPUFEATURE(CLFLUSHOPT,    5*32+23) /*A  CLFLUSHOPT instruction */
 XEN_CPUFEATURE(CLWB,          5*32+24) /*!A CLWB instruction */
 XEN_CPUFEATURE(PROC_TRACE,    5*32+25) /*   Processor Trace */
-XEN_CPUFEATURE(AVX512PF,      5*32+26) /*A  AVX-512 Prefetch Instructions */
-XEN_CPUFEATURE(AVX512ER,      5*32+27) /*A  AVX-512 Exponent & Reciprocal Instrs */
+XEN_CPUFEATURE(AVX512PF,      5*32+26) /*   Xeon Phi AVX-512 Prefetch Instructions */
+XEN_CPUFEATURE(AVX512ER,      5*32+27) /*   Xeon Phi AVX-512 Exponent & Reciprocal Instrs */
 XEN_CPUFEATURE(AVX512CD,      5*32+28) /*A  AVX-512 Conflict Detection Instrs */
 XEN_CPUFEATURE(SHA,           5*32+29) /*A  SHA1 & SHA256 instructions */
 XEN_CPUFEATURE(AVX512BW,      5*32+30) /*A  AVX-512 Byte and Word Instructions */
@@ -264,8 +264,8 @@ XEN_CPUFEATURE(BTC_NO,        8*32+29) /*A  Hardware not vulnerable to Branch Ty
 XEN_CPUFEATURE(IBPB_RET,      8*32+30) /*A  IBPB clears RSB/RAS too. */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:0.edx, word 9 */
-XEN_CPUFEATURE(AVX512_4VNNIW, 9*32+ 2) /*A  AVX512 Neural Network Instructions */
-XEN_CPUFEATURE(AVX512_4FMAPS, 9*32+ 3) /*A  AVX512 Multiply Accumulation Single Precision */
+XEN_CPUFEATURE(AVX512_4VNNIW, 9*32+ 2) /*   Xeon Phi AVX512 Neural Network Instructions */
+XEN_CPUFEATURE(AVX512_4FMAPS, 9*32+ 3) /*   Xeon Phi AVX512 Multiply Accumulation Single Precision */
 XEN_CPUFEATURE(FSRM,          9*32+ 4) /*A  Fast Short REP MOVS */
 XEN_CPUFEATURE(UINTR,         9*32+ 5) /*   User-mode Interrupts */
 XEN_CPUFEATURE(AVX512_VP2INTERSECT, 9*32+8) /*a  VP2INTERSECT{D,Q} insns */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 03 07:55:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Aug 2024 07:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771435.1182006 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sa9bU-0005Ci-B6; Sat, 03 Aug 2024 07:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771435.1182006; Sat, 03 Aug 2024 07: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 1sa9bU-0005Cb-88; Sat, 03 Aug 2024 07:55:04 +0000
Received: by outflank-mailman (input) for mailman id 771435;
 Sat, 03 Aug 2024 07:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sa9bS-0005CV-EB
 for xen-changelog@lists.xenproject.org; Sat, 03 Aug 2024 07:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sa9bS-0005G5-2B
 for xen-changelog@lists.xenproject.org; Sat, 03 Aug 2024 07:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sa9bR-0006jD-V9
 for xen-changelog@lists.xenproject.org; Sat, 03 Aug 2024 07: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WAxKoV4ny8nZGvrrvvlryPtCJA9ylZ+UJLSZ5W1O9Ao=; b=Y6kGj3nb3DMsf7ZMUEjFWT5p+J
	gnPax08pOhHkkGV+PeYLj6iCdvJXvFKAF090zQ0ADeV16MoKNPxx9Y3He6U+Gwjsu0Zr+Rvrva184
	fTLj/KR5u3vgWI5Ou1y1Bqu/uPSq/m3Y7JCjEVvy+qnMAuJ25rRVq2gbFGE9d4xZ9QGQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/hvm: Don't skip MSR_READ trace record
Message-Id: <E1sa9bR-0006jD-V9@xenbits.xenproject.org>
Date: Sat, 03 Aug 2024 07:55:01 +0000

commit bc8a43fff61ae4162a95d84f4e148d6773667cd2
Author:     George Dunlap <george.dunlap@cloud.com>
AuthorDate: Fri Aug 2 08:42:09 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 2 08:42:09 2024 +0200

    xen/hvm: Don't skip MSR_READ trace record
    
    Commit 37f074a3383 ("x86/msr: introduce guest_rdmsr()") introduced a
    function to combine the MSR_READ handling between PV and HVM.
    Unfortunately, by returning directly, it skipped the trace generation,
    leading to gaps in the trace record, as well as xenalyze errors like
    this:
    
    hvm_generic_postprocess: d2v0 Strange, exit 7c(VMEXIT_MSR) missing a handler
    
    Replace the `return` with `goto out`.
    
    Fixes: 37f074a3383 ("x86/msr: introduce guest_rdmsr()")
    Signed-off-by: George Dunlap <george.dunlap@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 9f37db494d..f49e29faf7 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3557,7 +3557,7 @@ int hvm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
     fixed_range_base = (uint64_t *)v->arch.hvm.mtrr.fixed_ranges;
 
     if ( (ret = guest_rdmsr(v, msr, msr_content)) != X86EMUL_UNHANDLEABLE )
-        return ret;
+        goto out;
 
     ret = X86EMUL_OKAY;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 03 07:55:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Aug 2024 07:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771437.1182014 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sa9bn-0005HK-Gv; Sat, 03 Aug 2024 07:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771437.1182014; Sat, 03 Aug 2024 07: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 1sa9bn-0005HB-Dv; Sat, 03 Aug 2024 07:55:23 +0000
Received: by outflank-mailman (input) for mailman id 771437;
 Sat, 03 Aug 2024 07:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sa9bm-0005Gy-BH
 for xen-changelog@lists.xenproject.org; Sat, 03 Aug 2024 07:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sa9bm-0005Gb-AU
 for xen-changelog@lists.xenproject.org; Sat, 03 Aug 2024 07:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sa9bm-0006kO-9a
 for xen-changelog@lists.xenproject.org; Sat, 03 Aug 2024 07: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vkG8c9sd9YmKuhRmvkgfYyAbEL1G6edEGCOaAX2NMas=; b=fPouj5aq55NkD04ICKuNsDFtH2
	uhlmr+jK+tiKU+BYF0TCaWlLZP5ULoK6EykE20uD+JnpCmuXm/Hp6QLvxp4a7UszYVezyMevYmVOM
	Vgu+8suma0tq6ukNzFNaypdUjZbyLQioySrWkQrMtkWVxyn6xyKssekNmUBkIySukJzM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/lsevtchn: Use errno macro to handle hypercall error cases
Message-Id: <E1sa9bm-0006kO-9a@xenbits.xenproject.org>
Date: Sat, 03 Aug 2024 07:55:22 +0000

commit e92a453c8db8bba62d6be3006079e2b9990c3978
Author:     Matthew Barnes <matthew.barnes@cloud.com>
AuthorDate: Fri Aug 2 08:43:57 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 2 08:43:57 2024 +0200

    tools/lsevtchn: Use errno macro to handle hypercall error cases
    
    Currently, lsevtchn aborts its event channel enumeration when it hits
    an event channel that is owned by Xen.
    
    lsevtchn does not distinguish between different hypercall errors, which
    results in lsevtchn missing potential relevant event channels with
    higher port numbers.
    
    Use the errno macro to distinguish between hypercall errors, and
    continue event channel enumeration if the hypercall error is not
    critical to enumeration.
    
    Signed-off-by: Matthew Barnes <matthew.barnes@cloud.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xcutils/lsevtchn.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/tools/xcutils/lsevtchn.c b/tools/xcutils/lsevtchn.c
index d1710613dd..30c8d847b8 100644
--- a/tools/xcutils/lsevtchn.c
+++ b/tools/xcutils/lsevtchn.c
@@ -3,6 +3,7 @@
 #include <stdint.h>
 #include <string.h>
 #include <stdio.h>
+#include <errno.h>
 
 #include <xenctrl.h>
 
@@ -24,7 +25,23 @@ int main(int argc, char **argv)
         status.port = port;
         rc = xc_evtchn_status(xch, &status);
         if ( rc < 0 )
-            break;
+        {
+            switch ( errno )
+            {
+            case EACCES: /* Xen-owned evtchn */
+                continue;
+
+            case EINVAL: /* Port enumeration has ended */
+                rc = 0;
+                break;
+
+            default:
+                perror("xc_evtchn_status");
+                rc = 1;
+                break;
+            }
+            goto out;
+        }
 
         if ( status.status == EVTCHNSTAT_closed )
             continue;
@@ -58,7 +75,8 @@ int main(int argc, char **argv)
         printf("\n");
     }
 
+ out:
     xc_interface_close(xch);
 
-    return 0;
+    return rc;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 03 07:55:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 03 Aug 2024 07:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771438.1182017 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sa9bx-0005Jz-I2; Sat, 03 Aug 2024 07:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771438.1182017; Sat, 03 Aug 2024 07: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 1sa9bx-0005Jr-FL; Sat, 03 Aug 2024 07:55:33 +0000
Received: by outflank-mailman (input) for mailman id 771438;
 Sat, 03 Aug 2024 07:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sa9bw-0005Jg-Gd
 for xen-changelog@lists.xenproject.org; Sat, 03 Aug 2024 07:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sa9bw-0005Gj-En
 for xen-changelog@lists.xenproject.org; Sat, 03 Aug 2024 07:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sa9bw-0006ks-Cg
 for xen-changelog@lists.xenproject.org; Sat, 03 Aug 2024 07: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=i+Z4Mc3itQfa2wg3wxdCsLx6yq+ZJjAkrUE5u8+UTPc=; b=M7OoK/TFYATOq7vAPXamEm1sK1
	efhEyhBTTfg5oXQeDgdlPzwTQnAXQ3SXjiGFBfhSov4BeKsneKfswkfRRx2qMXe9ajoj0BUyUL9DW
	DYMU/TK4qLaoWCJIqjPCfmsJv/+rMKbwbrWeCQZFDtkyvwrbMoRBTUcmNvNuTcDfv2B8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] 9pfsd: fix release build with old gcc
Message-Id: <E1sa9bw-0006ks-Cg@xenbits.xenproject.org>
Date: Sat, 03 Aug 2024 07:55:32 +0000

commit 984cb316cb27b53704c607e640a7dd2763b898ab
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Aug 2 08:44:22 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 2 08:44:22 2024 +0200

    9pfsd: fix release build with old gcc
    
    Being able to recognize that "par" is reliably initialized on the 1st
    loop iteration requires not overly old compilers.
    
    Fixes: 7809132b1a1d ("tools/xen-9pfsd: add 9pfs response generation support")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 tools/9pfsd/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/9pfsd/io.c b/tools/9pfsd/io.c
index df1be3df7d..468e0241f5 100644
--- a/tools/9pfsd/io.c
+++ b/tools/9pfsd/io.c
@@ -196,7 +196,7 @@ static void fill_buffer_at(void **data, const char *fmt, ...);
 static void vfill_buffer_at(void **data, const char *fmt, va_list ap)
 {
     const char *f;
-    const void *par;
+    const void *par = NULL; /* old gcc */
     const char *str_val;
     const struct p9_qid *qid;
     const struct p9_stat *stat;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Aug 04 01:55:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 04 Aug 2024 01:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771573.1182075 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1saQSc-0006Sf-AU; Sun, 04 Aug 2024 01:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771573.1182075; Sun, 04 Aug 2024 01: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 1saQSc-0006SW-6l; Sun, 04 Aug 2024 01:55:02 +0000
Received: by outflank-mailman (input) for mailman id 771573;
 Sun, 04 Aug 2024 01:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1saQSb-0006SQ-HK
 for xen-changelog@lists.xenproject.org; Sun, 04 Aug 2024 01:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1saQSb-000409-Fw
 for xen-changelog@lists.xenproject.org; Sun, 04 Aug 2024 01:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1saQSb-0005Wf-DR
 for xen-changelog@lists.xenproject.org; Sun, 04 Aug 2024 01: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FwMiiTcZUBV2/v9RgGnUL4Vmevjia3XfqZhLTyxdOKI=; b=gXKm439CiwZ/4CoWEuvpvssjgg
	qhyp+oE2MnVwhBKczS1EvjCq2GRS3X9Om8lfBIpbIAuDeEvmIG0RmBAY+1PTNFNWALv1pIPuIW7++
	Z/5cS0/24Ivc/M14F/Kl7hai/ZpZJU4MwmGk03B797hr7QwyMD6PX5x1MyIaHZYdgPSY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation/eclair_analysis: add Rule 18.6 to the clean guidelines
Message-Id: <E1saQSb-0005Wf-DR@xenbits.xenproject.org>
Date: Sun, 04 Aug 2024 01:55:01 +0000

commit f2158c59245027abcebf72f250dac7ff8817ffaf
Author:     Nicola Vetrini <nicola.vetrini@bugseng.com>
AuthorDate: Wed Jul 31 14:41:52 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 2 14:24:30 2024 -0700

    automation/eclair_analysis: add Rule 18.6 to the clean guidelines
    
    MISRA C Rule 18.6 states: "The address of an object with automatic
    storage shall not be copied to another object that persists after
    the first object has ceased to exist."
    
    The rule is set as monitored and tagged clean, in order to block
    the CI on any violations that may arise, allowing the presence
    of cautions (currently there are no violations).
    
    No functional change.
    
    Signed-off-by: Nicola Vetrini <nicola.vetrini@bugseng.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/monitored.ecl | 1 +
 automation/eclair_analysis/ECLAIR/tagging.ecl   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/automation/eclair_analysis/ECLAIR/monitored.ecl b/automation/eclair_analysis/ECLAIR/monitored.ecl
index 9ffaebbdc3..8a7e3f3cea 100644
--- a/automation/eclair_analysis/ECLAIR/monitored.ecl
+++ b/automation/eclair_analysis/ECLAIR/monitored.ecl
@@ -32,6 +32,7 @@
 -enable=MC3R1.R17.4
 -enable=MC3R1.R17.5
 -enable=MC3R1.R17.6
+-enable=MC3R1.R18.6
 -enable=MC3R1.R19.1
 -enable=MC3R1.R20.12
 -enable=MC3R1.R20.13
diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index b829655ca0..e7b32773e6 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -67,6 +67,7 @@ MC3R1.R17.3||
 MC3R1.R17.4||
 MC3R1.R17.5||
 MC3R1.R17.6||
+MC3R1.R18.6||
 MC3R1.R18.8||
 MC3R1.R20.2||
 MC3R1.R20.3||
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Aug 04 01:55:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 04 Aug 2024 01:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771574.1182079 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1saQSm-0006UV-Ap; Sun, 04 Aug 2024 01:55:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771574.1182079; Sun, 04 Aug 2024 01:55:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1saQSm-0006UN-8J; Sun, 04 Aug 2024 01:55:12 +0000
Received: by outflank-mailman (input) for mailman id 771574;
 Sun, 04 Aug 2024 01:55:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1saQSl-0006UF-LB
 for xen-changelog@lists.xenproject.org; Sun, 04 Aug 2024 01:55:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1saQSl-00040Q-KE
 for xen-changelog@lists.xenproject.org; Sun, 04 Aug 2024 01:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1saQSl-0005Xj-I7
 for xen-changelog@lists.xenproject.org; Sun, 04 Aug 2024 01: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jIktsAN/HpxbREF6F9JcA2IIXjoug1HPPcfvqWPMp9g=; b=Aef49VHinxp+Js8gp5Ot4AXKS5
	gfXUaCucU/xdz+yZT78MQ/aS6wlW6uMZFeO3+2pyOcHnznjtTGeKBDk1mGeCIStz2EExwEeVGpCAo
	r3I6Af/OHRF2LfTT1kmwfNoCeaDn2caOKj877yjm5j7ieaEFuDxeFNaxDGlehvDHFH0M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs/misra: add R13.2 and R18.2 to rules.rst
Message-Id: <E1saQSl-0005Xj-I7@xenbits.xenproject.org>
Date: Sun, 04 Aug 2024 01:55:11 +0000

commit ded5474718a84366dac80aae039a693b66fa7e2e
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Thu Aug 1 12:19:58 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 2 14:25:18 2024 -0700

    docs/misra: add R13.2 and R18.2 to rules.rst
    
    Add MISRA C rules 13.2 and 18.2 to rules.rst. Both rules have zero
    violations reported by Eclair but they have some cautions. We accept
    both rules and for now we'll enable scanning for them in Eclair but only
    violations will cause the Gitlab CI job to fail (cautions will not.)
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/misra/rules.rst | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/docs/misra/rules.rst b/docs/misra/rules.rst
index 7b366edb07..e99cb81089 100644
--- a/docs/misra/rules.rst
+++ b/docs/misra/rules.rst
@@ -462,6 +462,16 @@ maintainers if you want to suggest a change.
      - Initializer lists shall not contain persistent side effects
      -
 
+   * - `Rule 13.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_13_02.c>`_
+     - Required
+     - The value of an expression and its persistent side-effects shall
+       be the same under all permitted evaluation orders
+     - Be aware that the static analysis tool Eclair might report
+       several findings for Rule 13.2 of type "caution". These are
+       instances where Eclair is unable to verify that the code is valid
+       in regard to Rule 13.2. Caution reports might not be violations.
+       The rule should be followed in any case in new code submitted.
+
    * - `Rule 13.6 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_13_06.c>`_
      - Required
      - The operand of the sizeof operator shall not contain any
@@ -583,6 +593,16 @@ maintainers if you want to suggest a change.
        submitting new patches please try to decrease the number of
        violations when possible.
 
+   * - `Rule 18.2 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_18_02.c>`_
+     - Required
+     - Subtraction between pointers shall only be applied to pointers
+       that address elements of the same array
+     - Be aware that the static analysis tool Eclair might report
+       several findings for Rule 18.2 of type "caution". These are
+       instances where Eclair is unable to verify that the code is valid
+       in regard to Rule 18.2. Caution reports might not be violations.
+       The rule should be followed in any case in new code submitted.
+
    * - `Rule 18.3 <https://gitlab.com/MISRA/MISRA-C/MISRA-C-2012/Example-Suite/-/blob/master/R_18_03.c>`_
      - Required
      - The relational operators > >= < and <= shall not be applied to objects of pointer type except where they point into the same object
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Aug 05 08:22:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 05 Aug 2024 08:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771858.1182282 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sasyj-0002zJ-Ou; Mon, 05 Aug 2024 08:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771858.1182282; Mon, 05 Aug 2024 08:22: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 1sasyj-0002zB-M7; Mon, 05 Aug 2024 08:22:05 +0000
Received: by outflank-mailman (input) for mailman id 771858;
 Mon, 05 Aug 2024 08:22:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sasyi-0002z4-04
 for xen-changelog@lists.xenproject.org; Mon, 05 Aug 2024 08:22:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sasyh-0003Ga-US
 for xen-changelog@lists.xenproject.org; Mon, 05 Aug 2024 08:22:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sasyh-0004HH-T2
 for xen-changelog@lists.xenproject.org; Mon, 05 Aug 2024 08:22: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mR57XZBulgc45tESD3EoV3op0GoVK9+FsyRyCSqgV0Q=; b=RYi/frZAtE/WJhE8sna2KBplHK
	f0fggPiAHC6DRcTBHm5/PYo0bdcCeQ/SU4gFl2V5celr1P2cNAj4UcE/TAguh0XnKC3Pp0z5pO2QO
	EFIhOjP+/tiVeJ95IFtHxq0chhDsnc7It6TR45r1JFo4AO4eZ8KuJkrxVOkd9KngNHYM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shutdown: change default reboot method preference
Message-Id: <E1sasyh-0004HH-T2@xenbits.xenproject.org>
Date: Mon, 05 Aug 2024 08:22:03 +0000

commit d81dd31303513a1626973778d557a6493d86511a
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Aug 5 10:16:54 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 5 10:16:54 2024 +0200

    x86/shutdown: change default reboot method preference
    
    The current logic to chose the preferred reboot method is based on the mode Xen
    has been booted into, so if the box is booted from UEFI, the preferred reboot
    method will be to use the ResetSystem() run time service call.
    
    However, that method seems to be widely untested, and quite often leads to a
    result similar to:
    
    Hardware Dom0 shutdown: rebooting machine
    ----[ Xen-4.18-unstable  x86_64  debug=y  Tainted:   C    ]----
    CPU:    0
    RIP:    e008:[<0000000000000017>] 0000000000000017
    RFLAGS: 0000000000010202   CONTEXT: hypervisor
    [...]
    Xen call trace:
       [<0000000000000017>] R 0000000000000017
       [<ffff83207eff7b50>] S ffff83207eff7b50
       [<ffff82d0403525aa>] F machine_restart+0x1da/0x261
       [<ffff82d04035263c>] F apic_wait_icr_idle+0/0x37
       [<ffff82d040233689>] F smp_call_function_interrupt+0xc7/0xcb
       [<ffff82d040352f05>] F call_function_interrupt+0x20/0x34
       [<ffff82d04033b0d5>] F do_IRQ+0x150/0x6f3
       [<ffff82d0402018c2>] F common_interrupt+0x132/0x140
       [<ffff82d040283d33>] F arch/x86/acpi/cpu_idle.c#acpi_idle_do_entry+0x113/0x129
       [<ffff82d04028436c>] F arch/x86/acpi/cpu_idle.c#acpi_processor_idle+0x3eb/0x5f7
       [<ffff82d04032a549>] F arch/x86/domain.c#idle_loop+0xec/0xee
    
    ****************************************
    Panic on CPU 0:
    FATAL TRAP: vector = 6 (invalid opcode)
    ****************************************
    
    Which in most cases does lead to a reboot, however that's unreliable.
    
    Change the default reboot preference to prefer ACPI over UEFI if available and
    not in reduced hardware mode.
    
    This is in line to what Linux does, so it's unlikely to cause issues on current
    and future hardware, since there's a much higher chance of vendors testing
    hardware with Linux rather than Xen.
    
    Add a special case for one Acer model that does require being rebooted using
    ResetSystem().  See Linux commit 0082517fa4bce for rationale.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 CHANGELOG.md            |  2 ++
 xen/arch/x86/shutdown.c | 19 +++++++++++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index eeaaa8b274..5521ae5bb3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ## [4.20.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
 
 ### Changed
+ - On x86:
+   - Prefer ACPI reboot over UEFI ResetSystem() run time service call.
 
 ### Added
 
diff --git a/xen/arch/x86/shutdown.c b/xen/arch/x86/shutdown.c
index acceec2a38..fa60d1638d 100644
--- a/xen/arch/x86/shutdown.c
+++ b/xen/arch/x86/shutdown.c
@@ -150,19 +150,20 @@ static void default_reboot_type(void)
 
     if ( xen_guest )
         reboot_type = BOOT_XEN;
+    else if ( !acpi_disabled && !acpi_gbl_reduced_hardware )
+        reboot_type = BOOT_ACPI;
     else if ( efi_enabled(EFI_RS) )
         reboot_type = BOOT_EFI;
-    else if ( acpi_disabled )
-        reboot_type = BOOT_KBD;
     else
-        reboot_type = BOOT_ACPI;
+        reboot_type = BOOT_KBD;
 }
 
 static int __init cf_check override_reboot(const struct dmi_system_id *d)
 {
     enum reboot_type type = (long)d->driver_data;
 
-    if ( type == BOOT_ACPI && acpi_disabled )
+    if ( (type == BOOT_ACPI && acpi_disabled) ||
+         (type == BOOT_EFI && !efi_enabled(EFI_RS)) )
         type = BOOT_KBD;
 
     if ( reboot_type != type )
@@ -172,6 +173,7 @@ static int __init cf_check override_reboot(const struct dmi_system_id *d)
             [BOOT_KBD]  = "keyboard controller",
             [BOOT_ACPI] = "ACPI",
             [BOOT_CF9]  = "PCI",
+            [BOOT_EFI]  = "UEFI",
         };
 
         reboot_type = type;
@@ -492,6 +494,15 @@ static const struct dmi_system_id __initconstrel reboot_dmi_table[] = {
             DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
             DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge R740")),
     },
+    {    /* Handle problems with rebooting on Acer TravelMate X514-51T. */
+        .callback = override_reboot,
+        .driver_data = (void *)(long)BOOT_EFI,
+        .ident = "Acer TravelMate X514-51T",
+        .matches = {
+            DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+            DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate X514-51T"),
+        },
+    },
     { }
 };
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 05 08:22:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 05 Aug 2024 08:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.771859.1182286 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sasyt-00031A-QG; Mon, 05 Aug 2024 08:22:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 771859.1182286; Mon, 05 Aug 2024 08:22: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 1sasyt-000312-Na; Mon, 05 Aug 2024 08:22:15 +0000
Received: by outflank-mailman (input) for mailman id 771859;
 Mon, 05 Aug 2024 08:22:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sasys-00030q-2E
 for xen-changelog@lists.xenproject.org; Mon, 05 Aug 2024 08:22:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sasys-0003Go-1U
 for xen-changelog@lists.xenproject.org; Mon, 05 Aug 2024 08:22:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sasys-0004Ho-0c
 for xen-changelog@lists.xenproject.org; Mon, 05 Aug 2024 08:22: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=63vrKqghcjantMs/Mi9YhEPp6pN10eIkAEblA9O+jas=; b=a1hEw3CJTI1jMo5AhvVzxm45F6
	aczD4eiC5MH9xAOvPw4VupAEXW6uMnAGKFBhP+K8W70SWQl1ntBmbAwhvWIS666Kl7BbYb9coh6wg
	kJthbMzVFC4Kfe2bvrID3lXO+8VzsoEBU97p3c4EGXaR05LfmwGpRz3B9Sq7uh+I5UPw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/dom0: delay setting SMAP after dom0 build is done
Message-Id: <E1sasys-0004Ho-0c@xenbits.xenproject.org>
Date: Mon, 05 Aug 2024 08:22:14 +0000

commit ac6b9309694de9b2b5163886656282f6ada71565
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Aug 5 10:18:05 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 5 10:18:05 2024 +0200

    x86/dom0: delay setting SMAP after dom0 build is done
    
    Delay setting X86_CR4_SMAP on the BSP until the domain building is done, so
    that there's no need to disable SMAP.  Note however that SMAP is enabled for
    the APs on bringup, as domain builder code strictly run on the BSP.  Delaying
    the setting for the APs would mean having to do a callfunc IPI later in order
    to set it on all the APs.
    
    The fixes tag is to account for the wrong usage of cpu_has_smap in
    create_dom0(), it should instead have used
    boot_cpu_has(X86_FEATURE_XEN_SMAP).
    
    While there also make cr4_pv32_mask __ro_after_init.
    
    Fixes: 493ab190e5b1 ('xen/sm{e, a}p: allow disabling sm{e, a}p for Xen itself')
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/setup.c | 48 +++++++++++++++++++++++++++---------------------
 1 file changed, 27 insertions(+), 21 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index eee20bb175..a7a85e94e3 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -80,7 +80,7 @@ int8_t __initdata opt_probe_port_aliases = -1;
 boolean_param("probe-port-aliases", opt_probe_port_aliases);
 
 /* Only used in asm code and within this source file */
-unsigned long asmlinkage __read_mostly cr4_pv32_mask;
+unsigned long asmlinkage __ro_after_init cr4_pv32_mask;
 
 /* **** Linux config option: propagated to domain0. */
 /* "acpi=off":    Sisables both ACPI table parsing and interpreter. */
@@ -955,26 +955,9 @@ static struct domain *__init create_dom0(const module_t *image,
         }
     }
 
-    /*
-     * Temporarily clear SMAP in CR4 to allow user-accesses in construct_dom0().
-     * This saves a large number of corner cases interactions with
-     * copy_from_user().
-     */
-    if ( cpu_has_smap )
-    {
-        cr4_pv32_mask &= ~X86_CR4_SMAP;
-        write_cr4(read_cr4() & ~X86_CR4_SMAP);
-    }
-
     if ( construct_dom0(d, image, headroom, initrd, cmdline) != 0 )
         panic("Could not construct domain 0\n");
 
-    if ( cpu_has_smap )
-    {
-        write_cr4(read_cr4() | X86_CR4_SMAP);
-        cr4_pv32_mask |= X86_CR4_SMAP;
-    }
-
     return d;
 }
 
@@ -1907,16 +1890,26 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     if ( cpu_has_smep && opt_smep != SMEP_HVM_ONLY )
         setup_force_cpu_cap(X86_FEATURE_XEN_SMEP);
     if ( boot_cpu_has(X86_FEATURE_XEN_SMEP) )
+    {
         set_in_cr4(X86_CR4_SMEP);
+        BUILD_BUG_ON(!(X86_CR4_SMEP & XEN_CR4_PV32_BITS));
+        cr4_pv32_mask |= X86_CR4_SMEP;
+    }
 
     if ( !opt_smap )
         setup_clear_cpu_cap(X86_FEATURE_SMAP);
     if ( cpu_has_smap && opt_smap != SMAP_HVM_ONLY )
         setup_force_cpu_cap(X86_FEATURE_XEN_SMAP);
     if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
-        set_in_cr4(X86_CR4_SMAP);
-
-    cr4_pv32_mask = mmu_cr4_features & XEN_CR4_PV32_BITS;
+        /*
+         * Set SMAP on the %cr4 mask so that it's set for APs on bringup, but
+         * don't set for the BSP until domain building is done.
+         *
+         * Don't set it in cr4_pv32_mask either, until it's also set on the
+         * BSP.  Otherwise the BUG in cr4_pv32_restore would trigger for events
+         * received on the BSP.
+         */
+        mmu_cr4_features |= X86_CR4_SMAP;
 
     if ( boot_cpu_has(X86_FEATURE_FSGSBASE) )
         set_in_cr4(X86_CR4_FSGSBASE);
@@ -2048,6 +2041,19 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     if ( !dom0 )
         panic("Could not set up DOM0 guest OS\n");
 
+    /*
+     * Enable SMAP only after being done with the domain building phase, as the
+     * PV builder switches to the domain page-tables and must be run with SMAP
+     * disabled.
+     */
+    if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
+    {
+        ASSERT(mmu_cr4_features & X86_CR4_SMAP);
+        write_cr4(read_cr4() | X86_CR4_SMAP);
+        BUILD_BUG_ON(!(X86_CR4_SMAP & XEN_CR4_PV32_BITS));
+        cr4_pv32_mask |= X86_CR4_SMAP;
+    }
+
     heap_init_late();
 
     init_trace_bufs();
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 05 11:00:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 05 Aug 2024 11:00:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.772024.1182456 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1savRd-0003Dj-EQ; Mon, 05 Aug 2024 11:00:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 772024.1182456; Mon, 05 Aug 2024 11:00: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 1savRd-0003Da-BL; Mon, 05 Aug 2024 11:00:05 +0000
Received: by outflank-mailman (input) for mailman id 772024;
 Mon, 05 Aug 2024 11:00:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1savRc-0002ya-Az
 for xen-changelog@lists.xenproject.org; Mon, 05 Aug 2024 11:00:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1savRc-00065f-3F
 for xen-changelog@lists.xenproject.org; Mon, 05 Aug 2024 11:00:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1savRc-0006iT-17
 for xen-changelog@lists.xenproject.org; Mon, 05 Aug 2024 11:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9uONoQh6uXaXEumJ20LVC/Ah43ueAJ3eileyp3VzV+A=; b=Q62bKepHmlYXp7nRF96WDz7AAM
	5PpFjeY9gggOxlkWAO1yX21dKoxdyNPpDD+UybVbwq/NblDZDVIDbr2HDDH97bxP2T1A/0dfuLDTt
	5KjTBWeQtWsoBluK3xy5pbkIGX09JmTVIycpiltrFrbejY2S68/80jByDDOW2gyxfO/c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Revert "x86/dom0: delay setting SMAP after dom0 build is done"
Message-Id: <E1savRc-0006iT-17@xenbits.xenproject.org>
Date: Mon, 05 Aug 2024 11:00:04 +0000

commit bec25f11d5180d407cf04d2de2525fa6f876bde1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Aug 5 12:55:37 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 5 12:55:37 2024 +0200

    Revert "x86/dom0: delay setting SMAP after dom0 build is done"
    
    This reverts commit ac6b9309694de9b2b5163886656282f6ada71565. The
    change crashes Xen on boot on SMAP-capable systems.
---
 xen/arch/x86/setup.c | 48 +++++++++++++++++++++---------------------------
 1 file changed, 21 insertions(+), 27 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index a7a85e94e3..eee20bb175 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -80,7 +80,7 @@ int8_t __initdata opt_probe_port_aliases = -1;
 boolean_param("probe-port-aliases", opt_probe_port_aliases);
 
 /* Only used in asm code and within this source file */
-unsigned long asmlinkage __ro_after_init cr4_pv32_mask;
+unsigned long asmlinkage __read_mostly cr4_pv32_mask;
 
 /* **** Linux config option: propagated to domain0. */
 /* "acpi=off":    Sisables both ACPI table parsing and interpreter. */
@@ -955,9 +955,26 @@ static struct domain *__init create_dom0(const module_t *image,
         }
     }
 
+    /*
+     * Temporarily clear SMAP in CR4 to allow user-accesses in construct_dom0().
+     * This saves a large number of corner cases interactions with
+     * copy_from_user().
+     */
+    if ( cpu_has_smap )
+    {
+        cr4_pv32_mask &= ~X86_CR4_SMAP;
+        write_cr4(read_cr4() & ~X86_CR4_SMAP);
+    }
+
     if ( construct_dom0(d, image, headroom, initrd, cmdline) != 0 )
         panic("Could not construct domain 0\n");
 
+    if ( cpu_has_smap )
+    {
+        write_cr4(read_cr4() | X86_CR4_SMAP);
+        cr4_pv32_mask |= X86_CR4_SMAP;
+    }
+
     return d;
 }
 
@@ -1890,26 +1907,16 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     if ( cpu_has_smep && opt_smep != SMEP_HVM_ONLY )
         setup_force_cpu_cap(X86_FEATURE_XEN_SMEP);
     if ( boot_cpu_has(X86_FEATURE_XEN_SMEP) )
-    {
         set_in_cr4(X86_CR4_SMEP);
-        BUILD_BUG_ON(!(X86_CR4_SMEP & XEN_CR4_PV32_BITS));
-        cr4_pv32_mask |= X86_CR4_SMEP;
-    }
 
     if ( !opt_smap )
         setup_clear_cpu_cap(X86_FEATURE_SMAP);
     if ( cpu_has_smap && opt_smap != SMAP_HVM_ONLY )
         setup_force_cpu_cap(X86_FEATURE_XEN_SMAP);
     if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
-        /*
-         * Set SMAP on the %cr4 mask so that it's set for APs on bringup, but
-         * don't set for the BSP until domain building is done.
-         *
-         * Don't set it in cr4_pv32_mask either, until it's also set on the
-         * BSP.  Otherwise the BUG in cr4_pv32_restore would trigger for events
-         * received on the BSP.
-         */
-        mmu_cr4_features |= X86_CR4_SMAP;
+        set_in_cr4(X86_CR4_SMAP);
+
+    cr4_pv32_mask = mmu_cr4_features & XEN_CR4_PV32_BITS;
 
     if ( boot_cpu_has(X86_FEATURE_FSGSBASE) )
         set_in_cr4(X86_CR4_FSGSBASE);
@@ -2041,19 +2048,6 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     if ( !dom0 )
         panic("Could not set up DOM0 guest OS\n");
 
-    /*
-     * Enable SMAP only after being done with the domain building phase, as the
-     * PV builder switches to the domain page-tables and must be run with SMAP
-     * disabled.
-     */
-    if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
-    {
-        ASSERT(mmu_cr4_features & X86_CR4_SMAP);
-        write_cr4(read_cr4() | X86_CR4_SMAP);
-        BUILD_BUG_ON(!(X86_CR4_SMAP & XEN_CR4_PV32_BITS));
-        cr4_pv32_mask |= X86_CR4_SMAP;
-    }
-
     heap_init_late();
 
     init_trace_bufs();
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 05 12:33:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 05 Aug 2024 12:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.772115.1182544 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sawtb-0006Vg-Df; Mon, 05 Aug 2024 12:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 772115.1182544; Mon, 05 Aug 2024 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 1sawtb-0006VY-Am; Mon, 05 Aug 2024 12:33:03 +0000
Received: by outflank-mailman (input) for mailman id 772115;
 Mon, 05 Aug 2024 12:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sawta-0006VS-9M
 for xen-changelog@lists.xenproject.org; Mon, 05 Aug 2024 12:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sawta-0007td-2D
 for xen-changelog@lists.xenproject.org; Mon, 05 Aug 2024 12:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sawtZ-0004kB-Vc
 for xen-changelog@lists.xenproject.org; Mon, 05 Aug 2024 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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=edK65GHTuEnFPiN7tJ0PaETlmm8kWYk7AcwGVlBDwvA=; b=5gUQrG0En6KyGTqWwzSicrQUex
	1/yFooxzlQvghi2nbvmyjTmZ9ZDP3bGfhanAHHaUepJ5jlZnYEsUOd6J+ZGiM7LIhgxnn5ABsW5Nd
	t/0QKXUKftCB9Abk9yxufrzpY7NHmHNIUw/bsG2e5MzhbikBuc2zK+ygSF4q9ANuiiUI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] Config.mk: Bump tags to 4.19.0 final
Message-Id: <E1sawtZ-0004kB-Vc@xenbits.xenproject.org>
Date: Mon, 05 Aug 2024 12:33:01 +0000

commit b2d2878ab2686b92fcdd7bbca4ff4c312a42bc11
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Jul 29 18:18:01 2024 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon Jul 29 18:18:01 2024 +0100

    Config.mk: Bump tags to 4.19.0 final
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 Config.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Config.mk b/Config.mk
index 8f759e95b3..ac8fb847ce 100644
--- a/Config.mk
+++ b/Config.mk
@@ -221,10 +221,10 @@ OVMF_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/ovmf.git
 OVMF_UPSTREAM_REVISION ?= ba91d0292e593df8528b66f99c1b0b14fadc8e16
 
 QEMU_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/qemu-xen.git
-QEMU_UPSTREAM_REVISION ?= qemu-xen-4.19.0-rc4
+QEMU_UPSTREAM_REVISION ?= qemu-xen-4.19.0
 
 MINIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/mini-os.git
-MINIOS_UPSTREAM_REVISION ?= xen-4.19.0-rc4
+MINIOS_UPSTREAM_REVISION ?= xen-RELEASE-4.19.0
 
 SEABIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/seabios.git
 SEABIOS_UPSTREAM_REVISION ?= rel-1.16.3
@@ -233,7 +233,7 @@ ETHERBOOT_NICS ?= rtl8139 8086100e
 
 
 QEMU_TRADITIONAL_URL ?= https://xenbits.xen.org/git-http/qemu-xen-traditional.git
-QEMU_TRADITIONAL_REVISION ?= xen-4.19.0-rc4
+QEMU_TRADITIONAL_REVISION ?= xen-4.19.0
 # Wed Jul 15 10:01:40 2020 +0100
 # qemu-trad: remove Xen path dependencies
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Aug 05 12:33:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 05 Aug 2024 12:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.772116.1182548 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sawtl-0006XL-Ev; Mon, 05 Aug 2024 12:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 772116.1182548; Mon, 05 Aug 2024 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 1sawtl-0006XD-CH; Mon, 05 Aug 2024 12:33:13 +0000
Received: by outflank-mailman (input) for mailman id 772116;
 Mon, 05 Aug 2024 12:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sawtk-0006X2-7L
 for xen-changelog@lists.xenproject.org; Mon, 05 Aug 2024 12:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sawtk-0007tj-5N
 for xen-changelog@lists.xenproject.org; Mon, 05 Aug 2024 12:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sawtk-0004ku-4T
 for xen-changelog@lists.xenproject.org; Mon, 05 Aug 2024 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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=f4E3eu2nXXfc73bRD9J2R142DQqqPvrE38W+xz4NHcQ=; b=PTkJY/Z776GaCWaUic2QFaVlzZ
	r8wVGw1FN0kJc9HsSXPoDDPHmY6mf7BLd5Ofh/RGQcjI3LanzDHTLdkBzUFBJU2PAxLOWqtw2Qr80
	q6W7893mzgYCohF1kHIOi+iiUncut+bPovB4x9/aj+o4zZDGczZjxKZy86B6gqQkDRdM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] README: make heading say 4.19
Message-Id: <E1sawtk-0004ku-4T@xenbits.xenproject.org>
Date: Mon, 05 Aug 2024 12:33:12 +0000

commit df9b8a649f0424e0a949c0f9a7961724bbe8ea70
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Jul 29 18:20:08 2024 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon Jul 29 18:20:08 2024 +0100

    README: make heading say 4.19
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 README | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/README b/README
index 560247e710..5cacce282e 100644
--- a/README
+++ b/README
@@ -1,11 +1,11 @@
-#################################################
+##################################
 __  __            _  _    _  ___
-\ \/ /___ _ __   | || |  / |/ _ \       _ __ ___
- \  // _ \ '_ \  | || |_ | | (_) |_____| '__/ __|
- /  \  __/ | | | |__   _|| |\__, |_____| | | (__
-/_/\_\___|_| |_|    |_|(_)_|  /_/      |_|  \___|
+\ \/ /___ _ __   | || |  / |/ _ \
+ \  // _ \ '_ \  | || |_ | | (_) |
+ /  \  __/ | | | |__   _|| |\__, |
+/_/\_\___|_| |_|    |_|(_)_|  /_/
 
-#################################################
+##################################
 
 https://www.xen.org/
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Aug 05 12:33:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 05 Aug 2024 12:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.772117.1182551 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sawtv-0006Zx-GA; Mon, 05 Aug 2024 12:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 772117.1182551; Mon, 05 Aug 2024 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 1sawtv-0006Zq-Dk; Mon, 05 Aug 2024 12:33:23 +0000
Received: by outflank-mailman (input) for mailman id 772117;
 Mon, 05 Aug 2024 12:33:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sawtu-0006ZO-Bj
 for xen-changelog@lists.xenproject.org; Mon, 05 Aug 2024 12:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sawtu-0007tv-9R
 for xen-changelog@lists.xenproject.org; Mon, 05 Aug 2024 12:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sawtu-0004n1-7P
 for xen-changelog@lists.xenproject.org; Mon, 05 Aug 2024 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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6TGoOYJgponw3uIVn8CRsKzbbkqGbdgs9NeNcozvL38=; b=JKooD4mnGAivPqpIsUGfm/KTHx
	Zg5nx2FFIGNKQaG/pvFF2+tMvT4SQiksXQ+o6UlmsARJntVKUBn2CU+oIztPwQaYn8NXdTEah1LPs
	9uLxQLo1tXKDcJlWQWC6S7i2kdGkDqYTViHKUC/O9Ns7kFgo5Immvu6b5AlYRPuLbesU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] Set 4.19 version
Message-Id: <E1sawtu-0004n1-7P@xenbits.xenproject.org>
Date: Mon, 05 Aug 2024 12:33:22 +0000

commit 026c9fa29716b0ff0f8b7c687908e71ba29cf239
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Mon Jul 29 18:20:45 2024 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Mon Jul 29 18:20:45 2024 +0100

    Set 4.19 version
    
    Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 xen/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/Makefile b/xen/Makefile
index e9fd19536f..16055101fb 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 ?= -rc$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .0$(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 Tue Aug 06 06:44:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Aug 2024 06:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.772501.1182940 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbDvR-0000Jr-2j; Tue, 06 Aug 2024 06:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 772501.1182940; Tue, 06 Aug 2024 06:44: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 1sbDvR-0000Jk-08; Tue, 06 Aug 2024 06:44:05 +0000
Received: by outflank-mailman (input) for mailman id 772501;
 Tue, 06 Aug 2024 06:44:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbDvP-0000Je-PI
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 06:44:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbDvP-000709-Dc
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 06:44:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbDvP-0006lC-Cg
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 06:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0+AU18YknJVG5ngLlNyZsN5twXRMmKthLcYwAxUbnCQ=; b=Etf8ND5dB/9xfMCwST6A5kfpWS
	hp062JOsL647zqKCneA2Lbny19dbSYhfd6MVuufCJmEBf+G/0xgXVg9orqtnWc2Xg6gnYp5wvTEnU
	PmWJZtqou42W3706IJ/vrf2ck6wf4cmxKh+vm6ncTHPHIlzA9fVzvXkr79HCCLFF0LTg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vpmu: guard calls to vmx/svm functions
Message-Id: <E1sbDvP-0006lC-Cg@xenbits.xenproject.org>
Date: Tue, 06 Aug 2024 06:44:03 +0000

commit cddbee85d0c0386a2126c4698c1f63baeaf292f1
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Tue Aug 6 08:35:09 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 6 08:35:09 2024 +0200

    x86/vpmu: guard calls to vmx/svm functions
    
    If VMX/SVM disabled in the build, we may still want to have vPMU drivers for
    PV guests. Yet in such case before using VMX/SVM features and functions we have
    to explicitly check if they're available in the build. For this purpose
    (and also not to complicate conditionals) two helpers introduced --
    is_{vmx,svm}_vcpu(v) that check both HVM & VMX/SVM conditions at the same time,
    and they replace is_hvm_vcpu(v) macro in Intel/AMD PMU drivers.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/vpmu_amd.c   | 11 ++++++-----
 xen/arch/x86/cpu/vpmu_intel.c | 28 +++++++++++++++-------------
 2 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/cpu/vpmu_amd.c b/xen/arch/x86/cpu/vpmu_amd.c
index 97e6315bd9..a082450e92 100644
--- a/xen/arch/x86/cpu/vpmu_amd.c
+++ b/xen/arch/x86/cpu/vpmu_amd.c
@@ -27,6 +27,7 @@
 #define is_pmu_enabled(msr) ((msr) & (1ULL << MSR_F10H_EVNTSEL_EN_SHIFT))
 #define set_guest_mode(msr) ((msr) |= (1ULL << MSR_F10H_EVNTSEL_GO_SHIFT))
 #define is_overflowed(msr) (!((msr) & (1ULL << (MSR_F10H_COUNTER_LENGTH - 1))))
+#define is_svm_vcpu(v) (IS_ENABLED(CONFIG_AMD_SVM) && is_hvm_vcpu(v))
 
 static unsigned int __read_mostly num_counters;
 static const u32 __read_mostly *counters;
@@ -289,7 +290,7 @@ static int cf_check amd_vpmu_save(struct vcpu *v,  bool to_guest)
 
     context_save(v);
 
-    if ( !vpmu_is_set(vpmu, VPMU_RUNNING) && is_hvm_vcpu(v) &&
+    if ( !vpmu_is_set(vpmu, VPMU_RUNNING) && is_svm_vcpu(v) &&
          is_msr_bitmap_on(vpmu) )
         amd_vpmu_unset_msr_bitmap(v);
 
@@ -349,7 +350,7 @@ static int cf_check amd_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content)
         return -EINVAL;
 
     /* For all counters, enable guest only mode for HVM guest */
-    if ( is_hvm_vcpu(v) && (type == MSR_TYPE_CTRL) &&
+    if ( is_svm_vcpu(v) && (type == MSR_TYPE_CTRL) &&
          !is_guest_mode(msr_content) )
     {
         set_guest_mode(msr_content);
@@ -363,7 +364,7 @@ static int cf_check amd_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content)
             return 0;
         vpmu_set(vpmu, VPMU_RUNNING);
 
-        if ( is_hvm_vcpu(v) && is_msr_bitmap_on(vpmu) )
+        if ( is_svm_vcpu(v) && is_msr_bitmap_on(vpmu) )
              amd_vpmu_set_msr_bitmap(v);
     }
 
@@ -372,7 +373,7 @@ static int cf_check amd_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content)
         (is_pmu_enabled(msr_content) == 0) && vpmu_is_set(vpmu, VPMU_RUNNING) )
     {
         vpmu_reset(vpmu, VPMU_RUNNING);
-        if ( is_hvm_vcpu(v) && is_msr_bitmap_on(vpmu) )
+        if ( is_svm_vcpu(v) && is_msr_bitmap_on(vpmu) )
              amd_vpmu_unset_msr_bitmap(v);
         release_pmu_ownership(PMU_OWNER_HVM);
     }
@@ -415,7 +416,7 @@ static void cf_check amd_vpmu_destroy(struct vcpu *v)
 {
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
 
-    if ( is_hvm_vcpu(v) && is_msr_bitmap_on(vpmu) )
+    if ( is_svm_vcpu(v) && is_msr_bitmap_on(vpmu) )
         amd_vpmu_unset_msr_bitmap(v);
 
     xfree(vpmu->context);
diff --git a/xen/arch/x86/cpu/vpmu_intel.c b/xen/arch/x86/cpu/vpmu_intel.c
index 26dd3a9358..7ce98ee42e 100644
--- a/xen/arch/x86/cpu/vpmu_intel.c
+++ b/xen/arch/x86/cpu/vpmu_intel.c
@@ -54,6 +54,8 @@
 #define MSR_PMC_ALIAS_MASK       (~(MSR_IA32_PERFCTR0 ^ MSR_IA32_A_PERFCTR0))
 static bool __read_mostly full_width_write;
 
+#define is_vmx_vcpu(v) (IS_ENABLED(CONFIG_INTEL_VMX) && is_hvm_vcpu(v))
+
 /*
  * MSR_CORE_PERF_FIXED_CTR_CTRL contains the configuration of all fixed
  * counters. 4 bits for every counter.
@@ -266,7 +268,7 @@ static inline void __core2_vpmu_save(struct vcpu *v)
         rdmsrl(MSR_P6_EVNTSEL(i), xen_pmu_cntr_pair[i].control);
     }
 
-    if ( !is_hvm_vcpu(v) )
+    if ( !is_vmx_vcpu(v) )
         rdmsrl(MSR_CORE_PERF_GLOBAL_STATUS, core2_vpmu_cxt->global_status);
     /* Save MSR to private context to make it fork-friendly */
     else if ( mem_sharing_enabled(v->domain) )
@@ -278,7 +280,7 @@ static int cf_check core2_vpmu_save(struct vcpu *v, bool to_guest)
 {
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
 
-    if ( !is_hvm_vcpu(v) )
+    if ( !is_vmx_vcpu(v) )
         wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, 0);
 
     if ( !vpmu_are_all_set(vpmu, VPMU_CONTEXT_SAVE | VPMU_CONTEXT_LOADED) )
@@ -287,7 +289,7 @@ static int cf_check core2_vpmu_save(struct vcpu *v, bool to_guest)
     __core2_vpmu_save(v);
 
     /* Unset PMU MSR bitmap to trap lazy load. */
-    if ( !vpmu_is_set(vpmu, VPMU_RUNNING) && is_hvm_vcpu(v) &&
+    if ( !vpmu_is_set(vpmu, VPMU_RUNNING) && is_vmx_vcpu(v) &&
          cpu_has_vmx_msr_bitmap )
         core2_vpmu_unset_msr_bitmap(v);
 
@@ -326,7 +328,7 @@ static inline void __core2_vpmu_load(struct vcpu *v)
     if ( vpmu_is_set(vcpu_vpmu(v), VPMU_CPU_HAS_DS) )
         wrmsrl(MSR_IA32_DS_AREA, core2_vpmu_cxt->ds_area);
 
-    if ( !is_hvm_vcpu(v) )
+    if ( !is_vmx_vcpu(v) )
     {
         wrmsrl(MSR_CORE_PERF_GLOBAL_OVF_CTRL, core2_vpmu_cxt->global_ovf_ctrl);
         core2_vpmu_cxt->global_ovf_ctrl = 0;
@@ -381,7 +383,7 @@ static int core2_vpmu_verify(struct vcpu *v)
     }
 
     if ( vpmu_is_set(vpmu, VPMU_CPU_HAS_DS) &&
-         !(is_hvm_vcpu(v)
+         !(is_vmx_vcpu(v)
            ? is_canonical_address(core2_vpmu_cxt->ds_area)
            : __addr_ok(core2_vpmu_cxt->ds_area)) )
         return -EINVAL;
@@ -442,7 +444,7 @@ static int cf_check core2_vpmu_alloc_resource(struct vcpu *v)
     if ( !acquire_pmu_ownership(PMU_OWNER_HVM) )
         return 0;
 
-    if ( is_hvm_vcpu(v) )
+    if ( is_vmx_vcpu(v) )
     {
         if ( vmx_add_host_load_msr(v, MSR_CORE_PERF_GLOBAL_CTRL, 0) )
             goto out_err;
@@ -513,7 +515,7 @@ static int core2_vpmu_msr_common_check(u32 msr_index, int *type, int *index)
         __core2_vpmu_load(current);
         vpmu_set(vpmu, VPMU_CONTEXT_LOADED);
 
-        if ( is_hvm_vcpu(current) && cpu_has_vmx_msr_bitmap )
+        if ( is_vmx_vcpu(current) && cpu_has_vmx_msr_bitmap )
             core2_vpmu_set_msr_bitmap(current);
     }
     return 1;
@@ -562,7 +564,7 @@ static int cf_check core2_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content)
             return -EINVAL;
         if ( vpmu_is_set(vpmu, VPMU_CPU_HAS_DS) )
         {
-            if ( !(is_hvm_vcpu(v) ? is_canonical_address(msr_content)
+            if ( !(is_vmx_vcpu(v) ? is_canonical_address(msr_content)
                                   : __addr_ok(msr_content)) )
             {
                 gdprintk(XENLOG_WARNING,
@@ -584,7 +586,7 @@ static int cf_check core2_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content)
         if ( msr_content & fixed_ctrl_mask )
             return -EINVAL;
 
-        if ( is_hvm_vcpu(v) )
+        if ( is_vmx_vcpu(v) )
             vmx_read_guest_msr(v, MSR_CORE_PERF_GLOBAL_CTRL,
                                &core2_vpmu_cxt->global_ctrl);
         else
@@ -653,7 +655,7 @@ static int cf_check core2_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content)
             if ( blocked )
                 return -EINVAL;
 
-            if ( is_hvm_vcpu(v) )
+            if ( is_vmx_vcpu(v) )
                 vmx_read_guest_msr(v, MSR_CORE_PERF_GLOBAL_CTRL,
                                    &core2_vpmu_cxt->global_ctrl);
             else
@@ -673,7 +675,7 @@ static int cf_check core2_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content)
         wrmsrl(msr, msr_content);
     else
     {
-        if ( is_hvm_vcpu(v) )
+        if ( is_vmx_vcpu(v) )
             vmx_write_guest_msr(v, MSR_CORE_PERF_GLOBAL_CTRL, msr_content);
         else
             wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, msr_content);
@@ -707,7 +709,7 @@ static int cf_check core2_vpmu_do_rdmsr(unsigned int msr, uint64_t *msr_content)
             *msr_content = core2_vpmu_cxt->global_status;
             break;
         case MSR_CORE_PERF_GLOBAL_CTRL:
-            if ( is_hvm_vcpu(v) )
+            if ( is_vmx_vcpu(v) )
                 vmx_read_guest_msr(v, MSR_CORE_PERF_GLOBAL_CTRL, msr_content);
             else
                 rdmsrl(MSR_CORE_PERF_GLOBAL_CTRL, *msr_content);
@@ -810,7 +812,7 @@ static void cf_check core2_vpmu_destroy(struct vcpu *v)
     vpmu->context = NULL;
     xfree(vpmu->priv_context);
     vpmu->priv_context = NULL;
-    if ( is_hvm_vcpu(v) && cpu_has_vmx_msr_bitmap )
+    if ( is_vmx_vcpu(v) && cpu_has_vmx_msr_bitmap )
         core2_vpmu_unset_msr_bitmap(v);
     release_pmu_ownership(PMU_OWNER_HVM);
     vpmu_clear(vpmu);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 06 06:44:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Aug 2024 06:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.772502.1182943 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbDva-0000Lb-4D; Tue, 06 Aug 2024 06:44:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 772502.1182943; Tue, 06 Aug 2024 06: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 1sbDva-0000LT-1b; Tue, 06 Aug 2024 06:44:14 +0000
Received: by outflank-mailman (input) for mailman id 772502;
 Tue, 06 Aug 2024 06:44:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbDvZ-0000LL-Hi
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 06:44:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbDvZ-00070V-Gp
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 06:44:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbDvZ-0006lh-Fl
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 06:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9/3f1LfIL338XJLmg3K14gPdsNh0yMuELRzFZAMXiTc=; b=Xzctg4fcHqdOs+C7JgLp313od+
	3lx2q0flUACamwhjo64RS8k8rojC0Js/kU/Frg/OLGkWBC7iEzXwZ/vCM4WPW2jDzG1XZCNz5pXVl
	CDtxGi51Ez0MBh+kQ2EF/3nff/4Ea2eaNp63oc8keR/8tVMCz8mgMomj5GFZUEAWdf3U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: refactor decode_trap_cause()
Message-Id: <E1sbDvZ-0006lh-Fl@xenbits.xenproject.org>
Date: Tue, 06 Aug 2024 06:44:13 +0000

commit 10eccbb821cbd0d623ba3cb68a01dfb79c39ea48
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Aug 6 08:36:29 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 6 08:36:29 2024 +0200

    xen/riscv: refactor decode_trap_cause()
    
    Use array_access_nospec() to prevent guest speculation.
    
    Avoid double access of trap_causes[cause].
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/traps.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/xen/arch/riscv/traps.c b/xen/arch/riscv/traps.c
index cb18b30ff2..7149504ebc 100644
--- a/xen/arch/riscv/traps.c
+++ b/xen/arch/riscv/traps.c
@@ -6,6 +6,7 @@
  */
 
 #include <xen/lib.h>
+#include <xen/nospec.h>
 #include <xen/sched.h>
 
 #include <asm/processor.h>
@@ -47,9 +48,11 @@ static const char *decode_trap_cause(unsigned long cause)
         [CAUSE_STORE_GUEST_PAGE_FAULT] = "Guest Store/AMO Page Fault",
     };
 
-    if ( cause < ARRAY_SIZE(trap_causes) && trap_causes[cause] )
-        return trap_causes[cause];
-    return "UNKNOWN";
+    const char *res = cause < ARRAY_SIZE(trap_causes)
+                      ? array_access_nospec(trap_causes, cause)
+                      : NULL;
+
+    return res ?: "UNKNOWN";
 }
 
 static const char *decode_reserved_interrupt_cause(unsigned long irq_cause)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 06 06:44:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Aug 2024 06:44:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.772503.1182949 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbDvk-0000O6-6y; Tue, 06 Aug 2024 06:44:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 772503.1182949; Tue, 06 Aug 2024 06: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 1sbDvk-0000Ny-32; Tue, 06 Aug 2024 06:44:24 +0000
Received: by outflank-mailman (input) for mailman id 772503;
 Tue, 06 Aug 2024 06:44:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbDvj-0000Nq-LF
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 06:44:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbDvj-00070i-KQ
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 06:44:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbDvj-0006mI-Iw
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 06:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1nEplUGYkJL20iroRDhcDO1Gp0fLxaVC8T60h3EUhlM=; b=s+UDQ3q9x7o+5ZXj5UuFZbAVSH
	C3odrYQJAaX/gzKDXxvzpd8isxrIcNZWbESi1eA73/gg2PJ3I37q4ttKB9tASsr667J4B3KJwAHwL
	c0Zy0TIBRl4va/lK4Kj4kvck8El+YiWzSz4c5NFNbS9vmd9IyOU1hxGnC75ietMBis8E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/shutdown: use DMI_MATCH2()
Message-Id: <E1sbDvj-0006mI-Iw@xenbits.xenproject.org>
Date: Tue, 06 Aug 2024 06:44:23 +0000

commit 44a37c7832e49cdee103a0af392b7c12705bdc25
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Aug 6 08:37:10 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 6 08:37:10 2024 +0200

    x86/shutdown: use DMI_MATCH2()
    
    ... to please Misra C:2012 Rule 9.3 (Arrays shall not be partially
    initialized).
    
    Fixes: d81dd3130351 ("x86/shutdown: change default reboot method preference")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/x86/shutdown.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/shutdown.c b/xen/arch/x86/shutdown.c
index fa60d1638d..902076cf67 100644
--- a/xen/arch/x86/shutdown.c
+++ b/xen/arch/x86/shutdown.c
@@ -498,10 +498,9 @@ static const struct dmi_system_id __initconstrel reboot_dmi_table[] = {
         .callback = override_reboot,
         .driver_data = (void *)(long)BOOT_EFI,
         .ident = "Acer TravelMate X514-51T",
-        .matches = {
+        DMI_MATCH2(
             DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
-            DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate X514-51T"),
-        },
+            DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate X514-51T")),
     },
     { }
 };
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 06 09:22:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Aug 2024 09:22:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.772619.1183062 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbGOJ-000661-Rf; Tue, 06 Aug 2024 09:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 772619.1183062; Tue, 06 Aug 2024 09: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 1sbGOJ-00065t-Ot; Tue, 06 Aug 2024 09:22:03 +0000
Received: by outflank-mailman (input) for mailman id 772619;
 Tue, 06 Aug 2024 09:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbGOI-00065n-1S
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 09:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbGOH-00021u-UO
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 09:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbGOH-0001w8-Sr
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 09: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sNaV8z1quVzsB/QBgWagszdQPMHatWOb1B0SEQd0VJg=; b=XfjowZVca9S4oeTjiOyRlg9XKq
	DFBXSy7qACEiQJY3lQCSjnaV6dy8Qf8Vi3xZW3kHAcZ4VO6Kak6EbySgA1SI0f7HFID0CSk2OEn7K
	uWixOP0mRNg73pn51TsRs2Ck1io7Ql6N2pIurFUcGglG+ebU6cLM/17ShcBjVpLIa+PI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shutdown: change default reboot method preference
Message-Id: <E1sbGOH-0001w8-Sr@xenbits.xenproject.org>
Date: Tue, 06 Aug 2024 09:22:01 +0000

commit d81dd31303513a1626973778d557a6493d86511a
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Aug 5 10:16:54 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 5 10:16:54 2024 +0200

    x86/shutdown: change default reboot method preference
    
    The current logic to chose the preferred reboot method is based on the mode Xen
    has been booted into, so if the box is booted from UEFI, the preferred reboot
    method will be to use the ResetSystem() run time service call.
    
    However, that method seems to be widely untested, and quite often leads to a
    result similar to:
    
    Hardware Dom0 shutdown: rebooting machine
    ----[ Xen-4.18-unstable  x86_64  debug=y  Tainted:   C    ]----
    CPU:    0
    RIP:    e008:[<0000000000000017>] 0000000000000017
    RFLAGS: 0000000000010202   CONTEXT: hypervisor
    [...]
    Xen call trace:
       [<0000000000000017>] R 0000000000000017
       [<ffff83207eff7b50>] S ffff83207eff7b50
       [<ffff82d0403525aa>] F machine_restart+0x1da/0x261
       [<ffff82d04035263c>] F apic_wait_icr_idle+0/0x37
       [<ffff82d040233689>] F smp_call_function_interrupt+0xc7/0xcb
       [<ffff82d040352f05>] F call_function_interrupt+0x20/0x34
       [<ffff82d04033b0d5>] F do_IRQ+0x150/0x6f3
       [<ffff82d0402018c2>] F common_interrupt+0x132/0x140
       [<ffff82d040283d33>] F arch/x86/acpi/cpu_idle.c#acpi_idle_do_entry+0x113/0x129
       [<ffff82d04028436c>] F arch/x86/acpi/cpu_idle.c#acpi_processor_idle+0x3eb/0x5f7
       [<ffff82d04032a549>] F arch/x86/domain.c#idle_loop+0xec/0xee
    
    ****************************************
    Panic on CPU 0:
    FATAL TRAP: vector = 6 (invalid opcode)
    ****************************************
    
    Which in most cases does lead to a reboot, however that's unreliable.
    
    Change the default reboot preference to prefer ACPI over UEFI if available and
    not in reduced hardware mode.
    
    This is in line to what Linux does, so it's unlikely to cause issues on current
    and future hardware, since there's a much higher chance of vendors testing
    hardware with Linux rather than Xen.
    
    Add a special case for one Acer model that does require being rebooted using
    ResetSystem().  See Linux commit 0082517fa4bce for rationale.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-By: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
 CHANGELOG.md            |  2 ++
 xen/arch/x86/shutdown.c | 19 +++++++++++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index eeaaa8b274..5521ae5bb3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
 ## [4.20.0 UNRELEASED](https://xenbits.xenproject.org/gitweb/?p=xen.git;a=shortlog;h=staging) - TBD
 
 ### Changed
+ - On x86:
+   - Prefer ACPI reboot over UEFI ResetSystem() run time service call.
 
 ### Added
 
diff --git a/xen/arch/x86/shutdown.c b/xen/arch/x86/shutdown.c
index acceec2a38..fa60d1638d 100644
--- a/xen/arch/x86/shutdown.c
+++ b/xen/arch/x86/shutdown.c
@@ -150,19 +150,20 @@ static void default_reboot_type(void)
 
     if ( xen_guest )
         reboot_type = BOOT_XEN;
+    else if ( !acpi_disabled && !acpi_gbl_reduced_hardware )
+        reboot_type = BOOT_ACPI;
     else if ( efi_enabled(EFI_RS) )
         reboot_type = BOOT_EFI;
-    else if ( acpi_disabled )
-        reboot_type = BOOT_KBD;
     else
-        reboot_type = BOOT_ACPI;
+        reboot_type = BOOT_KBD;
 }
 
 static int __init cf_check override_reboot(const struct dmi_system_id *d)
 {
     enum reboot_type type = (long)d->driver_data;
 
-    if ( type == BOOT_ACPI && acpi_disabled )
+    if ( (type == BOOT_ACPI && acpi_disabled) ||
+         (type == BOOT_EFI && !efi_enabled(EFI_RS)) )
         type = BOOT_KBD;
 
     if ( reboot_type != type )
@@ -172,6 +173,7 @@ static int __init cf_check override_reboot(const struct dmi_system_id *d)
             [BOOT_KBD]  = "keyboard controller",
             [BOOT_ACPI] = "ACPI",
             [BOOT_CF9]  = "PCI",
+            [BOOT_EFI]  = "UEFI",
         };
 
         reboot_type = type;
@@ -492,6 +494,15 @@ static const struct dmi_system_id __initconstrel reboot_dmi_table[] = {
             DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
             DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge R740")),
     },
+    {    /* Handle problems with rebooting on Acer TravelMate X514-51T. */
+        .callback = override_reboot,
+        .driver_data = (void *)(long)BOOT_EFI,
+        .ident = "Acer TravelMate X514-51T",
+        .matches = {
+            DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+            DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate X514-51T"),
+        },
+    },
     { }
 };
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Aug 06 09:22:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Aug 2024 09:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.772620.1183065 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbGOT-00068P-Us; Tue, 06 Aug 2024 09:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 772620.1183065; Tue, 06 Aug 2024 09: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 1sbGOT-00068I-SL; Tue, 06 Aug 2024 09:22:13 +0000
Received: by outflank-mailman (input) for mailman id 772620;
 Tue, 06 Aug 2024 09:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbGOS-000689-2x
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 09:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbGOS-00022K-1i
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 09:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbGOS-0001x9-0M
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 09:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NOgm2Rn9SRi+JRATXwdDkcVJZHs/fEdhyvNxtRB5vhk=; b=BvwRfoIhMY72yI74kUuriQviTG
	k79V8tCpVpQFpihyBNKw/Tsj/z86a63iFOKkpxynL3sRotztnKHh4vFN3O3tHRfRPwRxuS7r4hVFc
	aZf+0KGn24MnecnCGsDOKtv5DPCmgkRuE3zC4Z0S7IzbxpFHovHzmgxj2HcmN4Yue8ww=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/dom0: delay setting SMAP after dom0 build is done
Message-Id: <E1sbGOS-0001x9-0M@xenbits.xenproject.org>
Date: Tue, 06 Aug 2024 09:22:12 +0000

commit ac6b9309694de9b2b5163886656282f6ada71565
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Aug 5 10:18:05 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 5 10:18:05 2024 +0200

    x86/dom0: delay setting SMAP after dom0 build is done
    
    Delay setting X86_CR4_SMAP on the BSP until the domain building is done, so
    that there's no need to disable SMAP.  Note however that SMAP is enabled for
    the APs on bringup, as domain builder code strictly run on the BSP.  Delaying
    the setting for the APs would mean having to do a callfunc IPI later in order
    to set it on all the APs.
    
    The fixes tag is to account for the wrong usage of cpu_has_smap in
    create_dom0(), it should instead have used
    boot_cpu_has(X86_FEATURE_XEN_SMAP).
    
    While there also make cr4_pv32_mask __ro_after_init.
    
    Fixes: 493ab190e5b1 ('xen/sm{e, a}p: allow disabling sm{e, a}p for Xen itself')
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/setup.c | 48 +++++++++++++++++++++++++++---------------------
 1 file changed, 27 insertions(+), 21 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index eee20bb175..a7a85e94e3 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -80,7 +80,7 @@ int8_t __initdata opt_probe_port_aliases = -1;
 boolean_param("probe-port-aliases", opt_probe_port_aliases);
 
 /* Only used in asm code and within this source file */
-unsigned long asmlinkage __read_mostly cr4_pv32_mask;
+unsigned long asmlinkage __ro_after_init cr4_pv32_mask;
 
 /* **** Linux config option: propagated to domain0. */
 /* "acpi=off":    Sisables both ACPI table parsing and interpreter. */
@@ -955,26 +955,9 @@ static struct domain *__init create_dom0(const module_t *image,
         }
     }
 
-    /*
-     * Temporarily clear SMAP in CR4 to allow user-accesses in construct_dom0().
-     * This saves a large number of corner cases interactions with
-     * copy_from_user().
-     */
-    if ( cpu_has_smap )
-    {
-        cr4_pv32_mask &= ~X86_CR4_SMAP;
-        write_cr4(read_cr4() & ~X86_CR4_SMAP);
-    }
-
     if ( construct_dom0(d, image, headroom, initrd, cmdline) != 0 )
         panic("Could not construct domain 0\n");
 
-    if ( cpu_has_smap )
-    {
-        write_cr4(read_cr4() | X86_CR4_SMAP);
-        cr4_pv32_mask |= X86_CR4_SMAP;
-    }
-
     return d;
 }
 
@@ -1907,16 +1890,26 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     if ( cpu_has_smep && opt_smep != SMEP_HVM_ONLY )
         setup_force_cpu_cap(X86_FEATURE_XEN_SMEP);
     if ( boot_cpu_has(X86_FEATURE_XEN_SMEP) )
+    {
         set_in_cr4(X86_CR4_SMEP);
+        BUILD_BUG_ON(!(X86_CR4_SMEP & XEN_CR4_PV32_BITS));
+        cr4_pv32_mask |= X86_CR4_SMEP;
+    }
 
     if ( !opt_smap )
         setup_clear_cpu_cap(X86_FEATURE_SMAP);
     if ( cpu_has_smap && opt_smap != SMAP_HVM_ONLY )
         setup_force_cpu_cap(X86_FEATURE_XEN_SMAP);
     if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
-        set_in_cr4(X86_CR4_SMAP);
-
-    cr4_pv32_mask = mmu_cr4_features & XEN_CR4_PV32_BITS;
+        /*
+         * Set SMAP on the %cr4 mask so that it's set for APs on bringup, but
+         * don't set for the BSP until domain building is done.
+         *
+         * Don't set it in cr4_pv32_mask either, until it's also set on the
+         * BSP.  Otherwise the BUG in cr4_pv32_restore would trigger for events
+         * received on the BSP.
+         */
+        mmu_cr4_features |= X86_CR4_SMAP;
 
     if ( boot_cpu_has(X86_FEATURE_FSGSBASE) )
         set_in_cr4(X86_CR4_FSGSBASE);
@@ -2048,6 +2041,19 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     if ( !dom0 )
         panic("Could not set up DOM0 guest OS\n");
 
+    /*
+     * Enable SMAP only after being done with the domain building phase, as the
+     * PV builder switches to the domain page-tables and must be run with SMAP
+     * disabled.
+     */
+    if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
+    {
+        ASSERT(mmu_cr4_features & X86_CR4_SMAP);
+        write_cr4(read_cr4() | X86_CR4_SMAP);
+        BUILD_BUG_ON(!(X86_CR4_SMAP & XEN_CR4_PV32_BITS));
+        cr4_pv32_mask |= X86_CR4_SMAP;
+    }
+
     heap_init_late();
 
     init_trace_bufs();
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Aug 06 09:22:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Aug 2024 09:22:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.772621.1183070 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbGOe-0006Cp-0K; Tue, 06 Aug 2024 09:22:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 772621.1183070; Tue, 06 Aug 2024 09: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 1sbGOd-0006Ci-Tq; Tue, 06 Aug 2024 09:22:23 +0000
Received: by outflank-mailman (input) for mailman id 772621;
 Tue, 06 Aug 2024 09:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbGOc-0006CT-6y
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 09:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbGOc-00022k-54
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 09:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbGOc-0001yI-3x
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 09: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tbG6mfDgtm4s3IoE/we8JxiQDEsTl+lkQdda+ybOqkg=; b=Z7sKXVKK1oTBbFCSRA443rt1ke
	8BHN8fEXkRQ/LH4xu1OdcdJxkkzb8TgcA/9Mt5R12bFK229QiuuZQXIXz/2f4DQlsdXQSNiVqIU95
	Kw5hJqZdUp2xlx68rjvp/7yFIpFfbgif+RIZpqJqIz3EjMw+QTVPPFd5ZL/1aILoF3pY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Revert "x86/dom0: delay setting SMAP after dom0 build is done"
Message-Id: <E1sbGOc-0001yI-3x@xenbits.xenproject.org>
Date: Tue, 06 Aug 2024 09:22:22 +0000

commit bec25f11d5180d407cf04d2de2525fa6f876bde1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Aug 5 12:55:37 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 5 12:55:37 2024 +0200

    Revert "x86/dom0: delay setting SMAP after dom0 build is done"
    
    This reverts commit ac6b9309694de9b2b5163886656282f6ada71565. The
    change crashes Xen on boot on SMAP-capable systems.
---
 xen/arch/x86/setup.c | 48 +++++++++++++++++++++---------------------------
 1 file changed, 21 insertions(+), 27 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index a7a85e94e3..eee20bb175 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -80,7 +80,7 @@ int8_t __initdata opt_probe_port_aliases = -1;
 boolean_param("probe-port-aliases", opt_probe_port_aliases);
 
 /* Only used in asm code and within this source file */
-unsigned long asmlinkage __ro_after_init cr4_pv32_mask;
+unsigned long asmlinkage __read_mostly cr4_pv32_mask;
 
 /* **** Linux config option: propagated to domain0. */
 /* "acpi=off":    Sisables both ACPI table parsing and interpreter. */
@@ -955,9 +955,26 @@ static struct domain *__init create_dom0(const module_t *image,
         }
     }
 
+    /*
+     * Temporarily clear SMAP in CR4 to allow user-accesses in construct_dom0().
+     * This saves a large number of corner cases interactions with
+     * copy_from_user().
+     */
+    if ( cpu_has_smap )
+    {
+        cr4_pv32_mask &= ~X86_CR4_SMAP;
+        write_cr4(read_cr4() & ~X86_CR4_SMAP);
+    }
+
     if ( construct_dom0(d, image, headroom, initrd, cmdline) != 0 )
         panic("Could not construct domain 0\n");
 
+    if ( cpu_has_smap )
+    {
+        write_cr4(read_cr4() | X86_CR4_SMAP);
+        cr4_pv32_mask |= X86_CR4_SMAP;
+    }
+
     return d;
 }
 
@@ -1890,26 +1907,16 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     if ( cpu_has_smep && opt_smep != SMEP_HVM_ONLY )
         setup_force_cpu_cap(X86_FEATURE_XEN_SMEP);
     if ( boot_cpu_has(X86_FEATURE_XEN_SMEP) )
-    {
         set_in_cr4(X86_CR4_SMEP);
-        BUILD_BUG_ON(!(X86_CR4_SMEP & XEN_CR4_PV32_BITS));
-        cr4_pv32_mask |= X86_CR4_SMEP;
-    }
 
     if ( !opt_smap )
         setup_clear_cpu_cap(X86_FEATURE_SMAP);
     if ( cpu_has_smap && opt_smap != SMAP_HVM_ONLY )
         setup_force_cpu_cap(X86_FEATURE_XEN_SMAP);
     if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
-        /*
-         * Set SMAP on the %cr4 mask so that it's set for APs on bringup, but
-         * don't set for the BSP until domain building is done.
-         *
-         * Don't set it in cr4_pv32_mask either, until it's also set on the
-         * BSP.  Otherwise the BUG in cr4_pv32_restore would trigger for events
-         * received on the BSP.
-         */
-        mmu_cr4_features |= X86_CR4_SMAP;
+        set_in_cr4(X86_CR4_SMAP);
+
+    cr4_pv32_mask = mmu_cr4_features & XEN_CR4_PV32_BITS;
 
     if ( boot_cpu_has(X86_FEATURE_FSGSBASE) )
         set_in_cr4(X86_CR4_FSGSBASE);
@@ -2041,19 +2048,6 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     if ( !dom0 )
         panic("Could not set up DOM0 guest OS\n");
 
-    /*
-     * Enable SMAP only after being done with the domain building phase, as the
-     * PV builder switches to the domain page-tables and must be run with SMAP
-     * disabled.
-     */
-    if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
-    {
-        ASSERT(mmu_cr4_features & X86_CR4_SMAP);
-        write_cr4(read_cr4() | X86_CR4_SMAP);
-        BUILD_BUG_ON(!(X86_CR4_SMAP & XEN_CR4_PV32_BITS));
-        cr4_pv32_mask |= X86_CR4_SMAP;
-    }
-
     heap_init_late();
 
     init_trace_bufs();
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Aug 06 18:44:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Aug 2024 18:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773094.1183547 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbPAD-0001a5-M7; Tue, 06 Aug 2024 18:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773094.1183547; Tue, 06 Aug 2024 18:44: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 1sbPAD-0001Zx-JW; Tue, 06 Aug 2024 18:44:05 +0000
Received: by outflank-mailman (input) for mailman id 773094;
 Tue, 06 Aug 2024 18:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbPAC-0001Zm-3w
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 18:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbPAC-00041H-1z
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 18:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbPAC-00021d-1H
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 18:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yce2/r2/K9qYSxcLhOxXeExHR4lXB6kMveoBW1G+RLA=; b=zaBQ+dLGGJzh3pJaQinSEhdRCJ
	G2uHwMgvJNKwoIp6JTtAOS+Un4G6CX4+84yUPxVstkrJFl3zaau3o2PWD4rTAVyZRr+0nXIwneaRQ
	s8geVlJ4yc+5FlNj8yYCg1QnYcxHVTZUSxIttHhtexmYIFxceRsuqO+fnlUFTxbAcdi0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: dom0less: Add #redistributor-regions property to GICv3 node
Message-Id: <E1sbPAC-00021d-1H@xenbits.xenproject.org>
Date: Tue, 06 Aug 2024 18:44:04 +0000

commit 3679ed232e95f5abdeea1f0792d8e4d1e3e53fe6
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Thu Jul 4 09:54:19 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Aug 6 19:08:50 2024 +0100

    xen/arm: dom0less: Add #redistributor-regions property to GICv3 node
    
    Dom0less domain using host memory layout may use more than one
    re-distributor region (d->arch.vgic.nr_regions > 1). In that case Xen
    will add them in a "reg" property of a GICv3 domU node. Guest needs to
    know how many regions to search for, and therefore the GICv3 dt binding
    [1] specifies that "#redistributor-regions" property is required if more
    than one redistributor region is present. However, Xen does not add this
    property which makes guest believe, there is just one such region. This
    can lead to guest boot failure when doing GIC SMP initialization. Fix it
    by adding this property, which matches what we do for hwdom.
    
    [1] Linux: Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.yaml
    
    Fixes: 4809f9ec7d71 ("xen/arm: if direct-map domain use native addresses for GICv3")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/dom0less-build.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index f919d3acf9..09b65e44ae 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -176,6 +176,11 @@ static int __init make_gicv3_domU_node(struct kernel_info *kinfo)
     if ( res )
         return res;
 
+    res = fdt_property_cell(fdt, "#redistributor-regions",
+                            d->arch.vgic.nr_regions);
+    if ( res )
+        return res;
+
     /* reg specifies all re-distributors and Distributor. */
     len = (GUEST_ROOT_ADDRESS_CELLS + GUEST_ROOT_SIZE_CELLS) *
           (d->arch.vgic.nr_regions + 1) * sizeof(__be32);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 06 18:44:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Aug 2024 18:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773095.1183551 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbPAN-0001cE-Nf; Tue, 06 Aug 2024 18:44:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773095.1183551; Tue, 06 Aug 2024 18:44: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 1sbPAN-0001c6-L0; Tue, 06 Aug 2024 18:44:15 +0000
Received: by outflank-mailman (input) for mailman id 773095;
 Tue, 06 Aug 2024 18:44:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbPAM-0001bm-5k
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 18:44:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbPAM-00041f-4o
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 18:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbPAM-00022M-49
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 18:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3uskbUQlgNYUKjWZB6XtwsvJ+bmPgmz/GU9EabkMr6Y=; b=xZmJGtbHiKhkwEkPdVNaI2TKnS
	XhhUeGQAr81FITZGpTd1HWJc7ISQeWkKlGs0gCzCnT/TBulDOi1wFsReagbmqGZR3oXzUL2W54Xcp
	M0WrWmIDx3TTfr7JykLfUEi0S6Asus1axrOFfG4NBKlXTPWRwL9KhOGpLWnWJBLjeKE4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: bootfdt: Fix device tree memory node probing
Message-Id: <E1sbPAM-00022M-49@xenbits.xenproject.org>
Date: Tue, 06 Aug 2024 18:44:14 +0000

commit 47d4d3cdc5e97fa12dd91e1faa863d8bdd96b18f
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Wed Jul 10 13:22:04 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Aug 6 19:09:46 2024 +0100

    xen/arm: bootfdt: Fix device tree memory node probing
    
    Memory node probing is done as part of early_scan_node() that is called
    for each node with depth >= 1 (root node is at depth 0). According to
    Devicetree Specification v0.4, chapter 3.4, /memory node can only exists
    as a top level node. However, Xen incorrectly considers all the nodes with
    unit node name "memory" as RAM. This buggy behavior can result in a
    failure if there are other nodes in the device tree (at depth >= 2) with
    "memory" as unit node name. An example can be a "memory@xxx" node under
    /reserved-memory. Fix it by introducing device_tree_is_memory_node() to
    perform all the required checks to assess if a node is a proper /memory
    node.
    
    Fixes: 3e99c95ba1c8 ("arm, device tree: parse the DTB for RAM location and size")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Julien Grall <julien@xen.org>
---
 xen/arch/arm/bootfdt.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
index 6e060111d9..f2892fce0a 100644
--- a/xen/arch/arm/bootfdt.c
+++ b/xen/arch/arm/bootfdt.c
@@ -83,6 +83,32 @@ static bool __init device_tree_node_compatible(const void *fdt, int node,
     return false;
 }
 
+/*
+ * Check if a node is a proper /memory node according to Devicetree
+ * Specification v0.4, chapter 3.4.
+ */
+static bool __init device_tree_is_memory_node(const void *fdt, int node,
+                                              int depth)
+{
+    const char *type;
+    int len;
+
+    if ( depth != 1 )
+        return false;
+
+    if ( !device_tree_node_matches(fdt, node, "memory") )
+        return false;
+
+    type = fdt_getprop(fdt, node, "device_type", &len);
+    if ( !type )
+        return false;
+
+    if ( (len <= strlen("memory")) || strcmp(type, "memory") )
+        return false;
+
+    return true;
+}
+
 void __init device_tree_get_reg(const __be32 **cell, uint32_t address_cells,
                                 uint32_t size_cells, paddr_t *start,
                                 paddr_t *size)
@@ -448,7 +474,7 @@ static int __init early_scan_node(const void *fdt,
      * populated. So we should skip the parsing.
      */
     if ( !efi_enabled(EFI_BOOT) &&
-         device_tree_node_matches(fdt, node, "memory") )
+         device_tree_is_memory_node(fdt, node, depth) )
         rc = process_memory_node(fdt, node, name, depth,
                                  address_cells, size_cells, bootinfo_get_mem());
     else if ( depth == 1 && !dt_node_cmp(name, "reserved-memory") )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 06 18:44:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Aug 2024 18:44:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773096.1183555 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbPAX-0001fB-Q3; Tue, 06 Aug 2024 18:44:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773096.1183555; Tue, 06 Aug 2024 18:44: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 1sbPAX-0001f4-Mk; Tue, 06 Aug 2024 18:44:25 +0000
Received: by outflank-mailman (input) for mailman id 773096;
 Tue, 06 Aug 2024 18:44:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbPAW-0001el-8y
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 18:44:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbPAW-00041w-7z
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 18:44:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbPAW-00023E-79
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 18:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jgkvJUsaecExNAr3giP5lJ+AADcJwWFfb2vHayAn11Y=; b=bgEqANQxU5UaTm8gKGvLiTLpvu
	p7co8PGZXNYYUejF/+6KFdCPOjet5hvJj5FeYmb4g1OrVbXlJ+3BpptmddII6bul+L2j1woVrrDqC
	P8+7j+UEWAuXJ8xcC1YTFt2DHIwfCXOz4fDHH8Gt6HW5RtnWab88xmW3ikcfvd7Y6/Xs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/device-tree: Move Arm's setup.c bootinfo functions to common
Message-Id: <E1sbPAW-00023E-79@xenbits.xenproject.org>
Date: Tue, 06 Aug 2024 18:44:24 +0000

commit d6c57aa085e7abb1eacf015511f0f40bc2f28d81
Author:     Shawn Anastasio <sanastasio@raptorengineering.com>
AuthorDate: Tue Aug 6 13:41:13 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Aug 6 19:10:56 2024 +0100

    xen/device-tree: Move Arm's setup.c bootinfo functions to common
    
    Arm's setup.c contains a collection of functions for parsing memory map
    and other boot information from a device tree. Since these routines are
    generally useful on any architecture that supports device tree booting,
    move them into xen/common/device-tree.
    
    Also, common/device_tree.c has been moved to the device-tree folder with
    the corresponding updates to common/Makefile and common/device-tree/Makefile.
    
    Mentioning of arm32 is changed to CONFIG_SEPARATE_XENHEAP in comparison with
    original ARM's code as now it is moved in common code.
    
    Suggested-by: Julien Grall <julien@xen.org>
    Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com>
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 MAINTAINERS                          |    3 +-
 xen/arch/arm/include/asm/setup.h     |  185 +--
 xen/arch/arm/setup.c                 |  432 -------
 xen/common/Makefile                  |    2 +-
 xen/common/device-tree/Makefile      |    2 +
 xen/common/device-tree/bootinfo.c    |  459 +++++++
 xen/common/device-tree/device-tree.c | 2253 ++++++++++++++++++++++++++++++++++
 xen/common/device_tree.c             | 2253 ----------------------------------
 xen/include/xen/bootfdt.h            |  195 +++
 9 files changed, 2913 insertions(+), 2871 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 7c524a8a93..89be48fdf9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -291,9 +291,10 @@ M:	Bertrand Marquis <bertrand.marquis@arm.com>
 M:	Michal Orzel <michal.orzel@amd.com>
 S:	Supported
 F:	xen/common/libfdt/
-F:	xen/common/device_tree.c
+F:	xen/common/device-tree/
 F:	xen/common/dt-overlay.c
 F:	xen/include/xen/libfdt/
+F:	xen/include/xen/bootfdt.h
 F:	xen/include/xen/device_tree.h
 F:	xen/drivers/passthrough/device_tree.c
 
diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/setup.h
index c34179da93..1748be29e5 100644
--- a/xen/arch/arm/include/asm/setup.h
+++ b/xen/arch/arm/include/asm/setup.h
@@ -3,159 +3,11 @@
 
 #include <public/version.h>
 #include <asm/p2m.h>
+#include <xen/bootfdt.h>
 #include <xen/device_tree.h>
 
-#define MIN_FDT_ALIGN 8
 #define MAX_FDT_SIZE SZ_2M
 
-#define NR_MEM_BANKS 256
-#define NR_SHMEM_BANKS 32
-
-#define MAX_MODULES 32 /* Current maximum useful modules */
-
-typedef enum {
-    BOOTMOD_XEN,
-    BOOTMOD_FDT,
-    BOOTMOD_KERNEL,
-    BOOTMOD_RAMDISK,
-    BOOTMOD_XSM,
-    BOOTMOD_GUEST_DTB,
-    BOOTMOD_UNKNOWN
-}  bootmodule_kind;
-
-enum membank_type {
-    /*
-     * The MEMBANK_DEFAULT type refers to either reserved memory for the
-     * device/firmware (when the bank is in 'reserved_mem') or any RAM (when
-     * the bank is in 'mem').
-     */
-    MEMBANK_DEFAULT,
-    /*
-     * The MEMBANK_STATIC_DOMAIN type is used to indicate whether the memory
-     * bank is bound to a static Xen domain. It is only valid when the bank
-     * is in reserved_mem.
-     */
-    MEMBANK_STATIC_DOMAIN,
-    /*
-     * The MEMBANK_STATIC_HEAP type is used to indicate whether the memory
-     * bank is reserved as static heap. It is only valid when the bank is
-     * in reserved_mem.
-     */
-    MEMBANK_STATIC_HEAP,
-    /*
-     * The MEMBANK_FDT_RESVMEM type is used to indicate whether the memory
-     * bank is from the FDT reserve map.
-     */
-    MEMBANK_FDT_RESVMEM,
-};
-
-/* Indicates the maximum number of characters(\0 included) for shm_id */
-#define MAX_SHM_ID_LENGTH 16
-
-struct shmem_membank_extra {
-    char shm_id[MAX_SHM_ID_LENGTH];
-    unsigned int nr_shm_borrowers;
-};
-
-struct membank {
-    paddr_t start;
-    paddr_t size;
-    union {
-        enum membank_type type;
-#ifdef CONFIG_STATIC_SHM
-        struct shmem_membank_extra *shmem_extra;
-#endif
-    };
-};
-
-struct membanks {
-    __struct_group(membanks_hdr, common, ,
-        unsigned int nr_banks;
-        unsigned int max_banks;
-    );
-    struct membank bank[];
-};
-
-struct meminfo {
-    struct membanks_hdr common;
-    struct membank bank[NR_MEM_BANKS];
-};
-
-struct shared_meminfo {
-    struct membanks_hdr common;
-    struct membank bank[NR_SHMEM_BANKS];
-    struct shmem_membank_extra extra[NR_SHMEM_BANKS];
-};
-
-/*
- * The domU flag is set for kernels and ramdisks of "xen,domain" nodes.
- * The purpose of the domU flag is to avoid getting confused in
- * kernel_probe, where we try to guess which is the dom0 kernel and
- * initrd to be compatible with all versions of the multiboot spec. 
- */
-#define BOOTMOD_MAX_CMDLINE 1024
-struct bootmodule {
-    bootmodule_kind kind;
-    bool domU;
-    paddr_t start;
-    paddr_t size;
-};
-
-/* DT_MAX_NAME is the node name max length according the DT spec */
-#define DT_MAX_NAME 41
-struct bootcmdline {
-    bootmodule_kind kind;
-    bool domU;
-    paddr_t start;
-    char dt_name[DT_MAX_NAME];
-    char cmdline[BOOTMOD_MAX_CMDLINE];
-};
-
-struct bootmodules {
-    int nr_mods;
-    struct bootmodule module[MAX_MODULES];
-};
-
-struct bootcmdlines {
-    unsigned int nr_mods;
-    struct bootcmdline cmdline[MAX_MODULES];
-};
-
-struct bootinfo {
-    struct meminfo mem;
-    /* The reserved regions are only used when booting using Device-Tree */
-    struct meminfo reserved_mem;
-    struct bootmodules modules;
-    struct bootcmdlines cmdlines;
-#ifdef CONFIG_ACPI
-    struct meminfo acpi;
-#endif
-#ifdef CONFIG_STATIC_SHM
-    struct shared_meminfo shmem;
-#endif
-    bool static_heap;
-};
-
-#ifdef CONFIG_ACPI
-#define BOOTINFO_ACPI_INIT .acpi.common.max_banks = NR_MEM_BANKS,
-#else
-#define BOOTINFO_ACPI_INIT
-#endif
-
-#ifdef CONFIG_STATIC_SHM
-#define BOOTINFO_SHMEM_INIT .shmem.common.max_banks = NR_SHMEM_BANKS,
-#else
-#define BOOTINFO_SHMEM_INIT
-#endif
-
-#define BOOTINFO_INIT                               \
-{                                                   \
-    .mem.common.max_banks = NR_MEM_BANKS,           \
-    .reserved_mem.common.max_banks = NR_MEM_BANKS,  \
-    BOOTINFO_ACPI_INIT                              \
-    BOOTINFO_SHMEM_INIT                             \
-}
-
 struct map_range_data
 {
     struct domain *d;
@@ -167,39 +19,8 @@ struct map_range_data
     struct rangeset *irq_ranges;
 };
 
-extern struct bootinfo bootinfo;
-
 extern domid_t max_init_domid;
 
-static inline struct membanks *bootinfo_get_mem(void)
-{
-    return container_of(&bootinfo.mem.common, struct membanks, common);
-}
-
-static inline struct membanks *bootinfo_get_reserved_mem(void)
-{
-    return container_of(&bootinfo.reserved_mem.common, struct membanks, common);
-}
-
-#ifdef CONFIG_ACPI
-static inline struct membanks *bootinfo_get_acpi(void)
-{
-    return container_of(&bootinfo.acpi.common, struct membanks, common);
-}
-#endif
-
-#ifdef CONFIG_STATIC_SHM
-static inline struct membanks *bootinfo_get_shmem(void)
-{
-    return container_of(&bootinfo.shmem.common, struct membanks, common);
-}
-
-static inline struct shmem_membank_extra *bootinfo_get_shmem_extra(void)
-{
-    return bootinfo.shmem.extra;
-}
-#endif
-
 void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len);
 
 size_t estimate_efi_size(unsigned int mem_nr_banks);
@@ -220,9 +41,6 @@ void fw_unreserved_regions(paddr_t s, paddr_t e,
                            void (*cb)(paddr_t ps, paddr_t pe),
                            unsigned int first);
 
-size_t boot_fdt_info(const void *fdt, paddr_t paddr);
-const char *boot_fdt_cmdline(const void *fdt);
-
 bool check_reserved_regions_overlap(paddr_t region_start, paddr_t region_size);
 
 struct bootmodule *add_boot_module(bootmodule_kind kind,
@@ -237,7 +55,6 @@ struct bootcmdline * boot_cmdline_find_by_name(const char *name);
 const char *boot_module_kind_as_string(bootmodule_kind kind);
 
 void init_pdx(void);
-void populate_boot_allocator(void);
 void setup_mm(void);
 
 extern uint32_t hyp_traps_vector[];
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 0c2fdaceaf..cb2c0a16b8 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -48,8 +48,6 @@
 #include <xsm/xsm.h>
 #include <asm/acpi.h>
 
-struct bootinfo __initdata bootinfo = BOOTINFO_INIT;
-
 /*
  * Sanitized version of cpuinfo containing only features available on all
  * cores (only on arm64 as there is no sanitization support on arm32).
@@ -203,321 +201,6 @@ static void __init processor_id(void)
     processor_setup();
 }
 
-static void __init dt_unreserved_regions(paddr_t s, paddr_t e,
-                                         void (*cb)(paddr_t ps, paddr_t pe),
-                                         unsigned int first)
-{
-    const struct membanks *reserved_mem = bootinfo_get_reserved_mem();
-#ifdef CONFIG_STATIC_SHM
-    const struct membanks *shmem = bootinfo_get_shmem();
-    unsigned int offset;
-#endif
-    unsigned int i;
-
-    /*
-     * i is the current bootmodule we are evaluating across all possible
-     * kinds.
-     */
-    for ( i = first; i < reserved_mem->nr_banks; i++ )
-    {
-        paddr_t r_s = reserved_mem->bank[i].start;
-        paddr_t r_e = r_s + reserved_mem->bank[i].size;
-
-        if ( s < r_e && r_s < e )
-        {
-            dt_unreserved_regions(r_e, e, cb, i + 1);
-            dt_unreserved_regions(s, r_s, cb, i + 1);
-            return;
-        }
-    }
-
-#ifdef CONFIG_STATIC_SHM
-    /*
-     * When retrieving the corresponding shared memory addresses
-     * below, we need to index the shmem->bank starting from 0, hence
-     * we need to use i - reserved_mem->nr_banks.
-    */
-    offset = reserved_mem->nr_banks;
-    for ( ; i - offset < shmem->nr_banks; i++ )
-    {
-        paddr_t r_s, r_e;
-
-        r_s = shmem->bank[i - offset].start;
-
-        /* Shared memory banks can contain INVALID_PADDR as start */
-        if ( INVALID_PADDR == r_s )
-            continue;
-
-        r_e = r_s + shmem->bank[i - offset].size;
-
-        if ( s < r_e && r_s < e )
-        {
-            dt_unreserved_regions(r_e, e, cb, i + 1);
-            dt_unreserved_regions(s, r_s, cb, i + 1);
-            return;
-        }
-    }
-#endif
-
-    cb(s, e);
-}
-
-/*
- * TODO: '*_end' could be 0 if the bank/region is at the end of the physical
- * address space. This is for now not handled as it requires more rework.
- */
-static bool __init meminfo_overlap_check(const struct membanks *mem,
-                                         paddr_t region_start,
-                                         paddr_t region_size)
-{
-    paddr_t bank_start = INVALID_PADDR, bank_end = 0;
-    paddr_t region_end = region_start + region_size;
-    unsigned int i, bank_num = mem->nr_banks;
-
-    for ( i = 0; i < bank_num; i++ )
-    {
-        bank_start = mem->bank[i].start;
-        bank_end = bank_start + mem->bank[i].size;
-
-        if ( INVALID_PADDR == bank_start || region_end <= bank_start ||
-             region_start >= bank_end )
-            continue;
-        else
-        {
-            printk("Region: [%#"PRIpaddr", %#"PRIpaddr") overlapping with bank[%u]: [%#"PRIpaddr", %#"PRIpaddr")\n",
-                   region_start, region_end, i, bank_start, bank_end);
-            return true;
-        }
-    }
-
-    return false;
-}
-
-/*
- * TODO: '*_end' could be 0 if the module/region is at the end of the physical
- * address space. This is for now not handled as it requires more rework.
- */
-static bool __init bootmodules_overlap_check(struct bootmodules *bootmodules,
-                                             paddr_t region_start,
-                                             paddr_t region_size)
-{
-    paddr_t mod_start = INVALID_PADDR, mod_end = 0;
-    paddr_t region_end = region_start + region_size;
-    unsigned int i, mod_num = bootmodules->nr_mods;
-
-    for ( i = 0; i < mod_num; i++ )
-    {
-        mod_start = bootmodules->module[i].start;
-        mod_end = mod_start + bootmodules->module[i].size;
-
-        if ( region_end <= mod_start || region_start >= mod_end )
-            continue;
-        else
-        {
-            printk("Region: [%#"PRIpaddr", %#"PRIpaddr") overlapping with mod[%u]: [%#"PRIpaddr", %#"PRIpaddr")\n",
-                   region_start, region_end, i, mod_start, mod_end);
-            return true;
-        }
-    }
-
-    return false;
-}
-
-void __init fw_unreserved_regions(paddr_t s, paddr_t e,
-                                  void (*cb)(paddr_t ps, paddr_t pe),
-                                  unsigned int first)
-{
-    if ( acpi_disabled )
-        dt_unreserved_regions(s, e, cb, first);
-    else
-        cb(s, e);
-}
-
-/*
- * Given an input physical address range, check if this range is overlapping
- * with the existing reserved memory regions defined in bootinfo.
- * Return true if the input physical address range is overlapping with any
- * existing reserved memory regions, otherwise false.
- */
-bool __init check_reserved_regions_overlap(paddr_t region_start,
-                                           paddr_t region_size)
-{
-    const struct membanks *mem_banks[] = {
-        bootinfo_get_reserved_mem(),
-#ifdef CONFIG_ACPI
-        bootinfo_get_acpi(),
-#endif
-#ifdef CONFIG_STATIC_SHM
-        bootinfo_get_shmem(),
-#endif
-    };
-    unsigned int i;
-
-    /*
-     * Check if input region is overlapping with reserved memory banks or
-     * ACPI EfiACPIReclaimMemory (when ACPI feature is enabled) or static
-     * shared memory banks (when static shared memory feature is enabled)
-     */
-    for ( i = 0; i < ARRAY_SIZE(mem_banks); i++ )
-        if ( meminfo_overlap_check(mem_banks[i], region_start, region_size) )
-            return true;
-
-    /* Check if input region is overlapping with bootmodules */
-    if ( bootmodules_overlap_check(&bootinfo.modules,
-                                   region_start, region_size) )
-        return true;
-
-    return false;
-}
-
-struct bootmodule __init *add_boot_module(bootmodule_kind kind,
-                                          paddr_t start, paddr_t size,
-                                          bool domU)
-{
-    struct bootmodules *mods = &bootinfo.modules;
-    struct bootmodule *mod;
-    unsigned int i;
-
-    if ( mods->nr_mods == MAX_MODULES )
-    {
-        printk("Ignoring %s boot module at %"PRIpaddr"-%"PRIpaddr" (too many)\n",
-               boot_module_kind_as_string(kind), start, start + size);
-        return NULL;
-    }
-
-    if ( check_reserved_regions_overlap(start, size) )
-        return NULL;
-
-    for ( i = 0 ; i < mods->nr_mods ; i++ )
-    {
-        mod = &mods->module[i];
-        if ( mod->kind == kind && mod->start == start )
-        {
-            if ( !domU )
-                mod->domU = false;
-            return mod;
-        }
-    }
-
-    mod = &mods->module[mods->nr_mods++];
-    mod->kind = kind;
-    mod->start = start;
-    mod->size = size;
-    mod->domU = domU;
-
-    return mod;
-}
-
-/*
- * boot_module_find_by_kind can only be used to return Xen modules (e.g
- * XSM, DTB) or Dom0 modules. This is not suitable for looking up guest
- * modules.
- */
-struct bootmodule * __init boot_module_find_by_kind(bootmodule_kind kind)
-{
-    struct bootmodules *mods = &bootinfo.modules;
-    struct bootmodule *mod;
-    int i;
-    for (i = 0 ; i < mods->nr_mods ; i++ )
-    {
-        mod = &mods->module[i];
-        if ( mod->kind == kind && !mod->domU )
-            return mod;
-    }
-    return NULL;
-}
-
-void __init add_boot_cmdline(const char *name, const char *cmdline,
-                             bootmodule_kind kind, paddr_t start, bool domU)
-{
-    struct bootcmdlines *cmds = &bootinfo.cmdlines;
-    struct bootcmdline *cmd;
-
-    if ( cmds->nr_mods == MAX_MODULES )
-    {
-        printk("Ignoring %s cmdline (too many)\n", name);
-        return;
-    }
-
-    cmd = &cmds->cmdline[cmds->nr_mods++];
-    cmd->kind = kind;
-    cmd->domU = domU;
-    cmd->start = start;
-
-    ASSERT(strlen(name) <= DT_MAX_NAME);
-    safe_strcpy(cmd->dt_name, name);
-
-    if ( strlen(cmdline) > BOOTMOD_MAX_CMDLINE )
-        panic("module %s command line too long\n", name);
-    safe_strcpy(cmd->cmdline, cmdline);
-}
-
-/*
- * boot_cmdline_find_by_kind can only be used to return Xen modules (e.g
- * XSM, DTB) or Dom0 modules. This is not suitable for looking up guest
- * modules.
- */
-struct bootcmdline * __init boot_cmdline_find_by_kind(bootmodule_kind kind)
-{
-    struct bootcmdlines *cmds = &bootinfo.cmdlines;
-    struct bootcmdline *cmd;
-    int i;
-
-    for ( i = 0 ; i < cmds->nr_mods ; i++ )
-    {
-        cmd = &cmds->cmdline[i];
-        if ( cmd->kind == kind && !cmd->domU )
-            return cmd;
-    }
-    return NULL;
-}
-
-struct bootcmdline * __init boot_cmdline_find_by_name(const char *name)
-{
-    struct bootcmdlines *mods = &bootinfo.cmdlines;
-    struct bootcmdline *mod;
-    unsigned int i;
-
-    for (i = 0 ; i < mods->nr_mods ; i++ )
-    {
-        mod = &mods->cmdline[i];
-        if ( strcmp(mod->dt_name, name) == 0 )
-            return mod;
-    }
-    return NULL;
-}
-
-struct bootmodule * __init boot_module_find_by_addr_and_kind(bootmodule_kind kind,
-                                                             paddr_t start)
-{
-    struct bootmodules *mods = &bootinfo.modules;
-    struct bootmodule *mod;
-    unsigned int i;
-
-    for (i = 0 ; i < mods->nr_mods ; i++ )
-    {
-        mod = &mods->module[i];
-        if ( mod->kind == kind && mod->start == start )
-            return mod;
-    }
-    return NULL;
-}
-
-const char * __init boot_module_kind_as_string(bootmodule_kind kind)
-{
-    switch ( kind )
-    {
-    case BOOTMOD_XEN:     return "Xen";
-    case BOOTMOD_FDT:     return "Device Tree";
-    case BOOTMOD_KERNEL:  return "Kernel";
-    case BOOTMOD_RAMDISK: return "Ramdisk";
-    case BOOTMOD_XSM:     return "XSM";
-    case BOOTMOD_GUEST_DTB:     return "DTB";
-    case BOOTMOD_UNKNOWN: return "Unknown";
-    default: BUG();
-    }
-}
-
 void __init discard_initial_modules(void)
 {
     struct bootmodules *mi = &bootinfo.modules;
@@ -556,40 +239,6 @@ static void * __init relocate_fdt(paddr_t dtb_paddr, size_t dtb_size)
     return fdt;
 }
 
-/*
- * Return the end of the non-module region starting at s. In other
- * words return s the start of the next modules after s.
- *
- * On input *end is the end of the region which should be considered
- * and it is updated to reflect the end of the module, clipped to the
- * end of the region if it would run over.
- */
-static paddr_t __init next_module(paddr_t s, paddr_t *end)
-{
-    struct bootmodules *mi = &bootinfo.modules;
-    paddr_t lowest = ~(paddr_t)0;
-    int i;
-
-    for ( i = 0; i < mi->nr_mods; i++ )
-    {
-        paddr_t mod_s = mi->module[i].start;
-        paddr_t mod_e = mod_s + mi->module[i].size;
-
-        if ( !mi->module[i].size )
-            continue;
-
-        if ( mod_s < s )
-            continue;
-        if ( mod_s > lowest )
-            continue;
-        if ( mod_s > *end )
-            continue;
-        lowest = mod_s;
-        *end = min(*end, mod_e);
-    }
-    return lowest;
-}
-
 void __init init_pdx(void)
 {
     const struct membanks *mem = bootinfo_get_mem();
@@ -635,87 +284,6 @@ void __init init_pdx(void)
     }
 }
 
-/*
- * Populate the boot allocator.
- * If a static heap was not provided by the admin, all the RAM but the
- * following regions will be added:
- *  - Modules (e.g., Xen, Kernel)
- *  - Reserved regions
- *  - Xenheap (arm32 only)
- * If a static heap was provided by the admin, populate the boot
- * allocator with the corresponding regions only, but with Xenheap excluded
- * on arm32.
- */
-void __init populate_boot_allocator(void)
-{
-    unsigned int i;
-    const struct membanks *banks = bootinfo_get_mem();
-    const struct membanks *reserved_mem = bootinfo_get_reserved_mem();
-    paddr_t s, e;
-
-    if ( bootinfo.static_heap )
-    {
-        for ( i = 0 ; i < reserved_mem->nr_banks; i++ )
-        {
-            if ( reserved_mem->bank[i].type != MEMBANK_STATIC_HEAP )
-                continue;
-
-            s = reserved_mem->bank[i].start;
-            e = s + reserved_mem->bank[i].size;
-#ifdef CONFIG_ARM_32
-            /* Avoid the xenheap, note that the xenheap cannot across a bank */
-            if ( s <= mfn_to_maddr(directmap_mfn_start) &&
-                 e >= mfn_to_maddr(directmap_mfn_end) )
-            {
-                init_boot_pages(s, mfn_to_maddr(directmap_mfn_start));
-                init_boot_pages(mfn_to_maddr(directmap_mfn_end), e);
-            }
-            else
-#endif
-                init_boot_pages(s, e);
-        }
-
-        return;
-    }
-
-    for ( i = 0; i < banks->nr_banks; i++ )
-    {
-        const struct membank *bank = &banks->bank[i];
-        paddr_t bank_end = bank->start + bank->size;
-
-        s = bank->start;
-        while ( s < bank_end )
-        {
-            paddr_t n = bank_end;
-
-            e = next_module(s, &n);
-
-            if ( e == ~(paddr_t)0 )
-                e = n = bank_end;
-
-            /*
-             * Module in a RAM bank other than the one which we are
-             * not dealing with here.
-             */
-            if ( e > bank_end )
-                e = bank_end;
-
-#ifdef CONFIG_ARM_32
-            /* Avoid the xenheap */
-            if ( s < mfn_to_maddr(directmap_mfn_end) &&
-                 mfn_to_maddr(directmap_mfn_start) < e )
-            {
-                e = mfn_to_maddr(directmap_mfn_start);
-                n = mfn_to_maddr(directmap_mfn_end);
-            }
-#endif
-
-            fw_unreserved_regions(s, e, init_boot_pages, 0);
-            s = n;
-        }
-    }
-}
-
 size_t __read_mostly dcache_line_bytes;
 
 /* C entry point for boot CPU */
diff --git a/xen/common/Makefile b/xen/common/Makefile
index f12a474d40..7e66802a9e 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -6,7 +6,7 @@ obj-$(CONFIG_HYPFS_CONFIG) += config_data.o
 obj-$(CONFIG_CORE_PARKING) += core_parking.o
 obj-y += cpu.o
 obj-$(CONFIG_DEBUG_TRACE) += debugtrace.o
-obj-$(CONFIG_HAS_DEVICE_TREE) += device_tree.o
+obj-$(CONFIG_HAS_DEVICE_TREE) += device-tree/
 obj-$(CONFIG_IOREQ_SERVER) += dm.o
 obj-y += domain.o
 obj-$(CONFIG_OVERLAY_DTB) += dt-overlay.o
diff --git a/xen/common/device-tree/Makefile b/xen/common/device-tree/Makefile
new file mode 100644
index 0000000000..f813f7555f
--- /dev/null
+++ b/xen/common/device-tree/Makefile
@@ -0,0 +1,2 @@
+obj-y += bootinfo.init.o
+obj-y += device-tree.o
diff --git a/xen/common/device-tree/bootinfo.c b/xen/common/device-tree/bootinfo.c
new file mode 100644
index 0000000000..f2e6a1145b
--- /dev/null
+++ b/xen/common/device-tree/bootinfo.c
@@ -0,0 +1,459 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Derived from Xen 4.19's $xen/arch/arm/setup.c.
+ *
+ * bookkeeping routines.
+ *
+ * Tim Deegan <tim@xen.org>
+ * Copyright (c) 2011 Citrix Systems.
+ * Copyright (c) 2024 Raptor Engineering LLC
+ */
+
+#include <xen/acpi.h>
+#include <xen/bootfdt.h>
+#include <xen/bug.h>
+#include <xen/device_tree.h>
+#include <xen/init.h>
+#include <xen/libfdt/libfdt-xen.h>
+#include <xen/mm.h>
+
+struct bootinfo __initdata bootinfo = BOOTINFO_INIT;
+
+const char * __init boot_module_kind_as_string(bootmodule_kind kind)
+{
+    switch ( kind )
+    {
+    case BOOTMOD_XEN:     return "Xen";
+    case BOOTMOD_FDT:     return "Device Tree";
+    case BOOTMOD_KERNEL:  return "Kernel";
+    case BOOTMOD_RAMDISK: return "Ramdisk";
+    case BOOTMOD_XSM:     return "XSM";
+    case BOOTMOD_GUEST_DTB:     return "DTB";
+    case BOOTMOD_UNKNOWN: return "Unknown";
+    default: BUG();
+    }
+}
+
+static void __init dt_unreserved_regions(paddr_t s, paddr_t e,
+                                         void (*cb)(paddr_t ps, paddr_t pe),
+                                         unsigned int first)
+{
+    const struct membanks *reserved_mem = bootinfo_get_reserved_mem();
+#ifdef CONFIG_STATIC_SHM
+    const struct membanks *shmem = bootinfo_get_shmem();
+    unsigned int offset;
+#endif
+    unsigned int i;
+
+    /*
+     * i is the current bootmodule we are evaluating across all possible
+     * kinds.
+     */
+    for ( i = first; i < reserved_mem->nr_banks; i++ )
+    {
+        paddr_t r_s = reserved_mem->bank[i].start;
+        paddr_t r_e = r_s + reserved_mem->bank[i].size;
+
+        if ( s < r_e && r_s < e )
+        {
+            dt_unreserved_regions(r_e, e, cb, i + 1);
+            dt_unreserved_regions(s, r_s, cb, i + 1);
+            return;
+        }
+    }
+
+#ifdef CONFIG_STATIC_SHM
+    /*
+     * When retrieving the corresponding shared memory addresses
+     * below, we need to index the shmem->bank starting from 0, hence
+     * we need to use i - reserved_mem->nr_banks.
+    */
+    offset = reserved_mem->nr_banks;
+    for ( ; i - offset < shmem->nr_banks; i++ )
+    {
+        paddr_t r_s, r_e;
+
+        r_s = shmem->bank[i - offset].start;
+
+        /* Shared memory banks can contain INVALID_PADDR as start */
+        if ( INVALID_PADDR == r_s )
+            continue;
+
+        r_e = r_s + shmem->bank[i - offset].size;
+
+        if ( s < r_e && r_s < e )
+        {
+            dt_unreserved_regions(r_e, e, cb, i + 1);
+            dt_unreserved_regions(s, r_s, cb, i + 1);
+            return;
+        }
+    }
+#endif
+
+    cb(s, e);
+}
+
+/*
+ * TODO: '*_end' could be 0 if the bank/region is at the end of the physical
+ * address space. This is for now not handled as it requires more rework.
+ */
+static bool __init meminfo_overlap_check(const struct membanks *mem,
+                                         paddr_t region_start,
+                                         paddr_t region_size)
+{
+    paddr_t bank_start = INVALID_PADDR, bank_end = 0;
+    paddr_t region_end = region_start + region_size;
+    unsigned int i, bank_num = mem->nr_banks;
+
+    for ( i = 0; i < bank_num; i++ )
+    {
+        bank_start = mem->bank[i].start;
+        bank_end = bank_start + mem->bank[i].size;
+
+        if ( INVALID_PADDR == bank_start || region_end <= bank_start ||
+             region_start >= bank_end )
+            continue;
+        else
+        {
+            printk("Region: [%#"PRIpaddr", %#"PRIpaddr") overlapping with bank[%u]: [%#"PRIpaddr", %#"PRIpaddr")\n",
+                   region_start, region_end, i, bank_start, bank_end);
+            return true;
+        }
+    }
+
+    return false;
+}
+
+/*
+ * TODO: '*_end' could be 0 if the module/region is at the end of the physical
+ * address space. This is for now not handled as it requires more rework.
+ */
+static bool __init bootmodules_overlap_check(struct bootmodules *bootmodules,
+                                             paddr_t region_start,
+                                             paddr_t region_size)
+{
+    paddr_t mod_start = INVALID_PADDR, mod_end = 0;
+    paddr_t region_end = region_start + region_size;
+    unsigned int i, mod_num = bootmodules->nr_mods;
+
+    for ( i = 0; i < mod_num; i++ )
+    {
+        mod_start = bootmodules->module[i].start;
+        mod_end = mod_start + bootmodules->module[i].size;
+
+        if ( region_end <= mod_start || region_start >= mod_end )
+            continue;
+        else
+        {
+            printk("Region: [%#"PRIpaddr", %#"PRIpaddr") overlapping with mod[%u]: [%#"PRIpaddr", %#"PRIpaddr")\n",
+                   region_start, region_end, i, mod_start, mod_end);
+            return true;
+        }
+    }
+
+    return false;
+}
+
+void __init fw_unreserved_regions(paddr_t s, paddr_t e,
+                                  void (*cb)(paddr_t ps, paddr_t pe),
+                                  unsigned int first)
+{
+    if ( acpi_disabled )
+        dt_unreserved_regions(s, e, cb, first);
+    else
+        cb(s, e);
+}
+
+/*
+ * Given an input physical address range, check if this range is overlapping
+ * with the existing reserved memory regions defined in bootinfo.
+ * Return true if the input physical address range is overlapping with any
+ * existing reserved memory regions, otherwise false.
+ */
+bool __init check_reserved_regions_overlap(paddr_t region_start,
+                                           paddr_t region_size)
+{
+    const struct membanks *mem_banks[] = {
+        bootinfo_get_reserved_mem(),
+#ifdef CONFIG_ACPI
+        bootinfo_get_acpi(),
+#endif
+#ifdef CONFIG_STATIC_SHM
+        bootinfo_get_shmem(),
+#endif
+    };
+    unsigned int i;
+
+    /*
+     * Check if input region is overlapping with reserved memory banks or
+     * ACPI EfiACPIReclaimMemory (when ACPI feature is enabled) or static
+     * shared memory banks (when static shared memory feature is enabled)
+     */
+    for ( i = 0; i < ARRAY_SIZE(mem_banks); i++ )
+        if ( meminfo_overlap_check(mem_banks[i], region_start, region_size) )
+            return true;
+
+    /* Check if input region is overlapping with bootmodules */
+    if ( bootmodules_overlap_check(&bootinfo.modules,
+                                   region_start, region_size) )
+        return true;
+
+    return false;
+}
+
+struct bootmodule __init *add_boot_module(bootmodule_kind kind,
+                                          paddr_t start, paddr_t size,
+                                          bool domU)
+{
+    struct bootmodules *mods = &bootinfo.modules;
+    struct bootmodule *mod;
+    unsigned int i;
+
+    if ( mods->nr_mods == MAX_MODULES )
+    {
+        printk("Ignoring %s boot module at %"PRIpaddr"-%"PRIpaddr" (too many)\n",
+               boot_module_kind_as_string(kind), start, start + size);
+        return NULL;
+    }
+
+    if ( check_reserved_regions_overlap(start, size) )
+        return NULL;
+
+    for ( i = 0 ; i < mods->nr_mods ; i++ )
+    {
+        mod = &mods->module[i];
+        if ( mod->kind == kind && mod->start == start )
+        {
+            if ( !domU )
+                mod->domU = false;
+            return mod;
+        }
+    }
+
+    mod = &mods->module[mods->nr_mods++];
+    mod->kind = kind;
+    mod->start = start;
+    mod->size = size;
+    mod->domU = domU;
+
+    return mod;
+}
+
+/*
+ * boot_module_find_by_kind can only be used to return Xen modules (e.g
+ * XSM, DTB) or Dom0 modules. This is not suitable for looking up guest
+ * modules.
+ */
+struct bootmodule * __init boot_module_find_by_kind(bootmodule_kind kind)
+{
+    struct bootmodules *mods = &bootinfo.modules;
+    struct bootmodule *mod;
+    int i;
+    for (i = 0 ; i < mods->nr_mods ; i++ )
+    {
+        mod = &mods->module[i];
+        if ( mod->kind == kind && !mod->domU )
+            return mod;
+    }
+    return NULL;
+}
+
+void __init add_boot_cmdline(const char *name, const char *cmdline,
+                             bootmodule_kind kind, paddr_t start, bool domU)
+{
+    struct bootcmdlines *cmds = &bootinfo.cmdlines;
+    struct bootcmdline *cmd;
+
+    if ( cmds->nr_mods == MAX_MODULES )
+    {
+        printk("Ignoring %s cmdline (too many)\n", name);
+        return;
+    }
+
+    cmd = &cmds->cmdline[cmds->nr_mods++];
+    cmd->kind = kind;
+    cmd->domU = domU;
+    cmd->start = start;
+
+    ASSERT(strlen(name) <= DT_MAX_NAME);
+    safe_strcpy(cmd->dt_name, name);
+
+    if ( strlen(cmdline) > BOOTMOD_MAX_CMDLINE )
+        panic("module %s command line too long\n", name);
+    safe_strcpy(cmd->cmdline, cmdline);
+}
+
+/*
+ * boot_cmdline_find_by_kind can only be used to return Xen modules (e.g
+ * XSM, DTB) or Dom0 modules. This is not suitable for looking up guest
+ * modules.
+ */
+struct bootcmdline * __init boot_cmdline_find_by_kind(bootmodule_kind kind)
+{
+    struct bootcmdlines *cmds = &bootinfo.cmdlines;
+    struct bootcmdline *cmd;
+    int i;
+
+    for ( i = 0 ; i < cmds->nr_mods ; i++ )
+    {
+        cmd = &cmds->cmdline[i];
+        if ( cmd->kind == kind && !cmd->domU )
+            return cmd;
+    }
+    return NULL;
+}
+
+struct bootcmdline * __init boot_cmdline_find_by_name(const char *name)
+{
+    struct bootcmdlines *mods = &bootinfo.cmdlines;
+    struct bootcmdline *mod;
+    unsigned int i;
+
+    for (i = 0 ; i < mods->nr_mods ; i++ )
+    {
+        mod = &mods->cmdline[i];
+        if ( strcmp(mod->dt_name, name) == 0 )
+            return mod;
+    }
+    return NULL;
+}
+
+struct bootmodule * __init boot_module_find_by_addr_and_kind(bootmodule_kind kind,
+                                                             paddr_t start)
+{
+    struct bootmodules *mods = &bootinfo.modules;
+    struct bootmodule *mod;
+    unsigned int i;
+
+    for (i = 0 ; i < mods->nr_mods ; i++ )
+    {
+        mod = &mods->module[i];
+        if ( mod->kind == kind && mod->start == start )
+            return mod;
+    }
+    return NULL;
+}
+
+/*
+ * Return the end of the non-module region starting at s. In other
+ * words return s the start of the next modules after s.
+ *
+ * On input *end is the end of the region which should be considered
+ * and it is updated to reflect the end of the module, clipped to the
+ * end of the region if it would run over.
+ */
+static paddr_t __init next_module(paddr_t s, paddr_t *end)
+{
+    struct bootmodules *mi = &bootinfo.modules;
+    paddr_t lowest = ~(paddr_t)0;
+    int i;
+
+    for ( i = 0; i < mi->nr_mods; i++ )
+    {
+        paddr_t mod_s = mi->module[i].start;
+        paddr_t mod_e = mod_s + mi->module[i].size;
+
+        if ( !mi->module[i].size )
+            continue;
+
+        if ( mod_s < s )
+            continue;
+        if ( mod_s > lowest )
+            continue;
+        if ( mod_s > *end )
+            continue;
+        lowest = mod_s;
+        *end = min(*end, mod_e);
+    }
+    return lowest;
+}
+
+/*
+ * Populate the boot allocator.
+ * If a static heap was not provided by the admin, all the RAM but the
+ * following regions will be added:
+ *  - Modules (e.g., Xen, Kernel)
+ *  - Reserved regions
+ *  - Xenheap (CONFIG_SEPARATE_XENHEAP only)
+ * If a static heap was provided by the admin, populate the boot
+ * allocator with the corresponding regions only, but with Xenheap excluded
+ * on CONFIG_SEPARATE_XENHEAP.
+ */
+void __init populate_boot_allocator(void)
+{
+    unsigned int i;
+    const struct membanks *banks = bootinfo_get_mem();
+    const struct membanks *reserved_mem = bootinfo_get_reserved_mem();
+    paddr_t s, e;
+
+    if ( bootinfo.static_heap )
+    {
+        for ( i = 0 ; i < reserved_mem->nr_banks; i++ )
+        {
+            if ( reserved_mem->bank[i].type != MEMBANK_STATIC_HEAP )
+                continue;
+
+            s = reserved_mem->bank[i].start;
+            e = s + reserved_mem->bank[i].size;
+#ifdef CONFIG_SEPARATE_XENHEAP
+            /* Avoid the xenheap, note that the xenheap cannot across a bank */
+            if ( s <= mfn_to_maddr(directmap_mfn_start) &&
+                 e >= mfn_to_maddr(directmap_mfn_end) )
+            {
+                init_boot_pages(s, mfn_to_maddr(directmap_mfn_start));
+                init_boot_pages(mfn_to_maddr(directmap_mfn_end), e);
+            }
+            else
+#endif
+                init_boot_pages(s, e);
+        }
+
+        return;
+    }
+
+    for ( i = 0; i < banks->nr_banks; i++ )
+    {
+        const struct membank *bank = &banks->bank[i];
+        paddr_t bank_end = bank->start + bank->size;
+
+        s = bank->start;
+        while ( s < bank_end )
+        {
+            paddr_t n = bank_end;
+
+            e = next_module(s, &n);
+
+            if ( e == ~(paddr_t)0 )
+                e = n = bank_end;
+
+            /*
+             * Module in a RAM bank other than the one which we are
+             * not dealing with here.
+             */
+            if ( e > bank_end )
+                e = bank_end;
+
+#ifdef CONFIG_SEPARATE_XENHEAP
+            /* Avoid the xenheap */
+            if ( s < mfn_to_maddr(directmap_mfn_end) &&
+                 mfn_to_maddr(directmap_mfn_start) < e )
+            {
+                e = mfn_to_maddr(directmap_mfn_start);
+                n = mfn_to_maddr(directmap_mfn_end);
+            }
+#endif
+
+            fw_unreserved_regions(s, e, init_boot_pages, 0);
+            s = n;
+        }
+    }
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/common/device-tree/device-tree.c b/xen/common/device-tree/device-tree.c
new file mode 100644
index 0000000000..8d1017a49d
--- /dev/null
+++ b/xen/common/device-tree/device-tree.c
@@ -0,0 +1,2253 @@
+/*
+ * Device Tree
+ *
+ * Copyright (C) 2012 Citrix Systems, Inc.
+ * Copyright 2009 Benjamin Herrenschmidt, IBM Corp
+ * benh@kernel.crashing.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <xen/types.h>
+#include <xen/init.h>
+#include <xen/guest_access.h>
+#include <xen/device_tree.h>
+#include <xen/kernel.h>
+#include <xen/lib.h>
+#include <xen/libfdt/libfdt.h>
+#include <xen/mm.h>
+#include <xen/stdarg.h>
+#include <xen/string.h>
+#include <xen/cpumask.h>
+#include <xen/ctype.h>
+#include <asm/setup.h>
+#include <xen/err.h>
+
+const void *device_tree_flattened;
+dt_irq_xlate_func dt_irq_xlate;
+/* Host device tree */
+struct dt_device_node *dt_host;
+/* Interrupt controller node*/
+const struct dt_device_node *dt_interrupt_controller;
+DEFINE_RWLOCK(dt_host_lock);
+
+/**
+ * struct dt_alias_prop - Alias property in 'aliases' node
+ * @link: List node to link the structure in aliases_lookup list
+ * @alias: Alias property name
+ * @np: Pointer to device_node that the alias stands for
+ * @id: Index value from end of alias name
+ * @stem: Alias string without the index
+ *
+ * The structure represents one alias property of 'aliases' node as
+ * an entry in aliases_lookup list.
+ */
+struct dt_alias_prop {
+    struct list_head link;
+    const char *alias;
+    struct dt_device_node *np;
+    int id;
+    char stem[0];
+};
+
+static LIST_HEAD(aliases_lookup);
+
+#ifdef CONFIG_DEVICE_TREE_DEBUG
+static void dt_dump_addr(const char *s, const __be32 *addr, int na)
+{
+    dt_dprintk("%s", s);
+    while ( na-- )
+        dt_dprintk(" %08x", be32_to_cpu(*(addr++)));
+    dt_dprintk("\n");
+}
+#else
+static void dt_dump_addr(const char *s, const __be32 *addr, int na) { }
+#endif
+
+#define DT_BAD_ADDR ((u64)-1)
+
+/* Max address size we deal with */
+#define DT_MAX_ADDR_CELLS 4
+#define DT_CHECK_ADDR_COUNT(na) ((na) > 0 && (na) <= DT_MAX_ADDR_CELLS)
+#define DT_CHECK_COUNTS(na, ns) (DT_CHECK_ADDR_COUNT(na) && (ns) > 0)
+
+/* Callbacks for bus specific translators */
+struct dt_bus
+{
+    const char *name;
+    const char *addresses;
+    bool (*match)(const struct dt_device_node *node);
+    void (*count_cells)(const struct dt_device_node *child,
+                        int *addrc, int *sizec);
+    u64 (*map)(__be32 *addr, const __be32 *range, int na, int ns, int pna);
+    int (*translate)(__be32 *addr, u64 offset, int na);
+    unsigned int (*get_flags)(const __be32 *addr);
+};
+
+void dt_get_range(const __be32 **cellp, const struct dt_device_node *np,
+                  u64 *address, u64 *size)
+{
+    *address = dt_next_cell(dt_n_addr_cells(np), cellp);
+    *size = dt_next_cell(dt_n_size_cells(np), cellp);
+}
+
+void dt_set_cell(__be32 **cellp, int size, u64 val)
+{
+    int cells = size;
+
+    while ( size-- )
+    {
+        (*cellp)[size] = cpu_to_fdt32(val);
+        val >>= 32;
+    }
+
+    (*cellp) += cells;
+}
+
+void dt_set_range(__be32 **cellp, const struct dt_device_node *np,
+                  u64 address, u64 size)
+{
+    dt_set_cell(cellp, dt_n_addr_cells(np), address);
+    dt_set_cell(cellp, dt_n_size_cells(np), size);
+}
+
+void dt_child_set_range(__be32 **cellp, int addrcells, int sizecells,
+                        u64 address, u64 size)
+{
+    dt_set_cell(cellp, addrcells, address);
+    dt_set_cell(cellp, sizecells, size);
+}
+
+static void __init *unflatten_dt_alloc(unsigned long *mem, unsigned long size,
+                                       unsigned long align)
+{
+    void *res;
+
+    *mem = ROUNDUP(*mem, align);
+    res = (void *)*mem;
+    *mem += size;
+
+    return res;
+}
+
+/* Find a property with a given name for a given node and return it. */
+const struct dt_property *dt_find_property(const struct dt_device_node *np,
+                                           const char *name, u32 *lenp)
+{
+    const struct dt_property *pp;
+
+    if ( !np )
+        return NULL;
+
+    for ( pp = np->properties; pp; pp = pp->next )
+    {
+        if ( dt_prop_cmp(pp->name, name) == 0 )
+        {
+            if ( lenp )
+                *lenp = pp->length;
+            break;
+        }
+    }
+
+    return pp;
+}
+
+const void *dt_get_property(const struct dt_device_node *np,
+                            const char *name, u32 *lenp)
+{
+    const struct dt_property *pp = dt_find_property(np, name, lenp);
+
+    return pp ? pp->value : NULL;
+}
+
+bool dt_property_read_u32(const struct dt_device_node *np,
+                          const char *name, u32 *out_value)
+{
+    u32 len;
+    const __be32 *val;
+
+    val = dt_get_property(np, name, &len);
+    if ( !val || len < sizeof(*out_value) )
+        return 0;
+
+    *out_value = be32_to_cpup(val);
+
+    return 1;
+}
+
+
+bool dt_property_read_u64(const struct dt_device_node *np,
+                          const char *name, u64 *out_value)
+{
+    u32 len;
+    const __be32 *val;
+
+    val = dt_get_property(np, name, &len);
+    if ( !val || len < sizeof(*out_value) )
+        return 0;
+
+    *out_value = dt_read_number(val, 2);
+
+    return 1;
+}
+int dt_property_read_string(const struct dt_device_node *np,
+                            const char *propname, const char **out_string)
+{
+    const struct dt_property *pp = dt_find_property(np, propname, NULL);
+
+    if ( !pp )
+        return -EINVAL;
+    if ( !pp->length )
+        return -ENODATA;
+    if ( strnlen(pp->value, pp->length) >= pp->length )
+        return -EILSEQ;
+
+    *out_string = pp->value;
+
+    return 0;
+}
+
+/**
+ * dt_find_property_value_of_size
+ *
+ * @np:     device node from which the property value is to be read.
+ * @propname:   name of the property to be searched.
+ * @min:    minimum allowed length of property value
+ * @max:    maximum allowed length of property value (0 means unlimited)
+ * @len:    if !=NULL, actual length is written to here
+ *
+ * Search for a property in a device node and valid the requested size.
+ *
+ * Return: The property value on success, -EINVAL if the property does not
+ * exist, -ENODATA if property does not have a value, and -EOVERFLOW if the
+ * property data is too small or too large.
+ */
+static void *dt_find_property_value_of_size(const struct dt_device_node *np,
+                                            const char *propname, u32 min,
+                                            u32 max, size_t *len)
+{
+    const struct dt_property *prop = dt_find_property(np, propname, NULL);
+
+    if ( !prop )
+        return ERR_PTR(-EINVAL);
+    if ( !prop->value )
+        return ERR_PTR(-ENODATA);
+    if ( prop->length < min )
+        return ERR_PTR(-EOVERFLOW);
+    if ( max && prop->length > max )
+        return ERR_PTR(-EOVERFLOW);
+
+    if ( len )
+        *len = prop->length;
+
+    return prop->value;
+}
+
+int dt_property_read_variable_u32_array(const struct dt_device_node *np,
+                                        const char *propname, u32 *out_values,
+                                        size_t sz_min, size_t sz_max)
+{
+    size_t sz, count;
+    const __be32 *val = dt_find_property_value_of_size(np, propname,
+                        (sz_min * sizeof(*out_values)),
+                        (sz_max * sizeof(*out_values)),
+                        &sz);
+
+    if ( IS_ERR(val) )
+        return PTR_ERR(val);
+
+    if ( !sz_max )
+        sz = sz_min;
+    else
+        sz /= sizeof(*out_values);
+
+    count = sz;
+    while ( count-- )
+        *out_values++ = be32_to_cpup(val++);
+
+    return sz;
+}
+
+int dt_property_match_string(const struct dt_device_node *np,
+                             const char *propname, const char *string)
+{
+    const struct dt_property *dtprop = dt_find_property(np, propname, NULL);
+    size_t l;
+    int i;
+    const char *p, *end;
+
+    if ( !dtprop )
+        return -EINVAL;
+    if ( !dtprop->value )
+        return -ENODATA;
+
+    p = dtprop->value;
+    end = p + dtprop->length;
+
+    for ( i = 0; p < end; i++, p += l )
+    {
+        l = strnlen(p, end - p) + 1;
+        if ( p + l > end )
+            return -EILSEQ;
+        if ( strcmp(string, p) == 0 )
+            return i; /* Found it; return index */
+    }
+    return -ENODATA;
+}
+
+bool dt_device_is_compatible(const struct dt_device_node *device,
+                             const char *compat)
+{
+    const char* cp;
+    u32 cplen, l;
+
+    cp = dt_get_property(device, "compatible", &cplen);
+    if ( cp == NULL )
+        return 0;
+    while ( cplen > 0 )
+    {
+        if ( dt_compat_cmp(cp, compat) == 0 )
+            return 1;
+        l = strlen(cp) + 1;
+        cp += l;
+        cplen -= l;
+    }
+
+    return 0;
+}
+
+bool dt_machine_is_compatible(const char *compat)
+{
+    const struct dt_device_node *root;
+    bool rc = false;
+
+    root = dt_find_node_by_path("/");
+    if ( root )
+    {
+        rc = dt_device_is_compatible(root, compat);
+    }
+    return rc;
+}
+
+struct dt_device_node *dt_find_node_by_name(struct dt_device_node *from,
+                                            const char *name)
+{
+    struct dt_device_node *np;
+    struct dt_device_node *dt;
+
+    dt = from ? from->allnext : dt_host;
+    dt_for_each_device_node(dt, np)
+        if ( np->name && (dt_node_cmp(np->name, name) == 0) )
+            break;
+
+    return np;
+}
+
+struct dt_device_node *dt_find_node_by_type(struct dt_device_node *from,
+                                            const char *type)
+{
+    struct dt_device_node *np;
+    struct dt_device_node *dt;
+
+    dt = from ? from->allnext : dt_host;
+    dt_for_each_device_node(dt, np)
+        if ( np->type && (dt_node_cmp(np->type, type) == 0) )
+            break;
+
+    return np;
+}
+
+struct dt_device_node *dt_find_node_by_path_from(struct dt_device_node *from,
+                                                 const char *path)
+{
+    struct dt_device_node *np;
+
+    dt_for_each_device_node(from, np)
+        if ( np->full_name && (dt_node_cmp(np->full_name, path) == 0) )
+            break;
+
+    return np;
+}
+
+int dt_find_node_by_gpath(XEN_GUEST_HANDLE(char) u_path, uint32_t u_plen,
+                          struct dt_device_node **node)
+{
+    char *path;
+
+    path = safe_copy_string_from_guest(u_path, u_plen, PAGE_SIZE);
+    if ( IS_ERR(path) )
+        return PTR_ERR(path);
+
+    *node = dt_find_node_by_path(path);
+
+    xfree(path);
+
+    return (*node == NULL) ? -ESRCH : 0;
+}
+
+struct dt_device_node *dt_find_node_by_alias(const char *alias)
+{
+    const struct dt_alias_prop *app;
+
+    list_for_each_entry( app, &aliases_lookup, link )
+    {
+        if ( !strcmp(app->alias, alias) )
+            return app->np;
+    }
+
+    return NULL;
+}
+
+const struct dt_device_match *
+dt_match_node(const struct dt_device_match *matches,
+              const struct dt_device_node *node)
+{
+    if ( !matches )
+        return NULL;
+
+    while ( matches->path || matches->type ||
+            matches->compatible || matches->not_available || matches->prop )
+    {
+        bool match = true;
+
+        if ( matches->path )
+            match &= dt_node_path_is_equal(node, matches->path);
+
+        if ( matches->type )
+            match &= dt_device_type_is_equal(node, matches->type);
+
+        if ( matches->compatible )
+            match &= dt_device_is_compatible(node, matches->compatible);
+
+        if ( matches->not_available )
+            match &= !dt_device_is_available(node);
+
+        if ( matches->prop )
+            match &= dt_find_property(node, matches->prop, NULL) != NULL;
+
+        if ( match )
+            return matches;
+        matches++;
+    }
+
+    return NULL;
+}
+
+const struct dt_device_node *dt_get_parent(const struct dt_device_node *node)
+{
+    if ( !node )
+        return NULL;
+
+    return node->parent;
+}
+
+struct dt_device_node *
+dt_find_compatible_node(struct dt_device_node *from,
+                        const char *type,
+                        const char *compatible)
+{
+    struct dt_device_node *np;
+    struct dt_device_node *dt;
+
+    dt = from ? from->allnext : dt_host;
+    dt_for_each_device_node(dt, np)
+    {
+        if ( type
+             && !(np->type && (dt_node_cmp(np->type, type) == 0)) )
+            continue;
+        if ( dt_device_is_compatible(np, compatible) )
+            break;
+    }
+
+    return np;
+}
+
+struct dt_device_node *
+dt_find_matching_node(struct dt_device_node *from,
+                      const struct dt_device_match *matches)
+{
+    struct dt_device_node *np;
+    struct dt_device_node *dt;
+
+    dt = from ? from->allnext : dt_host;
+    dt_for_each_device_node(dt, np)
+    {
+        if ( dt_match_node(matches, np) )
+            return np;
+    }
+
+    return NULL;
+}
+
+static int __dt_n_addr_cells(const struct dt_device_node *np, bool parent)
+{
+    const __be32 *ip;
+
+    do {
+        if ( np->parent && !parent )
+            np = np->parent;
+        parent = false;
+
+        ip = dt_get_property(np, "#address-cells", NULL);
+        if ( ip )
+            return be32_to_cpup(ip);
+    } while ( np->parent );
+    /* No #address-cells property for the root node */
+    return DT_ROOT_NODE_ADDR_CELLS_DEFAULT;
+}
+
+static int __dt_n_size_cells(const struct dt_device_node *np, bool parent)
+{
+    const __be32 *ip;
+
+    do {
+        if ( np->parent && !parent )
+            np = np->parent;
+        parent = false;
+
+        ip = dt_get_property(np, "#size-cells", NULL);
+        if ( ip )
+            return be32_to_cpup(ip);
+    } while ( np->parent );
+    /* No #address-cells property for the root node */
+    return DT_ROOT_NODE_SIZE_CELLS_DEFAULT;
+}
+
+int dt_n_addr_cells(const struct dt_device_node *np)
+{
+    return __dt_n_addr_cells(np, false);
+}
+
+int dt_n_size_cells(const struct dt_device_node *np)
+{
+    return __dt_n_size_cells(np, false);
+}
+
+int dt_child_n_addr_cells(const struct dt_device_node *parent)
+{
+    return __dt_n_addr_cells(parent, true);
+}
+
+int dt_child_n_size_cells(const struct dt_device_node *parent)
+{
+    return __dt_n_size_cells(parent, true);
+}
+
+/*
+ * These are defined in Linux where much of this code comes from, but
+ * are currently unused outside this file in the context of Xen.
+ */
+#define IORESOURCE_BITS         0x000000ff      /* Bus-specific bits */
+
+#define IORESOURCE_TYPE_BITS    0x00001f00      /* Resource type */
+#define IORESOURCE_IO           0x00000100      /* PCI/ISA I/O ports */
+#define IORESOURCE_MEM          0x00000200
+#define IORESOURCE_REG          0x00000300      /* Register offsets */
+#define IORESOURCE_IRQ          0x00000400
+#define IORESOURCE_DMA          0x00000800
+#define IORESOURCE_BUS          0x00001000
+
+#define IORESOURCE_PREFETCH     0x00002000      /* No side effects */
+#define IORESOURCE_READONLY     0x00004000
+#define IORESOURCE_CACHEABLE    0x00008000
+#define IORESOURCE_RANGELENGTH  0x00010000
+#define IORESOURCE_SHADOWABLE   0x00020000
+
+/*
+ * Default translator (generic bus)
+ */
+static bool dt_bus_default_match(const struct dt_device_node *node)
+{
+    /* Root node doesn't have "ranges" property */
+    if ( node->parent == NULL )
+        return 1;
+
+    /* The default bus is only used when the "ranges" property exists.
+     * Otherwise we can't translate the address
+     */
+    return (dt_get_property(node, "ranges", NULL) != NULL);
+}
+
+static void dt_bus_default_count_cells(const struct dt_device_node *dev,
+                                int *addrc, int *sizec)
+{
+    if ( addrc )
+        *addrc = dt_n_addr_cells(dev);
+    if ( sizec )
+        *sizec = dt_n_size_cells(dev);
+}
+
+static u64 dt_bus_default_map(__be32 *addr, const __be32 *range,
+                              int na, int ns, int pna)
+{
+    u64 cp, s, da;
+
+    cp = dt_read_number(range, na);
+    s = dt_read_number(range + na + pna, ns);
+    da = dt_read_number(addr, na);
+
+    dt_dprintk("DT: default map, cp=%llx, s=%llx, da=%llx\n",
+               (unsigned long long)cp, (unsigned long long)s,
+               (unsigned long long)da);
+
+    /*
+     * If the number of address cells is larger than 2 we assume the
+     * mapping doesn't specify a physical address. Rather, the address
+     * specifies an identifier that must match exactly.
+     */
+    if ( na > 2 && memcmp(range, addr, na * 4) != 0 )
+        return DT_BAD_ADDR;
+
+    if ( da < cp || da >= (cp + s) )
+        return DT_BAD_ADDR;
+    return da - cp;
+}
+
+static int dt_bus_default_translate(__be32 *addr, u64 offset, int na)
+{
+    u64 a = dt_read_number(addr, na);
+
+    memset(addr, 0, na * 4);
+    a += offset;
+    if ( na > 1 )
+        addr[na - 2] = cpu_to_be32(a >> 32);
+    addr[na - 1] = cpu_to_be32(a & 0xffffffffu);
+
+    return 0;
+}
+static unsigned int dt_bus_default_get_flags(const __be32 *addr)
+{
+    return IORESOURCE_MEM;
+}
+
+/*
+ * PCI bus specific translator
+ */
+
+static bool dt_node_is_pci(const struct dt_device_node *np)
+{
+    bool is_pci = !strcmp(np->name, "pcie") || !strcmp(np->name, "pci");
+
+    if ( is_pci )
+        printk(XENLOG_WARNING "%s: Missing device_type\n", np->full_name);
+
+    return is_pci;
+}
+
+static bool dt_bus_pci_match(const struct dt_device_node *np)
+{
+    /*
+     * "pciex" is PCI Express "vci" is for the /chaos bridge on 1st-gen PCI
+     * powermacs "ht" is hypertransport
+     *
+     * If none of the device_type match, and that the node name is
+     * "pcie" or "pci", accept the device as PCI (with a warning).
+     */
+    return !strcmp(np->type, "pci") || !strcmp(np->type, "pciex") ||
+        !strcmp(np->type, "vci") || !strcmp(np->type, "ht") ||
+        dt_node_is_pci(np);
+}
+
+static void dt_bus_pci_count_cells(const struct dt_device_node *np,
+				   int *addrc, int *sizec)
+{
+    if (addrc)
+        *addrc = 3;
+    if (sizec)
+        *sizec = 2;
+}
+
+static unsigned int dt_bus_pci_get_flags(const __be32 *addr)
+{
+    unsigned int flags = 0;
+    u32 w = be32_to_cpup(addr);
+
+    switch((w >> 24) & 0x03) {
+    case 0x01:
+        flags |= IORESOURCE_IO;
+        break;
+    case 0x02: /* 32 bits */
+    case 0x03: /* 64 bits */
+        flags |= IORESOURCE_MEM;
+        break;
+    }
+    if (w & 0x40000000)
+        flags |= IORESOURCE_PREFETCH;
+    return flags;
+}
+
+static u64 dt_bus_pci_map(__be32 *addr, const __be32 *range, int na, int ns,
+		int pna)
+{
+    u64 cp, s, da;
+    unsigned int af, rf;
+
+    af = dt_bus_pci_get_flags(addr);
+    rf = dt_bus_pci_get_flags(range);
+
+    /* Check address type match */
+    if ((af ^ rf) & (IORESOURCE_MEM | IORESOURCE_IO))
+        return DT_BAD_ADDR;
+
+    /* Read address values, skipping high cell */
+    cp = dt_read_number(range + 1, na - 1);
+    s  = dt_read_number(range + na + pna, ns);
+    da = dt_read_number(addr + 1, na - 1);
+
+    dt_dprintk("DT: PCI map, cp=%llx, s=%llx, da=%llx\n",
+               (unsigned long long)cp, (unsigned long long)s,
+               (unsigned long long)da);
+
+    if (da < cp || da >= (cp + s))
+        return DT_BAD_ADDR;
+    return da - cp;
+}
+
+static int dt_bus_pci_translate(__be32 *addr, u64 offset, int na)
+{
+    return dt_bus_default_translate(addr + 1, offset, na - 1);
+}
+
+/*
+ * Array of bus specific translators
+ */
+static const struct dt_bus dt_busses[] =
+{
+    /* PCI */
+    {
+        .name = "pci",
+        .addresses = "assigned-addresses",
+        .match = dt_bus_pci_match,
+        .count_cells = dt_bus_pci_count_cells,
+        .map = dt_bus_pci_map,
+        .translate = dt_bus_pci_translate,
+        .get_flags = dt_bus_pci_get_flags,
+    },
+    /* Default */
+    {
+        .name = "default",
+        .addresses = "reg",
+        .match = dt_bus_default_match,
+        .count_cells = dt_bus_default_count_cells,
+        .map = dt_bus_default_map,
+        .translate = dt_bus_default_translate,
+        .get_flags = dt_bus_default_get_flags,
+    },
+};
+
+static const struct dt_bus *dt_match_bus(const struct dt_device_node *np)
+{
+    int i;
+
+    for ( i = 0; i < ARRAY_SIZE(dt_busses); i++ )
+        if ( !dt_busses[i].match || dt_busses[i].match(np) )
+            return &dt_busses[i];
+
+    return NULL;
+}
+
+static const __be32 *dt_get_address(const struct dt_device_node *dev,
+                                    unsigned int index, u64 *size,
+                                    unsigned int *flags)
+{
+    const __be32 *prop;
+    u32 psize;
+    const struct dt_device_node *parent;
+    const struct dt_bus *bus;
+    int onesize, i, na, ns;
+
+    /* Get parent & match bus type */
+    parent = dt_get_parent(dev);
+    if ( parent == NULL )
+        return NULL;
+
+    bus = dt_match_bus(parent);
+    if ( !bus )
+        return NULL;
+    bus->count_cells(dev, &na, &ns);
+
+    if ( !DT_CHECK_ADDR_COUNT(na) )
+        return NULL;
+
+    /* Get "reg" or "assigned-addresses" property */
+    prop = dt_get_property(dev, bus->addresses, &psize);
+    if ( prop == NULL )
+        return NULL;
+    psize /= 4;
+
+    onesize = na + ns;
+    for ( i = 0; psize >= onesize; psize -= onesize, prop += onesize, i++ )
+    {
+        if ( i == index )
+        {
+            if ( size )
+                *size = dt_read_number(prop + na, ns);
+            if ( flags )
+                *flags = bus->get_flags(prop);
+            return prop;
+        }
+    }
+    return NULL;
+}
+
+static int dt_translate_one(const struct dt_device_node *parent,
+                            const struct dt_bus *bus,
+                            const struct dt_bus *pbus,
+                            __be32 *addr, int na, int ns,
+                            int pna, const char *rprop)
+{
+    const __be32 *ranges;
+    unsigned int rlen;
+    int rone;
+    u64 offset = DT_BAD_ADDR;
+
+    ranges = dt_get_property(parent, rprop, &rlen);
+    if ( ranges == NULL )
+    {
+        printk(XENLOG_ERR "DT: no ranges; cannot translate\n");
+        return 1;
+    }
+    if ( rlen == 0 )
+    {
+        offset = dt_read_number(addr, na);
+        memset(addr, 0, pna * 4);
+        dt_dprintk("DT: empty ranges; 1:1 translation\n");
+        goto finish;
+    }
+
+    dt_dprintk("DT: walking ranges...\n");
+
+    /* Now walk through the ranges */
+    rlen /= 4;
+    rone = na + pna + ns;
+    for ( ; rlen >= rone; rlen -= rone, ranges += rone )
+    {
+        offset = bus->map(addr, ranges, na, ns, pna);
+        if ( offset != DT_BAD_ADDR )
+            break;
+    }
+    if ( offset == DT_BAD_ADDR )
+    {
+        dt_dprintk("DT: not found !\n");
+        return 1;
+    }
+    memcpy(addr, ranges + na, 4 * pna);
+
+finish:
+    dt_dump_addr("DT: parent translation for:", addr, pna);
+    dt_dprintk("DT: with offset: %llx\n", (unsigned long long)offset);
+
+    /* Translate it into parent bus space */
+    return pbus->translate(addr, offset, pna);
+}
+
+/*
+ * Translate an address from the device-tree into a CPU physical address,
+ * this walks up the tree and applies the various bus mappings on the
+ * way.
+ *
+ * Note: We consider that crossing any level with #size-cells == 0 to mean
+ * that translation is impossible (that is we are not dealing with a value
+ * that can be mapped to a cpu physical address). This is not really specified
+ * that way, but this is traditionally the way IBM at least do things
+ */
+static u64 __dt_translate_address(const struct dt_device_node *dev,
+                                  const __be32 *in_addr, const char *rprop)
+{
+    const struct dt_device_node *parent = NULL;
+    const struct dt_bus *bus, *pbus;
+    __be32 addr[DT_MAX_ADDR_CELLS];
+    int na, ns, pna, pns;
+    u64 result = DT_BAD_ADDR;
+
+    dt_dprintk("DT: ** translation for device %s **\n", dev->full_name);
+
+    /* Get parent & match bus type */
+    parent = dt_get_parent(dev);
+    if ( parent == NULL )
+        goto bail;
+    bus = dt_match_bus(parent);
+    if ( !bus )
+        goto bail;
+
+    /* Count address cells & copy address locally */
+    bus->count_cells(dev, &na, &ns);
+    if ( !DT_CHECK_COUNTS(na, ns) )
+    {
+        printk(XENLOG_ERR "dt_parse: Bad cell count for device %s\n",
+                  dev->full_name);
+        goto bail;
+    }
+    memcpy(addr, in_addr, na * 4);
+
+    dt_dprintk("DT: bus is %s (na=%d, ns=%d) on %s\n",
+               bus->name, na, ns, parent->full_name);
+    dt_dump_addr("DT: translating address:", addr, na);
+
+    /* Translate */
+    for ( ;; )
+    {
+        /* Switch to parent bus */
+        dev = parent;
+        parent = dt_get_parent(dev);
+
+        /* If root, we have finished */
+        if ( parent == NULL )
+        {
+            dt_dprintk("DT: reached root node\n");
+            result = dt_read_number(addr, na);
+            break;
+        }
+
+        /* Get new parent bus and counts */
+        pbus = dt_match_bus(parent);
+        if ( pbus == NULL )
+        {
+            printk("DT: %s is not a valid bus\n", parent->full_name);
+            break;
+        }
+        pbus->count_cells(dev, &pna, &pns);
+        if ( !DT_CHECK_COUNTS(pna, pns) )
+        {
+            printk(XENLOG_ERR "dt_parse: Bad cell count for parent %s\n",
+                   dev->full_name);
+            break;
+        }
+
+        dt_dprintk("DT: parent bus is %s (na=%d, ns=%d) on %s\n",
+                   pbus->name, pna, pns, parent->full_name);
+
+        /* Apply bus translation */
+        if ( dt_translate_one(dev, bus, pbus, addr, na, ns, pna, rprop) )
+            break;
+
+        /* Complete the move up one level */
+        na = pna;
+        ns = pns;
+        bus = pbus;
+
+        dt_dump_addr("DT: one level translation:", addr, na);
+    }
+
+bail:
+    return result;
+}
+
+/* dt_device_address - Translate device tree address and return it */
+int dt_device_get_address(const struct dt_device_node *dev, unsigned int index,
+                          u64 *addr, u64 *size)
+{
+    const __be32 *addrp;
+    unsigned int flags;
+
+    addrp = dt_get_address(dev, index, size, &flags);
+    if ( addrp == NULL )
+        return -EINVAL;
+
+    if ( !addr )
+        return -EINVAL;
+
+    *addr = __dt_translate_address(dev, addrp, "ranges");
+
+    if ( *addr == DT_BAD_ADDR )
+        return -EINVAL;
+
+    return 0;
+}
+
+int dt_device_get_paddr(const struct dt_device_node *dev, unsigned int index,
+                        paddr_t *addr, paddr_t *size)
+{
+    uint64_t dt_addr, dt_size;
+    int ret;
+
+    ret = dt_device_get_address(dev, index, &dt_addr, &dt_size);
+    if ( ret )
+        return ret;
+
+    if ( !addr )
+        return -EINVAL;
+
+    if ( dt_addr != (paddr_t)dt_addr )
+    {
+        printk("Error: Physical address 0x%"PRIx64" for node=%s is greater than max width (%zu bytes) supported\n",
+               dt_addr, dev->name, sizeof(paddr_t));
+        return -ERANGE;
+    }
+
+    *addr = dt_addr;
+
+    if ( size )
+    {
+        if ( dt_size != (paddr_t)dt_size )
+        {
+            printk("Error: Physical size 0x%"PRIx64" for node=%s is greater than max width (%zu bytes) supported\n",
+                   dt_size, dev->name, sizeof(paddr_t));
+            return -ERANGE;
+        }
+
+        *size = dt_size;
+    }
+
+    return ret;
+}
+
+int dt_for_each_range(const struct dt_device_node *dev,
+                      int (*cb)(const struct dt_device_node *dev,
+                                uint64_t addr, uint64_t length,
+                                void *data),
+                      void *data)
+{
+    const struct dt_device_node *parent = NULL;
+    const struct dt_bus *bus, *pbus;
+    const __be32 *ranges;
+    __be32 addr[DT_MAX_ADDR_CELLS];
+    unsigned int rlen;
+    int na, ns, pna, pns, rone;
+
+    bus = dt_match_bus(dev);
+    if ( !bus )
+        return 0; /* device is not a bus */
+
+    parent = dt_get_parent(dev);
+    if ( parent == NULL )
+        return -EINVAL;
+
+    ranges = dt_get_property(dev, "ranges", &rlen);
+    if ( ranges == NULL )
+    {
+        printk(XENLOG_ERR "DT: no ranges; cannot enumerate %s\n",
+               dev->full_name);
+        return -EINVAL;
+    }
+    if ( rlen == 0 ) /* Nothing to do */
+        return 0;
+
+    bus->count_cells(dev, &na, &ns);
+    if ( !DT_CHECK_COUNTS(na, ns) )
+    {
+        printk(XENLOG_ERR "dt_parse: Bad cell count for device %s\n",
+                  dev->full_name);
+        return -EINVAL;
+    }
+
+    pbus = dt_match_bus(parent);
+    if ( pbus == NULL )
+    {
+        printk("DT: %s is not a valid bus\n", parent->full_name);
+        return -EINVAL;
+    }
+
+    pbus->count_cells(dev, &pna, &pns);
+    if ( !DT_CHECK_COUNTS(pna, pns) )
+    {
+        printk(XENLOG_ERR "dt_parse: Bad cell count for parent %s\n",
+               dev->full_name);
+        return -EINVAL;
+    }
+
+    /* Now walk through the ranges */
+    rlen /= 4;
+    rone = na + pna + ns;
+
+    dt_dprintk("%s: dev=%s, bus=%s, parent=%s, rlen=%d, rone=%d\n",
+               __func__,
+               dt_node_name(dev), bus->name,
+               dt_node_name(parent), rlen, rone);
+
+    for ( ; rlen >= rone; rlen -= rone, ranges += rone )
+    {
+        uint64_t a, s;
+        int ret;
+
+        memcpy(addr, ranges + na, 4 * pna);
+
+        a = __dt_translate_address(dev, addr, "ranges");
+        s = dt_read_number(ranges + na + pna, ns);
+
+        ret = cb(dev, a, s, data);
+        if ( ret )
+        {
+            dt_dprintk(" -> callback failed=%d\n", ret);
+            return ret;
+        }
+
+    }
+
+    return 0;
+}
+
+/**
+ * dt_find_node_by_phandle - Find a node given a phandle
+ * @handle: phandle of the node to find
+ *
+ * Returns a node pointer.
+ */
+struct dt_device_node *dt_find_node_by_phandle(dt_phandle handle)
+{
+    struct dt_device_node *np;
+
+    dt_for_each_device_node(dt_host, np)
+        if ( np->phandle == handle )
+            break;
+
+    return np;
+}
+
+/**
+ * dt_irq_find_parent - Given a device node, find its interrupt parent node
+ * @child: pointer to device node
+ *
+ * Returns a pointer to the interrupt parent node, or NULL if the interrupt
+ * parent could not be determined.
+ */
+static const struct dt_device_node *
+dt_irq_find_parent(const struct dt_device_node *child)
+{
+    const struct dt_device_node *p;
+    const __be32 *parp;
+
+    do
+    {
+        parp = dt_get_property(child, "interrupt-parent", NULL);
+        if ( parp == NULL )
+            p = dt_get_parent(child);
+        else
+            p = dt_find_node_by_phandle(be32_to_cpup(parp));
+        child = p;
+    } while ( p && dt_get_property(p, "#interrupt-cells", NULL) == NULL );
+
+    return p;
+}
+
+unsigned int dt_number_of_irq(const struct dt_device_node *device)
+{
+    const struct dt_device_node *p;
+    const __be32 *intspec, *tmp;
+    u32 intsize, intlen;
+    int intnum;
+
+    dt_dprintk("dt_irq_number: dev=%s\n", device->full_name);
+
+    /* Try the new-style interrupts-extended first */
+    intnum = dt_count_phandle_with_args(device, "interrupts-extended",
+                                        "#interrupt-cells");
+    if ( intnum >= 0 )
+    {
+        dt_dprintk(" using 'interrupts-extended' property\n");
+        dt_dprintk(" intnum=%d\n", intnum);
+        return intnum;
+    }
+
+    /* Get the interrupts property */
+    intspec = dt_get_property(device, "interrupts", &intlen);
+    if ( intspec == NULL )
+        return 0;
+    intlen /= sizeof(*intspec);
+
+    dt_dprintk(" using 'interrupts' property\n");
+    dt_dprintk(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen);
+
+    /* Look for the interrupt parent. */
+    p = dt_irq_find_parent(device);
+    if ( p == NULL )
+        return 0;
+
+    /* Get size of interrupt specifier */
+    tmp = dt_get_property(p, "#interrupt-cells", NULL);
+    if ( tmp == NULL )
+        return 0;
+    intsize = be32_to_cpu(*tmp);
+
+    dt_dprintk(" intsize=%d intlen=%d\n", intsize, intlen);
+
+    return (intlen / intsize);
+}
+
+unsigned int dt_number_of_address(const struct dt_device_node *dev)
+{
+    const __be32 *prop;
+    u32 psize;
+    const struct dt_device_node *parent;
+    const struct dt_bus *bus;
+    int onesize, na, ns;
+
+    /* Get parent & match bus type */
+    parent = dt_get_parent(dev);
+    if ( parent == NULL )
+        return 0;
+
+    bus = dt_match_bus(parent);
+    if ( !bus )
+        return 0;
+    bus->count_cells(dev, &na, &ns);
+
+    if ( !DT_CHECK_COUNTS(na, ns) )
+        return 0;
+
+    /* Get "reg" or "assigned-addresses" property */
+    prop = dt_get_property(dev, bus->addresses, &psize);
+    if ( prop == NULL )
+        return 0;
+
+    psize /= 4;
+    onesize = na + ns;
+
+    return (psize / onesize);
+}
+
+int dt_for_each_irq_map(const struct dt_device_node *dev,
+                        int (*cb)(const struct dt_device_node *dev,
+                                  const struct dt_irq *dt_irq,
+                                  void *data),
+                        void *data)
+{
+    const struct dt_device_node *ipar, *tnode, *old = NULL;
+    const __be32 *tmp, *imap;
+    u32 intsize = 1, addrsize, pintsize = 0, paddrsize = 0;
+    u32 imaplen;
+    int i, ret;
+
+    struct dt_raw_irq dt_raw_irq;
+    struct dt_irq dt_irq;
+
+    dt_dprintk("%s: par=%s cb=%p data=%p\n", __func__,
+               dev->full_name, cb, data);
+
+    ipar = dev;
+
+    /* First get the #interrupt-cells property of the current cursor
+     * that tells us how to interpret the passed-in intspec. If there
+     * is none, we are nice and just walk up the tree
+     */
+    do {
+        tmp = dt_get_property(ipar, "#interrupt-cells", NULL);
+        if ( tmp != NULL )
+        {
+            intsize = be32_to_cpu(*tmp);
+            break;
+        }
+        tnode = ipar;
+        ipar = dt_irq_find_parent(ipar);
+    } while ( ipar );
+    if ( ipar == NULL )
+    {
+        dt_dprintk(" -> no parent found !\n");
+        goto fail;
+    }
+
+    dt_dprintk("%s: ipar=%s, size=%d\n", __func__, ipar->full_name, intsize);
+
+    if ( intsize > DT_MAX_IRQ_SPEC )
+    {
+        dt_dprintk(" -> too many irq specifier cells\n");
+        goto fail;
+    }
+
+    /* Look for this #address-cells. We have to implement the old linux
+     * trick of looking for the parent here as some device-trees rely on it
+     */
+    old = ipar;
+    do {
+        tmp = dt_get_property(old, "#address-cells", NULL);
+        tnode = dt_get_parent(old);
+        old = tnode;
+    } while ( old && tmp == NULL );
+
+    old = NULL;
+    addrsize = (tmp == NULL) ? 2 : be32_to_cpu(*tmp);
+
+    dt_dprintk(" -> addrsize=%d\n", addrsize);
+
+    /* Now look for an interrupt-map */
+    imap = dt_get_property(dev, "interrupt-map", &imaplen);
+    /* No interrupt-map found. Ignore */
+    if ( imap == NULL )
+    {
+        dt_dprintk(" -> no map, ignoring\n");
+        return 0;
+    }
+    imaplen /= sizeof(u32);
+
+    /* Parse interrupt-map */
+    while ( imaplen > (addrsize + intsize + 1) )
+    {
+        /* skip child unit address and child interrupt specifier */
+        imap += addrsize + intsize;
+        imaplen -= addrsize + intsize;
+
+        /* Get the interrupt parent */
+        ipar = dt_find_node_by_phandle(be32_to_cpup(imap));
+        imap++;
+        --imaplen;
+
+        /* Check if not found */
+        if ( ipar == NULL )
+        {
+            dt_dprintk(" -> imap parent not found !\n");
+            goto fail;
+        }
+
+        dt_dprintk(" -> ipar %s\n", dt_node_name(ipar));
+
+        /* Get #interrupt-cells and #address-cells of new
+         * parent
+         */
+        tmp = dt_get_property(ipar, "#interrupt-cells", NULL);
+        if ( tmp == NULL )
+        {
+            dt_dprintk(" -> parent lacks #interrupt-cells!\n");
+            goto fail;
+        }
+        pintsize = be32_to_cpu(*tmp);
+        tmp = dt_get_property(ipar, "#address-cells", NULL);
+        paddrsize = (tmp == NULL) ? 0 : be32_to_cpu(*tmp);
+
+        dt_dprintk(" -> pintsize=%d, paddrsize=%d\n",
+                   pintsize, paddrsize);
+
+        if ( pintsize > DT_MAX_IRQ_SPEC )
+        {
+            dt_dprintk(" -> too many irq specifier cells in parent\n");
+            goto fail;
+        }
+
+        /* Check for malformed properties */
+        if ( imaplen < (paddrsize + pintsize) )
+            goto fail;
+
+        imap += paddrsize;
+        imaplen -= paddrsize;
+
+        dt_raw_irq.controller = ipar;
+        dt_raw_irq.size = pintsize;
+        for ( i = 0; i < pintsize; i++ )
+            dt_raw_irq.specifier[i] = dt_read_number(imap + i, 1);
+
+        if ( dt_raw_irq.controller != dt_interrupt_controller )
+        {
+            /*
+             * We don't map IRQs connected to secondary IRQ controllers as
+             * these IRQs have no meaning to us until they connect to the
+             * primary controller.
+             *
+             * Secondary IRQ controllers will at some point connect to
+             * the primary controller (possibly via other IRQ controllers).
+             * We map the IRQs at that last connection point.
+             */
+            imap += pintsize;
+            imaplen -= pintsize;
+            dt_dprintk(" -> Skipped IRQ for secondary IRQ controller\n");
+            continue;
+        }
+
+        ret = dt_irq_translate(&dt_raw_irq, &dt_irq);
+        if ( ret )
+        {
+            dt_dprintk(" -> failed to translate IRQ: %d\n", ret);
+            return ret;
+        }
+
+        ret = cb(dev, &dt_irq, data);
+        if ( ret )
+        {
+            dt_dprintk(" -> callback failed=%d\n", ret);
+            return ret;
+        }
+
+        imap += pintsize;
+        imaplen -= pintsize;
+
+        dt_dprintk(" -> imaplen=%d\n", imaplen);
+    }
+
+    return 0;
+
+fail:
+    return -EINVAL;
+}
+
+/**
+ * dt_irq_map_raw - Low level interrupt tree parsing
+ * @parent:     the device interrupt parent
+ * @intspec:    interrupt specifier ("interrupts" property of the device)
+ * @ointsize:   size of the passed in interrupt specifier
+ * @addr:       address specifier (start of "reg" property of the device)
+ * @oirq:       structure dt_raw_irq filled by this function
+ *
+ * Returns 0 on success and a negative number on error
+ *
+ * This function is a low-level interrupt tree walking function. It
+ * can be used to do a partial walk with synthesized reg and interrupts
+ * properties, for example when resolving PCI interrupts when no device
+ * node exist for the parent.
+ */
+static int dt_irq_map_raw(const struct dt_device_node *parent,
+                          const __be32 *intspec, u32 ointsize,
+                          const __be32 *addr,
+                          struct dt_raw_irq *oirq)
+{
+    const struct dt_device_node *ipar, *tnode, *old = NULL, *newpar = NULL;
+    const __be32 *tmp, *imap, *imask;
+    u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0;
+    u32 imaplen;
+    int match, i;
+
+    dt_dprintk("dt_irq_map_raw: par=%s,intspec=[0x%08x 0x%08x...],ointsize=%d\n",
+               parent->full_name, be32_to_cpup(intspec),
+               be32_to_cpup(intspec + 1), ointsize);
+
+    ipar = parent;
+
+    /* First get the #interrupt-cells property of the current cursor
+     * that tells us how to interpret the passed-in intspec. If there
+     * is none, we are nice and just walk up the tree
+     */
+    do {
+        tmp = dt_get_property(ipar, "#interrupt-cells", NULL);
+        if ( tmp != NULL )
+        {
+            intsize = be32_to_cpu(*tmp);
+            break;
+        }
+        tnode = ipar;
+        ipar = dt_irq_find_parent(ipar);
+    } while ( ipar );
+    if ( ipar == NULL )
+    {
+        dt_dprintk(" -> no parent found !\n");
+        goto fail;
+    }
+
+    dt_dprintk("dt_irq_map_raw: ipar=%s, size=%d\n", ipar->full_name, intsize);
+
+    if ( ointsize != intsize )
+        return -EINVAL;
+
+    /* Look for this #address-cells. We have to implement the old linux
+     * trick of looking for the parent here as some device-trees rely on it
+     */
+    old = ipar;
+    do {
+        tmp = dt_get_property(old, "#address-cells", NULL);
+        tnode = dt_get_parent(old);
+        old = tnode;
+    } while ( old && tmp == NULL );
+
+    old = NULL;
+    addrsize = (tmp == NULL) ? 2 : be32_to_cpu(*tmp);
+
+    dt_dprintk(" -> addrsize=%d\n", addrsize);
+
+    /* Now start the actual "proper" walk of the interrupt tree */
+    while ( ipar != NULL )
+    {
+        /* Now check if cursor is an interrupt-controller and if it is
+         * then we are done
+         */
+        if ( dt_get_property(ipar, "interrupt-controller", NULL) != NULL )
+        {
+            dt_dprintk(" -> got it !\n");
+            if ( intsize > DT_MAX_IRQ_SPEC )
+            {
+                dt_dprintk(" -> intsize(%u) greater than DT_MAX_IRQ_SPEC(%u)\n",
+                           intsize, DT_MAX_IRQ_SPEC);
+                goto fail;
+            }
+            for ( i = 0; i < intsize; i++ )
+                oirq->specifier[i] = dt_read_number(intspec + i, 1);
+            oirq->size = intsize;
+            oirq->controller = ipar;
+            return 0;
+        }
+
+        /* Now look for an interrupt-map */
+        imap = dt_get_property(ipar, "interrupt-map", &imaplen);
+        /* No interrupt map, check for an interrupt parent */
+        if ( imap == NULL )
+        {
+            dt_dprintk(" -> no map, getting parent\n");
+            newpar = dt_irq_find_parent(ipar);
+            goto skiplevel;
+        }
+        imaplen /= sizeof(u32);
+
+        /* Look for a mask */
+        imask = dt_get_property(ipar, "interrupt-map-mask", NULL);
+
+        /* If we were passed no "reg" property and we attempt to parse
+         * an interrupt-map, then #address-cells must be 0.
+         * Fail if it's not.
+         */
+        if ( addr == NULL && addrsize != 0 )
+        {
+            dt_dprintk(" -> no reg passed in when needed !\n");
+            goto fail;
+        }
+
+        /* Parse interrupt-map */
+        match = 0;
+        while ( imaplen > (addrsize + intsize + 1) && !match )
+        {
+            /* Compare specifiers */
+            match = 1;
+            for ( i = 0; i < addrsize && match; ++i )
+            {
+                __be32 mask = imask ? imask[i] : cpu_to_be32(0xffffffffu);
+                match = ((addr[i] ^ imap[i]) & mask) == 0;
+            }
+            for ( ; i < (addrsize + intsize) && match; ++i )
+            {
+                __be32 mask = imask ? imask[i] : cpu_to_be32(0xffffffffu);
+                match = ((intspec[i-addrsize] ^ imap[i]) & mask) == 0;
+            }
+            imap += addrsize + intsize;
+            imaplen -= addrsize + intsize;
+
+            dt_dprintk(" -> match=%d (imaplen=%d)\n", match, imaplen);
+
+            /* Get the interrupt parent */
+            newpar = dt_find_node_by_phandle(be32_to_cpup(imap));
+            imap++;
+            --imaplen;
+
+            /* Check if not found */
+            if ( newpar == NULL )
+            {
+                dt_dprintk(" -> imap parent not found !\n");
+                goto fail;
+            }
+
+            /* Get #interrupt-cells and #address-cells of new
+             * parent
+             */
+            tmp = dt_get_property(newpar, "#interrupt-cells", NULL);
+            if ( tmp == NULL )
+            {
+                dt_dprintk(" -> parent lacks #interrupt-cells!\n");
+                goto fail;
+            }
+            newintsize = be32_to_cpu(*tmp);
+            tmp = dt_get_property(newpar, "#address-cells", NULL);
+            newaddrsize = (tmp == NULL) ? 0 : be32_to_cpu(*tmp);
+
+            dt_dprintk(" -> newintsize=%d, newaddrsize=%d\n",
+                       newintsize, newaddrsize);
+
+            /* Check for malformed properties */
+            if ( imaplen < (newaddrsize + newintsize) )
+                goto fail;
+
+            imap += newaddrsize + newintsize;
+            imaplen -= newaddrsize + newintsize;
+
+            dt_dprintk(" -> imaplen=%d\n", imaplen);
+        }
+        if ( !match )
+            goto fail;
+
+        old = newpar;
+        addrsize = newaddrsize;
+        intsize = newintsize;
+        intspec = imap - intsize;
+        addr = intspec - addrsize;
+
+    skiplevel:
+        /* Iterate again with new parent */
+        dt_dprintk(" -> new parent: %s\n", dt_node_full_name(newpar));
+        ipar = newpar;
+        newpar = NULL;
+    }
+fail:
+    return -EINVAL;
+}
+
+int dt_device_get_raw_irq(const struct dt_device_node *device,
+                          unsigned int index,
+                          struct dt_raw_irq *out_irq)
+{
+    const struct dt_device_node *p;
+    const __be32 *intspec, *tmp, *addr;
+    u32 intsize, intlen;
+    int res = -EINVAL;
+    struct dt_phandle_args args;
+    int i;
+
+    dt_dprintk("dt_device_get_raw_irq: dev=%s, index=%u\n",
+               device->full_name, index);
+
+    /* Get the reg property (if any) */
+    addr = dt_get_property(device, "reg", NULL);
+
+    /* Try the new-style interrupts-extended first */
+    res = dt_parse_phandle_with_args(device, "interrupts-extended",
+                                     "#interrupt-cells", index, &args);
+    if ( !res )
+    {
+        dt_dprintk(" using 'interrupts-extended' property\n");
+        dt_dprintk(" intspec=%d intsize=%d\n", args.args[0], args.args_count);
+
+        for ( i = 0; i < args.args_count; i++ )
+            args.args[i] = cpu_to_be32(args.args[i]);
+
+        return dt_irq_map_raw(args.np, args.args, args.args_count,
+                              addr, out_irq);
+    }
+
+    /* Get the interrupts property */
+    intspec = dt_get_property(device, "interrupts", &intlen);
+    if ( intspec == NULL )
+        return -EINVAL;
+    intlen /= sizeof(*intspec);
+
+    dt_dprintk(" using 'interrupts' property\n");
+    dt_dprintk(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen);
+
+    /* Look for the interrupt parent. */
+    p = dt_irq_find_parent(device);
+    if ( p == NULL )
+        return -EINVAL;
+
+    /* Get size of interrupt specifier */
+    tmp = dt_get_property(p, "#interrupt-cells", NULL);
+    if ( tmp == NULL )
+        goto out;
+    intsize = be32_to_cpu(*tmp);
+
+    dt_dprintk(" intsize=%d intlen=%d\n", intsize, intlen);
+
+    /* Check index */
+    if ( (index + 1) * intsize > intlen )
+        goto out;
+
+    /* Get new specifier and map it */
+    res = dt_irq_map_raw(p, intspec + index * intsize, intsize,
+                         addr, out_irq);
+    if ( res )
+        goto out;
+out:
+    return res;
+}
+
+int dt_irq_translate(const struct dt_raw_irq *raw,
+                     struct dt_irq *out_irq)
+{
+    ASSERT(dt_irq_xlate != NULL);
+    ASSERT(dt_interrupt_controller != NULL);
+
+    /*
+     * TODO: Retrieve the right irq_xlate. This is only works for the primary
+     * interrupt controller.
+     */
+    if ( raw->controller != dt_interrupt_controller )
+        return -EINVAL;
+
+    return dt_irq_xlate(raw->specifier, raw->size,
+                        &out_irq->irq, &out_irq->type);
+}
+
+int dt_device_get_irq(const struct dt_device_node *device, unsigned int index,
+                      struct dt_irq *out_irq)
+{
+    struct dt_raw_irq raw;
+    int res;
+
+    res = dt_device_get_raw_irq(device, index, &raw);
+
+    if ( res )
+        return res;
+
+    return dt_irq_translate(&raw, out_irq);
+}
+
+bool dt_device_is_available(const struct dt_device_node *device)
+{
+    const char *status;
+    u32 statlen;
+
+    status = dt_get_property(device, "status", &statlen);
+    if ( status == NULL )
+        return 1;
+
+    if ( statlen > 0 )
+    {
+        if ( !strcmp(status, "okay") || !strcmp(status, "ok") )
+            return 1;
+    }
+
+    return 0;
+}
+
+bool dt_device_for_passthrough(const struct dt_device_node *device)
+{
+    return (dt_find_property(device, "xen,passthrough", NULL) != NULL);
+
+}
+
+static int __dt_parse_phandle_with_args(const struct dt_device_node *np,
+                                        const char *list_name,
+                                        const char *cells_name,
+                                        int cell_count, int index,
+                                        struct dt_phandle_args *out_args)
+{
+    const __be32 *list, *list_end;
+    int rc = 0, cur_index = 0;
+    u32 size, count = 0;
+    struct dt_device_node *node = NULL;
+    dt_phandle phandle;
+
+    /* Retrieve the phandle list property */
+    list = dt_get_property(np, list_name, &size);
+    if ( !list )
+        return -ENOENT;
+    list_end = list + size / sizeof(*list);
+
+    /* Loop over the phandles until all the requested entry is found */
+    while ( list < list_end )
+    {
+        rc = -EINVAL;
+        count = 0;
+
+        /*
+         * If phandle is 0, then it is an empty entry with no
+         * arguments.  Skip forward to the next entry.
+         * */
+        phandle = be32_to_cpup(list++);
+        if ( phandle )
+        {
+            /*
+             * Find the provider node and parse the #*-cells
+             * property to determine the argument length.
+             *
+             * This is not needed if the cell count is hard-coded
+             * (i.e. cells_name not set, but cell_count is set),
+             * except when we're going to return the found node
+             * below.
+             */
+            if ( cells_name || cur_index == index )
+            {
+                node = dt_find_node_by_phandle(phandle);
+                if ( !node )
+                {
+                    printk(XENLOG_ERR "%s: could not find phandle\n",
+                           np->full_name);
+                    goto err;
+                }
+            }
+
+            if ( cells_name )
+            {
+                if ( !dt_property_read_u32(node, cells_name, &count) )
+                {
+                    printk("%s: could not get %s for %s\n",
+                           np->full_name, cells_name, node->full_name);
+                    goto err;
+                }
+            }
+            else
+                count = cell_count;
+
+            /*
+             * Make sure that the arguments actually fit in the
+             * remaining property data length
+             */
+            if ( list + count > list_end )
+            {
+                printk(XENLOG_ERR "%s: arguments longer than property\n",
+                       np->full_name);
+                goto err;
+            }
+        }
+
+        /*
+         * All of the error cases above bail out of the loop, so at


From xen-changelog-bounces@lists.xenproject.org Tue Aug 06 18:44:36 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Aug 2024 18:44:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773097.1183559 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbPAh-0001iD-Tn; Tue, 06 Aug 2024 18:44:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773097.1183559; Tue, 06 Aug 2024 18:44: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 1sbPAh-0001i6-Qr; Tue, 06 Aug 2024 18:44:35 +0000
Received: by outflank-mailman (input) for mailman id 773097;
 Tue, 06 Aug 2024 18:44:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbPAg-0001hy-Hg
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 18:44:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbPAg-00042A-B8
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 18:44:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbPAg-00024B-AJ
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 18:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=If9Yhd8KKeyBxmSe6wAkgeYmqxeW0V8WGAeFhMtKEO4=; b=iKed49loM2zbhp/8G5mk1WPi6v
	3plc0XjMBSUyp7Pbu2a3lTZD2INHRTEsNUtch+9GDwe/Lk4zNfyUOmrOB8XPJXkQjMhOFDPI+LUME
	VX+g+iGLhw7hIbUCfUeG4b3Icmxc7u0imSdo6r8dDeBSrVTV+c7JYBu6Zau26YH3dLTQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/common: Move Arm's bootfdt.c to common
Message-Id: <E1sbPAg-00024B-AJ@xenbits.xenproject.org>
Date: Tue, 06 Aug 2024 18:44:34 +0000

commit f06fbfe54dea044b9d5e93a6ef4bcb0c4747ca9d
Author:     Shawn Anastasio <sanastasio@raptorengineering.com>
AuthorDate: Tue Aug 6 13:41:14 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Aug 6 19:10:56 2024 +0100

    xen/common: Move Arm's bootfdt.c to common
    
    Move Arm's bootfdt.c to xen/common so that it can be used by other
    device tree architectures like PPC and RISCV.
    
    Remove stubs for process_shm_node() and early_print_info_shmem()
    from $xen/arch/arm/include/asm/static-shmem.h.
    These stubs are removed to avoid introducing them for architectures
    that do not support CONFIG_STATIC_SHM.
    The process_shm_node() stub is now implemented in common code to
    maintain the current behavior of early_scan_code() on ARM.
    The early_print_info_shmem() stub is only used in early_print_info(),
    so it's now guarded with #ifdef CONFIG_STATIC_SHM ... #endif.
    
    Suggested-by: Julien Grall <julien@xen.org>
    Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com>
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/Makefile                   |   1 -
 xen/arch/arm/bootfdt.c                  | 648 -------------------------------
 xen/arch/arm/include/asm/setup.h        |  13 -
 xen/arch/arm/include/asm/static-shmem.h |   9 -
 xen/common/device-tree/Makefile         |   1 +
 xen/common/device-tree/bootfdt.c        | 662 ++++++++++++++++++++++++++++++++
 xen/include/xen/bootfdt.h               |  14 +
 7 files changed, 677 insertions(+), 671 deletions(-)

diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 45dc29ea53..da9c979dc4 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -10,7 +10,6 @@ obj-$(CONFIG_TEE) += tee/
 obj-$(CONFIG_HAS_VPCI) += vpci.o
 
 obj-$(CONFIG_HAS_ALTERNATIVE) += alternative.o
-obj-y += bootfdt.init.o
 obj-y += cpuerrata.o
 obj-y += cpufeature.o
 obj-y += decode.o
diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
deleted file mode 100644
index f2892fce0a..0000000000
--- a/xen/arch/arm/bootfdt.c
+++ /dev/null
@@ -1,648 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Early Device Tree
- *
- * Copyright (C) 2012-2014 Citrix Systems, Inc.
- */
-#include <xen/types.h>
-#include <xen/lib.h>
-#include <xen/kernel.h>
-#include <xen/init.h>
-#include <xen/efi.h>
-#include <xen/device_tree.h>
-#include <xen/lib.h>
-#include <xen/libfdt/libfdt-xen.h>
-#include <xen/sort.h>
-#include <xsm/xsm.h>
-#include <asm/setup.h>
-#include <asm/static-shmem.h>
-
-static void __init __maybe_unused build_assertions(void)
-{
-    /*
-     * Check that no padding is between struct membanks "bank" flexible array
-     * member and struct meminfo "bank" member
-     */
-    BUILD_BUG_ON((offsetof(struct membanks, bank) !=
-                 offsetof(struct meminfo, bank)));
-    /* Ensure "struct membanks" is 8-byte aligned */
-    BUILD_BUG_ON(alignof(struct membanks) != 8);
-}
-
-static bool __init device_tree_node_is_available(const void *fdt, int node)
-{
-    const char *status;
-    int len;
-
-    status = fdt_getprop(fdt, node, "status", &len);
-    if ( !status )
-        return true;
-
-    if ( len > 0 )
-    {
-        if ( !strcmp(status, "ok") || !strcmp(status, "okay") )
-            return true;
-    }
-
-    return false;
-}
-
-static bool __init device_tree_node_matches(const void *fdt, int node,
-                                            const char *match)
-{
-    const char *name;
-    size_t match_len;
-
-    name = fdt_get_name(fdt, node, NULL);
-    match_len = strlen(match);
-
-    /* Match both "match" and "match@..." patterns but not
-       "match-foo". */
-    return strncmp(name, match, match_len) == 0
-        && (name[match_len] == '@' || name[match_len] == '\0');
-}
-
-static bool __init device_tree_node_compatible(const void *fdt, int node,
-                                               const char *match)
-{
-    int len, l;
-    const void *prop;
-
-    prop = fdt_getprop(fdt, node, "compatible", &len);
-    if ( prop == NULL )
-        return false;
-
-    while ( len > 0 ) {
-        if ( !dt_compat_cmp(prop, match) )
-            return true;
-        l = strlen(prop) + 1;
-        prop += l;
-        len -= l;
-    }
-
-    return false;
-}
-
-/*
- * Check if a node is a proper /memory node according to Devicetree
- * Specification v0.4, chapter 3.4.
- */
-static bool __init device_tree_is_memory_node(const void *fdt, int node,
-                                              int depth)
-{
-    const char *type;
-    int len;
-
-    if ( depth != 1 )
-        return false;
-
-    if ( !device_tree_node_matches(fdt, node, "memory") )
-        return false;
-
-    type = fdt_getprop(fdt, node, "device_type", &len);
-    if ( !type )
-        return false;
-
-    if ( (len <= strlen("memory")) || strcmp(type, "memory") )
-        return false;
-
-    return true;
-}
-
-void __init device_tree_get_reg(const __be32 **cell, uint32_t address_cells,
-                                uint32_t size_cells, paddr_t *start,
-                                paddr_t *size)
-{
-    uint64_t dt_start, dt_size;
-
-    /*
-     * dt_next_cell will return uint64_t whereas paddr_t may not be 64-bit.
-     * Thus, there is an implicit cast from uint64_t to paddr_t.
-     */
-    dt_start = dt_next_cell(address_cells, cell);
-    dt_size = dt_next_cell(size_cells, cell);
-
-    if ( dt_start != (paddr_t)dt_start )
-    {
-        printk("Physical address greater than max width supported\n");
-        WARN();
-    }
-
-    if ( dt_size != (paddr_t)dt_size )
-    {
-        printk("Physical size greater than max width supported\n");
-        WARN();
-    }
-
-    /*
-     * Xen will truncate the address/size if it is greater than the maximum
-     * supported width and it will give an appropriate warning.
-     */
-    *start = dt_start;
-    *size = dt_size;
-}
-
-static int __init device_tree_get_meminfo(const void *fdt, int node,
-                                          const char *prop_name,
-                                          u32 address_cells, u32 size_cells,
-                                          struct membanks *mem,
-                                          enum membank_type type)
-{
-    const struct fdt_property *prop;
-    unsigned int i, banks;
-    const __be32 *cell;
-    u32 reg_cells = address_cells + size_cells;
-    paddr_t start, size;
-
-    if ( !device_tree_node_is_available(fdt, node) )
-        return 0;
-
-    if ( address_cells < 1 || size_cells < 1 )
-    {
-        printk("fdt: property `%s': invalid #address-cells or #size-cells",
-               prop_name);
-        return -EINVAL;
-    }
-
-    prop = fdt_get_property(fdt, node, prop_name, NULL);
-    if ( !prop )
-        return -ENOENT;
-
-    cell = (const __be32 *)prop->data;
-    banks = fdt32_to_cpu(prop->len) / (reg_cells * sizeof (u32));
-
-    for ( i = 0; i < banks && mem->nr_banks < mem->max_banks; i++ )
-    {
-        device_tree_get_reg(&cell, address_cells, size_cells, &start, &size);
-        if ( mem == bootinfo_get_reserved_mem() &&
-             check_reserved_regions_overlap(start, size) )
-            return -EINVAL;
-        /* Some DT may describe empty bank, ignore them */
-        if ( !size )
-            continue;
-        mem->bank[mem->nr_banks].start = start;
-        mem->bank[mem->nr_banks].size = size;
-        mem->bank[mem->nr_banks].type = type;
-        mem->nr_banks++;
-    }
-
-    if ( i < banks )
-    {
-        printk("Warning: Max number of supported memory regions reached.\n");
-        return -ENOSPC;
-    }
-
-    return 0;
-}
-
-u32 __init device_tree_get_u32(const void *fdt, int node,
-                               const char *prop_name, u32 dflt)
-{
-    const struct fdt_property *prop;
-
-    prop = fdt_get_property(fdt, node, prop_name, NULL);
-    if ( !prop || prop->len < sizeof(u32) )
-        return dflt;
-
-    return fdt32_to_cpu(*(uint32_t*)prop->data);
-}
-
-/**
- * device_tree_for_each_node - iterate over all device tree sub-nodes
- * @fdt: flat device tree.
- * @node: parent node to start the search from
- * @func: function to call for each sub-node.
- * @data: data to pass to @func.
- *
- * Any nodes nested at DEVICE_TREE_MAX_DEPTH or deeper are ignored.
- *
- * Returns 0 if all nodes were iterated over successfully.  If @func
- * returns a value different from 0, that value is returned immediately.
- */
-int __init device_tree_for_each_node(const void *fdt, int node,
-                                     device_tree_node_func func,
-                                     void *data)
-{
-    /*
-     * We only care about relative depth increments, assume depth of
-     * node is 0 for simplicity.
-     */
-    int depth = 0;
-    const int first_node = node;
-    u32 address_cells[DEVICE_TREE_MAX_DEPTH];
-    u32 size_cells[DEVICE_TREE_MAX_DEPTH];
-    int ret;
-
-    do {
-        const char *name = fdt_get_name(fdt, node, NULL);
-        u32 as, ss;
-
-        if ( depth >= DEVICE_TREE_MAX_DEPTH )
-        {
-            printk("Warning: device tree node `%s' is nested too deep\n",
-                   name);
-            continue;
-        }
-
-        as = depth > 0 ? address_cells[depth-1] : DT_ROOT_NODE_ADDR_CELLS_DEFAULT;
-        ss = depth > 0 ? size_cells[depth-1] : DT_ROOT_NODE_SIZE_CELLS_DEFAULT;
-
-        address_cells[depth] = device_tree_get_u32(fdt, node,
-                                                   "#address-cells", as);
-        size_cells[depth] = device_tree_get_u32(fdt, node,
-                                                "#size-cells", ss);
-
-        /* skip the first node */
-        if ( node != first_node )
-        {
-            ret = func(fdt, node, name, depth, as, ss, data);
-            if ( ret != 0 )
-                return ret;
-        }
-
-        node = fdt_next_node(fdt, node, &depth);
-    } while ( node >= 0 && depth > 0 );
-
-    return 0;
-}
-
-static int __init process_memory_node(const void *fdt, int node,
-                                      const char *name, int depth,
-                                      u32 address_cells, u32 size_cells,
-                                      struct membanks *mem)
-{
-    return device_tree_get_meminfo(fdt, node, "reg", address_cells, size_cells,
-                                   mem, MEMBANK_DEFAULT);
-}
-
-static int __init process_reserved_memory_node(const void *fdt, int node,
-                                               const char *name, int depth,
-                                               u32 address_cells,
-                                               u32 size_cells,
-                                               void *data)
-{
-    int rc = process_memory_node(fdt, node, name, depth, address_cells,
-                                 size_cells, data);
-
-    if ( rc == -ENOSPC )
-        panic("Max number of supported reserved-memory regions reached.\n");
-    else if ( rc != -ENOENT )
-        return rc;
-    return 0;
-}
-
-static int __init process_reserved_memory(const void *fdt, int node,
-                                          const char *name, int depth,
-                                          u32 address_cells, u32 size_cells)
-{
-    return device_tree_for_each_node(fdt, node,
-                                     process_reserved_memory_node,
-                                     bootinfo_get_reserved_mem());
-}
-
-static void __init process_multiboot_node(const void *fdt, int node,
-                                          const char *name,
-                                          u32 address_cells, u32 size_cells)
-{
-    static int __initdata kind_guess = 0;
-    const struct fdt_property *prop;
-    const __be32 *cell;
-    bootmodule_kind kind;
-    paddr_t start, size;
-    int len;
-    /* sizeof("/chosen/") + DT_MAX_NAME + '/' + DT_MAX_NAME + '/0' => 92 */
-    char path[92];
-    int parent_node, ret;
-    bool domU;
-
-    parent_node = fdt_parent_offset(fdt, node);
-    ASSERT(parent_node >= 0);
-
-    /* Check that the node is under "/chosen" (first 7 chars of path) */
-    ret = fdt_get_path(fdt, node, path, sizeof (path));
-    if ( ret != 0 || strncmp(path, "/chosen", 7) )
-        return;
-
-    prop = fdt_get_property(fdt, node, "reg", &len);
-    if ( !prop )
-        panic("node %s missing `reg' property\n", name);
-
-    if ( len < dt_cells_to_size(address_cells + size_cells) )
-        panic("fdt: node `%s': `reg` property length is too short\n",
-                    name);
-
-    cell = (const __be32 *)prop->data;
-    device_tree_get_reg(&cell, address_cells, size_cells, &start, &size);
-
-    if ( fdt_node_check_compatible(fdt, node, "xen,linux-zimage") == 0 ||
-         fdt_node_check_compatible(fdt, node, "multiboot,kernel") == 0 )
-        kind = BOOTMOD_KERNEL;
-    else if ( fdt_node_check_compatible(fdt, node, "xen,linux-initrd") == 0 ||
-              fdt_node_check_compatible(fdt, node, "multiboot,ramdisk") == 0 )
-        kind = BOOTMOD_RAMDISK;
-    else if ( fdt_node_check_compatible(fdt, node, "xen,xsm-policy") == 0 )
-        kind = BOOTMOD_XSM;
-    else if ( fdt_node_check_compatible(fdt, node, "multiboot,device-tree") == 0 )
-        kind = BOOTMOD_GUEST_DTB;
-    else
-        kind = BOOTMOD_UNKNOWN;
-
-    /**
-     * Guess the kind of these first two unknowns respectively:
-     * (1) The first unknown must be kernel.
-     * (2) Detect the XSM Magic from the 2nd unknown:
-     *     a. If it's XSM, set the kind as XSM, and that also means we
-     *     won't load ramdisk;
-     *     b. if it's not XSM, set the kind as ramdisk.
-     *     So if user want to load ramdisk, it must be the 2nd unknown.
-     * We also detect the XSM Magic for the following unknowns,
-     * then set its kind according to the return value of has_xsm_magic.
-     */
-    if ( kind == BOOTMOD_UNKNOWN )
-    {
-        switch ( kind_guess++ )
-        {
-        case 0: kind = BOOTMOD_KERNEL; break;
-        case 1: kind = BOOTMOD_RAMDISK; break;
-        default: break;
-        }
-        if ( kind_guess > 1 && has_xsm_magic(start) )
-            kind = BOOTMOD_XSM;
-    }
-
-    domU = fdt_node_check_compatible(fdt, parent_node, "xen,domain") == 0;
-    add_boot_module(kind, start, size, domU);
-
-    prop = fdt_get_property(fdt, node, "bootargs", &len);
-    if ( !prop )
-        return;
-    add_boot_cmdline(fdt_get_name(fdt, parent_node, &len), prop->data,
-                     kind, start, domU);
-}
-
-static int __init process_chosen_node(const void *fdt, int node,
-                                      const char *name,
-                                      u32 address_cells, u32 size_cells)
-{
-    const struct fdt_property *prop;
-    paddr_t start, end;
-    int len;
-
-    if ( fdt_get_property(fdt, node, "xen,static-heap", NULL) )
-    {
-        int rc;
-
-        printk("Checking for static heap in /chosen\n");
-
-        rc = device_tree_get_meminfo(fdt, node, "xen,static-heap",
-                                     address_cells, size_cells,
-                                     bootinfo_get_reserved_mem(),
-                                     MEMBANK_STATIC_HEAP);
-        if ( rc )
-            return rc;
-
-        bootinfo.static_heap = true;
-    }
-
-    printk("Checking for initrd in /chosen\n");
-
-    prop = fdt_get_property(fdt, node, "linux,initrd-start", &len);
-    if ( !prop )
-        /* No initrd present. */
-        return 0;
-    if ( len != sizeof(u32) && len != sizeof(u64) )
-    {
-        printk("linux,initrd-start property has invalid length %d\n", len);
-        return -EINVAL;
-    }
-    start = dt_read_paddr((const void *)&prop->data, dt_size_to_cells(len));
-
-    prop = fdt_get_property(fdt, node, "linux,initrd-end", &len);
-    if ( !prop )
-    {
-        printk("linux,initrd-end not present but -start was\n");
-        return -EINVAL;
-    }
-    if ( len != sizeof(u32) && len != sizeof(u64) )
-    {
-        printk("linux,initrd-end property has invalid length %d\n", len);
-        return -EINVAL;
-    }
-    end = dt_read_paddr((const void *)&prop->data, dt_size_to_cells(len));
-
-    if ( start >= end )
-    {
-        printk("linux,initrd limits invalid: %"PRIpaddr" >= %"PRIpaddr"\n",
-                  start, end);
-        return -EINVAL;
-    }
-
-    printk("Initrd %"PRIpaddr"-%"PRIpaddr"\n", start, end);
-
-    add_boot_module(BOOTMOD_RAMDISK, start, end-start, false);
-
-    return 0;
-}
-
-static int __init process_domain_node(const void *fdt, int node,
-                                      const char *name,
-                                      u32 address_cells, u32 size_cells)
-{
-    const struct fdt_property *prop;
-
-    printk("Checking for \"xen,static-mem\" in domain node\n");
-
-    prop = fdt_get_property(fdt, node, "xen,static-mem", NULL);
-    if ( !prop )
-        /* No "xen,static-mem" present. */
-        return 0;
-
-    return device_tree_get_meminfo(fdt, node, "xen,static-mem", address_cells,
-                                   size_cells, bootinfo_get_reserved_mem(),
-                                   MEMBANK_STATIC_DOMAIN);
-}
-
-static int __init early_scan_node(const void *fdt,
-                                  int node, const char *name, int depth,
-                                  u32 address_cells, u32 size_cells,
-                                  void *data)
-{
-    int rc = 0;
-
-    /*
-     * If Xen has been booted via UEFI, the memory banks are
-     * populated. So we should skip the parsing.
-     */
-    if ( !efi_enabled(EFI_BOOT) &&
-         device_tree_is_memory_node(fdt, node, depth) )
-        rc = process_memory_node(fdt, node, name, depth,
-                                 address_cells, size_cells, bootinfo_get_mem());
-    else if ( depth == 1 && !dt_node_cmp(name, "reserved-memory") )
-        rc = process_reserved_memory(fdt, node, name, depth,
-                                     address_cells, size_cells);
-    else if ( depth <= 3 && (device_tree_node_compatible(fdt, node, "xen,multiboot-module" ) ||
-              device_tree_node_compatible(fdt, node, "multiboot,module" )))
-        process_multiboot_node(fdt, node, name, address_cells, size_cells);
-    else if ( depth == 1 && device_tree_node_matches(fdt, node, "chosen") )
-        rc = process_chosen_node(fdt, node, name, address_cells, size_cells);
-    else if ( depth == 2 && device_tree_node_compatible(fdt, node, "xen,domain") )
-        rc = process_domain_node(fdt, node, name, address_cells, size_cells);
-    else if ( depth <= 3 && device_tree_node_compatible(fdt, node, "xen,domain-shared-memory-v1") )
-        rc = process_shm_node(fdt, node, address_cells, size_cells);
-
-    if ( rc < 0 )
-        printk("fdt: node `%s': parsing failed\n", name);
-    return rc;
-}
-
-static void __init early_print_info(void)
-{
-    const struct membanks *mi = bootinfo_get_mem();
-    const struct membanks *mem_resv = bootinfo_get_reserved_mem();
-    struct bootmodules *mods = &bootinfo.modules;
-    struct bootcmdlines *cmds = &bootinfo.cmdlines;
-    unsigned int i;
-
-    for ( i = 0; i < mi->nr_banks; i++ )
-        printk("RAM: %"PRIpaddr" - %"PRIpaddr"\n",
-                mi->bank[i].start,
-                mi->bank[i].start + mi->bank[i].size - 1);
-    printk("\n");
-    for ( i = 0 ; i < mods->nr_mods; i++ )
-        printk("MODULE[%d]: %"PRIpaddr" - %"PRIpaddr" %-12s\n",
-                i,
-                mods->module[i].start,
-                mods->module[i].start + mods->module[i].size,
-                boot_module_kind_as_string(mods->module[i].kind));
-
-    for ( i = 0; i < mem_resv->nr_banks; i++ )
-    {
-        printk(" RESVD[%u]: %"PRIpaddr" - %"PRIpaddr"\n", i,
-               mem_resv->bank[i].start,
-               mem_resv->bank[i].start + mem_resv->bank[i].size - 1);
-    }
-    early_print_info_shmem();
-    printk("\n");
-    for ( i = 0 ; i < cmds->nr_mods; i++ )
-        printk("CMDLINE[%"PRIpaddr"]:%s %s\n", cmds->cmdline[i].start,
-               cmds->cmdline[i].dt_name,
-               &cmds->cmdline[i].cmdline[0]);
-    printk("\n");
-}
-
-/* This function assumes that memory regions are not overlapped */
-static int __init cmp_memory_node(const void *key, const void *elem)
-{
-    const struct membank *handler0 = key;
-    const struct membank *handler1 = elem;
-
-    if ( handler0->start < handler1->start )
-        return -1;
-
-    if ( handler0->start >= (handler1->start + handler1->size) )
-        return 1;
-
-    return 0;
-}
-
-static void __init swap_memory_node(void *_a, void *_b, size_t size)
-{
-    struct membank *a = _a, *b = _b;
-
-    SWAP(*a, *b);
-}
-
-/**
- * boot_fdt_info - initialize bootinfo from a DTB
- * @fdt: flattened device tree binary
- *
- * Returns the size of the DTB.
- */
-size_t __init boot_fdt_info(const void *fdt, paddr_t paddr)
-{
-    struct membanks *reserved_mem = bootinfo_get_reserved_mem();
-    struct membanks *mem = bootinfo_get_mem();
-    unsigned int i;
-    int nr_rsvd;
-    int ret;
-
-    ret = fdt_check_header(fdt);
-    if ( ret < 0 )
-        panic("No valid device tree\n");
-
-    add_boot_module(BOOTMOD_FDT, paddr, fdt_totalsize(fdt), false);
-
-    nr_rsvd = fdt_num_mem_rsv(fdt);
-    if ( nr_rsvd < 0 )
-        panic("Parsing FDT memory reserve map failed (%d)\n", nr_rsvd);
-
-    for ( i = 0; i < nr_rsvd; i++ )
-    {
-        struct membank *bank;
-        paddr_t s, sz;
-
-        if ( fdt_get_mem_rsv_paddr(device_tree_flattened, i, &s, &sz) < 0 )
-            continue;
-
-        if ( reserved_mem->nr_banks < reserved_mem->max_banks )
-        {
-            bank = &reserved_mem->bank[reserved_mem->nr_banks];
-            bank->start = s;
-            bank->size = sz;
-            bank->type = MEMBANK_FDT_RESVMEM;
-            reserved_mem->nr_banks++;
-        }
-        else
-            panic("Cannot allocate reserved memory bank\n");
-    }
-
-    ret = device_tree_for_each_node(fdt, 0, early_scan_node, NULL);
-    if ( ret )
-        panic("Early FDT parsing failed (%d)\n", ret);
-
-    /*
-     * On Arm64 setup_directmap_mappings() expects to be called with the lowest
-     * bank in memory first. There is no requirement that the DT will provide
-     * the banks sorted in ascending order. So sort them through.
-     */
-    sort(mem->bank, mem->nr_banks, sizeof(struct membank),
-         cmp_memory_node, swap_memory_node);
-
-    early_print_info();
-
-    return fdt_totalsize(fdt);
-}
-
-const __init char *boot_fdt_cmdline(const void *fdt)
-{
-    int node;
-    const struct fdt_property *prop;
-
-    node = fdt_path_offset(fdt, "/chosen");
-    if ( node < 0 )
-        return NULL;
-
-    prop = fdt_get_property(fdt, node, "xen,xen-bootargs", NULL);
-    if ( prop == NULL )
-    {
-        struct bootcmdline *dom0_cmdline =
-            boot_cmdline_find_by_kind(BOOTMOD_KERNEL);
-
-        if (fdt_get_property(fdt, node, "xen,dom0-bootargs", NULL) ||
-            ( dom0_cmdline && dom0_cmdline->cmdline[0] ) )
-            prop = fdt_get_property(fdt, node, "bootargs", NULL);
-    }
-    if ( prop == NULL )
-        return NULL;
-
-    return prop->data;
-}
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/setup.h
index 1748be29e5..64c227d171 100644
--- a/xen/arch/arm/include/asm/setup.h
+++ b/xen/arch/arm/include/asm/setup.h
@@ -41,19 +41,6 @@ void fw_unreserved_regions(paddr_t s, paddr_t e,
                            void (*cb)(paddr_t ps, paddr_t pe),
                            unsigned int first);
 
-bool check_reserved_regions_overlap(paddr_t region_start, paddr_t region_size);
-
-struct bootmodule *add_boot_module(bootmodule_kind kind,
-                                   paddr_t start, paddr_t size, bool domU);
-struct bootmodule *boot_module_find_by_kind(bootmodule_kind kind);
-struct bootmodule * boot_module_find_by_addr_and_kind(bootmodule_kind kind,
-                                                             paddr_t start);
-void add_boot_cmdline(const char *name, const char *cmdline,
-                      bootmodule_kind kind, paddr_t start, bool domU);
-struct bootcmdline *boot_cmdline_find_by_kind(bootmodule_kind kind);
-struct bootcmdline * boot_cmdline_find_by_name(const char *name);
-const char *boot_module_kind_as_string(bootmodule_kind kind);
-
 void init_pdx(void);
 void setup_mm(void);
 
diff --git a/xen/arch/arm/include/asm/static-shmem.h b/xen/arch/arm/include/asm/static-shmem.h
index 806ee41cfc..fd0867c4f2 100644
--- a/xen/arch/arm/include/asm/static-shmem.h
+++ b/xen/arch/arm/include/asm/static-shmem.h
@@ -80,15 +80,6 @@ static inline int process_shm_chosen(struct domain *d,
     return 0;
 }
 
-static inline int process_shm_node(const void *fdt, int node,
-                                   uint32_t address_cells, uint32_t size_cells)
-{
-    printk("CONFIG_STATIC_SHM must be enabled for parsing static shared memory nodes\n");
-    return -EINVAL;
-}
-
-static inline void early_print_info_shmem(void) {};
-
 static inline void init_sharedmem_pages(void) {};
 
 static inline int remove_shm_from_rangeset(const struct kernel_info *kinfo,
diff --git a/xen/common/device-tree/Makefile b/xen/common/device-tree/Makefile
index f813f7555f..990abd571a 100644
--- a/xen/common/device-tree/Makefile
+++ b/xen/common/device-tree/Makefile
@@ -1,2 +1,3 @@
+obj-y += bootfdt.init.o
 obj-y += bootinfo.init.o
 obj-y += device-tree.o
diff --git a/xen/common/device-tree/bootfdt.c b/xen/common/device-tree/bootfdt.c
new file mode 100644
index 0000000000..911a630e7d
--- /dev/null
+++ b/xen/common/device-tree/bootfdt.c
@@ -0,0 +1,662 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Early Device Tree
+ *
+ * Copyright (C) 2012-2014 Citrix Systems, Inc.
+ */
+
+#include <xen/bootfdt.h>
+#include <xen/device_tree.h>
+#include <xen/efi.h>
+#include <xen/init.h>
+#include <xen/kernel.h>
+#include <xen/lib.h>
+#include <xen/libfdt/libfdt-xen.h>
+#include <xen/sort.h>
+#include <xsm/xsm.h>
+#include <asm/setup.h>
+#ifdef CONFIG_STATIC_SHM
+#include <asm/static-shmem.h>
+#endif
+
+static void __init __maybe_unused build_assertions(void)
+{
+    /*
+     * Check that no padding is between struct membanks "bank" flexible array
+     * member and struct meminfo "bank" member
+     */
+    BUILD_BUG_ON((offsetof(struct membanks, bank) !=
+                 offsetof(struct meminfo, bank)));
+    /* Ensure "struct membanks" is 8-byte aligned */
+    BUILD_BUG_ON(alignof(struct membanks) != 8);
+}
+
+static bool __init device_tree_node_is_available(const void *fdt, int node)
+{
+    const char *status;
+    int len;
+
+    status = fdt_getprop(fdt, node, "status", &len);
+    if ( !status )
+        return true;
+
+    if ( len > 0 )
+    {
+        if ( !strcmp(status, "ok") || !strcmp(status, "okay") )
+            return true;
+    }
+
+    return false;
+}
+
+static bool __init device_tree_node_matches(const void *fdt, int node,
+                                            const char *match)
+{
+    const char *name;
+    size_t match_len;
+
+    name = fdt_get_name(fdt, node, NULL);
+    match_len = strlen(match);
+
+    /* Match both "match" and "match@..." patterns but not
+       "match-foo". */
+    return strncmp(name, match, match_len) == 0
+        && (name[match_len] == '@' || name[match_len] == '\0');
+}
+
+static bool __init device_tree_node_compatible(const void *fdt, int node,
+                                               const char *match)
+{
+    int len, l;
+    const void *prop;
+
+    prop = fdt_getprop(fdt, node, "compatible", &len);
+    if ( prop == NULL )
+        return false;
+
+    while ( len > 0 ) {
+        if ( !dt_compat_cmp(prop, match) )
+            return true;
+        l = strlen(prop) + 1;
+        prop += l;
+        len -= l;
+    }
+
+    return false;
+}
+
+/*
+ * Check if a node is a proper /memory node according to Devicetree
+ * Specification v0.4, chapter 3.4.
+ */
+static bool __init device_tree_is_memory_node(const void *fdt, int node,
+                                              int depth)
+{
+    const char *type;
+    int len;
+
+    if ( depth != 1 )
+        return false;
+
+    if ( !device_tree_node_matches(fdt, node, "memory") )
+        return false;
+
+    type = fdt_getprop(fdt, node, "device_type", &len);
+    if ( !type )
+        return false;
+
+    if ( (len <= strlen("memory")) || strcmp(type, "memory") )
+        return false;
+
+    return true;
+}
+
+void __init device_tree_get_reg(const __be32 **cell, uint32_t address_cells,
+                                uint32_t size_cells, paddr_t *start,
+                                paddr_t *size)
+{
+    uint64_t dt_start, dt_size;
+
+    /*
+     * dt_next_cell will return uint64_t whereas paddr_t may not be 64-bit.
+     * Thus, there is an implicit cast from uint64_t to paddr_t.
+     */
+    dt_start = dt_next_cell(address_cells, cell);
+    dt_size = dt_next_cell(size_cells, cell);
+
+    if ( dt_start != (paddr_t)dt_start )
+    {
+        printk("Physical address greater than max width supported\n");
+        WARN();
+    }
+
+    if ( dt_size != (paddr_t)dt_size )
+    {
+        printk("Physical size greater than max width supported\n");
+        WARN();
+    }
+
+    /*
+     * Xen will truncate the address/size if it is greater than the maximum
+     * supported width and it will give an appropriate warning.
+     */
+    *start = dt_start;
+    *size = dt_size;
+}
+
+static int __init device_tree_get_meminfo(const void *fdt, int node,
+                                          const char *prop_name,
+                                          u32 address_cells, u32 size_cells,
+                                          struct membanks *mem,
+                                          enum membank_type type)
+{
+    const struct fdt_property *prop;
+    unsigned int i, banks;
+    const __be32 *cell;
+    u32 reg_cells = address_cells + size_cells;
+    paddr_t start, size;
+
+    if ( !device_tree_node_is_available(fdt, node) )
+        return 0;
+
+    if ( address_cells < 1 || size_cells < 1 )
+    {
+        printk("fdt: property `%s': invalid #address-cells or #size-cells",
+               prop_name);
+        return -EINVAL;
+    }
+
+    prop = fdt_get_property(fdt, node, prop_name, NULL);
+    if ( !prop )
+        return -ENOENT;
+
+    cell = (const __be32 *)prop->data;
+    banks = fdt32_to_cpu(prop->len) / (reg_cells * sizeof (u32));
+
+    for ( i = 0; i < banks && mem->nr_banks < mem->max_banks; i++ )
+    {
+        device_tree_get_reg(&cell, address_cells, size_cells, &start, &size);
+        if ( mem == bootinfo_get_reserved_mem() &&
+             check_reserved_regions_overlap(start, size) )
+            return -EINVAL;
+        /* Some DT may describe empty bank, ignore them */
+        if ( !size )
+            continue;
+        mem->bank[mem->nr_banks].start = start;
+        mem->bank[mem->nr_banks].size = size;
+        mem->bank[mem->nr_banks].type = type;
+        mem->nr_banks++;
+    }
+
+    if ( i < banks )
+    {
+        printk("Warning: Max number of supported memory regions reached.\n");
+        return -ENOSPC;
+    }
+
+    return 0;
+}
+
+u32 __init device_tree_get_u32(const void *fdt, int node,
+                               const char *prop_name, u32 dflt)
+{
+    const struct fdt_property *prop;
+
+    prop = fdt_get_property(fdt, node, prop_name, NULL);
+    if ( !prop || prop->len < sizeof(u32) )
+        return dflt;
+
+    return fdt32_to_cpu(*(uint32_t*)prop->data);
+}
+
+/**
+ * device_tree_for_each_node - iterate over all device tree sub-nodes
+ * @fdt: flat device tree.
+ * @node: parent node to start the search from
+ * @func: function to call for each sub-node.
+ * @data: data to pass to @func.
+ *
+ * Any nodes nested at DEVICE_TREE_MAX_DEPTH or deeper are ignored.
+ *
+ * Returns 0 if all nodes were iterated over successfully.  If @func
+ * returns a value different from 0, that value is returned immediately.
+ */
+int __init device_tree_for_each_node(const void *fdt, int node,
+                                     device_tree_node_func func,
+                                     void *data)
+{
+    /*
+     * We only care about relative depth increments, assume depth of
+     * node is 0 for simplicity.
+     */
+    int depth = 0;
+    const int first_node = node;
+    u32 address_cells[DEVICE_TREE_MAX_DEPTH];
+    u32 size_cells[DEVICE_TREE_MAX_DEPTH];
+    int ret;
+
+    do {
+        const char *name = fdt_get_name(fdt, node, NULL);
+        u32 as, ss;
+
+        if ( depth >= DEVICE_TREE_MAX_DEPTH )
+        {
+            printk("Warning: device tree node `%s' is nested too deep\n",
+                   name);
+            continue;
+        }
+
+        as = depth > 0 ? address_cells[depth-1] : DT_ROOT_NODE_ADDR_CELLS_DEFAULT;
+        ss = depth > 0 ? size_cells[depth-1] : DT_ROOT_NODE_SIZE_CELLS_DEFAULT;
+
+        address_cells[depth] = device_tree_get_u32(fdt, node,
+                                                   "#address-cells", as);
+        size_cells[depth] = device_tree_get_u32(fdt, node,
+                                                "#size-cells", ss);
+
+        /* skip the first node */
+        if ( node != first_node )
+        {
+            ret = func(fdt, node, name, depth, as, ss, data);
+            if ( ret != 0 )
+                return ret;
+        }
+
+        node = fdt_next_node(fdt, node, &depth);
+    } while ( node >= 0 && depth > 0 );
+
+    return 0;
+}
+
+static int __init process_memory_node(const void *fdt, int node,
+                                      const char *name, int depth,
+                                      u32 address_cells, u32 size_cells,
+                                      struct membanks *mem)
+{
+    return device_tree_get_meminfo(fdt, node, "reg", address_cells, size_cells,
+                                   mem, MEMBANK_DEFAULT);
+}
+
+static int __init process_reserved_memory_node(const void *fdt, int node,
+                                               const char *name, int depth,
+                                               u32 address_cells,
+                                               u32 size_cells,
+                                               void *data)
+{
+    int rc = process_memory_node(fdt, node, name, depth, address_cells,
+                                 size_cells, data);
+
+    if ( rc == -ENOSPC )
+        panic("Max number of supported reserved-memory regions reached.\n");
+    else if ( rc != -ENOENT )
+        return rc;
+    return 0;
+}
+
+static int __init process_reserved_memory(const void *fdt, int node,
+                                          const char *name, int depth,
+                                          u32 address_cells, u32 size_cells)
+{
+    return device_tree_for_each_node(fdt, node,
+                                     process_reserved_memory_node,
+                                     bootinfo_get_reserved_mem());
+}
+
+static void __init process_multiboot_node(const void *fdt, int node,
+                                          const char *name,
+                                          u32 address_cells, u32 size_cells)
+{
+    static int __initdata kind_guess = 0;
+    const struct fdt_property *prop;
+    const __be32 *cell;
+    bootmodule_kind kind;
+    paddr_t start, size;
+    int len;
+    /* sizeof("/chosen/") + DT_MAX_NAME + '/' + DT_MAX_NAME + '/0' => 92 */
+    char path[92];
+    int parent_node, ret;
+    bool domU;
+
+    parent_node = fdt_parent_offset(fdt, node);
+    ASSERT(parent_node >= 0);
+
+    /* Check that the node is under "/chosen" (first 7 chars of path) */
+    ret = fdt_get_path(fdt, node, path, sizeof (path));
+    if ( ret != 0 || strncmp(path, "/chosen", 7) )
+        return;
+
+    prop = fdt_get_property(fdt, node, "reg", &len);
+    if ( !prop )
+        panic("node %s missing `reg' property\n", name);
+
+    if ( len < dt_cells_to_size(address_cells + size_cells) )
+        panic("fdt: node `%s': `reg` property length is too short\n",
+                    name);
+
+    cell = (const __be32 *)prop->data;
+    device_tree_get_reg(&cell, address_cells, size_cells, &start, &size);
+
+    if ( fdt_node_check_compatible(fdt, node, "xen,linux-zimage") == 0 ||
+         fdt_node_check_compatible(fdt, node, "multiboot,kernel") == 0 )
+        kind = BOOTMOD_KERNEL;
+    else if ( fdt_node_check_compatible(fdt, node, "xen,linux-initrd") == 0 ||
+              fdt_node_check_compatible(fdt, node, "multiboot,ramdisk") == 0 )
+        kind = BOOTMOD_RAMDISK;
+    else if ( fdt_node_check_compatible(fdt, node, "xen,xsm-policy") == 0 )
+        kind = BOOTMOD_XSM;
+    else if ( fdt_node_check_compatible(fdt, node, "multiboot,device-tree") == 0 )
+        kind = BOOTMOD_GUEST_DTB;
+    else
+        kind = BOOTMOD_UNKNOWN;
+
+    /**
+     * Guess the kind of these first two unknowns respectively:
+     * (1) The first unknown must be kernel.
+     * (2) Detect the XSM Magic from the 2nd unknown:
+     *     a. If it's XSM, set the kind as XSM, and that also means we
+     *     won't load ramdisk;
+     *     b. if it's not XSM, set the kind as ramdisk.
+     *     So if user want to load ramdisk, it must be the 2nd unknown.
+     * We also detect the XSM Magic for the following unknowns,
+     * then set its kind according to the return value of has_xsm_magic.
+     */
+    if ( kind == BOOTMOD_UNKNOWN )
+    {
+        switch ( kind_guess++ )
+        {
+        case 0: kind = BOOTMOD_KERNEL; break;
+        case 1: kind = BOOTMOD_RAMDISK; break;
+        default: break;
+        }
+        if ( kind_guess > 1 && has_xsm_magic(start) )
+            kind = BOOTMOD_XSM;
+    }
+
+    domU = fdt_node_check_compatible(fdt, parent_node, "xen,domain") == 0;
+    add_boot_module(kind, start, size, domU);
+
+    prop = fdt_get_property(fdt, node, "bootargs", &len);
+    if ( !prop )
+        return;
+    add_boot_cmdline(fdt_get_name(fdt, parent_node, &len), prop->data,
+                     kind, start, domU);
+}
+
+static int __init process_chosen_node(const void *fdt, int node,
+                                      const char *name,
+                                      u32 address_cells, u32 size_cells)
+{
+    const struct fdt_property *prop;
+    paddr_t start, end;
+    int len;
+
+    if ( fdt_get_property(fdt, node, "xen,static-heap", NULL) )
+    {
+        int rc;
+
+        printk("Checking for static heap in /chosen\n");
+
+        rc = device_tree_get_meminfo(fdt, node, "xen,static-heap",
+                                     address_cells, size_cells,
+                                     bootinfo_get_reserved_mem(),
+                                     MEMBANK_STATIC_HEAP);
+        if ( rc )
+            return rc;
+
+        bootinfo.static_heap = true;
+    }
+
+    printk("Checking for initrd in /chosen\n");
+
+    prop = fdt_get_property(fdt, node, "linux,initrd-start", &len);
+    if ( !prop )
+        /* No initrd present. */
+        return 0;
+    if ( len != sizeof(u32) && len != sizeof(u64) )
+    {
+        printk("linux,initrd-start property has invalid length %d\n", len);
+        return -EINVAL;
+    }
+    start = dt_read_paddr((const void *)&prop->data, dt_size_to_cells(len));
+
+    prop = fdt_get_property(fdt, node, "linux,initrd-end", &len);
+    if ( !prop )
+    {
+        printk("linux,initrd-end not present but -start was\n");
+        return -EINVAL;
+    }
+    if ( len != sizeof(u32) && len != sizeof(u64) )
+    {
+        printk("linux,initrd-end property has invalid length %d\n", len);
+        return -EINVAL;
+    }
+    end = dt_read_paddr((const void *)&prop->data, dt_size_to_cells(len));
+
+    if ( start >= end )
+    {
+        printk("linux,initrd limits invalid: %"PRIpaddr" >= %"PRIpaddr"\n",
+                  start, end);
+        return -EINVAL;
+    }
+
+    printk("Initrd %"PRIpaddr"-%"PRIpaddr"\n", start, end);
+
+    add_boot_module(BOOTMOD_RAMDISK, start, end-start, false);
+
+    return 0;
+}
+
+static int __init process_domain_node(const void *fdt, int node,
+                                      const char *name,
+                                      u32 address_cells, u32 size_cells)
+{
+    const struct fdt_property *prop;
+
+    printk("Checking for \"xen,static-mem\" in domain node\n");
+
+    prop = fdt_get_property(fdt, node, "xen,static-mem", NULL);
+    if ( !prop )
+        /* No "xen,static-mem" present. */
+        return 0;
+
+    return device_tree_get_meminfo(fdt, node, "xen,static-mem", address_cells,
+                                   size_cells, bootinfo_get_reserved_mem(),
+                                   MEMBANK_STATIC_DOMAIN);
+}
+
+#ifndef CONFIG_STATIC_SHM
+static inline int process_shm_node(const void *fdt, int node,
+                                   uint32_t address_cells, uint32_t size_cells)
+{
+    printk("CONFIG_STATIC_SHM must be enabled for parsing static shared"
+            " memory nodes\n");
+    return -EINVAL;
+}
+#endif
+
+static int __init early_scan_node(const void *fdt,
+                                  int node, const char *name, int depth,
+                                  u32 address_cells, u32 size_cells,
+                                  void *data)
+{
+    int rc = 0;
+
+    /*
+     * If Xen has been booted via UEFI, the memory banks are
+     * populated. So we should skip the parsing.
+     */
+    if ( !efi_enabled(EFI_BOOT) &&
+         device_tree_is_memory_node(fdt, node, depth) )
+        rc = process_memory_node(fdt, node, name, depth,
+                                 address_cells, size_cells, bootinfo_get_mem());
+    else if ( depth == 1 && !dt_node_cmp(name, "reserved-memory") )
+        rc = process_reserved_memory(fdt, node, name, depth,
+                                     address_cells, size_cells);
+    else if ( depth <= 3 && (device_tree_node_compatible(fdt, node, "xen,multiboot-module" ) ||
+              device_tree_node_compatible(fdt, node, "multiboot,module" )))
+        process_multiboot_node(fdt, node, name, address_cells, size_cells);
+    else if ( depth == 1 && device_tree_node_matches(fdt, node, "chosen") )
+        rc = process_chosen_node(fdt, node, name, address_cells, size_cells);
+    else if ( depth == 2 && device_tree_node_compatible(fdt, node, "xen,domain") )
+        rc = process_domain_node(fdt, node, name, address_cells, size_cells);
+    else if ( depth <= 3 && device_tree_node_compatible(fdt, node, "xen,domain-shared-memory-v1") )
+        rc = process_shm_node(fdt, node, address_cells, size_cells);
+
+    if ( rc < 0 )
+        printk("fdt: node `%s': parsing failed\n", name);
+    return rc;
+}
+
+static void __init early_print_info(void)
+{
+    const struct membanks *mi = bootinfo_get_mem();
+    const struct membanks *mem_resv = bootinfo_get_reserved_mem();
+    struct bootmodules *mods = &bootinfo.modules;
+    struct bootcmdlines *cmds = &bootinfo.cmdlines;
+    unsigned int i;
+
+    for ( i = 0; i < mi->nr_banks; i++ )
+        printk("RAM: %"PRIpaddr" - %"PRIpaddr"\n",
+                mi->bank[i].start,
+                mi->bank[i].start + mi->bank[i].size - 1);
+    printk("\n");
+    for ( i = 0 ; i < mods->nr_mods; i++ )
+        printk("MODULE[%d]: %"PRIpaddr" - %"PRIpaddr" %-12s\n",
+                i,
+                mods->module[i].start,
+                mods->module[i].start + mods->module[i].size,
+                boot_module_kind_as_string(mods->module[i].kind));
+
+    for ( i = 0; i < mem_resv->nr_banks; i++ )
+    {
+        printk(" RESVD[%u]: %"PRIpaddr" - %"PRIpaddr"\n", i,
+               mem_resv->bank[i].start,
+               mem_resv->bank[i].start + mem_resv->bank[i].size - 1);
+    }
+#ifdef CONFIG_STATIC_SHM
+    early_print_info_shmem();
+#endif
+    printk("\n");
+    for ( i = 0 ; i < cmds->nr_mods; i++ )
+        printk("CMDLINE[%"PRIpaddr"]:%s %s\n", cmds->cmdline[i].start,
+               cmds->cmdline[i].dt_name,
+               &cmds->cmdline[i].cmdline[0]);
+    printk("\n");
+}
+
+/* This function assumes that memory regions are not overlapped */
+static int __init cmp_memory_node(const void *key, const void *elem)
+{
+    const struct membank *handler0 = key;
+    const struct membank *handler1 = elem;
+
+    if ( handler0->start < handler1->start )
+        return -1;
+
+    if ( handler0->start >= (handler1->start + handler1->size) )
+        return 1;
+
+    return 0;
+}
+
+static void __init swap_memory_node(void *_a, void *_b, size_t size)
+{
+    struct membank *a = _a, *b = _b;
+
+    SWAP(*a, *b);
+}
+
+/**
+ * boot_fdt_info - initialize bootinfo from a DTB
+ * @fdt: flattened device tree binary
+ *
+ * Returns the size of the DTB.
+ */
+size_t __init boot_fdt_info(const void *fdt, paddr_t paddr)
+{
+    struct membanks *reserved_mem = bootinfo_get_reserved_mem();
+    struct membanks *mem = bootinfo_get_mem();
+    unsigned int i;
+    int nr_rsvd;
+    int ret;
+
+    ret = fdt_check_header(fdt);
+    if ( ret < 0 )
+        panic("No valid device tree\n");
+
+    add_boot_module(BOOTMOD_FDT, paddr, fdt_totalsize(fdt), false);
+
+    nr_rsvd = fdt_num_mem_rsv(fdt);
+    if ( nr_rsvd < 0 )
+        panic("Parsing FDT memory reserve map failed (%d)\n", nr_rsvd);
+
+    for ( i = 0; i < nr_rsvd; i++ )
+    {
+        struct membank *bank;
+        paddr_t s, sz;
+
+        if ( fdt_get_mem_rsv_paddr(device_tree_flattened, i, &s, &sz) < 0 )
+            continue;
+
+        if ( reserved_mem->nr_banks < reserved_mem->max_banks )
+        {
+            bank = &reserved_mem->bank[reserved_mem->nr_banks];
+            bank->start = s;
+            bank->size = sz;
+            bank->type = MEMBANK_FDT_RESVMEM;
+            reserved_mem->nr_banks++;
+        }
+        else
+            panic("Cannot allocate reserved memory bank\n");
+    }
+
+    ret = device_tree_for_each_node(fdt, 0, early_scan_node, NULL);
+    if ( ret )
+        panic("Early FDT parsing failed (%d)\n", ret);
+
+    /*
+     * On Arm64 setup_directmap_mappings() expects to be called with the lowest
+     * bank in memory first. There is no requirement that the DT will provide
+     * the banks sorted in ascending order. So sort them through.
+     */
+    sort(mem->bank, mem->nr_banks, sizeof(struct membank),
+         cmp_memory_node, swap_memory_node);
+
+    early_print_info();
+
+    return fdt_totalsize(fdt);
+}
+
+const __init char *boot_fdt_cmdline(const void *fdt)
+{
+    int node;
+    const struct fdt_property *prop;
+
+    node = fdt_path_offset(fdt, "/chosen");
+    if ( node < 0 )
+        return NULL;
+
+    prop = fdt_get_property(fdt, node, "xen,xen-bootargs", NULL);
+    if ( prop == NULL )
+    {
+        struct bootcmdline *dom0_cmdline =
+            boot_cmdline_find_by_kind(BOOTMOD_KERNEL);
+
+        if (fdt_get_property(fdt, node, "xen,dom0-bootargs", NULL) ||
+            ( dom0_cmdline && dom0_cmdline->cmdline[0] ) )
+            prop = fdt_get_property(fdt, node, "bootargs", NULL);
+    }
+    if ( prop == NULL )
+        return NULL;
+
+    return prop->data;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h
index c39428d5f5..16fa05f38f 100644
--- a/xen/include/xen/bootfdt.h
+++ b/xen/include/xen/bootfdt.h
@@ -157,6 +157,20 @@ struct bootinfo {
 
 extern struct bootinfo bootinfo;
 
+bool check_reserved_regions_overlap(paddr_t region_start,
+                                    paddr_t region_size);
+
+struct bootmodule *add_boot_module(bootmodule_kind kind,
+                                   paddr_t start, paddr_t size, bool domU);
+struct bootmodule *boot_module_find_by_kind(bootmodule_kind kind);
+struct bootmodule * boot_module_find_by_addr_and_kind(bootmodule_kind kind,
+                                                             paddr_t start);
+void add_boot_cmdline(const char *name, const char *cmdline,
+                      bootmodule_kind kind, paddr_t start, bool domU);
+struct bootcmdline *boot_cmdline_find_by_kind(bootmodule_kind kind);
+struct bootcmdline * boot_cmdline_find_by_name(const char *name);
+const char *boot_module_kind_as_string(bootmodule_kind kind);
+
 void populate_boot_allocator(void);
 
 size_t boot_fdt_info(const void *fdt, paddr_t paddr);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 06 18:44:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Aug 2024 18:44:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773098.1183563 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbPAs-0001mE-0y; Tue, 06 Aug 2024 18:44:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773098.1183563; Tue, 06 Aug 2024 18:44:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbPAr-0001m6-Uc; Tue, 06 Aug 2024 18:44:45 +0000
Received: by outflank-mailman (input) for mailman id 773098;
 Tue, 06 Aug 2024 18:44:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbPAq-0001lw-F0
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 18:44:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbPAq-00042J-E7
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 18:44:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbPAq-00025I-DK
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 18:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=X64WqPbbgFTQiaF7e7HCr+XcMC8TuWhWUZVnnSBdSpU=; b=xVbPBj8XEqgRWbZinxx/0zdKMU
	YWqphVJX9fyYw7ksWanANyCTQLDg18qvvceZnVSrkKRkJwmi6ctymlg/+1Q377LihMdQD8x1Vgn0K
	QrSZNFnD2Rj+H+cGzNlmNwJ68yIpLHaqLGTSNBtWPZY0uUoRa+rg9cG/FZvfIwIPTnZo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: vITS: add #msi-cells property
Message-Id: <E1sbPAq-00025I-DK@xenbits.xenproject.org>
Date: Tue, 06 Aug 2024 18:44:44 +0000

commit 2dbb61001b335c8f980b39ef9fa05fe5b2bca3e6
Author:     Stewart Hildebrand <stewart.hildebrand@amd.com>
AuthorDate: Fri Aug 2 14:26:52 2024 -0400
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Aug 6 19:11:50 2024 +0100

    xen/arm: vITS: add #msi-cells property
    
    Non-PCI platform devices may use the ITS. Dom0 Linux drivers for such
    devices are failing to register IRQs due to a missing #msi-cells
    property. Add the missing #msi-cells property.
    
    Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
---
 xen/arch/arm/gic-v3-its.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
index 8afcd9783b..55bed3fe87 100644
--- a/xen/arch/arm/gic-v3-its.c
+++ b/xen/arch/arm/gic-v3-its.c
@@ -951,6 +951,10 @@ int gicv3_its_make_hwdom_dt_nodes(const struct domain *d,
         if ( res )
             return res;
 
+        res = fdt_property_cell(fdt, "#msi-cells", 1);
+        if ( res )
+            return res;
+
         if ( its->phandle )
         {
             res = fdt_property_cell(fdt, "phandle", its->phandle);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 06 21:00:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Aug 2024 21:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773123.1183588 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbRHo-0006Xa-Lw; Tue, 06 Aug 2024 21:00:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773123.1183588; Tue, 06 Aug 2024 21: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 1sbRHo-0006XF-Ir; Tue, 06 Aug 2024 21:00:04 +0000
Received: by outflank-mailman (input) for mailman id 773123;
 Tue, 06 Aug 2024 21:00:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbRHn-0006KU-SP
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 21:00:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbRHn-0006Sn-GS
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 21:00:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbRHn-0002hW-EJ
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 21:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MSjq1efhVSIqUS6Fih36ALVQ/v1Z1q93TW/XrQAoulo=; b=hjKuMhd9v28vblEywTdjQZ713z
	dq2VShS2fTeGprJ2oSBIzsk1hj50mFT54Ptc897iN76UXB057g0ccgwPBXvBsUyBOAzRiwsQ9sq0s
	7/YaSCAoXx7XlriWqQCVYV/LPlL8l/Xm7Wc9cVyMqKPx3zNxZaZeDP1eLVw80U+oiz7o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: fix eclair gitlab jobs for merge requests
Message-Id: <E1sbRHn-0002hW-EJ@xenbits.xenproject.org>
Date: Tue, 06 Aug 2024 21:00:03 +0000

commit 449caecbdfa3f423eae46a53822b7e403607cfee
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Mon Aug 5 14:24:23 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Aug 6 12:29:05 2024 -0700

    automation: fix eclair gitlab jobs for merge requests
    
    The "eclair" script calls action_push.sh even for merge request, while
    instead action_pull_request.sh should be called, resulting in a job
    failure with this error:
    
    Unexpected event pull_request
    
    Fix the script to call action_pull_request.sh appropriately.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Simone Ballarin <simone.ballarin@bugseng.com>
---
 automation/eclair_analysis/ECLAIR/action_pull_request.sh |  2 +-
 automation/scripts/eclair                                | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/action_pull_request.sh b/automation/eclair_analysis/ECLAIR/action_pull_request.sh
old mode 100644
new mode 100755
index 68f7e6282e..812238e07f
--- a/automation/eclair_analysis/ECLAIR/action_pull_request.sh
+++ b/automation/eclair_analysis/ECLAIR/action_pull_request.sh
@@ -3,7 +3,7 @@
 set -eu
 
 usage() {
-    echo "Usage: $0 WTOKEN ANALYSIS_OUTPUT_DIR COMMIT_ID" >&2
+    echo "Usage: $0 WTOKEN ANALYSIS_OUTPUT_DIR" >&2
     exit 2
 }
 
diff --git a/automation/scripts/eclair b/automation/scripts/eclair
index ebcaf09b54..3ec760bab8 100755
--- a/automation/scripts/eclair
+++ b/automation/scripts/eclair
@@ -21,5 +21,16 @@ ex=0
 # Fail in case of new reports for clean guidelines
 "${ECLAIR_DIR}/action_check_clean_regressions.sh" "${ECLAIR_OUTPUT_DIR}" || ex=$?
 
-"${ECLAIR_DIR}/action_push.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}"
+case "${CI_PIPELINE_SOURCE}" in
+merge_request_event)
+    "${ECLAIR_DIR}/action_pull_request.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}"
+    ;;
+push | pipeline | web | schedule)
+    "${ECLAIR_DIR}/action_push.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}"
+    ;;
+*)
+    echo "Unexpected event ${CI_PIPELINE_SOURCE}" >&2
+    ex=1
+    ;;
+esac
 [ "${ex}" = 0 ] || exit "${ex}"
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 06 21:00:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Aug 2024 21:00:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773124.1183591 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbRHy-0006uO-NC; Tue, 06 Aug 2024 21:00:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773124.1183591; Tue, 06 Aug 2024 21: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 1sbRHy-0006uH-KV; Tue, 06 Aug 2024 21:00:14 +0000
Received: by outflank-mailman (input) for mailman id 773124;
 Tue, 06 Aug 2024 21:00:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbRHx-0006uB-Km
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 21:00:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbRHx-0006Sr-JW
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 21:00:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbRHx-0002jG-Id
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 21:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=c5V4H2USiB+Id7jap4/NY6QG3W1aNZj4L/J2wnJPZnI=; b=sh0xs/opDNGYSG6FjXERvRXQFt
	M/vLXjjG6OI2Z+6Gcy9xWRFep/V8w7X3KDoAbtcuM5QaCE7rw4I3EWMUbZp6CCkqKhVOXM3KdiIug
	PLudmv9AMPmpR6JGSi1/Gv06y7rO8ChAdpT9fOZDsm/yMwW2KdkUvm6yfFo14szaLVIk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation/eclair: sort monitored guidelines with -V
Message-Id: <E1sbRHx-0002jG-Id@xenbits.xenproject.org>
Date: Tue, 06 Aug 2024 21:00:13 +0000

commit e03cea171a5f60d7370aae28891587817c407ff4
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Mon Aug 5 11:34:32 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Aug 6 12:30:17 2024 -0700

    automation/eclair: sort monitored guidelines with -V
    
    To improve readability, sort guidelines with -V.
    
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/monitored.ecl | 92 ++++++++++++-------------
 1 file changed, 46 insertions(+), 46 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/monitored.ecl b/automation/eclair_analysis/ECLAIR/monitored.ecl
index 8a7e3f3cea..7b085a329a 100644
--- a/automation/eclair_analysis/ECLAIR/monitored.ecl
+++ b/automation/eclair_analysis/ECLAIR/monitored.ecl
@@ -2,58 +2,17 @@
 -enable=MC3R1.D1.1
 -enable=MC3R1.D2.1
 -enable=MC3R1.D4.1
+-enable=MC3R1.D4.3
+-enable=MC3R1.D4.7
 -enable=MC3R1.D4.10
 -enable=MC3R1.D4.11
 -enable=MC3R1.D4.12
 -enable=MC3R1.D4.14
--enable=MC3R1.D4.3
--enable=MC3R1.D4.7
--enable=MC3R1.R10.1
--enable=MC3R1.R10.2
 -enable=MC3R1.R1.1
--enable=MC3R1.R11.1
--enable=MC3R1.R11.7
--enable=MC3R1.R11.8
--enable=MC3R1.R11.9
--enable=MC3R1.R12.5
 -enable=MC3R1.R1.3
--enable=MC3R1.R13.6
--enable=MC3R1.R13.1
 -enable=MC3R1.R1.4
--enable=MC3R1.R14.1
--enable=MC3R1.R14.4
--enable=MC3R1.R16.2
--enable=MC3R1.R16.3
--enable=MC3R1.R16.4
--enable=MC3R1.R16.6
--enable=MC3R1.R16.7
--enable=MC3R1.R17.1
--enable=MC3R1.R17.3
--enable=MC3R1.R17.4
--enable=MC3R1.R17.5
--enable=MC3R1.R17.6
--enable=MC3R1.R18.6
--enable=MC3R1.R19.1
--enable=MC3R1.R20.12
--enable=MC3R1.R20.13
--enable=MC3R1.R20.14
--enable=MC3R1.R20.4
--enable=MC3R1.R20.7
--enable=MC3R1.R20.9
 -enable=MC3R1.R2.1
--enable=MC3R1.R21.10
--enable=MC3R1.R21.13
--enable=MC3R1.R21.17
--enable=MC3R1.R21.18
--enable=MC3R1.R21.19
--enable=MC3R1.R21.20
--enable=MC3R1.R21.21
--enable=MC3R1.R21.9
 -enable=MC3R1.R2.2
--enable=MC3R1.R22.2
--enable=MC3R1.R22.4
--enable=MC3R1.R22.5
--enable=MC3R1.R22.6
 -enable=MC3R1.R2.6
 -enable=MC3R1.R3.1
 -enable=MC3R1.R3.2
@@ -72,32 +31,73 @@
 -enable=MC3R1.R7.3
 -enable=MC3R1.R7.4
 -enable=MC3R1.R8.1
--enable=MC3R1.R8.10
--enable=MC3R1.R8.12
--enable=MC3R1.R8.14
 -enable=MC3R1.R8.2
 -enable=MC3R1.R8.3
 -enable=MC3R1.R8.4
 -enable=MC3R1.R8.5
 -enable=MC3R1.R8.6
 -enable=MC3R1.R8.8
+-enable=MC3R1.R8.10
+-enable=MC3R1.R8.12
+-enable=MC3R1.R8.14
 -enable=MC3R1.R9.2
 -enable=MC3R1.R9.3
 -enable=MC3R1.R9.4
 -enable=MC3R1.R9.5
+-enable=MC3R1.R10.1
+-enable=MC3R1.R10.2
+-enable=MC3R1.R11.1
+-enable=MC3R1.R11.7
+-enable=MC3R1.R11.8
+-enable=MC3R1.R11.9
+-enable=MC3R1.R12.5
+-enable=MC3R1.R13.1
+-enable=MC3R1.R13.6
+-enable=MC3R1.R14.1
+-enable=MC3R1.R14.4
+-enable=MC3R1.R16.2
+-enable=MC3R1.R16.3
+-enable=MC3R1.R16.4
+-enable=MC3R1.R16.6
+-enable=MC3R1.R16.7
+-enable=MC3R1.R17.1
+-enable=MC3R1.R17.3
+-enable=MC3R1.R17.4
+-enable=MC3R1.R17.5
+-enable=MC3R1.R17.6
+-enable=MC3R1.R18.6
 -enable=MC3R1.R18.8
+-enable=MC3R1.R19.1
 -enable=MC3R1.R20.2
 -enable=MC3R1.R20.3
+-enable=MC3R1.R20.4
 -enable=MC3R1.R20.6
+-enable=MC3R1.R20.7
+-enable=MC3R1.R20.9
 -enable=MC3R1.R20.11
+-enable=MC3R1.R20.12
+-enable=MC3R1.R20.13
+-enable=MC3R1.R20.14
 -enable=MC3R1.R21.3
 -enable=MC3R1.R21.4
 -enable=MC3R1.R21.5
 -enable=MC3R1.R21.7
 -enable=MC3R1.R21.8
+-enable=MC3R1.R21.9
+-enable=MC3R1.R21.10
 -enable=MC3R1.R21.12
+-enable=MC3R1.R21.13
+-enable=MC3R1.R21.17
+-enable=MC3R1.R21.18
+-enable=MC3R1.R21.19
+-enable=MC3R1.R21.20
+-enable=MC3R1.R21.21
 -enable=MC3R1.R22.1
+-enable=MC3R1.R22.2
 -enable=MC3R1.R22.3
+-enable=MC3R1.R22.4
+-enable=MC3R1.R22.5
+-enable=MC3R1.R22.6
 -enable=MC3R1.R22.7
 -enable=MC3R1.R22.8
 -enable=MC3R1.R22.9
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 06 21:00:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 06 Aug 2024 21:00:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773125.1183594 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbRI8-0006wx-OZ; Tue, 06 Aug 2024 21:00:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773125.1183594; Tue, 06 Aug 2024 21: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 1sbRI8-0006wq-M9; Tue, 06 Aug 2024 21:00:24 +0000
Received: by outflank-mailman (input) for mailman id 773125;
 Tue, 06 Aug 2024 21:00:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbRI7-0006wc-OE
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 21:00:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbRI7-0006TK-NI
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 21:00:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbRI7-0002kN-LZ
 for xen-changelog@lists.xenproject.org; Tue, 06 Aug 2024 21:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qONnNrSo5waCI8xuiuho91jjGLmh6bPOMaytH2+k0yA=; b=abIjc+foOLU8C9IVI23/IwZ3bn
	WifUfwYe3laAw6YXERFPEmRyioJhTCvuOO6jzEKUVc2T0rStSxe8TUiprMwmOp2DdS9loWnaVwM4h
	qf+ZOsPpenncB7W9BKbkqLsYflq+8lblzWAjSvJBLP+3xynDMvIMErUC+MiBZBwiibTY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation/eclair: tag more guidelines as clean
Message-Id: <E1sbRI7-0002kN-LZ@xenbits.xenproject.org>
Date: Tue, 06 Aug 2024 21:00:23 +0000

commit 6b9b96ddebf269579730ff2a65f324505bc2aba9
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Mon Aug 5 11:34:33 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Aug 6 12:30:17 2024 -0700

    automation/eclair: tag more guidelines as clean
    
    Tag more of the accepted guidelines as clean to avoid regressions.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/tagging.ecl | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index e7b32773e6..4d0ac94848 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -56,11 +56,14 @@ MC3R1.R9.3||
 MC3R1.R9.4||
 MC3R1.R9.5||
 MC3R1.R10.2||
+MC3R1.R11.6||
 MC3R1.R11.7||
 MC3R1.R11.9||
 MC3R1.R12.5||
 MC3R1.R14.1||
+MC3R1.R14.3||
 MC3R1.R14.4||
+MC3R1.R16.2||
 MC3R1.R16.7||
 MC3R1.R17.1||
 MC3R1.R17.3||
@@ -85,6 +88,7 @@ MC3R1.R21.7||
 MC3R1.R21.8||
 MC3R1.R21.9||
 MC3R1.R21.10||
+MC3R1.R21.11||
 MC3R1.R21.12||
 MC3R1.R21.13||
 MC3R1.R21.19||
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 07 17:22:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Aug 2024 17:22:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773615.1184051 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbkMN-000393-LG; Wed, 07 Aug 2024 17:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773615.1184051; Wed, 07 Aug 2024 17: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 1sbkMN-00038v-Ia; Wed, 07 Aug 2024 17:22:03 +0000
Received: by outflank-mailman (input) for mailman id 773615;
 Wed, 07 Aug 2024 17:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkMM-00038p-0J
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkML-0008Uq-PZ
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkML-0003FP-OL
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=M5mLzHiiX0JeZkx/EfwOn8xQ5UbfvQ5A/276Kr2H1pM=; b=R5GFth8j2a/ETMc59Sw464CHTJ
	umoF9TYOsI2b2bQdMhXyNUopW4idA0fdEEPnHG0PFUlxgsGcVM+xhiqWn/CgsJ4T9ecCYbGyY6s/z
	r8RjDElgseacu84RpKB32IY5eLXQbERXhNzCeWgthQwwiTckG6ZyrYNmZR6an82XMPYU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vpmu: guard calls to vmx/svm functions
Message-Id: <E1sbkML-0003FP-OL@xenbits.xenproject.org>
Date: Wed, 07 Aug 2024 17:22:01 +0000

commit cddbee85d0c0386a2126c4698c1f63baeaf292f1
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Tue Aug 6 08:35:09 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 6 08:35:09 2024 +0200

    x86/vpmu: guard calls to vmx/svm functions
    
    If VMX/SVM disabled in the build, we may still want to have vPMU drivers for
    PV guests. Yet in such case before using VMX/SVM features and functions we have
    to explicitly check if they're available in the build. For this purpose
    (and also not to complicate conditionals) two helpers introduced --
    is_{vmx,svm}_vcpu(v) that check both HVM & VMX/SVM conditions at the same time,
    and they replace is_hvm_vcpu(v) macro in Intel/AMD PMU drivers.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/vpmu_amd.c   | 11 ++++++-----
 xen/arch/x86/cpu/vpmu_intel.c | 28 +++++++++++++++-------------
 2 files changed, 21 insertions(+), 18 deletions(-)

diff --git a/xen/arch/x86/cpu/vpmu_amd.c b/xen/arch/x86/cpu/vpmu_amd.c
index 97e6315bd9..a082450e92 100644
--- a/xen/arch/x86/cpu/vpmu_amd.c
+++ b/xen/arch/x86/cpu/vpmu_amd.c
@@ -27,6 +27,7 @@
 #define is_pmu_enabled(msr) ((msr) & (1ULL << MSR_F10H_EVNTSEL_EN_SHIFT))
 #define set_guest_mode(msr) ((msr) |= (1ULL << MSR_F10H_EVNTSEL_GO_SHIFT))
 #define is_overflowed(msr) (!((msr) & (1ULL << (MSR_F10H_COUNTER_LENGTH - 1))))
+#define is_svm_vcpu(v) (IS_ENABLED(CONFIG_AMD_SVM) && is_hvm_vcpu(v))
 
 static unsigned int __read_mostly num_counters;
 static const u32 __read_mostly *counters;
@@ -289,7 +290,7 @@ static int cf_check amd_vpmu_save(struct vcpu *v,  bool to_guest)
 
     context_save(v);
 
-    if ( !vpmu_is_set(vpmu, VPMU_RUNNING) && is_hvm_vcpu(v) &&
+    if ( !vpmu_is_set(vpmu, VPMU_RUNNING) && is_svm_vcpu(v) &&
          is_msr_bitmap_on(vpmu) )
         amd_vpmu_unset_msr_bitmap(v);
 
@@ -349,7 +350,7 @@ static int cf_check amd_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content)
         return -EINVAL;
 
     /* For all counters, enable guest only mode for HVM guest */
-    if ( is_hvm_vcpu(v) && (type == MSR_TYPE_CTRL) &&
+    if ( is_svm_vcpu(v) && (type == MSR_TYPE_CTRL) &&
          !is_guest_mode(msr_content) )
     {
         set_guest_mode(msr_content);
@@ -363,7 +364,7 @@ static int cf_check amd_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content)
             return 0;
         vpmu_set(vpmu, VPMU_RUNNING);
 
-        if ( is_hvm_vcpu(v) && is_msr_bitmap_on(vpmu) )
+        if ( is_svm_vcpu(v) && is_msr_bitmap_on(vpmu) )
              amd_vpmu_set_msr_bitmap(v);
     }
 
@@ -372,7 +373,7 @@ static int cf_check amd_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content)
         (is_pmu_enabled(msr_content) == 0) && vpmu_is_set(vpmu, VPMU_RUNNING) )
     {
         vpmu_reset(vpmu, VPMU_RUNNING);
-        if ( is_hvm_vcpu(v) && is_msr_bitmap_on(vpmu) )
+        if ( is_svm_vcpu(v) && is_msr_bitmap_on(vpmu) )
              amd_vpmu_unset_msr_bitmap(v);
         release_pmu_ownership(PMU_OWNER_HVM);
     }
@@ -415,7 +416,7 @@ static void cf_check amd_vpmu_destroy(struct vcpu *v)
 {
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
 
-    if ( is_hvm_vcpu(v) && is_msr_bitmap_on(vpmu) )
+    if ( is_svm_vcpu(v) && is_msr_bitmap_on(vpmu) )
         amd_vpmu_unset_msr_bitmap(v);
 
     xfree(vpmu->context);
diff --git a/xen/arch/x86/cpu/vpmu_intel.c b/xen/arch/x86/cpu/vpmu_intel.c
index 26dd3a9358..7ce98ee42e 100644
--- a/xen/arch/x86/cpu/vpmu_intel.c
+++ b/xen/arch/x86/cpu/vpmu_intel.c
@@ -54,6 +54,8 @@
 #define MSR_PMC_ALIAS_MASK       (~(MSR_IA32_PERFCTR0 ^ MSR_IA32_A_PERFCTR0))
 static bool __read_mostly full_width_write;
 
+#define is_vmx_vcpu(v) (IS_ENABLED(CONFIG_INTEL_VMX) && is_hvm_vcpu(v))
+
 /*
  * MSR_CORE_PERF_FIXED_CTR_CTRL contains the configuration of all fixed
  * counters. 4 bits for every counter.
@@ -266,7 +268,7 @@ static inline void __core2_vpmu_save(struct vcpu *v)
         rdmsrl(MSR_P6_EVNTSEL(i), xen_pmu_cntr_pair[i].control);
     }
 
-    if ( !is_hvm_vcpu(v) )
+    if ( !is_vmx_vcpu(v) )
         rdmsrl(MSR_CORE_PERF_GLOBAL_STATUS, core2_vpmu_cxt->global_status);
     /* Save MSR to private context to make it fork-friendly */
     else if ( mem_sharing_enabled(v->domain) )
@@ -278,7 +280,7 @@ static int cf_check core2_vpmu_save(struct vcpu *v, bool to_guest)
 {
     struct vpmu_struct *vpmu = vcpu_vpmu(v);
 
-    if ( !is_hvm_vcpu(v) )
+    if ( !is_vmx_vcpu(v) )
         wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, 0);
 
     if ( !vpmu_are_all_set(vpmu, VPMU_CONTEXT_SAVE | VPMU_CONTEXT_LOADED) )
@@ -287,7 +289,7 @@ static int cf_check core2_vpmu_save(struct vcpu *v, bool to_guest)
     __core2_vpmu_save(v);
 
     /* Unset PMU MSR bitmap to trap lazy load. */
-    if ( !vpmu_is_set(vpmu, VPMU_RUNNING) && is_hvm_vcpu(v) &&
+    if ( !vpmu_is_set(vpmu, VPMU_RUNNING) && is_vmx_vcpu(v) &&
          cpu_has_vmx_msr_bitmap )
         core2_vpmu_unset_msr_bitmap(v);
 
@@ -326,7 +328,7 @@ static inline void __core2_vpmu_load(struct vcpu *v)
     if ( vpmu_is_set(vcpu_vpmu(v), VPMU_CPU_HAS_DS) )
         wrmsrl(MSR_IA32_DS_AREA, core2_vpmu_cxt->ds_area);
 
-    if ( !is_hvm_vcpu(v) )
+    if ( !is_vmx_vcpu(v) )
     {
         wrmsrl(MSR_CORE_PERF_GLOBAL_OVF_CTRL, core2_vpmu_cxt->global_ovf_ctrl);
         core2_vpmu_cxt->global_ovf_ctrl = 0;
@@ -381,7 +383,7 @@ static int core2_vpmu_verify(struct vcpu *v)
     }
 
     if ( vpmu_is_set(vpmu, VPMU_CPU_HAS_DS) &&
-         !(is_hvm_vcpu(v)
+         !(is_vmx_vcpu(v)
            ? is_canonical_address(core2_vpmu_cxt->ds_area)
            : __addr_ok(core2_vpmu_cxt->ds_area)) )
         return -EINVAL;
@@ -442,7 +444,7 @@ static int cf_check core2_vpmu_alloc_resource(struct vcpu *v)
     if ( !acquire_pmu_ownership(PMU_OWNER_HVM) )
         return 0;
 
-    if ( is_hvm_vcpu(v) )
+    if ( is_vmx_vcpu(v) )
     {
         if ( vmx_add_host_load_msr(v, MSR_CORE_PERF_GLOBAL_CTRL, 0) )
             goto out_err;
@@ -513,7 +515,7 @@ static int core2_vpmu_msr_common_check(u32 msr_index, int *type, int *index)
         __core2_vpmu_load(current);
         vpmu_set(vpmu, VPMU_CONTEXT_LOADED);
 
-        if ( is_hvm_vcpu(current) && cpu_has_vmx_msr_bitmap )
+        if ( is_vmx_vcpu(current) && cpu_has_vmx_msr_bitmap )
             core2_vpmu_set_msr_bitmap(current);
     }
     return 1;
@@ -562,7 +564,7 @@ static int cf_check core2_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content)
             return -EINVAL;
         if ( vpmu_is_set(vpmu, VPMU_CPU_HAS_DS) )
         {
-            if ( !(is_hvm_vcpu(v) ? is_canonical_address(msr_content)
+            if ( !(is_vmx_vcpu(v) ? is_canonical_address(msr_content)
                                   : __addr_ok(msr_content)) )
             {
                 gdprintk(XENLOG_WARNING,
@@ -584,7 +586,7 @@ static int cf_check core2_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content)
         if ( msr_content & fixed_ctrl_mask )
             return -EINVAL;
 
-        if ( is_hvm_vcpu(v) )
+        if ( is_vmx_vcpu(v) )
             vmx_read_guest_msr(v, MSR_CORE_PERF_GLOBAL_CTRL,
                                &core2_vpmu_cxt->global_ctrl);
         else
@@ -653,7 +655,7 @@ static int cf_check core2_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content)
             if ( blocked )
                 return -EINVAL;
 
-            if ( is_hvm_vcpu(v) )
+            if ( is_vmx_vcpu(v) )
                 vmx_read_guest_msr(v, MSR_CORE_PERF_GLOBAL_CTRL,
                                    &core2_vpmu_cxt->global_ctrl);
             else
@@ -673,7 +675,7 @@ static int cf_check core2_vpmu_do_wrmsr(unsigned int msr, uint64_t msr_content)
         wrmsrl(msr, msr_content);
     else
     {
-        if ( is_hvm_vcpu(v) )
+        if ( is_vmx_vcpu(v) )
             vmx_write_guest_msr(v, MSR_CORE_PERF_GLOBAL_CTRL, msr_content);
         else
             wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, msr_content);
@@ -707,7 +709,7 @@ static int cf_check core2_vpmu_do_rdmsr(unsigned int msr, uint64_t *msr_content)
             *msr_content = core2_vpmu_cxt->global_status;
             break;
         case MSR_CORE_PERF_GLOBAL_CTRL:
-            if ( is_hvm_vcpu(v) )
+            if ( is_vmx_vcpu(v) )
                 vmx_read_guest_msr(v, MSR_CORE_PERF_GLOBAL_CTRL, msr_content);
             else
                 rdmsrl(MSR_CORE_PERF_GLOBAL_CTRL, *msr_content);
@@ -810,7 +812,7 @@ static void cf_check core2_vpmu_destroy(struct vcpu *v)
     vpmu->context = NULL;
     xfree(vpmu->priv_context);
     vpmu->priv_context = NULL;
-    if ( is_hvm_vcpu(v) && cpu_has_vmx_msr_bitmap )
+    if ( is_vmx_vcpu(v) && cpu_has_vmx_msr_bitmap )
         core2_vpmu_unset_msr_bitmap(v);
     release_pmu_ownership(PMU_OWNER_HVM);
     vpmu_clear(vpmu);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 07 17:22:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Aug 2024 17:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773616.1184055 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbkMX-0003Aj-Mv; Wed, 07 Aug 2024 17:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773616.1184055; Wed, 07 Aug 2024 17: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 1sbkMX-0003AX-K1; Wed, 07 Aug 2024 17:22:13 +0000
Received: by outflank-mailman (input) for mailman id 773616;
 Wed, 07 Aug 2024 17:22:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkMV-0003AL-TY
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkMV-0008V1-Sj
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkMV-0003GI-Rn
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cO0qbhXi/yrOmMi4WUnB5wTuhK7hM/2dVdSx1BbfTt0=; b=bvb3lZ7oF7bhk0T4+rWQ04WTu0
	I1i7qUgIP70B2d75YKsD2PLVMf+/qrDKJFbHPIxYtXGZ+SbQTzzOfNWnoDRq/zgYmNqhYF9QVwzDi
	34b6LmZ4lN09OFYCZphXSBoXfyC5qRF4+fAFgwmuHsQcxAS1ZXFk0LVa2CW4leF03o7Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: refactor decode_trap_cause()
Message-Id: <E1sbkMV-0003GI-Rn@xenbits.xenproject.org>
Date: Wed, 07 Aug 2024 17:22:11 +0000

commit 10eccbb821cbd0d623ba3cb68a01dfb79c39ea48
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Aug 6 08:36:29 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 6 08:36:29 2024 +0200

    xen/riscv: refactor decode_trap_cause()
    
    Use array_access_nospec() to prevent guest speculation.
    
    Avoid double access of trap_causes[cause].
    
    Suggested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/traps.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/xen/arch/riscv/traps.c b/xen/arch/riscv/traps.c
index cb18b30ff2..7149504ebc 100644
--- a/xen/arch/riscv/traps.c
+++ b/xen/arch/riscv/traps.c
@@ -6,6 +6,7 @@
  */
 
 #include <xen/lib.h>
+#include <xen/nospec.h>
 #include <xen/sched.h>
 
 #include <asm/processor.h>
@@ -47,9 +48,11 @@ static const char *decode_trap_cause(unsigned long cause)
         [CAUSE_STORE_GUEST_PAGE_FAULT] = "Guest Store/AMO Page Fault",
     };
 
-    if ( cause < ARRAY_SIZE(trap_causes) && trap_causes[cause] )
-        return trap_causes[cause];
-    return "UNKNOWN";
+    const char *res = cause < ARRAY_SIZE(trap_causes)
+                      ? array_access_nospec(trap_causes, cause)
+                      : NULL;
+
+    return res ?: "UNKNOWN";
 }
 
 static const char *decode_reserved_interrupt_cause(unsigned long irq_cause)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 07 17:22:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Aug 2024 17:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773617.1184059 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbkMh-0003Eb-O9; Wed, 07 Aug 2024 17:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773617.1184059; Wed, 07 Aug 2024 17:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbkMh-0003ET-LQ; Wed, 07 Aug 2024 17:22:23 +0000
Received: by outflank-mailman (input) for mailman id 773617;
 Wed, 07 Aug 2024 17:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkMg-0003EJ-1r
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkMg-0008VL-0g
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkMf-0003Gp-Uv
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RrLPYDrSfc29/51N5ZQgmDwjHDH5KkrH0o3eUMUZfA8=; b=NQncTbYO7WR6C/wI22aAeD2CJr
	4D/KkLjcFCPG5YyqhQKeXfMo/SvBZydcdfBcF8uuNXCnMkDFhrZrxF0qNEAbnv/p1PzBpMr6s/OkA
	0FRSV0Dgt9pwA62HeI56PDzBam3SRtYoHZP49kkpeCjGxBN5qhq0lf1eTgUODn8MMwSQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/shutdown: use DMI_MATCH2()
Message-Id: <E1sbkMf-0003Gp-Uv@xenbits.xenproject.org>
Date: Wed, 07 Aug 2024 17:22:21 +0000

commit 44a37c7832e49cdee103a0af392b7c12705bdc25
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Aug 6 08:37:10 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 6 08:37:10 2024 +0200

    x86/shutdown: use DMI_MATCH2()
    
    ... to please Misra C:2012 Rule 9.3 (Arrays shall not be partially
    initialized).
    
    Fixes: d81dd3130351 ("x86/shutdown: change default reboot method preference")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/x86/shutdown.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/shutdown.c b/xen/arch/x86/shutdown.c
index fa60d1638d..902076cf67 100644
--- a/xen/arch/x86/shutdown.c
+++ b/xen/arch/x86/shutdown.c
@@ -498,10 +498,9 @@ static const struct dmi_system_id __initconstrel reboot_dmi_table[] = {
         .callback = override_reboot,
         .driver_data = (void *)(long)BOOT_EFI,
         .ident = "Acer TravelMate X514-51T",
-        .matches = {
+        DMI_MATCH2(
             DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
-            DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate X514-51T"),
-        },
+            DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate X514-51T")),
     },
     { }
 };
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 07 17:22:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Aug 2024 17:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773618.1184062 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbkMr-0003HJ-Pu; Wed, 07 Aug 2024 17:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773618.1184062; Wed, 07 Aug 2024 17:22:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbkMr-0003HC-NV; Wed, 07 Aug 2024 17:22:33 +0000
Received: by outflank-mailman (input) for mailman id 773618;
 Wed, 07 Aug 2024 17:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkMq-0003Gz-5N
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkMq-0008Vm-49
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkMq-0003HU-2s
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sBEZrIOwndANzK8jHYRlEz6BlnqergfPz1jRChhv2g0=; b=UeP+tuVC4/enub+ZzLh3vmUWYH
	VfwjQktl/s88Zki6ITo+9cYD+ehMvTjvTerHW1/Ub00m9aHr65Mf13CjcUP9YDruJAwunm+xTsGox
	m1hrYWv806TxEkHLtzAp06XUgOhxeRkCg3ktz8aIyRgP5SEd/eHU6HoUm913UMeEh/kQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: dom0less: Add #redistributor-regions property to GICv3 node
Message-Id: <E1sbkMq-0003HU-2s@xenbits.xenproject.org>
Date: Wed, 07 Aug 2024 17:22:32 +0000

commit 3679ed232e95f5abdeea1f0792d8e4d1e3e53fe6
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Thu Jul 4 09:54:19 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Aug 6 19:08:50 2024 +0100

    xen/arm: dom0less: Add #redistributor-regions property to GICv3 node
    
    Dom0less domain using host memory layout may use more than one
    re-distributor region (d->arch.vgic.nr_regions > 1). In that case Xen
    will add them in a "reg" property of a GICv3 domU node. Guest needs to
    know how many regions to search for, and therefore the GICv3 dt binding
    [1] specifies that "#redistributor-regions" property is required if more
    than one redistributor region is present. However, Xen does not add this
    property which makes guest believe, there is just one such region. This
    can lead to guest boot failure when doing GIC SMP initialization. Fix it
    by adding this property, which matches what we do for hwdom.
    
    [1] Linux: Documentation/devicetree/bindings/interrupt-controller/arm,gic-v3.yaml
    
    Fixes: 4809f9ec7d71 ("xen/arm: if direct-map domain use native addresses for GICv3")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/dom0less-build.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index f919d3acf9..09b65e44ae 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -176,6 +176,11 @@ static int __init make_gicv3_domU_node(struct kernel_info *kinfo)
     if ( res )
         return res;
 
+    res = fdt_property_cell(fdt, "#redistributor-regions",
+                            d->arch.vgic.nr_regions);
+    if ( res )
+        return res;
+
     /* reg specifies all re-distributors and Distributor. */
     len = (GUEST_ROOT_ADDRESS_CELLS + GUEST_ROOT_SIZE_CELLS) *
           (d->arch.vgic.nr_regions + 1) * sizeof(__be32);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 07 17:22:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Aug 2024 17:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773619.1184069 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbkN1-0003KJ-T4; Wed, 07 Aug 2024 17:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773619.1184069; Wed, 07 Aug 2024 17:22:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbkN1-0003K8-P9; Wed, 07 Aug 2024 17:22:43 +0000
Received: by outflank-mailman (input) for mailman id 773619;
 Wed, 07 Aug 2024 17:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkN0-0003Jw-7e
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkN0-0008Vw-6x
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkN0-0003I3-6F
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JbJmoxDumtAOIWd/dX1QuOeaooBW4LxCksNj3cfP5jc=; b=22Ez7F3haD8dIEZuDAGkeKWAkP
	8AlsfpquOBACVsMzjvLwzJW07zppWFEZrddGmK7huSjqtW9a+nelMWq6tOJMls2tC+d3kK1QUkFh5
	AYDxJDTtsM2cs9w0C/qVNnxp1PlcaNz/zYWuWrOdGhCf6mGJPfz3eWpMbYESxMP60D4A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: bootfdt: Fix device tree memory node probing
Message-Id: <E1sbkN0-0003I3-6F@xenbits.xenproject.org>
Date: Wed, 07 Aug 2024 17:22:42 +0000

commit 47d4d3cdc5e97fa12dd91e1faa863d8bdd96b18f
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Wed Jul 10 13:22:04 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Aug 6 19:09:46 2024 +0100

    xen/arm: bootfdt: Fix device tree memory node probing
    
    Memory node probing is done as part of early_scan_node() that is called
    for each node with depth >= 1 (root node is at depth 0). According to
    Devicetree Specification v0.4, chapter 3.4, /memory node can only exists
    as a top level node. However, Xen incorrectly considers all the nodes with
    unit node name "memory" as RAM. This buggy behavior can result in a
    failure if there are other nodes in the device tree (at depth >= 2) with
    "memory" as unit node name. An example can be a "memory@xxx" node under
    /reserved-memory. Fix it by introducing device_tree_is_memory_node() to
    perform all the required checks to assess if a node is a proper /memory
    node.
    
    Fixes: 3e99c95ba1c8 ("arm, device tree: parse the DTB for RAM location and size")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com>
    Reviewed-by: Julien Grall <julien@xen.org>
---
 xen/arch/arm/bootfdt.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
index 6e060111d9..f2892fce0a 100644
--- a/xen/arch/arm/bootfdt.c
+++ b/xen/arch/arm/bootfdt.c
@@ -83,6 +83,32 @@ static bool __init device_tree_node_compatible(const void *fdt, int node,
     return false;
 }
 
+/*
+ * Check if a node is a proper /memory node according to Devicetree
+ * Specification v0.4, chapter 3.4.
+ */
+static bool __init device_tree_is_memory_node(const void *fdt, int node,
+                                              int depth)
+{
+    const char *type;
+    int len;
+
+    if ( depth != 1 )
+        return false;
+
+    if ( !device_tree_node_matches(fdt, node, "memory") )
+        return false;
+
+    type = fdt_getprop(fdt, node, "device_type", &len);
+    if ( !type )
+        return false;
+
+    if ( (len <= strlen("memory")) || strcmp(type, "memory") )
+        return false;
+
+    return true;
+}
+
 void __init device_tree_get_reg(const __be32 **cell, uint32_t address_cells,
                                 uint32_t size_cells, paddr_t *start,
                                 paddr_t *size)
@@ -448,7 +474,7 @@ static int __init early_scan_node(const void *fdt,
      * populated. So we should skip the parsing.
      */
     if ( !efi_enabled(EFI_BOOT) &&
-         device_tree_node_matches(fdt, node, "memory") )
+         device_tree_is_memory_node(fdt, node, depth) )
         rc = process_memory_node(fdt, node, name, depth,
                                  address_cells, size_cells, bootinfo_get_mem());
     else if ( depth == 1 && !dt_node_cmp(name, "reserved-memory") )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 07 17:22:53 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Aug 2024 17:22:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773620.1184071 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbkNB-0003ND-U3; Wed, 07 Aug 2024 17:22:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773620.1184071; Wed, 07 Aug 2024 17:22:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbkNB-0003N6-Qo; Wed, 07 Aug 2024 17:22:53 +0000
Received: by outflank-mailman (input) for mailman id 773620;
 Wed, 07 Aug 2024 17:22:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkNA-0003Mv-CH
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkNA-0008W3-AF
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkNA-0003IV-9M
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jgkvJUsaecExNAr3giP5lJ+AADcJwWFfb2vHayAn11Y=; b=iJ8t3M7EqGOL8NRQZFDdbQ7MDv
	qPdtsXJfG8fQWpSsgvlct6SAZDyolyZTFat2Bf9+MEuzSLYCsXwvHYN3hIwd6fDMAS5w6QeBDLSZ0
	0AA0gM1vwcxetbsDUVOsLko0ErIaLg7I4I8aL4YsnM4g1aC2HEZ43EAtU/vgKIWmr+A0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/device-tree: Move Arm's setup.c bootinfo functions to common
Message-Id: <E1sbkNA-0003IV-9M@xenbits.xenproject.org>
Date: Wed, 07 Aug 2024 17:22:52 +0000

commit d6c57aa085e7abb1eacf015511f0f40bc2f28d81
Author:     Shawn Anastasio <sanastasio@raptorengineering.com>
AuthorDate: Tue Aug 6 13:41:13 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Aug 6 19:10:56 2024 +0100

    xen/device-tree: Move Arm's setup.c bootinfo functions to common
    
    Arm's setup.c contains a collection of functions for parsing memory map
    and other boot information from a device tree. Since these routines are
    generally useful on any architecture that supports device tree booting,
    move them into xen/common/device-tree.
    
    Also, common/device_tree.c has been moved to the device-tree folder with
    the corresponding updates to common/Makefile and common/device-tree/Makefile.
    
    Mentioning of arm32 is changed to CONFIG_SEPARATE_XENHEAP in comparison with
    original ARM's code as now it is moved in common code.
    
    Suggested-by: Julien Grall <julien@xen.org>
    Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com>
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 MAINTAINERS                          |    3 +-
 xen/arch/arm/include/asm/setup.h     |  185 +--
 xen/arch/arm/setup.c                 |  432 -------
 xen/common/Makefile                  |    2 +-
 xen/common/device-tree/Makefile      |    2 +
 xen/common/device-tree/bootinfo.c    |  459 +++++++
 xen/common/device-tree/device-tree.c | 2253 ++++++++++++++++++++++++++++++++++
 xen/common/device_tree.c             | 2253 ----------------------------------
 xen/include/xen/bootfdt.h            |  195 +++
 9 files changed, 2913 insertions(+), 2871 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 7c524a8a93..89be48fdf9 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -291,9 +291,10 @@ M:	Bertrand Marquis <bertrand.marquis@arm.com>
 M:	Michal Orzel <michal.orzel@amd.com>
 S:	Supported
 F:	xen/common/libfdt/
-F:	xen/common/device_tree.c
+F:	xen/common/device-tree/
 F:	xen/common/dt-overlay.c
 F:	xen/include/xen/libfdt/
+F:	xen/include/xen/bootfdt.h
 F:	xen/include/xen/device_tree.h
 F:	xen/drivers/passthrough/device_tree.c
 
diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/setup.h
index c34179da93..1748be29e5 100644
--- a/xen/arch/arm/include/asm/setup.h
+++ b/xen/arch/arm/include/asm/setup.h
@@ -3,159 +3,11 @@
 
 #include <public/version.h>
 #include <asm/p2m.h>
+#include <xen/bootfdt.h>
 #include <xen/device_tree.h>
 
-#define MIN_FDT_ALIGN 8
 #define MAX_FDT_SIZE SZ_2M
 
-#define NR_MEM_BANKS 256
-#define NR_SHMEM_BANKS 32
-
-#define MAX_MODULES 32 /* Current maximum useful modules */
-
-typedef enum {
-    BOOTMOD_XEN,
-    BOOTMOD_FDT,
-    BOOTMOD_KERNEL,
-    BOOTMOD_RAMDISK,
-    BOOTMOD_XSM,
-    BOOTMOD_GUEST_DTB,
-    BOOTMOD_UNKNOWN
-}  bootmodule_kind;
-
-enum membank_type {
-    /*
-     * The MEMBANK_DEFAULT type refers to either reserved memory for the
-     * device/firmware (when the bank is in 'reserved_mem') or any RAM (when
-     * the bank is in 'mem').
-     */
-    MEMBANK_DEFAULT,
-    /*
-     * The MEMBANK_STATIC_DOMAIN type is used to indicate whether the memory
-     * bank is bound to a static Xen domain. It is only valid when the bank
-     * is in reserved_mem.
-     */
-    MEMBANK_STATIC_DOMAIN,
-    /*
-     * The MEMBANK_STATIC_HEAP type is used to indicate whether the memory
-     * bank is reserved as static heap. It is only valid when the bank is
-     * in reserved_mem.
-     */
-    MEMBANK_STATIC_HEAP,
-    /*
-     * The MEMBANK_FDT_RESVMEM type is used to indicate whether the memory
-     * bank is from the FDT reserve map.
-     */
-    MEMBANK_FDT_RESVMEM,
-};
-
-/* Indicates the maximum number of characters(\0 included) for shm_id */
-#define MAX_SHM_ID_LENGTH 16
-
-struct shmem_membank_extra {
-    char shm_id[MAX_SHM_ID_LENGTH];
-    unsigned int nr_shm_borrowers;
-};
-
-struct membank {
-    paddr_t start;
-    paddr_t size;
-    union {
-        enum membank_type type;
-#ifdef CONFIG_STATIC_SHM
-        struct shmem_membank_extra *shmem_extra;
-#endif
-    };
-};
-
-struct membanks {
-    __struct_group(membanks_hdr, common, ,
-        unsigned int nr_banks;
-        unsigned int max_banks;
-    );
-    struct membank bank[];
-};
-
-struct meminfo {
-    struct membanks_hdr common;
-    struct membank bank[NR_MEM_BANKS];
-};
-
-struct shared_meminfo {
-    struct membanks_hdr common;
-    struct membank bank[NR_SHMEM_BANKS];
-    struct shmem_membank_extra extra[NR_SHMEM_BANKS];
-};
-
-/*
- * The domU flag is set for kernels and ramdisks of "xen,domain" nodes.
- * The purpose of the domU flag is to avoid getting confused in
- * kernel_probe, where we try to guess which is the dom0 kernel and
- * initrd to be compatible with all versions of the multiboot spec. 
- */
-#define BOOTMOD_MAX_CMDLINE 1024
-struct bootmodule {
-    bootmodule_kind kind;
-    bool domU;
-    paddr_t start;
-    paddr_t size;
-};
-
-/* DT_MAX_NAME is the node name max length according the DT spec */
-#define DT_MAX_NAME 41
-struct bootcmdline {
-    bootmodule_kind kind;
-    bool domU;
-    paddr_t start;
-    char dt_name[DT_MAX_NAME];
-    char cmdline[BOOTMOD_MAX_CMDLINE];
-};
-
-struct bootmodules {
-    int nr_mods;
-    struct bootmodule module[MAX_MODULES];
-};
-
-struct bootcmdlines {
-    unsigned int nr_mods;
-    struct bootcmdline cmdline[MAX_MODULES];
-};
-
-struct bootinfo {
-    struct meminfo mem;
-    /* The reserved regions are only used when booting using Device-Tree */
-    struct meminfo reserved_mem;
-    struct bootmodules modules;
-    struct bootcmdlines cmdlines;
-#ifdef CONFIG_ACPI
-    struct meminfo acpi;
-#endif
-#ifdef CONFIG_STATIC_SHM
-    struct shared_meminfo shmem;
-#endif
-    bool static_heap;
-};
-
-#ifdef CONFIG_ACPI
-#define BOOTINFO_ACPI_INIT .acpi.common.max_banks = NR_MEM_BANKS,
-#else
-#define BOOTINFO_ACPI_INIT
-#endif
-
-#ifdef CONFIG_STATIC_SHM
-#define BOOTINFO_SHMEM_INIT .shmem.common.max_banks = NR_SHMEM_BANKS,
-#else
-#define BOOTINFO_SHMEM_INIT
-#endif
-
-#define BOOTINFO_INIT                               \
-{                                                   \
-    .mem.common.max_banks = NR_MEM_BANKS,           \
-    .reserved_mem.common.max_banks = NR_MEM_BANKS,  \
-    BOOTINFO_ACPI_INIT                              \
-    BOOTINFO_SHMEM_INIT                             \
-}
-
 struct map_range_data
 {
     struct domain *d;
@@ -167,39 +19,8 @@ struct map_range_data
     struct rangeset *irq_ranges;
 };
 
-extern struct bootinfo bootinfo;
-
 extern domid_t max_init_domid;
 
-static inline struct membanks *bootinfo_get_mem(void)
-{
-    return container_of(&bootinfo.mem.common, struct membanks, common);
-}
-
-static inline struct membanks *bootinfo_get_reserved_mem(void)
-{
-    return container_of(&bootinfo.reserved_mem.common, struct membanks, common);
-}
-
-#ifdef CONFIG_ACPI
-static inline struct membanks *bootinfo_get_acpi(void)
-{
-    return container_of(&bootinfo.acpi.common, struct membanks, common);
-}
-#endif
-
-#ifdef CONFIG_STATIC_SHM
-static inline struct membanks *bootinfo_get_shmem(void)
-{
-    return container_of(&bootinfo.shmem.common, struct membanks, common);
-}
-
-static inline struct shmem_membank_extra *bootinfo_get_shmem_extra(void)
-{
-    return bootinfo.shmem.extra;
-}
-#endif
-
 void copy_from_paddr(void *dst, paddr_t paddr, unsigned long len);
 
 size_t estimate_efi_size(unsigned int mem_nr_banks);
@@ -220,9 +41,6 @@ void fw_unreserved_regions(paddr_t s, paddr_t e,
                            void (*cb)(paddr_t ps, paddr_t pe),
                            unsigned int first);
 
-size_t boot_fdt_info(const void *fdt, paddr_t paddr);
-const char *boot_fdt_cmdline(const void *fdt);
-
 bool check_reserved_regions_overlap(paddr_t region_start, paddr_t region_size);
 
 struct bootmodule *add_boot_module(bootmodule_kind kind,
@@ -237,7 +55,6 @@ struct bootcmdline * boot_cmdline_find_by_name(const char *name);
 const char *boot_module_kind_as_string(bootmodule_kind kind);
 
 void init_pdx(void);
-void populate_boot_allocator(void);
 void setup_mm(void);
 
 extern uint32_t hyp_traps_vector[];
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 0c2fdaceaf..cb2c0a16b8 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -48,8 +48,6 @@
 #include <xsm/xsm.h>
 #include <asm/acpi.h>
 
-struct bootinfo __initdata bootinfo = BOOTINFO_INIT;
-
 /*
  * Sanitized version of cpuinfo containing only features available on all
  * cores (only on arm64 as there is no sanitization support on arm32).
@@ -203,321 +201,6 @@ static void __init processor_id(void)
     processor_setup();
 }
 
-static void __init dt_unreserved_regions(paddr_t s, paddr_t e,
-                                         void (*cb)(paddr_t ps, paddr_t pe),
-                                         unsigned int first)
-{
-    const struct membanks *reserved_mem = bootinfo_get_reserved_mem();
-#ifdef CONFIG_STATIC_SHM
-    const struct membanks *shmem = bootinfo_get_shmem();
-    unsigned int offset;
-#endif
-    unsigned int i;
-
-    /*
-     * i is the current bootmodule we are evaluating across all possible
-     * kinds.
-     */
-    for ( i = first; i < reserved_mem->nr_banks; i++ )
-    {
-        paddr_t r_s = reserved_mem->bank[i].start;
-        paddr_t r_e = r_s + reserved_mem->bank[i].size;
-
-        if ( s < r_e && r_s < e )
-        {
-            dt_unreserved_regions(r_e, e, cb, i + 1);
-            dt_unreserved_regions(s, r_s, cb, i + 1);
-            return;
-        }
-    }
-
-#ifdef CONFIG_STATIC_SHM
-    /*
-     * When retrieving the corresponding shared memory addresses
-     * below, we need to index the shmem->bank starting from 0, hence
-     * we need to use i - reserved_mem->nr_banks.
-    */
-    offset = reserved_mem->nr_banks;
-    for ( ; i - offset < shmem->nr_banks; i++ )
-    {
-        paddr_t r_s, r_e;
-
-        r_s = shmem->bank[i - offset].start;
-
-        /* Shared memory banks can contain INVALID_PADDR as start */
-        if ( INVALID_PADDR == r_s )
-            continue;
-
-        r_e = r_s + shmem->bank[i - offset].size;
-
-        if ( s < r_e && r_s < e )
-        {
-            dt_unreserved_regions(r_e, e, cb, i + 1);
-            dt_unreserved_regions(s, r_s, cb, i + 1);
-            return;
-        }
-    }
-#endif
-
-    cb(s, e);
-}
-
-/*
- * TODO: '*_end' could be 0 if the bank/region is at the end of the physical
- * address space. This is for now not handled as it requires more rework.
- */
-static bool __init meminfo_overlap_check(const struct membanks *mem,
-                                         paddr_t region_start,
-                                         paddr_t region_size)
-{
-    paddr_t bank_start = INVALID_PADDR, bank_end = 0;
-    paddr_t region_end = region_start + region_size;
-    unsigned int i, bank_num = mem->nr_banks;
-
-    for ( i = 0; i < bank_num; i++ )
-    {
-        bank_start = mem->bank[i].start;
-        bank_end = bank_start + mem->bank[i].size;
-
-        if ( INVALID_PADDR == bank_start || region_end <= bank_start ||
-             region_start >= bank_end )
-            continue;
-        else
-        {
-            printk("Region: [%#"PRIpaddr", %#"PRIpaddr") overlapping with bank[%u]: [%#"PRIpaddr", %#"PRIpaddr")\n",
-                   region_start, region_end, i, bank_start, bank_end);
-            return true;
-        }
-    }
-
-    return false;
-}
-
-/*
- * TODO: '*_end' could be 0 if the module/region is at the end of the physical
- * address space. This is for now not handled as it requires more rework.
- */
-static bool __init bootmodules_overlap_check(struct bootmodules *bootmodules,
-                                             paddr_t region_start,
-                                             paddr_t region_size)
-{
-    paddr_t mod_start = INVALID_PADDR, mod_end = 0;
-    paddr_t region_end = region_start + region_size;
-    unsigned int i, mod_num = bootmodules->nr_mods;
-
-    for ( i = 0; i < mod_num; i++ )
-    {
-        mod_start = bootmodules->module[i].start;
-        mod_end = mod_start + bootmodules->module[i].size;
-
-        if ( region_end <= mod_start || region_start >= mod_end )
-            continue;
-        else
-        {
-            printk("Region: [%#"PRIpaddr", %#"PRIpaddr") overlapping with mod[%u]: [%#"PRIpaddr", %#"PRIpaddr")\n",
-                   region_start, region_end, i, mod_start, mod_end);
-            return true;
-        }
-    }
-
-    return false;
-}
-
-void __init fw_unreserved_regions(paddr_t s, paddr_t e,
-                                  void (*cb)(paddr_t ps, paddr_t pe),
-                                  unsigned int first)
-{
-    if ( acpi_disabled )
-        dt_unreserved_regions(s, e, cb, first);
-    else
-        cb(s, e);
-}
-
-/*
- * Given an input physical address range, check if this range is overlapping
- * with the existing reserved memory regions defined in bootinfo.
- * Return true if the input physical address range is overlapping with any
- * existing reserved memory regions, otherwise false.
- */
-bool __init check_reserved_regions_overlap(paddr_t region_start,
-                                           paddr_t region_size)
-{
-    const struct membanks *mem_banks[] = {
-        bootinfo_get_reserved_mem(),
-#ifdef CONFIG_ACPI
-        bootinfo_get_acpi(),
-#endif
-#ifdef CONFIG_STATIC_SHM
-        bootinfo_get_shmem(),
-#endif
-    };
-    unsigned int i;
-
-    /*
-     * Check if input region is overlapping with reserved memory banks or
-     * ACPI EfiACPIReclaimMemory (when ACPI feature is enabled) or static
-     * shared memory banks (when static shared memory feature is enabled)
-     */
-    for ( i = 0; i < ARRAY_SIZE(mem_banks); i++ )
-        if ( meminfo_overlap_check(mem_banks[i], region_start, region_size) )
-            return true;
-
-    /* Check if input region is overlapping with bootmodules */
-    if ( bootmodules_overlap_check(&bootinfo.modules,
-                                   region_start, region_size) )
-        return true;
-
-    return false;
-}
-
-struct bootmodule __init *add_boot_module(bootmodule_kind kind,
-                                          paddr_t start, paddr_t size,
-                                          bool domU)
-{
-    struct bootmodules *mods = &bootinfo.modules;
-    struct bootmodule *mod;
-    unsigned int i;
-
-    if ( mods->nr_mods == MAX_MODULES )
-    {
-        printk("Ignoring %s boot module at %"PRIpaddr"-%"PRIpaddr" (too many)\n",
-               boot_module_kind_as_string(kind), start, start + size);
-        return NULL;
-    }
-
-    if ( check_reserved_regions_overlap(start, size) )
-        return NULL;
-
-    for ( i = 0 ; i < mods->nr_mods ; i++ )
-    {
-        mod = &mods->module[i];
-        if ( mod->kind == kind && mod->start == start )
-        {
-            if ( !domU )
-                mod->domU = false;
-            return mod;
-        }
-    }
-
-    mod = &mods->module[mods->nr_mods++];
-    mod->kind = kind;
-    mod->start = start;
-    mod->size = size;
-    mod->domU = domU;
-
-    return mod;
-}
-
-/*
- * boot_module_find_by_kind can only be used to return Xen modules (e.g
- * XSM, DTB) or Dom0 modules. This is not suitable for looking up guest
- * modules.
- */
-struct bootmodule * __init boot_module_find_by_kind(bootmodule_kind kind)
-{
-    struct bootmodules *mods = &bootinfo.modules;
-    struct bootmodule *mod;
-    int i;
-    for (i = 0 ; i < mods->nr_mods ; i++ )
-    {
-        mod = &mods->module[i];
-        if ( mod->kind == kind && !mod->domU )
-            return mod;
-    }
-    return NULL;
-}
-
-void __init add_boot_cmdline(const char *name, const char *cmdline,
-                             bootmodule_kind kind, paddr_t start, bool domU)
-{
-    struct bootcmdlines *cmds = &bootinfo.cmdlines;
-    struct bootcmdline *cmd;
-
-    if ( cmds->nr_mods == MAX_MODULES )
-    {
-        printk("Ignoring %s cmdline (too many)\n", name);
-        return;
-    }
-
-    cmd = &cmds->cmdline[cmds->nr_mods++];
-    cmd->kind = kind;
-    cmd->domU = domU;
-    cmd->start = start;
-
-    ASSERT(strlen(name) <= DT_MAX_NAME);
-    safe_strcpy(cmd->dt_name, name);
-
-    if ( strlen(cmdline) > BOOTMOD_MAX_CMDLINE )
-        panic("module %s command line too long\n", name);
-    safe_strcpy(cmd->cmdline, cmdline);
-}
-
-/*
- * boot_cmdline_find_by_kind can only be used to return Xen modules (e.g
- * XSM, DTB) or Dom0 modules. This is not suitable for looking up guest
- * modules.
- */
-struct bootcmdline * __init boot_cmdline_find_by_kind(bootmodule_kind kind)
-{
-    struct bootcmdlines *cmds = &bootinfo.cmdlines;
-    struct bootcmdline *cmd;
-    int i;
-
-    for ( i = 0 ; i < cmds->nr_mods ; i++ )
-    {
-        cmd = &cmds->cmdline[i];
-        if ( cmd->kind == kind && !cmd->domU )
-            return cmd;
-    }
-    return NULL;
-}
-
-struct bootcmdline * __init boot_cmdline_find_by_name(const char *name)
-{
-    struct bootcmdlines *mods = &bootinfo.cmdlines;
-    struct bootcmdline *mod;
-    unsigned int i;
-
-    for (i = 0 ; i < mods->nr_mods ; i++ )
-    {
-        mod = &mods->cmdline[i];
-        if ( strcmp(mod->dt_name, name) == 0 )
-            return mod;
-    }
-    return NULL;
-}
-
-struct bootmodule * __init boot_module_find_by_addr_and_kind(bootmodule_kind kind,
-                                                             paddr_t start)
-{
-    struct bootmodules *mods = &bootinfo.modules;
-    struct bootmodule *mod;
-    unsigned int i;
-
-    for (i = 0 ; i < mods->nr_mods ; i++ )
-    {
-        mod = &mods->module[i];
-        if ( mod->kind == kind && mod->start == start )
-            return mod;
-    }
-    return NULL;
-}
-
-const char * __init boot_module_kind_as_string(bootmodule_kind kind)
-{
-    switch ( kind )
-    {
-    case BOOTMOD_XEN:     return "Xen";
-    case BOOTMOD_FDT:     return "Device Tree";
-    case BOOTMOD_KERNEL:  return "Kernel";
-    case BOOTMOD_RAMDISK: return "Ramdisk";
-    case BOOTMOD_XSM:     return "XSM";
-    case BOOTMOD_GUEST_DTB:     return "DTB";
-    case BOOTMOD_UNKNOWN: return "Unknown";
-    default: BUG();
-    }
-}
-
 void __init discard_initial_modules(void)
 {
     struct bootmodules *mi = &bootinfo.modules;
@@ -556,40 +239,6 @@ static void * __init relocate_fdt(paddr_t dtb_paddr, size_t dtb_size)
     return fdt;
 }
 
-/*
- * Return the end of the non-module region starting at s. In other
- * words return s the start of the next modules after s.
- *
- * On input *end is the end of the region which should be considered
- * and it is updated to reflect the end of the module, clipped to the
- * end of the region if it would run over.
- */
-static paddr_t __init next_module(paddr_t s, paddr_t *end)
-{
-    struct bootmodules *mi = &bootinfo.modules;
-    paddr_t lowest = ~(paddr_t)0;
-    int i;
-
-    for ( i = 0; i < mi->nr_mods; i++ )
-    {
-        paddr_t mod_s = mi->module[i].start;
-        paddr_t mod_e = mod_s + mi->module[i].size;
-
-        if ( !mi->module[i].size )
-            continue;
-
-        if ( mod_s < s )
-            continue;
-        if ( mod_s > lowest )
-            continue;
-        if ( mod_s > *end )
-            continue;
-        lowest = mod_s;
-        *end = min(*end, mod_e);
-    }
-    return lowest;
-}
-
 void __init init_pdx(void)
 {
     const struct membanks *mem = bootinfo_get_mem();
@@ -635,87 +284,6 @@ void __init init_pdx(void)
     }
 }
 
-/*
- * Populate the boot allocator.
- * If a static heap was not provided by the admin, all the RAM but the
- * following regions will be added:
- *  - Modules (e.g., Xen, Kernel)
- *  - Reserved regions
- *  - Xenheap (arm32 only)
- * If a static heap was provided by the admin, populate the boot
- * allocator with the corresponding regions only, but with Xenheap excluded
- * on arm32.
- */
-void __init populate_boot_allocator(void)
-{
-    unsigned int i;
-    const struct membanks *banks = bootinfo_get_mem();
-    const struct membanks *reserved_mem = bootinfo_get_reserved_mem();
-    paddr_t s, e;
-
-    if ( bootinfo.static_heap )
-    {
-        for ( i = 0 ; i < reserved_mem->nr_banks; i++ )
-        {
-            if ( reserved_mem->bank[i].type != MEMBANK_STATIC_HEAP )
-                continue;
-
-            s = reserved_mem->bank[i].start;
-            e = s + reserved_mem->bank[i].size;
-#ifdef CONFIG_ARM_32
-            /* Avoid the xenheap, note that the xenheap cannot across a bank */
-            if ( s <= mfn_to_maddr(directmap_mfn_start) &&
-                 e >= mfn_to_maddr(directmap_mfn_end) )
-            {
-                init_boot_pages(s, mfn_to_maddr(directmap_mfn_start));
-                init_boot_pages(mfn_to_maddr(directmap_mfn_end), e);
-            }
-            else
-#endif
-                init_boot_pages(s, e);
-        }
-
-        return;
-    }
-
-    for ( i = 0; i < banks->nr_banks; i++ )
-    {
-        const struct membank *bank = &banks->bank[i];
-        paddr_t bank_end = bank->start + bank->size;
-
-        s = bank->start;
-        while ( s < bank_end )
-        {
-            paddr_t n = bank_end;
-
-            e = next_module(s, &n);
-
-            if ( e == ~(paddr_t)0 )
-                e = n = bank_end;
-
-            /*
-             * Module in a RAM bank other than the one which we are
-             * not dealing with here.
-             */
-            if ( e > bank_end )
-                e = bank_end;
-
-#ifdef CONFIG_ARM_32
-            /* Avoid the xenheap */
-            if ( s < mfn_to_maddr(directmap_mfn_end) &&
-                 mfn_to_maddr(directmap_mfn_start) < e )
-            {
-                e = mfn_to_maddr(directmap_mfn_start);
-                n = mfn_to_maddr(directmap_mfn_end);
-            }
-#endif
-
-            fw_unreserved_regions(s, e, init_boot_pages, 0);
-            s = n;
-        }
-    }
-}
-
 size_t __read_mostly dcache_line_bytes;
 
 /* C entry point for boot CPU */
diff --git a/xen/common/Makefile b/xen/common/Makefile
index f12a474d40..7e66802a9e 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -6,7 +6,7 @@ obj-$(CONFIG_HYPFS_CONFIG) += config_data.o
 obj-$(CONFIG_CORE_PARKING) += core_parking.o
 obj-y += cpu.o
 obj-$(CONFIG_DEBUG_TRACE) += debugtrace.o
-obj-$(CONFIG_HAS_DEVICE_TREE) += device_tree.o
+obj-$(CONFIG_HAS_DEVICE_TREE) += device-tree/
 obj-$(CONFIG_IOREQ_SERVER) += dm.o
 obj-y += domain.o
 obj-$(CONFIG_OVERLAY_DTB) += dt-overlay.o
diff --git a/xen/common/device-tree/Makefile b/xen/common/device-tree/Makefile
new file mode 100644
index 0000000000..f813f7555f
--- /dev/null
+++ b/xen/common/device-tree/Makefile
@@ -0,0 +1,2 @@
+obj-y += bootinfo.init.o
+obj-y += device-tree.o
diff --git a/xen/common/device-tree/bootinfo.c b/xen/common/device-tree/bootinfo.c
new file mode 100644
index 0000000000..f2e6a1145b
--- /dev/null
+++ b/xen/common/device-tree/bootinfo.c
@@ -0,0 +1,459 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Derived from Xen 4.19's $xen/arch/arm/setup.c.
+ *
+ * bookkeeping routines.
+ *
+ * Tim Deegan <tim@xen.org>
+ * Copyright (c) 2011 Citrix Systems.
+ * Copyright (c) 2024 Raptor Engineering LLC
+ */
+
+#include <xen/acpi.h>
+#include <xen/bootfdt.h>
+#include <xen/bug.h>
+#include <xen/device_tree.h>
+#include <xen/init.h>
+#include <xen/libfdt/libfdt-xen.h>
+#include <xen/mm.h>
+
+struct bootinfo __initdata bootinfo = BOOTINFO_INIT;
+
+const char * __init boot_module_kind_as_string(bootmodule_kind kind)
+{
+    switch ( kind )
+    {
+    case BOOTMOD_XEN:     return "Xen";
+    case BOOTMOD_FDT:     return "Device Tree";
+    case BOOTMOD_KERNEL:  return "Kernel";
+    case BOOTMOD_RAMDISK: return "Ramdisk";
+    case BOOTMOD_XSM:     return "XSM";
+    case BOOTMOD_GUEST_DTB:     return "DTB";
+    case BOOTMOD_UNKNOWN: return "Unknown";
+    default: BUG();
+    }
+}
+
+static void __init dt_unreserved_regions(paddr_t s, paddr_t e,
+                                         void (*cb)(paddr_t ps, paddr_t pe),
+                                         unsigned int first)
+{
+    const struct membanks *reserved_mem = bootinfo_get_reserved_mem();
+#ifdef CONFIG_STATIC_SHM
+    const struct membanks *shmem = bootinfo_get_shmem();
+    unsigned int offset;
+#endif
+    unsigned int i;
+
+    /*
+     * i is the current bootmodule we are evaluating across all possible
+     * kinds.
+     */
+    for ( i = first; i < reserved_mem->nr_banks; i++ )
+    {
+        paddr_t r_s = reserved_mem->bank[i].start;
+        paddr_t r_e = r_s + reserved_mem->bank[i].size;
+
+        if ( s < r_e && r_s < e )
+        {
+            dt_unreserved_regions(r_e, e, cb, i + 1);
+            dt_unreserved_regions(s, r_s, cb, i + 1);
+            return;
+        }
+    }
+
+#ifdef CONFIG_STATIC_SHM
+    /*
+     * When retrieving the corresponding shared memory addresses
+     * below, we need to index the shmem->bank starting from 0, hence
+     * we need to use i - reserved_mem->nr_banks.
+    */
+    offset = reserved_mem->nr_banks;
+    for ( ; i - offset < shmem->nr_banks; i++ )
+    {
+        paddr_t r_s, r_e;
+
+        r_s = shmem->bank[i - offset].start;
+
+        /* Shared memory banks can contain INVALID_PADDR as start */
+        if ( INVALID_PADDR == r_s )
+            continue;
+
+        r_e = r_s + shmem->bank[i - offset].size;
+
+        if ( s < r_e && r_s < e )
+        {
+            dt_unreserved_regions(r_e, e, cb, i + 1);
+            dt_unreserved_regions(s, r_s, cb, i + 1);
+            return;
+        }
+    }
+#endif
+
+    cb(s, e);
+}
+
+/*
+ * TODO: '*_end' could be 0 if the bank/region is at the end of the physical
+ * address space. This is for now not handled as it requires more rework.
+ */
+static bool __init meminfo_overlap_check(const struct membanks *mem,
+                                         paddr_t region_start,
+                                         paddr_t region_size)
+{
+    paddr_t bank_start = INVALID_PADDR, bank_end = 0;
+    paddr_t region_end = region_start + region_size;
+    unsigned int i, bank_num = mem->nr_banks;
+
+    for ( i = 0; i < bank_num; i++ )
+    {
+        bank_start = mem->bank[i].start;
+        bank_end = bank_start + mem->bank[i].size;
+
+        if ( INVALID_PADDR == bank_start || region_end <= bank_start ||
+             region_start >= bank_end )
+            continue;
+        else
+        {
+            printk("Region: [%#"PRIpaddr", %#"PRIpaddr") overlapping with bank[%u]: [%#"PRIpaddr", %#"PRIpaddr")\n",
+                   region_start, region_end, i, bank_start, bank_end);
+            return true;
+        }
+    }
+
+    return false;
+}
+
+/*
+ * TODO: '*_end' could be 0 if the module/region is at the end of the physical
+ * address space. This is for now not handled as it requires more rework.
+ */
+static bool __init bootmodules_overlap_check(struct bootmodules *bootmodules,
+                                             paddr_t region_start,
+                                             paddr_t region_size)
+{
+    paddr_t mod_start = INVALID_PADDR, mod_end = 0;
+    paddr_t region_end = region_start + region_size;
+    unsigned int i, mod_num = bootmodules->nr_mods;
+
+    for ( i = 0; i < mod_num; i++ )
+    {
+        mod_start = bootmodules->module[i].start;
+        mod_end = mod_start + bootmodules->module[i].size;
+
+        if ( region_end <= mod_start || region_start >= mod_end )
+            continue;
+        else
+        {
+            printk("Region: [%#"PRIpaddr", %#"PRIpaddr") overlapping with mod[%u]: [%#"PRIpaddr", %#"PRIpaddr")\n",
+                   region_start, region_end, i, mod_start, mod_end);
+            return true;
+        }
+    }
+
+    return false;
+}
+
+void __init fw_unreserved_regions(paddr_t s, paddr_t e,
+                                  void (*cb)(paddr_t ps, paddr_t pe),
+                                  unsigned int first)
+{
+    if ( acpi_disabled )
+        dt_unreserved_regions(s, e, cb, first);
+    else
+        cb(s, e);
+}
+
+/*
+ * Given an input physical address range, check if this range is overlapping
+ * with the existing reserved memory regions defined in bootinfo.
+ * Return true if the input physical address range is overlapping with any
+ * existing reserved memory regions, otherwise false.
+ */
+bool __init check_reserved_regions_overlap(paddr_t region_start,
+                                           paddr_t region_size)
+{
+    const struct membanks *mem_banks[] = {
+        bootinfo_get_reserved_mem(),
+#ifdef CONFIG_ACPI
+        bootinfo_get_acpi(),
+#endif
+#ifdef CONFIG_STATIC_SHM
+        bootinfo_get_shmem(),
+#endif
+    };
+    unsigned int i;
+
+    /*
+     * Check if input region is overlapping with reserved memory banks or
+     * ACPI EfiACPIReclaimMemory (when ACPI feature is enabled) or static
+     * shared memory banks (when static shared memory feature is enabled)
+     */
+    for ( i = 0; i < ARRAY_SIZE(mem_banks); i++ )
+        if ( meminfo_overlap_check(mem_banks[i], region_start, region_size) )
+            return true;
+
+    /* Check if input region is overlapping with bootmodules */
+    if ( bootmodules_overlap_check(&bootinfo.modules,
+                                   region_start, region_size) )
+        return true;
+
+    return false;
+}
+
+struct bootmodule __init *add_boot_module(bootmodule_kind kind,
+                                          paddr_t start, paddr_t size,
+                                          bool domU)
+{
+    struct bootmodules *mods = &bootinfo.modules;
+    struct bootmodule *mod;
+    unsigned int i;
+
+    if ( mods->nr_mods == MAX_MODULES )
+    {
+        printk("Ignoring %s boot module at %"PRIpaddr"-%"PRIpaddr" (too many)\n",
+               boot_module_kind_as_string(kind), start, start + size);
+        return NULL;
+    }
+
+    if ( check_reserved_regions_overlap(start, size) )
+        return NULL;
+
+    for ( i = 0 ; i < mods->nr_mods ; i++ )
+    {
+        mod = &mods->module[i];
+        if ( mod->kind == kind && mod->start == start )
+        {
+            if ( !domU )
+                mod->domU = false;
+            return mod;
+        }
+    }
+
+    mod = &mods->module[mods->nr_mods++];
+    mod->kind = kind;
+    mod->start = start;
+    mod->size = size;
+    mod->domU = domU;
+
+    return mod;
+}
+
+/*
+ * boot_module_find_by_kind can only be used to return Xen modules (e.g
+ * XSM, DTB) or Dom0 modules. This is not suitable for looking up guest
+ * modules.
+ */
+struct bootmodule * __init boot_module_find_by_kind(bootmodule_kind kind)
+{
+    struct bootmodules *mods = &bootinfo.modules;
+    struct bootmodule *mod;
+    int i;
+    for (i = 0 ; i < mods->nr_mods ; i++ )
+    {
+        mod = &mods->module[i];
+        if ( mod->kind == kind && !mod->domU )
+            return mod;
+    }
+    return NULL;
+}
+
+void __init add_boot_cmdline(const char *name, const char *cmdline,
+                             bootmodule_kind kind, paddr_t start, bool domU)
+{
+    struct bootcmdlines *cmds = &bootinfo.cmdlines;
+    struct bootcmdline *cmd;
+
+    if ( cmds->nr_mods == MAX_MODULES )
+    {
+        printk("Ignoring %s cmdline (too many)\n", name);
+        return;
+    }
+
+    cmd = &cmds->cmdline[cmds->nr_mods++];
+    cmd->kind = kind;
+    cmd->domU = domU;
+    cmd->start = start;
+
+    ASSERT(strlen(name) <= DT_MAX_NAME);
+    safe_strcpy(cmd->dt_name, name);
+
+    if ( strlen(cmdline) > BOOTMOD_MAX_CMDLINE )
+        panic("module %s command line too long\n", name);
+    safe_strcpy(cmd->cmdline, cmdline);
+}
+
+/*
+ * boot_cmdline_find_by_kind can only be used to return Xen modules (e.g
+ * XSM, DTB) or Dom0 modules. This is not suitable for looking up guest
+ * modules.
+ */
+struct bootcmdline * __init boot_cmdline_find_by_kind(bootmodule_kind kind)
+{
+    struct bootcmdlines *cmds = &bootinfo.cmdlines;
+    struct bootcmdline *cmd;
+    int i;
+
+    for ( i = 0 ; i < cmds->nr_mods ; i++ )
+    {
+        cmd = &cmds->cmdline[i];
+        if ( cmd->kind == kind && !cmd->domU )
+            return cmd;
+    }
+    return NULL;
+}
+
+struct bootcmdline * __init boot_cmdline_find_by_name(const char *name)
+{
+    struct bootcmdlines *mods = &bootinfo.cmdlines;
+    struct bootcmdline *mod;
+    unsigned int i;
+
+    for (i = 0 ; i < mods->nr_mods ; i++ )
+    {
+        mod = &mods->cmdline[i];
+        if ( strcmp(mod->dt_name, name) == 0 )
+            return mod;
+    }
+    return NULL;
+}
+
+struct bootmodule * __init boot_module_find_by_addr_and_kind(bootmodule_kind kind,
+                                                             paddr_t start)
+{
+    struct bootmodules *mods = &bootinfo.modules;
+    struct bootmodule *mod;
+    unsigned int i;
+
+    for (i = 0 ; i < mods->nr_mods ; i++ )
+    {
+        mod = &mods->module[i];
+        if ( mod->kind == kind && mod->start == start )
+            return mod;
+    }
+    return NULL;
+}
+
+/*
+ * Return the end of the non-module region starting at s. In other
+ * words return s the start of the next modules after s.
+ *
+ * On input *end is the end of the region which should be considered
+ * and it is updated to reflect the end of the module, clipped to the
+ * end of the region if it would run over.
+ */
+static paddr_t __init next_module(paddr_t s, paddr_t *end)
+{
+    struct bootmodules *mi = &bootinfo.modules;
+    paddr_t lowest = ~(paddr_t)0;
+    int i;
+
+    for ( i = 0; i < mi->nr_mods; i++ )
+    {
+        paddr_t mod_s = mi->module[i].start;
+        paddr_t mod_e = mod_s + mi->module[i].size;
+
+        if ( !mi->module[i].size )
+            continue;
+
+        if ( mod_s < s )
+            continue;
+        if ( mod_s > lowest )
+            continue;
+        if ( mod_s > *end )
+            continue;
+        lowest = mod_s;
+        *end = min(*end, mod_e);
+    }
+    return lowest;
+}
+
+/*
+ * Populate the boot allocator.
+ * If a static heap was not provided by the admin, all the RAM but the
+ * following regions will be added:
+ *  - Modules (e.g., Xen, Kernel)
+ *  - Reserved regions
+ *  - Xenheap (CONFIG_SEPARATE_XENHEAP only)
+ * If a static heap was provided by the admin, populate the boot
+ * allocator with the corresponding regions only, but with Xenheap excluded
+ * on CONFIG_SEPARATE_XENHEAP.
+ */
+void __init populate_boot_allocator(void)
+{
+    unsigned int i;
+    const struct membanks *banks = bootinfo_get_mem();
+    const struct membanks *reserved_mem = bootinfo_get_reserved_mem();
+    paddr_t s, e;
+
+    if ( bootinfo.static_heap )
+    {
+        for ( i = 0 ; i < reserved_mem->nr_banks; i++ )
+        {
+            if ( reserved_mem->bank[i].type != MEMBANK_STATIC_HEAP )
+                continue;
+
+            s = reserved_mem->bank[i].start;
+            e = s + reserved_mem->bank[i].size;
+#ifdef CONFIG_SEPARATE_XENHEAP
+            /* Avoid the xenheap, note that the xenheap cannot across a bank */
+            if ( s <= mfn_to_maddr(directmap_mfn_start) &&
+                 e >= mfn_to_maddr(directmap_mfn_end) )
+            {
+                init_boot_pages(s, mfn_to_maddr(directmap_mfn_start));
+                init_boot_pages(mfn_to_maddr(directmap_mfn_end), e);
+            }
+            else
+#endif
+                init_boot_pages(s, e);
+        }
+
+        return;
+    }
+
+    for ( i = 0; i < banks->nr_banks; i++ )
+    {
+        const struct membank *bank = &banks->bank[i];
+        paddr_t bank_end = bank->start + bank->size;
+
+        s = bank->start;
+        while ( s < bank_end )
+        {
+            paddr_t n = bank_end;
+
+            e = next_module(s, &n);
+
+            if ( e == ~(paddr_t)0 )
+                e = n = bank_end;
+
+            /*
+             * Module in a RAM bank other than the one which we are
+             * not dealing with here.
+             */
+            if ( e > bank_end )
+                e = bank_end;
+
+#ifdef CONFIG_SEPARATE_XENHEAP
+            /* Avoid the xenheap */
+            if ( s < mfn_to_maddr(directmap_mfn_end) &&
+                 mfn_to_maddr(directmap_mfn_start) < e )
+            {
+                e = mfn_to_maddr(directmap_mfn_start);
+                n = mfn_to_maddr(directmap_mfn_end);
+            }
+#endif
+
+            fw_unreserved_regions(s, e, init_boot_pages, 0);
+            s = n;
+        }
+    }
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/common/device-tree/device-tree.c b/xen/common/device-tree/device-tree.c
new file mode 100644
index 0000000000..8d1017a49d
--- /dev/null
+++ b/xen/common/device-tree/device-tree.c
@@ -0,0 +1,2253 @@
+/*
+ * Device Tree
+ *
+ * Copyright (C) 2012 Citrix Systems, Inc.
+ * Copyright 2009 Benjamin Herrenschmidt, IBM Corp
+ * benh@kernel.crashing.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <xen/types.h>
+#include <xen/init.h>
+#include <xen/guest_access.h>
+#include <xen/device_tree.h>
+#include <xen/kernel.h>
+#include <xen/lib.h>
+#include <xen/libfdt/libfdt.h>
+#include <xen/mm.h>
+#include <xen/stdarg.h>
+#include <xen/string.h>
+#include <xen/cpumask.h>
+#include <xen/ctype.h>
+#include <asm/setup.h>
+#include <xen/err.h>
+
+const void *device_tree_flattened;
+dt_irq_xlate_func dt_irq_xlate;
+/* Host device tree */
+struct dt_device_node *dt_host;
+/* Interrupt controller node*/
+const struct dt_device_node *dt_interrupt_controller;
+DEFINE_RWLOCK(dt_host_lock);
+
+/**
+ * struct dt_alias_prop - Alias property in 'aliases' node
+ * @link: List node to link the structure in aliases_lookup list
+ * @alias: Alias property name
+ * @np: Pointer to device_node that the alias stands for
+ * @id: Index value from end of alias name
+ * @stem: Alias string without the index
+ *
+ * The structure represents one alias property of 'aliases' node as
+ * an entry in aliases_lookup list.
+ */
+struct dt_alias_prop {
+    struct list_head link;
+    const char *alias;
+    struct dt_device_node *np;
+    int id;
+    char stem[0];
+};
+
+static LIST_HEAD(aliases_lookup);
+
+#ifdef CONFIG_DEVICE_TREE_DEBUG
+static void dt_dump_addr(const char *s, const __be32 *addr, int na)
+{
+    dt_dprintk("%s", s);
+    while ( na-- )
+        dt_dprintk(" %08x", be32_to_cpu(*(addr++)));
+    dt_dprintk("\n");
+}
+#else
+static void dt_dump_addr(const char *s, const __be32 *addr, int na) { }
+#endif
+
+#define DT_BAD_ADDR ((u64)-1)
+
+/* Max address size we deal with */
+#define DT_MAX_ADDR_CELLS 4
+#define DT_CHECK_ADDR_COUNT(na) ((na) > 0 && (na) <= DT_MAX_ADDR_CELLS)
+#define DT_CHECK_COUNTS(na, ns) (DT_CHECK_ADDR_COUNT(na) && (ns) > 0)
+
+/* Callbacks for bus specific translators */
+struct dt_bus
+{
+    const char *name;
+    const char *addresses;
+    bool (*match)(const struct dt_device_node *node);
+    void (*count_cells)(const struct dt_device_node *child,
+                        int *addrc, int *sizec);
+    u64 (*map)(__be32 *addr, const __be32 *range, int na, int ns, int pna);
+    int (*translate)(__be32 *addr, u64 offset, int na);
+    unsigned int (*get_flags)(const __be32 *addr);
+};
+
+void dt_get_range(const __be32 **cellp, const struct dt_device_node *np,
+                  u64 *address, u64 *size)
+{
+    *address = dt_next_cell(dt_n_addr_cells(np), cellp);
+    *size = dt_next_cell(dt_n_size_cells(np), cellp);
+}
+
+void dt_set_cell(__be32 **cellp, int size, u64 val)
+{
+    int cells = size;
+
+    while ( size-- )
+    {
+        (*cellp)[size] = cpu_to_fdt32(val);
+        val >>= 32;
+    }
+
+    (*cellp) += cells;
+}
+
+void dt_set_range(__be32 **cellp, const struct dt_device_node *np,
+                  u64 address, u64 size)
+{
+    dt_set_cell(cellp, dt_n_addr_cells(np), address);
+    dt_set_cell(cellp, dt_n_size_cells(np), size);
+}
+
+void dt_child_set_range(__be32 **cellp, int addrcells, int sizecells,
+                        u64 address, u64 size)
+{
+    dt_set_cell(cellp, addrcells, address);
+    dt_set_cell(cellp, sizecells, size);
+}
+
+static void __init *unflatten_dt_alloc(unsigned long *mem, unsigned long size,
+                                       unsigned long align)
+{
+    void *res;
+
+    *mem = ROUNDUP(*mem, align);
+    res = (void *)*mem;
+    *mem += size;
+
+    return res;
+}
+
+/* Find a property with a given name for a given node and return it. */
+const struct dt_property *dt_find_property(const struct dt_device_node *np,
+                                           const char *name, u32 *lenp)
+{
+    const struct dt_property *pp;
+
+    if ( !np )
+        return NULL;
+
+    for ( pp = np->properties; pp; pp = pp->next )
+    {
+        if ( dt_prop_cmp(pp->name, name) == 0 )
+        {
+            if ( lenp )
+                *lenp = pp->length;
+            break;
+        }
+    }
+
+    return pp;
+}
+
+const void *dt_get_property(const struct dt_device_node *np,
+                            const char *name, u32 *lenp)
+{
+    const struct dt_property *pp = dt_find_property(np, name, lenp);
+
+    return pp ? pp->value : NULL;
+}
+
+bool dt_property_read_u32(const struct dt_device_node *np,
+                          const char *name, u32 *out_value)
+{
+    u32 len;
+    const __be32 *val;
+
+    val = dt_get_property(np, name, &len);
+    if ( !val || len < sizeof(*out_value) )
+        return 0;
+
+    *out_value = be32_to_cpup(val);
+
+    return 1;
+}
+
+
+bool dt_property_read_u64(const struct dt_device_node *np,
+                          const char *name, u64 *out_value)
+{
+    u32 len;
+    const __be32 *val;
+
+    val = dt_get_property(np, name, &len);
+    if ( !val || len < sizeof(*out_value) )
+        return 0;
+
+    *out_value = dt_read_number(val, 2);
+
+    return 1;
+}
+int dt_property_read_string(const struct dt_device_node *np,
+                            const char *propname, const char **out_string)
+{
+    const struct dt_property *pp = dt_find_property(np, propname, NULL);
+
+    if ( !pp )
+        return -EINVAL;
+    if ( !pp->length )
+        return -ENODATA;
+    if ( strnlen(pp->value, pp->length) >= pp->length )
+        return -EILSEQ;
+
+    *out_string = pp->value;
+
+    return 0;
+}
+
+/**
+ * dt_find_property_value_of_size
+ *
+ * @np:     device node from which the property value is to be read.
+ * @propname:   name of the property to be searched.
+ * @min:    minimum allowed length of property value
+ * @max:    maximum allowed length of property value (0 means unlimited)
+ * @len:    if !=NULL, actual length is written to here
+ *
+ * Search for a property in a device node and valid the requested size.
+ *
+ * Return: The property value on success, -EINVAL if the property does not
+ * exist, -ENODATA if property does not have a value, and -EOVERFLOW if the
+ * property data is too small or too large.
+ */
+static void *dt_find_property_value_of_size(const struct dt_device_node *np,
+                                            const char *propname, u32 min,
+                                            u32 max, size_t *len)
+{
+    const struct dt_property *prop = dt_find_property(np, propname, NULL);
+
+    if ( !prop )
+        return ERR_PTR(-EINVAL);
+    if ( !prop->value )
+        return ERR_PTR(-ENODATA);
+    if ( prop->length < min )
+        return ERR_PTR(-EOVERFLOW);
+    if ( max && prop->length > max )
+        return ERR_PTR(-EOVERFLOW);
+
+    if ( len )
+        *len = prop->length;
+
+    return prop->value;
+}
+
+int dt_property_read_variable_u32_array(const struct dt_device_node *np,
+                                        const char *propname, u32 *out_values,
+                                        size_t sz_min, size_t sz_max)
+{
+    size_t sz, count;
+    const __be32 *val = dt_find_property_value_of_size(np, propname,
+                        (sz_min * sizeof(*out_values)),
+                        (sz_max * sizeof(*out_values)),
+                        &sz);
+
+    if ( IS_ERR(val) )
+        return PTR_ERR(val);
+
+    if ( !sz_max )
+        sz = sz_min;
+    else
+        sz /= sizeof(*out_values);
+
+    count = sz;
+    while ( count-- )
+        *out_values++ = be32_to_cpup(val++);
+
+    return sz;
+}
+
+int dt_property_match_string(const struct dt_device_node *np,
+                             const char *propname, const char *string)
+{
+    const struct dt_property *dtprop = dt_find_property(np, propname, NULL);
+    size_t l;
+    int i;
+    const char *p, *end;
+
+    if ( !dtprop )
+        return -EINVAL;
+    if ( !dtprop->value )
+        return -ENODATA;
+
+    p = dtprop->value;
+    end = p + dtprop->length;
+
+    for ( i = 0; p < end; i++, p += l )
+    {
+        l = strnlen(p, end - p) + 1;
+        if ( p + l > end )
+            return -EILSEQ;
+        if ( strcmp(string, p) == 0 )
+            return i; /* Found it; return index */
+    }
+    return -ENODATA;
+}
+
+bool dt_device_is_compatible(const struct dt_device_node *device,
+                             const char *compat)
+{
+    const char* cp;
+    u32 cplen, l;
+
+    cp = dt_get_property(device, "compatible", &cplen);
+    if ( cp == NULL )
+        return 0;
+    while ( cplen > 0 )
+    {
+        if ( dt_compat_cmp(cp, compat) == 0 )
+            return 1;
+        l = strlen(cp) + 1;
+        cp += l;
+        cplen -= l;
+    }
+
+    return 0;
+}
+
+bool dt_machine_is_compatible(const char *compat)
+{
+    const struct dt_device_node *root;
+    bool rc = false;
+
+    root = dt_find_node_by_path("/");
+    if ( root )
+    {
+        rc = dt_device_is_compatible(root, compat);
+    }
+    return rc;
+}
+
+struct dt_device_node *dt_find_node_by_name(struct dt_device_node *from,
+                                            const char *name)
+{
+    struct dt_device_node *np;
+    struct dt_device_node *dt;
+
+    dt = from ? from->allnext : dt_host;
+    dt_for_each_device_node(dt, np)
+        if ( np->name && (dt_node_cmp(np->name, name) == 0) )
+            break;
+
+    return np;
+}
+
+struct dt_device_node *dt_find_node_by_type(struct dt_device_node *from,
+                                            const char *type)
+{
+    struct dt_device_node *np;
+    struct dt_device_node *dt;
+
+    dt = from ? from->allnext : dt_host;
+    dt_for_each_device_node(dt, np)
+        if ( np->type && (dt_node_cmp(np->type, type) == 0) )
+            break;
+
+    return np;
+}
+
+struct dt_device_node *dt_find_node_by_path_from(struct dt_device_node *from,
+                                                 const char *path)
+{
+    struct dt_device_node *np;
+
+    dt_for_each_device_node(from, np)
+        if ( np->full_name && (dt_node_cmp(np->full_name, path) == 0) )
+            break;
+
+    return np;
+}
+
+int dt_find_node_by_gpath(XEN_GUEST_HANDLE(char) u_path, uint32_t u_plen,
+                          struct dt_device_node **node)
+{
+    char *path;
+
+    path = safe_copy_string_from_guest(u_path, u_plen, PAGE_SIZE);
+    if ( IS_ERR(path) )
+        return PTR_ERR(path);
+
+    *node = dt_find_node_by_path(path);
+
+    xfree(path);
+
+    return (*node == NULL) ? -ESRCH : 0;
+}
+
+struct dt_device_node *dt_find_node_by_alias(const char *alias)
+{
+    const struct dt_alias_prop *app;
+
+    list_for_each_entry( app, &aliases_lookup, link )
+    {
+        if ( !strcmp(app->alias, alias) )
+            return app->np;
+    }
+
+    return NULL;
+}
+
+const struct dt_device_match *
+dt_match_node(const struct dt_device_match *matches,
+              const struct dt_device_node *node)
+{
+    if ( !matches )
+        return NULL;
+
+    while ( matches->path || matches->type ||
+            matches->compatible || matches->not_available || matches->prop )
+    {
+        bool match = true;
+
+        if ( matches->path )
+            match &= dt_node_path_is_equal(node, matches->path);
+
+        if ( matches->type )
+            match &= dt_device_type_is_equal(node, matches->type);
+
+        if ( matches->compatible )
+            match &= dt_device_is_compatible(node, matches->compatible);
+
+        if ( matches->not_available )
+            match &= !dt_device_is_available(node);
+
+        if ( matches->prop )
+            match &= dt_find_property(node, matches->prop, NULL) != NULL;
+
+        if ( match )
+            return matches;
+        matches++;
+    }
+
+    return NULL;
+}
+
+const struct dt_device_node *dt_get_parent(const struct dt_device_node *node)
+{
+    if ( !node )
+        return NULL;
+
+    return node->parent;
+}
+
+struct dt_device_node *
+dt_find_compatible_node(struct dt_device_node *from,
+                        const char *type,
+                        const char *compatible)
+{
+    struct dt_device_node *np;
+    struct dt_device_node *dt;
+
+    dt = from ? from->allnext : dt_host;
+    dt_for_each_device_node(dt, np)
+    {
+        if ( type
+             && !(np->type && (dt_node_cmp(np->type, type) == 0)) )
+            continue;
+        if ( dt_device_is_compatible(np, compatible) )
+            break;
+    }
+
+    return np;
+}
+
+struct dt_device_node *
+dt_find_matching_node(struct dt_device_node *from,
+                      const struct dt_device_match *matches)
+{
+    struct dt_device_node *np;
+    struct dt_device_node *dt;
+
+    dt = from ? from->allnext : dt_host;
+    dt_for_each_device_node(dt, np)
+    {
+        if ( dt_match_node(matches, np) )
+            return np;
+    }
+
+    return NULL;
+}
+
+static int __dt_n_addr_cells(const struct dt_device_node *np, bool parent)
+{
+    const __be32 *ip;
+
+    do {
+        if ( np->parent && !parent )
+            np = np->parent;
+        parent = false;
+
+        ip = dt_get_property(np, "#address-cells", NULL);
+        if ( ip )
+            return be32_to_cpup(ip);
+    } while ( np->parent );
+    /* No #address-cells property for the root node */
+    return DT_ROOT_NODE_ADDR_CELLS_DEFAULT;
+}
+
+static int __dt_n_size_cells(const struct dt_device_node *np, bool parent)
+{
+    const __be32 *ip;
+
+    do {
+        if ( np->parent && !parent )
+            np = np->parent;
+        parent = false;
+
+        ip = dt_get_property(np, "#size-cells", NULL);
+        if ( ip )
+            return be32_to_cpup(ip);
+    } while ( np->parent );
+    /* No #address-cells property for the root node */
+    return DT_ROOT_NODE_SIZE_CELLS_DEFAULT;
+}
+
+int dt_n_addr_cells(const struct dt_device_node *np)
+{
+    return __dt_n_addr_cells(np, false);
+}
+
+int dt_n_size_cells(const struct dt_device_node *np)
+{
+    return __dt_n_size_cells(np, false);
+}
+
+int dt_child_n_addr_cells(const struct dt_device_node *parent)
+{
+    return __dt_n_addr_cells(parent, true);
+}
+
+int dt_child_n_size_cells(const struct dt_device_node *parent)
+{
+    return __dt_n_size_cells(parent, true);
+}
+
+/*
+ * These are defined in Linux where much of this code comes from, but
+ * are currently unused outside this file in the context of Xen.
+ */
+#define IORESOURCE_BITS         0x000000ff      /* Bus-specific bits */
+
+#define IORESOURCE_TYPE_BITS    0x00001f00      /* Resource type */
+#define IORESOURCE_IO           0x00000100      /* PCI/ISA I/O ports */
+#define IORESOURCE_MEM          0x00000200
+#define IORESOURCE_REG          0x00000300      /* Register offsets */
+#define IORESOURCE_IRQ          0x00000400
+#define IORESOURCE_DMA          0x00000800
+#define IORESOURCE_BUS          0x00001000
+
+#define IORESOURCE_PREFETCH     0x00002000      /* No side effects */
+#define IORESOURCE_READONLY     0x00004000
+#define IORESOURCE_CACHEABLE    0x00008000
+#define IORESOURCE_RANGELENGTH  0x00010000
+#define IORESOURCE_SHADOWABLE   0x00020000
+
+/*
+ * Default translator (generic bus)
+ */
+static bool dt_bus_default_match(const struct dt_device_node *node)
+{
+    /* Root node doesn't have "ranges" property */
+    if ( node->parent == NULL )
+        return 1;
+
+    /* The default bus is only used when the "ranges" property exists.
+     * Otherwise we can't translate the address
+     */
+    return (dt_get_property(node, "ranges", NULL) != NULL);
+}
+
+static void dt_bus_default_count_cells(const struct dt_device_node *dev,
+                                int *addrc, int *sizec)
+{
+    if ( addrc )
+        *addrc = dt_n_addr_cells(dev);
+    if ( sizec )
+        *sizec = dt_n_size_cells(dev);
+}
+
+static u64 dt_bus_default_map(__be32 *addr, const __be32 *range,
+                              int na, int ns, int pna)
+{
+    u64 cp, s, da;
+
+    cp = dt_read_number(range, na);
+    s = dt_read_number(range + na + pna, ns);
+    da = dt_read_number(addr, na);
+
+    dt_dprintk("DT: default map, cp=%llx, s=%llx, da=%llx\n",
+               (unsigned long long)cp, (unsigned long long)s,
+               (unsigned long long)da);
+
+    /*
+     * If the number of address cells is larger than 2 we assume the
+     * mapping doesn't specify a physical address. Rather, the address
+     * specifies an identifier that must match exactly.
+     */
+    if ( na > 2 && memcmp(range, addr, na * 4) != 0 )
+        return DT_BAD_ADDR;
+
+    if ( da < cp || da >= (cp + s) )
+        return DT_BAD_ADDR;
+    return da - cp;
+}
+
+static int dt_bus_default_translate(__be32 *addr, u64 offset, int na)
+{
+    u64 a = dt_read_number(addr, na);
+
+    memset(addr, 0, na * 4);
+    a += offset;
+    if ( na > 1 )
+        addr[na - 2] = cpu_to_be32(a >> 32);
+    addr[na - 1] = cpu_to_be32(a & 0xffffffffu);
+
+    return 0;
+}
+static unsigned int dt_bus_default_get_flags(const __be32 *addr)
+{
+    return IORESOURCE_MEM;
+}
+
+/*
+ * PCI bus specific translator
+ */
+
+static bool dt_node_is_pci(const struct dt_device_node *np)
+{
+    bool is_pci = !strcmp(np->name, "pcie") || !strcmp(np->name, "pci");
+
+    if ( is_pci )
+        printk(XENLOG_WARNING "%s: Missing device_type\n", np->full_name);
+
+    return is_pci;
+}
+
+static bool dt_bus_pci_match(const struct dt_device_node *np)
+{
+    /*
+     * "pciex" is PCI Express "vci" is for the /chaos bridge on 1st-gen PCI
+     * powermacs "ht" is hypertransport
+     *
+     * If none of the device_type match, and that the node name is
+     * "pcie" or "pci", accept the device as PCI (with a warning).
+     */
+    return !strcmp(np->type, "pci") || !strcmp(np->type, "pciex") ||
+        !strcmp(np->type, "vci") || !strcmp(np->type, "ht") ||
+        dt_node_is_pci(np);
+}
+
+static void dt_bus_pci_count_cells(const struct dt_device_node *np,
+				   int *addrc, int *sizec)
+{
+    if (addrc)
+        *addrc = 3;
+    if (sizec)
+        *sizec = 2;
+}
+
+static unsigned int dt_bus_pci_get_flags(const __be32 *addr)
+{
+    unsigned int flags = 0;
+    u32 w = be32_to_cpup(addr);
+
+    switch((w >> 24) & 0x03) {
+    case 0x01:
+        flags |= IORESOURCE_IO;
+        break;
+    case 0x02: /* 32 bits */
+    case 0x03: /* 64 bits */
+        flags |= IORESOURCE_MEM;
+        break;
+    }
+    if (w & 0x40000000)
+        flags |= IORESOURCE_PREFETCH;
+    return flags;
+}
+
+static u64 dt_bus_pci_map(__be32 *addr, const __be32 *range, int na, int ns,
+		int pna)
+{
+    u64 cp, s, da;
+    unsigned int af, rf;
+
+    af = dt_bus_pci_get_flags(addr);
+    rf = dt_bus_pci_get_flags(range);
+
+    /* Check address type match */
+    if ((af ^ rf) & (IORESOURCE_MEM | IORESOURCE_IO))
+        return DT_BAD_ADDR;
+
+    /* Read address values, skipping high cell */
+    cp = dt_read_number(range + 1, na - 1);
+    s  = dt_read_number(range + na + pna, ns);
+    da = dt_read_number(addr + 1, na - 1);
+
+    dt_dprintk("DT: PCI map, cp=%llx, s=%llx, da=%llx\n",
+               (unsigned long long)cp, (unsigned long long)s,
+               (unsigned long long)da);
+
+    if (da < cp || da >= (cp + s))
+        return DT_BAD_ADDR;
+    return da - cp;
+}
+
+static int dt_bus_pci_translate(__be32 *addr, u64 offset, int na)
+{
+    return dt_bus_default_translate(addr + 1, offset, na - 1);
+}
+
+/*
+ * Array of bus specific translators
+ */
+static const struct dt_bus dt_busses[] =
+{
+    /* PCI */
+    {
+        .name = "pci",
+        .addresses = "assigned-addresses",
+        .match = dt_bus_pci_match,
+        .count_cells = dt_bus_pci_count_cells,
+        .map = dt_bus_pci_map,
+        .translate = dt_bus_pci_translate,
+        .get_flags = dt_bus_pci_get_flags,
+    },
+    /* Default */
+    {
+        .name = "default",
+        .addresses = "reg",
+        .match = dt_bus_default_match,
+        .count_cells = dt_bus_default_count_cells,
+        .map = dt_bus_default_map,
+        .translate = dt_bus_default_translate,
+        .get_flags = dt_bus_default_get_flags,
+    },
+};
+
+static const struct dt_bus *dt_match_bus(const struct dt_device_node *np)
+{
+    int i;
+
+    for ( i = 0; i < ARRAY_SIZE(dt_busses); i++ )
+        if ( !dt_busses[i].match || dt_busses[i].match(np) )
+            return &dt_busses[i];
+
+    return NULL;
+}
+
+static const __be32 *dt_get_address(const struct dt_device_node *dev,
+                                    unsigned int index, u64 *size,
+                                    unsigned int *flags)
+{
+    const __be32 *prop;
+    u32 psize;
+    const struct dt_device_node *parent;
+    const struct dt_bus *bus;
+    int onesize, i, na, ns;
+
+    /* Get parent & match bus type */
+    parent = dt_get_parent(dev);
+    if ( parent == NULL )
+        return NULL;
+
+    bus = dt_match_bus(parent);
+    if ( !bus )
+        return NULL;
+    bus->count_cells(dev, &na, &ns);
+
+    if ( !DT_CHECK_ADDR_COUNT(na) )
+        return NULL;
+
+    /* Get "reg" or "assigned-addresses" property */
+    prop = dt_get_property(dev, bus->addresses, &psize);
+    if ( prop == NULL )
+        return NULL;
+    psize /= 4;
+
+    onesize = na + ns;
+    for ( i = 0; psize >= onesize; psize -= onesize, prop += onesize, i++ )
+    {
+        if ( i == index )
+        {
+            if ( size )
+                *size = dt_read_number(prop + na, ns);
+            if ( flags )
+                *flags = bus->get_flags(prop);
+            return prop;
+        }
+    }
+    return NULL;
+}
+
+static int dt_translate_one(const struct dt_device_node *parent,
+                            const struct dt_bus *bus,
+                            const struct dt_bus *pbus,
+                            __be32 *addr, int na, int ns,
+                            int pna, const char *rprop)
+{
+    const __be32 *ranges;
+    unsigned int rlen;
+    int rone;
+    u64 offset = DT_BAD_ADDR;
+
+    ranges = dt_get_property(parent, rprop, &rlen);
+    if ( ranges == NULL )
+    {
+        printk(XENLOG_ERR "DT: no ranges; cannot translate\n");
+        return 1;
+    }
+    if ( rlen == 0 )
+    {
+        offset = dt_read_number(addr, na);
+        memset(addr, 0, pna * 4);
+        dt_dprintk("DT: empty ranges; 1:1 translation\n");
+        goto finish;
+    }
+
+    dt_dprintk("DT: walking ranges...\n");
+
+    /* Now walk through the ranges */
+    rlen /= 4;
+    rone = na + pna + ns;
+    for ( ; rlen >= rone; rlen -= rone, ranges += rone )
+    {
+        offset = bus->map(addr, ranges, na, ns, pna);
+        if ( offset != DT_BAD_ADDR )
+            break;
+    }
+    if ( offset == DT_BAD_ADDR )
+    {
+        dt_dprintk("DT: not found !\n");
+        return 1;
+    }
+    memcpy(addr, ranges + na, 4 * pna);
+
+finish:
+    dt_dump_addr("DT: parent translation for:", addr, pna);
+    dt_dprintk("DT: with offset: %llx\n", (unsigned long long)offset);
+
+    /* Translate it into parent bus space */
+    return pbus->translate(addr, offset, pna);
+}
+
+/*
+ * Translate an address from the device-tree into a CPU physical address,
+ * this walks up the tree and applies the various bus mappings on the
+ * way.
+ *
+ * Note: We consider that crossing any level with #size-cells == 0 to mean
+ * that translation is impossible (that is we are not dealing with a value
+ * that can be mapped to a cpu physical address). This is not really specified
+ * that way, but this is traditionally the way IBM at least do things
+ */
+static u64 __dt_translate_address(const struct dt_device_node *dev,
+                                  const __be32 *in_addr, const char *rprop)
+{
+    const struct dt_device_node *parent = NULL;
+    const struct dt_bus *bus, *pbus;
+    __be32 addr[DT_MAX_ADDR_CELLS];
+    int na, ns, pna, pns;
+    u64 result = DT_BAD_ADDR;
+
+    dt_dprintk("DT: ** translation for device %s **\n", dev->full_name);
+
+    /* Get parent & match bus type */
+    parent = dt_get_parent(dev);
+    if ( parent == NULL )
+        goto bail;
+    bus = dt_match_bus(parent);
+    if ( !bus )
+        goto bail;
+
+    /* Count address cells & copy address locally */
+    bus->count_cells(dev, &na, &ns);
+    if ( !DT_CHECK_COUNTS(na, ns) )
+    {
+        printk(XENLOG_ERR "dt_parse: Bad cell count for device %s\n",
+                  dev->full_name);
+        goto bail;
+    }
+    memcpy(addr, in_addr, na * 4);
+
+    dt_dprintk("DT: bus is %s (na=%d, ns=%d) on %s\n",
+               bus->name, na, ns, parent->full_name);
+    dt_dump_addr("DT: translating address:", addr, na);
+
+    /* Translate */
+    for ( ;; )
+    {
+        /* Switch to parent bus */
+        dev = parent;
+        parent = dt_get_parent(dev);
+
+        /* If root, we have finished */
+        if ( parent == NULL )
+        {
+            dt_dprintk("DT: reached root node\n");
+            result = dt_read_number(addr, na);
+            break;
+        }
+
+        /* Get new parent bus and counts */
+        pbus = dt_match_bus(parent);
+        if ( pbus == NULL )
+        {
+            printk("DT: %s is not a valid bus\n", parent->full_name);
+            break;
+        }
+        pbus->count_cells(dev, &pna, &pns);
+        if ( !DT_CHECK_COUNTS(pna, pns) )
+        {
+            printk(XENLOG_ERR "dt_parse: Bad cell count for parent %s\n",
+                   dev->full_name);
+            break;
+        }
+
+        dt_dprintk("DT: parent bus is %s (na=%d, ns=%d) on %s\n",
+                   pbus->name, pna, pns, parent->full_name);
+
+        /* Apply bus translation */
+        if ( dt_translate_one(dev, bus, pbus, addr, na, ns, pna, rprop) )
+            break;
+
+        /* Complete the move up one level */
+        na = pna;
+        ns = pns;
+        bus = pbus;
+
+        dt_dump_addr("DT: one level translation:", addr, na);
+    }
+
+bail:
+    return result;
+}
+
+/* dt_device_address - Translate device tree address and return it */
+int dt_device_get_address(const struct dt_device_node *dev, unsigned int index,
+                          u64 *addr, u64 *size)
+{
+    const __be32 *addrp;
+    unsigned int flags;
+
+    addrp = dt_get_address(dev, index, size, &flags);
+    if ( addrp == NULL )
+        return -EINVAL;
+
+    if ( !addr )
+        return -EINVAL;
+
+    *addr = __dt_translate_address(dev, addrp, "ranges");
+
+    if ( *addr == DT_BAD_ADDR )
+        return -EINVAL;
+
+    return 0;
+}
+
+int dt_device_get_paddr(const struct dt_device_node *dev, unsigned int index,
+                        paddr_t *addr, paddr_t *size)
+{
+    uint64_t dt_addr, dt_size;
+    int ret;
+
+    ret = dt_device_get_address(dev, index, &dt_addr, &dt_size);
+    if ( ret )
+        return ret;
+
+    if ( !addr )
+        return -EINVAL;
+
+    if ( dt_addr != (paddr_t)dt_addr )
+    {
+        printk("Error: Physical address 0x%"PRIx64" for node=%s is greater than max width (%zu bytes) supported\n",
+               dt_addr, dev->name, sizeof(paddr_t));
+        return -ERANGE;
+    }
+
+    *addr = dt_addr;
+
+    if ( size )
+    {
+        if ( dt_size != (paddr_t)dt_size )
+        {
+            printk("Error: Physical size 0x%"PRIx64" for node=%s is greater than max width (%zu bytes) supported\n",
+                   dt_size, dev->name, sizeof(paddr_t));
+            return -ERANGE;
+        }
+
+        *size = dt_size;
+    }
+
+    return ret;
+}
+
+int dt_for_each_range(const struct dt_device_node *dev,
+                      int (*cb)(const struct dt_device_node *dev,
+                                uint64_t addr, uint64_t length,
+                                void *data),
+                      void *data)
+{
+    const struct dt_device_node *parent = NULL;
+    const struct dt_bus *bus, *pbus;
+    const __be32 *ranges;
+    __be32 addr[DT_MAX_ADDR_CELLS];
+    unsigned int rlen;
+    int na, ns, pna, pns, rone;
+
+    bus = dt_match_bus(dev);
+    if ( !bus )
+        return 0; /* device is not a bus */
+
+    parent = dt_get_parent(dev);
+    if ( parent == NULL )
+        return -EINVAL;
+
+    ranges = dt_get_property(dev, "ranges", &rlen);
+    if ( ranges == NULL )
+    {
+        printk(XENLOG_ERR "DT: no ranges; cannot enumerate %s\n",
+               dev->full_name);
+        return -EINVAL;
+    }
+    if ( rlen == 0 ) /* Nothing to do */
+        return 0;
+
+    bus->count_cells(dev, &na, &ns);
+    if ( !DT_CHECK_COUNTS(na, ns) )
+    {
+        printk(XENLOG_ERR "dt_parse: Bad cell count for device %s\n",
+                  dev->full_name);
+        return -EINVAL;
+    }
+
+    pbus = dt_match_bus(parent);
+    if ( pbus == NULL )
+    {
+        printk("DT: %s is not a valid bus\n", parent->full_name);
+        return -EINVAL;
+    }
+
+    pbus->count_cells(dev, &pna, &pns);
+    if ( !DT_CHECK_COUNTS(pna, pns) )
+    {
+        printk(XENLOG_ERR "dt_parse: Bad cell count for parent %s\n",
+               dev->full_name);
+        return -EINVAL;
+    }
+
+    /* Now walk through the ranges */
+    rlen /= 4;
+    rone = na + pna + ns;
+
+    dt_dprintk("%s: dev=%s, bus=%s, parent=%s, rlen=%d, rone=%d\n",
+               __func__,
+               dt_node_name(dev), bus->name,
+               dt_node_name(parent), rlen, rone);
+
+    for ( ; rlen >= rone; rlen -= rone, ranges += rone )
+    {
+        uint64_t a, s;
+        int ret;
+
+        memcpy(addr, ranges + na, 4 * pna);
+
+        a = __dt_translate_address(dev, addr, "ranges");
+        s = dt_read_number(ranges + na + pna, ns);
+
+        ret = cb(dev, a, s, data);
+        if ( ret )
+        {
+            dt_dprintk(" -> callback failed=%d\n", ret);
+            return ret;
+        }
+
+    }
+
+    return 0;
+}
+
+/**
+ * dt_find_node_by_phandle - Find a node given a phandle
+ * @handle: phandle of the node to find
+ *
+ * Returns a node pointer.
+ */
+struct dt_device_node *dt_find_node_by_phandle(dt_phandle handle)
+{
+    struct dt_device_node *np;
+
+    dt_for_each_device_node(dt_host, np)
+        if ( np->phandle == handle )
+            break;
+
+    return np;
+}
+
+/**
+ * dt_irq_find_parent - Given a device node, find its interrupt parent node
+ * @child: pointer to device node
+ *
+ * Returns a pointer to the interrupt parent node, or NULL if the interrupt
+ * parent could not be determined.
+ */
+static const struct dt_device_node *
+dt_irq_find_parent(const struct dt_device_node *child)
+{
+    const struct dt_device_node *p;
+    const __be32 *parp;
+
+    do
+    {
+        parp = dt_get_property(child, "interrupt-parent", NULL);
+        if ( parp == NULL )
+            p = dt_get_parent(child);
+        else
+            p = dt_find_node_by_phandle(be32_to_cpup(parp));
+        child = p;
+    } while ( p && dt_get_property(p, "#interrupt-cells", NULL) == NULL );
+
+    return p;
+}
+
+unsigned int dt_number_of_irq(const struct dt_device_node *device)
+{
+    const struct dt_device_node *p;
+    const __be32 *intspec, *tmp;
+    u32 intsize, intlen;
+    int intnum;
+
+    dt_dprintk("dt_irq_number: dev=%s\n", device->full_name);
+
+    /* Try the new-style interrupts-extended first */
+    intnum = dt_count_phandle_with_args(device, "interrupts-extended",
+                                        "#interrupt-cells");
+    if ( intnum >= 0 )
+    {
+        dt_dprintk(" using 'interrupts-extended' property\n");
+        dt_dprintk(" intnum=%d\n", intnum);
+        return intnum;
+    }
+
+    /* Get the interrupts property */
+    intspec = dt_get_property(device, "interrupts", &intlen);
+    if ( intspec == NULL )
+        return 0;
+    intlen /= sizeof(*intspec);
+
+    dt_dprintk(" using 'interrupts' property\n");
+    dt_dprintk(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen);
+
+    /* Look for the interrupt parent. */
+    p = dt_irq_find_parent(device);
+    if ( p == NULL )
+        return 0;
+
+    /* Get size of interrupt specifier */
+    tmp = dt_get_property(p, "#interrupt-cells", NULL);
+    if ( tmp == NULL )
+        return 0;
+    intsize = be32_to_cpu(*tmp);
+
+    dt_dprintk(" intsize=%d intlen=%d\n", intsize, intlen);
+
+    return (intlen / intsize);
+}
+
+unsigned int dt_number_of_address(const struct dt_device_node *dev)
+{
+    const __be32 *prop;
+    u32 psize;
+    const struct dt_device_node *parent;
+    const struct dt_bus *bus;
+    int onesize, na, ns;
+
+    /* Get parent & match bus type */
+    parent = dt_get_parent(dev);
+    if ( parent == NULL )
+        return 0;
+
+    bus = dt_match_bus(parent);
+    if ( !bus )
+        return 0;
+    bus->count_cells(dev, &na, &ns);
+
+    if ( !DT_CHECK_COUNTS(na, ns) )
+        return 0;
+
+    /* Get "reg" or "assigned-addresses" property */
+    prop = dt_get_property(dev, bus->addresses, &psize);
+    if ( prop == NULL )
+        return 0;
+
+    psize /= 4;
+    onesize = na + ns;
+
+    return (psize / onesize);
+}
+
+int dt_for_each_irq_map(const struct dt_device_node *dev,
+                        int (*cb)(const struct dt_device_node *dev,
+                                  const struct dt_irq *dt_irq,
+                                  void *data),
+                        void *data)
+{
+    const struct dt_device_node *ipar, *tnode, *old = NULL;
+    const __be32 *tmp, *imap;
+    u32 intsize = 1, addrsize, pintsize = 0, paddrsize = 0;
+    u32 imaplen;
+    int i, ret;
+
+    struct dt_raw_irq dt_raw_irq;
+    struct dt_irq dt_irq;
+
+    dt_dprintk("%s: par=%s cb=%p data=%p\n", __func__,
+               dev->full_name, cb, data);
+
+    ipar = dev;
+
+    /* First get the #interrupt-cells property of the current cursor
+     * that tells us how to interpret the passed-in intspec. If there
+     * is none, we are nice and just walk up the tree
+     */
+    do {
+        tmp = dt_get_property(ipar, "#interrupt-cells", NULL);
+        if ( tmp != NULL )
+        {
+            intsize = be32_to_cpu(*tmp);
+            break;
+        }
+        tnode = ipar;
+        ipar = dt_irq_find_parent(ipar);
+    } while ( ipar );
+    if ( ipar == NULL )
+    {
+        dt_dprintk(" -> no parent found !\n");
+        goto fail;
+    }
+
+    dt_dprintk("%s: ipar=%s, size=%d\n", __func__, ipar->full_name, intsize);
+
+    if ( intsize > DT_MAX_IRQ_SPEC )
+    {
+        dt_dprintk(" -> too many irq specifier cells\n");
+        goto fail;
+    }
+
+    /* Look for this #address-cells. We have to implement the old linux
+     * trick of looking for the parent here as some device-trees rely on it
+     */
+    old = ipar;
+    do {
+        tmp = dt_get_property(old, "#address-cells", NULL);
+        tnode = dt_get_parent(old);
+        old = tnode;
+    } while ( old && tmp == NULL );
+
+    old = NULL;
+    addrsize = (tmp == NULL) ? 2 : be32_to_cpu(*tmp);
+
+    dt_dprintk(" -> addrsize=%d\n", addrsize);
+
+    /* Now look for an interrupt-map */
+    imap = dt_get_property(dev, "interrupt-map", &imaplen);
+    /* No interrupt-map found. Ignore */
+    if ( imap == NULL )
+    {
+        dt_dprintk(" -> no map, ignoring\n");
+        return 0;
+    }
+    imaplen /= sizeof(u32);
+
+    /* Parse interrupt-map */
+    while ( imaplen > (addrsize + intsize + 1) )
+    {
+        /* skip child unit address and child interrupt specifier */
+        imap += addrsize + intsize;
+        imaplen -= addrsize + intsize;
+
+        /* Get the interrupt parent */
+        ipar = dt_find_node_by_phandle(be32_to_cpup(imap));
+        imap++;
+        --imaplen;
+
+        /* Check if not found */
+        if ( ipar == NULL )
+        {
+            dt_dprintk(" -> imap parent not found !\n");
+            goto fail;
+        }
+
+        dt_dprintk(" -> ipar %s\n", dt_node_name(ipar));
+
+        /* Get #interrupt-cells and #address-cells of new
+         * parent
+         */
+        tmp = dt_get_property(ipar, "#interrupt-cells", NULL);
+        if ( tmp == NULL )
+        {
+            dt_dprintk(" -> parent lacks #interrupt-cells!\n");
+            goto fail;
+        }
+        pintsize = be32_to_cpu(*tmp);
+        tmp = dt_get_property(ipar, "#address-cells", NULL);
+        paddrsize = (tmp == NULL) ? 0 : be32_to_cpu(*tmp);
+
+        dt_dprintk(" -> pintsize=%d, paddrsize=%d\n",
+                   pintsize, paddrsize);
+
+        if ( pintsize > DT_MAX_IRQ_SPEC )
+        {
+            dt_dprintk(" -> too many irq specifier cells in parent\n");
+            goto fail;
+        }
+
+        /* Check for malformed properties */
+        if ( imaplen < (paddrsize + pintsize) )
+            goto fail;
+
+        imap += paddrsize;
+        imaplen -= paddrsize;
+
+        dt_raw_irq.controller = ipar;
+        dt_raw_irq.size = pintsize;
+        for ( i = 0; i < pintsize; i++ )
+            dt_raw_irq.specifier[i] = dt_read_number(imap + i, 1);
+
+        if ( dt_raw_irq.controller != dt_interrupt_controller )
+        {
+            /*
+             * We don't map IRQs connected to secondary IRQ controllers as
+             * these IRQs have no meaning to us until they connect to the
+             * primary controller.
+             *
+             * Secondary IRQ controllers will at some point connect to
+             * the primary controller (possibly via other IRQ controllers).
+             * We map the IRQs at that last connection point.
+             */
+            imap += pintsize;
+            imaplen -= pintsize;
+            dt_dprintk(" -> Skipped IRQ for secondary IRQ controller\n");
+            continue;
+        }
+
+        ret = dt_irq_translate(&dt_raw_irq, &dt_irq);
+        if ( ret )
+        {
+            dt_dprintk(" -> failed to translate IRQ: %d\n", ret);
+            return ret;
+        }
+
+        ret = cb(dev, &dt_irq, data);
+        if ( ret )
+        {
+            dt_dprintk(" -> callback failed=%d\n", ret);
+            return ret;
+        }
+
+        imap += pintsize;
+        imaplen -= pintsize;
+
+        dt_dprintk(" -> imaplen=%d\n", imaplen);
+    }
+
+    return 0;
+
+fail:
+    return -EINVAL;
+}
+
+/**
+ * dt_irq_map_raw - Low level interrupt tree parsing
+ * @parent:     the device interrupt parent
+ * @intspec:    interrupt specifier ("interrupts" property of the device)
+ * @ointsize:   size of the passed in interrupt specifier
+ * @addr:       address specifier (start of "reg" property of the device)
+ * @oirq:       structure dt_raw_irq filled by this function
+ *
+ * Returns 0 on success and a negative number on error
+ *
+ * This function is a low-level interrupt tree walking function. It
+ * can be used to do a partial walk with synthesized reg and interrupts
+ * properties, for example when resolving PCI interrupts when no device
+ * node exist for the parent.
+ */
+static int dt_irq_map_raw(const struct dt_device_node *parent,
+                          const __be32 *intspec, u32 ointsize,
+                          const __be32 *addr,
+                          struct dt_raw_irq *oirq)
+{
+    const struct dt_device_node *ipar, *tnode, *old = NULL, *newpar = NULL;
+    const __be32 *tmp, *imap, *imask;
+    u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0;
+    u32 imaplen;
+    int match, i;
+
+    dt_dprintk("dt_irq_map_raw: par=%s,intspec=[0x%08x 0x%08x...],ointsize=%d\n",
+               parent->full_name, be32_to_cpup(intspec),
+               be32_to_cpup(intspec + 1), ointsize);
+
+    ipar = parent;
+
+    /* First get the #interrupt-cells property of the current cursor
+     * that tells us how to interpret the passed-in intspec. If there
+     * is none, we are nice and just walk up the tree
+     */
+    do {
+        tmp = dt_get_property(ipar, "#interrupt-cells", NULL);
+        if ( tmp != NULL )
+        {
+            intsize = be32_to_cpu(*tmp);
+            break;
+        }
+        tnode = ipar;
+        ipar = dt_irq_find_parent(ipar);
+    } while ( ipar );
+    if ( ipar == NULL )
+    {
+        dt_dprintk(" -> no parent found !\n");
+        goto fail;
+    }
+
+    dt_dprintk("dt_irq_map_raw: ipar=%s, size=%d\n", ipar->full_name, intsize);
+
+    if ( ointsize != intsize )
+        return -EINVAL;
+
+    /* Look for this #address-cells. We have to implement the old linux
+     * trick of looking for the parent here as some device-trees rely on it
+     */
+    old = ipar;
+    do {
+        tmp = dt_get_property(old, "#address-cells", NULL);
+        tnode = dt_get_parent(old);
+        old = tnode;
+    } while ( old && tmp == NULL );
+
+    old = NULL;
+    addrsize = (tmp == NULL) ? 2 : be32_to_cpu(*tmp);
+
+    dt_dprintk(" -> addrsize=%d\n", addrsize);
+
+    /* Now start the actual "proper" walk of the interrupt tree */
+    while ( ipar != NULL )
+    {
+        /* Now check if cursor is an interrupt-controller and if it is
+         * then we are done
+         */
+        if ( dt_get_property(ipar, "interrupt-controller", NULL) != NULL )
+        {
+            dt_dprintk(" -> got it !\n");
+            if ( intsize > DT_MAX_IRQ_SPEC )
+            {
+                dt_dprintk(" -> intsize(%u) greater than DT_MAX_IRQ_SPEC(%u)\n",
+                           intsize, DT_MAX_IRQ_SPEC);
+                goto fail;
+            }
+            for ( i = 0; i < intsize; i++ )
+                oirq->specifier[i] = dt_read_number(intspec + i, 1);
+            oirq->size = intsize;
+            oirq->controller = ipar;
+            return 0;
+        }
+
+        /* Now look for an interrupt-map */
+        imap = dt_get_property(ipar, "interrupt-map", &imaplen);
+        /* No interrupt map, check for an interrupt parent */
+        if ( imap == NULL )
+        {
+            dt_dprintk(" -> no map, getting parent\n");
+            newpar = dt_irq_find_parent(ipar);
+            goto skiplevel;
+        }
+        imaplen /= sizeof(u32);
+
+        /* Look for a mask */
+        imask = dt_get_property(ipar, "interrupt-map-mask", NULL);
+
+        /* If we were passed no "reg" property and we attempt to parse
+         * an interrupt-map, then #address-cells must be 0.
+         * Fail if it's not.
+         */
+        if ( addr == NULL && addrsize != 0 )
+        {
+            dt_dprintk(" -> no reg passed in when needed !\n");
+            goto fail;
+        }
+
+        /* Parse interrupt-map */
+        match = 0;
+        while ( imaplen > (addrsize + intsize + 1) && !match )
+        {
+            /* Compare specifiers */
+            match = 1;
+            for ( i = 0; i < addrsize && match; ++i )
+            {
+                __be32 mask = imask ? imask[i] : cpu_to_be32(0xffffffffu);
+                match = ((addr[i] ^ imap[i]) & mask) == 0;
+            }
+            for ( ; i < (addrsize + intsize) && match; ++i )
+            {
+                __be32 mask = imask ? imask[i] : cpu_to_be32(0xffffffffu);
+                match = ((intspec[i-addrsize] ^ imap[i]) & mask) == 0;
+            }
+            imap += addrsize + intsize;
+            imaplen -= addrsize + intsize;
+
+            dt_dprintk(" -> match=%d (imaplen=%d)\n", match, imaplen);
+
+            /* Get the interrupt parent */
+            newpar = dt_find_node_by_phandle(be32_to_cpup(imap));
+            imap++;
+            --imaplen;
+
+            /* Check if not found */
+            if ( newpar == NULL )
+            {
+                dt_dprintk(" -> imap parent not found !\n");
+                goto fail;
+            }
+
+            /* Get #interrupt-cells and #address-cells of new
+             * parent
+             */
+            tmp = dt_get_property(newpar, "#interrupt-cells", NULL);
+            if ( tmp == NULL )
+            {
+                dt_dprintk(" -> parent lacks #interrupt-cells!\n");
+                goto fail;
+            }
+            newintsize = be32_to_cpu(*tmp);
+            tmp = dt_get_property(newpar, "#address-cells", NULL);
+            newaddrsize = (tmp == NULL) ? 0 : be32_to_cpu(*tmp);
+
+            dt_dprintk(" -> newintsize=%d, newaddrsize=%d\n",
+                       newintsize, newaddrsize);
+
+            /* Check for malformed properties */
+            if ( imaplen < (newaddrsize + newintsize) )
+                goto fail;
+
+            imap += newaddrsize + newintsize;
+            imaplen -= newaddrsize + newintsize;
+
+            dt_dprintk(" -> imaplen=%d\n", imaplen);
+        }
+        if ( !match )
+            goto fail;
+
+        old = newpar;
+        addrsize = newaddrsize;
+        intsize = newintsize;
+        intspec = imap - intsize;
+        addr = intspec - addrsize;
+
+    skiplevel:
+        /* Iterate again with new parent */
+        dt_dprintk(" -> new parent: %s\n", dt_node_full_name(newpar));
+        ipar = newpar;
+        newpar = NULL;
+    }
+fail:
+    return -EINVAL;
+}
+
+int dt_device_get_raw_irq(const struct dt_device_node *device,
+                          unsigned int index,
+                          struct dt_raw_irq *out_irq)
+{
+    const struct dt_device_node *p;
+    const __be32 *intspec, *tmp, *addr;
+    u32 intsize, intlen;
+    int res = -EINVAL;
+    struct dt_phandle_args args;
+    int i;
+
+    dt_dprintk("dt_device_get_raw_irq: dev=%s, index=%u\n",
+               device->full_name, index);
+
+    /* Get the reg property (if any) */
+    addr = dt_get_property(device, "reg", NULL);
+
+    /* Try the new-style interrupts-extended first */
+    res = dt_parse_phandle_with_args(device, "interrupts-extended",
+                                     "#interrupt-cells", index, &args);
+    if ( !res )
+    {
+        dt_dprintk(" using 'interrupts-extended' property\n");
+        dt_dprintk(" intspec=%d intsize=%d\n", args.args[0], args.args_count);
+
+        for ( i = 0; i < args.args_count; i++ )
+            args.args[i] = cpu_to_be32(args.args[i]);
+
+        return dt_irq_map_raw(args.np, args.args, args.args_count,
+                              addr, out_irq);
+    }
+
+    /* Get the interrupts property */
+    intspec = dt_get_property(device, "interrupts", &intlen);
+    if ( intspec == NULL )
+        return -EINVAL;
+    intlen /= sizeof(*intspec);
+
+    dt_dprintk(" using 'interrupts' property\n");
+    dt_dprintk(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen);
+
+    /* Look for the interrupt parent. */
+    p = dt_irq_find_parent(device);
+    if ( p == NULL )
+        return -EINVAL;
+
+    /* Get size of interrupt specifier */
+    tmp = dt_get_property(p, "#interrupt-cells", NULL);
+    if ( tmp == NULL )
+        goto out;
+    intsize = be32_to_cpu(*tmp);
+
+    dt_dprintk(" intsize=%d intlen=%d\n", intsize, intlen);
+
+    /* Check index */
+    if ( (index + 1) * intsize > intlen )
+        goto out;
+
+    /* Get new specifier and map it */
+    res = dt_irq_map_raw(p, intspec + index * intsize, intsize,
+                         addr, out_irq);
+    if ( res )
+        goto out;
+out:
+    return res;
+}
+
+int dt_irq_translate(const struct dt_raw_irq *raw,
+                     struct dt_irq *out_irq)
+{
+    ASSERT(dt_irq_xlate != NULL);
+    ASSERT(dt_interrupt_controller != NULL);
+
+    /*
+     * TODO: Retrieve the right irq_xlate. This is only works for the primary
+     * interrupt controller.
+     */
+    if ( raw->controller != dt_interrupt_controller )
+        return -EINVAL;
+
+    return dt_irq_xlate(raw->specifier, raw->size,
+                        &out_irq->irq, &out_irq->type);
+}
+
+int dt_device_get_irq(const struct dt_device_node *device, unsigned int index,
+                      struct dt_irq *out_irq)
+{
+    struct dt_raw_irq raw;
+    int res;
+
+    res = dt_device_get_raw_irq(device, index, &raw);
+
+    if ( res )
+        return res;
+
+    return dt_irq_translate(&raw, out_irq);
+}
+
+bool dt_device_is_available(const struct dt_device_node *device)
+{
+    const char *status;
+    u32 statlen;
+
+    status = dt_get_property(device, "status", &statlen);
+    if ( status == NULL )
+        return 1;
+
+    if ( statlen > 0 )
+    {
+        if ( !strcmp(status, "okay") || !strcmp(status, "ok") )
+            return 1;
+    }
+
+    return 0;
+}
+
+bool dt_device_for_passthrough(const struct dt_device_node *device)
+{
+    return (dt_find_property(device, "xen,passthrough", NULL) != NULL);
+
+}
+
+static int __dt_parse_phandle_with_args(const struct dt_device_node *np,
+                                        const char *list_name,
+                                        const char *cells_name,
+                                        int cell_count, int index,
+                                        struct dt_phandle_args *out_args)
+{
+    const __be32 *list, *list_end;
+    int rc = 0, cur_index = 0;
+    u32 size, count = 0;
+    struct dt_device_node *node = NULL;
+    dt_phandle phandle;
+
+    /* Retrieve the phandle list property */
+    list = dt_get_property(np, list_name, &size);
+    if ( !list )
+        return -ENOENT;
+    list_end = list + size / sizeof(*list);
+
+    /* Loop over the phandles until all the requested entry is found */
+    while ( list < list_end )
+    {
+        rc = -EINVAL;
+        count = 0;
+
+        /*
+         * If phandle is 0, then it is an empty entry with no
+         * arguments.  Skip forward to the next entry.
+         * */
+        phandle = be32_to_cpup(list++);
+        if ( phandle )
+        {
+            /*
+             * Find the provider node and parse the #*-cells
+             * property to determine the argument length.
+             *
+             * This is not needed if the cell count is hard-coded
+             * (i.e. cells_name not set, but cell_count is set),
+             * except when we're going to return the found node
+             * below.
+             */
+            if ( cells_name || cur_index == index )
+            {
+                node = dt_find_node_by_phandle(phandle);
+                if ( !node )
+                {
+                    printk(XENLOG_ERR "%s: could not find phandle\n",
+                           np->full_name);
+                    goto err;
+                }
+            }
+
+            if ( cells_name )
+            {
+                if ( !dt_property_read_u32(node, cells_name, &count) )
+                {
+                    printk("%s: could not get %s for %s\n",
+                           np->full_name, cells_name, node->full_name);
+                    goto err;
+                }
+            }
+            else
+                count = cell_count;
+
+            /*
+             * Make sure that the arguments actually fit in the
+             * remaining property data length
+             */
+            if ( list + count > list_end )
+            {
+                printk(XENLOG_ERR "%s: arguments longer than property\n",
+                       np->full_name);
+                goto err;
+            }
+        }
+
+        /*
+         * All of the error cases above bail out of the loop, so at


From xen-changelog-bounces@lists.xenproject.org Wed Aug 07 17:23:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Aug 2024 17:23:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773621.1184075 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbkNM-0003QW-2B; Wed, 07 Aug 2024 17:23:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773621.1184075; Wed, 07 Aug 2024 17:23:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbkNL-0003QO-V9; Wed, 07 Aug 2024 17:23:03 +0000
Received: by outflank-mailman (input) for mailman id 773621;
 Wed, 07 Aug 2024 17:23:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkNK-0003QA-EB
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:23:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkNK-0008WS-DQ
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:23:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkNK-0003JE-Cj
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:23:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=muWYAZF9QwTyIhZcOFTRBrzk5uTjxSlszKDz8PXCgOA=; b=11w6y4JUhrt96JQhiyQgZk49im
	aK6riTHfxE9gsHij59DCKP3PdJEI6fBxZ9BfiVvepB3McRYPMb7nyAj0gIt5oIJasgnMtw5Oped8O
	maxNCFMVAYmMAbgfSm59yDB6goZKzmVsIAxiv73jE0dl6cxHmi3LacJim7a3jVGLzG28=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/common: Move Arm's bootfdt.c to common
Message-Id: <E1sbkNK-0003JE-Cj@xenbits.xenproject.org>
Date: Wed, 07 Aug 2024 17:23:02 +0000

commit f06fbfe54dea044b9d5e93a6ef4bcb0c4747ca9d
Author:     Shawn Anastasio <sanastasio@raptorengineering.com>
AuthorDate: Tue Aug 6 13:41:14 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Aug 6 19:10:56 2024 +0100

    xen/common: Move Arm's bootfdt.c to common
    
    Move Arm's bootfdt.c to xen/common so that it can be used by other
    device tree architectures like PPC and RISCV.
    
    Remove stubs for process_shm_node() and early_print_info_shmem()
    from $xen/arch/arm/include/asm/static-shmem.h.
    These stubs are removed to avoid introducing them for architectures
    that do not support CONFIG_STATIC_SHM.
    The process_shm_node() stub is now implemented in common code to
    maintain the current behavior of early_scan_code() on ARM.
    The early_print_info_shmem() stub is only used in early_print_info(),
    so it's now guarded with #ifdef CONFIG_STATIC_SHM ... #endif.
    
    Suggested-by: Julien Grall <julien@xen.org>
    Signed-off-by: Shawn Anastasio <sanastasio@raptorengineering.com>
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/Makefile                   |   1 -
 xen/arch/arm/bootfdt.c                  | 648 -------------------------------
 xen/arch/arm/include/asm/setup.h        |  13 -
 xen/arch/arm/include/asm/static-shmem.h |   9 -
 xen/common/device-tree/Makefile         |   1 +
 xen/common/device-tree/bootfdt.c        | 662 ++++++++++++++++++++++++++++++++
 xen/include/xen/bootfdt.h               |  14 +
 7 files changed, 677 insertions(+), 671 deletions(-)

diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 45dc29ea53..da9c979dc4 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -10,7 +10,6 @@ obj-$(CONFIG_TEE) += tee/
 obj-$(CONFIG_HAS_VPCI) += vpci.o
 
 obj-$(CONFIG_HAS_ALTERNATIVE) += alternative.o
-obj-y += bootfdt.init.o
 obj-y += cpuerrata.o
 obj-y += cpufeature.o
 obj-y += decode.o
diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
deleted file mode 100644
index f2892fce0a..0000000000
--- a/xen/arch/arm/bootfdt.c
+++ /dev/null
@@ -1,648 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/*
- * Early Device Tree
- *
- * Copyright (C) 2012-2014 Citrix Systems, Inc.
- */
-#include <xen/types.h>
-#include <xen/lib.h>
-#include <xen/kernel.h>
-#include <xen/init.h>
-#include <xen/efi.h>
-#include <xen/device_tree.h>
-#include <xen/lib.h>
-#include <xen/libfdt/libfdt-xen.h>
-#include <xen/sort.h>
-#include <xsm/xsm.h>
-#include <asm/setup.h>
-#include <asm/static-shmem.h>
-
-static void __init __maybe_unused build_assertions(void)
-{
-    /*
-     * Check that no padding is between struct membanks "bank" flexible array
-     * member and struct meminfo "bank" member
-     */
-    BUILD_BUG_ON((offsetof(struct membanks, bank) !=
-                 offsetof(struct meminfo, bank)));
-    /* Ensure "struct membanks" is 8-byte aligned */
-    BUILD_BUG_ON(alignof(struct membanks) != 8);
-}
-
-static bool __init device_tree_node_is_available(const void *fdt, int node)
-{
-    const char *status;
-    int len;
-
-    status = fdt_getprop(fdt, node, "status", &len);
-    if ( !status )
-        return true;
-
-    if ( len > 0 )
-    {
-        if ( !strcmp(status, "ok") || !strcmp(status, "okay") )
-            return true;
-    }
-
-    return false;
-}
-
-static bool __init device_tree_node_matches(const void *fdt, int node,
-                                            const char *match)
-{
-    const char *name;
-    size_t match_len;
-
-    name = fdt_get_name(fdt, node, NULL);
-    match_len = strlen(match);
-
-    /* Match both "match" and "match@..." patterns but not
-       "match-foo". */
-    return strncmp(name, match, match_len) == 0
-        && (name[match_len] == '@' || name[match_len] == '\0');
-}
-
-static bool __init device_tree_node_compatible(const void *fdt, int node,
-                                               const char *match)
-{
-    int len, l;
-    const void *prop;
-
-    prop = fdt_getprop(fdt, node, "compatible", &len);
-    if ( prop == NULL )
-        return false;
-
-    while ( len > 0 ) {
-        if ( !dt_compat_cmp(prop, match) )
-            return true;
-        l = strlen(prop) + 1;
-        prop += l;
-        len -= l;
-    }
-
-    return false;
-}
-
-/*
- * Check if a node is a proper /memory node according to Devicetree
- * Specification v0.4, chapter 3.4.
- */
-static bool __init device_tree_is_memory_node(const void *fdt, int node,
-                                              int depth)
-{
-    const char *type;
-    int len;
-
-    if ( depth != 1 )
-        return false;
-
-    if ( !device_tree_node_matches(fdt, node, "memory") )
-        return false;
-
-    type = fdt_getprop(fdt, node, "device_type", &len);
-    if ( !type )
-        return false;
-
-    if ( (len <= strlen("memory")) || strcmp(type, "memory") )
-        return false;
-
-    return true;
-}
-
-void __init device_tree_get_reg(const __be32 **cell, uint32_t address_cells,
-                                uint32_t size_cells, paddr_t *start,
-                                paddr_t *size)
-{
-    uint64_t dt_start, dt_size;
-
-    /*
-     * dt_next_cell will return uint64_t whereas paddr_t may not be 64-bit.
-     * Thus, there is an implicit cast from uint64_t to paddr_t.
-     */
-    dt_start = dt_next_cell(address_cells, cell);
-    dt_size = dt_next_cell(size_cells, cell);
-
-    if ( dt_start != (paddr_t)dt_start )
-    {
-        printk("Physical address greater than max width supported\n");
-        WARN();
-    }
-
-    if ( dt_size != (paddr_t)dt_size )
-    {
-        printk("Physical size greater than max width supported\n");
-        WARN();
-    }
-
-    /*
-     * Xen will truncate the address/size if it is greater than the maximum
-     * supported width and it will give an appropriate warning.
-     */
-    *start = dt_start;
-    *size = dt_size;
-}
-
-static int __init device_tree_get_meminfo(const void *fdt, int node,
-                                          const char *prop_name,
-                                          u32 address_cells, u32 size_cells,
-                                          struct membanks *mem,
-                                          enum membank_type type)
-{
-    const struct fdt_property *prop;
-    unsigned int i, banks;
-    const __be32 *cell;
-    u32 reg_cells = address_cells + size_cells;
-    paddr_t start, size;
-
-    if ( !device_tree_node_is_available(fdt, node) )
-        return 0;
-
-    if ( address_cells < 1 || size_cells < 1 )
-    {
-        printk("fdt: property `%s': invalid #address-cells or #size-cells",
-               prop_name);
-        return -EINVAL;
-    }
-
-    prop = fdt_get_property(fdt, node, prop_name, NULL);
-    if ( !prop )
-        return -ENOENT;
-
-    cell = (const __be32 *)prop->data;
-    banks = fdt32_to_cpu(prop->len) / (reg_cells * sizeof (u32));
-
-    for ( i = 0; i < banks && mem->nr_banks < mem->max_banks; i++ )
-    {
-        device_tree_get_reg(&cell, address_cells, size_cells, &start, &size);
-        if ( mem == bootinfo_get_reserved_mem() &&
-             check_reserved_regions_overlap(start, size) )
-            return -EINVAL;
-        /* Some DT may describe empty bank, ignore them */
-        if ( !size )
-            continue;
-        mem->bank[mem->nr_banks].start = start;
-        mem->bank[mem->nr_banks].size = size;
-        mem->bank[mem->nr_banks].type = type;
-        mem->nr_banks++;
-    }
-
-    if ( i < banks )
-    {
-        printk("Warning: Max number of supported memory regions reached.\n");
-        return -ENOSPC;
-    }
-
-    return 0;
-}
-
-u32 __init device_tree_get_u32(const void *fdt, int node,
-                               const char *prop_name, u32 dflt)
-{
-    const struct fdt_property *prop;
-
-    prop = fdt_get_property(fdt, node, prop_name, NULL);
-    if ( !prop || prop->len < sizeof(u32) )
-        return dflt;
-
-    return fdt32_to_cpu(*(uint32_t*)prop->data);
-}
-
-/**
- * device_tree_for_each_node - iterate over all device tree sub-nodes
- * @fdt: flat device tree.
- * @node: parent node to start the search from
- * @func: function to call for each sub-node.
- * @data: data to pass to @func.
- *
- * Any nodes nested at DEVICE_TREE_MAX_DEPTH or deeper are ignored.
- *
- * Returns 0 if all nodes were iterated over successfully.  If @func
- * returns a value different from 0, that value is returned immediately.
- */
-int __init device_tree_for_each_node(const void *fdt, int node,
-                                     device_tree_node_func func,
-                                     void *data)
-{
-    /*
-     * We only care about relative depth increments, assume depth of
-     * node is 0 for simplicity.
-     */
-    int depth = 0;
-    const int first_node = node;
-    u32 address_cells[DEVICE_TREE_MAX_DEPTH];
-    u32 size_cells[DEVICE_TREE_MAX_DEPTH];
-    int ret;
-
-    do {
-        const char *name = fdt_get_name(fdt, node, NULL);
-        u32 as, ss;
-
-        if ( depth >= DEVICE_TREE_MAX_DEPTH )
-        {
-            printk("Warning: device tree node `%s' is nested too deep\n",
-                   name);
-            continue;
-        }
-
-        as = depth > 0 ? address_cells[depth-1] : DT_ROOT_NODE_ADDR_CELLS_DEFAULT;
-        ss = depth > 0 ? size_cells[depth-1] : DT_ROOT_NODE_SIZE_CELLS_DEFAULT;
-
-        address_cells[depth] = device_tree_get_u32(fdt, node,
-                                                   "#address-cells", as);
-        size_cells[depth] = device_tree_get_u32(fdt, node,
-                                                "#size-cells", ss);
-
-        /* skip the first node */
-        if ( node != first_node )
-        {
-            ret = func(fdt, node, name, depth, as, ss, data);
-            if ( ret != 0 )
-                return ret;
-        }
-
-        node = fdt_next_node(fdt, node, &depth);
-    } while ( node >= 0 && depth > 0 );
-
-    return 0;
-}
-
-static int __init process_memory_node(const void *fdt, int node,
-                                      const char *name, int depth,
-                                      u32 address_cells, u32 size_cells,
-                                      struct membanks *mem)
-{
-    return device_tree_get_meminfo(fdt, node, "reg", address_cells, size_cells,
-                                   mem, MEMBANK_DEFAULT);
-}
-
-static int __init process_reserved_memory_node(const void *fdt, int node,
-                                               const char *name, int depth,
-                                               u32 address_cells,
-                                               u32 size_cells,
-                                               void *data)
-{
-    int rc = process_memory_node(fdt, node, name, depth, address_cells,
-                                 size_cells, data);
-
-    if ( rc == -ENOSPC )
-        panic("Max number of supported reserved-memory regions reached.\n");
-    else if ( rc != -ENOENT )
-        return rc;
-    return 0;
-}
-
-static int __init process_reserved_memory(const void *fdt, int node,
-                                          const char *name, int depth,
-                                          u32 address_cells, u32 size_cells)
-{
-    return device_tree_for_each_node(fdt, node,
-                                     process_reserved_memory_node,
-                                     bootinfo_get_reserved_mem());
-}
-
-static void __init process_multiboot_node(const void *fdt, int node,
-                                          const char *name,
-                                          u32 address_cells, u32 size_cells)
-{
-    static int __initdata kind_guess = 0;
-    const struct fdt_property *prop;
-    const __be32 *cell;
-    bootmodule_kind kind;
-    paddr_t start, size;
-    int len;
-    /* sizeof("/chosen/") + DT_MAX_NAME + '/' + DT_MAX_NAME + '/0' => 92 */
-    char path[92];
-    int parent_node, ret;
-    bool domU;
-
-    parent_node = fdt_parent_offset(fdt, node);
-    ASSERT(parent_node >= 0);
-
-    /* Check that the node is under "/chosen" (first 7 chars of path) */
-    ret = fdt_get_path(fdt, node, path, sizeof (path));
-    if ( ret != 0 || strncmp(path, "/chosen", 7) )
-        return;
-
-    prop = fdt_get_property(fdt, node, "reg", &len);
-    if ( !prop )
-        panic("node %s missing `reg' property\n", name);
-
-    if ( len < dt_cells_to_size(address_cells + size_cells) )
-        panic("fdt: node `%s': `reg` property length is too short\n",
-                    name);
-
-    cell = (const __be32 *)prop->data;
-    device_tree_get_reg(&cell, address_cells, size_cells, &start, &size);
-
-    if ( fdt_node_check_compatible(fdt, node, "xen,linux-zimage") == 0 ||
-         fdt_node_check_compatible(fdt, node, "multiboot,kernel") == 0 )
-        kind = BOOTMOD_KERNEL;
-    else if ( fdt_node_check_compatible(fdt, node, "xen,linux-initrd") == 0 ||
-              fdt_node_check_compatible(fdt, node, "multiboot,ramdisk") == 0 )
-        kind = BOOTMOD_RAMDISK;
-    else if ( fdt_node_check_compatible(fdt, node, "xen,xsm-policy") == 0 )
-        kind = BOOTMOD_XSM;
-    else if ( fdt_node_check_compatible(fdt, node, "multiboot,device-tree") == 0 )
-        kind = BOOTMOD_GUEST_DTB;
-    else
-        kind = BOOTMOD_UNKNOWN;
-
-    /**
-     * Guess the kind of these first two unknowns respectively:
-     * (1) The first unknown must be kernel.
-     * (2) Detect the XSM Magic from the 2nd unknown:
-     *     a. If it's XSM, set the kind as XSM, and that also means we
-     *     won't load ramdisk;
-     *     b. if it's not XSM, set the kind as ramdisk.
-     *     So if user want to load ramdisk, it must be the 2nd unknown.
-     * We also detect the XSM Magic for the following unknowns,
-     * then set its kind according to the return value of has_xsm_magic.
-     */
-    if ( kind == BOOTMOD_UNKNOWN )
-    {
-        switch ( kind_guess++ )
-        {
-        case 0: kind = BOOTMOD_KERNEL; break;
-        case 1: kind = BOOTMOD_RAMDISK; break;
-        default: break;
-        }
-        if ( kind_guess > 1 && has_xsm_magic(start) )
-            kind = BOOTMOD_XSM;
-    }
-
-    domU = fdt_node_check_compatible(fdt, parent_node, "xen,domain") == 0;
-    add_boot_module(kind, start, size, domU);
-
-    prop = fdt_get_property(fdt, node, "bootargs", &len);
-    if ( !prop )
-        return;
-    add_boot_cmdline(fdt_get_name(fdt, parent_node, &len), prop->data,
-                     kind, start, domU);
-}
-
-static int __init process_chosen_node(const void *fdt, int node,
-                                      const char *name,
-                                      u32 address_cells, u32 size_cells)
-{
-    const struct fdt_property *prop;
-    paddr_t start, end;
-    int len;
-
-    if ( fdt_get_property(fdt, node, "xen,static-heap", NULL) )
-    {
-        int rc;
-
-        printk("Checking for static heap in /chosen\n");
-
-        rc = device_tree_get_meminfo(fdt, node, "xen,static-heap",
-                                     address_cells, size_cells,
-                                     bootinfo_get_reserved_mem(),
-                                     MEMBANK_STATIC_HEAP);
-        if ( rc )
-            return rc;
-
-        bootinfo.static_heap = true;
-    }
-
-    printk("Checking for initrd in /chosen\n");
-
-    prop = fdt_get_property(fdt, node, "linux,initrd-start", &len);
-    if ( !prop )
-        /* No initrd present. */
-        return 0;
-    if ( len != sizeof(u32) && len != sizeof(u64) )
-    {
-        printk("linux,initrd-start property has invalid length %d\n", len);
-        return -EINVAL;
-    }
-    start = dt_read_paddr((const void *)&prop->data, dt_size_to_cells(len));
-
-    prop = fdt_get_property(fdt, node, "linux,initrd-end", &len);
-    if ( !prop )
-    {
-        printk("linux,initrd-end not present but -start was\n");
-        return -EINVAL;
-    }
-    if ( len != sizeof(u32) && len != sizeof(u64) )
-    {
-        printk("linux,initrd-end property has invalid length %d\n", len);
-        return -EINVAL;
-    }
-    end = dt_read_paddr((const void *)&prop->data, dt_size_to_cells(len));
-
-    if ( start >= end )
-    {
-        printk("linux,initrd limits invalid: %"PRIpaddr" >= %"PRIpaddr"\n",
-                  start, end);
-        return -EINVAL;
-    }
-
-    printk("Initrd %"PRIpaddr"-%"PRIpaddr"\n", start, end);
-
-    add_boot_module(BOOTMOD_RAMDISK, start, end-start, false);
-
-    return 0;
-}
-
-static int __init process_domain_node(const void *fdt, int node,
-                                      const char *name,
-                                      u32 address_cells, u32 size_cells)
-{
-    const struct fdt_property *prop;
-
-    printk("Checking for \"xen,static-mem\" in domain node\n");
-
-    prop = fdt_get_property(fdt, node, "xen,static-mem", NULL);
-    if ( !prop )
-        /* No "xen,static-mem" present. */
-        return 0;
-
-    return device_tree_get_meminfo(fdt, node, "xen,static-mem", address_cells,
-                                   size_cells, bootinfo_get_reserved_mem(),
-                                   MEMBANK_STATIC_DOMAIN);
-}
-
-static int __init early_scan_node(const void *fdt,
-                                  int node, const char *name, int depth,
-                                  u32 address_cells, u32 size_cells,
-                                  void *data)
-{
-    int rc = 0;
-
-    /*
-     * If Xen has been booted via UEFI, the memory banks are
-     * populated. So we should skip the parsing.
-     */
-    if ( !efi_enabled(EFI_BOOT) &&
-         device_tree_is_memory_node(fdt, node, depth) )
-        rc = process_memory_node(fdt, node, name, depth,
-                                 address_cells, size_cells, bootinfo_get_mem());
-    else if ( depth == 1 && !dt_node_cmp(name, "reserved-memory") )
-        rc = process_reserved_memory(fdt, node, name, depth,
-                                     address_cells, size_cells);
-    else if ( depth <= 3 && (device_tree_node_compatible(fdt, node, "xen,multiboot-module" ) ||
-              device_tree_node_compatible(fdt, node, "multiboot,module" )))
-        process_multiboot_node(fdt, node, name, address_cells, size_cells);
-    else if ( depth == 1 && device_tree_node_matches(fdt, node, "chosen") )
-        rc = process_chosen_node(fdt, node, name, address_cells, size_cells);
-    else if ( depth == 2 && device_tree_node_compatible(fdt, node, "xen,domain") )
-        rc = process_domain_node(fdt, node, name, address_cells, size_cells);
-    else if ( depth <= 3 && device_tree_node_compatible(fdt, node, "xen,domain-shared-memory-v1") )
-        rc = process_shm_node(fdt, node, address_cells, size_cells);
-
-    if ( rc < 0 )
-        printk("fdt: node `%s': parsing failed\n", name);
-    return rc;
-}
-
-static void __init early_print_info(void)
-{
-    const struct membanks *mi = bootinfo_get_mem();
-    const struct membanks *mem_resv = bootinfo_get_reserved_mem();
-    struct bootmodules *mods = &bootinfo.modules;
-    struct bootcmdlines *cmds = &bootinfo.cmdlines;
-    unsigned int i;
-
-    for ( i = 0; i < mi->nr_banks; i++ )
-        printk("RAM: %"PRIpaddr" - %"PRIpaddr"\n",
-                mi->bank[i].start,
-                mi->bank[i].start + mi->bank[i].size - 1);
-    printk("\n");
-    for ( i = 0 ; i < mods->nr_mods; i++ )
-        printk("MODULE[%d]: %"PRIpaddr" - %"PRIpaddr" %-12s\n",
-                i,
-                mods->module[i].start,
-                mods->module[i].start + mods->module[i].size,
-                boot_module_kind_as_string(mods->module[i].kind));
-
-    for ( i = 0; i < mem_resv->nr_banks; i++ )
-    {
-        printk(" RESVD[%u]: %"PRIpaddr" - %"PRIpaddr"\n", i,
-               mem_resv->bank[i].start,
-               mem_resv->bank[i].start + mem_resv->bank[i].size - 1);
-    }
-    early_print_info_shmem();
-    printk("\n");
-    for ( i = 0 ; i < cmds->nr_mods; i++ )
-        printk("CMDLINE[%"PRIpaddr"]:%s %s\n", cmds->cmdline[i].start,
-               cmds->cmdline[i].dt_name,
-               &cmds->cmdline[i].cmdline[0]);
-    printk("\n");
-}
-
-/* This function assumes that memory regions are not overlapped */
-static int __init cmp_memory_node(const void *key, const void *elem)
-{
-    const struct membank *handler0 = key;
-    const struct membank *handler1 = elem;
-
-    if ( handler0->start < handler1->start )
-        return -1;
-
-    if ( handler0->start >= (handler1->start + handler1->size) )
-        return 1;
-
-    return 0;
-}
-
-static void __init swap_memory_node(void *_a, void *_b, size_t size)
-{
-    struct membank *a = _a, *b = _b;
-
-    SWAP(*a, *b);
-}
-
-/**
- * boot_fdt_info - initialize bootinfo from a DTB
- * @fdt: flattened device tree binary
- *
- * Returns the size of the DTB.
- */
-size_t __init boot_fdt_info(const void *fdt, paddr_t paddr)
-{
-    struct membanks *reserved_mem = bootinfo_get_reserved_mem();
-    struct membanks *mem = bootinfo_get_mem();
-    unsigned int i;
-    int nr_rsvd;
-    int ret;
-
-    ret = fdt_check_header(fdt);
-    if ( ret < 0 )
-        panic("No valid device tree\n");
-
-    add_boot_module(BOOTMOD_FDT, paddr, fdt_totalsize(fdt), false);
-
-    nr_rsvd = fdt_num_mem_rsv(fdt);
-    if ( nr_rsvd < 0 )
-        panic("Parsing FDT memory reserve map failed (%d)\n", nr_rsvd);
-
-    for ( i = 0; i < nr_rsvd; i++ )
-    {
-        struct membank *bank;
-        paddr_t s, sz;
-
-        if ( fdt_get_mem_rsv_paddr(device_tree_flattened, i, &s, &sz) < 0 )
-            continue;
-
-        if ( reserved_mem->nr_banks < reserved_mem->max_banks )
-        {
-            bank = &reserved_mem->bank[reserved_mem->nr_banks];
-            bank->start = s;
-            bank->size = sz;
-            bank->type = MEMBANK_FDT_RESVMEM;
-            reserved_mem->nr_banks++;
-        }
-        else
-            panic("Cannot allocate reserved memory bank\n");
-    }
-
-    ret = device_tree_for_each_node(fdt, 0, early_scan_node, NULL);
-    if ( ret )
-        panic("Early FDT parsing failed (%d)\n", ret);
-
-    /*
-     * On Arm64 setup_directmap_mappings() expects to be called with the lowest
-     * bank in memory first. There is no requirement that the DT will provide
-     * the banks sorted in ascending order. So sort them through.
-     */
-    sort(mem->bank, mem->nr_banks, sizeof(struct membank),
-         cmp_memory_node, swap_memory_node);
-
-    early_print_info();
-
-    return fdt_totalsize(fdt);
-}
-
-const __init char *boot_fdt_cmdline(const void *fdt)
-{
-    int node;
-    const struct fdt_property *prop;
-
-    node = fdt_path_offset(fdt, "/chosen");
-    if ( node < 0 )
-        return NULL;
-
-    prop = fdt_get_property(fdt, node, "xen,xen-bootargs", NULL);
-    if ( prop == NULL )
-    {
-        struct bootcmdline *dom0_cmdline =
-            boot_cmdline_find_by_kind(BOOTMOD_KERNEL);
-
-        if (fdt_get_property(fdt, node, "xen,dom0-bootargs", NULL) ||
-            ( dom0_cmdline && dom0_cmdline->cmdline[0] ) )
-            prop = fdt_get_property(fdt, node, "bootargs", NULL);
-    }
-    if ( prop == NULL )
-        return NULL;
-
-    return prop->data;
-}
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/xen/arch/arm/include/asm/setup.h b/xen/arch/arm/include/asm/setup.h
index 1748be29e5..64c227d171 100644
--- a/xen/arch/arm/include/asm/setup.h
+++ b/xen/arch/arm/include/asm/setup.h
@@ -41,19 +41,6 @@ void fw_unreserved_regions(paddr_t s, paddr_t e,
                            void (*cb)(paddr_t ps, paddr_t pe),
                            unsigned int first);
 
-bool check_reserved_regions_overlap(paddr_t region_start, paddr_t region_size);
-
-struct bootmodule *add_boot_module(bootmodule_kind kind,
-                                   paddr_t start, paddr_t size, bool domU);
-struct bootmodule *boot_module_find_by_kind(bootmodule_kind kind);
-struct bootmodule * boot_module_find_by_addr_and_kind(bootmodule_kind kind,
-                                                             paddr_t start);
-void add_boot_cmdline(const char *name, const char *cmdline,
-                      bootmodule_kind kind, paddr_t start, bool domU);
-struct bootcmdline *boot_cmdline_find_by_kind(bootmodule_kind kind);
-struct bootcmdline * boot_cmdline_find_by_name(const char *name);
-const char *boot_module_kind_as_string(bootmodule_kind kind);
-
 void init_pdx(void);
 void setup_mm(void);
 
diff --git a/xen/arch/arm/include/asm/static-shmem.h b/xen/arch/arm/include/asm/static-shmem.h
index 806ee41cfc..fd0867c4f2 100644
--- a/xen/arch/arm/include/asm/static-shmem.h
+++ b/xen/arch/arm/include/asm/static-shmem.h
@@ -80,15 +80,6 @@ static inline int process_shm_chosen(struct domain *d,
     return 0;
 }
 
-static inline int process_shm_node(const void *fdt, int node,
-                                   uint32_t address_cells, uint32_t size_cells)
-{
-    printk("CONFIG_STATIC_SHM must be enabled for parsing static shared memory nodes\n");
-    return -EINVAL;
-}
-
-static inline void early_print_info_shmem(void) {};
-
 static inline void init_sharedmem_pages(void) {};
 
 static inline int remove_shm_from_rangeset(const struct kernel_info *kinfo,
diff --git a/xen/common/device-tree/Makefile b/xen/common/device-tree/Makefile
index f813f7555f..990abd571a 100644
--- a/xen/common/device-tree/Makefile
+++ b/xen/common/device-tree/Makefile
@@ -1,2 +1,3 @@
+obj-y += bootfdt.init.o
 obj-y += bootinfo.init.o
 obj-y += device-tree.o
diff --git a/xen/common/device-tree/bootfdt.c b/xen/common/device-tree/bootfdt.c
new file mode 100644
index 0000000000..911a630e7d
--- /dev/null
+++ b/xen/common/device-tree/bootfdt.c
@@ -0,0 +1,662 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Early Device Tree
+ *
+ * Copyright (C) 2012-2014 Citrix Systems, Inc.
+ */
+
+#include <xen/bootfdt.h>
+#include <xen/device_tree.h>
+#include <xen/efi.h>
+#include <xen/init.h>
+#include <xen/kernel.h>
+#include <xen/lib.h>
+#include <xen/libfdt/libfdt-xen.h>
+#include <xen/sort.h>
+#include <xsm/xsm.h>
+#include <asm/setup.h>
+#ifdef CONFIG_STATIC_SHM
+#include <asm/static-shmem.h>
+#endif
+
+static void __init __maybe_unused build_assertions(void)
+{
+    /*
+     * Check that no padding is between struct membanks "bank" flexible array
+     * member and struct meminfo "bank" member
+     */
+    BUILD_BUG_ON((offsetof(struct membanks, bank) !=
+                 offsetof(struct meminfo, bank)));
+    /* Ensure "struct membanks" is 8-byte aligned */
+    BUILD_BUG_ON(alignof(struct membanks) != 8);
+}
+
+static bool __init device_tree_node_is_available(const void *fdt, int node)
+{
+    const char *status;
+    int len;
+
+    status = fdt_getprop(fdt, node, "status", &len);
+    if ( !status )
+        return true;
+
+    if ( len > 0 )
+    {
+        if ( !strcmp(status, "ok") || !strcmp(status, "okay") )
+            return true;
+    }
+
+    return false;
+}
+
+static bool __init device_tree_node_matches(const void *fdt, int node,
+                                            const char *match)
+{
+    const char *name;
+    size_t match_len;
+
+    name = fdt_get_name(fdt, node, NULL);
+    match_len = strlen(match);
+
+    /* Match both "match" and "match@..." patterns but not
+       "match-foo". */
+    return strncmp(name, match, match_len) == 0
+        && (name[match_len] == '@' || name[match_len] == '\0');
+}
+
+static bool __init device_tree_node_compatible(const void *fdt, int node,
+                                               const char *match)
+{
+    int len, l;
+    const void *prop;
+
+    prop = fdt_getprop(fdt, node, "compatible", &len);
+    if ( prop == NULL )
+        return false;
+
+    while ( len > 0 ) {
+        if ( !dt_compat_cmp(prop, match) )
+            return true;
+        l = strlen(prop) + 1;
+        prop += l;
+        len -= l;
+    }
+
+    return false;
+}
+
+/*
+ * Check if a node is a proper /memory node according to Devicetree
+ * Specification v0.4, chapter 3.4.
+ */
+static bool __init device_tree_is_memory_node(const void *fdt, int node,
+                                              int depth)
+{
+    const char *type;
+    int len;
+
+    if ( depth != 1 )
+        return false;
+
+    if ( !device_tree_node_matches(fdt, node, "memory") )
+        return false;
+
+    type = fdt_getprop(fdt, node, "device_type", &len);
+    if ( !type )
+        return false;
+
+    if ( (len <= strlen("memory")) || strcmp(type, "memory") )
+        return false;
+
+    return true;
+}
+
+void __init device_tree_get_reg(const __be32 **cell, uint32_t address_cells,
+                                uint32_t size_cells, paddr_t *start,
+                                paddr_t *size)
+{
+    uint64_t dt_start, dt_size;
+
+    /*
+     * dt_next_cell will return uint64_t whereas paddr_t may not be 64-bit.
+     * Thus, there is an implicit cast from uint64_t to paddr_t.
+     */
+    dt_start = dt_next_cell(address_cells, cell);
+    dt_size = dt_next_cell(size_cells, cell);
+
+    if ( dt_start != (paddr_t)dt_start )
+    {
+        printk("Physical address greater than max width supported\n");
+        WARN();
+    }
+
+    if ( dt_size != (paddr_t)dt_size )
+    {
+        printk("Physical size greater than max width supported\n");
+        WARN();
+    }
+
+    /*
+     * Xen will truncate the address/size if it is greater than the maximum
+     * supported width and it will give an appropriate warning.
+     */
+    *start = dt_start;
+    *size = dt_size;
+}
+
+static int __init device_tree_get_meminfo(const void *fdt, int node,
+                                          const char *prop_name,
+                                          u32 address_cells, u32 size_cells,
+                                          struct membanks *mem,
+                                          enum membank_type type)
+{
+    const struct fdt_property *prop;
+    unsigned int i, banks;
+    const __be32 *cell;
+    u32 reg_cells = address_cells + size_cells;
+    paddr_t start, size;
+
+    if ( !device_tree_node_is_available(fdt, node) )
+        return 0;
+
+    if ( address_cells < 1 || size_cells < 1 )
+    {
+        printk("fdt: property `%s': invalid #address-cells or #size-cells",
+               prop_name);
+        return -EINVAL;
+    }
+
+    prop = fdt_get_property(fdt, node, prop_name, NULL);
+    if ( !prop )
+        return -ENOENT;
+
+    cell = (const __be32 *)prop->data;
+    banks = fdt32_to_cpu(prop->len) / (reg_cells * sizeof (u32));
+
+    for ( i = 0; i < banks && mem->nr_banks < mem->max_banks; i++ )
+    {
+        device_tree_get_reg(&cell, address_cells, size_cells, &start, &size);
+        if ( mem == bootinfo_get_reserved_mem() &&
+             check_reserved_regions_overlap(start, size) )
+            return -EINVAL;
+        /* Some DT may describe empty bank, ignore them */
+        if ( !size )
+            continue;
+        mem->bank[mem->nr_banks].start = start;
+        mem->bank[mem->nr_banks].size = size;
+        mem->bank[mem->nr_banks].type = type;
+        mem->nr_banks++;
+    }
+
+    if ( i < banks )
+    {
+        printk("Warning: Max number of supported memory regions reached.\n");
+        return -ENOSPC;
+    }
+
+    return 0;
+}
+
+u32 __init device_tree_get_u32(const void *fdt, int node,
+                               const char *prop_name, u32 dflt)
+{
+    const struct fdt_property *prop;
+
+    prop = fdt_get_property(fdt, node, prop_name, NULL);
+    if ( !prop || prop->len < sizeof(u32) )
+        return dflt;
+
+    return fdt32_to_cpu(*(uint32_t*)prop->data);
+}
+
+/**
+ * device_tree_for_each_node - iterate over all device tree sub-nodes
+ * @fdt: flat device tree.
+ * @node: parent node to start the search from
+ * @func: function to call for each sub-node.
+ * @data: data to pass to @func.
+ *
+ * Any nodes nested at DEVICE_TREE_MAX_DEPTH or deeper are ignored.
+ *
+ * Returns 0 if all nodes were iterated over successfully.  If @func
+ * returns a value different from 0, that value is returned immediately.
+ */
+int __init device_tree_for_each_node(const void *fdt, int node,
+                                     device_tree_node_func func,
+                                     void *data)
+{
+    /*
+     * We only care about relative depth increments, assume depth of
+     * node is 0 for simplicity.
+     */
+    int depth = 0;
+    const int first_node = node;
+    u32 address_cells[DEVICE_TREE_MAX_DEPTH];
+    u32 size_cells[DEVICE_TREE_MAX_DEPTH];
+    int ret;
+
+    do {
+        const char *name = fdt_get_name(fdt, node, NULL);
+        u32 as, ss;
+
+        if ( depth >= DEVICE_TREE_MAX_DEPTH )
+        {
+            printk("Warning: device tree node `%s' is nested too deep\n",
+                   name);
+            continue;
+        }
+
+        as = depth > 0 ? address_cells[depth-1] : DT_ROOT_NODE_ADDR_CELLS_DEFAULT;
+        ss = depth > 0 ? size_cells[depth-1] : DT_ROOT_NODE_SIZE_CELLS_DEFAULT;
+
+        address_cells[depth] = device_tree_get_u32(fdt, node,
+                                                   "#address-cells", as);
+        size_cells[depth] = device_tree_get_u32(fdt, node,
+                                                "#size-cells", ss);
+
+        /* skip the first node */
+        if ( node != first_node )
+        {
+            ret = func(fdt, node, name, depth, as, ss, data);
+            if ( ret != 0 )
+                return ret;
+        }
+
+        node = fdt_next_node(fdt, node, &depth);
+    } while ( node >= 0 && depth > 0 );
+
+    return 0;
+}
+
+static int __init process_memory_node(const void *fdt, int node,
+                                      const char *name, int depth,
+                                      u32 address_cells, u32 size_cells,
+                                      struct membanks *mem)
+{
+    return device_tree_get_meminfo(fdt, node, "reg", address_cells, size_cells,
+                                   mem, MEMBANK_DEFAULT);
+}
+
+static int __init process_reserved_memory_node(const void *fdt, int node,
+                                               const char *name, int depth,
+                                               u32 address_cells,
+                                               u32 size_cells,
+                                               void *data)
+{
+    int rc = process_memory_node(fdt, node, name, depth, address_cells,
+                                 size_cells, data);
+
+    if ( rc == -ENOSPC )
+        panic("Max number of supported reserved-memory regions reached.\n");
+    else if ( rc != -ENOENT )
+        return rc;
+    return 0;
+}
+
+static int __init process_reserved_memory(const void *fdt, int node,
+                                          const char *name, int depth,
+                                          u32 address_cells, u32 size_cells)
+{
+    return device_tree_for_each_node(fdt, node,
+                                     process_reserved_memory_node,
+                                     bootinfo_get_reserved_mem());
+}
+
+static void __init process_multiboot_node(const void *fdt, int node,
+                                          const char *name,
+                                          u32 address_cells, u32 size_cells)
+{
+    static int __initdata kind_guess = 0;
+    const struct fdt_property *prop;
+    const __be32 *cell;
+    bootmodule_kind kind;
+    paddr_t start, size;
+    int len;
+    /* sizeof("/chosen/") + DT_MAX_NAME + '/' + DT_MAX_NAME + '/0' => 92 */
+    char path[92];
+    int parent_node, ret;
+    bool domU;
+
+    parent_node = fdt_parent_offset(fdt, node);
+    ASSERT(parent_node >= 0);
+
+    /* Check that the node is under "/chosen" (first 7 chars of path) */
+    ret = fdt_get_path(fdt, node, path, sizeof (path));
+    if ( ret != 0 || strncmp(path, "/chosen", 7) )
+        return;
+
+    prop = fdt_get_property(fdt, node, "reg", &len);
+    if ( !prop )
+        panic("node %s missing `reg' property\n", name);
+
+    if ( len < dt_cells_to_size(address_cells + size_cells) )
+        panic("fdt: node `%s': `reg` property length is too short\n",
+                    name);
+
+    cell = (const __be32 *)prop->data;
+    device_tree_get_reg(&cell, address_cells, size_cells, &start, &size);
+
+    if ( fdt_node_check_compatible(fdt, node, "xen,linux-zimage") == 0 ||
+         fdt_node_check_compatible(fdt, node, "multiboot,kernel") == 0 )
+        kind = BOOTMOD_KERNEL;
+    else if ( fdt_node_check_compatible(fdt, node, "xen,linux-initrd") == 0 ||
+              fdt_node_check_compatible(fdt, node, "multiboot,ramdisk") == 0 )
+        kind = BOOTMOD_RAMDISK;
+    else if ( fdt_node_check_compatible(fdt, node, "xen,xsm-policy") == 0 )
+        kind = BOOTMOD_XSM;
+    else if ( fdt_node_check_compatible(fdt, node, "multiboot,device-tree") == 0 )
+        kind = BOOTMOD_GUEST_DTB;
+    else
+        kind = BOOTMOD_UNKNOWN;
+
+    /**
+     * Guess the kind of these first two unknowns respectively:
+     * (1) The first unknown must be kernel.
+     * (2) Detect the XSM Magic from the 2nd unknown:
+     *     a. If it's XSM, set the kind as XSM, and that also means we
+     *     won't load ramdisk;
+     *     b. if it's not XSM, set the kind as ramdisk.
+     *     So if user want to load ramdisk, it must be the 2nd unknown.
+     * We also detect the XSM Magic for the following unknowns,
+     * then set its kind according to the return value of has_xsm_magic.
+     */
+    if ( kind == BOOTMOD_UNKNOWN )
+    {
+        switch ( kind_guess++ )
+        {
+        case 0: kind = BOOTMOD_KERNEL; break;
+        case 1: kind = BOOTMOD_RAMDISK; break;
+        default: break;
+        }
+        if ( kind_guess > 1 && has_xsm_magic(start) )
+            kind = BOOTMOD_XSM;
+    }
+
+    domU = fdt_node_check_compatible(fdt, parent_node, "xen,domain") == 0;
+    add_boot_module(kind, start, size, domU);
+
+    prop = fdt_get_property(fdt, node, "bootargs", &len);
+    if ( !prop )
+        return;
+    add_boot_cmdline(fdt_get_name(fdt, parent_node, &len), prop->data,
+                     kind, start, domU);
+}
+
+static int __init process_chosen_node(const void *fdt, int node,
+                                      const char *name,
+                                      u32 address_cells, u32 size_cells)
+{
+    const struct fdt_property *prop;
+    paddr_t start, end;
+    int len;
+
+    if ( fdt_get_property(fdt, node, "xen,static-heap", NULL) )
+    {
+        int rc;
+
+        printk("Checking for static heap in /chosen\n");
+
+        rc = device_tree_get_meminfo(fdt, node, "xen,static-heap",
+                                     address_cells, size_cells,
+                                     bootinfo_get_reserved_mem(),
+                                     MEMBANK_STATIC_HEAP);
+        if ( rc )
+            return rc;
+
+        bootinfo.static_heap = true;
+    }
+
+    printk("Checking for initrd in /chosen\n");
+
+    prop = fdt_get_property(fdt, node, "linux,initrd-start", &len);
+    if ( !prop )
+        /* No initrd present. */
+        return 0;
+    if ( len != sizeof(u32) && len != sizeof(u64) )
+    {
+        printk("linux,initrd-start property has invalid length %d\n", len);
+        return -EINVAL;
+    }
+    start = dt_read_paddr((const void *)&prop->data, dt_size_to_cells(len));
+
+    prop = fdt_get_property(fdt, node, "linux,initrd-end", &len);
+    if ( !prop )
+    {
+        printk("linux,initrd-end not present but -start was\n");
+        return -EINVAL;
+    }
+    if ( len != sizeof(u32) && len != sizeof(u64) )
+    {
+        printk("linux,initrd-end property has invalid length %d\n", len);
+        return -EINVAL;
+    }
+    end = dt_read_paddr((const void *)&prop->data, dt_size_to_cells(len));
+
+    if ( start >= end )
+    {
+        printk("linux,initrd limits invalid: %"PRIpaddr" >= %"PRIpaddr"\n",
+                  start, end);
+        return -EINVAL;
+    }
+
+    printk("Initrd %"PRIpaddr"-%"PRIpaddr"\n", start, end);
+
+    add_boot_module(BOOTMOD_RAMDISK, start, end-start, false);
+
+    return 0;
+}
+
+static int __init process_domain_node(const void *fdt, int node,
+                                      const char *name,
+                                      u32 address_cells, u32 size_cells)
+{
+    const struct fdt_property *prop;
+
+    printk("Checking for \"xen,static-mem\" in domain node\n");
+
+    prop = fdt_get_property(fdt, node, "xen,static-mem", NULL);
+    if ( !prop )
+        /* No "xen,static-mem" present. */
+        return 0;
+
+    return device_tree_get_meminfo(fdt, node, "xen,static-mem", address_cells,
+                                   size_cells, bootinfo_get_reserved_mem(),
+                                   MEMBANK_STATIC_DOMAIN);
+}
+
+#ifndef CONFIG_STATIC_SHM
+static inline int process_shm_node(const void *fdt, int node,
+                                   uint32_t address_cells, uint32_t size_cells)
+{
+    printk("CONFIG_STATIC_SHM must be enabled for parsing static shared"
+            " memory nodes\n");
+    return -EINVAL;
+}
+#endif
+
+static int __init early_scan_node(const void *fdt,
+                                  int node, const char *name, int depth,
+                                  u32 address_cells, u32 size_cells,
+                                  void *data)
+{
+    int rc = 0;
+
+    /*
+     * If Xen has been booted via UEFI, the memory banks are
+     * populated. So we should skip the parsing.
+     */
+    if ( !efi_enabled(EFI_BOOT) &&
+         device_tree_is_memory_node(fdt, node, depth) )
+        rc = process_memory_node(fdt, node, name, depth,
+                                 address_cells, size_cells, bootinfo_get_mem());
+    else if ( depth == 1 && !dt_node_cmp(name, "reserved-memory") )
+        rc = process_reserved_memory(fdt, node, name, depth,
+                                     address_cells, size_cells);
+    else if ( depth <= 3 && (device_tree_node_compatible(fdt, node, "xen,multiboot-module" ) ||
+              device_tree_node_compatible(fdt, node, "multiboot,module" )))
+        process_multiboot_node(fdt, node, name, address_cells, size_cells);
+    else if ( depth == 1 && device_tree_node_matches(fdt, node, "chosen") )
+        rc = process_chosen_node(fdt, node, name, address_cells, size_cells);
+    else if ( depth == 2 && device_tree_node_compatible(fdt, node, "xen,domain") )
+        rc = process_domain_node(fdt, node, name, address_cells, size_cells);
+    else if ( depth <= 3 && device_tree_node_compatible(fdt, node, "xen,domain-shared-memory-v1") )
+        rc = process_shm_node(fdt, node, address_cells, size_cells);
+
+    if ( rc < 0 )
+        printk("fdt: node `%s': parsing failed\n", name);
+    return rc;
+}
+
+static void __init early_print_info(void)
+{
+    const struct membanks *mi = bootinfo_get_mem();
+    const struct membanks *mem_resv = bootinfo_get_reserved_mem();
+    struct bootmodules *mods = &bootinfo.modules;
+    struct bootcmdlines *cmds = &bootinfo.cmdlines;
+    unsigned int i;
+
+    for ( i = 0; i < mi->nr_banks; i++ )
+        printk("RAM: %"PRIpaddr" - %"PRIpaddr"\n",
+                mi->bank[i].start,
+                mi->bank[i].start + mi->bank[i].size - 1);
+    printk("\n");
+    for ( i = 0 ; i < mods->nr_mods; i++ )
+        printk("MODULE[%d]: %"PRIpaddr" - %"PRIpaddr" %-12s\n",
+                i,
+                mods->module[i].start,
+                mods->module[i].start + mods->module[i].size,
+                boot_module_kind_as_string(mods->module[i].kind));
+
+    for ( i = 0; i < mem_resv->nr_banks; i++ )
+    {
+        printk(" RESVD[%u]: %"PRIpaddr" - %"PRIpaddr"\n", i,
+               mem_resv->bank[i].start,
+               mem_resv->bank[i].start + mem_resv->bank[i].size - 1);
+    }
+#ifdef CONFIG_STATIC_SHM
+    early_print_info_shmem();
+#endif
+    printk("\n");
+    for ( i = 0 ; i < cmds->nr_mods; i++ )
+        printk("CMDLINE[%"PRIpaddr"]:%s %s\n", cmds->cmdline[i].start,
+               cmds->cmdline[i].dt_name,
+               &cmds->cmdline[i].cmdline[0]);
+    printk("\n");
+}
+
+/* This function assumes that memory regions are not overlapped */
+static int __init cmp_memory_node(const void *key, const void *elem)
+{
+    const struct membank *handler0 = key;
+    const struct membank *handler1 = elem;
+
+    if ( handler0->start < handler1->start )
+        return -1;
+
+    if ( handler0->start >= (handler1->start + handler1->size) )
+        return 1;
+
+    return 0;
+}
+
+static void __init swap_memory_node(void *_a, void *_b, size_t size)
+{
+    struct membank *a = _a, *b = _b;
+
+    SWAP(*a, *b);
+}
+
+/**
+ * boot_fdt_info - initialize bootinfo from a DTB
+ * @fdt: flattened device tree binary
+ *
+ * Returns the size of the DTB.
+ */
+size_t __init boot_fdt_info(const void *fdt, paddr_t paddr)
+{
+    struct membanks *reserved_mem = bootinfo_get_reserved_mem();
+    struct membanks *mem = bootinfo_get_mem();
+    unsigned int i;
+    int nr_rsvd;
+    int ret;
+
+    ret = fdt_check_header(fdt);
+    if ( ret < 0 )
+        panic("No valid device tree\n");
+
+    add_boot_module(BOOTMOD_FDT, paddr, fdt_totalsize(fdt), false);
+
+    nr_rsvd = fdt_num_mem_rsv(fdt);
+    if ( nr_rsvd < 0 )
+        panic("Parsing FDT memory reserve map failed (%d)\n", nr_rsvd);
+
+    for ( i = 0; i < nr_rsvd; i++ )
+    {
+        struct membank *bank;
+        paddr_t s, sz;
+
+        if ( fdt_get_mem_rsv_paddr(device_tree_flattened, i, &s, &sz) < 0 )
+            continue;
+
+        if ( reserved_mem->nr_banks < reserved_mem->max_banks )
+        {
+            bank = &reserved_mem->bank[reserved_mem->nr_banks];
+            bank->start = s;
+            bank->size = sz;
+            bank->type = MEMBANK_FDT_RESVMEM;
+            reserved_mem->nr_banks++;
+        }
+        else
+            panic("Cannot allocate reserved memory bank\n");
+    }
+
+    ret = device_tree_for_each_node(fdt, 0, early_scan_node, NULL);
+    if ( ret )
+        panic("Early FDT parsing failed (%d)\n", ret);
+
+    /*
+     * On Arm64 setup_directmap_mappings() expects to be called with the lowest
+     * bank in memory first. There is no requirement that the DT will provide
+     * the banks sorted in ascending order. So sort them through.
+     */
+    sort(mem->bank, mem->nr_banks, sizeof(struct membank),
+         cmp_memory_node, swap_memory_node);
+
+    early_print_info();
+
+    return fdt_totalsize(fdt);
+}
+
+const __init char *boot_fdt_cmdline(const void *fdt)
+{
+    int node;
+    const struct fdt_property *prop;
+
+    node = fdt_path_offset(fdt, "/chosen");
+    if ( node < 0 )
+        return NULL;
+
+    prop = fdt_get_property(fdt, node, "xen,xen-bootargs", NULL);
+    if ( prop == NULL )
+    {
+        struct bootcmdline *dom0_cmdline =
+            boot_cmdline_find_by_kind(BOOTMOD_KERNEL);
+
+        if (fdt_get_property(fdt, node, "xen,dom0-bootargs", NULL) ||
+            ( dom0_cmdline && dom0_cmdline->cmdline[0] ) )
+            prop = fdt_get_property(fdt, node, "bootargs", NULL);
+    }
+    if ( prop == NULL )
+        return NULL;
+
+    return prop->data;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h
index c39428d5f5..16fa05f38f 100644
--- a/xen/include/xen/bootfdt.h
+++ b/xen/include/xen/bootfdt.h
@@ -157,6 +157,20 @@ struct bootinfo {
 
 extern struct bootinfo bootinfo;
 
+bool check_reserved_regions_overlap(paddr_t region_start,
+                                    paddr_t region_size);
+
+struct bootmodule *add_boot_module(bootmodule_kind kind,
+                                   paddr_t start, paddr_t size, bool domU);
+struct bootmodule *boot_module_find_by_kind(bootmodule_kind kind);
+struct bootmodule * boot_module_find_by_addr_and_kind(bootmodule_kind kind,
+                                                             paddr_t start);
+void add_boot_cmdline(const char *name, const char *cmdline,
+                      bootmodule_kind kind, paddr_t start, bool domU);
+struct bootcmdline *boot_cmdline_find_by_kind(bootmodule_kind kind);
+struct bootcmdline * boot_cmdline_find_by_name(const char *name);
+const char *boot_module_kind_as_string(bootmodule_kind kind);
+
 void populate_boot_allocator(void);
 
 size_t boot_fdt_info(const void *fdt, paddr_t paddr);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 07 17:23:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Aug 2024 17:23:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773622.1184079 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbkNV-0003TY-5h; Wed, 07 Aug 2024 17:23:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773622.1184079; Wed, 07 Aug 2024 17:23: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 1sbkNV-0003TQ-2o; Wed, 07 Aug 2024 17:23:13 +0000
Received: by outflank-mailman (input) for mailman id 773622;
 Wed, 07 Aug 2024 17:23:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkNU-0003TH-HY
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:23:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkNU-000053-GO
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:23:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkNU-0003Jr-Fb
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:23:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rZoeJcEw0nM2YcCZ63TZKOSXd9Hm08wr/fcLi+c6R/s=; b=gpWEdHYgMQt0nI/S89K3dAm2hT
	0CVhm6CqYBe48bGvOIC1DWqBHPvKMtgsoQeUbMa0xsFVYJkKUzbpx409zc7SYs/0i/4nE+9FhL59d
	TrLdxvjus9GeaxeuBam9YnmfxRZwyBtPAPATgvxn/RPXNld6lZk6CYP4Lg1dBCgngNk8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: vITS: add #msi-cells property
Message-Id: <E1sbkNU-0003Jr-Fb@xenbits.xenproject.org>
Date: Wed, 07 Aug 2024 17:23:12 +0000

commit 2dbb61001b335c8f980b39ef9fa05fe5b2bca3e6
Author:     Stewart Hildebrand <stewart.hildebrand@amd.com>
AuthorDate: Fri Aug 2 14:26:52 2024 -0400
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Tue Aug 6 19:11:50 2024 +0100

    xen/arm: vITS: add #msi-cells property
    
    Non-PCI platform devices may use the ITS. Dom0 Linux drivers for such
    devices are failing to register IRQs due to a missing #msi-cells
    property. Add the missing #msi-cells property.
    
    Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Rahul Singh <rahul.singh@arm.com>
---
 xen/arch/arm/gic-v3-its.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
index 8afcd9783b..55bed3fe87 100644
--- a/xen/arch/arm/gic-v3-its.c
+++ b/xen/arch/arm/gic-v3-its.c
@@ -951,6 +951,10 @@ int gicv3_its_make_hwdom_dt_nodes(const struct domain *d,
         if ( res )
             return res;
 
+        res = fdt_property_cell(fdt, "#msi-cells", 1);
+        if ( res )
+            return res;
+
         if ( its->phandle )
         {
             res = fdt_property_cell(fdt, "phandle", its->phandle);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 07 17:23:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Aug 2024 17:23:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773623.1184083 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbkNf-0003WZ-6u; Wed, 07 Aug 2024 17:23:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773623.1184083; Wed, 07 Aug 2024 17:23: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 1sbkNf-0003WR-4I; Wed, 07 Aug 2024 17:23:23 +0000
Received: by outflank-mailman (input) for mailman id 773623;
 Wed, 07 Aug 2024 17:23:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkNe-0003WL-KA
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:23:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkNe-00005E-JK
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:23:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkNe-0003MD-IS
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:23:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DQjgVjpEBmYIQ5Qv/CBfVqHN/occW4WFhurXk2jU8vQ=; b=ndVFFlyxRB85PaCuxDYgDQHPhE
	Qpc9Jg3ZdhfwrmqHSLQZ2ph2EOJ5Jcds1La7huL8tcrEJrnTmU4P/bjOBkuCPrucA7YjPNDWMM/Vj
	W5IhppYJC326NU3F2x11EF1Mp5j6tz9/LHG9i8wW6ocPCiI/IsHimoz62WHWkNuaiSFY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: fix eclair gitlab jobs for merge requests
Message-Id: <E1sbkNe-0003MD-IS@xenbits.xenproject.org>
Date: Wed, 07 Aug 2024 17:23:22 +0000

commit 449caecbdfa3f423eae46a53822b7e403607cfee
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Mon Aug 5 14:24:23 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Aug 6 12:29:05 2024 -0700

    automation: fix eclair gitlab jobs for merge requests
    
    The "eclair" script calls action_push.sh even for merge request, while
    instead action_pull_request.sh should be called, resulting in a job
    failure with this error:
    
    Unexpected event pull_request
    
    Fix the script to call action_pull_request.sh appropriately.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Simone Ballarin <simone.ballarin@bugseng.com>
---
 automation/eclair_analysis/ECLAIR/action_pull_request.sh |  2 +-
 automation/scripts/eclair                                | 13 ++++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/action_pull_request.sh b/automation/eclair_analysis/ECLAIR/action_pull_request.sh
old mode 100644
new mode 100755
index 68f7e6282e..812238e07f
--- a/automation/eclair_analysis/ECLAIR/action_pull_request.sh
+++ b/automation/eclair_analysis/ECLAIR/action_pull_request.sh
@@ -3,7 +3,7 @@
 set -eu
 
 usage() {
-    echo "Usage: $0 WTOKEN ANALYSIS_OUTPUT_DIR COMMIT_ID" >&2
+    echo "Usage: $0 WTOKEN ANALYSIS_OUTPUT_DIR" >&2
     exit 2
 }
 
diff --git a/automation/scripts/eclair b/automation/scripts/eclair
index ebcaf09b54..3ec760bab8 100755
--- a/automation/scripts/eclair
+++ b/automation/scripts/eclair
@@ -21,5 +21,16 @@ ex=0
 # Fail in case of new reports for clean guidelines
 "${ECLAIR_DIR}/action_check_clean_regressions.sh" "${ECLAIR_OUTPUT_DIR}" || ex=$?
 
-"${ECLAIR_DIR}/action_push.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}"
+case "${CI_PIPELINE_SOURCE}" in
+merge_request_event)
+    "${ECLAIR_DIR}/action_pull_request.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}"
+    ;;
+push | pipeline | web | schedule)
+    "${ECLAIR_DIR}/action_push.sh" "${WTOKEN}" "${ECLAIR_OUTPUT_DIR}"
+    ;;
+*)
+    echo "Unexpected event ${CI_PIPELINE_SOURCE}" >&2
+    ex=1
+    ;;
+esac
 [ "${ex}" = 0 ] || exit "${ex}"
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 07 17:23:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Aug 2024 17:23:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773624.1184086 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbkNp-0003ZA-8H; Wed, 07 Aug 2024 17:23:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773624.1184086; Wed, 07 Aug 2024 17:23: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 1sbkNp-0003Z2-5j; Wed, 07 Aug 2024 17:23:33 +0000
Received: by outflank-mailman (input) for mailman id 773624;
 Wed, 07 Aug 2024 17:23:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkNo-0003Yw-My
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:23:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkNo-00005f-M7
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:23:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkNo-0003Ml-LP
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:23:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MwjI2xQlRDVuIHvxLRY+YgbKUHq2QjGds+Zl6OeUHt4=; b=pc3/bgOHAWFzlQdR91VvvxfhJg
	jVgNnhU30I4A8+OtbuLY3CuEyzZlJKOdj+AovmSNceE36ZbzsQjpcSPtB+kAi4qYdJ4lXXR7JYxeD
	DDaO/bSxrTAFZPoSKFGYjQ94HyBx63g2BODF58NDxhr8COnlkpLpuVQ/T8FdSHyKOce8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation/eclair: sort monitored guidelines with -V
Message-Id: <E1sbkNo-0003Ml-LP@xenbits.xenproject.org>
Date: Wed, 07 Aug 2024 17:23:32 +0000

commit e03cea171a5f60d7370aae28891587817c407ff4
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Mon Aug 5 11:34:32 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Aug 6 12:30:17 2024 -0700

    automation/eclair: sort monitored guidelines with -V
    
    To improve readability, sort guidelines with -V.
    
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/monitored.ecl | 92 ++++++++++++-------------
 1 file changed, 46 insertions(+), 46 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/monitored.ecl b/automation/eclair_analysis/ECLAIR/monitored.ecl
index 8a7e3f3cea..7b085a329a 100644
--- a/automation/eclair_analysis/ECLAIR/monitored.ecl
+++ b/automation/eclair_analysis/ECLAIR/monitored.ecl
@@ -2,58 +2,17 @@
 -enable=MC3R1.D1.1
 -enable=MC3R1.D2.1
 -enable=MC3R1.D4.1
+-enable=MC3R1.D4.3
+-enable=MC3R1.D4.7
 -enable=MC3R1.D4.10
 -enable=MC3R1.D4.11
 -enable=MC3R1.D4.12
 -enable=MC3R1.D4.14
--enable=MC3R1.D4.3
--enable=MC3R1.D4.7
--enable=MC3R1.R10.1
--enable=MC3R1.R10.2
 -enable=MC3R1.R1.1
--enable=MC3R1.R11.1
--enable=MC3R1.R11.7
--enable=MC3R1.R11.8
--enable=MC3R1.R11.9
--enable=MC3R1.R12.5
 -enable=MC3R1.R1.3
--enable=MC3R1.R13.6
--enable=MC3R1.R13.1
 -enable=MC3R1.R1.4
--enable=MC3R1.R14.1
--enable=MC3R1.R14.4
--enable=MC3R1.R16.2
--enable=MC3R1.R16.3
--enable=MC3R1.R16.4
--enable=MC3R1.R16.6
--enable=MC3R1.R16.7
--enable=MC3R1.R17.1
--enable=MC3R1.R17.3
--enable=MC3R1.R17.4
--enable=MC3R1.R17.5
--enable=MC3R1.R17.6
--enable=MC3R1.R18.6
--enable=MC3R1.R19.1
--enable=MC3R1.R20.12
--enable=MC3R1.R20.13
--enable=MC3R1.R20.14
--enable=MC3R1.R20.4
--enable=MC3R1.R20.7
--enable=MC3R1.R20.9
 -enable=MC3R1.R2.1
--enable=MC3R1.R21.10
--enable=MC3R1.R21.13
--enable=MC3R1.R21.17
--enable=MC3R1.R21.18
--enable=MC3R1.R21.19
--enable=MC3R1.R21.20
--enable=MC3R1.R21.21
--enable=MC3R1.R21.9
 -enable=MC3R1.R2.2
--enable=MC3R1.R22.2
--enable=MC3R1.R22.4
--enable=MC3R1.R22.5
--enable=MC3R1.R22.6
 -enable=MC3R1.R2.6
 -enable=MC3R1.R3.1
 -enable=MC3R1.R3.2
@@ -72,32 +31,73 @@
 -enable=MC3R1.R7.3
 -enable=MC3R1.R7.4
 -enable=MC3R1.R8.1
--enable=MC3R1.R8.10
--enable=MC3R1.R8.12
--enable=MC3R1.R8.14
 -enable=MC3R1.R8.2
 -enable=MC3R1.R8.3
 -enable=MC3R1.R8.4
 -enable=MC3R1.R8.5
 -enable=MC3R1.R8.6
 -enable=MC3R1.R8.8
+-enable=MC3R1.R8.10
+-enable=MC3R1.R8.12
+-enable=MC3R1.R8.14
 -enable=MC3R1.R9.2
 -enable=MC3R1.R9.3
 -enable=MC3R1.R9.4
 -enable=MC3R1.R9.5
+-enable=MC3R1.R10.1
+-enable=MC3R1.R10.2
+-enable=MC3R1.R11.1
+-enable=MC3R1.R11.7
+-enable=MC3R1.R11.8
+-enable=MC3R1.R11.9
+-enable=MC3R1.R12.5
+-enable=MC3R1.R13.1
+-enable=MC3R1.R13.6
+-enable=MC3R1.R14.1
+-enable=MC3R1.R14.4
+-enable=MC3R1.R16.2
+-enable=MC3R1.R16.3
+-enable=MC3R1.R16.4
+-enable=MC3R1.R16.6
+-enable=MC3R1.R16.7
+-enable=MC3R1.R17.1
+-enable=MC3R1.R17.3
+-enable=MC3R1.R17.4
+-enable=MC3R1.R17.5
+-enable=MC3R1.R17.6
+-enable=MC3R1.R18.6
 -enable=MC3R1.R18.8
+-enable=MC3R1.R19.1
 -enable=MC3R1.R20.2
 -enable=MC3R1.R20.3
+-enable=MC3R1.R20.4
 -enable=MC3R1.R20.6
+-enable=MC3R1.R20.7
+-enable=MC3R1.R20.9
 -enable=MC3R1.R20.11
+-enable=MC3R1.R20.12
+-enable=MC3R1.R20.13
+-enable=MC3R1.R20.14
 -enable=MC3R1.R21.3
 -enable=MC3R1.R21.4
 -enable=MC3R1.R21.5
 -enable=MC3R1.R21.7
 -enable=MC3R1.R21.8
+-enable=MC3R1.R21.9
+-enable=MC3R1.R21.10
 -enable=MC3R1.R21.12
+-enable=MC3R1.R21.13
+-enable=MC3R1.R21.17
+-enable=MC3R1.R21.18
+-enable=MC3R1.R21.19
+-enable=MC3R1.R21.20
+-enable=MC3R1.R21.21
 -enable=MC3R1.R22.1
+-enable=MC3R1.R22.2
 -enable=MC3R1.R22.3
+-enable=MC3R1.R22.4
+-enable=MC3R1.R22.5
+-enable=MC3R1.R22.6
 -enable=MC3R1.R22.7
 -enable=MC3R1.R22.8
 -enable=MC3R1.R22.9
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 07 17:23:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 07 Aug 2024 17:23:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773625.1184091 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sbkNz-0003c4-9v; Wed, 07 Aug 2024 17:23:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773625.1184091; Wed, 07 Aug 2024 17:23: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 1sbkNz-0003bu-7E; Wed, 07 Aug 2024 17:23:43 +0000
Received: by outflank-mailman (input) for mailman id 773625;
 Wed, 07 Aug 2024 17:23:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkNy-0003bn-PW
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:23:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkNy-00005q-On
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:23:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sbkNy-0003NK-OC
 for xen-changelog@lists.xenproject.org; Wed, 07 Aug 2024 17:23:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Msb7zKHC60C+Z8veKOYGmOyBa8MHmmmpG5MgYYipRbo=; b=bEAaM1Nn0Puo13yXsVSB8xza/G
	06Z5StxZ27A7FWC0trv83LV/qe2mgKeDJxWwmIVEZmmt0euZNYWSIaf7PfBMtlhz1J8gM8EDqhSJ5
	lAr3PD1OTC9VE71lhuwILQgeEi03M73+L6SgaMDGm9/Gph9B6inVjH8nEDFthprAPJQw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation/eclair: tag more guidelines as clean
Message-Id: <E1sbkNy-0003NK-OC@xenbits.xenproject.org>
Date: Wed, 07 Aug 2024 17:23:42 +0000

commit 6b9b96ddebf269579730ff2a65f324505bc2aba9
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Mon Aug 5 11:34:33 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Aug 6 12:30:17 2024 -0700

    automation/eclair: tag more guidelines as clean
    
    Tag more of the accepted guidelines as clean to avoid regressions.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/tagging.ecl | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index e7b32773e6..4d0ac94848 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -56,11 +56,14 @@ MC3R1.R9.3||
 MC3R1.R9.4||
 MC3R1.R9.5||
 MC3R1.R10.2||
+MC3R1.R11.6||
 MC3R1.R11.7||
 MC3R1.R11.9||
 MC3R1.R12.5||
 MC3R1.R14.1||
+MC3R1.R14.3||
 MC3R1.R14.4||
+MC3R1.R16.2||
 MC3R1.R16.7||
 MC3R1.R17.1||
 MC3R1.R17.3||
@@ -85,6 +88,7 @@ MC3R1.R21.7||
 MC3R1.R21.8||
 MC3R1.R21.9||
 MC3R1.R21.10||
+MC3R1.R21.11||
 MC3R1.R21.12||
 MC3R1.R21.13||
 MC3R1.R21.19||
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 11:33:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 11:33:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773919.1184342 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1OE-0002P0-Cd; Thu, 08 Aug 2024 11:33:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773919.1184342; Thu, 08 Aug 2024 11:33: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 1sc1OE-0002Os-AA; Thu, 08 Aug 2024 11:33:06 +0000
Received: by outflank-mailman (input) for mailman id 773919;
 Thu, 08 Aug 2024 11:33:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1OC-0002Om-Kj
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 11:33:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1OC-0006dN-40
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 11:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1OC-0000IL-1M
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 11:33: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xyaC5N5q0Ytayf+oPXy4keVeFdTDhbM1b8ATBk68w4k=; b=PeVTnoY+UVf0J4lRy8fyaTYgyE
	8z8rl4ONq3o3WU+tmiifKhPdgSNBMJ3xUgPBlmodaAor7BQikaZl+ajm/29MQZqYzfK5eBcD447zE
	XM9/xQobydbJdsOCHC3bDSZ0HIBiRgVk+o88qWT5bo1jcS7DxQCj52nYh3eJ1Qlt3kOA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul: avoid UB shift in AVX512 VPMOV* handling
Message-Id: <E1sc1OC-0000IL-1M@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 11:33:04 +0000

commit c24615500062eb63f1cfd208c234df5268a880e0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 8 13:26:38 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:26:38 2024 +0200

    x86emul: avoid UB shift in AVX512 VPMOV* handling
    
    For widening and narrowing moves, operand (vector) size is calculated
    from a table. This calculation, for the AVX512 cases, lives ahead of
    validation of EVEX.L'L (which cannot be 3 without raising #UD). Account
    for the later checking by adjusting the constants in the expression such
    that even EVEX.L'L == 3 will yield a non-UB shift (read: shift count
    reliably >= 0).
    
    Fixes: 3988beb08 ("x86emul: support AVX512{F,BW} zero- and sign-extending moves")
    Oss-fuzz: 70914
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index bf388b7b1e..f0829a19d4 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -5788,7 +5788,7 @@ x86_emulate(
             d = DstMem | SrcReg | TwoOp;
         }
         generate_exception_if(evex.brs, X86_EXC_UD);
-        op_bytes = 32 >> (pmov_convert_delta[b & 7] + 1 - evex.lr);
+        op_bytes = 64 >> (pmov_convert_delta[b & 7] + 2 - evex.lr);
         elem_bytes = (b & 7) < 3 ? 1 : (b & 7) != 5 ? 2 : 4;
         goto avx512f_no_sae;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 11:33:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 11:33:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773920.1184347 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1ON-0002Qm-EB; Thu, 08 Aug 2024 11:33:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773920.1184347; Thu, 08 Aug 2024 11:33: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 1sc1ON-0002Qf-BX; Thu, 08 Aug 2024 11:33:15 +0000
Received: by outflank-mailman (input) for mailman id 773920;
 Thu, 08 Aug 2024 11:33:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1OM-0002QV-8X
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 11:33:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1OM-0006dT-7W
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 11:33:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1OM-0000KO-6Q
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 11:33: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XU75ckJzwhKdpKBMUYtRRECRXr+YFSkKWm0hT4jjack=; b=cUcooRXurAFy6NiK0mHVXJAPj0
	Gjcqz08iN+SCsfgYuCMmIxPvXqXxuXHeuGIwFfSfocvR82ls7b8/hjMed7gyCH83ZiEoXwqVYYncs
	JhV6yTXe1FTL4jdgmBn1f1CgjaO3E/+Y2uPfKRpYlH3KUHq6p6ZRnA2WZe4QV66PlJ6Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul: adjust 2nd param of idiv_dbl()
Message-Id: <E1sc1OM-0000KO-6Q@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 11:33:14 +0000

commit ef31716a57e6c29ba14b4f009e9a67277c8117a8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 8 13:27:25 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:27:25 2024 +0200

    x86emul: adjust 2nd param of idiv_dbl()
    
    -LONG_MIN cannot be represented in a long and hence is UB, for being one
    larger than LONG_MAX.
    
    The caller passing an unsigned long and the 1st param also being (array
    of) unsigned long, change the 2nd param accordingly while adding the
    sole necessary cast. This was the original form of the function anyway.
    
    Fixes: 5644ce014223 ("x86emul: relax asm() constraints")
    Oss-fuzz: 70923
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index f0829a19d4..a0deafbd3b 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -607,9 +607,9 @@ static bool div_dbl(unsigned long u[2], unsigned long v)
  * NB. We don't use idiv directly as it's moderately hard to work out
  *     ahead of time whether it will #DE, which we cannot allow to happen.
  */
-static bool idiv_dbl(unsigned long u[2], long v)
+static bool idiv_dbl(unsigned long u[2], unsigned long v)
 {
-    bool negu = (long)u[1] < 0, negv = v < 0;
+    bool negu = (long)u[1] < 0, negv = (long)v < 0;
 
     /* u = abs(u) */
     if ( negu )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 11:33:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 11:33:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773921.1184352 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1OX-0002Tm-Fg; Thu, 08 Aug 2024 11:33:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773921.1184352; Thu, 08 Aug 2024 11:33: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 1sc1OX-0002Te-Cw; Thu, 08 Aug 2024 11:33:25 +0000
Received: by outflank-mailman (input) for mailman id 773921;
 Thu, 08 Aug 2024 11:33:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1OW-0002TM-CO
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 11:33:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1OW-0006de-Ba
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 11:33:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1OW-0000L8-9e
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 11:33: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hMvSiI0M/Yh2w9Wg2+alZQFJzhP0WO1cFMfjTEfYxF8=; b=xVapUUgmK04a2Z7c4k0nL1iDJd
	jIcsFwxuXBq2ZGk5LiY8DSehVoh3+8X3DTRzGiNNzvW9dHHUc9K5zI8o/HlYBlRrCLax2si2gs7uH
	9b7k4nQ2s2RjoIxSyLPCVKYYc5TteQIq9F7REJ32+BhIlXFMVQMXLnaVe0U5PIb6MPBE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/emul: Fix misaligned IO breakpoint behaviour in PV guests
Message-Id: <E1sc1OW-0000L8-9e@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 11:33:24 +0000

commit 08aacc392d86d4c7dbebdb5e664060ae2af72057
Author:     Matthew Barnes <matthew.barnes@cloud.com>
AuthorDate: Thu Aug 8 13:27:50 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:27:50 2024 +0200

    x86/emul: Fix misaligned IO breakpoint behaviour in PV guests
    
    When hardware breakpoints are configured on misaligned IO ports, the
    hardware will mask the addresses based on the breakpoint width during
    comparison.
    
    For PV guests, misaligned IO breakpoints do not behave the same way, and
    therefore yield different results.
    
    This patch tweaks the emulation of IO breakpoints for PV guests such
    that they reproduce the same behaviour as hardware.
    
    Fixes: bec9e3205018 ("x86: emulate I/O port access breakpoints")
    Signed-off-by: Matthew Barnes <matthew.barnes@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/pv/emul-priv-op.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index f101510a1b..aa11ecadaa 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -346,6 +346,8 @@ static unsigned int check_guest_io_breakpoint(struct vcpu *v,
         case DR_LEN_8: width = 8; break;
         }
 
+        start &= ~(width - 1UL);
+
         if ( (start < (port + len)) && ((start + width) > port) )
             match |= 1u << i;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:00:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:00:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773926.1184355 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1oL-0006zd-9U; Thu, 08 Aug 2024 12:00:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773926.1184355; Thu, 08 Aug 2024 12:00: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 1sc1oL-0006zB-6g; Thu, 08 Aug 2024 12:00:05 +0000
Received: by outflank-mailman (input) for mailman id 773926;
 Thu, 08 Aug 2024 12:00:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1oJ-0006gc-ND
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:00:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1oJ-000767-Hp
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:00:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1oJ-0002Ot-EZ
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=F0BDyIa2HTggXuFaPOMWo+obkqmXslh7+ToXf7phS3M=; b=zKtSoRB2APY4Y9DJ+Qw2tac2Ae
	QYRVc2YfLn16TmO2kcYX86pt3/7NOOtjrPuI8fysx9b+cxL5EpZpMGy6Hjvkau/r+7soWm7BZwWbD
	zhTf0mXOF30HwAFO/jMatJWFHZlkxSUv1lB4WTQCrAOlntrRoBgYm2saX5ahXN5hrYqg=;
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.1-pre
Message-Id: <E1sc1oJ-0002Ot-EZ@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:00:03 +0000

commit f97db9b3bc3deac4eead160106a3f6de2ccce81d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 8 13:43:19 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:43:19 2024 +0200

    update Xen version to 4.19.1-pre
---
 Config.mk    |   2 --
 MAINTAINERS  | 106 +++++------------------------------------------------------
 xen/Makefile |   2 +-
 3 files changed, 10 insertions(+), 100 deletions(-)

diff --git a/Config.mk b/Config.mk
index ac8fb847ce..03a89624c7 100644
--- a/Config.mk
+++ b/Config.mk
@@ -234,8 +234,6 @@ ETHERBOOT_NICS ?= rtl8139 8086100e
 
 QEMU_TRADITIONAL_URL ?= https://xenbits.xen.org/git-http/qemu-xen-traditional.git
 QEMU_TRADITIONAL_REVISION ?= xen-4.19.0
-# Wed Jul 15 10:01:40 2020 +0100
-# qemu-trad: remove Xen path dependencies
 
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
diff --git a/MAINTAINERS b/MAINTAINERS
index 2b0c894527..fe81ed63ad 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -54,6 +54,15 @@ list. Remember to copy the appropriate stable branch maintainer who
 will be listed in this section of the MAINTAINERS file in the
 appropriate branch.
 
+The maintainer for this branch is:
+
+	Jan Beulich <jbeulich@suse.com>
+
+Tools backport requests should also be copied to:
+
+       Anthony Perard <anthony.perard@citrix.com>
+
+
 	Unstable Subsystem Maintainers
 	==============================
 
@@ -104,103 +113,6 @@ Descriptions of section entries:
 	   xen-maintainers-<version format number of this file>
 
 
-	Check-in policy
-	===============
-
-In order for a patch to be checked in, in general, several conditions
-must be met:
-
-1. In order to get a change to a given file committed, it must have
-   the approval of at least one maintainer of that file.
-
-   A patch of course needs Acks from the maintainers of each file that
-   it changes; so a patch which changes xen/arch/x86/traps.c,
-   xen/arch/x86/mm/p2m.c, and xen/arch/x86/mm/shadow/multi.c would
-   require an Ack from each of the three sets of maintainers.
-
-   See below for rules on nested maintainership.
-
-2. Each change must have appropriate approval from someone other than
-   the person who wrote it.  This can be either:
-
-  a. An Acked-by from a maintainer of the code being touched (a
-     co-maintainer if available, or a more general level maintainer if
-     not available; see the secton on nested maintainership)
-
-  b. A Reviewed-by by anyone of suitable stature in the community
-
-3. Sufficient time must have been given for anyone to respond.  This
-   depends in large part upon the urgency and nature of the patch.
-   For a straightforward uncontroversial patch, a day or two may be
-   sufficient; for a controversial patch, a week or two may be better.
-
-4. There must be no "open" objections.
-
-In a case where one person submits a patch and a maintainer gives an
-Ack, the Ack stands in for both the approval requirement (#1) and the
-Acked-by-non-submitter requirement (#2).
-
-In a case where a maintainer themselves submits a patch, the
-Signed-off-by meets the approval requirement (#1); so a Review
-from anyone in the community suffices for requirement #2.
-
-Before a maintainer checks in their own patch with another community
-member's R-b but no co-maintainer Ack, it is especially important to
-give their co-maintainer opportunity to give feedback, perhaps
-declaring their intention to check it in without their co-maintainers
-ack a day before doing so.
-
-In the case where two people collaborate on a patch, at least one of
-whom is a maintainer -- typically where one maintainer will do an
-early version of the patch, and another maintainer will pick it up and
-revise it -- there should be two Signed-off-by's and one Acked-by or
-Reviewed-by; with the maintainer who did the most recent change
-sending the patch, and an Acked-by or Reviewed-by coming from the
-maintainer who did not most recently edit the patch.  This satisfies
-the requirement #2 because a) the Signed-off-by of the sender approves
-the final version of the patch; including all parts of the patch that
-the sender did not write b) the Reviewed-by approves the final version
-of the patch, including all patches that the reviewer did not write.
-Thus all code in the patch has been approved by someone who did not
-write it.
-
-Maintainers may choose to override non-maintainer objections in the
-case that consensus can't be reached.
-
-As always, no policy can cover all possible situations.  In
-exceptional circumstances, committers may commit a patch in absence of
-one or more of the above requirements, if they are reasonably
-confident that the other maintainers will approve of their decision in
-retrospect.
-
-       The meaning of nesting
-       ======================
-
-Many maintainership areas are "nested": for example, there are entries
-for xen/arch/x86 as well as xen/arch/x86/mm, and even
-xen/arch/x86/mm/shadow; and there is a section at the end called "THE
-REST" which lists all committers.  The meaning of nesting is that:
-
-1. Under normal circumstances, the Ack of the most specific maintainer
-is both necessary and sufficient to get a change to a given file
-committed.  So a change to xen/arch/x86/mm/shadow/multi.c requires the
-the Ack of the xen/arch/x86/mm/shadow maintainer for that part of the
-patch, but would not require the Ack of the xen/arch/x86 maintainer or
-the xen/arch/x86/mm maintainer.
-
-2. In unusual circumstances, a more general maintainer's Ack can stand
-in for or even overrule a specific maintainer's Ack.  Unusual
-circumstances might include:
- - The patch is fixing a high-priority issue causing immediate pain,
- and the more specific maintainer is not available.
- - The more specific maintainer has not responded either to the
- original patch, nor to "pings", within a reasonable amount of time.
- - The more general maintainer wants to overrule the more specific
- maintainer on some issue. (This should be exceptional.)
- - In the case of a disagreement between maintainers, THE REST can
- settle the matter by majority vote.  (This should be very exceptional
- indeed.)
-
 
 Maintainers List (try to look for most precise areas first)
 
diff --git a/xen/Makefile b/xen/Makefile
index 16055101fb..59dac504b3 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 ?= .0$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .1-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 Thu Aug 08 12:00:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:00:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773927.1184359 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1oV-0007Km-Av; Thu, 08 Aug 2024 12:00:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773927.1184359; Thu, 08 Aug 2024 12:00: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 1sc1oV-0007Ke-8A; Thu, 08 Aug 2024 12:00:15 +0000
Received: by outflank-mailman (input) for mailman id 773927;
 Thu, 08 Aug 2024 12:00:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1oT-0007KS-NN
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:00:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1oT-00076B-ME
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:00:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1oT-0002QP-K3
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dXmoRr2qn49naZbN0Vec67g053J/wQ3tgJAm9X0/ivU=; b=tKKZBwVZVVIUD8hnk8ryqOeUO9
	cLZGPaN3K2aNYD5hBWWHF1sohD+rVezypXDix9RLauOEE++Mqa+h4cOf+Lx+t+0zw9KUfYBFppnAB
	IyukqDZ3HNhC03aVtYNmLQlCKWz5ZJ8WPWUX4gQF4n9IDFK1UfL5DprP8FNXvh4+2oiQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] bunzip2: fix rare decompression failure
Message-Id: <E1sc1oT-0002QP-K3@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:00:13 +0000

commit e54077cbca7149c8fa856535b69a4c70dfd48cd2
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Thu Aug 8 13:44:26 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:44:26 2024 +0200

    bunzip2: fix rare decompression failure
    
    The decompression code parses a huffman tree and counts the number of
    symbols for a given bit length.  In rare cases, there may be >= 256
    symbols with a given bit length, causing the unsigned char to overflow.
    This causes a decompression failure later when the code tries and fails to
    find the bit length for a given symbol.
    
    Since the maximum number of symbols is 258, use unsigned short instead.
    
    Fixes: ab77e81f6521 ("x86/dom0: support bzip2 and lzma compressed bzImage payloads")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 303d3ff85c90ee4af4bad4e3b1d4932fa2634d64
    master date: 2024-07-30 11:55:56 +0200
---
 xen/common/bunzip2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/bunzip2.c b/xen/common/bunzip2.c
index 4466426941..79f17162b1 100644
--- a/xen/common/bunzip2.c
+++ b/xen/common/bunzip2.c
@@ -221,7 +221,8 @@ static int __init get_next_block(struct bunzip_data *bd)
 	   RUNB) */
 	symCount = symTotal+2;
 	for (j = 0; j < groupCount; j++) {
-		unsigned char length[MAX_SYMBOLS], temp[MAX_HUFCODE_BITS+1];
+		unsigned char length[MAX_SYMBOLS];
+		unsigned short temp[MAX_HUFCODE_BITS+1];
 		int	minLen,	maxLen, pp;
 		/* Read Huffman code lengths for each symbol.  They're
 		   stored in a way similar to mtf; record a starting
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:00:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:00:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773928.1184362 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1of-0007NC-CH; Thu, 08 Aug 2024 12:00:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773928.1184362; Thu, 08 Aug 2024 12:00: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 1sc1of-0007N5-9i; Thu, 08 Aug 2024 12:00:25 +0000
Received: by outflank-mailman (input) for mailman id 773928;
 Thu, 08 Aug 2024 12:00:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1od-0007Mn-Qp
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:00:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1od-00076M-Q0
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:00:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1od-0002Rf-OX
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Q0oNxZtftTLU9sAVg9krNXNRtIt9jR/40y7xT53TzCU=; b=AK1dqX6AGcyR/jQxB1UnBIc8kT
	k1bP2CGn//iuG6QT3sVOshfCM0XAty6cbHb0U9jEkrTRs08d8AOZ+9WBa3zeHU0FzrsU6n6S1f0iR
	rSnNDtn+LtY6iv4tfYaleUTSJv24nBS56qwqXn0cxf6tiD3TTXemUf8CDuvqkeDgocS8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] XSM/domctl: Fix permission checks on XEN_DOMCTL_createdomain
Message-Id: <E1sc1od-0002Rf-OX@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:00:23 +0000

commit d2ecc1f231b90d4e54394e25a9aef9be42c0d196
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 8 13:44:56 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:44:56 2024 +0200

    XSM/domctl: Fix permission checks on XEN_DOMCTL_createdomain
    
    The XSM checks for XEN_DOMCTL_createdomain are problematic.  There's a split
    between xsm_domctl() called early, and flask_domain_create() called quite late
    during domain construction.
    
    All XSM implementations except Flask have a simple IS_PRIV check in
    xsm_domctl(), and operate as expected when an unprivileged domain tries to
    make a hypercall.
    
    Flask however foregoes any action in xsm_domctl() and defers everything,
    including the simple "is the caller permitted to create a domain" check, to
    flask_domain_create().
    
    As a consequence, when XSM Flask is active, and irrespective of the policy
    loaded, all domains irrespective of privilege can:
    
     * Mutate the global 'rover' variable, used to track the next free domid.
       Therefore, all domains can cause a domid wraparound, and combined with a
       voluntary reboot, choose their own domid.
    
     * Cause a reasonable amount of a domain to be constructed before ultimately
       failing for permission reasons, including the use of settings outside of
       supported limits.
    
    In order to remediate this, pass the ssidref into xsm_domctl() and at least
    check that the calling domain privileged enough to create domains.
    
    Take the opportunity to also fix the sign of the cmd parameter to be unsigned.
    
    This issue has not been assigned an XSA, because Flask is experimental and not
    security supported.
    
    Reported-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    master commit: ee32b9b29af449d38aad0a1b3a81aaae586f5ea7
    master date: 2024-07-30 17:42:17 +0100
---
 xen/arch/x86/mm/paging.c |  2 +-
 xen/common/domctl.c      |  4 +++-
 xen/include/xsm/dummy.h  |  2 +-
 xen/include/xsm/xsm.h    |  7 ++++---
 xen/xsm/flask/hooks.c    | 14 ++++++++++++--
 5 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index bca320fffa..dd47bde5ce 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -767,7 +767,7 @@ long do_paging_domctl_cont(
     if ( d == NULL )
         return -ESRCH;
 
-    ret = xsm_domctl(XSM_OTHER, d, op.cmd);
+    ret = xsm_domctl(XSM_OTHER, d, op.cmd, 0 /* SSIDref not applicable */);
     if ( !ret )
     {
         if ( domctl_lock_acquire() )
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 2c0331bb05..ea16b75910 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -322,7 +322,9 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
         break;
     }
 
-    ret = xsm_domctl(XSM_OTHER, d, op->cmd);
+    ret = xsm_domctl(XSM_OTHER, d, op->cmd,
+                     /* SSIDRef only applicable for cmd == createdomain */
+                     op->u.createdomain.ssidref);
     if ( ret )
         goto domctl_out_unlock_domonly;
 
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index 00d2cbebf2..7956f27a29 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -162,7 +162,7 @@ static XSM_INLINE int cf_check xsm_set_target(
 }
 
 static XSM_INLINE int cf_check xsm_domctl(
-    XSM_DEFAULT_ARG struct domain *d, int cmd)
+    XSM_DEFAULT_ARG struct domain *d, unsigned int cmd, uint32_t ssidref)
 {
     XSM_ASSERT_ACTION(XSM_OTHER);
     switch ( cmd )
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 8dad03fd3d..627c0d2731 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -60,7 +60,7 @@ struct xsm_ops {
     int (*domctl_scheduler_op)(struct domain *d, int op);
     int (*sysctl_scheduler_op)(int op);
     int (*set_target)(struct domain *d, struct domain *e);
-    int (*domctl)(struct domain *d, int cmd);
+    int (*domctl)(struct domain *d, unsigned int cmd, uint32_t ssidref);
     int (*sysctl)(int cmd);
     int (*readconsole)(uint32_t clear);
 
@@ -248,9 +248,10 @@ static inline int xsm_set_target(
     return alternative_call(xsm_ops.set_target, d, e);
 }
 
-static inline int xsm_domctl(xsm_default_t def, struct domain *d, int cmd)
+static inline int xsm_domctl(xsm_default_t def, struct domain *d,
+                             unsigned int cmd, uint32_t ssidref)
 {
-    return alternative_call(xsm_ops.domctl, d, cmd);
+    return alternative_call(xsm_ops.domctl, d, cmd, ssidref);
 }
 
 static inline int xsm_sysctl(xsm_default_t def, int cmd)
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 5e88c71b8e..278ad38c2a 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -663,12 +663,22 @@ static int cf_check flask_set_target(struct domain *d, struct domain *t)
     return rc;
 }
 
-static int cf_check flask_domctl(struct domain *d, int cmd)
+static int cf_check flask_domctl(struct domain *d, unsigned int cmd,
+                                 uint32_t ssidref)
 {
     switch ( cmd )
     {
-    /* These have individual XSM hooks (common/domctl.c) */
     case XEN_DOMCTL_createdomain:
+        /*
+         * There is a later hook too, but at this early point simply check
+         * that the calling domain is privileged enough to create a domain.
+         *
+         * Note that d is NULL because we haven't even allocated memory for it
+         * this early in XEN_DOMCTL_createdomain.
+         */
+        return avc_current_has_perm(ssidref, SECCLASS_DOMAIN, DOMAIN__CREATE, NULL);
+
+    /* These have individual XSM hooks (common/domctl.c) */
     case XEN_DOMCTL_getdomaininfo:
     case XEN_DOMCTL_scheduler_op:
     case XEN_DOMCTL_irq_permission:
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:00:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:00:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773929.1184367 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1op-0007QA-EV; Thu, 08 Aug 2024 12:00:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773929.1184367; Thu, 08 Aug 2024 12:00: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 1sc1op-0007Q2-BE; Thu, 08 Aug 2024 12:00:35 +0000
Received: by outflank-mailman (input) for mailman id 773929;
 Thu, 08 Aug 2024 12:00:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1on-0007Pm-UX
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:00:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1on-00076X-TA
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:00:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1on-0002T5-SD
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5ZIso4PjuttjckJhyx17HNm4ald9pfI84xKL0QDWIWY=; b=0Tbxh78PqFFEKmvXYW0TtC3TmQ
	CrD4+DGW/Tk655ltR9ysGWD8kSNIs6LplIV05iuB1OnHImrRkw42UMMI0maYlE82HbfIxZ9EVSh7X
	LB+GMbboYvhdKu8VEweMr0RGI2pW5ovEectqPL1Z3CWn5DBmqhwWloLz9unc35mXoNVI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/dom0: fix restoring %cr3 and the mapcache override on PV build error
Message-Id: <E1sc1on-0002T5-SD@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:00:33 +0000

commit adf1939b51a0a2fa596f7acca0989bfe56cab307
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Aug 8 13:45:28 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:45:28 2024 +0200

    x86/dom0: fix restoring %cr3 and the mapcache override on PV build error
    
    One of the error paths in the PV dom0 builder section that runs on the guest
    page-tables wasn't restoring the Xen value of %cr3, neither removing the
    mapcache override.
    
    Fixes: 079ff2d32c3d ('libelf-loader: introduce elf_load_image')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 1fc3f77113dd43b14fa7ef5936dcdba120c0b63f
    master date: 2024-07-31 12:41:02 +0200
---
 xen/arch/x86/pv/dom0_build.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index d8043fa58a..57e58a02e7 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -825,6 +825,8 @@ int __init dom0_construct_pv(struct domain *d,
     rc = elf_load_binary(&elf);
     if ( rc < 0 )
     {
+        mapcache_override_current(NULL);
+        switch_cr3_cr4(current->arch.cr3, read_cr4());
         printk("Failed to load the kernel binary\n");
         goto out;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:00:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:00:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773930.1184370 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1oz-0007Sf-FB; Thu, 08 Aug 2024 12:00:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773930.1184370; Thu, 08 Aug 2024 12:00: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 1sc1oz-0007SY-Cj; Thu, 08 Aug 2024 12:00:45 +0000
Received: by outflank-mailman (input) for mailman id 773930;
 Thu, 08 Aug 2024 12:00:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1oy-0007SO-0w
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:00:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1oy-00076x-06
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:00:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1ox-0002U8-VM
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=u6MxmU/kmlWhKPHNqydhjVKWIatM5rWQg0JACkIZQXs=; b=Vf/twY9Gu1q9/jcZjcLXPiUOCK
	rpbVIOysmi4Qg+ayvydNnDeu9UiI+cDiT7z1LzgPYSAT4egwRNe7uWRY7UyaU9npQx4CaUyoRwwgq
	/NIiE4Ql9fXwNEhpZ69M2N2+llGk7aAjBfJNCivQoESLPdWhMOMzmoTDj0Put/uiYXJc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/altcall: further refine clang workaround
Message-Id: <E1sc1ox-0002U8-VM@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:00:43 +0000

commit ee032f29972b8c58db9fcf96650f9cbc083edca8
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Aug 8 13:45:58 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:45:58 2024 +0200

    x86/altcall: further refine clang workaround
    
    The current code in ALT_CALL_ARG() won't successfully workaround the clang
    code-generation issue if the arg parameter has a size that's not a power of 2.
    While there are no such sized parameters at the moment, improve the workaround
    to also be effective when such sizes are used.
    
    Instead of using a union with a long use an unsigned long that's first
    initialized to 0 and afterwards set to the argument value.
    
    Reported-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Suggested-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 561cba38ff551383a628dc93e64ab0691cfc92bf
    master date: 2024-07-31 12:41:22 +0200
---
 xen/arch/x86/include/asm/alternative.h | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/include/asm/alternative.h b/xen/arch/x86/include/asm/alternative.h
index e63b459276..a86eadfaec 100644
--- a/xen/arch/x86/include/asm/alternative.h
+++ b/xen/arch/x86/include/asm/alternative.h
@@ -169,27 +169,25 @@ extern void alternative_branches(void);
 
 #ifdef CONFIG_CC_IS_CLANG
 /*
- * Use a union with an unsigned long in order to prevent clang from
- * skipping a possible truncation of the value.  By using the union any
- * truncation is carried before the call instruction, in turn covering
- * for ABI-non-compliance in that the necessary clipping / extension of
- * the value is supposed to be carried out in the callee.
+ * Clang doesn't follow the psABI and doesn't truncate parameter values at the
+ * callee.  This can lead to bad code being generated when using alternative
+ * calls.
  *
- * Note this behavior is not mandated by the standard, and hence could
- * stop being a viable workaround, or worse, could cause a different set
- * of code-generation issues in future clang versions.
+ * Workaround it by using a temporary intermediate variable that's zeroed
+ * before being assigned the parameter value, as that forces clang to zero the
+ * register at the caller.
  *
  * This has been reported upstream:
  * https://github.com/llvm/llvm-project/issues/12579
  * https://github.com/llvm/llvm-project/issues/82598
  */
 #define ALT_CALL_ARG(arg, n)                                            \
-    register union {                                                    \
-        typeof(arg) e[sizeof(long) / sizeof(arg)];                      \
-        unsigned long r;                                                \
-    } a ## n ## _ asm ( ALT_CALL_arg ## n ) = {                         \
-        .e[0] = ({ BUILD_BUG_ON(sizeof(arg) > sizeof(void *)); (arg); })\
-    }
+    register unsigned long a ## n ## _ asm ( ALT_CALL_arg ## n ) = ({   \
+        unsigned long tmp = 0;                                          \
+        BUILD_BUG_ON(sizeof(arg) > sizeof(unsigned long));              \
+        *(typeof(arg) *)&tmp = (arg);                                   \
+        tmp;                                                            \
+    })
 #else
 #define ALT_CALL_ARG(arg, n) \
     register typeof(arg) a ## n ## _ asm ( ALT_CALL_arg ## n ) = \
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:00:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:00:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773931.1184374 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1p9-0007Va-Go; Thu, 08 Aug 2024 12:00:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773931.1184374; Thu, 08 Aug 2024 12:00: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 1sc1p9-0007VT-EO; Thu, 08 Aug 2024 12:00:55 +0000
Received: by outflank-mailman (input) for mailman id 773931;
 Thu, 08 Aug 2024 12:00:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1p8-0007VE-3i
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:00:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1p8-000778-33
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:00:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1p8-0002V5-2J
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HQhSn4lU+CWzHGCK11LR3HvrYJSUTQP1RHawlFhZ6Mc=; b=v1xcHa9Jah9jF/OcCsERSXNu1y
	QTdD021xZ+kfk4n0HdnjtHN7mNnpAKhNWmr3k/LQhXrKXwgcGCWdwtgEk5PoPQ6nXV37+7hV8IXOy
	nno9Pg0pI7e3UjCAVEGFfh5lSiCsytDBQkNl9VhXt+8Qbmz1cvOuXO7Uda2Prd8ddzag=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] xen/sched: fix error handling in cpu_schedule_up()
Message-Id: <E1sc1p8-0002V5-2J@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:00:54 +0000

commit b37580d5e984770266783b639552a97c36ecb58a
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Aug 8 13:46:21 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:46:21 2024 +0200

    xen/sched: fix error handling in cpu_schedule_up()
    
    In case cpu_schedule_up() is failing, it needs to undo all externally
    visible changes it has done before.
    
    Reason is that cpu_schedule_callback() won't be called with the
    CPU_UP_CANCELED notifier in case cpu_schedule_up() did fail.
    
    Fixes: 207589dbacd4 ("xen/sched: move per cpu scheduler private data into struct sched_resource")
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 44a7d4f0a5e9eae41a44a162e54ff6d2ebe5b7d6
    master date: 2024-07-31 14:50:18 +0200
---
 xen/common/sched/core.c | 63 ++++++++++++++++++++++++++-----------------------
 1 file changed, 33 insertions(+), 30 deletions(-)

diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index d84b65f197..c466711e9e 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -2755,6 +2755,36 @@ static struct sched_resource *sched_alloc_res(void)
     return sr;
 }
 
+static void cf_check sched_res_free(struct rcu_head *head)
+{
+    struct sched_resource *sr = container_of(head, struct sched_resource, rcu);
+
+    free_cpumask_var(sr->cpus);
+    if ( sr->sched_unit_idle )
+        sched_free_unit_mem(sr->sched_unit_idle);
+    xfree(sr);
+}
+
+static void cpu_schedule_down(unsigned int cpu)
+{
+    struct sched_resource *sr;
+
+    rcu_read_lock(&sched_res_rculock);
+
+    sr = get_sched_res(cpu);
+
+    kill_timer(&sr->s_timer);
+
+    cpumask_clear_cpu(cpu, &sched_res_mask);
+    set_sched_res(cpu, NULL);
+
+    /* Keep idle unit. */
+    sr->sched_unit_idle = NULL;
+    call_rcu(&sr->rcu, sched_res_free);
+
+    rcu_read_unlock(&sched_res_rculock);
+}
+
 static int cpu_schedule_up(unsigned int cpu)
 {
     struct sched_resource *sr;
@@ -2794,7 +2824,10 @@ static int cpu_schedule_up(unsigned int cpu)
         idle_vcpu[cpu]->sched_unit->res = sr;
 
     if ( idle_vcpu[cpu] == NULL )
+    {
+        cpu_schedule_down(cpu);
         return -ENOMEM;
+    }
 
     idle_vcpu[cpu]->sched_unit->rendezvous_in_cnt = 0;
 
@@ -2812,36 +2845,6 @@ static int cpu_schedule_up(unsigned int cpu)
     return 0;
 }
 
-static void cf_check sched_res_free(struct rcu_head *head)
-{
-    struct sched_resource *sr = container_of(head, struct sched_resource, rcu);
-
-    free_cpumask_var(sr->cpus);
-    if ( sr->sched_unit_idle )
-        sched_free_unit_mem(sr->sched_unit_idle);
-    xfree(sr);
-}
-
-static void cpu_schedule_down(unsigned int cpu)
-{
-    struct sched_resource *sr;
-
-    rcu_read_lock(&sched_res_rculock);
-
-    sr = get_sched_res(cpu);
-
-    kill_timer(&sr->s_timer);
-
-    cpumask_clear_cpu(cpu, &sched_res_mask);
-    set_sched_res(cpu, NULL);
-
-    /* Keep idle unit. */
-    sr->sched_unit_idle = NULL;
-    call_rcu(&sr->rcu, sched_res_free);
-
-    rcu_read_unlock(&sched_res_rculock);
-}
-
 void sched_rm_cpu(unsigned int cpu)
 {
     int rc;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:01:05 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:01:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773932.1184378 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1pJ-0007Yq-Jo; Thu, 08 Aug 2024 12:01:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773932.1184378; Thu, 08 Aug 2024 12:01: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 1sc1pJ-0007Yi-H8; Thu, 08 Aug 2024 12:01:05 +0000
Received: by outflank-mailman (input) for mailman id 773932;
 Thu, 08 Aug 2024 12:01:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1pI-0007YX-7D
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:01:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1pI-00077T-6N
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:01:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1pI-0002WS-5S
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:01: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VOTWrCur0SakUSKavTYcVftVtdGRAUsFaUjexGI6Fk8=; b=qxjdi7el6gqQMAwhC6NErodF4U
	obiW8Fnxlb0Ybp8k5hefQ8BY/RKRmtWVOUmeh39Xx/DzNJgFJVupFI3zF2Qx11QABaJ2W5wJK/3JZ
	rL5NfzcfxFnEwDsS3CapAXb/tf/QOcCSaceEKKVvMKFaQSFvF1VDfuS1iKzALhmjM3/A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] xen/hvm: Don't skip MSR_READ trace record
Message-Id: <E1sc1pI-0002WS-5S@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:01:04 +0000

commit 97a15007c9606d4c53109754bb21fd593bca589b
Author:     George Dunlap <george.dunlap@cloud.com>
AuthorDate: Thu Aug 8 13:47:02 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:47:02 2024 +0200

    xen/hvm: Don't skip MSR_READ trace record
    
    Commit 37f074a3383 ("x86/msr: introduce guest_rdmsr()") introduced a
    function to combine the MSR_READ handling between PV and HVM.
    Unfortunately, by returning directly, it skipped the trace generation,
    leading to gaps in the trace record, as well as xenalyze errors like
    this:
    
    hvm_generic_postprocess: d2v0 Strange, exit 7c(VMEXIT_MSR) missing a handler
    
    Replace the `return` with `goto out`.
    
    Fixes: 37f074a3383 ("x86/msr: introduce guest_rdmsr()")
    Signed-off-by: George Dunlap <george.dunlap@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: bc8a43fff61ae4162a95d84f4e148d6773667cd2
    master date: 2024-08-02 08:42:09 +0200
---
 xen/arch/x86/hvm/hvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 7f4b627b1f..0fe2b85b16 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3557,7 +3557,7 @@ int hvm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
     fixed_range_base = (uint64_t *)v->arch.hvm.mtrr.fixed_ranges;
 
     if ( (ret = guest_rdmsr(v, msr, msr_content)) != X86EMUL_UNHANDLEABLE )
-        return ret;
+        goto out;
 
     ret = X86EMUL_OKAY;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:01:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:01:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773933.1184383 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1pT-0007bk-LR; Thu, 08 Aug 2024 12:01:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773933.1184383; Thu, 08 Aug 2024 12:01:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1pT-0007bc-Ij; Thu, 08 Aug 2024 12:01:15 +0000
Received: by outflank-mailman (input) for mailman id 773933;
 Thu, 08 Aug 2024 12:01:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1pS-0007bS-BM
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:01:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1pS-00077b-9U
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:01:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1pS-0002Xa-8X
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:01: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ycoLA7IfNkdqdF93T8tEvS04Qc1BBg8FpJGrNJr4+UM=; b=w1AmUwjnV3UgLSuB8Vyry2ghB3
	gm88Ks2w8jDO+1LTZj6ycTvDHwgNHc50LzgpVIycAKknfbVvQqKOTLCbFFJCa77EpyWp284wirCB9
	XASLOZ3wC9cQT5/FwF7BoyudRNzIjaZGi+YOC6+H4g56mDbs3lAmxxdr4JHzXb6vZNKg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] tools/lsevtchn: Use errno macro to handle hypercall error cases
Message-Id: <E1sc1pS-0002Xa-8X@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:01:14 +0000

commit e0e84771b61ed985809d105d8f116d4c520542b0
Author:     Matthew Barnes <matthew.barnes@cloud.com>
AuthorDate: Thu Aug 8 13:47:30 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:47:30 2024 +0200

    tools/lsevtchn: Use errno macro to handle hypercall error cases
    
    Currently, lsevtchn aborts its event channel enumeration when it hits
    an event channel that is owned by Xen.
    
    lsevtchn does not distinguish between different hypercall errors, which
    results in lsevtchn missing potential relevant event channels with
    higher port numbers.
    
    Use the errno macro to distinguish between hypercall errors, and
    continue event channel enumeration if the hypercall error is not
    critical to enumeration.
    
    Signed-off-by: Matthew Barnes <matthew.barnes@cloud.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: e92a453c8db8bba62d6be3006079e2b9990c3978
    master date: 2024-08-02 08:43:57 +0200
---
 tools/xcutils/lsevtchn.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/tools/xcutils/lsevtchn.c b/tools/xcutils/lsevtchn.c
index d1710613dd..30c8d847b8 100644
--- a/tools/xcutils/lsevtchn.c
+++ b/tools/xcutils/lsevtchn.c
@@ -3,6 +3,7 @@
 #include <stdint.h>
 #include <string.h>
 #include <stdio.h>
+#include <errno.h>
 
 #include <xenctrl.h>
 
@@ -24,7 +25,23 @@ int main(int argc, char **argv)
         status.port = port;
         rc = xc_evtchn_status(xch, &status);
         if ( rc < 0 )
-            break;
+        {
+            switch ( errno )
+            {
+            case EACCES: /* Xen-owned evtchn */
+                continue;
+
+            case EINVAL: /* Port enumeration has ended */
+                rc = 0;
+                break;
+
+            default:
+                perror("xc_evtchn_status");
+                rc = 1;
+                break;
+            }
+            goto out;
+        }
 
         if ( status.status == EVTCHNSTAT_closed )
             continue;
@@ -58,7 +75,8 @@ int main(int argc, char **argv)
         printf("\n");
     }
 
+ out:
     xc_interface_close(xch);
 
-    return 0;
+    return rc;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:01:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:01:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773934.1184386 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1pd-0007eB-Mk; Thu, 08 Aug 2024 12:01:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773934.1184386; Thu, 08 Aug 2024 12:01:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1pd-0007e3-KB; Thu, 08 Aug 2024 12:01:25 +0000
Received: by outflank-mailman (input) for mailman id 773934;
 Thu, 08 Aug 2024 12:01:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1pc-0007du-DB
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:01:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1pc-00079J-CR
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:01:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1pc-0002YY-Bg
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:01: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3HuYp9Oh+/p3HEC67ZXE07WxKYferwEBjCIJ9l7T6Ss=; b=UKh/rPhPfPjnVpB9icw/2nXQBL
	hu3vqSJgCXGOqC9yg1xj5upzauGS9KgzqonsTeUVTp5sT4DWXTc8HoL3wFdEJt0cDNGWkDnhRZZzt
	4Gu1jvy2RoSvrRZoiG1D09M+7u7uYGxQJudgXYvJH79jHQCgjgQjUUiEvk1xEsQpGGYU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] 9pfsd: fix release build with old gcc
Message-Id: <E1sc1pc-0002YY-Bg@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:01:24 +0000

commit 8ad5a8c5c36add2eee70a7253da4098ebffdb79b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 8 13:47:44 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:47:44 2024 +0200

    9pfsd: fix release build with old gcc
    
    Being able to recognize that "par" is reliably initialized on the 1st
    loop iteration requires not overly old compilers.
    
    Fixes: 7809132b1a1d ("tools/xen-9pfsd: add 9pfs response generation support")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    master commit: 984cb316cb27b53704c607e640a7dd2763b898ab
    master date: 2024-08-02 08:44:22 +0200
---
 tools/9pfsd/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/9pfsd/io.c b/tools/9pfsd/io.c
index df1be3df7d..468e0241f5 100644
--- a/tools/9pfsd/io.c
+++ b/tools/9pfsd/io.c
@@ -196,7 +196,7 @@ static void fill_buffer_at(void **data, const char *fmt, ...);
 static void vfill_buffer_at(void **data, const char *fmt, va_list ap)
 {
     const char *f;
-    const void *par;
+    const void *par = NULL; /* old gcc */
     const char *str_val;
     const struct p9_qid *qid;
     const struct p9_stat *stat;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:01:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:01:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773935.1184390 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1pn-0007gj-OF; Thu, 08 Aug 2024 12:01:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773935.1184390; Thu, 08 Aug 2024 12:01:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1pn-0007gb-Ld; Thu, 08 Aug 2024 12:01:35 +0000
Received: by outflank-mailman (input) for mailman id 773935;
 Thu, 08 Aug 2024 12:01:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1pm-0007gQ-Fx
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:01:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1pm-00079Q-FH
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:01:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1pm-0002ZT-EZ
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:01: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oA1zRtzApV1WpFtUyd1GHbDVuKqtgALuXEx8MqluvGI=; b=D7SP1rhxzCgKPQC3tLTgTrSuxM
	8ldFU4uW6L8gXTOU4HfZwUpR+MbAFsEaBVU5P5jERWDFzetGhyddpATCNU2oYZpnyOtz4S3V7pMvV
	+oyu3Gj+wxccIkY+39U3+4A5L7l6aJmZ3X4Q3RlGGEZk5Ej381sCfyfRtKjjNkjxbDWY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/emul: Fix misaligned IO breakpoint behaviour in PV guests
Message-Id: <E1sc1pm-0002ZT-EZ@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:01:34 +0000

commit 033060ee6e05f9e86ef1a51674864b55dc15e62c
Author:     Matthew Barnes <matthew.barnes@cloud.com>
AuthorDate: Thu Aug 8 13:48:03 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:48:03 2024 +0200

    x86/emul: Fix misaligned IO breakpoint behaviour in PV guests
    
    When hardware breakpoints are configured on misaligned IO ports, the
    hardware will mask the addresses based on the breakpoint width during
    comparison.
    
    For PV guests, misaligned IO breakpoints do not behave the same way, and
    therefore yield different results.
    
    This patch tweaks the emulation of IO breakpoints for PV guests such
    that they reproduce the same behaviour as hardware.
    
    Fixes: bec9e3205018 ("x86: emulate I/O port access breakpoints")
    Signed-off-by: Matthew Barnes <matthew.barnes@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 08aacc392d86d4c7dbebdb5e664060ae2af72057
    master date: 2024-08-08 13:27:50 +0200
---
 xen/arch/x86/pv/emul-priv-op.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index f101510a1b..aa11ecadaa 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -346,6 +346,8 @@ static unsigned int check_guest_io_breakpoint(struct vcpu *v,
         case DR_LEN_8: width = 8; break;
         }
 
+        start &= ~(width - 1UL);
+
         if ( (start < (port + len)) && ((start + width) > port) )
             match |= 1u << i;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:01:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:01:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773936.1184394 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1py-0007jY-Pd; Thu, 08 Aug 2024 12:01:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773936.1184394; Thu, 08 Aug 2024 12:01:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1py-0007jQ-N8; Thu, 08 Aug 2024 12:01:46 +0000
Received: by outflank-mailman (input) for mailman id 773936;
 Thu, 08 Aug 2024 12:01:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1pw-0007j8-UF
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:01:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1pw-00079s-TW
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:01:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1pw-0002b5-SH
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:01: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/Sc4ecmy3xUoSD3mLzO5o9UnFYoPLJZK1wjxC04aerA=; b=jFhuy8jH5S2eUNdGE5+jen3Smu
	F9VSoMlKZgN1u9f81offS/99Hp96aVvp6uohilgRTVs9bzQxSZIhyPNLJAIm+4jvz/foblIDxlFa1
	2KOSf6hMLLzAyf0RLXEfPGi0sh5Z9khKVISq19KB6FLv6epDycSjBW+VoN+1LNpZnTiA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] bunzip2: fix rare decompression failure
Message-Id: <E1sc1pw-0002b5-SH@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:01:44 +0000

commit b3fc8ffcca50d5a52130734f8a037a580b7c9500
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Thu Aug 8 13:50:36 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:50:36 2024 +0200

    bunzip2: fix rare decompression failure
    
    The decompression code parses a huffman tree and counts the number of
    symbols for a given bit length.  In rare cases, there may be >= 256
    symbols with a given bit length, causing the unsigned char to overflow.
    This causes a decompression failure later when the code tries and fails to
    find the bit length for a given symbol.
    
    Since the maximum number of symbols is 258, use unsigned short instead.
    
    Fixes: ab77e81f6521 ("x86/dom0: support bzip2 and lzma compressed bzImage payloads")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 303d3ff85c90ee4af4bad4e3b1d4932fa2634d64
    master date: 2024-07-30 11:55:56 +0200
---
 xen/common/bunzip2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/bunzip2.c b/xen/common/bunzip2.c
index 4466426941..79f17162b1 100644
--- a/xen/common/bunzip2.c
+++ b/xen/common/bunzip2.c
@@ -221,7 +221,8 @@ static int __init get_next_block(struct bunzip_data *bd)
 	   RUNB) */
 	symCount = symTotal+2;
 	for (j = 0; j < groupCount; j++) {
-		unsigned char length[MAX_SYMBOLS], temp[MAX_HUFCODE_BITS+1];
+		unsigned char length[MAX_SYMBOLS];
+		unsigned short temp[MAX_HUFCODE_BITS+1];
 		int	minLen,	maxLen, pp;
 		/* Read Huffman code lengths for each symbol.  They're
 		   stored in a way similar to mtf; record a starting
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:01:56 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:01:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773937.1184398 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1q8-0007lt-R5; Thu, 08 Aug 2024 12:01:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773937.1184398; Thu, 08 Aug 2024 12:01:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1q8-0007lm-Od; Thu, 08 Aug 2024 12:01:56 +0000
Received: by outflank-mailman (input) for mailman id 773937;
 Thu, 08 Aug 2024 12:01:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1q7-0007lY-15
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:01:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1q7-0007A4-0L
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:01:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1q6-0002bo-Vk
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:01: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bmo1sl+tFd8T8eb6USc+TyBWlE0mOn8S7EaN/CRBLiI=; b=6TpZti1YzEu87l8VqNWlOda5br
	rMlWA8ZyBKsngvp5fzbN7IKoEfRnP6oEZuTDa3LwWHi0uhGCQHZXY/sjcN2cbqpwRS0z7rKuVUkVS
	jLmo3ZEY/6xkNZ9iMit0ZuBqPCiv2AlkjJJoHwsjU+dcY7MI4C8uRFSCCeSh2NkS/Dqg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] XSM/domctl: Fix permission checks on XEN_DOMCTL_createdomain
Message-Id: <E1sc1q6-0002bo-Vk@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:01:54 +0000

commit 98fda0718f79c44e5753e7ef481ca61c8361e234
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 8 13:51:09 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:51:09 2024 +0200

    XSM/domctl: Fix permission checks on XEN_DOMCTL_createdomain
    
    The XSM checks for XEN_DOMCTL_createdomain are problematic.  There's a split
    between xsm_domctl() called early, and flask_domain_create() called quite late
    during domain construction.
    
    All XSM implementations except Flask have a simple IS_PRIV check in
    xsm_domctl(), and operate as expected when an unprivileged domain tries to
    make a hypercall.
    
    Flask however foregoes any action in xsm_domctl() and defers everything,
    including the simple "is the caller permitted to create a domain" check, to
    flask_domain_create().
    
    As a consequence, when XSM Flask is active, and irrespective of the policy
    loaded, all domains irrespective of privilege can:
    
     * Mutate the global 'rover' variable, used to track the next free domid.
       Therefore, all domains can cause a domid wraparound, and combined with a
       voluntary reboot, choose their own domid.
    
     * Cause a reasonable amount of a domain to be constructed before ultimately
       failing for permission reasons, including the use of settings outside of
       supported limits.
    
    In order to remediate this, pass the ssidref into xsm_domctl() and at least
    check that the calling domain privileged enough to create domains.
    
    Take the opportunity to also fix the sign of the cmd parameter to be unsigned.
    
    This issue has not been assigned an XSA, because Flask is experimental and not
    security supported.
    
    Reported-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    master commit: ee32b9b29af449d38aad0a1b3a81aaae586f5ea7
    master date: 2024-07-30 17:42:17 +0100
---
 xen/arch/x86/mm/paging.c |  2 +-
 xen/common/domctl.c      |  4 +++-
 xen/include/xsm/dummy.h  |  2 +-
 xen/include/xsm/xsm.h    |  7 ++++---
 xen/xsm/flask/hooks.c    | 14 ++++++++++++--
 5 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index 34d833251b..3a309bc74b 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -767,7 +767,7 @@ long do_paging_domctl_cont(
     if ( d == NULL )
         return -ESRCH;
 
-    ret = xsm_domctl(XSM_OTHER, d, op.cmd);
+    ret = xsm_domctl(XSM_OTHER, d, op.cmd, 0 /* SSIDref not applicable */);
     if ( !ret )
     {
         if ( domctl_lock_acquire() )
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 505e29c0dc..6cf78d4975 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -318,7 +318,9 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
             return -ESRCH;
     }
 
-    ret = xsm_domctl(XSM_OTHER, d, op->cmd);
+    ret = xsm_domctl(XSM_OTHER, d, op->cmd,
+                     /* SSIDRef only applicable for cmd == createdomain */
+                     op->u.createdomain.ssidref);
     if ( ret )
         goto domctl_out_unlock_domonly;
 
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index 8671af1ba4..3286befeca 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -162,7 +162,7 @@ static XSM_INLINE int cf_check xsm_set_target(
 }
 
 static XSM_INLINE int cf_check xsm_domctl(
-    XSM_DEFAULT_ARG struct domain *d, int cmd)
+    XSM_DEFAULT_ARG struct domain *d, unsigned int cmd, uint32_t ssidref)
 {
     XSM_ASSERT_ACTION(XSM_OTHER);
     switch ( cmd )
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 8dad03fd3d..627c0d2731 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -60,7 +60,7 @@ struct xsm_ops {
     int (*domctl_scheduler_op)(struct domain *d, int op);
     int (*sysctl_scheduler_op)(int op);
     int (*set_target)(struct domain *d, struct domain *e);
-    int (*domctl)(struct domain *d, int cmd);
+    int (*domctl)(struct domain *d, unsigned int cmd, uint32_t ssidref);
     int (*sysctl)(int cmd);
     int (*readconsole)(uint32_t clear);
 
@@ -248,9 +248,10 @@ static inline int xsm_set_target(
     return alternative_call(xsm_ops.set_target, d, e);
 }
 
-static inline int xsm_domctl(xsm_default_t def, struct domain *d, int cmd)
+static inline int xsm_domctl(xsm_default_t def, struct domain *d,
+                             unsigned int cmd, uint32_t ssidref)
 {
-    return alternative_call(xsm_ops.domctl, d, cmd);
+    return alternative_call(xsm_ops.domctl, d, cmd, ssidref);
 }
 
 static inline int xsm_sysctl(xsm_default_t def, int cmd)
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 5e88c71b8e..278ad38c2a 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -663,12 +663,22 @@ static int cf_check flask_set_target(struct domain *d, struct domain *t)
     return rc;
 }
 
-static int cf_check flask_domctl(struct domain *d, int cmd)
+static int cf_check flask_domctl(struct domain *d, unsigned int cmd,
+                                 uint32_t ssidref)
 {
     switch ( cmd )
     {
-    /* These have individual XSM hooks (common/domctl.c) */
     case XEN_DOMCTL_createdomain:
+        /*
+         * There is a later hook too, but at this early point simply check
+         * that the calling domain is privileged enough to create a domain.
+         *
+         * Note that d is NULL because we haven't even allocated memory for it
+         * this early in XEN_DOMCTL_createdomain.
+         */
+        return avc_current_has_perm(ssidref, SECCLASS_DOMAIN, DOMAIN__CREATE, NULL);
+
+    /* These have individual XSM hooks (common/domctl.c) */
     case XEN_DOMCTL_getdomaininfo:
     case XEN_DOMCTL_scheduler_op:
     case XEN_DOMCTL_irq_permission:
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:02:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:02:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773938.1184403 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1qI-0007or-TL; Thu, 08 Aug 2024 12:02:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773938.1184403; Thu, 08 Aug 2024 12:02: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 1sc1qI-0007oj-QD; Thu, 08 Aug 2024 12:02:06 +0000
Received: by outflank-mailman (input) for mailman id 773938;
 Thu, 08 Aug 2024 12:02:05 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1qH-0007oP-44
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:02:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1qH-0007AP-3G
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:02:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1qH-0002dR-2Q
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:02:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uGXiI+eZDTTMg2YwiudzumI/q/6bFu8YonhRCi+VYbM=; b=veXKLHUju0x1grAIQ9VE57Sn4d
	A0YRZdci+1yT44zcY2j/dr6NGusMz6B29ngEwtdzVYBDO14qxAWuP5g7YUq4YyXxTnC2qOt9lil+w
	jHnbmn80YeyV2Nq/SniY02wBn1xJgPc/C1UAwA9t1PyYlwnwShjsBP+OEI+mhbTr+Nug=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/dom0: fix restoring %cr3 and the mapcache override on PV build error
Message-Id: <E1sc1qH-0002dR-2Q@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:02:05 +0000

commit a71fac3c48929e96881dbcb1f6eea7692369eb98
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Aug 8 13:51:39 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:51:39 2024 +0200

    x86/dom0: fix restoring %cr3 and the mapcache override on PV build error
    
    One of the error paths in the PV dom0 builder section that runs on the guest
    page-tables wasn't restoring the Xen value of %cr3, neither removing the
    mapcache override.
    
    Fixes: 079ff2d32c3d ('libelf-loader: introduce elf_load_image')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 1fc3f77113dd43b14fa7ef5936dcdba120c0b63f
    master date: 2024-07-31 12:41:02 +0200
---
 xen/arch/x86/pv/dom0_build.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 5bbed3a36a..64a0b9f598 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -822,6 +822,8 @@ int __init dom0_construct_pv(struct domain *d,
     rc = elf_load_binary(&elf);
     if ( rc < 0 )
     {
+        mapcache_override_current(NULL);
+        switch_cr3_cr4(current->arch.cr3, read_cr4());
         printk("Failed to load the kernel binary\n");
         goto out;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:02:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:02:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773941.1184416 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1qS-00086X-8G; Thu, 08 Aug 2024 12:02:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773941.1184416; Thu, 08 Aug 2024 12:02:16 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1qS-00086M-5R; Thu, 08 Aug 2024 12:02:16 +0000
Received: by outflank-mailman (input) for mailman id 773941;
 Thu, 08 Aug 2024 12:02:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1qR-0007vS-6t
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:02:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1qR-0007Ak-60
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:02:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1qR-0002ds-5J
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:02:15 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=h0TdzdvwSC1oCNNM1kj9CDsqLZQq80Jxkq7yn2iW4z4=; b=gL9M4Lzdd9dxH0LInLhbXLirkG
	lptrspC7n3IpgHu+J8QkzIsDwTd4D3qHHZ04pNnPOx/o3EY5YNIzv++xChfRZew5Z73q3/aXLvYym
	6DEAvNlTSB+PjSrRb3Jp8Iqdm4aHsMZUlygZkNQIr5fxCLb1XLkla6tCIYDhg9PzYcZg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/altcall: further refine clang workaround
Message-Id: <E1sc1qR-0002ds-5J@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:02:15 +0000

commit 211c73c8e9d8e75db9358fb3c9ce2fc56fb406bf
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Aug 8 13:52:11 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:52:11 2024 +0200

    x86/altcall: further refine clang workaround
    
    The current code in ALT_CALL_ARG() won't successfully workaround the clang
    code-generation issue if the arg parameter has a size that's not a power of 2.
    While there are no such sized parameters at the moment, improve the workaround
    to also be effective when such sizes are used.
    
    Instead of using a union with a long use an unsigned long that's first
    initialized to 0 and afterwards set to the argument value.
    
    Reported-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Suggested-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 561cba38ff551383a628dc93e64ab0691cfc92bf
    master date: 2024-07-31 12:41:22 +0200
---
 xen/arch/x86/include/asm/alternative.h | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/include/asm/alternative.h b/xen/arch/x86/include/asm/alternative.h
index e63b459276..a86eadfaec 100644
--- a/xen/arch/x86/include/asm/alternative.h
+++ b/xen/arch/x86/include/asm/alternative.h
@@ -169,27 +169,25 @@ extern void alternative_branches(void);
 
 #ifdef CONFIG_CC_IS_CLANG
 /*
- * Use a union with an unsigned long in order to prevent clang from
- * skipping a possible truncation of the value.  By using the union any
- * truncation is carried before the call instruction, in turn covering
- * for ABI-non-compliance in that the necessary clipping / extension of
- * the value is supposed to be carried out in the callee.
+ * Clang doesn't follow the psABI and doesn't truncate parameter values at the
+ * callee.  This can lead to bad code being generated when using alternative
+ * calls.
  *
- * Note this behavior is not mandated by the standard, and hence could
- * stop being a viable workaround, or worse, could cause a different set
- * of code-generation issues in future clang versions.
+ * Workaround it by using a temporary intermediate variable that's zeroed
+ * before being assigned the parameter value, as that forces clang to zero the
+ * register at the caller.
  *
  * This has been reported upstream:
  * https://github.com/llvm/llvm-project/issues/12579
  * https://github.com/llvm/llvm-project/issues/82598
  */
 #define ALT_CALL_ARG(arg, n)                                            \
-    register union {                                                    \
-        typeof(arg) e[sizeof(long) / sizeof(arg)];                      \
-        unsigned long r;                                                \
-    } a ## n ## _ asm ( ALT_CALL_arg ## n ) = {                         \
-        .e[0] = ({ BUILD_BUG_ON(sizeof(arg) > sizeof(void *)); (arg); })\
-    }
+    register unsigned long a ## n ## _ asm ( ALT_CALL_arg ## n ) = ({   \
+        unsigned long tmp = 0;                                          \
+        BUILD_BUG_ON(sizeof(arg) > sizeof(unsigned long));              \
+        *(typeof(arg) *)&tmp = (arg);                                   \
+        tmp;                                                            \
+    })
 #else
 #define ALT_CALL_ARG(arg, n) \
     register typeof(arg) a ## n ## _ asm ( ALT_CALL_arg ## n ) = \
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:02:26 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:02:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773943.1184422 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1qc-0008DS-AP; Thu, 08 Aug 2024 12:02:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773943.1184422; Thu, 08 Aug 2024 12:02:26 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1qc-0008DK-7M; Thu, 08 Aug 2024 12:02:26 +0000
Received: by outflank-mailman (input) for mailman id 773943;
 Thu, 08 Aug 2024 12:02:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1qb-0008Cu-Al
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:02:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1qb-0007Av-8p
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:02:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1qb-0002eQ-8B
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:02: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rZRf8+UXhLZweWqNf+5+6nLtb+8VxCz51IMvxcpk+Fk=; b=2KUQXGty9Ss10DOgKvYm4o+Yvc
	s7Rrt383hRhbGtR4DTkMdPG/2WWmxJtb9Tiejbo+ia2M8buG3XWqqOE/57esHduEUyAA5wyPRoKwi
	6pNoiFJ7H1RS1oyhyba2W4VgK/JogrY/qFnV1pPfQ/Z+5dE4A9Ip7e+4AieNC9qvVopI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] xen/sched: fix error handling in cpu_schedule_up()
Message-Id: <E1sc1qb-0002eQ-8B@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:02:25 +0000

commit bfae66cc4c2d65bb5a788b79e9b3dbd275d096b5
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Aug 8 13:52:26 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:52:26 2024 +0200

    xen/sched: fix error handling in cpu_schedule_up()
    
    In case cpu_schedule_up() is failing, it needs to undo all externally
    visible changes it has done before.
    
    Reason is that cpu_schedule_callback() won't be called with the
    CPU_UP_CANCELED notifier in case cpu_schedule_up() did fail.
    
    Fixes: 207589dbacd4 ("xen/sched: move per cpu scheduler private data into struct sched_resource")
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 44a7d4f0a5e9eae41a44a162e54ff6d2ebe5b7d6
    master date: 2024-07-31 14:50:18 +0200
---
 xen/common/sched/core.c | 63 ++++++++++++++++++++++++++-----------------------
 1 file changed, 33 insertions(+), 30 deletions(-)

diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index 3c2403ebcf..cbaa292bb2 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -2760,6 +2760,36 @@ static struct sched_resource *sched_alloc_res(void)
     return sr;
 }
 
+static void cf_check sched_res_free(struct rcu_head *head)
+{
+    struct sched_resource *sr = container_of(head, struct sched_resource, rcu);
+
+    free_cpumask_var(sr->cpus);
+    if ( sr->sched_unit_idle )
+        sched_free_unit_mem(sr->sched_unit_idle);
+    xfree(sr);
+}
+
+static void cpu_schedule_down(unsigned int cpu)
+{
+    struct sched_resource *sr;
+
+    rcu_read_lock(&sched_res_rculock);
+
+    sr = get_sched_res(cpu);
+
+    kill_timer(&sr->s_timer);
+
+    cpumask_clear_cpu(cpu, &sched_res_mask);
+    set_sched_res(cpu, NULL);
+
+    /* Keep idle unit. */
+    sr->sched_unit_idle = NULL;
+    call_rcu(&sr->rcu, sched_res_free);
+
+    rcu_read_unlock(&sched_res_rculock);
+}
+
 static int cpu_schedule_up(unsigned int cpu)
 {
     struct sched_resource *sr;
@@ -2799,7 +2829,10 @@ static int cpu_schedule_up(unsigned int cpu)
         idle_vcpu[cpu]->sched_unit->res = sr;
 
     if ( idle_vcpu[cpu] == NULL )
+    {
+        cpu_schedule_down(cpu);
         return -ENOMEM;
+    }
 
     idle_vcpu[cpu]->sched_unit->rendezvous_in_cnt = 0;
 
@@ -2817,36 +2850,6 @@ static int cpu_schedule_up(unsigned int cpu)
     return 0;
 }
 
-static void cf_check sched_res_free(struct rcu_head *head)
-{
-    struct sched_resource *sr = container_of(head, struct sched_resource, rcu);
-
-    free_cpumask_var(sr->cpus);
-    if ( sr->sched_unit_idle )
-        sched_free_unit_mem(sr->sched_unit_idle);
-    xfree(sr);
-}
-
-static void cpu_schedule_down(unsigned int cpu)
-{
-    struct sched_resource *sr;
-
-    rcu_read_lock(&sched_res_rculock);
-
-    sr = get_sched_res(cpu);
-
-    kill_timer(&sr->s_timer);
-
-    cpumask_clear_cpu(cpu, &sched_res_mask);
-    set_sched_res(cpu, NULL);
-
-    /* Keep idle unit. */
-    sr->sched_unit_idle = NULL;
-    call_rcu(&sr->rcu, sched_res_free);
-
-    rcu_read_unlock(&sched_res_rculock);
-}
-
 void sched_rm_cpu(unsigned int cpu)
 {
     int rc;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:02:36 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:02:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773945.1184425 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1qm-0008Kf-BY; Thu, 08 Aug 2024 12:02:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773945.1184425; Thu, 08 Aug 2024 12:02:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1qm-0008KX-8w; Thu, 08 Aug 2024 12:02:36 +0000
Received: by outflank-mailman (input) for mailman id 773945;
 Thu, 08 Aug 2024 12:02:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1ql-0008J4-CO
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:02:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1ql-0007B2-Bf
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:02:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1ql-0002et-B3
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:02:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AtG7rOetvk8A8smQCyEgHKhyuxXVbiDzb+B7qfcYReA=; b=bo1G3Iow6iQyQy4ZS8oq4H0l1F
	K7ZC/f87Tp5MNI8NmITa2ODAVI+6bQ63QDNweIoLMb95cK8saJLtKcYyZLAt/kx5DMyPMNOcG1Em7
	LEzESKIcTq8aGxM73ofS1U3AIiAgY3ub5Kz+MmM14697ljMajuO5OrRa20PAANvAOZnk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] xen/hvm: Don't skip MSR_READ trace record
Message-Id: <E1sc1ql-0002et-B3@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:02:35 +0000

commit 4e0d6fad57d20876addd469e664dab0cde92e2c2
Author:     George Dunlap <george.dunlap@cloud.com>
AuthorDate: Thu Aug 8 13:53:01 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:53:01 2024 +0200

    xen/hvm: Don't skip MSR_READ trace record
    
    Commit 37f074a3383 ("x86/msr: introduce guest_rdmsr()") introduced a
    function to combine the MSR_READ handling between PV and HVM.
    Unfortunately, by returning directly, it skipped the trace generation,
    leading to gaps in the trace record, as well as xenalyze errors like
    this:
    
    hvm_generic_postprocess: d2v0 Strange, exit 7c(VMEXIT_MSR) missing a handler
    
    Replace the `return` with `goto out`.
    
    Fixes: 37f074a3383 ("x86/msr: introduce guest_rdmsr()")
    Signed-off-by: George Dunlap <george.dunlap@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: bc8a43fff61ae4162a95d84f4e148d6773667cd2
    master date: 2024-08-02 08:42:09 +0200
---
 xen/arch/x86/hvm/hvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index a70b351373..8f293f4feb 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3537,7 +3537,7 @@ int hvm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
     fixed_range_base = (uint64_t *)v->arch.hvm.mtrr.fixed_ranges;
 
     if ( (ret = guest_rdmsr(v, msr, msr_content)) != X86EMUL_UNHANDLEABLE )
-        return ret;
+        goto out;
 
     ret = X86EMUL_OKAY;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:02:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:02:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773950.1184429 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1qw-0008Uy-Dg; Thu, 08 Aug 2024 12:02:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773950.1184429; Thu, 08 Aug 2024 12:02:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1qw-0008Up-AL; Thu, 08 Aug 2024 12:02:46 +0000
Received: by outflank-mailman (input) for mailman id 773950;
 Thu, 08 Aug 2024 12:02:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1qv-0008TW-FC
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:02:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1qv-0007BS-EX
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:02:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1qv-0002ff-Dg
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:02:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dapLyu5sRJhpx/k3vBQhcHCnGIYAcL0yNrDP//jsTK4=; b=nUkaUrW7HA0KLP92J38LkIBN4Z
	SV6bPrpURDvIJaSdUs/PqEh/Fz+nXUs5MGp5m9d0fQa21LQwda6M2EQigPYD+WlYgMJVgaBxc3HU9
	iwfr+UIa1ZaiV2gSxTwiKOFq7jB3DlIAI2rc6+Bo8gNJgxDck65tIwdpvLJiiq+NS+YI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] tools/lsevtchn: Use errno macro to handle hypercall error cases
Message-Id: <E1sc1qv-0002ff-Dg@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:02:45 +0000

commit 8aa5245ef68065c0f3e5fcdcc3c410baa8654b35
Author:     Matthew Barnes <matthew.barnes@cloud.com>
AuthorDate: Thu Aug 8 13:53:26 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:53:26 2024 +0200

    tools/lsevtchn: Use errno macro to handle hypercall error cases
    
    Currently, lsevtchn aborts its event channel enumeration when it hits
    an event channel that is owned by Xen.
    
    lsevtchn does not distinguish between different hypercall errors, which
    results in lsevtchn missing potential relevant event channels with
    higher port numbers.
    
    Use the errno macro to distinguish between hypercall errors, and
    continue event channel enumeration if the hypercall error is not
    critical to enumeration.
    
    Signed-off-by: Matthew Barnes <matthew.barnes@cloud.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: e92a453c8db8bba62d6be3006079e2b9990c3978
    master date: 2024-08-02 08:43:57 +0200
---
 tools/xcutils/lsevtchn.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/tools/xcutils/lsevtchn.c b/tools/xcutils/lsevtchn.c
index d1710613dd..30c8d847b8 100644
--- a/tools/xcutils/lsevtchn.c
+++ b/tools/xcutils/lsevtchn.c
@@ -3,6 +3,7 @@
 #include <stdint.h>
 #include <string.h>
 #include <stdio.h>
+#include <errno.h>
 
 #include <xenctrl.h>
 
@@ -24,7 +25,23 @@ int main(int argc, char **argv)
         status.port = port;
         rc = xc_evtchn_status(xch, &status);
         if ( rc < 0 )
-            break;
+        {
+            switch ( errno )
+            {
+            case EACCES: /* Xen-owned evtchn */
+                continue;
+
+            case EINVAL: /* Port enumeration has ended */
+                rc = 0;
+                break;
+
+            default:
+                perror("xc_evtchn_status");
+                rc = 1;
+                break;
+            }
+            goto out;
+        }
 
         if ( status.status == EVTCHNSTAT_closed )
             continue;
@@ -58,7 +75,8 @@ int main(int argc, char **argv)
         printf("\n");
     }
 
+ out:
     xc_interface_close(xch);
 
-    return 0;
+    return rc;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:02:56 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:02:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773952.1184433 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1r6-00006e-Ed; Thu, 08 Aug 2024 12:02:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773952.1184433; Thu, 08 Aug 2024 12:02:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1r6-00006W-C1; Thu, 08 Aug 2024 12:02:56 +0000
Received: by outflank-mailman (input) for mailman id 773952;
 Thu, 08 Aug 2024 12:02:55 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1r5-00006L-IL
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:02:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1r5-0007BZ-HJ
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:02:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1r5-0002g8-Ge
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:02:55 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fPlX1HAmib0AHZ0E2XA33lJs8CApvc7XU+6ejp/4znk=; b=YwjIEZYSZstOZvUh6DBkOuRSRR
	i0RG7qSQjE4BEM2/9YJde6DTBiJfjd6GrfUp8iqtcu/F1ohV96KBJAXOqG17kIIYKz+8LKRyjvpeP
	71bO014mpIkIUaMgtldZiS15EJkJmiLd3XVfZAG70+MmkvRrt1mfL6/j4wBW3jyG8dAg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/emul: Fix misaligned IO breakpoint behaviour in PV guests
Message-Id: <E1sc1r5-0002g8-Ge@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:02:55 +0000

commit d446b472cc5051c2ef4eaf5f895d96d7a458c8a1
Author:     Matthew Barnes <matthew.barnes@cloud.com>
AuthorDate: Thu Aug 8 13:53:40 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:53:40 2024 +0200

    x86/emul: Fix misaligned IO breakpoint behaviour in PV guests
    
    When hardware breakpoints are configured on misaligned IO ports, the
    hardware will mask the addresses based on the breakpoint width during
    comparison.
    
    For PV guests, misaligned IO breakpoints do not behave the same way, and
    therefore yield different results.
    
    This patch tweaks the emulation of IO breakpoints for PV guests such
    that they reproduce the same behaviour as hardware.
    
    Fixes: bec9e3205018 ("x86: emulate I/O port access breakpoints")
    Signed-off-by: Matthew Barnes <matthew.barnes@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 08aacc392d86d4c7dbebdb5e664060ae2af72057
    master date: 2024-08-08 13:27:50 +0200
---
 xen/arch/x86/pv/emul-priv-op.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index f101510a1b..aa11ecadaa 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -346,6 +346,8 @@ static unsigned int check_guest_io_breakpoint(struct vcpu *v,
         case DR_LEN_8: width = 8; break;
         }
 
+        start &= ~(width - 1UL);
+
         if ( (start < (port + len)) && ((start + width) > port) )
             match |= 1u << i;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:03:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:03:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773954.1184436 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1rG-00009i-GC; Thu, 08 Aug 2024 12:03:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773954.1184436; Thu, 08 Aug 2024 12:03: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 1sc1rG-00009b-DS; Thu, 08 Aug 2024 12:03:06 +0000
Received: by outflank-mailman (input) for mailman id 773954;
 Thu, 08 Aug 2024 12:03:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1rF-00009V-VM
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:03:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1rF-0007Bt-Uf
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:03:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1rF-0002hz-Tr
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:03:05 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cktjve2WZMLMHGN8K+is4fR0khf2KSQ5bxs7R/4oAhU=; b=6wHE5TVV0ms8TMJhIAchZTcgKI
	SeAt7vmY7iRfZ1tdpsk+667PORR7DAl9bnI8mLALcgmvfIk4KN8+tVpx2z/yVi5VunRomuTCwSik2
	SHGp0MmLKj3jh69J6Z3pxjei7eC7sTjxmcLjyFFoE1+65v906M07roPs4gOqGArxgYmY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] bunzip2: fix rare decompression failure
Message-Id: <E1sc1rF-0002hz-Tr@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:03:05 +0000

commit d663711c05883948d306fea59a2c834a7a3b94da
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Thu Aug 8 13:55:01 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:55:01 2024 +0200

    bunzip2: fix rare decompression failure
    
    The decompression code parses a huffman tree and counts the number of
    symbols for a given bit length.  In rare cases, there may be >= 256
    symbols with a given bit length, causing the unsigned char to overflow.
    This causes a decompression failure later when the code tries and fails to
    find the bit length for a given symbol.
    
    Since the maximum number of symbols is 258, use unsigned short instead.
    
    Fixes: ab77e81f6521 ("x86/dom0: support bzip2 and lzma compressed bzImage payloads")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 303d3ff85c90ee4af4bad4e3b1d4932fa2634d64
    master date: 2024-07-30 11:55:56 +0200
---
 xen/common/bunzip2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/bunzip2.c b/xen/common/bunzip2.c
index 4466426941..79f17162b1 100644
--- a/xen/common/bunzip2.c
+++ b/xen/common/bunzip2.c
@@ -221,7 +221,8 @@ static int __init get_next_block(struct bunzip_data *bd)
 	   RUNB) */
 	symCount = symTotal+2;
 	for (j = 0; j < groupCount; j++) {
-		unsigned char length[MAX_SYMBOLS], temp[MAX_HUFCODE_BITS+1];
+		unsigned char length[MAX_SYMBOLS];
+		unsigned short temp[MAX_HUFCODE_BITS+1];
 		int	minLen,	maxLen, pp;
 		/* Read Huffman code lengths for each symbol.  They're
 		   stored in a way similar to mtf; record a starting
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:03:18 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:03:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773955.1184441 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1rR-0000DH-I2; Thu, 08 Aug 2024 12:03:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773955.1184441; Thu, 08 Aug 2024 12:03:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1rR-0000D9-F6; Thu, 08 Aug 2024 12:03:17 +0000
Received: by outflank-mailman (input) for mailman id 773955;
 Thu, 08 Aug 2024 12:03:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1rQ-0000Cz-1z
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:03:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1rQ-0007C2-1G
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:03:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1rQ-0002kD-0e
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:03:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3QP9ZUmDLPHYknNquPWdWk4LxLMWI5ZJyCP4b6ugjtM=; b=IjU7ocB+5OHvNR+OQ5i7q/hjHV
	uzs6K1W3zdV48Pe8qfcFJ9GSOWCubRPCb9HpTtGODdwsyaD8nkqA/fo9vKk3TUP9hV7vsO/QLcASl
	sEMIEvCDD3gArDd90E2SJY7wu5OgvFfGPmn4FGffLgO0j3B8F0jrHL+fzbfdNmQmS3HM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] XSM/domctl: Fix permission checks on XEN_DOMCTL_createdomain
Message-Id: <E1sc1rQ-0002kD-0e@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:03:16 +0000

commit 37a2c8fe359b97e98e8be9c534aa765a006532aa
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 8 13:55:30 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:55:30 2024 +0200

    XSM/domctl: Fix permission checks on XEN_DOMCTL_createdomain
    
    The XSM checks for XEN_DOMCTL_createdomain are problematic.  There's a split
    between xsm_domctl() called early, and flask_domain_create() called quite late
    during domain construction.
    
    All XSM implementations except Flask have a simple IS_PRIV check in
    xsm_domctl(), and operate as expected when an unprivileged domain tries to
    make a hypercall.
    
    Flask however foregoes any action in xsm_domctl() and defers everything,
    including the simple "is the caller permitted to create a domain" check, to
    flask_domain_create().
    
    As a consequence, when XSM Flask is active, and irrespective of the policy
    loaded, all domains irrespective of privilege can:
    
     * Mutate the global 'rover' variable, used to track the next free domid.
       Therefore, all domains can cause a domid wraparound, and combined with a
       voluntary reboot, choose their own domid.
    
     * Cause a reasonable amount of a domain to be constructed before ultimately
       failing for permission reasons, including the use of settings outside of
       supported limits.
    
    In order to remediate this, pass the ssidref into xsm_domctl() and at least
    check that the calling domain privileged enough to create domains.
    
    Take the opportunity to also fix the sign of the cmd parameter to be unsigned.
    
    This issue has not been assigned an XSA, because Flask is experimental and not
    security supported.
    
    Reported-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    master commit: ee32b9b29af449d38aad0a1b3a81aaae586f5ea7
    master date: 2024-07-30 17:42:17 +0100
---
 xen/arch/x86/mm/paging.c |  2 +-
 xen/common/domctl.c      |  4 +++-
 xen/include/xsm/dummy.h  |  2 +-
 xen/include/xsm/xsm.h    |  7 ++++---
 xen/xsm/flask/hooks.c    | 14 ++++++++++++--
 5 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index ae0340570d..d7785420bb 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -779,7 +779,7 @@ long do_paging_domctl_cont(
     if ( d == NULL )
         return -ESRCH;
 
-    ret = xsm_domctl(XSM_OTHER, d, op.cmd);
+    ret = xsm_domctl(XSM_OTHER, d, op.cmd, 0 /* SSIDref not applicable */);
     if ( !ret )
     {
         if ( domctl_lock_acquire() )
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index ad71ad8a4c..96ca55a421 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -318,7 +318,9 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
             return -ESRCH;
     }
 
-    ret = xsm_domctl(XSM_OTHER, d, op->cmd);
+    ret = xsm_domctl(XSM_OTHER, d, op->cmd,
+                     /* SSIDRef only applicable for cmd == createdomain */
+                     op->u.createdomain.ssidref);
     if ( ret )
         goto domctl_out_unlock_domonly;
 
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index 8671af1ba4..3286befeca 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -162,7 +162,7 @@ static XSM_INLINE int cf_check xsm_set_target(
 }
 
 static XSM_INLINE int cf_check xsm_domctl(
-    XSM_DEFAULT_ARG struct domain *d, int cmd)
+    XSM_DEFAULT_ARG struct domain *d, unsigned int cmd, uint32_t ssidref)
 {
     XSM_ASSERT_ACTION(XSM_OTHER);
     switch ( cmd )
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 8dad03fd3d..627c0d2731 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -60,7 +60,7 @@ struct xsm_ops {
     int (*domctl_scheduler_op)(struct domain *d, int op);
     int (*sysctl_scheduler_op)(int op);
     int (*set_target)(struct domain *d, struct domain *e);
-    int (*domctl)(struct domain *d, int cmd);
+    int (*domctl)(struct domain *d, unsigned int cmd, uint32_t ssidref);
     int (*sysctl)(int cmd);
     int (*readconsole)(uint32_t clear);
 
@@ -248,9 +248,10 @@ static inline int xsm_set_target(
     return alternative_call(xsm_ops.set_target, d, e);
 }
 
-static inline int xsm_domctl(xsm_default_t def, struct domain *d, int cmd)
+static inline int xsm_domctl(xsm_default_t def, struct domain *d,
+                             unsigned int cmd, uint32_t ssidref)
 {
-    return alternative_call(xsm_ops.domctl, d, cmd);
+    return alternative_call(xsm_ops.domctl, d, cmd, ssidref);
 }
 
 static inline int xsm_sysctl(xsm_default_t def, int cmd)
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 78225f68c1..42857c2122 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -663,12 +663,22 @@ static int cf_check flask_set_target(struct domain *d, struct domain *t)
     return rc;
 }
 
-static int cf_check flask_domctl(struct domain *d, int cmd)
+static int cf_check flask_domctl(struct domain *d, unsigned int cmd,
+                                 uint32_t ssidref)
 {
     switch ( cmd )
     {
-    /* These have individual XSM hooks (common/domctl.c) */
     case XEN_DOMCTL_createdomain:
+        /*
+         * There is a later hook too, but at this early point simply check
+         * that the calling domain is privileged enough to create a domain.
+         *
+         * Note that d is NULL because we haven't even allocated memory for it
+         * this early in XEN_DOMCTL_createdomain.
+         */
+        return avc_current_has_perm(ssidref, SECCLASS_DOMAIN, DOMAIN__CREATE, NULL);
+
+    /* These have individual XSM hooks (common/domctl.c) */
     case XEN_DOMCTL_getdomaininfo:
     case XEN_DOMCTL_scheduler_op:
     case XEN_DOMCTL_irq_permission:
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:03:27 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:03:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773956.1184445 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1rb-0000HN-KP; Thu, 08 Aug 2024 12:03:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773956.1184445; Thu, 08 Aug 2024 12:03:27 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1rb-0000H7-Hl; Thu, 08 Aug 2024 12:03:27 +0000
Received: by outflank-mailman (input) for mailman id 773956;
 Thu, 08 Aug 2024 12:03:26 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1ra-0000Gu-4i
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:03:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1ra-0007CF-3u
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:03:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1ra-0002kk-3H
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:03:26 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=btxtfg0KbK/ZlrQiwvWLXePbO8PDCSUFgA5TS2rXU0s=; b=FSQtWzlpzYruEJxTTpucq8bwkP
	8BlKcVQUoqySRQmSbzg1zPnT5yqQVsX+Z4yCKBaWMZP9btTVg2U7VjxVVynAQ23maT8wzs6hzFjki
	da9B7e4jg/dJ5ZC/BbtrkZfZu72WnQJH8vGHjPdts927bhpT/JAhQWr12p/xZ1Q0k/Xo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] x86/dom0: fix restoring %cr3 and the mapcache override on PV build error
Message-Id: <E1sc1ra-0002kk-3H@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:03:26 +0000

commit 82e70687b8f53310775b65ce63259288b6b3e45b
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Aug 8 13:55:53 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:55:53 2024 +0200

    x86/dom0: fix restoring %cr3 and the mapcache override on PV build error
    
    One of the error paths in the PV dom0 builder section that runs on the guest
    page-tables wasn't restoring the Xen value of %cr3, neither removing the
    mapcache override.
    
    Fixes: 079ff2d32c3d ('libelf-loader: introduce elf_load_image')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 1fc3f77113dd43b14fa7ef5936dcdba120c0b63f
    master date: 2024-07-31 12:41:02 +0200
---
 xen/arch/x86/pv/dom0_build.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index a62f0fa2ef..3e74cf4ea2 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -821,6 +821,8 @@ int __init dom0_construct_pv(struct domain *d,
     rc = elf_load_binary(&elf);
     if ( rc < 0 )
     {
+        mapcache_override_current(NULL);
+        switch_cr3_cr4(current->arch.cr3, read_cr4());
         printk("Failed to load the kernel binary\n");
         goto out;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:03:37 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:03:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773957.1184449 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1rl-0000Km-Lt; Thu, 08 Aug 2024 12:03:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773957.1184449; Thu, 08 Aug 2024 12:03:37 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1rl-0000Ke-JH; Thu, 08 Aug 2024 12:03:37 +0000
Received: by outflank-mailman (input) for mailman id 773957;
 Thu, 08 Aug 2024 12:03:36 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1rk-0000KF-7F
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:03:36 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1rk-0007CN-6b
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:03:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1rk-0002lO-5y
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:03:36 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IAxEScd7NaLuj0os+3qw4rZhzx9cayOHB0i9zXW0bkc=; b=eRQhmfecOZ6KsyYJoZsY7tRou3
	AbTpL1vj12ZDd2ztr8DKAH7BfsByp/8KPghHOaXYbhZ6GW6b3yRI1+sIqbJKA+eHtDlACe2VU1FvE
	l7wfhlixbnrsCPe7/fHr0zW5vEOKx6djoOUDBz6zBCHb+1vpT3ZjpIUFUNPEf7lg1JVw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] x86/altcall: further refine clang workaround
Message-Id: <E1sc1rk-0002lO-5y@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:03:36 +0000

commit ca191891e37fd13fd5e1685624e3c16563426ff4
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Aug 8 13:56:20 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:56:20 2024 +0200

    x86/altcall: further refine clang workaround
    
    The current code in ALT_CALL_ARG() won't successfully workaround the clang
    code-generation issue if the arg parameter has a size that's not a power of 2.
    While there are no such sized parameters at the moment, improve the workaround
    to also be effective when such sizes are used.
    
    Instead of using a union with a long use an unsigned long that's first
    initialized to 0 and afterwards set to the argument value.
    
    Reported-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Suggested-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 561cba38ff551383a628dc93e64ab0691cfc92bf
    master date: 2024-07-31 12:41:22 +0200
---
 xen/arch/x86/include/asm/alternative.h | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/include/asm/alternative.h b/xen/arch/x86/include/asm/alternative.h
index b54a970e70..ee4cbe92cc 100644
--- a/xen/arch/x86/include/asm/alternative.h
+++ b/xen/arch/x86/include/asm/alternative.h
@@ -169,27 +169,25 @@ extern void alternative_branches(void);
 
 #ifdef CONFIG_CC_IS_CLANG
 /*
- * Use a union with an unsigned long in order to prevent clang from
- * skipping a possible truncation of the value.  By using the union any
- * truncation is carried before the call instruction, in turn covering
- * for ABI-non-compliance in that the necessary clipping / extension of
- * the value is supposed to be carried out in the callee.
+ * Clang doesn't follow the psABI and doesn't truncate parameter values at the
+ * callee.  This can lead to bad code being generated when using alternative
+ * calls.
  *
- * Note this behavior is not mandated by the standard, and hence could
- * stop being a viable workaround, or worse, could cause a different set
- * of code-generation issues in future clang versions.
+ * Workaround it by using a temporary intermediate variable that's zeroed
+ * before being assigned the parameter value, as that forces clang to zero the
+ * register at the caller.
  *
  * This has been reported upstream:
  * https://github.com/llvm/llvm-project/issues/12579
  * https://github.com/llvm/llvm-project/issues/82598
  */
 #define ALT_CALL_ARG(arg, n)                                            \
-    register union {                                                    \
-        typeof(arg) e[sizeof(long) / sizeof(arg)];                      \
-        unsigned long r;                                                \
-    } a ## n ## _ asm ( ALT_CALL_arg ## n ) = {                         \
-        .e[0] = ({ BUILD_BUG_ON(sizeof(arg) > sizeof(void *)); (arg); })\
-    }
+    register unsigned long a ## n ## _ asm ( ALT_CALL_arg ## n ) = ({   \
+        unsigned long tmp = 0;                                          \
+        BUILD_BUG_ON(sizeof(arg) > sizeof(unsigned long));              \
+        *(typeof(arg) *)&tmp = (arg);                                   \
+        tmp;                                                            \
+    })
 #else
 #define ALT_CALL_ARG(arg, n) \
     register typeof(arg) a ## n ## _ asm ( ALT_CALL_arg ## n ) = \
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:03:47 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:03:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773958.1184452 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1rv-0000Ng-NC; Thu, 08 Aug 2024 12:03:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773958.1184452; Thu, 08 Aug 2024 12:03:47 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1rv-0000NY-Ki; Thu, 08 Aug 2024 12:03:47 +0000
Received: by outflank-mailman (input) for mailman id 773958;
 Thu, 08 Aug 2024 12:03:46 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1ru-0000NM-AE
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:03:46 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1ru-0007Cn-9U
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:03:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1ru-0002lv-8m
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:03:46 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rIxmbhOimB7KkFZuvlqOwMOW2YR7+zVLjmKAQOjJ8Aw=; b=Auf7UnVAgBS9KOk41JJx5HY7EC
	u70lK6DCDsJyZv+eb5uUMNJEL9SS/wECc1uVavjv1SVdqLhyEKmjZqaU1GgI0Xg/51fx2pB46l48t
	va8ZIoH4f/o7XJe0ysJunvh0f44Tdaw6RxSiTb8WMJ0LnhPVtf+xsbdbPKQWUhQE0TD4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] xen/sched: fix error handling in cpu_schedule_up()
Message-Id: <E1sc1ru-0002lv-8m@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:03:46 +0000

commit befe52ecf0483b1e4d9cd27a88b6eca27cdc3ba5
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Aug 8 13:56:35 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:56:35 2024 +0200

    xen/sched: fix error handling in cpu_schedule_up()
    
    In case cpu_schedule_up() is failing, it needs to undo all externally
    visible changes it has done before.
    
    Reason is that cpu_schedule_callback() won't be called with the
    CPU_UP_CANCELED notifier in case cpu_schedule_up() did fail.
    
    Fixes: 207589dbacd4 ("xen/sched: move per cpu scheduler private data into struct sched_resource")
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 44a7d4f0a5e9eae41a44a162e54ff6d2ebe5b7d6
    master date: 2024-07-31 14:50:18 +0200
---
 xen/common/sched/core.c | 63 ++++++++++++++++++++++++++-----------------------
 1 file changed, 33 insertions(+), 30 deletions(-)

diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index a9ff98f67a..8c6c26b562 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -2760,6 +2760,36 @@ static struct sched_resource *sched_alloc_res(void)
     return sr;
 }
 
+static void cf_check sched_res_free(struct rcu_head *head)
+{
+    struct sched_resource *sr = container_of(head, struct sched_resource, rcu);
+
+    free_cpumask_var(sr->cpus);
+    if ( sr->sched_unit_idle )
+        sched_free_unit_mem(sr->sched_unit_idle);
+    xfree(sr);
+}
+
+static void cpu_schedule_down(unsigned int cpu)
+{
+    struct sched_resource *sr;
+
+    rcu_read_lock(&sched_res_rculock);
+
+    sr = get_sched_res(cpu);
+
+    kill_timer(&sr->s_timer);
+
+    cpumask_clear_cpu(cpu, &sched_res_mask);
+    set_sched_res(cpu, NULL);
+
+    /* Keep idle unit. */
+    sr->sched_unit_idle = NULL;
+    call_rcu(&sr->rcu, sched_res_free);
+
+    rcu_read_unlock(&sched_res_rculock);
+}
+
 static int cpu_schedule_up(unsigned int cpu)
 {
     struct sched_resource *sr;
@@ -2799,7 +2829,10 @@ static int cpu_schedule_up(unsigned int cpu)
         idle_vcpu[cpu]->sched_unit->res = sr;
 
     if ( idle_vcpu[cpu] == NULL )
+    {
+        cpu_schedule_down(cpu);
         return -ENOMEM;
+    }
 
     idle_vcpu[cpu]->sched_unit->rendezvous_in_cnt = 0;
 
@@ -2817,36 +2850,6 @@ static int cpu_schedule_up(unsigned int cpu)
     return 0;
 }
 
-static void cf_check sched_res_free(struct rcu_head *head)
-{
-    struct sched_resource *sr = container_of(head, struct sched_resource, rcu);
-
-    free_cpumask_var(sr->cpus);
-    if ( sr->sched_unit_idle )
-        sched_free_unit_mem(sr->sched_unit_idle);
-    xfree(sr);
-}
-
-static void cpu_schedule_down(unsigned int cpu)
-{
-    struct sched_resource *sr;
-
-    rcu_read_lock(&sched_res_rculock);
-
-    sr = get_sched_res(cpu);
-
-    kill_timer(&sr->s_timer);
-
-    cpumask_clear_cpu(cpu, &sched_res_mask);
-    set_sched_res(cpu, NULL);
-
-    /* Keep idle unit. */
-    sr->sched_unit_idle = NULL;
-    call_rcu(&sr->rcu, sched_res_free);
-
-    rcu_read_unlock(&sched_res_rculock);
-}
-
 void sched_rm_cpu(unsigned int cpu)
 {
     int rc;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:03:57 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:03:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773959.1184457 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1s5-0000QV-Ov; Thu, 08 Aug 2024 12:03:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773959.1184457; Thu, 08 Aug 2024 12:03:57 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1s5-0000QO-M8; Thu, 08 Aug 2024 12:03:57 +0000
Received: by outflank-mailman (input) for mailman id 773959;
 Thu, 08 Aug 2024 12:03:56 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1s4-0000QC-D9
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:03:56 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1s4-0007Cr-CP
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:03:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1s4-0002mM-Bl
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:03:56 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5E0/qiI4Kj2kZ1epVGNI7KR/TuF/nJnSgrz52feTd4A=; b=f6xsogn8B2tKHmBHww+Cl9VtOs
	5yoKCH7Lox7VBRJoFT57pT95PmVqoi9thPcftVLcsLq2s+nxS/mNSCxC1DTv8ydGdltanc5uW7OMh
	NWCszyjhdAykVHpVPqpHZBsSHTZD+y4Xmrt4c/MuRhwso2+myLGLyA7R+ZLtlqWNGgfo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] xen/hvm: Don't skip MSR_READ trace record
Message-Id: <E1sc1s4-0002mM-Bl@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:03:56 +0000

commit e336a160eb1df488bca2044a0d2aea70abeb70d8
Author:     George Dunlap <george.dunlap@cloud.com>
AuthorDate: Thu Aug 8 13:57:10 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:57:10 2024 +0200

    xen/hvm: Don't skip MSR_READ trace record
    
    Commit 37f074a3383 ("x86/msr: introduce guest_rdmsr()") introduced a
    function to combine the MSR_READ handling between PV and HVM.
    Unfortunately, by returning directly, it skipped the trace generation,
    leading to gaps in the trace record, as well as xenalyze errors like
    this:
    
    hvm_generic_postprocess: d2v0 Strange, exit 7c(VMEXIT_MSR) missing a handler
    
    Replace the `return` with `goto out`.
    
    Fixes: 37f074a3383 ("x86/msr: introduce guest_rdmsr()")
    Signed-off-by: George Dunlap <george.dunlap@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: bc8a43fff61ae4162a95d84f4e148d6773667cd2
    master date: 2024-08-02 08:42:09 +0200
---
 xen/arch/x86/hvm/hvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 558dc3eddc..6ae15e04f3 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3524,7 +3524,7 @@ int hvm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
     fixed_range_base = (uint64_t *)v->arch.hvm.mtrr.fixed_ranges;
 
     if ( (ret = guest_rdmsr(v, msr, msr_content)) != X86EMUL_UNHANDLEABLE )
-        return ret;
+        goto out;
 
     ret = X86EMUL_OKAY;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:04:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:04:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773960.1184460 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1sF-0000TT-QC; Thu, 08 Aug 2024 12:04:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773960.1184460; Thu, 08 Aug 2024 12:04:07 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1sF-0000TL-Nd; Thu, 08 Aug 2024 12:04:07 +0000
Received: by outflank-mailman (input) for mailman id 773960;
 Thu, 08 Aug 2024 12:04:06 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1sE-0000TB-GG
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:04:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1sE-0007DA-FU
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:04:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1sE-0002nd-EP
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:04:06 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OnNthCsvbFSQf1SzmV1Z10CcU0kdzAlVx7TJBMUMSh4=; b=z+NFFANpOsLHeVdZHy7MmVKnQn
	lDDRG5EkQBfAyFydmnT1X7v0xWeMBGi223hMpWbE6U0yqLMp9ZdScEnCyVHweY90Q76eFJlSKbBH7
	vhL6pOULKPrGJyVHjq4grS99+VW8tSHqr+GXHXr9aArUPMRFu5Y1evWqSQX+Pc3k1nQA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] tools/lsevtchn: Use errno macro to handle hypercall error cases
Message-Id: <E1sc1sE-0002nd-EP@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:04:06 +0000

commit 2cb91df736374f3a09cbff1d61fe8e7d6dbc636c
Author:     Matthew Barnes <matthew.barnes@cloud.com>
AuthorDate: Thu Aug 8 13:57:28 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:57:28 2024 +0200

    tools/lsevtchn: Use errno macro to handle hypercall error cases
    
    Currently, lsevtchn aborts its event channel enumeration when it hits
    an event channel that is owned by Xen.
    
    lsevtchn does not distinguish between different hypercall errors, which
    results in lsevtchn missing potential relevant event channels with
    higher port numbers.
    
    Use the errno macro to distinguish between hypercall errors, and
    continue event channel enumeration if the hypercall error is not
    critical to enumeration.
    
    Signed-off-by: Matthew Barnes <matthew.barnes@cloud.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: e92a453c8db8bba62d6be3006079e2b9990c3978
    master date: 2024-08-02 08:43:57 +0200
---
 tools/xcutils/lsevtchn.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/tools/xcutils/lsevtchn.c b/tools/xcutils/lsevtchn.c
index d1710613dd..30c8d847b8 100644
--- a/tools/xcutils/lsevtchn.c
+++ b/tools/xcutils/lsevtchn.c
@@ -3,6 +3,7 @@
 #include <stdint.h>
 #include <string.h>
 #include <stdio.h>
+#include <errno.h>
 
 #include <xenctrl.h>
 
@@ -24,7 +25,23 @@ int main(int argc, char **argv)
         status.port = port;
         rc = xc_evtchn_status(xch, &status);
         if ( rc < 0 )
-            break;
+        {
+            switch ( errno )
+            {
+            case EACCES: /* Xen-owned evtchn */
+                continue;
+
+            case EINVAL: /* Port enumeration has ended */
+                rc = 0;
+                break;
+
+            default:
+                perror("xc_evtchn_status");
+                rc = 1;
+                break;
+            }
+            goto out;
+        }
 
         if ( status.status == EVTCHNSTAT_closed )
             continue;
@@ -58,7 +75,8 @@ int main(int argc, char **argv)
         printf("\n");
     }
 
+ out:
     xc_interface_close(xch);
 
-    return 0;
+    return rc;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 12:04:17 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 12:04:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.773961.1184464 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1sP-0000Wh-RX; Thu, 08 Aug 2024 12:04:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 773961.1184464; Thu, 08 Aug 2024 12:04:17 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sc1sP-0000Wa-P5; Thu, 08 Aug 2024 12:04:17 +0000
Received: by outflank-mailman (input) for mailman id 773961;
 Thu, 08 Aug 2024 12:04:16 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1sO-0000WK-Ir
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:04:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1sO-0007DG-IA
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:04:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sc1sO-0002oM-HW
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 12:04:16 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hGGOCC5rENUw1BMQm+dkzv/EI4LY+Y4x6Br2gygWUnA=; b=Xl1TIQAcBkj/ufUHx86lxoBzPg
	xRRSo35zztoTp8jjQu/OtjuYPeZ16NrQ8epMoKW1nFPp+qOWF8ZOUjYkbqtWb0sa2Xy5OFDMZlrpE
	seJcZJfFbPYQsUJ76eG2QUL+AWat3mJbhLUSBvy2xsjMpQ/GajfFdMToO4o/4GGuDJn0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] x86/emul: Fix misaligned IO breakpoint behaviour in PV guests
Message-Id: <E1sc1sO-0002oM-HW@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 12:04:16 +0000

commit 72db7ba7dbd1287101b9533cd7e4c877f31a0764
Author:     Matthew Barnes <matthew.barnes@cloud.com>
AuthorDate: Thu Aug 8 13:57:43 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:57:43 2024 +0200

    x86/emul: Fix misaligned IO breakpoint behaviour in PV guests
    
    When hardware breakpoints are configured on misaligned IO ports, the
    hardware will mask the addresses based on the breakpoint width during
    comparison.
    
    For PV guests, misaligned IO breakpoints do not behave the same way, and
    therefore yield different results.
    
    This patch tweaks the emulation of IO breakpoints for PV guests such
    that they reproduce the same behaviour as hardware.
    
    Fixes: bec9e3205018 ("x86: emulate I/O port access breakpoints")
    Signed-off-by: Matthew Barnes <matthew.barnes@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 08aacc392d86d4c7dbebdb5e664060ae2af72057
    master date: 2024-08-08 13:27:50 +0200
---
 xen/arch/x86/pv/emul-priv-op.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index e429dfa4f0..f216c26412 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -358,6 +358,8 @@ static unsigned int check_guest_io_breakpoint(struct vcpu *v,
         case DR_LEN_8: width = 8; break;
         }
 
+        start &= ~(width - 1UL);
+
         if ( (start < (port + len)) && ((start + width) > port) )
             match |= 1u << i;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 22:22:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 22:22:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774477.1184879 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scBWQ-0007Ob-2L; Thu, 08 Aug 2024 22:22:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774477.1184879; Thu, 08 Aug 2024 22:22:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scBWP-0007OU-Vb; Thu, 08 Aug 2024 22:22:13 +0000
Received: by outflank-mailman (input) for mailman id 774477;
 Thu, 08 Aug 2024 22:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scBWO-0007OI-J1
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 22:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scBWO-0001mW-IJ
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 22:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scBWO-0007VP-Gz
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 22:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xhIlRono83kxAMv+CP4/50EsLjVS/UrbJr/SnFQa6sw=; b=cda67FS/puEA/lATcB6e2OwFV4
	62YJWpZ6ZoxSi+oB4ES6SqfuxHQzUT406FjsdtlbuLck0BriGnbxQE+GId37kiVwJDXj5EHKNAkdT
	8pa+38oqUU6HQQ67/j/s6y+4lV396XRbWWMU2hC79kjTZJZiCN7XjrhXbRFiZ0AW5sAw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] XSM/domctl: Fix permission checks on XEN_DOMCTL_createdomain
Message-Id: <E1scBWO-0007VP-Gz@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 22:22:12 +0000

commit 37a2c8fe359b97e98e8be9c534aa765a006532aa
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 8 13:55:30 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:55:30 2024 +0200

    XSM/domctl: Fix permission checks on XEN_DOMCTL_createdomain
    
    The XSM checks for XEN_DOMCTL_createdomain are problematic.  There's a split
    between xsm_domctl() called early, and flask_domain_create() called quite late
    during domain construction.
    
    All XSM implementations except Flask have a simple IS_PRIV check in
    xsm_domctl(), and operate as expected when an unprivileged domain tries to
    make a hypercall.
    
    Flask however foregoes any action in xsm_domctl() and defers everything,
    including the simple "is the caller permitted to create a domain" check, to
    flask_domain_create().
    
    As a consequence, when XSM Flask is active, and irrespective of the policy
    loaded, all domains irrespective of privilege can:
    
     * Mutate the global 'rover' variable, used to track the next free domid.
       Therefore, all domains can cause a domid wraparound, and combined with a
       voluntary reboot, choose their own domid.
    
     * Cause a reasonable amount of a domain to be constructed before ultimately
       failing for permission reasons, including the use of settings outside of
       supported limits.
    
    In order to remediate this, pass the ssidref into xsm_domctl() and at least
    check that the calling domain privileged enough to create domains.
    
    Take the opportunity to also fix the sign of the cmd parameter to be unsigned.
    
    This issue has not been assigned an XSA, because Flask is experimental and not
    security supported.
    
    Reported-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    master commit: ee32b9b29af449d38aad0a1b3a81aaae586f5ea7
    master date: 2024-07-30 17:42:17 +0100
---
 xen/arch/x86/mm/paging.c |  2 +-
 xen/common/domctl.c      |  4 +++-
 xen/include/xsm/dummy.h  |  2 +-
 xen/include/xsm/xsm.h    |  7 ++++---
 xen/xsm/flask/hooks.c    | 14 ++++++++++++--
 5 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index ae0340570d..d7785420bb 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -779,7 +779,7 @@ long do_paging_domctl_cont(
     if ( d == NULL )
         return -ESRCH;
 
-    ret = xsm_domctl(XSM_OTHER, d, op.cmd);
+    ret = xsm_domctl(XSM_OTHER, d, op.cmd, 0 /* SSIDref not applicable */);
     if ( !ret )
     {
         if ( domctl_lock_acquire() )
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index ad71ad8a4c..96ca55a421 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -318,7 +318,9 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
             return -ESRCH;
     }
 
-    ret = xsm_domctl(XSM_OTHER, d, op->cmd);
+    ret = xsm_domctl(XSM_OTHER, d, op->cmd,
+                     /* SSIDRef only applicable for cmd == createdomain */
+                     op->u.createdomain.ssidref);
     if ( ret )
         goto domctl_out_unlock_domonly;
 
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index 8671af1ba4..3286befeca 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -162,7 +162,7 @@ static XSM_INLINE int cf_check xsm_set_target(
 }
 
 static XSM_INLINE int cf_check xsm_domctl(
-    XSM_DEFAULT_ARG struct domain *d, int cmd)
+    XSM_DEFAULT_ARG struct domain *d, unsigned int cmd, uint32_t ssidref)
 {
     XSM_ASSERT_ACTION(XSM_OTHER);
     switch ( cmd )
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 8dad03fd3d..627c0d2731 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -60,7 +60,7 @@ struct xsm_ops {
     int (*domctl_scheduler_op)(struct domain *d, int op);
     int (*sysctl_scheduler_op)(int op);
     int (*set_target)(struct domain *d, struct domain *e);
-    int (*domctl)(struct domain *d, int cmd);
+    int (*domctl)(struct domain *d, unsigned int cmd, uint32_t ssidref);
     int (*sysctl)(int cmd);
     int (*readconsole)(uint32_t clear);
 
@@ -248,9 +248,10 @@ static inline int xsm_set_target(
     return alternative_call(xsm_ops.set_target, d, e);
 }
 
-static inline int xsm_domctl(xsm_default_t def, struct domain *d, int cmd)
+static inline int xsm_domctl(xsm_default_t def, struct domain *d,
+                             unsigned int cmd, uint32_t ssidref)
 {
-    return alternative_call(xsm_ops.domctl, d, cmd);
+    return alternative_call(xsm_ops.domctl, d, cmd, ssidref);
 }
 
 static inline int xsm_sysctl(xsm_default_t def, int cmd)
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 78225f68c1..42857c2122 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -663,12 +663,22 @@ static int cf_check flask_set_target(struct domain *d, struct domain *t)
     return rc;
 }
 
-static int cf_check flask_domctl(struct domain *d, int cmd)
+static int cf_check flask_domctl(struct domain *d, unsigned int cmd,
+                                 uint32_t ssidref)
 {
     switch ( cmd )
     {
-    /* These have individual XSM hooks (common/domctl.c) */
     case XEN_DOMCTL_createdomain:
+        /*
+         * There is a later hook too, but at this early point simply check
+         * that the calling domain is privileged enough to create a domain.
+         *
+         * Note that d is NULL because we haven't even allocated memory for it
+         * this early in XEN_DOMCTL_createdomain.
+         */
+        return avc_current_has_perm(ssidref, SECCLASS_DOMAIN, DOMAIN__CREATE, NULL);
+
+    /* These have individual XSM hooks (common/domctl.c) */
     case XEN_DOMCTL_getdomaininfo:
     case XEN_DOMCTL_scheduler_op:
     case XEN_DOMCTL_irq_permission:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 22:22:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 22:22:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774476.1184875 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scBWG-0007ND-0o; Thu, 08 Aug 2024 22:22:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774476.1184875; Thu, 08 Aug 2024 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 1scBWF-0007N4-U5; Thu, 08 Aug 2024 22:22:03 +0000
Received: by outflank-mailman (input) for mailman id 774476;
 Thu, 08 Aug 2024 22:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scBWE-0007My-Lm
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 22:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scBWE-0001mP-EY
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 22:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scBWE-0007Ui-C2
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 22:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=l3DZyJ9k5hwMUyl9HHD6ZabMJifEwATmFDsDOn9Vboo=; b=aEWn2n36Yy/orewP0DP9TfAiPw
	UB8LSTB1kKpVGYMnrbizyFVo/pRlthM2QqgsnRzpnIcKfJewTrFkIvcMi1nW3ZJbVCOtAXG2UeoWA
	GNtt0YliuoKYjh8AP+Rm4pL+7EYJwtH1McxIcCBUy33m+TMBpd2w6hzvgsFJDBhb3dWM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] bunzip2: fix rare decompression failure
Message-Id: <E1scBWE-0007Ui-C2@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 22:22:02 +0000

commit d663711c05883948d306fea59a2c834a7a3b94da
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Thu Aug 8 13:55:01 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:55:01 2024 +0200

    bunzip2: fix rare decompression failure
    
    The decompression code parses a huffman tree and counts the number of
    symbols for a given bit length.  In rare cases, there may be >= 256
    symbols with a given bit length, causing the unsigned char to overflow.
    This causes a decompression failure later when the code tries and fails to
    find the bit length for a given symbol.
    
    Since the maximum number of symbols is 258, use unsigned short instead.
    
    Fixes: ab77e81f6521 ("x86/dom0: support bzip2 and lzma compressed bzImage payloads")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 303d3ff85c90ee4af4bad4e3b1d4932fa2634d64
    master date: 2024-07-30 11:55:56 +0200
---
 xen/common/bunzip2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/bunzip2.c b/xen/common/bunzip2.c
index 4466426941..79f17162b1 100644
--- a/xen/common/bunzip2.c
+++ b/xen/common/bunzip2.c
@@ -221,7 +221,8 @@ static int __init get_next_block(struct bunzip_data *bd)
 	   RUNB) */
 	symCount = symTotal+2;
 	for (j = 0; j < groupCount; j++) {
-		unsigned char length[MAX_SYMBOLS], temp[MAX_HUFCODE_BITS+1];
+		unsigned char length[MAX_SYMBOLS];
+		unsigned short temp[MAX_HUFCODE_BITS+1];
 		int	minLen,	maxLen, pp;
 		/* Read Huffman code lengths for each symbol.  They're
 		   stored in a way similar to mtf; record a starting
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 22:22:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 22:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774481.1184893 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scBWZ-0007ig-DU; Thu, 08 Aug 2024 22:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774481.1184893; Thu, 08 Aug 2024 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 1scBWZ-0007iX-Ac; Thu, 08 Aug 2024 22:22:23 +0000
Received: by outflank-mailman (input) for mailman id 774481;
 Thu, 08 Aug 2024 22:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scBWY-0007i8-NZ
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 22:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scBWY-0001mx-Mr
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 22:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scBWY-0007W8-KU
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 22: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sqUsaXz0XbZGzeWVhvUVxYh/talc79UJllEL2IZdMk8=; b=OAncovM4tjDWiRBdsa2+DNDUZD
	qEY7slWxYPMhWa9MWq3DEdyfwdCxAKig6aI/8F+1V1E1dal6pos9Tmdah2Su5MXYy4hJTam/ffrla
	emUPeVEHuXXDE8xg7lp70jrKqHCrH1unoOpoWC1tSbzNJM+ZbIIMKEq6JX1FmLmtHWmc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/dom0: fix restoring %cr3 and the mapcache override on PV build error
Message-Id: <E1scBWY-0007W8-KU@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 22:22:22 +0000

commit 82e70687b8f53310775b65ce63259288b6b3e45b
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Aug 8 13:55:53 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:55:53 2024 +0200

    x86/dom0: fix restoring %cr3 and the mapcache override on PV build error
    
    One of the error paths in the PV dom0 builder section that runs on the guest
    page-tables wasn't restoring the Xen value of %cr3, neither removing the
    mapcache override.
    
    Fixes: 079ff2d32c3d ('libelf-loader: introduce elf_load_image')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 1fc3f77113dd43b14fa7ef5936dcdba120c0b63f
    master date: 2024-07-31 12:41:02 +0200
---
 xen/arch/x86/pv/dom0_build.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index a62f0fa2ef..3e74cf4ea2 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -821,6 +821,8 @@ int __init dom0_construct_pv(struct domain *d,
     rc = elf_load_binary(&elf);
     if ( rc < 0 )
     {
+        mapcache_override_current(NULL);
+        switch_cr3_cr4(current->arch.cr3, read_cr4());
         printk("Failed to load the kernel binary\n");
         goto out;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 22:22:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 22:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774482.1184897 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scBWj-0007qQ-F4; Thu, 08 Aug 2024 22:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774482.1184897; Thu, 08 Aug 2024 22: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 1scBWj-0007qI-CF; Thu, 08 Aug 2024 22:22:33 +0000
Received: by outflank-mailman (input) for mailman id 774482;
 Thu, 08 Aug 2024 22:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scBWi-0007p6-Qm
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 22:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scBWi-0001n6-Py
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 22:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scBWi-0007Wf-Ou
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 22: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tHH6eYDlFqRbXy43Ka4AnPN5+zdwGquVw7k+G63vr5I=; b=gAfEPeN6+WE+uUZs6bpbyoUBwp
	HSCurzpgLuDFoiETW9fS4beH89FWhLgeGh3J6ChwAUPVyNCgh9Y4XRF7XkKO1Bev5VBja67y/CpZE
	bc+P8CTmZwt3r93ryxmSUpYpiRezflJo3mEVem/haOhoXf+UdFLlosS/tPiTQtu/MCkM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/altcall: further refine clang workaround
Message-Id: <E1scBWi-0007Wf-Ou@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 22:22:32 +0000

commit ca191891e37fd13fd5e1685624e3c16563426ff4
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Aug 8 13:56:20 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:56:20 2024 +0200

    x86/altcall: further refine clang workaround
    
    The current code in ALT_CALL_ARG() won't successfully workaround the clang
    code-generation issue if the arg parameter has a size that's not a power of 2.
    While there are no such sized parameters at the moment, improve the workaround
    to also be effective when such sizes are used.
    
    Instead of using a union with a long use an unsigned long that's first
    initialized to 0 and afterwards set to the argument value.
    
    Reported-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Suggested-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 561cba38ff551383a628dc93e64ab0691cfc92bf
    master date: 2024-07-31 12:41:22 +0200
---
 xen/arch/x86/include/asm/alternative.h | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/include/asm/alternative.h b/xen/arch/x86/include/asm/alternative.h
index b54a970e70..ee4cbe92cc 100644
--- a/xen/arch/x86/include/asm/alternative.h
+++ b/xen/arch/x86/include/asm/alternative.h
@@ -169,27 +169,25 @@ extern void alternative_branches(void);
 
 #ifdef CONFIG_CC_IS_CLANG
 /*
- * Use a union with an unsigned long in order to prevent clang from
- * skipping a possible truncation of the value.  By using the union any
- * truncation is carried before the call instruction, in turn covering
- * for ABI-non-compliance in that the necessary clipping / extension of
- * the value is supposed to be carried out in the callee.
+ * Clang doesn't follow the psABI and doesn't truncate parameter values at the
+ * callee.  This can lead to bad code being generated when using alternative
+ * calls.
  *
- * Note this behavior is not mandated by the standard, and hence could
- * stop being a viable workaround, or worse, could cause a different set
- * of code-generation issues in future clang versions.
+ * Workaround it by using a temporary intermediate variable that's zeroed
+ * before being assigned the parameter value, as that forces clang to zero the
+ * register at the caller.
  *
  * This has been reported upstream:
  * https://github.com/llvm/llvm-project/issues/12579
  * https://github.com/llvm/llvm-project/issues/82598
  */
 #define ALT_CALL_ARG(arg, n)                                            \
-    register union {                                                    \
-        typeof(arg) e[sizeof(long) / sizeof(arg)];                      \
-        unsigned long r;                                                \
-    } a ## n ## _ asm ( ALT_CALL_arg ## n ) = {                         \
-        .e[0] = ({ BUILD_BUG_ON(sizeof(arg) > sizeof(void *)); (arg); })\
-    }
+    register unsigned long a ## n ## _ asm ( ALT_CALL_arg ## n ) = ({   \
+        unsigned long tmp = 0;                                          \
+        BUILD_BUG_ON(sizeof(arg) > sizeof(unsigned long));              \
+        *(typeof(arg) *)&tmp = (arg);                                   \
+        tmp;                                                            \
+    })
 #else
 #define ALT_CALL_ARG(arg, n) \
     register typeof(arg) a ## n ## _ asm ( ALT_CALL_arg ## n ) = \
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 22:22:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 22:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774487.1184901 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scBWt-0007zR-Gq; Thu, 08 Aug 2024 22:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774487.1184901; Thu, 08 Aug 2024 22: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 1scBWt-0007zJ-Dy; Thu, 08 Aug 2024 22:22:43 +0000
Received: by outflank-mailman (input) for mailman id 774487;
 Thu, 08 Aug 2024 22:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scBWs-0007zA-U9
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 22:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scBWs-0001nG-TR
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 22:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scBWs-0007XC-SA
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 22: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7ZGEW/peDz0xxwad1a1JfK8ZXceesexmtbIhRK9MiX8=; b=txnaRKaM1/Gt2YqMccmcD6cNLp
	oNVIEMfbGyRi/F4FncojO+jIyAo/lCb8nrAJdyz936yJU7nYTexmDKNto+g8tVMXnXqSweH11rbQx
	W/Vg3ZrGA35Vd+Sbx5ClYwvT9BAgNR6biC6Eurosfw+4r6Cki+S3DLgi0EeT5GAcwTWM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] xen/sched: fix error handling in cpu_schedule_up()
Message-Id: <E1scBWs-0007XC-SA@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 22:22:42 +0000

commit befe52ecf0483b1e4d9cd27a88b6eca27cdc3ba5
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Aug 8 13:56:35 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:56:35 2024 +0200

    xen/sched: fix error handling in cpu_schedule_up()
    
    In case cpu_schedule_up() is failing, it needs to undo all externally
    visible changes it has done before.
    
    Reason is that cpu_schedule_callback() won't be called with the
    CPU_UP_CANCELED notifier in case cpu_schedule_up() did fail.
    
    Fixes: 207589dbacd4 ("xen/sched: move per cpu scheduler private data into struct sched_resource")
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 44a7d4f0a5e9eae41a44a162e54ff6d2ebe5b7d6
    master date: 2024-07-31 14:50:18 +0200
---
 xen/common/sched/core.c | 63 ++++++++++++++++++++++++++-----------------------
 1 file changed, 33 insertions(+), 30 deletions(-)

diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index a9ff98f67a..8c6c26b562 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -2760,6 +2760,36 @@ static struct sched_resource *sched_alloc_res(void)
     return sr;
 }
 
+static void cf_check sched_res_free(struct rcu_head *head)
+{
+    struct sched_resource *sr = container_of(head, struct sched_resource, rcu);
+
+    free_cpumask_var(sr->cpus);
+    if ( sr->sched_unit_idle )
+        sched_free_unit_mem(sr->sched_unit_idle);
+    xfree(sr);
+}
+
+static void cpu_schedule_down(unsigned int cpu)
+{
+    struct sched_resource *sr;
+
+    rcu_read_lock(&sched_res_rculock);
+
+    sr = get_sched_res(cpu);
+
+    kill_timer(&sr->s_timer);
+
+    cpumask_clear_cpu(cpu, &sched_res_mask);
+    set_sched_res(cpu, NULL);
+
+    /* Keep idle unit. */
+    sr->sched_unit_idle = NULL;
+    call_rcu(&sr->rcu, sched_res_free);
+
+    rcu_read_unlock(&sched_res_rculock);
+}
+
 static int cpu_schedule_up(unsigned int cpu)
 {
     struct sched_resource *sr;
@@ -2799,7 +2829,10 @@ static int cpu_schedule_up(unsigned int cpu)
         idle_vcpu[cpu]->sched_unit->res = sr;
 
     if ( idle_vcpu[cpu] == NULL )
+    {
+        cpu_schedule_down(cpu);
         return -ENOMEM;
+    }
 
     idle_vcpu[cpu]->sched_unit->rendezvous_in_cnt = 0;
 
@@ -2817,36 +2850,6 @@ static int cpu_schedule_up(unsigned int cpu)
     return 0;
 }
 
-static void cf_check sched_res_free(struct rcu_head *head)
-{
-    struct sched_resource *sr = container_of(head, struct sched_resource, rcu);
-
-    free_cpumask_var(sr->cpus);
-    if ( sr->sched_unit_idle )
-        sched_free_unit_mem(sr->sched_unit_idle);
-    xfree(sr);
-}
-
-static void cpu_schedule_down(unsigned int cpu)
-{
-    struct sched_resource *sr;
-
-    rcu_read_lock(&sched_res_rculock);
-
-    sr = get_sched_res(cpu);
-
-    kill_timer(&sr->s_timer);
-
-    cpumask_clear_cpu(cpu, &sched_res_mask);
-    set_sched_res(cpu, NULL);
-
-    /* Keep idle unit. */
-    sr->sched_unit_idle = NULL;
-    call_rcu(&sr->rcu, sched_res_free);
-
-    rcu_read_unlock(&sched_res_rculock);
-}
-
 void sched_rm_cpu(unsigned int cpu)
 {
     int rc;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 22:22:53 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 22:22:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774488.1184905 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scBX3-00082W-I0; Thu, 08 Aug 2024 22:22:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774488.1184905; Thu, 08 Aug 2024 22:22:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scBX3-00082O-FP; Thu, 08 Aug 2024 22:22:53 +0000
Received: by outflank-mailman (input) for mailman id 774488;
 Thu, 08 Aug 2024 22:22:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scBX3-00082I-0z
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 22:22:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scBX3-0001nd-0L
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 22:22:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scBX2-0007Xi-Vg
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 22: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xKYvMGiD/pjiOEDSpxAaNPgcg8LT2fNQbJkWHMcWLkA=; b=n/4UxV6FUlqcYRFYFizG5EFzYB
	62oSta5T13qcoeL8+eS5BF7eH4jeZe+lGozPbDu0CfZ6PRxRsTfB4OimbnyRRFR/UkLUUMBsiFsdX
	3tXLPHGfxczVCtxiJVgAC8xKavqWm9djD+7LZf4FRdgJ0WxPtRrRAT26fPN70o1tDNrI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] xen/hvm: Don't skip MSR_READ trace record
Message-Id: <E1scBX2-0007Xi-Vg@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 22:22:52 +0000

commit e336a160eb1df488bca2044a0d2aea70abeb70d8
Author:     George Dunlap <george.dunlap@cloud.com>
AuthorDate: Thu Aug 8 13:57:10 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:57:10 2024 +0200

    xen/hvm: Don't skip MSR_READ trace record
    
    Commit 37f074a3383 ("x86/msr: introduce guest_rdmsr()") introduced a
    function to combine the MSR_READ handling between PV and HVM.
    Unfortunately, by returning directly, it skipped the trace generation,
    leading to gaps in the trace record, as well as xenalyze errors like
    this:
    
    hvm_generic_postprocess: d2v0 Strange, exit 7c(VMEXIT_MSR) missing a handler
    
    Replace the `return` with `goto out`.
    
    Fixes: 37f074a3383 ("x86/msr: introduce guest_rdmsr()")
    Signed-off-by: George Dunlap <george.dunlap@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: bc8a43fff61ae4162a95d84f4e148d6773667cd2
    master date: 2024-08-02 08:42:09 +0200
---
 xen/arch/x86/hvm/hvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 558dc3eddc..6ae15e04f3 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3524,7 +3524,7 @@ int hvm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
     fixed_range_base = (uint64_t *)v->arch.hvm.mtrr.fixed_ranges;
 
     if ( (ret = guest_rdmsr(v, msr, msr_content)) != X86EMUL_UNHANDLEABLE )
-        return ret;
+        goto out;
 
     ret = X86EMUL_OKAY;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 22:23:03 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 22:23:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774491.1184908 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scBXD-00087B-Jh; Thu, 08 Aug 2024 22:23:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774491.1184908; Thu, 08 Aug 2024 22:23:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scBXD-000874-Gq; Thu, 08 Aug 2024 22:23:03 +0000
Received: by outflank-mailman (input) for mailman id 774491;
 Thu, 08 Aug 2024 22:23:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scBXD-00086u-40
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 22:23:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scBXD-0001o0-3G
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 22:23:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scBXD-0007YI-2M
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 22:23:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ywd3OjFyzBq+GvjX/RzeJD4vmN/ZyoP5OWDym+kJSzY=; b=Mng5e21dhtokGPEy2DCOOH+svO
	dkesGJN1qejHZMCRJ/5lpijY5pxTtoX2OQ+lOpbslRuUMq88fquvZDxJcm6XJFCHbSn310lHPxGEt
	SBMG19LHHoo8RydzieGUG1jG2K9vI4HX7M1kjcZatkywqigVYcqMXEgRWYyqmeMejjTg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] tools/lsevtchn: Use errno macro to handle hypercall error cases
Message-Id: <E1scBXD-0007YI-2M@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 22:23:03 +0000

commit 2cb91df736374f3a09cbff1d61fe8e7d6dbc636c
Author:     Matthew Barnes <matthew.barnes@cloud.com>
AuthorDate: Thu Aug 8 13:57:28 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:57:28 2024 +0200

    tools/lsevtchn: Use errno macro to handle hypercall error cases
    
    Currently, lsevtchn aborts its event channel enumeration when it hits
    an event channel that is owned by Xen.
    
    lsevtchn does not distinguish between different hypercall errors, which
    results in lsevtchn missing potential relevant event channels with
    higher port numbers.
    
    Use the errno macro to distinguish between hypercall errors, and
    continue event channel enumeration if the hypercall error is not
    critical to enumeration.
    
    Signed-off-by: Matthew Barnes <matthew.barnes@cloud.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: e92a453c8db8bba62d6be3006079e2b9990c3978
    master date: 2024-08-02 08:43:57 +0200
---
 tools/xcutils/lsevtchn.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/tools/xcutils/lsevtchn.c b/tools/xcutils/lsevtchn.c
index d1710613dd..30c8d847b8 100644
--- a/tools/xcutils/lsevtchn.c
+++ b/tools/xcutils/lsevtchn.c
@@ -3,6 +3,7 @@
 #include <stdint.h>
 #include <string.h>
 #include <stdio.h>
+#include <errno.h>
 
 #include <xenctrl.h>
 
@@ -24,7 +25,23 @@ int main(int argc, char **argv)
         status.port = port;
         rc = xc_evtchn_status(xch, &status);
         if ( rc < 0 )
-            break;
+        {
+            switch ( errno )
+            {
+            case EACCES: /* Xen-owned evtchn */
+                continue;
+
+            case EINVAL: /* Port enumeration has ended */
+                rc = 0;
+                break;
+
+            default:
+                perror("xc_evtchn_status");
+                rc = 1;
+                break;
+            }
+            goto out;
+        }
 
         if ( status.status == EVTCHNSTAT_closed )
             continue;
@@ -58,7 +75,8 @@ int main(int argc, char **argv)
         printf("\n");
     }
 
+ out:
     xc_interface_close(xch);
 
-    return 0;
+    return rc;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Aug 08 22:23:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 08 Aug 2024 22:23:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774493.1184913 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scBXN-0008B7-Ky; Thu, 08 Aug 2024 22:23:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774493.1184913; Thu, 08 Aug 2024 22:23: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 1scBXN-0008Az-IM; Thu, 08 Aug 2024 22:23:13 +0000
Received: by outflank-mailman (input) for mailman id 774493;
 Thu, 08 Aug 2024 22:23:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scBXN-0008At-7A
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 22:23:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scBXN-0001o9-6J
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 22:23:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scBXN-0007ZT-5R
 for xen-changelog@lists.xenproject.org; Thu, 08 Aug 2024 22:23:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eHzRCEkZumIBPmThnNVuwNH7Hx9iqvmG0cvX+iYrix0=; b=wimdcZXvUs5sp3+cqqOGOthbyc
	06YnCJFCzJSl1HGCRNYHxJil15bl46fw77TdsF3SDBVs82wzyWZ6e/VypeBus6SBq20xf3t/fMbyX
	6yIa07+UgYh9TzMgmRdKrgTaS0BM2FchKSz2I0l9CbMYrLnuAgEj4xsYIxVaTcX9ekH0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/emul: Fix misaligned IO breakpoint behaviour in PV guests
Message-Id: <E1scBXN-0007ZT-5R@xenbits.xenproject.org>
Date: Thu, 08 Aug 2024 22:23:13 +0000

commit 72db7ba7dbd1287101b9533cd7e4c877f31a0764
Author:     Matthew Barnes <matthew.barnes@cloud.com>
AuthorDate: Thu Aug 8 13:57:43 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:57:43 2024 +0200

    x86/emul: Fix misaligned IO breakpoint behaviour in PV guests
    
    When hardware breakpoints are configured on misaligned IO ports, the
    hardware will mask the addresses based on the breakpoint width during
    comparison.
    
    For PV guests, misaligned IO breakpoints do not behave the same way, and
    therefore yield different results.
    
    This patch tweaks the emulation of IO breakpoints for PV guests such
    that they reproduce the same behaviour as hardware.
    
    Fixes: bec9e3205018 ("x86: emulate I/O port access breakpoints")
    Signed-off-by: Matthew Barnes <matthew.barnes@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 08aacc392d86d4c7dbebdb5e664060ae2af72057
    master date: 2024-08-08 13:27:50 +0200
---
 xen/arch/x86/pv/emul-priv-op.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index e429dfa4f0..f216c26412 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -358,6 +358,8 @@ static unsigned int check_guest_io_breakpoint(struct vcpu *v,
         case DR_LEN_8: width = 8; break;
         }
 
+        start &= ~(width - 1UL);
+
         if ( (start < (port + len)) && ((start + width) > port) )
             match |= 1u << i;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Aug 09 02:33:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Aug 2024 02:33:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774520.1184936 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scFR9-0007IJ-1T; Fri, 09 Aug 2024 02:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774520.1184936; Fri, 09 Aug 2024 02: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 1scFR8-0007IC-V4; Fri, 09 Aug 2024 02:33:02 +0000
Received: by outflank-mailman (input) for mailman id 774520;
 Fri, 09 Aug 2024 02:33:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scFR8-0007I6-0r
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 02:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scFR7-0001yS-Se
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 02:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scFR7-0006so-Pp
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 02: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kHZzM7r7wFH8+lhtyv5F3PAmWKgwzthokOHXe9TiU+g=; b=oLM9g9Hw/aVvy7aSMtdrPowEln
	c8tLtpYWQiyuMAkQczyBTl3YVmR3imWSd6weEYaHi1ct9+d63euJJb7tCSFBWyBMCtA4j8MaCKaIx
	E0jY1V7oHVd4P0MwZuKm3vcYA2XhNQHmh/QvwAoqZAUhMgXHYBUG0lY9717TwQpV+PIM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] bunzip2: fix rare decompression failure
Message-Id: <E1scFR7-0006so-Pp@xenbits.xenproject.org>
Date: Fri, 09 Aug 2024 02:33:01 +0000

commit b3fc8ffcca50d5a52130734f8a037a580b7c9500
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Thu Aug 8 13:50:36 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:50:36 2024 +0200

    bunzip2: fix rare decompression failure
    
    The decompression code parses a huffman tree and counts the number of
    symbols for a given bit length.  In rare cases, there may be >= 256
    symbols with a given bit length, causing the unsigned char to overflow.
    This causes a decompression failure later when the code tries and fails to
    find the bit length for a given symbol.
    
    Since the maximum number of symbols is 258, use unsigned short instead.
    
    Fixes: ab77e81f6521 ("x86/dom0: support bzip2 and lzma compressed bzImage payloads")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 303d3ff85c90ee4af4bad4e3b1d4932fa2634d64
    master date: 2024-07-30 11:55:56 +0200
---
 xen/common/bunzip2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/bunzip2.c b/xen/common/bunzip2.c
index 4466426941..79f17162b1 100644
--- a/xen/common/bunzip2.c
+++ b/xen/common/bunzip2.c
@@ -221,7 +221,8 @@ static int __init get_next_block(struct bunzip_data *bd)
 	   RUNB) */
 	symCount = symTotal+2;
 	for (j = 0; j < groupCount; j++) {
-		unsigned char length[MAX_SYMBOLS], temp[MAX_HUFCODE_BITS+1];
+		unsigned char length[MAX_SYMBOLS];
+		unsigned short temp[MAX_HUFCODE_BITS+1];
 		int	minLen,	maxLen, pp;
 		/* Read Huffman code lengths for each symbol.  They're
 		   stored in a way similar to mtf; record a starting
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Fri Aug 09 02:33:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Aug 2024 02:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774521.1184941 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scFRJ-0007KN-2u; Fri, 09 Aug 2024 02:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774521.1184941; Fri, 09 Aug 2024 02: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 1scFRJ-0007KF-0O; Fri, 09 Aug 2024 02:33:13 +0000
Received: by outflank-mailman (input) for mailman id 774521;
 Fri, 09 Aug 2024 02:33:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scFRI-0007K6-1h
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 02:33:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scFRI-0001yc-0G
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 02:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scFRH-0006tK-VA
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 02: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LEBGdHnMtGu4eFJHpsRtLdgcBbsxvBPzNdHOONS6gaY=; b=7LZh3vBoFBnczYu2nLQ63Y56Sa
	Zw4J5kUxsyJlRXeCDoXnaBOb3GIjDA+/4dy4ZRVllp+uU+EGx6bwBqsJGGGmoN0vNVG8pityx9m9q
	3i+jdXd5eQ3KmCxgaMnvCw82ojB3gcO1hD2oBr9++6QH82/a+s1LqtV/4mq1Z36XtlSI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] XSM/domctl: Fix permission checks on XEN_DOMCTL_createdomain
Message-Id: <E1scFRH-0006tK-VA@xenbits.xenproject.org>
Date: Fri, 09 Aug 2024 02:33:11 +0000

commit 98fda0718f79c44e5753e7ef481ca61c8361e234
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 8 13:51:09 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:51:09 2024 +0200

    XSM/domctl: Fix permission checks on XEN_DOMCTL_createdomain
    
    The XSM checks for XEN_DOMCTL_createdomain are problematic.  There's a split
    between xsm_domctl() called early, and flask_domain_create() called quite late
    during domain construction.
    
    All XSM implementations except Flask have a simple IS_PRIV check in
    xsm_domctl(), and operate as expected when an unprivileged domain tries to
    make a hypercall.
    
    Flask however foregoes any action in xsm_domctl() and defers everything,
    including the simple "is the caller permitted to create a domain" check, to
    flask_domain_create().
    
    As a consequence, when XSM Flask is active, and irrespective of the policy
    loaded, all domains irrespective of privilege can:
    
     * Mutate the global 'rover' variable, used to track the next free domid.
       Therefore, all domains can cause a domid wraparound, and combined with a
       voluntary reboot, choose their own domid.
    
     * Cause a reasonable amount of a domain to be constructed before ultimately
       failing for permission reasons, including the use of settings outside of
       supported limits.
    
    In order to remediate this, pass the ssidref into xsm_domctl() and at least
    check that the calling domain privileged enough to create domains.
    
    Take the opportunity to also fix the sign of the cmd parameter to be unsigned.
    
    This issue has not been assigned an XSA, because Flask is experimental and not
    security supported.
    
    Reported-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    master commit: ee32b9b29af449d38aad0a1b3a81aaae586f5ea7
    master date: 2024-07-30 17:42:17 +0100
---
 xen/arch/x86/mm/paging.c |  2 +-
 xen/common/domctl.c      |  4 +++-
 xen/include/xsm/dummy.h  |  2 +-
 xen/include/xsm/xsm.h    |  7 ++++---
 xen/xsm/flask/hooks.c    | 14 ++++++++++++--
 5 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index 34d833251b..3a309bc74b 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -767,7 +767,7 @@ long do_paging_domctl_cont(
     if ( d == NULL )
         return -ESRCH;
 
-    ret = xsm_domctl(XSM_OTHER, d, op.cmd);
+    ret = xsm_domctl(XSM_OTHER, d, op.cmd, 0 /* SSIDref not applicable */);
     if ( !ret )
     {
         if ( domctl_lock_acquire() )
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 505e29c0dc..6cf78d4975 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -318,7 +318,9 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
             return -ESRCH;
     }
 
-    ret = xsm_domctl(XSM_OTHER, d, op->cmd);
+    ret = xsm_domctl(XSM_OTHER, d, op->cmd,
+                     /* SSIDRef only applicable for cmd == createdomain */
+                     op->u.createdomain.ssidref);
     if ( ret )
         goto domctl_out_unlock_domonly;
 
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index 8671af1ba4..3286befeca 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -162,7 +162,7 @@ static XSM_INLINE int cf_check xsm_set_target(
 }
 
 static XSM_INLINE int cf_check xsm_domctl(
-    XSM_DEFAULT_ARG struct domain *d, int cmd)
+    XSM_DEFAULT_ARG struct domain *d, unsigned int cmd, uint32_t ssidref)
 {
     XSM_ASSERT_ACTION(XSM_OTHER);
     switch ( cmd )
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 8dad03fd3d..627c0d2731 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -60,7 +60,7 @@ struct xsm_ops {
     int (*domctl_scheduler_op)(struct domain *d, int op);
     int (*sysctl_scheduler_op)(int op);
     int (*set_target)(struct domain *d, struct domain *e);
-    int (*domctl)(struct domain *d, int cmd);
+    int (*domctl)(struct domain *d, unsigned int cmd, uint32_t ssidref);
     int (*sysctl)(int cmd);
     int (*readconsole)(uint32_t clear);
 
@@ -248,9 +248,10 @@ static inline int xsm_set_target(
     return alternative_call(xsm_ops.set_target, d, e);
 }
 
-static inline int xsm_domctl(xsm_default_t def, struct domain *d, int cmd)
+static inline int xsm_domctl(xsm_default_t def, struct domain *d,
+                             unsigned int cmd, uint32_t ssidref)
 {
-    return alternative_call(xsm_ops.domctl, d, cmd);
+    return alternative_call(xsm_ops.domctl, d, cmd, ssidref);
 }
 
 static inline int xsm_sysctl(xsm_default_t def, int cmd)
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 5e88c71b8e..278ad38c2a 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -663,12 +663,22 @@ static int cf_check flask_set_target(struct domain *d, struct domain *t)
     return rc;
 }
 
-static int cf_check flask_domctl(struct domain *d, int cmd)
+static int cf_check flask_domctl(struct domain *d, unsigned int cmd,
+                                 uint32_t ssidref)
 {
     switch ( cmd )
     {
-    /* These have individual XSM hooks (common/domctl.c) */
     case XEN_DOMCTL_createdomain:
+        /*
+         * There is a later hook too, but at this early point simply check
+         * that the calling domain is privileged enough to create a domain.
+         *
+         * Note that d is NULL because we haven't even allocated memory for it
+         * this early in XEN_DOMCTL_createdomain.
+         */
+        return avc_current_has_perm(ssidref, SECCLASS_DOMAIN, DOMAIN__CREATE, NULL);
+
+    /* These have individual XSM hooks (common/domctl.c) */
     case XEN_DOMCTL_getdomaininfo:
     case XEN_DOMCTL_scheduler_op:
     case XEN_DOMCTL_irq_permission:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Fri Aug 09 02:33:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Aug 2024 02:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774522.1184946 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scFRT-0007O6-68; Fri, 09 Aug 2024 02:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774522.1184946; Fri, 09 Aug 2024 02: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 1scFRT-0007Nw-34; Fri, 09 Aug 2024 02:33:23 +0000
Received: by outflank-mailman (input) for mailman id 774522;
 Fri, 09 Aug 2024 02:33:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scFRS-0007Nd-4r
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 02:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scFRS-0001yk-43
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 02:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scFRS-0006vp-2M
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 02: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=e1hxwDTTSWs2PhdTmoEBjEpEjqOvyCai0tf3WOC1hp4=; b=COxmwOOzueiBt1+iYhkdIKyfD/
	19nEu4ZkyAHJkaN6mmECmi3WJS3qiQxYkkGvXCskoPZR5d4gpxxVE0a6VtA/BcED/GqEANkEkENN3
	IWqoMRnF/eN7yOEMdhhrJOPaTsxpF5qg6ue88M6R/KyD944qUiTTuMlT9QhSYCoFRz28=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/dom0: fix restoring %cr3 and the mapcache override on PV build error
Message-Id: <E1scFRS-0006vp-2M@xenbits.xenproject.org>
Date: Fri, 09 Aug 2024 02:33:22 +0000

commit a71fac3c48929e96881dbcb1f6eea7692369eb98
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Aug 8 13:51:39 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:51:39 2024 +0200

    x86/dom0: fix restoring %cr3 and the mapcache override on PV build error
    
    One of the error paths in the PV dom0 builder section that runs on the guest
    page-tables wasn't restoring the Xen value of %cr3, neither removing the
    mapcache override.
    
    Fixes: 079ff2d32c3d ('libelf-loader: introduce elf_load_image')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 1fc3f77113dd43b14fa7ef5936dcdba120c0b63f
    master date: 2024-07-31 12:41:02 +0200
---
 xen/arch/x86/pv/dom0_build.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 5bbed3a36a..64a0b9f598 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -822,6 +822,8 @@ int __init dom0_construct_pv(struct domain *d,
     rc = elf_load_binary(&elf);
     if ( rc < 0 )
     {
+        mapcache_override_current(NULL);
+        switch_cr3_cr4(current->arch.cr3, read_cr4());
         printk("Failed to load the kernel binary\n");
         goto out;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Fri Aug 09 02:33:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Aug 2024 02:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774523.1184949 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scFRd-0007Qe-7R; Fri, 09 Aug 2024 02:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774523.1184949; Fri, 09 Aug 2024 02: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 1scFRd-0007QW-4d; Fri, 09 Aug 2024 02:33:33 +0000
Received: by outflank-mailman (input) for mailman id 774523;
 Fri, 09 Aug 2024 02:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scFRc-0007QQ-9R
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 02:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scFRc-0001yr-8e
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 02:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scFRc-0006wH-6B
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 02: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ct7aX2XosQT5rXrK6Ms4YJ+aWvllJg+YHZwxQVkyJQQ=; b=tma9KYngZNXHeeF9Lae+i6rW4i
	p4u2X9rOYtH++L68bRM3G6WA35BZoX/LJDMtZe0KSC29Zm0JkdgGFzWlyW2ASIynFpCj4XyWvm7au
	m9xgQEKAvrBGdO1m1PY+F2oeltqo+JkNF6Jly3JhnbeoS7Fy+YXv0jW50zNhuKSY0Lf8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/altcall: further refine clang workaround
Message-Id: <E1scFRc-0006wH-6B@xenbits.xenproject.org>
Date: Fri, 09 Aug 2024 02:33:32 +0000

commit 211c73c8e9d8e75db9358fb3c9ce2fc56fb406bf
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Aug 8 13:52:11 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:52:11 2024 +0200

    x86/altcall: further refine clang workaround
    
    The current code in ALT_CALL_ARG() won't successfully workaround the clang
    code-generation issue if the arg parameter has a size that's not a power of 2.
    While there are no such sized parameters at the moment, improve the workaround
    to also be effective when such sizes are used.
    
    Instead of using a union with a long use an unsigned long that's first
    initialized to 0 and afterwards set to the argument value.
    
    Reported-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Suggested-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 561cba38ff551383a628dc93e64ab0691cfc92bf
    master date: 2024-07-31 12:41:22 +0200
---
 xen/arch/x86/include/asm/alternative.h | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/include/asm/alternative.h b/xen/arch/x86/include/asm/alternative.h
index e63b459276..a86eadfaec 100644
--- a/xen/arch/x86/include/asm/alternative.h
+++ b/xen/arch/x86/include/asm/alternative.h
@@ -169,27 +169,25 @@ extern void alternative_branches(void);
 
 #ifdef CONFIG_CC_IS_CLANG
 /*
- * Use a union with an unsigned long in order to prevent clang from
- * skipping a possible truncation of the value.  By using the union any
- * truncation is carried before the call instruction, in turn covering
- * for ABI-non-compliance in that the necessary clipping / extension of
- * the value is supposed to be carried out in the callee.
+ * Clang doesn't follow the psABI and doesn't truncate parameter values at the
+ * callee.  This can lead to bad code being generated when using alternative
+ * calls.
  *
- * Note this behavior is not mandated by the standard, and hence could
- * stop being a viable workaround, or worse, could cause a different set
- * of code-generation issues in future clang versions.
+ * Workaround it by using a temporary intermediate variable that's zeroed
+ * before being assigned the parameter value, as that forces clang to zero the
+ * register at the caller.
  *
  * This has been reported upstream:
  * https://github.com/llvm/llvm-project/issues/12579
  * https://github.com/llvm/llvm-project/issues/82598
  */
 #define ALT_CALL_ARG(arg, n)                                            \
-    register union {                                                    \
-        typeof(arg) e[sizeof(long) / sizeof(arg)];                      \
-        unsigned long r;                                                \
-    } a ## n ## _ asm ( ALT_CALL_arg ## n ) = {                         \
-        .e[0] = ({ BUILD_BUG_ON(sizeof(arg) > sizeof(void *)); (arg); })\
-    }
+    register unsigned long a ## n ## _ asm ( ALT_CALL_arg ## n ) = ({   \
+        unsigned long tmp = 0;                                          \
+        BUILD_BUG_ON(sizeof(arg) > sizeof(unsigned long));              \
+        *(typeof(arg) *)&tmp = (arg);                                   \
+        tmp;                                                            \
+    })
 #else
 #define ALT_CALL_ARG(arg, n) \
     register typeof(arg) a ## n ## _ asm ( ALT_CALL_arg ## n ) = \
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Fri Aug 09 02:33:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Aug 2024 02:33:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774524.1184954 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scFRn-0007Tz-9L; Fri, 09 Aug 2024 02:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774524.1184954; Fri, 09 Aug 2024 02: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 1scFRn-0007Tr-6K; Fri, 09 Aug 2024 02:33:43 +0000
Received: by outflank-mailman (input) for mailman id 774524;
 Fri, 09 Aug 2024 02:33:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scFRm-0007Td-CI
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 02:33:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scFRm-0001z0-BZ
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 02:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scFRm-0006wu-Ap
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 02: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=25RKimXjnA379TBHLX3RsUj7IQsNlgKAqQxC2ztUrXw=; b=TdPwCnML93Z/DpBivXE/3UoXQW
	ZvQ/mooqx7GFgdNdkKY6l8cq2YmIHfgq8ZG9/XkQY0y1NPEkDObStdhSMq5shfYOcyrBiZb+79aJz
	eSgLpYKhh2491/zjFLrfD6QCE077EymP6dX1F2PiLGJVaZbDCJ/Gyx5oGVSb+xbzz/C0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] xen/sched: fix error handling in cpu_schedule_up()
Message-Id: <E1scFRm-0006wu-Ap@xenbits.xenproject.org>
Date: Fri, 09 Aug 2024 02:33:42 +0000

commit bfae66cc4c2d65bb5a788b79e9b3dbd275d096b5
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Aug 8 13:52:26 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:52:26 2024 +0200

    xen/sched: fix error handling in cpu_schedule_up()
    
    In case cpu_schedule_up() is failing, it needs to undo all externally
    visible changes it has done before.
    
    Reason is that cpu_schedule_callback() won't be called with the
    CPU_UP_CANCELED notifier in case cpu_schedule_up() did fail.
    
    Fixes: 207589dbacd4 ("xen/sched: move per cpu scheduler private data into struct sched_resource")
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 44a7d4f0a5e9eae41a44a162e54ff6d2ebe5b7d6
    master date: 2024-07-31 14:50:18 +0200
---
 xen/common/sched/core.c | 63 ++++++++++++++++++++++++++-----------------------
 1 file changed, 33 insertions(+), 30 deletions(-)

diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index 3c2403ebcf..cbaa292bb2 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -2760,6 +2760,36 @@ static struct sched_resource *sched_alloc_res(void)
     return sr;
 }
 
+static void cf_check sched_res_free(struct rcu_head *head)
+{
+    struct sched_resource *sr = container_of(head, struct sched_resource, rcu);
+
+    free_cpumask_var(sr->cpus);
+    if ( sr->sched_unit_idle )
+        sched_free_unit_mem(sr->sched_unit_idle);
+    xfree(sr);
+}
+
+static void cpu_schedule_down(unsigned int cpu)
+{
+    struct sched_resource *sr;
+
+    rcu_read_lock(&sched_res_rculock);
+
+    sr = get_sched_res(cpu);
+
+    kill_timer(&sr->s_timer);
+
+    cpumask_clear_cpu(cpu, &sched_res_mask);
+    set_sched_res(cpu, NULL);
+
+    /* Keep idle unit. */
+    sr->sched_unit_idle = NULL;
+    call_rcu(&sr->rcu, sched_res_free);
+
+    rcu_read_unlock(&sched_res_rculock);
+}
+
 static int cpu_schedule_up(unsigned int cpu)
 {
     struct sched_resource *sr;
@@ -2799,7 +2829,10 @@ static int cpu_schedule_up(unsigned int cpu)
         idle_vcpu[cpu]->sched_unit->res = sr;
 
     if ( idle_vcpu[cpu] == NULL )
+    {
+        cpu_schedule_down(cpu);
         return -ENOMEM;
+    }
 
     idle_vcpu[cpu]->sched_unit->rendezvous_in_cnt = 0;
 
@@ -2817,36 +2850,6 @@ static int cpu_schedule_up(unsigned int cpu)
     return 0;
 }
 
-static void cf_check sched_res_free(struct rcu_head *head)
-{
-    struct sched_resource *sr = container_of(head, struct sched_resource, rcu);
-
-    free_cpumask_var(sr->cpus);
-    if ( sr->sched_unit_idle )
-        sched_free_unit_mem(sr->sched_unit_idle);
-    xfree(sr);
-}
-
-static void cpu_schedule_down(unsigned int cpu)
-{
-    struct sched_resource *sr;
-
-    rcu_read_lock(&sched_res_rculock);
-
-    sr = get_sched_res(cpu);
-
-    kill_timer(&sr->s_timer);
-
-    cpumask_clear_cpu(cpu, &sched_res_mask);
-    set_sched_res(cpu, NULL);
-
-    /* Keep idle unit. */
-    sr->sched_unit_idle = NULL;
-    call_rcu(&sr->rcu, sched_res_free);
-
-    rcu_read_unlock(&sched_res_rculock);
-}
-
 void sched_rm_cpu(unsigned int cpu)
 {
     int rc;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Fri Aug 09 02:33:53 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Aug 2024 02:33:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774525.1184957 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scFRx-0007WU-AY; Fri, 09 Aug 2024 02:33:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774525.1184957; Fri, 09 Aug 2024 02: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 1scFRx-0007WM-7l; Fri, 09 Aug 2024 02:33:53 +0000
Received: by outflank-mailman (input) for mailman id 774525;
 Fri, 09 Aug 2024 02:33:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scFRw-0007WE-FQ
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 02:33:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scFRw-0001zQ-Eg
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 02:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scFRw-0006xV-Dq
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 02: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xViTSfENUABP3rCcTMbEkpZuvxJ2gWmvCziRnrXxdhc=; b=ThSpK0nOwPZ0j8bU0vL9uQdZGm
	wAhiHcKlPBLuzUVEAQef9u2qhjeR3uKSu/bLHloicGYj2ovYy2LMQ9ZRYXDE1VM9BCt6YnltuGs5o
	lRo8kyX2l/jy1T2jlE81axThgSWLZlwQTg+c7nNOO1/o92iE+eXkIgMm+T076scdTMck=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] xen/hvm: Don't skip MSR_READ trace record
Message-Id: <E1scFRw-0006xV-Dq@xenbits.xenproject.org>
Date: Fri, 09 Aug 2024 02:33:52 +0000

commit 4e0d6fad57d20876addd469e664dab0cde92e2c2
Author:     George Dunlap <george.dunlap@cloud.com>
AuthorDate: Thu Aug 8 13:53:01 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:53:01 2024 +0200

    xen/hvm: Don't skip MSR_READ trace record
    
    Commit 37f074a3383 ("x86/msr: introduce guest_rdmsr()") introduced a
    function to combine the MSR_READ handling between PV and HVM.
    Unfortunately, by returning directly, it skipped the trace generation,
    leading to gaps in the trace record, as well as xenalyze errors like
    this:
    
    hvm_generic_postprocess: d2v0 Strange, exit 7c(VMEXIT_MSR) missing a handler
    
    Replace the `return` with `goto out`.
    
    Fixes: 37f074a3383 ("x86/msr: introduce guest_rdmsr()")
    Signed-off-by: George Dunlap <george.dunlap@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: bc8a43fff61ae4162a95d84f4e148d6773667cd2
    master date: 2024-08-02 08:42:09 +0200
---
 xen/arch/x86/hvm/hvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index a70b351373..8f293f4feb 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3537,7 +3537,7 @@ int hvm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
     fixed_range_base = (uint64_t *)v->arch.hvm.mtrr.fixed_ranges;
 
     if ( (ret = guest_rdmsr(v, msr, msr_content)) != X86EMUL_UNHANDLEABLE )
-        return ret;
+        goto out;
 
     ret = X86EMUL_OKAY;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Fri Aug 09 02:34:03 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Aug 2024 02:34:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774526.1184960 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scFS7-0007Yl-Bb; Fri, 09 Aug 2024 02:34:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774526.1184960; Fri, 09 Aug 2024 02:34:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scFS7-0007Ye-9A; Fri, 09 Aug 2024 02:34:03 +0000
Received: by outflank-mailman (input) for mailman id 774526;
 Fri, 09 Aug 2024 02:34:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scFS6-0007YW-IU
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 02:34:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scFS6-0001zk-Hk
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 02:34:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scFS6-0006yQ-Gk
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 02: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fwNcS4574+FkyX7plN2I9yVj89HwTClmZcTKeeOxDJA=; b=rn++8q+fBvIoca0UWv71HTA8Ov
	y2IQIZUhSAySy6el8RyP+QsH10CBTR7v2bKg6sWGgCEZYchAw1xACV3DWgCtHS5Junf0pOOwCZgde
	wTNjOvSYBF3i86YrZMIurf9p7VX5woI9fOmCbp6pC6U2ZE4YzI0Yhqbb5HSIh8KdD230=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] tools/lsevtchn: Use errno macro to handle hypercall error cases
Message-Id: <E1scFS6-0006yQ-Gk@xenbits.xenproject.org>
Date: Fri, 09 Aug 2024 02:34:02 +0000

commit 8aa5245ef68065c0f3e5fcdcc3c410baa8654b35
Author:     Matthew Barnes <matthew.barnes@cloud.com>
AuthorDate: Thu Aug 8 13:53:26 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:53:26 2024 +0200

    tools/lsevtchn: Use errno macro to handle hypercall error cases
    
    Currently, lsevtchn aborts its event channel enumeration when it hits
    an event channel that is owned by Xen.
    
    lsevtchn does not distinguish between different hypercall errors, which
    results in lsevtchn missing potential relevant event channels with
    higher port numbers.
    
    Use the errno macro to distinguish between hypercall errors, and
    continue event channel enumeration if the hypercall error is not
    critical to enumeration.
    
    Signed-off-by: Matthew Barnes <matthew.barnes@cloud.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: e92a453c8db8bba62d6be3006079e2b9990c3978
    master date: 2024-08-02 08:43:57 +0200
---
 tools/xcutils/lsevtchn.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/tools/xcutils/lsevtchn.c b/tools/xcutils/lsevtchn.c
index d1710613dd..30c8d847b8 100644
--- a/tools/xcutils/lsevtchn.c
+++ b/tools/xcutils/lsevtchn.c
@@ -3,6 +3,7 @@
 #include <stdint.h>
 #include <string.h>
 #include <stdio.h>
+#include <errno.h>
 
 #include <xenctrl.h>
 
@@ -24,7 +25,23 @@ int main(int argc, char **argv)
         status.port = port;
         rc = xc_evtchn_status(xch, &status);
         if ( rc < 0 )
-            break;
+        {
+            switch ( errno )
+            {
+            case EACCES: /* Xen-owned evtchn */
+                continue;
+
+            case EINVAL: /* Port enumeration has ended */
+                rc = 0;
+                break;
+
+            default:
+                perror("xc_evtchn_status");
+                rc = 1;
+                break;
+            }
+            goto out;
+        }
 
         if ( status.status == EVTCHNSTAT_closed )
             continue;
@@ -58,7 +75,8 @@ int main(int argc, char **argv)
         printf("\n");
     }
 
+ out:
     xc_interface_close(xch);
 
-    return 0;
+    return rc;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Fri Aug 09 02:34:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Aug 2024 02:34:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774527.1184964 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scFSH-0007bH-D6; Fri, 09 Aug 2024 02:34:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774527.1184964; Fri, 09 Aug 2024 02:34:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scFSH-0007bA-Ad; Fri, 09 Aug 2024 02:34:13 +0000
Received: by outflank-mailman (input) for mailman id 774527;
 Fri, 09 Aug 2024 02:34:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scFSG-0007ay-LL
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 02:34:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scFSG-0001zs-Ke
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 02:34:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scFSG-0006zM-Jp
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 02: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wSsAUkr4ye9JjvmMV44aIRVKo9lQtCGzTWDfuRPZ+Pk=; b=GP6r2ul+2JNmWpfw2pcEuGPeo4
	VcR2uYpNLsUwUpEG99kEru4QFYchci/ZyeaZf+nn1Q5Cp5fnm7zXDTDFe1jXHBIUK8urw/JPjZ583
	dd5S7MJAH4kAyMmoxuXfbgSTll6IihBFxBcBQXPzMG0Fi7MPzaHw9TG30uLgdYwDTyxI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/emul: Fix misaligned IO breakpoint behaviour in PV guests
Message-Id: <E1scFSG-0006zM-Jp@xenbits.xenproject.org>
Date: Fri, 09 Aug 2024 02:34:12 +0000

commit d446b472cc5051c2ef4eaf5f895d96d7a458c8a1
Author:     Matthew Barnes <matthew.barnes@cloud.com>
AuthorDate: Thu Aug 8 13:53:40 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:53:40 2024 +0200

    x86/emul: Fix misaligned IO breakpoint behaviour in PV guests
    
    When hardware breakpoints are configured on misaligned IO ports, the
    hardware will mask the addresses based on the breakpoint width during
    comparison.
    
    For PV guests, misaligned IO breakpoints do not behave the same way, and
    therefore yield different results.
    
    This patch tweaks the emulation of IO breakpoints for PV guests such
    that they reproduce the same behaviour as hardware.
    
    Fixes: bec9e3205018 ("x86: emulate I/O port access breakpoints")
    Signed-off-by: Matthew Barnes <matthew.barnes@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 08aacc392d86d4c7dbebdb5e664060ae2af72057
    master date: 2024-08-08 13:27:50 +0200
---
 xen/arch/x86/pv/emul-priv-op.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index f101510a1b..aa11ecadaa 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -346,6 +346,8 @@ static unsigned int check_guest_io_breakpoint(struct vcpu *v,
         case DR_LEN_8: width = 8; break;
         }
 
+        start &= ~(width - 1UL);
+
         if ( (start < (port + len)) && ((start + width) > port) )
             match |= 1u << i;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Fri Aug 09 03:33:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Aug 2024 03:33:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774539.1184979 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scGNC-0008AI-Nc; Fri, 09 Aug 2024 03:33:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774539.1184979; Fri, 09 Aug 2024 03: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 1scGNC-0008AA-Kl; Fri, 09 Aug 2024 03:33:02 +0000
Received: by outflank-mailman (input) for mailman id 774539;
 Fri, 09 Aug 2024 03:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGNB-00089x-NT
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGNB-000305-Mj
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGNB-0002DP-KD
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=urYS5R3X0wyz7Bb0mSullvgL2n1/qAew7Wr6ReoxfSg=; b=OZbmdCwEGb+rQcpsjCEgdZK5oe
	eFE8hTRgkVm5yxOjRIMrwkuBYQRtByhcMy0cVH7VmiwKuc0xhByXbj0gAbMlH/o+5j2+K72S1dl6y
	8Cc042CfcRZr5bCe95i+eArtkWHO68ZkWFHjpCK/+c8BKf7u/RvsV2kRPGIcqYVn7NOA=;
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.1-pre
Message-Id: <E1scGNB-0002DP-KD@xenbits.xenproject.org>
Date: Fri, 09 Aug 2024 03:33:01 +0000

commit f97db9b3bc3deac4eead160106a3f6de2ccce81d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 8 13:43:19 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:43:19 2024 +0200

    update Xen version to 4.19.1-pre
---
 Config.mk    |   2 --
 MAINTAINERS  | 106 +++++------------------------------------------------------
 xen/Makefile |   2 +-
 3 files changed, 10 insertions(+), 100 deletions(-)

diff --git a/Config.mk b/Config.mk
index ac8fb847ce..03a89624c7 100644
--- a/Config.mk
+++ b/Config.mk
@@ -234,8 +234,6 @@ ETHERBOOT_NICS ?= rtl8139 8086100e
 
 QEMU_TRADITIONAL_URL ?= https://xenbits.xen.org/git-http/qemu-xen-traditional.git
 QEMU_TRADITIONAL_REVISION ?= xen-4.19.0
-# Wed Jul 15 10:01:40 2020 +0100
-# qemu-trad: remove Xen path dependencies
 
 # Specify which qemu-dm to use. This may be `ioemu' to use the old
 # Mercurial in-tree version, or a local directory, or a git URL.
diff --git a/MAINTAINERS b/MAINTAINERS
index 2b0c894527..fe81ed63ad 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -54,6 +54,15 @@ list. Remember to copy the appropriate stable branch maintainer who
 will be listed in this section of the MAINTAINERS file in the
 appropriate branch.
 
+The maintainer for this branch is:
+
+	Jan Beulich <jbeulich@suse.com>
+
+Tools backport requests should also be copied to:
+
+       Anthony Perard <anthony.perard@citrix.com>
+
+
 	Unstable Subsystem Maintainers
 	==============================
 
@@ -104,103 +113,6 @@ Descriptions of section entries:
 	   xen-maintainers-<version format number of this file>
 
 
-	Check-in policy
-	===============
-
-In order for a patch to be checked in, in general, several conditions
-must be met:
-
-1. In order to get a change to a given file committed, it must have
-   the approval of at least one maintainer of that file.
-
-   A patch of course needs Acks from the maintainers of each file that
-   it changes; so a patch which changes xen/arch/x86/traps.c,
-   xen/arch/x86/mm/p2m.c, and xen/arch/x86/mm/shadow/multi.c would
-   require an Ack from each of the three sets of maintainers.
-
-   See below for rules on nested maintainership.
-
-2. Each change must have appropriate approval from someone other than
-   the person who wrote it.  This can be either:
-
-  a. An Acked-by from a maintainer of the code being touched (a
-     co-maintainer if available, or a more general level maintainer if
-     not available; see the secton on nested maintainership)
-
-  b. A Reviewed-by by anyone of suitable stature in the community
-
-3. Sufficient time must have been given for anyone to respond.  This
-   depends in large part upon the urgency and nature of the patch.
-   For a straightforward uncontroversial patch, a day or two may be
-   sufficient; for a controversial patch, a week or two may be better.
-
-4. There must be no "open" objections.
-
-In a case where one person submits a patch and a maintainer gives an
-Ack, the Ack stands in for both the approval requirement (#1) and the
-Acked-by-non-submitter requirement (#2).
-
-In a case where a maintainer themselves submits a patch, the
-Signed-off-by meets the approval requirement (#1); so a Review
-from anyone in the community suffices for requirement #2.
-
-Before a maintainer checks in their own patch with another community
-member's R-b but no co-maintainer Ack, it is especially important to
-give their co-maintainer opportunity to give feedback, perhaps
-declaring their intention to check it in without their co-maintainers
-ack a day before doing so.
-
-In the case where two people collaborate on a patch, at least one of
-whom is a maintainer -- typically where one maintainer will do an
-early version of the patch, and another maintainer will pick it up and
-revise it -- there should be two Signed-off-by's and one Acked-by or
-Reviewed-by; with the maintainer who did the most recent change
-sending the patch, and an Acked-by or Reviewed-by coming from the
-maintainer who did not most recently edit the patch.  This satisfies
-the requirement #2 because a) the Signed-off-by of the sender approves
-the final version of the patch; including all parts of the patch that
-the sender did not write b) the Reviewed-by approves the final version
-of the patch, including all patches that the reviewer did not write.
-Thus all code in the patch has been approved by someone who did not
-write it.
-
-Maintainers may choose to override non-maintainer objections in the
-case that consensus can't be reached.
-
-As always, no policy can cover all possible situations.  In
-exceptional circumstances, committers may commit a patch in absence of
-one or more of the above requirements, if they are reasonably
-confident that the other maintainers will approve of their decision in
-retrospect.
-
-       The meaning of nesting
-       ======================
-
-Many maintainership areas are "nested": for example, there are entries
-for xen/arch/x86 as well as xen/arch/x86/mm, and even
-xen/arch/x86/mm/shadow; and there is a section at the end called "THE
-REST" which lists all committers.  The meaning of nesting is that:
-
-1. Under normal circumstances, the Ack of the most specific maintainer
-is both necessary and sufficient to get a change to a given file
-committed.  So a change to xen/arch/x86/mm/shadow/multi.c requires the
-the Ack of the xen/arch/x86/mm/shadow maintainer for that part of the
-patch, but would not require the Ack of the xen/arch/x86 maintainer or
-the xen/arch/x86/mm maintainer.
-
-2. In unusual circumstances, a more general maintainer's Ack can stand
-in for or even overrule a specific maintainer's Ack.  Unusual
-circumstances might include:
- - The patch is fixing a high-priority issue causing immediate pain,
- and the more specific maintainer is not available.
- - The more specific maintainer has not responded either to the
- original patch, nor to "pings", within a reasonable amount of time.
- - The more general maintainer wants to overrule the more specific
- maintainer on some issue. (This should be exceptional.)
- - In the case of a disagreement between maintainers, THE REST can
- settle the matter by majority vote.  (This should be very exceptional
- indeed.)
-
 
 Maintainers List (try to look for most precise areas first)
 
diff --git a/xen/Makefile b/xen/Makefile
index 16055101fb..59dac504b3 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 ?= .0$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .1-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 Fri Aug 09 03:33:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Aug 2024 03:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774542.1184983 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scGNN-0008GU-Qr; Fri, 09 Aug 2024 03:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774542.1184983; Fri, 09 Aug 2024 03: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 1scGNN-0008GN-Nh; Fri, 09 Aug 2024 03:33:13 +0000
Received: by outflank-mailman (input) for mailman id 774542;
 Fri, 09 Aug 2024 03:33:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGNL-0008G0-TF
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGNL-00030G-S3
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGNL-0002ED-Os
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NLU48FIEaMvFR0Qd1YY6m5pS3V2x4LTZGLAPeO09Rmw=; b=CiBfHeI+CfSQZQ8QODJwZy5Rfo
	+v/fHNMjTjJ8wKT2yftkaX06x4BjGeID3SWc9B97p82ObV/Q9Lmdb6tysva+M7Kt/ir6q73hd+8+U
	i0W2t54r/WIGq0zCDmhL/Lrt6zb58MTdD4PT3kY2xAnZ7nzvJeqKpqKG3e9j/kMW/zTo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] bunzip2: fix rare decompression failure
Message-Id: <E1scGNL-0002ED-Os@xenbits.xenproject.org>
Date: Fri, 09 Aug 2024 03:33:11 +0000

commit e54077cbca7149c8fa856535b69a4c70dfd48cd2
Author:     Ross Lagerwall <ross.lagerwall@citrix.com>
AuthorDate: Thu Aug 8 13:44:26 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:44:26 2024 +0200

    bunzip2: fix rare decompression failure
    
    The decompression code parses a huffman tree and counts the number of
    symbols for a given bit length.  In rare cases, there may be >= 256
    symbols with a given bit length, causing the unsigned char to overflow.
    This causes a decompression failure later when the code tries and fails to
    find the bit length for a given symbol.
    
    Since the maximum number of symbols is 258, use unsigned short instead.
    
    Fixes: ab77e81f6521 ("x86/dom0: support bzip2 and lzma compressed bzImage payloads")
    Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 303d3ff85c90ee4af4bad4e3b1d4932fa2634d64
    master date: 2024-07-30 11:55:56 +0200
---
 xen/common/bunzip2.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/bunzip2.c b/xen/common/bunzip2.c
index 4466426941..79f17162b1 100644
--- a/xen/common/bunzip2.c
+++ b/xen/common/bunzip2.c
@@ -221,7 +221,8 @@ static int __init get_next_block(struct bunzip_data *bd)
 	   RUNB) */
 	symCount = symTotal+2;
 	for (j = 0; j < groupCount; j++) {
-		unsigned char length[MAX_SYMBOLS], temp[MAX_HUFCODE_BITS+1];
+		unsigned char length[MAX_SYMBOLS];
+		unsigned short temp[MAX_HUFCODE_BITS+1];
 		int	minLen,	maxLen, pp;
 		/* Read Huffman code lengths for each symbol.  They're
 		   stored in a way similar to mtf; record a starting
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Fri Aug 09 03:33:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Aug 2024 03:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774544.1184986 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scGNX-0008Jt-Ru; Fri, 09 Aug 2024 03:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774544.1184986; Fri, 09 Aug 2024 03: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 1scGNX-0008Jl-PH; Fri, 09 Aug 2024 03:33:23 +0000
Received: by outflank-mailman (input) for mailman id 774544;
 Fri, 09 Aug 2024 03:33:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGNV-0008JS-WB
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGNV-00030O-VS
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03:33:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGNV-0002Gi-UP
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03:33:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=W4Bn7nEzZ1rO+7nUmZtI95zD0Et1kqN/GzsrMKhBWiM=; b=4cB3q1jiRNVWM5ps/l+C8IvqDh
	j7LY+8fV+zB7fuxuPShRk7IyMn4MqcZaialDt7I4dwqe9njrYZ5PWh5uKpT2uK/closT8Qewt0MyM
	yIpkYwA97vI7FChbB4yGWliauM2ncU4dQn2Xa1pzh06YZi8zxomWPKmfxinl/2Yq4uIk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] XSM/domctl: Fix permission checks on XEN_DOMCTL_createdomain
Message-Id: <E1scGNV-0002Gi-UP@xenbits.xenproject.org>
Date: Fri, 09 Aug 2024 03:33:21 +0000

commit d2ecc1f231b90d4e54394e25a9aef9be42c0d196
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 8 13:44:56 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:44:56 2024 +0200

    XSM/domctl: Fix permission checks on XEN_DOMCTL_createdomain
    
    The XSM checks for XEN_DOMCTL_createdomain are problematic.  There's a split
    between xsm_domctl() called early, and flask_domain_create() called quite late
    during domain construction.
    
    All XSM implementations except Flask have a simple IS_PRIV check in
    xsm_domctl(), and operate as expected when an unprivileged domain tries to
    make a hypercall.
    
    Flask however foregoes any action in xsm_domctl() and defers everything,
    including the simple "is the caller permitted to create a domain" check, to
    flask_domain_create().
    
    As a consequence, when XSM Flask is active, and irrespective of the policy
    loaded, all domains irrespective of privilege can:
    
     * Mutate the global 'rover' variable, used to track the next free domid.
       Therefore, all domains can cause a domid wraparound, and combined with a
       voluntary reboot, choose their own domid.
    
     * Cause a reasonable amount of a domain to be constructed before ultimately
       failing for permission reasons, including the use of settings outside of
       supported limits.
    
    In order to remediate this, pass the ssidref into xsm_domctl() and at least
    check that the calling domain privileged enough to create domains.
    
    Take the opportunity to also fix the sign of the cmd parameter to be unsigned.
    
    This issue has not been assigned an XSA, because Flask is experimental and not
    security supported.
    
    Reported-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    master commit: ee32b9b29af449d38aad0a1b3a81aaae586f5ea7
    master date: 2024-07-30 17:42:17 +0100
---
 xen/arch/x86/mm/paging.c |  2 +-
 xen/common/domctl.c      |  4 +++-
 xen/include/xsm/dummy.h  |  2 +-
 xen/include/xsm/xsm.h    |  7 ++++---
 xen/xsm/flask/hooks.c    | 14 ++++++++++++--
 5 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/mm/paging.c b/xen/arch/x86/mm/paging.c
index bca320fffa..dd47bde5ce 100644
--- a/xen/arch/x86/mm/paging.c
+++ b/xen/arch/x86/mm/paging.c
@@ -767,7 +767,7 @@ long do_paging_domctl_cont(
     if ( d == NULL )
         return -ESRCH;
 
-    ret = xsm_domctl(XSM_OTHER, d, op.cmd);
+    ret = xsm_domctl(XSM_OTHER, d, op.cmd, 0 /* SSIDref not applicable */);
     if ( !ret )
     {
         if ( domctl_lock_acquire() )
diff --git a/xen/common/domctl.c b/xen/common/domctl.c
index 2c0331bb05..ea16b75910 100644
--- a/xen/common/domctl.c
+++ b/xen/common/domctl.c
@@ -322,7 +322,9 @@ long do_domctl(XEN_GUEST_HANDLE_PARAM(xen_domctl_t) u_domctl)
         break;
     }
 
-    ret = xsm_domctl(XSM_OTHER, d, op->cmd);
+    ret = xsm_domctl(XSM_OTHER, d, op->cmd,
+                     /* SSIDRef only applicable for cmd == createdomain */
+                     op->u.createdomain.ssidref);
     if ( ret )
         goto domctl_out_unlock_domonly;
 
diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h
index 00d2cbebf2..7956f27a29 100644
--- a/xen/include/xsm/dummy.h
+++ b/xen/include/xsm/dummy.h
@@ -162,7 +162,7 @@ static XSM_INLINE int cf_check xsm_set_target(
 }
 
 static XSM_INLINE int cf_check xsm_domctl(
-    XSM_DEFAULT_ARG struct domain *d, int cmd)
+    XSM_DEFAULT_ARG struct domain *d, unsigned int cmd, uint32_t ssidref)
 {
     XSM_ASSERT_ACTION(XSM_OTHER);
     switch ( cmd )
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 8dad03fd3d..627c0d2731 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -60,7 +60,7 @@ struct xsm_ops {
     int (*domctl_scheduler_op)(struct domain *d, int op);
     int (*sysctl_scheduler_op)(int op);
     int (*set_target)(struct domain *d, struct domain *e);
-    int (*domctl)(struct domain *d, int cmd);
+    int (*domctl)(struct domain *d, unsigned int cmd, uint32_t ssidref);
     int (*sysctl)(int cmd);
     int (*readconsole)(uint32_t clear);
 
@@ -248,9 +248,10 @@ static inline int xsm_set_target(
     return alternative_call(xsm_ops.set_target, d, e);
 }
 
-static inline int xsm_domctl(xsm_default_t def, struct domain *d, int cmd)
+static inline int xsm_domctl(xsm_default_t def, struct domain *d,
+                             unsigned int cmd, uint32_t ssidref)
 {
-    return alternative_call(xsm_ops.domctl, d, cmd);
+    return alternative_call(xsm_ops.domctl, d, cmd, ssidref);
 }
 
 static inline int xsm_sysctl(xsm_default_t def, int cmd)
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 5e88c71b8e..278ad38c2a 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -663,12 +663,22 @@ static int cf_check flask_set_target(struct domain *d, struct domain *t)
     return rc;
 }
 
-static int cf_check flask_domctl(struct domain *d, int cmd)
+static int cf_check flask_domctl(struct domain *d, unsigned int cmd,
+                                 uint32_t ssidref)
 {
     switch ( cmd )
     {
-    /* These have individual XSM hooks (common/domctl.c) */
     case XEN_DOMCTL_createdomain:
+        /*
+         * There is a later hook too, but at this early point simply check
+         * that the calling domain is privileged enough to create a domain.
+         *
+         * Note that d is NULL because we haven't even allocated memory for it
+         * this early in XEN_DOMCTL_createdomain.
+         */
+        return avc_current_has_perm(ssidref, SECCLASS_DOMAIN, DOMAIN__CREATE, NULL);
+
+    /* These have individual XSM hooks (common/domctl.c) */
     case XEN_DOMCTL_getdomaininfo:
     case XEN_DOMCTL_scheduler_op:
     case XEN_DOMCTL_irq_permission:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Fri Aug 09 03:33:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Aug 2024 03:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774545.1184991 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scGNh-0008N8-TW; Fri, 09 Aug 2024 03:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774545.1184991; Fri, 09 Aug 2024 03: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 1scGNh-0008N0-Qh; Fri, 09 Aug 2024 03:33:33 +0000
Received: by outflank-mailman (input) for mailman id 774545;
 Fri, 09 Aug 2024 03:33:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGNg-0008Mb-3i
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGNg-00030V-31
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGNg-0002HK-1M
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+sGr/uon+d7HTG/uM0d5WyIyqJ8igTfTT+yuot9b1rM=; b=sEbNh2Sre5ZgPCryZB69A6obQs
	4e1IBV6DkclgbbnYq1LYoEueYkQSrTNiPgdSNutH8oEX3gcy5WHd4etF+IgWzlB/DPughsB9YZmCu
	4LZaBRp7re2Dx1zktdDkpc0lwtb+9VWS61h2uxinOi4ZNqUsKwj6QGxzt3Zy/LC0IYBA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/dom0: fix restoring %cr3 and the mapcache override on PV build error
Message-Id: <E1scGNg-0002HK-1M@xenbits.xenproject.org>
Date: Fri, 09 Aug 2024 03:33:32 +0000

commit adf1939b51a0a2fa596f7acca0989bfe56cab307
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Aug 8 13:45:28 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:45:28 2024 +0200

    x86/dom0: fix restoring %cr3 and the mapcache override on PV build error
    
    One of the error paths in the PV dom0 builder section that runs on the guest
    page-tables wasn't restoring the Xen value of %cr3, neither removing the
    mapcache override.
    
    Fixes: 079ff2d32c3d ('libelf-loader: introduce elf_load_image')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 1fc3f77113dd43b14fa7ef5936dcdba120c0b63f
    master date: 2024-07-31 12:41:02 +0200
---
 xen/arch/x86/pv/dom0_build.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index d8043fa58a..57e58a02e7 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -825,6 +825,8 @@ int __init dom0_construct_pv(struct domain *d,
     rc = elf_load_binary(&elf);
     if ( rc < 0 )
     {
+        mapcache_override_current(NULL);
+        switch_cr3_cr4(current->arch.cr3, read_cr4());
         printk("Failed to load the kernel binary\n");
         goto out;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Fri Aug 09 03:33:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Aug 2024 03:33:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774546.1184995 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scGNr-0008QO-Ui; Fri, 09 Aug 2024 03:33:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774546.1184995; Fri, 09 Aug 2024 03: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 1scGNr-0008QG-S6; Fri, 09 Aug 2024 03:33:43 +0000
Received: by outflank-mailman (input) for mailman id 774546;
 Fri, 09 Aug 2024 03:33:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGNq-0008Pv-9a
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03:33:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGNq-00030c-7P
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGNq-0002I1-57
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WgoftgJG567hBYpLMYdR+z+/qv7Y/jFU/Ff1qlfuKgc=; b=qtmUp/+2Hl9ntPYeZC2u9slWbW
	MnMzxgvQsgtjpBatCIyTh7WH4m6dSf3fItIUvWQLPe1JyL2VORe6eGlXM2DAC7T94GVxLoT5vKhrM
	y0Dep6IjHminVB7IWqgGQX+882luVSv1/Mkxtg+cU8VHamfsO35kKpGmXhzYD64FWNZI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/altcall: further refine clang workaround
Message-Id: <E1scGNq-0002I1-57@xenbits.xenproject.org>
Date: Fri, 09 Aug 2024 03:33:42 +0000

commit ee032f29972b8c58db9fcf96650f9cbc083edca8
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Aug 8 13:45:58 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:45:58 2024 +0200

    x86/altcall: further refine clang workaround
    
    The current code in ALT_CALL_ARG() won't successfully workaround the clang
    code-generation issue if the arg parameter has a size that's not a power of 2.
    While there are no such sized parameters at the moment, improve the workaround
    to also be effective when such sizes are used.
    
    Instead of using a union with a long use an unsigned long that's first
    initialized to 0 and afterwards set to the argument value.
    
    Reported-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Suggested-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 561cba38ff551383a628dc93e64ab0691cfc92bf
    master date: 2024-07-31 12:41:22 +0200
---
 xen/arch/x86/include/asm/alternative.h | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/include/asm/alternative.h b/xen/arch/x86/include/asm/alternative.h
index e63b459276..a86eadfaec 100644
--- a/xen/arch/x86/include/asm/alternative.h
+++ b/xen/arch/x86/include/asm/alternative.h
@@ -169,27 +169,25 @@ extern void alternative_branches(void);
 
 #ifdef CONFIG_CC_IS_CLANG
 /*
- * Use a union with an unsigned long in order to prevent clang from
- * skipping a possible truncation of the value.  By using the union any
- * truncation is carried before the call instruction, in turn covering
- * for ABI-non-compliance in that the necessary clipping / extension of
- * the value is supposed to be carried out in the callee.
+ * Clang doesn't follow the psABI and doesn't truncate parameter values at the
+ * callee.  This can lead to bad code being generated when using alternative
+ * calls.
  *
- * Note this behavior is not mandated by the standard, and hence could
- * stop being a viable workaround, or worse, could cause a different set
- * of code-generation issues in future clang versions.
+ * Workaround it by using a temporary intermediate variable that's zeroed
+ * before being assigned the parameter value, as that forces clang to zero the
+ * register at the caller.
  *
  * This has been reported upstream:
  * https://github.com/llvm/llvm-project/issues/12579
  * https://github.com/llvm/llvm-project/issues/82598
  */
 #define ALT_CALL_ARG(arg, n)                                            \
-    register union {                                                    \
-        typeof(arg) e[sizeof(long) / sizeof(arg)];                      \
-        unsigned long r;                                                \
-    } a ## n ## _ asm ( ALT_CALL_arg ## n ) = {                         \
-        .e[0] = ({ BUILD_BUG_ON(sizeof(arg) > sizeof(void *)); (arg); })\
-    }
+    register unsigned long a ## n ## _ asm ( ALT_CALL_arg ## n ) = ({   \
+        unsigned long tmp = 0;                                          \
+        BUILD_BUG_ON(sizeof(arg) > sizeof(unsigned long));              \
+        *(typeof(arg) *)&tmp = (arg);                                   \
+        tmp;                                                            \
+    })
 #else
 #define ALT_CALL_ARG(arg, n) \
     register typeof(arg) a ## n ## _ asm ( ALT_CALL_arg ## n ) = \
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Fri Aug 09 03:33:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Aug 2024 03:33:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774547.1185000 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scGO2-0008T4-0q; Fri, 09 Aug 2024 03:33:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774547.1185000; Fri, 09 Aug 2024 03: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 1scGO1-0008Sp-Tb; Fri, 09 Aug 2024 03:33:53 +0000
Received: by outflank-mailman (input) for mailman id 774547;
 Fri, 09 Aug 2024 03:33:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGO0-0008SZ-C2
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03:33:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGO0-00030s-BI
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGO0-0002IV-9e
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sEbqFOOmjfOk7HqwW9zyRDWvdO/6Jwsiu2am6H1Bkuw=; b=4EZdDDpfBxw/U0gZJVnPNFm53k
	EbuPNlEeSAZqYqAX+63TzDwLL9KQBGndAGX9WgZcm5Kannr0mqNdoCFw+MX0N+sL07rwsj9Ym4aZ9
	9teRm8MM1CPMMlfSIMdP9XX3sW8B0Kjdnt7FSNSuadfKVe4AEMxyH6nUFBwNA95B3Jfw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] xen/sched: fix error handling in cpu_schedule_up()
Message-Id: <E1scGO0-0002IV-9e@xenbits.xenproject.org>
Date: Fri, 09 Aug 2024 03:33:52 +0000

commit b37580d5e984770266783b639552a97c36ecb58a
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Aug 8 13:46:21 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:46:21 2024 +0200

    xen/sched: fix error handling in cpu_schedule_up()
    
    In case cpu_schedule_up() is failing, it needs to undo all externally
    visible changes it has done before.
    
    Reason is that cpu_schedule_callback() won't be called with the
    CPU_UP_CANCELED notifier in case cpu_schedule_up() did fail.
    
    Fixes: 207589dbacd4 ("xen/sched: move per cpu scheduler private data into struct sched_resource")
    Reported-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 44a7d4f0a5e9eae41a44a162e54ff6d2ebe5b7d6
    master date: 2024-07-31 14:50:18 +0200
---
 xen/common/sched/core.c | 63 ++++++++++++++++++++++++++-----------------------
 1 file changed, 33 insertions(+), 30 deletions(-)

diff --git a/xen/common/sched/core.c b/xen/common/sched/core.c
index d84b65f197..c466711e9e 100644
--- a/xen/common/sched/core.c
+++ b/xen/common/sched/core.c
@@ -2755,6 +2755,36 @@ static struct sched_resource *sched_alloc_res(void)
     return sr;
 }
 
+static void cf_check sched_res_free(struct rcu_head *head)
+{
+    struct sched_resource *sr = container_of(head, struct sched_resource, rcu);
+
+    free_cpumask_var(sr->cpus);
+    if ( sr->sched_unit_idle )
+        sched_free_unit_mem(sr->sched_unit_idle);
+    xfree(sr);
+}
+
+static void cpu_schedule_down(unsigned int cpu)
+{
+    struct sched_resource *sr;
+
+    rcu_read_lock(&sched_res_rculock);
+
+    sr = get_sched_res(cpu);
+
+    kill_timer(&sr->s_timer);
+
+    cpumask_clear_cpu(cpu, &sched_res_mask);
+    set_sched_res(cpu, NULL);
+
+    /* Keep idle unit. */
+    sr->sched_unit_idle = NULL;
+    call_rcu(&sr->rcu, sched_res_free);
+
+    rcu_read_unlock(&sched_res_rculock);
+}
+
 static int cpu_schedule_up(unsigned int cpu)
 {
     struct sched_resource *sr;
@@ -2794,7 +2824,10 @@ static int cpu_schedule_up(unsigned int cpu)
         idle_vcpu[cpu]->sched_unit->res = sr;
 
     if ( idle_vcpu[cpu] == NULL )
+    {
+        cpu_schedule_down(cpu);
         return -ENOMEM;
+    }
 
     idle_vcpu[cpu]->sched_unit->rendezvous_in_cnt = 0;
 
@@ -2812,36 +2845,6 @@ static int cpu_schedule_up(unsigned int cpu)
     return 0;
 }
 
-static void cf_check sched_res_free(struct rcu_head *head)
-{
-    struct sched_resource *sr = container_of(head, struct sched_resource, rcu);
-
-    free_cpumask_var(sr->cpus);
-    if ( sr->sched_unit_idle )
-        sched_free_unit_mem(sr->sched_unit_idle);
-    xfree(sr);
-}
-
-static void cpu_schedule_down(unsigned int cpu)
-{
-    struct sched_resource *sr;
-
-    rcu_read_lock(&sched_res_rculock);
-
-    sr = get_sched_res(cpu);
-
-    kill_timer(&sr->s_timer);
-
-    cpumask_clear_cpu(cpu, &sched_res_mask);
-    set_sched_res(cpu, NULL);
-
-    /* Keep idle unit. */
-    sr->sched_unit_idle = NULL;
-    call_rcu(&sr->rcu, sched_res_free);
-
-    rcu_read_unlock(&sched_res_rculock);
-}
-
 void sched_rm_cpu(unsigned int cpu)
 {
     int rc;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Fri Aug 09 03:34:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Aug 2024 03:34:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774548.1185002 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scGOC-0008Vk-1P; Fri, 09 Aug 2024 03:34:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774548.1185002; Fri, 09 Aug 2024 03: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 1scGOB-0008Vd-VB; Fri, 09 Aug 2024 03:34:03 +0000
Received: by outflank-mailman (input) for mailman id 774548;
 Fri, 09 Aug 2024 03:34:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGOA-0008VR-Hb
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03:34:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGOA-00031W-GS
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03:34:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGOA-0002Jj-DU
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=A7mqWlnjP3kfVBBfiFPFE/SVA2INaRd7KcCs9pEVJeI=; b=33G2WwoPqKDk1Yx94jAcp0yPiZ
	1J0G+yivWFm3y7hBu+1fAGk9KJg+m3wx/2c2XsbdxtBsDNjIshBiT9wAzbZzQh3HikmUFshRzqnmR
	xZwfKi/crUQorRolsOf8do1CNIvXo7H2if8VdBkB9b+UqCF0Gt6p65qGEJ7ZRP/s1PA0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] xen/hvm: Don't skip MSR_READ trace record
Message-Id: <E1scGOA-0002Jj-DU@xenbits.xenproject.org>
Date: Fri, 09 Aug 2024 03:34:02 +0000

commit 97a15007c9606d4c53109754bb21fd593bca589b
Author:     George Dunlap <george.dunlap@cloud.com>
AuthorDate: Thu Aug 8 13:47:02 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:47:02 2024 +0200

    xen/hvm: Don't skip MSR_READ trace record
    
    Commit 37f074a3383 ("x86/msr: introduce guest_rdmsr()") introduced a
    function to combine the MSR_READ handling between PV and HVM.
    Unfortunately, by returning directly, it skipped the trace generation,
    leading to gaps in the trace record, as well as xenalyze errors like
    this:
    
    hvm_generic_postprocess: d2v0 Strange, exit 7c(VMEXIT_MSR) missing a handler
    
    Replace the `return` with `goto out`.
    
    Fixes: 37f074a3383 ("x86/msr: introduce guest_rdmsr()")
    Signed-off-by: George Dunlap <george.dunlap@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: bc8a43fff61ae4162a95d84f4e148d6773667cd2
    master date: 2024-08-02 08:42:09 +0200
---
 xen/arch/x86/hvm/hvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 7f4b627b1f..0fe2b85b16 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3557,7 +3557,7 @@ int hvm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
     fixed_range_base = (uint64_t *)v->arch.hvm.mtrr.fixed_ranges;
 
     if ( (ret = guest_rdmsr(v, msr, msr_content)) != X86EMUL_UNHANDLEABLE )
-        return ret;
+        goto out;
 
     ret = X86EMUL_OKAY;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Fri Aug 09 03:34:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Aug 2024 03:34:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774549.1185007 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scGOM-000073-3J; Fri, 09 Aug 2024 03:34:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774549.1185007; Fri, 09 Aug 2024 03: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 1scGOM-00006v-0N; Fri, 09 Aug 2024 03:34:14 +0000
Received: by outflank-mailman (input) for mailman id 774549;
 Fri, 09 Aug 2024 03:34:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGOK-00006d-KN
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03:34:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGOK-00031d-Je
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03:34:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGOK-0002Kj-IU
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AfT0CIJSRBO1HdA/3buXhNqQZLno9WXqWAuzMQV4Ps0=; b=UxKl3xXJRgjIz8zaW9Gr9dGKM/
	o10J9zmq3oIs6sKj1Cee2Tz17hFQfu3nptf2KDgAE2qyi3KqmY0c02HeUywSS0RjsA7kRSIs1Q9hd
	HBm/WeNixynOVD406KtJlfuIVZoLP8Fjq29g3CgvUA/HgN90vymCECfBbf0HTX8AdCOY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] tools/lsevtchn: Use errno macro to handle hypercall error cases
Message-Id: <E1scGOK-0002Kj-IU@xenbits.xenproject.org>
Date: Fri, 09 Aug 2024 03:34:12 +0000

commit e0e84771b61ed985809d105d8f116d4c520542b0
Author:     Matthew Barnes <matthew.barnes@cloud.com>
AuthorDate: Thu Aug 8 13:47:30 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:47:30 2024 +0200

    tools/lsevtchn: Use errno macro to handle hypercall error cases
    
    Currently, lsevtchn aborts its event channel enumeration when it hits
    an event channel that is owned by Xen.
    
    lsevtchn does not distinguish between different hypercall errors, which
    results in lsevtchn missing potential relevant event channels with
    higher port numbers.
    
    Use the errno macro to distinguish between hypercall errors, and
    continue event channel enumeration if the hypercall error is not
    critical to enumeration.
    
    Signed-off-by: Matthew Barnes <matthew.barnes@cloud.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: e92a453c8db8bba62d6be3006079e2b9990c3978
    master date: 2024-08-02 08:43:57 +0200
---
 tools/xcutils/lsevtchn.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/tools/xcutils/lsevtchn.c b/tools/xcutils/lsevtchn.c
index d1710613dd..30c8d847b8 100644
--- a/tools/xcutils/lsevtchn.c
+++ b/tools/xcutils/lsevtchn.c
@@ -3,6 +3,7 @@
 #include <stdint.h>
 #include <string.h>
 #include <stdio.h>
+#include <errno.h>
 
 #include <xenctrl.h>
 
@@ -24,7 +25,23 @@ int main(int argc, char **argv)
         status.port = port;
         rc = xc_evtchn_status(xch, &status);
         if ( rc < 0 )
-            break;
+        {
+            switch ( errno )
+            {
+            case EACCES: /* Xen-owned evtchn */
+                continue;
+
+            case EINVAL: /* Port enumeration has ended */
+                rc = 0;
+                break;
+
+            default:
+                perror("xc_evtchn_status");
+                rc = 1;
+                break;
+            }
+            goto out;
+        }
 
         if ( status.status == EVTCHNSTAT_closed )
             continue;
@@ -58,7 +75,8 @@ int main(int argc, char **argv)
         printf("\n");
     }
 
+ out:
     xc_interface_close(xch);
 
-    return 0;
+    return rc;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Fri Aug 09 03:34:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Aug 2024 03:34:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774550.1185011 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scGOW-0000Bi-6X; Fri, 09 Aug 2024 03:34:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774550.1185011; Fri, 09 Aug 2024 03: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 1scGOW-0000BZ-3h; Fri, 09 Aug 2024 03:34:24 +0000
Received: by outflank-mailman (input) for mailman id 774550;
 Fri, 09 Aug 2024 03:34:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGOU-0000BN-N9
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03:34:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGOU-00031k-MZ
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03:34:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGOU-0002LR-Ll
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cdocYi7kylSs9eFvvu/UFXF3icLr60izYcd4yKIw66I=; b=6eeJk9QLG+SciXpnis3lmNeui7
	zBfWemWq+wFVyEpMGxfmy4WOgLz/cxNk+r07zM3brdlIrdzMd4XHt3s7vozvX2sLBi/0MttqGJq+Z
	vyA5jgfUJ88yWf6R+s6YYxagBASZ/cCYiZzYXj9iqsNoQF2D7O2Bbn9HJVL3BJ55XdwA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] 9pfsd: fix release build with old gcc
Message-Id: <E1scGOU-0002LR-Ll@xenbits.xenproject.org>
Date: Fri, 09 Aug 2024 03:34:22 +0000

commit 8ad5a8c5c36add2eee70a7253da4098ebffdb79b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 8 13:47:44 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:47:44 2024 +0200

    9pfsd: fix release build with old gcc
    
    Being able to recognize that "par" is reliably initialized on the 1st
    loop iteration requires not overly old compilers.
    
    Fixes: 7809132b1a1d ("tools/xen-9pfsd: add 9pfs response generation support")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    master commit: 984cb316cb27b53704c607e640a7dd2763b898ab
    master date: 2024-08-02 08:44:22 +0200
---
 tools/9pfsd/io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/9pfsd/io.c b/tools/9pfsd/io.c
index df1be3df7d..468e0241f5 100644
--- a/tools/9pfsd/io.c
+++ b/tools/9pfsd/io.c
@@ -196,7 +196,7 @@ static void fill_buffer_at(void **data, const char *fmt, ...);
 static void vfill_buffer_at(void **data, const char *fmt, va_list ap)
 {
     const char *f;
-    const void *par;
+    const void *par = NULL; /* old gcc */
     const char *str_val;
     const struct p9_qid *qid;
     const struct p9_stat *stat;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Fri Aug 09 03:34:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 09 Aug 2024 03:34:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774551.1185014 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scGOg-0000Ea-7x; Fri, 09 Aug 2024 03:34:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774551.1185014; Fri, 09 Aug 2024 03: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 1scGOg-0000ET-59; Fri, 09 Aug 2024 03:34:34 +0000
Received: by outflank-mailman (input) for mailman id 774551;
 Fri, 09 Aug 2024 03:34:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGOe-0000EE-Q8
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03:34:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGOe-00031w-PW
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03:34:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scGOe-0002MT-Of
 for xen-changelog@lists.xenproject.org; Fri, 09 Aug 2024 03: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tQcAJfMVARnQsYd7ZyxowNctbI0Xyl7MvksLLy3a9ok=; b=MxkkIdBB8chzmCbeSaiXSXGgAF
	Yj4gzYNURyF0Pa5GkD42qd5k01mJV1AxQAhmHS0QoFF/Wg3gI4euoQDvrfF0ROVDBVSr94yQZ4TSn
	XkitOx9VOuW/5vg9p2JIh1wMiILKqzf0R8HVER0Y3Q7QXld00mFUq5pT6zitMKhlNRiQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/emul: Fix misaligned IO breakpoint behaviour in PV guests
Message-Id: <E1scGOe-0002MT-Of@xenbits.xenproject.org>
Date: Fri, 09 Aug 2024 03:34:32 +0000

commit 033060ee6e05f9e86ef1a51674864b55dc15e62c
Author:     Matthew Barnes <matthew.barnes@cloud.com>
AuthorDate: Thu Aug 8 13:48:03 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:48:03 2024 +0200

    x86/emul: Fix misaligned IO breakpoint behaviour in PV guests
    
    When hardware breakpoints are configured on misaligned IO ports, the
    hardware will mask the addresses based on the breakpoint width during
    comparison.
    
    For PV guests, misaligned IO breakpoints do not behave the same way, and
    therefore yield different results.
    
    This patch tweaks the emulation of IO breakpoints for PV guests such
    that they reproduce the same behaviour as hardware.
    
    Fixes: bec9e3205018 ("x86: emulate I/O port access breakpoints")
    Signed-off-by: Matthew Barnes <matthew.barnes@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 08aacc392d86d4c7dbebdb5e664060ae2af72057
    master date: 2024-08-08 13:27:50 +0200
---
 xen/arch/x86/pv/emul-priv-op.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index f101510a1b..aa11ecadaa 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -346,6 +346,8 @@ static unsigned int check_guest_io_breakpoint(struct vcpu *v,
         case DR_LEN_8: width = 8; break;
         }
 
+        start &= ~(width - 1UL);
+
         if ( (start < (port + len)) && ((start + width) > port) )
             match |= 1u << i;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Sat Aug 10 00:11:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 10 Aug 2024 00:11:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774998.1185369 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scZhK-0003ed-Ed; Sat, 10 Aug 2024 00:11:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774998.1185369; Sat, 10 Aug 2024 00:11: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 1scZhK-0003eV-Bq; Sat, 10 Aug 2024 00:11:06 +0000
Received: by outflank-mailman (input) for mailman id 774998;
 Sat, 10 Aug 2024 00:11:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scZhI-0003eP-Et
 for xen-changelog@lists.xenproject.org; Sat, 10 Aug 2024 00:11:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scZhI-0003EH-46
 for xen-changelog@lists.xenproject.org; Sat, 10 Aug 2024 00:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scZhI-0005HO-2e
 for xen-changelog@lists.xenproject.org; Sat, 10 Aug 2024 00:11: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TAqrIhVPalwjAjgY++Mk5GKtaALGkjwk4ARRWABHy1o=; b=b31OV5VMQNdZsN9qH0QAn5s/vU
	Cb76qPSteBsab8T2soJNddaOKoYCqRlAUWYGhC5+7Kgob+dVh7GtJqUCg/PZRPxduvI13xUqx2Gys
	s+XvBbEMSRV6zNCLyrN50FpQyh456vrdn7DPJMc+weZehM0DozfhNrQ9YaG+qmbpjgIc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: Introduce Fusa Requirement and define maintainers
Message-Id: <E1scZhI-0005HO-2e@xenbits.xenproject.org>
Date: Sat, 10 Aug 2024 00:11:04 +0000

commit 878974a33f9b4ae2686364ce2375239fccd7b063
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Tue Aug 6 17:31:55 2024 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 9 16:58:04 2024 -0700

    docs: Introduce Fusa Requirement and define maintainers
    
    The FUSA folder is expected to contain requirements and other documents
    to enable safety certification of Xen hypervisor.
    Added a intro to explain how the requirements are categorized, written
    and their supported status.
    Also, added index.rst for inclusion in build docs.
    
    Added maintainers for the same.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 MAINTAINERS              |  9 +++++
 docs/fusa/index.rst      |  9 +++++
 docs/fusa/reqs/index.rst |  9 +++++
 docs/fusa/reqs/intro.rst | 86 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 113 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 89be48fdf9..fb0ebf0939 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -315,6 +315,15 @@ F:	xen/arch/x86/include/asm/x86_*/efi*.h
 F:	xen/common/efi/
 F:	xen/include/efi/
 
+FUSA
+M:	Stefano Stabellini <sstabellini@kernel.org>
+M:	Bertrand Marquis <bertrand.marquis@arm.com>
+M:	Michal Orzel <michal.orzel@amd.com>
+M:	Ayan Kumar Halder <ayan.kumar.halder@amd.com>
+M:	Artem Mygaiev <artem_mygaiev@epam.com>
+S:	Supported
+F:	docs/fusa/
+
 GDBSX DEBUGGER
 M:	Elena Ufimtseva <elena.ufimtseva@oracle.com>
 S:	Supported
diff --git a/docs/fusa/index.rst b/docs/fusa/index.rst
new file mode 100644
index 0000000000..13bf4e8e23
--- /dev/null
+++ b/docs/fusa/index.rst
@@ -0,0 +1,9 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Functional Safety documentation
+===============================
+
+.. toctree::
+   :maxdepth: 2
+
+   reqs
diff --git a/docs/fusa/reqs/index.rst b/docs/fusa/reqs/index.rst
new file mode 100644
index 0000000000..78c02b1d9b
--- /dev/null
+++ b/docs/fusa/reqs/index.rst
@@ -0,0 +1,9 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Requirements documentation
+==========================
+
+.. toctree::
+   :maxdepth: 2
+
+   intro
diff --git a/docs/fusa/reqs/intro.rst b/docs/fusa/reqs/intro.rst
new file mode 100644
index 0000000000..d67b18dd9f
--- /dev/null
+++ b/docs/fusa/reqs/intro.rst
@@ -0,0 +1,86 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+##################################
+Requirements Introduction Document
+##################################
+
+This folder contains a set of requirements describing Xen and its implementation
+in a form suitable for a safety certification process.
+
+The status is experimental and it is maintained on a best effort basis. The
+requirements may get slightly out of sync with the code. We are actively working
+on a process to keep them updated, more details to follow.
+
+The requirements writing style is inspired from the ANSI/IEEE guide to Software
+Requirements Standard 830-1984.
+
+The requirements are categorized as follows :-
+
+1. Market requirements - They define the high level functionalities of the
+hypervisor without going into concepts specific to Xen. Those should allow a
+system architect to understand wether Xen is providing the functionalities it
+needs for its system. This is the top level of the requirements.
+
+2. Product requirements - They define the Xen specific concepts and interfaces
+provided by Xen without going into implementation details. One or several of
+those requirements are linked to each market requirement. An Architect can use
+them understand how Xen fulfils a market need and design how Xen should be used
+in his system.
+
+3. Design requirements - They describe what the software implementation is doing
+from a technical point of view. One or several design requirement together
+define how product requirements are fulfilled technically and are linked to
+them. An implementer can use them to know how to write or understand the Xen
+code.
+
+The requirements are linked using OpenFastTrace
+(https://github.com/itsallcode/openfasttrace/blob/main/doc/user_guide.md).
+OpenFastTrace parses through the requirements and generates a traceability
+report.
+
+The following is the skeleton for a requirement.
+
+Title of the requirement
+========================
+
+`unique_tag`
+
+..
+
+  Each requirement needs to have a unique tag associated. The format is
+  req_type~name~revision.
+
+  Thus, it consists of three components :-
+  requirement type - This denotes the category of requirement. Thus, it shall
+  be 'XenMkt', 'XenProd' or 'XenSwdgn' to denote market, product or design
+  requirement.
+  name - This denotes name of the requirement. In case of architecture specific
+  requirements, this starts with the architecture type (ie x86_64, arm64).
+  revision number - This gets incremented each time the requirement is modified.
+
+
+Description:
+This shall describe the requirement in a definitive tone. In other words,
+the requirement begins with 'Xen shall ...'. Further, the description is
+expected to be unambiguous and consistent.
+
+Rationale:
+This describes a rationale explaining the reason of the presence of the
+requirement when this can help the reader. This field can be left blank.
+
+Comments:
+This describes the use cases for the requirement when this can help the
+reader. This field can be left blank as well.
+
+Covers:
+This denotes the unique_tag of the parent. This field is non existent for the
+market requirement as it is the top level.
+
+Needs:
+This denotes the requirement type of its children. This field is non existent
+for the design requirements as there are no subsequent requirements linked to
+them.
+
+
+The requirements are expected to the technically correct and follow the above
+guidelines.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Aug 10 00:11:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 10 Aug 2024 00:11:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.774999.1185373 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scZhT-0003g0-G5; Sat, 10 Aug 2024 00:11:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 774999.1185373; Sat, 10 Aug 2024 00:11: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 1scZhT-0003fs-DT; Sat, 10 Aug 2024 00:11:15 +0000
Received: by outflank-mailman (input) for mailman id 774999;
 Sat, 10 Aug 2024 00:11:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scZhS-0003fj-7l
 for xen-changelog@lists.xenproject.org; Sat, 10 Aug 2024 00:11:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scZhS-0003Ed-73
 for xen-changelog@lists.xenproject.org; Sat, 10 Aug 2024 00:11:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scZhS-0005IY-69
 for xen-changelog@lists.xenproject.org; Sat, 10 Aug 2024 00:11: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KFKqdBGqXEA1MXv/U3yp41IhvHeqMyPtMxxNTDqpBKk=; b=nmH8EIL7gSYbrvRp2Hs4BGH59y
	Iy9plM9BLzS1zxfSSmqV4xb0PQvfzFDfDMMsPBizJzo9ZKrJofhRIcAYaIgAAPgJb2OaHn91aK6p9
	zLeeuw9g6E2SMauXMDY/BT2wDzh73gY9gUUIeYIFHTTtrlL4T7xRsnwnOwtFJJPOBbwo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: fusa: reqs: Added a requirements writing style guide
Message-Id: <E1scZhS-0005IY-69@xenbits.xenproject.org>
Date: Sat, 10 Aug 2024 00:11:14 +0000

commit d61248b0fa2cdfc0be1d806c43d1b211a72b5d49
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Tue Aug 6 17:31:56 2024 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 9 16:58:04 2024 -0700

    docs: fusa: reqs: Added a requirements writing style guide
    
    Added a guide to help write and review requirements. The requirements
    are written to enable safety certification of Xen hypervisor.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/fusa/reqs/REQUIREMENTS-STYLE | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/docs/fusa/reqs/REQUIREMENTS-STYLE b/docs/fusa/reqs/REQUIREMENTS-STYLE
new file mode 100644
index 0000000000..cd2408b9f2
--- /dev/null
+++ b/docs/fusa/reqs/REQUIREMENTS-STYLE
@@ -0,0 +1,34 @@
+Requirements writing style for the Xen Hypervisor
+=================================================
+
+The requirements writing style described below is the style used for writing the
+requirements of the Xen hypervisor to enable functional safety certification.
+
+The requirements writing style is inspired from the ANSI/IEEE guide to Software
+Requirements Standard. Specifically, the requirements should satisfy the
+following validation checklist.
+(Source - https://www.nasa.gov/reference/appendix-c-how-to-write-a-good-requirement)
+
+Clarity -
+The requirements should be clear, unambiguous, consise and simple. Each
+requirement should express a single thought. Each requirement stated should have
+a single interpretation.
+
+Consistency -
+Any requirement shouldn't contradict with any other requirement. The requirements
+should be categorized correctly (the categories have been explained in the
+README). The tone of each requirement should be definitive (ie "Xen shall ..."
+should be present in each requirement).
+
+Traceability -
+Any market requirement should be linked to the product requirement/s and
+vice versa. Any product requirement should be linked to the design requirement/s
+and vice versa. Full bi-directional traceability should be maintained between
+market, product and design requirements.
+
+Correctness -
+The requirements should be feasible and technically correct (at the time of
+writing). However, it is not expected that the requirements will be kept upto
+date with the code.
+
+The requirements follow the same license and line length as the code.
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Aug 10 08:22:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 10 Aug 2024 08:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.775087.1185446 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1schMR-0007E3-D0; Sat, 10 Aug 2024 08:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 775087.1185446; Sat, 10 Aug 2024 08:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1schMR-0007Dv-A7; Sat, 10 Aug 2024 08:22:03 +0000
Received: by outflank-mailman (input) for mailman id 775087;
 Sat, 10 Aug 2024 08:22:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1schMP-0007Dp-Mv
 for xen-changelog@lists.xenproject.org; Sat, 10 Aug 2024 08:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1schMP-0007nn-Hf
 for xen-changelog@lists.xenproject.org; Sat, 10 Aug 2024 08:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1schMP-0005s8-GF
 for xen-changelog@lists.xenproject.org; Sat, 10 Aug 2024 08: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MEjm1xWoNLq9LiTXCd7drF0UA+fqNCYTdaceuUiNIL4=; b=cI1U3TK4G00ucO10v97bh5MNGx
	cusVXIS0GMw1tIBTOZ54sdGFbGB/VTI8eVrylCrP//73ryq6t8BRrXoXXlFYyBnWevA5PaF+3KM/H
	tbuaEaR+1G4FRxFI6Lj41DoW0vfaMt+EPkvlBqDnWBmaexNfCDb6CueDR8jpijOrVlaM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul: avoid UB shift in AVX512 VPMOV* handling
Message-Id: <E1schMP-0005s8-GF@xenbits.xenproject.org>
Date: Sat, 10 Aug 2024 08:22:01 +0000

commit c24615500062eb63f1cfd208c234df5268a880e0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 8 13:26:38 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:26:38 2024 +0200

    x86emul: avoid UB shift in AVX512 VPMOV* handling
    
    For widening and narrowing moves, operand (vector) size is calculated
    from a table. This calculation, for the AVX512 cases, lives ahead of
    validation of EVEX.L'L (which cannot be 3 without raising #UD). Account
    for the later checking by adjusting the constants in the expression such
    that even EVEX.L'L == 3 will yield a non-UB shift (read: shift count
    reliably >= 0).
    
    Fixes: 3988beb08 ("x86emul: support AVX512{F,BW} zero- and sign-extending moves")
    Oss-fuzz: 70914
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index bf388b7b1e..f0829a19d4 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -5788,7 +5788,7 @@ x86_emulate(
             d = DstMem | SrcReg | TwoOp;
         }
         generate_exception_if(evex.brs, X86_EXC_UD);
-        op_bytes = 32 >> (pmov_convert_delta[b & 7] + 1 - evex.lr);
+        op_bytes = 64 >> (pmov_convert_delta[b & 7] + 2 - evex.lr);
         elem_bytes = (b & 7) < 3 ? 1 : (b & 7) != 5 ? 2 : 4;
         goto avx512f_no_sae;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 10 08:22:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 10 Aug 2024 08:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.775088.1185451 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1schMb-0007Fj-EM; Sat, 10 Aug 2024 08:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 775088.1185451; Sat, 10 Aug 2024 08:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1schMb-0007Fc-Bg; Sat, 10 Aug 2024 08:22:13 +0000
Received: by outflank-mailman (input) for mailman id 775088;
 Sat, 10 Aug 2024 08:22:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1schMZ-0007FQ-Nh
 for xen-changelog@lists.xenproject.org; Sat, 10 Aug 2024 08:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1schMZ-0007nu-Mt
 for xen-changelog@lists.xenproject.org; Sat, 10 Aug 2024 08:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1schMZ-0005t5-K4
 for xen-changelog@lists.xenproject.org; Sat, 10 Aug 2024 08: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FD1uww4DhEQazq2CsrqDN9F7PMYiO9hJidhx/+4sNuk=; b=grODdM99C/l5gL0+1g4ewQAHpx
	xu67x+PrmIx/Rj7ciZYh9cOvcTi3oTvIZZftACowVI4q9xDYtOWJUOuA64ZS7axD+Uryx+B54Vjjw
	0SnjcPQkwaXejIohMzkrgNJdYORNlOHaXK752A40/J0hKjj2g8tQN0r3FweEQQ40hjxQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul: adjust 2nd param of idiv_dbl()
Message-Id: <E1schMZ-0005t5-K4@xenbits.xenproject.org>
Date: Sat, 10 Aug 2024 08:22:11 +0000

commit ef31716a57e6c29ba14b4f009e9a67277c8117a8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 8 13:27:25 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:27:25 2024 +0200

    x86emul: adjust 2nd param of idiv_dbl()
    
    -LONG_MIN cannot be represented in a long and hence is UB, for being one
    larger than LONG_MAX.
    
    The caller passing an unsigned long and the 1st param also being (array
    of) unsigned long, change the 2nd param accordingly while adding the
    sole necessary cast. This was the original form of the function anyway.
    
    Fixes: 5644ce014223 ("x86emul: relax asm() constraints")
    Oss-fuzz: 70923
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index f0829a19d4..a0deafbd3b 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -607,9 +607,9 @@ static bool div_dbl(unsigned long u[2], unsigned long v)
  * NB. We don't use idiv directly as it's moderately hard to work out
  *     ahead of time whether it will #DE, which we cannot allow to happen.
  */
-static bool idiv_dbl(unsigned long u[2], long v)
+static bool idiv_dbl(unsigned long u[2], unsigned long v)
 {
-    bool negu = (long)u[1] < 0, negv = v < 0;
+    bool negu = (long)u[1] < 0, negv = (long)v < 0;
 
     /* u = abs(u) */
     if ( negu )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 10 08:22:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 10 Aug 2024 08:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.775089.1185455 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1schMl-0007K3-Gb; Sat, 10 Aug 2024 08:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 775089.1185455; Sat, 10 Aug 2024 08:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1schMl-0007Jv-DI; Sat, 10 Aug 2024 08:22:23 +0000
Received: by outflank-mailman (input) for mailman id 775089;
 Sat, 10 Aug 2024 08:22:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1schMj-0007Jd-Rf
 for xen-changelog@lists.xenproject.org; Sat, 10 Aug 2024 08:22:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1schMj-0007oU-Qp
 for xen-changelog@lists.xenproject.org; Sat, 10 Aug 2024 08:22:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1schMj-0005vD-P8
 for xen-changelog@lists.xenproject.org; Sat, 10 Aug 2024 08: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=K0+d6LnosGLzaHqmC4WBE+Zv1wtspJiXIrDD7GAh3DY=; b=vhGbCLS4Y4YmIrZZ5q54x3M9Wj
	m2LcghwtKr54/d1GqpDWMFk+fjybe8qBRYN8Al2ZdFdjyALXbhZYoJVjGPYDiTdF0HaeAQ1fxRxw4
	gZlaPFrvUQDBpo93bjgn4dS0MQKP7OkqYJWx5QMfN2rbqz8RJqFc639CRCUT3GcmZZgA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/emul: Fix misaligned IO breakpoint behaviour in PV guests
Message-Id: <E1schMj-0005vD-P8@xenbits.xenproject.org>
Date: Sat, 10 Aug 2024 08:22:21 +0000

commit 08aacc392d86d4c7dbebdb5e664060ae2af72057
Author:     Matthew Barnes <matthew.barnes@cloud.com>
AuthorDate: Thu Aug 8 13:27:50 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 8 13:27:50 2024 +0200

    x86/emul: Fix misaligned IO breakpoint behaviour in PV guests
    
    When hardware breakpoints are configured on misaligned IO ports, the
    hardware will mask the addresses based on the breakpoint width during
    comparison.
    
    For PV guests, misaligned IO breakpoints do not behave the same way, and
    therefore yield different results.
    
    This patch tweaks the emulation of IO breakpoints for PV guests such
    that they reproduce the same behaviour as hardware.
    
    Fixes: bec9e3205018 ("x86: emulate I/O port access breakpoints")
    Signed-off-by: Matthew Barnes <matthew.barnes@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/pv/emul-priv-op.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index f101510a1b..aa11ecadaa 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -346,6 +346,8 @@ static unsigned int check_guest_io_breakpoint(struct vcpu *v,
         case DR_LEN_8: width = 8; break;
         }
 
+        start &= ~(width - 1UL);
+
         if ( (start < (port + len)) && ((start + width) > port) )
             match |= 1u << i;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 10 19:22:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 10 Aug 2024 19:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.775172.1185498 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scrf8-0004Gf-ED; Sat, 10 Aug 2024 19:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 775172.1185498; Sat, 10 Aug 2024 19:22:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scrf8-0004GX-BY; Sat, 10 Aug 2024 19:22:02 +0000
Received: by outflank-mailman (input) for mailman id 775172;
 Sat, 10 Aug 2024 19:22:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scrf7-0004GR-Kz
 for xen-changelog@lists.xenproject.org; Sat, 10 Aug 2024 19:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scrf7-0004hq-K7
 for xen-changelog@lists.xenproject.org; Sat, 10 Aug 2024 19:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scrf7-0003am-Ii
 for xen-changelog@lists.xenproject.org; Sat, 10 Aug 2024 19:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Tlazdn+OdvqxkMvAWkVGQP+fZulgxXY2uJeUSVVXVEY=; b=OOfi3BZi3vZ/kYwUYTfE+2LD+q
	SqvQw64sNg2Mrve7cOLZJkaq9iS02N7L92ymUydGEDJBUocMqtjNxpXu/+9dbj4aS6bt1hlzhIU4p
	K1G44kR18foqpgdknlJyRpUzLN8Fv2SEIhX41NZjbWDPe1siSB7CcVT7QjK9eiE3017M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: Introduce Fusa Requirement and define maintainers
Message-Id: <E1scrf7-0003am-Ii@xenbits.xenproject.org>
Date: Sat, 10 Aug 2024 19:22:01 +0000

commit 878974a33f9b4ae2686364ce2375239fccd7b063
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Tue Aug 6 17:31:55 2024 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 9 16:58:04 2024 -0700

    docs: Introduce Fusa Requirement and define maintainers
    
    The FUSA folder is expected to contain requirements and other documents
    to enable safety certification of Xen hypervisor.
    Added a intro to explain how the requirements are categorized, written
    and their supported status.
    Also, added index.rst for inclusion in build docs.
    
    Added maintainers for the same.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 MAINTAINERS              |  9 +++++
 docs/fusa/index.rst      |  9 +++++
 docs/fusa/reqs/index.rst |  9 +++++
 docs/fusa/reqs/intro.rst | 86 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 113 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 89be48fdf9..fb0ebf0939 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -315,6 +315,15 @@ F:	xen/arch/x86/include/asm/x86_*/efi*.h
 F:	xen/common/efi/
 F:	xen/include/efi/
 
+FUSA
+M:	Stefano Stabellini <sstabellini@kernel.org>
+M:	Bertrand Marquis <bertrand.marquis@arm.com>
+M:	Michal Orzel <michal.orzel@amd.com>
+M:	Ayan Kumar Halder <ayan.kumar.halder@amd.com>
+M:	Artem Mygaiev <artem_mygaiev@epam.com>
+S:	Supported
+F:	docs/fusa/
+
 GDBSX DEBUGGER
 M:	Elena Ufimtseva <elena.ufimtseva@oracle.com>
 S:	Supported
diff --git a/docs/fusa/index.rst b/docs/fusa/index.rst
new file mode 100644
index 0000000000..13bf4e8e23
--- /dev/null
+++ b/docs/fusa/index.rst
@@ -0,0 +1,9 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Functional Safety documentation
+===============================
+
+.. toctree::
+   :maxdepth: 2
+
+   reqs
diff --git a/docs/fusa/reqs/index.rst b/docs/fusa/reqs/index.rst
new file mode 100644
index 0000000000..78c02b1d9b
--- /dev/null
+++ b/docs/fusa/reqs/index.rst
@@ -0,0 +1,9 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+Requirements documentation
+==========================
+
+.. toctree::
+   :maxdepth: 2
+
+   intro
diff --git a/docs/fusa/reqs/intro.rst b/docs/fusa/reqs/intro.rst
new file mode 100644
index 0000000000..d67b18dd9f
--- /dev/null
+++ b/docs/fusa/reqs/intro.rst
@@ -0,0 +1,86 @@
+.. SPDX-License-Identifier: CC-BY-4.0
+
+##################################
+Requirements Introduction Document
+##################################
+
+This folder contains a set of requirements describing Xen and its implementation
+in a form suitable for a safety certification process.
+
+The status is experimental and it is maintained on a best effort basis. The
+requirements may get slightly out of sync with the code. We are actively working
+on a process to keep them updated, more details to follow.
+
+The requirements writing style is inspired from the ANSI/IEEE guide to Software
+Requirements Standard 830-1984.
+
+The requirements are categorized as follows :-
+
+1. Market requirements - They define the high level functionalities of the
+hypervisor without going into concepts specific to Xen. Those should allow a
+system architect to understand wether Xen is providing the functionalities it
+needs for its system. This is the top level of the requirements.
+
+2. Product requirements - They define the Xen specific concepts and interfaces
+provided by Xen without going into implementation details. One or several of
+those requirements are linked to each market requirement. An Architect can use
+them understand how Xen fulfils a market need and design how Xen should be used
+in his system.
+
+3. Design requirements - They describe what the software implementation is doing
+from a technical point of view. One or several design requirement together
+define how product requirements are fulfilled technically and are linked to
+them. An implementer can use them to know how to write or understand the Xen
+code.
+
+The requirements are linked using OpenFastTrace
+(https://github.com/itsallcode/openfasttrace/blob/main/doc/user_guide.md).
+OpenFastTrace parses through the requirements and generates a traceability
+report.
+
+The following is the skeleton for a requirement.
+
+Title of the requirement
+========================
+
+`unique_tag`
+
+..
+
+  Each requirement needs to have a unique tag associated. The format is
+  req_type~name~revision.
+
+  Thus, it consists of three components :-
+  requirement type - This denotes the category of requirement. Thus, it shall
+  be 'XenMkt', 'XenProd' or 'XenSwdgn' to denote market, product or design
+  requirement.
+  name - This denotes name of the requirement. In case of architecture specific
+  requirements, this starts with the architecture type (ie x86_64, arm64).
+  revision number - This gets incremented each time the requirement is modified.
+
+
+Description:
+This shall describe the requirement in a definitive tone. In other words,
+the requirement begins with 'Xen shall ...'. Further, the description is
+expected to be unambiguous and consistent.
+
+Rationale:
+This describes a rationale explaining the reason of the presence of the
+requirement when this can help the reader. This field can be left blank.
+
+Comments:
+This describes the use cases for the requirement when this can help the
+reader. This field can be left blank as well.
+
+Covers:
+This denotes the unique_tag of the parent. This field is non existent for the
+market requirement as it is the top level.
+
+Needs:
+This denotes the requirement type of its children. This field is non existent
+for the design requirements as there are no subsequent requirements linked to
+them.
+
+
+The requirements are expected to the technically correct and follow the above
+guidelines.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 10 19:22:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 10 Aug 2024 19:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.775173.1185503 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scrfJ-0004IX-Fb; Sat, 10 Aug 2024 19:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 775173.1185503; Sat, 10 Aug 2024 19:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1scrfJ-0004IO-D3; Sat, 10 Aug 2024 19:22:13 +0000
Received: by outflank-mailman (input) for mailman id 775173;
 Sat, 10 Aug 2024 19:22:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scrfH-0004ID-QP
 for xen-changelog@lists.xenproject.org; Sat, 10 Aug 2024 19:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scrfH-0004i0-O1
 for xen-changelog@lists.xenproject.org; Sat, 10 Aug 2024 19:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1scrfH-0003bg-MG
 for xen-changelog@lists.xenproject.org; Sat, 10 Aug 2024 19: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rgJMlyxLVM//uNXNxT7JC4uUAGqEwNi4XvUGcNjaBvw=; b=NeBoT+cVQBXOo+lvL6+rGU6iXm
	tsryhLhdmAwFnc+p+eeuFrhydLXSsCk+ub30jnkGW/ZgoPtwBl5/pzkaUnqcCKaXazFj7OTSE6bwo
	R8dQjTZe9fqzQ9pM6haInKjo/V2aH6tXivmrV+iZ5Pnj184np5y1GIG2npw7Gu2Ct7CE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: fusa: reqs: Added a requirements writing style guide
Message-Id: <E1scrfH-0003bg-MG@xenbits.xenproject.org>
Date: Sat, 10 Aug 2024 19:22:11 +0000

commit d61248b0fa2cdfc0be1d806c43d1b211a72b5d49
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Tue Aug 6 17:31:56 2024 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 9 16:58:04 2024 -0700

    docs: fusa: reqs: Added a requirements writing style guide
    
    Added a guide to help write and review requirements. The requirements
    are written to enable safety certification of Xen hypervisor.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/fusa/reqs/REQUIREMENTS-STYLE | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/docs/fusa/reqs/REQUIREMENTS-STYLE b/docs/fusa/reqs/REQUIREMENTS-STYLE
new file mode 100644
index 0000000000..cd2408b9f2
--- /dev/null
+++ b/docs/fusa/reqs/REQUIREMENTS-STYLE
@@ -0,0 +1,34 @@
+Requirements writing style for the Xen Hypervisor
+=================================================
+
+The requirements writing style described below is the style used for writing the
+requirements of the Xen hypervisor to enable functional safety certification.
+
+The requirements writing style is inspired from the ANSI/IEEE guide to Software
+Requirements Standard. Specifically, the requirements should satisfy the
+following validation checklist.
+(Source - https://www.nasa.gov/reference/appendix-c-how-to-write-a-good-requirement)
+
+Clarity -
+The requirements should be clear, unambiguous, consise and simple. Each
+requirement should express a single thought. Each requirement stated should have
+a single interpretation.
+
+Consistency -
+Any requirement shouldn't contradict with any other requirement. The requirements
+should be categorized correctly (the categories have been explained in the
+README). The tone of each requirement should be definitive (ie "Xen shall ..."
+should be present in each requirement).
+
+Traceability -
+Any market requirement should be linked to the product requirement/s and
+vice versa. Any product requirement should be linked to the design requirement/s
+and vice versa. Full bi-directional traceability should be maintained between
+market, product and design requirements.
+
+Correctness -
+The requirements should be feasible and technically correct (at the time of
+writing). However, it is not expected that the requirements will be kept upto
+date with the code.
+
+The requirements follow the same license and line length as the code.
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Aug 12 22:22:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 12 Aug 2024 22:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.775790.1185963 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sddQT-0007L8-3x; Mon, 12 Aug 2024 22:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 775790.1185963; Mon, 12 Aug 2024 22:22: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 1sddQT-0007L0-1R; Mon, 12 Aug 2024 22:22:05 +0000
Received: by outflank-mailman (input) for mailman id 775790;
 Mon, 12 Aug 2024 22:22:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sddQR-0007Ku-I4
 for xen-changelog@lists.xenproject.org; Mon, 12 Aug 2024 22:22:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sddQR-0006jP-Fr
 for xen-changelog@lists.xenproject.org; Mon, 12 Aug 2024 22:22:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sddQR-0005Oz-D3
 for xen-changelog@lists.xenproject.org; Mon, 12 Aug 2024 22:22: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XnGu+bv+wVtDbHCV1D0cLr94s6ETIFK6z45GMS45LIE=; b=KtaXSE0fC2rkF8/xqoPtGMSGtM
	8bQVq0maXOFeeFMEHbHEdSy0dw6bxRVAox2YR4Sfo3iL+luANssP2Taqlk7ewQm5Pehj3HNkYtN9b
	unEm54Jpt4sHaIAbDEkjz9W1f+FTtBvQqGUaQHE4f/LHVRmdS8Dg0GWSHejibSBVX1t0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: disable Yocto jobs
Message-Id: <E1sddQR-0005Oz-D3@xenbits.xenproject.org>
Date: Mon, 12 Aug 2024 22:22:03 +0000

commit 1c24bca387136d73f88f46ce3db82d34411702e8
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Aug 9 23:59:18 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Aug 12 15:20:16 2024 -0700

    automation: disable Yocto jobs
    
    The Yocto jobs take a long time to run. We are changing Gitlab ARM64
    runners and the new runners might not be able to finish the Yocto jobs
    in a reasonable time.
    
    For now, disable the Yocto jobs by turning them into "manual" trigger
    (they need to be manually executed.)
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 automation/gitlab-ci/build.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 32045cef0c..c668736bdc 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -470,17 +470,20 @@ yocto-qemuarm64:
   extends: .yocto-test-arm64
   variables:
     YOCTO_BOARD: qemuarm64
+  when: manual
 
 yocto-qemuarm:
   extends: .yocto-test-arm64
   variables:
     YOCTO_BOARD: qemuarm
     YOCTO_OUTPUT: --copy-output
+  when: manual
 
 yocto-qemux86-64:
   extends: .yocto-test-x86-64
   variables:
     YOCTO_BOARD: qemux86-64
+  when: manual
 
 # Cppcheck analysis jobs
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 12 22:22:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 12 Aug 2024 22:22:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.775791.1185967 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sddQc-0007Ml-5F; Mon, 12 Aug 2024 22:22:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 775791.1185967; Mon, 12 Aug 2024 22:22:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sddQc-0007Me-2o; Mon, 12 Aug 2024 22:22:14 +0000
Received: by outflank-mailman (input) for mailman id 775791;
 Mon, 12 Aug 2024 22:22:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sddQb-0007MU-KS
 for xen-changelog@lists.xenproject.org; Mon, 12 Aug 2024 22:22:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sddQb-0006jV-Jc
 for xen-changelog@lists.xenproject.org; Mon, 12 Aug 2024 22:22:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sddQb-0005Pt-Hw
 for xen-changelog@lists.xenproject.org; Mon, 12 Aug 2024 22:22: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=npQ5/wWi2Q3gupGn0IohdfI7FVxJi3PBtNj60Jb7Hjs=; b=WmqnOO3/WhTp1U8riuY7ukbJMP
	haIVWL6/QWM4Jr4GITtbOM9IiEfP4gL3XU9VEnYJicMbz3QLOFY/JXHOrmsK5AmMgEZM4HlbT93rp
	UgrGvnWCXhA//TGwvM0QSycZOF5sA4kLP3eGxVDIDbxwTTooAgG7khf09i/EoI42+sc0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: add "expect" to containers used to run QEMU tests
Message-Id: <E1sddQb-0005Pt-Hw@xenbits.xenproject.org>
Date: Mon, 12 Aug 2024 22:22:13 +0000

commit 98a462f8b169f93ab7463023f0ed94575f8225b4
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Aug 9 23:59:19 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Aug 12 15:20:30 2024 -0700

    automation: add "expect" to containers used to run QEMU tests
    
    It will be used for QEMU tests.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 automation/build/debian/12-ppc64le.dockerfile       | 1 +
 automation/build/debian/12-riscv64.dockerfile       | 1 +
 automation/build/debian/bookworm-arm64v8.dockerfile | 1 +
 automation/build/debian/bookworm.dockerfile         | 1 +
 4 files changed, 4 insertions(+)

diff --git a/automation/build/debian/12-ppc64le.dockerfile b/automation/build/debian/12-ppc64le.dockerfile
index 3b311e675e..1d5b486bb4 100644
--- a/automation/build/debian/12-ppc64le.dockerfile
+++ b/automation/build/debian/12-ppc64le.dockerfile
@@ -26,6 +26,7 @@ RUN <<EOF
 
         # Qemu for test phase
         qemu-system-ppc
+        expect
     )
 
     apt-get -y --no-install-recommends install "${DEPS[@]}"
diff --git a/automation/build/debian/12-riscv64.dockerfile b/automation/build/debian/12-riscv64.dockerfile
index 03fd4b0305..8d7233d675 100644
--- a/automation/build/debian/12-riscv64.dockerfile
+++ b/automation/build/debian/12-riscv64.dockerfile
@@ -26,6 +26,7 @@ RUN <<EOF
 
         # Qemu for test phase
         qemu-system-riscv64
+        expect
     )
 
     apt-get -y --no-install-recommends install "${DEPS[@]}"
diff --git a/automation/build/debian/bookworm-arm64v8.dockerfile b/automation/build/debian/bookworm-arm64v8.dockerfile
index 11acc07bff..da8ae75125 100644
--- a/automation/build/debian/bookworm-arm64v8.dockerfile
+++ b/automation/build/debian/bookworm-arm64v8.dockerfile
@@ -48,6 +48,7 @@ RUN apt-get update && \
         curl \
         cpio \
         busybox-static \
+        expect \
         && \
         apt-get autoremove -y && \
         apt-get clean && \
diff --git a/automation/build/debian/bookworm.dockerfile b/automation/build/debian/bookworm.dockerfile
index db866fde30..3dd70cb6b2 100644
--- a/automation/build/debian/bookworm.dockerfile
+++ b/automation/build/debian/bookworm.dockerfile
@@ -45,6 +45,7 @@ RUN apt-get update && \
         golang \
         # for test phase, qemu-smoke-* jobs
         qemu-system-x86 \
+        expect \
         # for test phase, qemu-alpine-* jobs
         cpio \
         busybox-static \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 13 14:44:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Aug 2024 14:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776385.1186497 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdskn-00041H-17; Tue, 13 Aug 2024 14:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776385.1186497; Tue, 13 Aug 2024 14:44: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 1sdskm-00041A-Uo; Tue, 13 Aug 2024 14:44:04 +0000
Received: by outflank-mailman (input) for mailman id 776385;
 Tue, 13 Aug 2024 14:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdskm-000414-3y
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdskm-0007xP-1c
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdskl-0007EB-Vm
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4wXJ+2y5hVZIrPG3SaSoeR62vbBwwItPkF7TN1Fbu1A=; b=DNbIsWY2x5WNAMRCWNcYxFWPT4
	G/pwss/krwrHUdXFxNFlJ+fmKQarX1N+dA8NMnb/kJu2pK4BgTD9u+UITpn5pJs45RuWQgo49guCY
	UE5onDAY0wwlPhodFxWDWQuMKhg3BaO1Htt1ODkojEBQMlFjUGX5HyNWIZOrqqrY8OF8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/IOMMU: move tracking in iommu_identity_mapping()
Message-Id: <E1sdskl-0007EB-Vm@xenbits.xenproject.org>
Date: Tue, 13 Aug 2024 14:44:03 +0000

commit beadd68b5490ada053d72f8a9ce6fd696d626596
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Tue Aug 13 16:36:40 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:36:40 2024 +0200

    x86/IOMMU: move tracking in iommu_identity_mapping()
    
    If for some reason xmalloc() fails after having mapped the reserved
    regions, an error is reported, but the regions remain mapped in the P2M.
    
    Similarly if an error occurs during set_identity_p2m_entry() (except on
    the first call), the partial mappings of the region would be retained
    without being tracked anywhere, and hence without there being a way to
    remove them again from the domain's P2M.
    
    Move the setting up of the list entry ahead of trying to map the region.
    In cases other than the first mapping failing, keep record of the full
    region, such that a subsequent unmapping request can be properly torn
    down.
    
    To compensate for the potentially excess unmapping requests, don't log a
    warning from p2m_remove_identity_entry() when there really was nothing
    mapped at a given GFN.
    
    This is XSA-460 / CVE-2024-31145.
    
    Fixes: 2201b67b9128 ("VT-d: improve RMRR region handling")
    Fixes: c0e19d7c6c42 ("IOMMU: generalize VT-d's tracking of mapped RMRR regions")
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m.c               |  8 +++++---
 xen/drivers/passthrough/x86/iommu.c | 30 +++++++++++++++++++++---------
 2 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index e7e327d6a6..1739133fc2 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1267,9 +1267,11 @@ int p2m_remove_identity_entry(struct domain *d, unsigned long gfn_l)
     else
     {
         gfn_unlock(p2m, gfn, 0);
-        printk(XENLOG_G_WARNING
-               "non-identity map d%d:%lx not cleared (mapped to %lx)\n",
-               d->domain_id, gfn_l, mfn_x(mfn));
+        if ( (p2mt != p2m_invalid && p2mt != p2m_mmio_dm) ||
+             a != p2m_access_n || !mfn_eq(mfn, INVALID_MFN) )
+           printk(XENLOG_G_WARNING
+                  "non-identity map %pd:%lx not cleared (mapped to %lx)\n",
+                  d, gfn_l, mfn_x(mfn));
         ret = 0;
     }
 
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index cc0062b027..8b1e0596b8 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -267,24 +267,36 @@ int iommu_identity_mapping(struct domain *d, p2m_access_t p2ma,
     if ( p2ma == p2m_access_x )
         return -ENOENT;
 
-    while ( base_pfn < end_pfn )
-    {
-        int err = set_identity_p2m_entry(d, base_pfn, p2ma, flag);
-
-        if ( err )
-            return err;
-        base_pfn++;
-    }
-
     map = xmalloc(struct identity_map);
     if ( !map )
         return -ENOMEM;
+
     map->base = base;
     map->end = end;
     map->access = p2ma;
     map->count = 1;
+
+    /*
+     * Insert into list ahead of mapping, so the range can be found when
+     * trying to clean up.
+     */
     list_add_tail(&map->list, &hd->arch.identity_maps);
 
+    for ( ; base_pfn < end_pfn; ++base_pfn )
+    {
+        int err = set_identity_p2m_entry(d, base_pfn, p2ma, flag);
+
+        if ( !err )
+            continue;
+
+        if ( (map->base >> PAGE_SHIFT_4K) == base_pfn )
+        {
+            list_del(&map->list);
+            xfree(map);
+        }
+        return err;
+    }
+
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 13 14:44:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Aug 2024 14:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776386.1186502 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdskx-00044O-2o; Tue, 13 Aug 2024 14:44:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776386.1186502; Tue, 13 Aug 2024 14:44: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 1sdskx-00044H-08; Tue, 13 Aug 2024 14:44:15 +0000
Received: by outflank-mailman (input) for mailman id 776386;
 Tue, 13 Aug 2024 14:44:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdskw-00043S-6I
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:44:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdskw-0007xj-4f
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdskw-0007Eq-3s
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qU9wBtdkyb+eDWkeSSY5Exeo4SWxBr9lBpqAOAwESUo=; b=P4Hi8yWGh3DXF8xyaI3VNKjj4G
	WIiX0MZ2x0Ca73L9I+DhYbtGrvs9HRmdoGYhSKy+J0jsN0v1k+qyFvCZn3Qe9bo8CeUPCycN7KIk2
	ZJPYTKL4GkbEvMFCL0FwKQ6BQnXIsw9A3kPWE0Mu09TpZYXxLvW/cobnjbRcLX4XimBo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/pass-through: documents as security-unsupported when sharing resources
Message-Id: <E1sdskw-0007Eq-3s@xenbits.xenproject.org>
Date: Tue, 13 Aug 2024 14:44:14 +0000

commit 9c94eda1e3790820699a6de3f6a7c959ecf30600
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Aug 13 16:37:25 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:37:25 2024 +0200

    x86/pass-through: documents as security-unsupported when sharing resources
    
    When multiple devices share resources and one of them is to be passed
    through to a guest, security of the entire system and of respective
    guests individually cannot really be guaranteed without knowing
    internals of any of the involved guests.  Therefore such a configuration
    cannot really be security-supported, yet making that explicit was so far
    missing.
    
    This is XSA-461 / CVE-2024-31146.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 SUPPORT.md | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index 0c36cb2ed4..f822a7e607 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -842,6 +842,11 @@ This feature is not security supported: see https://xenbits.xen.org/xsa/advisory
 
 Only systems using IOMMUs are supported.
 
+Passing through of devices sharing resources with another device is not
+security supported.  Such sharing could e.g. be the same line interrupt being
+used by multiple devices, one of which is to be passed through, or two such
+devices having memory BARs within the same 4k page.
+
 Not compatible with migration, populate-on-demand, altp2m,
 introspection, memory sharing, or memory paging.
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 13 14:44:26 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Aug 2024 14:44:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776387.1186506 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdsl8-00046k-4V; Tue, 13 Aug 2024 14:44:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776387.1186506; Tue, 13 Aug 2024 14:44: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 1sdsl8-00046c-1n; Tue, 13 Aug 2024 14:44:26 +0000
Received: by outflank-mailman (input) for mailman id 776387;
 Tue, 13 Aug 2024 14:44:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdsl6-00046W-AC
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:44:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdsl6-0007xv-8X
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:44:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdsl6-0007Fn-6q
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GPPEA7EfdLhYgMiUJ6UF/9KNFjjfTQyP3QG0z6lYgYE=; b=VMtAriS+q+xxPB7BeC4W2HjOXz
	ZOZbhxfTDl0SK2mCkVRfcBLooNiGGwNhNrz9GibNw1qurIcH1knwNzpaXDqYcYcxMCzbyft2VVtna
	4gN5/zInw2Xmg9Fq0oB4uMsMFGZnugpDZ4wVsc0cu1f6nQJR9RKk5jCBsNX/JPxqJgD4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: enable GENERIC_BUG_FRAME
Message-Id: <E1sdsl6-0007Fn-6q@xenbits.xenproject.org>
Date: Tue, 13 Aug 2024 14:44:24 +0000

commit a8d9b750458f7e91fbb8ab63b5b9341ffb6f6bed
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Aug 13 16:38:15 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:38:15 2024 +0200

    xen/riscv: enable GENERIC_BUG_FRAME
    
    Enable GENERIC_BUG_FRAME to support BUG(), WARN(), ASSERT,
    and run_in_exception_handler().
    
    "UNIMP" is used for BUG_INSTR, which, when macros from <xen/bug.h>
    are used, triggers an exception with the ILLEGAL_INSTRUCTION cause.
    This instruction is encoded as a 2-byte instruction when
    CONFIG_RISCV_ISA_C is enabled:
      ffffffffc0046ba0:       0000                    unimp
    and is encoded as a 4-byte instruction when CONFIG_RISCV_ISA_C
    ins't enabled:
      ffffffffc005a460:       c0001073                unimp
    
    Using 'ebreak' as BUG_INSTR does not guarantee proper handling of macros
    from <xen/bug.h>. If a debugger inserts a breakpoint (using the 'ebreak'
    instruction) at a location where Xen already uses 'ebreak', it
    creates ambiguity. Xen cannot distinguish whether the 'ebreak'
    instruction is inserted by the debugger or is part of Xen's own code.
    
    Remove BUG_INSN_32 and BUG_INSN_16 macros as they encode the ebreak
    instruction, which is no longer used for BUG_INSN.
    
    Update the comment above the definition of INS_LENGTH_MASK as instead of
    'ebreak' instruction 'unimp' instruction is used.
    
    <xen/lib.h> is included for the reason that panic() and printk() are
    used in common/bug.c and RISC-V fails if it is not included.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/Kconfig           |  1 +
 xen/arch/riscv/include/asm/bug.h |  8 +++-----
 xen/arch/riscv/traps.c           | 26 +++++++++++++++++++++++++-
 xen/common/bug.c                 |  1 +
 4 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
index b4b354a778..f531e96657 100644
--- a/xen/arch/riscv/Kconfig
+++ b/xen/arch/riscv/Kconfig
@@ -1,6 +1,7 @@
 config RISCV
 	def_bool y
 	select FUNCTION_ALIGNMENT_16B
+	select GENERIC_BUG_FRAME
 
 config RISCV_64
 	def_bool y
diff --git a/xen/arch/riscv/include/asm/bug.h b/xen/arch/riscv/include/asm/bug.h
index f5ff96140f..e3d41f411a 100644
--- a/xen/arch/riscv/include/asm/bug.h
+++ b/xen/arch/riscv/include/asm/bug.h
@@ -9,7 +9,7 @@
 
 #ifndef __ASSEMBLY__
 
-#define BUG_INSTR "ebreak"
+#define BUG_INSTR "unimp"
 
 /*
  * The base instruction set has a fixed length of 32-bit naturally aligned
@@ -18,15 +18,13 @@
  * There are extensions of variable length ( where each instruction can be
  * any number of 16-bit parcels in length ).
  *
- * Compressed ISA is used now where the instruction length is 16 bit  and
- * 'ebreak' instruction, in this case, can be either 16 or 32 bit (
+ * Compressed ISA is used now where the instruction length is 16 bit and
+ * 'unimp' instruction, in this case, can be either 16 or 32 bit (
  * depending on if compressed ISA is used or not )
  */
 #define INSN_LENGTH_MASK        _UL(0x3)
 #define INSN_LENGTH_32          _UL(0x3)
 
-#define BUG_INSN_32             _UL(0x00100073) /* ebreak */
-#define BUG_INSN_16             _UL(0x9002)     /* c.ebreak */
 #define COMPRESSED_INSN_MASK    _UL(0xffff)
 
 #define GET_INSN_LENGTH(insn)                               \
diff --git a/xen/arch/riscv/traps.c b/xen/arch/riscv/traps.c
index 7149504ebc..d55a4a827b 100644
--- a/xen/arch/riscv/traps.c
+++ b/xen/arch/riscv/traps.c
@@ -5,6 +5,8 @@
  * RISC-V Trap handlers
  */
 
+#include <xen/bug.h>
+#include <xen/compiler.h>
 #include <xen/lib.h>
 #include <xen/nospec.h>
 #include <xen/sched.h>
@@ -106,7 +108,29 @@ static void do_unexpected_trap(const struct cpu_user_regs *regs)
 
 void do_trap(struct cpu_user_regs *cpu_regs)
 {
-    do_unexpected_trap(cpu_regs);
+    register_t pc = cpu_regs->sepc;
+    unsigned long cause = csr_read(CSR_SCAUSE);
+
+    switch ( cause )
+    {
+    case CAUSE_ILLEGAL_INSTRUCTION:
+        if ( do_bug_frame(cpu_regs, pc) >= 0 )
+        {
+            if ( !(is_kernel_text(pc) || is_kernel_inittext(pc)) )
+            {
+                printk("Something wrong with PC: %#lx\n", pc);
+                die();
+            }
+
+            cpu_regs->sepc += GET_INSN_LENGTH(*(uint16_t *)pc);
+
+            break;
+        }
+        fallthrough;
+    default:
+        do_unexpected_trap(cpu_regs);
+        break;
+    }
 }
 
 void vcpu_show_execution_state(struct vcpu *v)
diff --git a/xen/common/bug.c b/xen/common/bug.c
index b7c5d8fd4d..75cb35fcfa 100644
--- a/xen/common/bug.c
+++ b/xen/common/bug.c
@@ -1,6 +1,7 @@
 #include <xen/bug.h>
 #include <xen/errno.h>
 #include <xen/kernel.h>
+#include <xen/lib.h>
 #include <xen/livepatch.h>
 #include <xen/string.h>
 #include <xen/types.h>
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 13 14:44:36 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Aug 2024 14:44:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776388.1186509 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdslI-00049c-5y; Tue, 13 Aug 2024 14:44:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776388.1186509; Tue, 13 Aug 2024 14:44:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdslI-00049V-3D; Tue, 13 Aug 2024 14:44:36 +0000
Received: by outflank-mailman (input) for mailman id 776388;
 Tue, 13 Aug 2024 14:44:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdslG-00049D-Dw
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:44:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdslG-0007y2-Bc
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:44:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdslG-0007GM-Ai
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ds/j44nJpbemwzJn+YgSkMbYsUY/pX3BApigzs24gkc=; b=s3nWm/QjmqIvluB8+YGar87ErA
	EeH9ZyaeMsQsTSjeHgx2a1mZ9lcJJpOaLL9GnSE1fdld7RTPdJ0KyOULgs43rKpsxSHVy7H8nGaS8
	H4Lqj2i4Jzyp8bGtHuosG/15GQUFu32WItUF5k4lcrhp0ZFDhyy433RMZ0YA0QaHCqfU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vmx: guard access to cpu_has_vmx_* in common code
Message-Id: <E1sdslG-0007GM-Ai@xenbits.xenproject.org>
Date: Tue, 13 Aug 2024 14:44:34 +0000

commit b2e8c8f42083afcac8b4720c50680d7c9eaaf90a
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Tue Aug 13 16:38:40 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:38:40 2024 +0200

    x86/vmx: guard access to cpu_has_vmx_* in common code
    
    There're several places in common code, outside of arch/x86/hvm/vmx,
    where cpu_has_vmx_* get accessed without checking whether VMX supported first.
    These macros rely on global variables defined in vmx code, so when VMX support
    is disabled accesses to these variables turn into build failures.
    
    To overcome these failures, build-time check is done before accessing global
    variables, so that DCE would remove these variables.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Paul Durrant <paul@xen.org>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h | 90 ++++++++++++++++++++++-----------
 1 file changed, 60 insertions(+), 30 deletions(-)

diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index 58140af691..939b87eb50 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -298,69 +298,99 @@ extern u64 vmx_ept_vpid_cap;
 #define VMX_TSC_MULTIPLIER_MAX                  0xffffffffffffffffULL
 
 #define cpu_has_wbinvd_exiting \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_WBINVD_EXITING)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_WBINVD_EXITING)
 #define cpu_has_vmx_virtualize_apic_accesses \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)
 #define cpu_has_vmx_tpr_shadow \
-    (vmx_cpu_based_exec_control & CPU_BASED_TPR_SHADOW)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_cpu_based_exec_control & CPU_BASED_TPR_SHADOW)
 #define cpu_has_vmx_vnmi \
-    (vmx_pin_based_exec_control & PIN_BASED_VIRTUAL_NMIS)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_pin_based_exec_control & PIN_BASED_VIRTUAL_NMIS)
 #define cpu_has_vmx_msr_bitmap \
-    (vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_MSR_BITMAP)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_MSR_BITMAP)
 #define cpu_has_vmx_secondary_exec_control \
-    (vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS)
 #define cpu_has_vmx_tertiary_exec_control \
-    (vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_TERTIARY_CONTROLS)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_TERTIARY_CONTROLS)
 #define cpu_has_vmx_ept \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT)
 #define cpu_has_vmx_dt_exiting \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_DESCRIPTOR_TABLE_EXITING)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_DESCRIPTOR_TABLE_EXITING)
 #define cpu_has_vmx_rdtscp \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_RDTSCP)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_RDTSCP)
 #define cpu_has_vmx_vpid \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VPID)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VPID)
 #define cpu_has_monitor_trap_flag \
-    (vmx_cpu_based_exec_control & CPU_BASED_MONITOR_TRAP_FLAG)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_cpu_based_exec_control & CPU_BASED_MONITOR_TRAP_FLAG)
 #define cpu_has_vmx_pat \
-    (vmx_vmentry_control & VM_ENTRY_LOAD_GUEST_PAT)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_vmentry_control & VM_ENTRY_LOAD_GUEST_PAT)
 #define cpu_has_vmx_efer \
-    (vmx_vmentry_control & VM_ENTRY_LOAD_GUEST_EFER)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_vmentry_control & VM_ENTRY_LOAD_GUEST_EFER)
 #define cpu_has_vmx_unrestricted_guest \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_UNRESTRICTED_GUEST)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_UNRESTRICTED_GUEST)
 #define vmx_unrestricted_guest(v)               \
     ((v)->arch.hvm.vmx.secondary_exec_control & \
      SECONDARY_EXEC_UNRESTRICTED_GUEST)
 #define cpu_has_vmx_ple \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_PAUSE_LOOP_EXITING)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_PAUSE_LOOP_EXITING)
 #define cpu_has_vmx_invpcid \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_INVPCID)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_INVPCID)
 #define cpu_has_vmx_apic_reg_virt \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_APIC_REGISTER_VIRT)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_APIC_REGISTER_VIRT)
 #define cpu_has_vmx_virtual_intr_delivery \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY)
 #define cpu_has_vmx_virtualize_x2apic_mode \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE)
 #define cpu_has_vmx_posted_intr_processing \
-    (vmx_pin_based_exec_control & PIN_BASED_POSTED_INTERRUPT)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_pin_based_exec_control & PIN_BASED_POSTED_INTERRUPT)
 #define cpu_has_vmx_vmcs_shadowing \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VMCS_SHADOWING)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VMCS_SHADOWING)
 #define cpu_has_vmx_vmfunc \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VM_FUNCTIONS)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VM_FUNCTIONS)
 #define cpu_has_vmx_virt_exceptions \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VIRT_EXCEPTIONS)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VIRT_EXCEPTIONS)
 #define cpu_has_vmx_pml \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_PML)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_PML)
 #define cpu_has_vmx_mpx \
-    ((vmx_vmexit_control & VM_EXIT_CLEAR_BNDCFGS) && \
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     (vmx_vmexit_control & VM_EXIT_CLEAR_BNDCFGS) && \
      (vmx_vmentry_control & VM_ENTRY_LOAD_BNDCFGS))
 #define cpu_has_vmx_xsaves \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_XSAVES)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_XSAVES)
 #define cpu_has_vmx_tsc_scaling \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_TSC_SCALING)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_TSC_SCALING)
 #define cpu_has_vmx_bus_lock_detection \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_BUS_LOCK_DETECTION)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_BUS_LOCK_DETECTION)
 #define cpu_has_vmx_notify_vm_exiting \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_NOTIFY_VM_EXITING)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_NOTIFY_VM_EXITING)
 
 #define VMCS_RID_TYPE_MASK              0x80000000U
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 13 14:44:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Aug 2024 14:44:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776389.1186514 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdslS-0004Cb-7Z; Tue, 13 Aug 2024 14:44:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776389.1186514; Tue, 13 Aug 2024 14:44:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdslS-0004CT-4n; Tue, 13 Aug 2024 14:44:46 +0000
Received: by outflank-mailman (input) for mailman id 776389;
 Tue, 13 Aug 2024 14:44:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdslQ-0004C8-GD
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:44:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdslQ-0007y9-FH
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:44:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdslQ-0007H2-Do
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=O1K875QRhff70ZgRGaCnczfyWx6Fx5/9UMwJ450I/WE=; b=fwrmddds8RjBBt1CeWRPi9Y+Sy
	WFqZH3SdLXIFfk3/GbnxZ1eNO1lwius61J2/joaL9ocZH985npNA79FYtPEwW8R6LH+rEiNjmGbnt
	q6HrDDvDtX1P/Dk+obc9tNKnTzWfdksN5ugLbMkaxxgSc8sOFAcglimyzksbr7FB/ATc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/hvmloader: Fix non-deterministic cpuid()
Message-Id: <E1sdslQ-0007H2-Do@xenbits.xenproject.org>
Date: Tue, 13 Aug 2024 14:44:44 +0000

commit cc47813c4a2c07a5c6c6a1491b98f3f8549835a7
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Tue Aug 13 16:39:10 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:39:10 2024 +0200

    tools/hvmloader: Fix non-deterministic cpuid()
    
    hvmloader's cpuid() implementation deviates from Xen's in that the value
    passed on ecx is unspecified. This means that when used on leaves that
    implement subleaves it's unspecified which one you get; though it's more
    than likely an invalid one.
    
    Import Xen's implementation so there are no surprises.
    
    Fixes: 318ac791f9f9 ("Add utilities needed for SMBIOS generation to hvmloader")
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/firmware/hvmloader/util.c |  9 ---------
 tools/firmware/hvmloader/util.h | 27 ++++++++++++++++++++++++---
 2 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c
index c34f077b38..d3b3f9038e 100644
--- a/tools/firmware/hvmloader/util.c
+++ b/tools/firmware/hvmloader/util.c
@@ -267,15 +267,6 @@ memcmp(const void *s1, const void *s2, unsigned n)
     return 0;
 }
 
-void
-cpuid(uint32_t idx, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
-{
-    asm volatile (
-        "cpuid"
-        : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
-        : "0" (idx) );
-}
-
 static const char hex_digits[] = "0123456789abcdef";
 
 /* Write a two-character hex representation of 'byte' to digits[].
diff --git a/tools/firmware/hvmloader/util.h b/tools/firmware/hvmloader/util.h
index deb823a892..17ed3783f2 100644
--- a/tools/firmware/hvmloader/util.h
+++ b/tools/firmware/hvmloader/util.h
@@ -184,9 +184,30 @@ int uart_exists(uint16_t uart_base);
 int lpt_exists(uint16_t lpt_base);
 int hpet_exists(unsigned long hpet_base);
 
-/* Do cpuid instruction, with operation 'idx' */
-void cpuid(uint32_t idx, uint32_t *eax, uint32_t *ebx,
-           uint32_t *ecx, uint32_t *edx);
+/* Some CPUID calls want 'count' to be placed in ecx */
+static inline void cpuid_count(
+    uint32_t leaf,
+    uint32_t subleaf,
+    uint32_t *eax,
+    uint32_t *ebx,
+    uint32_t *ecx,
+    uint32_t *edx)
+{
+    asm volatile ( "cpuid"
+                   : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
+                   : "a" (leaf), "c" (subleaf) );
+}
+
+/* Generic CPUID function (subleaf 0) */
+static inline void cpuid(
+    uint32_t leaf,
+    uint32_t *eax,
+    uint32_t *ebx,
+    uint32_t *ecx,
+    uint32_t *edx)
+{
+    cpuid_count(leaf, 0, eax, ebx, ecx, edx);
+}
 
 /* Read the TSC register. */
 static inline uint64_t rdtsc(void)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 13 14:44:56 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Aug 2024 14:44:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776392.1186518 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdslc-0004Fz-AI; Tue, 13 Aug 2024 14:44:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776392.1186518; Tue, 13 Aug 2024 14:44:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdslc-0004Fs-7a; Tue, 13 Aug 2024 14:44:56 +0000
Received: by outflank-mailman (input) for mailman id 776392;
 Tue, 13 Aug 2024 14:44:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdsla-0004FZ-Jt
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:44:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdsla-0007yK-J6
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:44:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdsla-0007He-HN
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MHDPEkAsWq9aWWrOEqw2YbXaMaNOPh8S9nONPEW03zs=; b=l1i1n7uO80WkOO8OwZLJqzRxVf
	+nDjyD8G2Fn7LRFzjyKkqWeJG3qwi09bBnnLN3BYEP8b5ItfQ72hpeN9q9LQjYHB9e5Alvz+igQU4
	at/WvH8pnbImvyyZBnWXt1ofnyIjIqyVc5wb6cQVnync5W5ObjaoV75XJRWAVehLCZFM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: enable CONFIG_HAS_DEVICE_TREE
Message-Id: <E1sdsla-0007He-HN@xenbits.xenproject.org>
Date: Tue, 13 Aug 2024 14:44:54 +0000

commit 8fb49f2697f74886742096e84193c4c7496def4a
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Aug 13 16:39:43 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:39:43 2024 +0200

    xen/riscv: enable CONFIG_HAS_DEVICE_TREE
    
    Enable build of generic functionality for working with device
    tree for RISC-V.
    Also, a collection of functions for parsing memory map and other
    boot information from a device tree are available now.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
index f531e96657..259eea8d3b 100644
--- a/xen/arch/riscv/Kconfig
+++ b/xen/arch/riscv/Kconfig
@@ -2,6 +2,7 @@ config RISCV
 	def_bool y
 	select FUNCTION_ALIGNMENT_16B
 	select GENERIC_BUG_FRAME
+	select HAS_DEVICE_TREE
 
 config RISCV_64
 	def_bool y
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 13 14:45:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Aug 2024 14:45:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776393.1186522 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdslm-0004J7-Bk; Tue, 13 Aug 2024 14:45:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776393.1186522; Tue, 13 Aug 2024 14:45: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 1sdslm-0004Iz-95; Tue, 13 Aug 2024 14:45:06 +0000
Received: by outflank-mailman (input) for mailman id 776393;
 Tue, 13 Aug 2024 14:45:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdslk-0004Ii-NH
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:45:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdslk-00080P-MS
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:45:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdslk-0007IZ-LW
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:45: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Yz0LNm2iRKS3GZtJoardHotFkCwnrtx+6em18qLlO5Q=; b=kGXEJTGKS/rvH/Za8IKlSmAaUv
	TVzVefhW1I8tO4gCImDp3cO297qacOcllL8SoiIozJn6Iv47a5zpafE+Cm3jT52YwcQFI2g3PZ/vc
	Hal1EqyubaIYLn6ra+o6hGGqSW4EzzKVHiOYHzYAHV2saQM0OlVlQacrbiLYWu4CF0OQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul: fix UB multiplications in S/G handling
Message-Id: <E1sdslk-0007IZ-LW@xenbits.xenproject.org>
Date: Tue, 13 Aug 2024 14:45:04 +0000

commit 69e99b5d4b087cfe508b4776703c5a9380cfb6d8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Aug 13 16:41:25 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:41:25 2024 +0200

    x86emul: fix UB multiplications in S/G handling
    
    The conversion of the shifts to multiplications by the commits tagged
    below still wasn't quite right: The multiplications (of signed values)
    can overflow, too. As of 298556c7b5f8 ("x86emul: correct 32-bit address
    handling for AVX2 gathers") signed multiplication wasn't necessary
    anymore, though: The necessary sign-extension (if any) will happen as
    well when using intermediate variables of unsigned long types, and
    excess address bits are chopped off by truncate_ea().
    
    Fixes: b6a907f8c83d ("x86emul: replace UB shifts")
    Fixes: 21de9680eb59 ("x86emul: replace further UB shifts")
    Oss-fuzz: 71138
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index a0deafbd3b..9025382670 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6369,11 +6369,11 @@ x86_emulate(
         {
             if ( (vex.w ? mask.qw[i] : mask.dw[i]) < 0 )
             {
-                signed long idx = b & 1 ? index.qw[i] : index.dw[i];
+                unsigned long idx = b & 1 ? index.qw[i] : index.dw[i];
 
                 rc = ops->read(ea.mem.seg,
                                truncate_ea(ea.mem.off +
-                                           idx * (1 << state->sib_scale)),
+                                           (idx << state->sib_scale)),
                                (void *)mmvalp + i * op_bytes, op_bytes, ctxt);
                 if ( rc != X86EMUL_OKAY )
                 {
@@ -6489,14 +6489,14 @@ x86_emulate(
 
         for ( i = 0; op_mask; ++i )
         {
-            long idx = b & 1 ? index.qw[i] : index.dw[i];
+            unsigned long idx = b & 1 ? index.qw[i] : index.dw[i];
 
             if ( !(op_mask & (1 << i)) )
                 continue;
 
             rc = ops->read(ea.mem.seg,
                            truncate_ea(ea.mem.off +
-                                       idx * (1 << state->sib_scale)),
+                                       (idx << state->sib_scale)),
                            (void *)mmvalp + i * op_bytes, op_bytes, ctxt);
             if ( rc != X86EMUL_OKAY )
             {
@@ -6643,9 +6643,9 @@ x86_emulate(
 
         for ( i = 0; op_mask; ++i )
         {
-            long idx = (b & 1 ? index.qw[i]
-                              : index.dw[i]) * (1 << state->sib_scale);
-            unsigned long offs = truncate_ea(ea.mem.off + idx);
+            unsigned long idx = b & 1 ? index.qw[i] : index.dw[i];
+            unsigned long offs = truncate_ea(ea.mem.off +
+                                             (idx << state->sib_scale));
             unsigned int j, slot;
 
             if ( !(op_mask & (1 << i)) )
@@ -6663,11 +6663,10 @@ x86_emulate(
              */
             for ( j = (slot = i) + 1; j < n; ++j )
             {
-                long idx2 = (b & 1 ? index.qw[j]
-                                   : index.dw[j]) * (1 << state->sib_scale);
-
+                idx = b & 1 ? index.qw[j] : index.dw[j];
                 if ( (op_mask & (1 << j)) &&
-                     truncate_ea(ea.mem.off + idx2) == offs )
+                     truncate_ea(ea.mem.off +
+                                 (idx << state->sib_scale)) == offs )
                     slot = j;
             }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 13 14:55:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Aug 2024 14:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776395.1186526 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdsvR-000608-2E; Tue, 13 Aug 2024 14:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776395.1186526; Tue, 13 Aug 2024 14:55: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 1sdsvQ-000600-Vs; Tue, 13 Aug 2024 14:55:04 +0000
Received: by outflank-mailman (input) for mailman id 776395;
 Tue, 13 Aug 2024 14:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdsvP-0005zu-VH
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:55:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdsvP-00089u-Tr
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:55:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdsvP-00080g-Su
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HSiToq7SlCXgnMdXEbp7sNCU+jqAHMUN7L1uP9gQea8=; b=emcNhc+h1fvhzvLbzsLbKUNtnu
	caGr7qoW2iecarVAOu2mRbzV7wCqcyhmCQtToOkl5eoFFj6Ylb8glYkYjx/D4G05xHJeuHjXJ+ifv
	bUu6gpWYxjZ24LPVSxKp8UeKhhRTRx5EbNj9vvYKI6zLXXivUZeDwe1IwsgPRG7nKBMs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/IOMMU: move tracking in iommu_identity_mapping()
Message-Id: <E1sdsvP-00080g-Su@xenbits.xenproject.org>
Date: Tue, 13 Aug 2024 14:55:03 +0000

commit c61d4264d26d1ffb26563bfb6dc2f0b06cd72128
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Tue Aug 13 16:47:19 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:47:19 2024 +0200

    x86/IOMMU: move tracking in iommu_identity_mapping()
    
    If for some reason xmalloc() fails after having mapped the reserved
    regions, an error is reported, but the regions remain mapped in the P2M.
    
    Similarly if an error occurs during set_identity_p2m_entry() (except on
    the first call), the partial mappings of the region would be retained
    without being tracked anywhere, and hence without there being a way to
    remove them again from the domain's P2M.
    
    Move the setting up of the list entry ahead of trying to map the region.
    In cases other than the first mapping failing, keep record of the full
    region, such that a subsequent unmapping request can be properly torn
    down.
    
    To compensate for the potentially excess unmapping requests, don't log a
    warning from p2m_remove_identity_entry() when there really was nothing
    mapped at a given GFN.
    
    This is XSA-460 / CVE-2024-31145.
    
    Fixes: 2201b67b9128 ("VT-d: improve RMRR region handling")
    Fixes: c0e19d7c6c42 ("IOMMU: generalize VT-d's tracking of mapped RMRR regions")
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: beadd68b5490ada053d72f8a9ce6fd696d626596
    master date: 2024-08-13 16:36:40 +0200
---
 xen/arch/x86/mm/p2m.c               |  8 +++++---
 xen/drivers/passthrough/x86/iommu.c | 30 +++++++++++++++++++++---------
 2 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index e7e327d6a6..1739133fc2 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1267,9 +1267,11 @@ int p2m_remove_identity_entry(struct domain *d, unsigned long gfn_l)
     else
     {
         gfn_unlock(p2m, gfn, 0);
-        printk(XENLOG_G_WARNING
-               "non-identity map d%d:%lx not cleared (mapped to %lx)\n",
-               d->domain_id, gfn_l, mfn_x(mfn));
+        if ( (p2mt != p2m_invalid && p2mt != p2m_mmio_dm) ||
+             a != p2m_access_n || !mfn_eq(mfn, INVALID_MFN) )
+           printk(XENLOG_G_WARNING
+                  "non-identity map %pd:%lx not cleared (mapped to %lx)\n",
+                  d, gfn_l, mfn_x(mfn));
         ret = 0;
     }
 
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index cc0062b027..8b1e0596b8 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -267,24 +267,36 @@ int iommu_identity_mapping(struct domain *d, p2m_access_t p2ma,
     if ( p2ma == p2m_access_x )
         return -ENOENT;
 
-    while ( base_pfn < end_pfn )
-    {
-        int err = set_identity_p2m_entry(d, base_pfn, p2ma, flag);
-
-        if ( err )
-            return err;
-        base_pfn++;
-    }
-
     map = xmalloc(struct identity_map);
     if ( !map )
         return -ENOMEM;
+
     map->base = base;
     map->end = end;
     map->access = p2ma;
     map->count = 1;
+
+    /*
+     * Insert into list ahead of mapping, so the range can be found when
+     * trying to clean up.
+     */
     list_add_tail(&map->list, &hd->arch.identity_maps);
 
+    for ( ; base_pfn < end_pfn; ++base_pfn )
+    {
+        int err = set_identity_p2m_entry(d, base_pfn, p2ma, flag);
+
+        if ( !err )
+            continue;
+
+        if ( (map->base >> PAGE_SHIFT_4K) == base_pfn )
+        {
+            list_del(&map->list);
+            xfree(map);
+        }
+        return err;
+    }
+
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Aug 13 14:55:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Aug 2024 14:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776396.1186530 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdsvc-00062G-49; Tue, 13 Aug 2024 14:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776396.1186530; Tue, 13 Aug 2024 14:55: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 1sdsvc-000627-16; Tue, 13 Aug 2024 14:55:16 +0000
Received: by outflank-mailman (input) for mailman id 776396;
 Tue, 13 Aug 2024 14:55:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdsva-00061s-2H
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:55:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdsva-0008AL-1O
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdsvZ-00081A-Vu
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 14:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jZsuojcKheF2b1c2H8xnHHPv00uljMLwzBXIP9HhSKU=; b=rTYutAV3oOolOBZS1eEVuCA80A
	fqef2WLZl9JL+byyXAXmTs4xSokw+BdctbW9vzav6epQ5LJ9wMJtN86Gedca0V9z12xIHCZPCDwnq
	Lo/j9Ictb1RPshtG7ItlXmIVEixHGYBkyPBgUt1HjSjgCAUnx1/YwwO05gTuhpOPIwGQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/pass-through: documents as security-unsupported when sharing resources
Message-Id: <E1sdsvZ-00081A-Vu@xenbits.xenproject.org>
Date: Tue, 13 Aug 2024 14:55:13 +0000

commit 3e8a2217f211d49dd771f7918d72df057121109f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Aug 13 16:48:13 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:48:13 2024 +0200

    x86/pass-through: documents as security-unsupported when sharing resources
    
    When multiple devices share resources and one of them is to be passed
    through to a guest, security of the entire system and of respective
    guests individually cannot really be guaranteed without knowing
    internals of any of the involved guests.  Therefore such a configuration
    cannot really be security-supported, yet making that explicit was so far
    missing.
    
    This is XSA-461 / CVE-2024-31146.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    master commit: 9c94eda1e3790820699a6de3f6a7c959ecf30600
    master date: 2024-08-13 16:37:25 +0200
---
 SUPPORT.md | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index 8b998d9bc7..1d8b38cbd0 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -841,6 +841,11 @@ This feature is not security supported: see https://xenbits.xen.org/xsa/advisory
 
 Only systems using IOMMUs are supported.
 
+Passing through of devices sharing resources with another device is not
+security supported.  Such sharing could e.g. be the same line interrupt being
+used by multiple devices, one of which is to be passed through, or two such
+devices having memory BARs within the same 4k page.
+
 Not compatible with migration, populate-on-demand, altp2m,
 introspection, memory sharing, or memory paging.
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Aug 13 15:00:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Aug 2024 15:00:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776397.1186534 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdt0H-0007Tw-Fd; Tue, 13 Aug 2024 15:00:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776397.1186534; Tue, 13 Aug 2024 15:00: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 1sdt0H-0007Tp-Cu; Tue, 13 Aug 2024 15:00:05 +0000
Received: by outflank-mailman (input) for mailman id 776397;
 Tue, 13 Aug 2024 15:00:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdt0F-0007DP-T7
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 15:00:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdt0F-0008H2-Ri
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 15:00:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdt0F-00009r-Pz
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 15:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iRDXzT1XS0D45v43Z6Z9SugjPGIXHbf95cSfvOlp71w=; b=Wvl0CMiAPP8N6mKEuRj6ODRUye
	6lmkVeI7OHI1p2g46Cv+ezDDeMn7hEkBi2PdpaCQtPbp70KUBOtIr3yjVQdY5vw5f5zQrbybtu85c
	HcX5HoLThBY8bzFCyKoVRX7hpBLKXiptPEtW3HrliTfmw7nk5z/UW8xa9tL4iUcQKEi8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/IOMMU: move tracking in iommu_identity_mapping()
Message-Id: <E1sdt0F-00009r-Pz@xenbits.xenproject.org>
Date: Tue, 13 Aug 2024 15:00:03 +0000

commit 255d6518ce993cf1d11b5d34dcc3ec696f36f8e1
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Tue Aug 13 16:49:06 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:49:06 2024 +0200

    x86/IOMMU: move tracking in iommu_identity_mapping()
    
    If for some reason xmalloc() fails after having mapped the reserved
    regions, an error is reported, but the regions remain mapped in the P2M.
    
    Similarly if an error occurs during set_identity_p2m_entry() (except on
    the first call), the partial mappings of the region would be retained
    without being tracked anywhere, and hence without there being a way to
    remove them again from the domain's P2M.
    
    Move the setting up of the list entry ahead of trying to map the region.
    In cases other than the first mapping failing, keep record of the full
    region, such that a subsequent unmapping request can be properly torn
    down.
    
    To compensate for the potentially excess unmapping requests, don't log a
    warning from p2m_remove_identity_entry() when there really was nothing
    mapped at a given GFN.
    
    This is XSA-460 / CVE-2024-31145.
    
    Fixes: 2201b67b9128 ("VT-d: improve RMRR region handling")
    Fixes: c0e19d7c6c42 ("IOMMU: generalize VT-d's tracking of mapped RMRR regions")
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: beadd68b5490ada053d72f8a9ce6fd696d626596
    master date: 2024-08-13 16:36:40 +0200
---
 xen/arch/x86/mm/p2m.c               |  8 +++++---
 xen/drivers/passthrough/x86/iommu.c | 30 +++++++++++++++++++++---------
 2 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 22ab1d606e..4d5a41898a 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1255,9 +1255,11 @@ int p2m_remove_identity_entry(struct domain *d, unsigned long gfn_l)
     else
     {
         gfn_unlock(p2m, gfn, 0);
-        printk(XENLOG_G_WARNING
-               "non-identity map d%d:%lx not cleared (mapped to %lx)\n",
-               d->domain_id, gfn_l, mfn_x(mfn));
+        if ( (p2mt != p2m_invalid && p2mt != p2m_mmio_dm) ||
+             a != p2m_access_n || !mfn_eq(mfn, INVALID_MFN) )
+           printk(XENLOG_G_WARNING
+                  "non-identity map %pd:%lx not cleared (mapped to %lx)\n",
+                  d, gfn_l, mfn_x(mfn));
         ret = 0;
     }
 
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index 857dccb6a4..c3f6d013e5 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -267,24 +267,36 @@ int iommu_identity_mapping(struct domain *d, p2m_access_t p2ma,
     if ( p2ma == p2m_access_x )
         return -ENOENT;
 
-    while ( base_pfn < end_pfn )
-    {
-        int err = set_identity_p2m_entry(d, base_pfn, p2ma, flag);
-
-        if ( err )
-            return err;
-        base_pfn++;
-    }
-
     map = xmalloc(struct identity_map);
     if ( !map )
         return -ENOMEM;
+
     map->base = base;
     map->end = end;
     map->access = p2ma;
     map->count = 1;
+
+    /*
+     * Insert into list ahead of mapping, so the range can be found when
+     * trying to clean up.
+     */
     list_add_tail(&map->list, &hd->arch.identity_maps);
 
+    for ( ; base_pfn < end_pfn; ++base_pfn )
+    {
+        int err = set_identity_p2m_entry(d, base_pfn, p2ma, flag);
+
+        if ( !err )
+            continue;
+
+        if ( (map->base >> PAGE_SHIFT_4K) == base_pfn )
+        {
+            list_del(&map->list);
+            xfree(map);
+        }
+        return err;
+    }
+
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Aug 13 15:00:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Aug 2024 15:00:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776398.1186540 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdt0R-0007g1-I7; Tue, 13 Aug 2024 15:00:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776398.1186540; Tue, 13 Aug 2024 15:00: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 1sdt0R-0007fr-EL; Tue, 13 Aug 2024 15:00:15 +0000
Received: by outflank-mailman (input) for mailman id 776398;
 Tue, 13 Aug 2024 15:00:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdt0Q-0007fd-02
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 15:00:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdt0P-0008HQ-Uj
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 15:00:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdt0P-0000By-Ti
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 15:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=93O921sHLv1xwo7wSlIssyscPaQ4o3W3OoQ7AAxenAU=; b=IkgiTGlxptaROUFyFt90w2tGi2
	AQ1v8wdcxsgwzg/o4G8Wa9pW9s2MqtAmOd6vt8PD5HsVptB5g7xFF90q9AN4f3tGbKP29Wv6d5yi0
	xxY2aTibvuOENoaDg9Fyv/qgN/LZrCdLFrN6EiAd/PkY0XmiO15dPr4Bzwg5klo4FFEU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/pass-through: documents as security-unsupported when sharing resources
Message-Id: <E1sdt0P-0000By-Ti@xenbits.xenproject.org>
Date: Tue, 13 Aug 2024 15:00:13 +0000

commit c70619e2b758f2c9c2c7a8683ab7897d01461cd0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Aug 13 16:49:45 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:49:45 2024 +0200

    x86/pass-through: documents as security-unsupported when sharing resources
    
    When multiple devices share resources and one of them is to be passed
    through to a guest, security of the entire system and of respective
    guests individually cannot really be guaranteed without knowing
    internals of any of the involved guests.  Therefore such a configuration
    cannot really be security-supported, yet making that explicit was so far
    missing.
    
    This is XSA-461 / CVE-2024-31146.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    master commit: 9c94eda1e3790820699a6de3f6a7c959ecf30600
    master date: 2024-08-13 16:37:25 +0200
---
 SUPPORT.md | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index 30ca5b15ed..b4715a65b5 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -804,6 +804,11 @@ This feature is not security supported: see https://xenbits.xen.org/xsa/advisory
 
 Only systems using IOMMUs are supported.
 
+Passing through of devices sharing resources with another device is not
+security supported.  Such sharing could e.g. be the same line interrupt being
+used by multiple devices, one of which is to be passed through, or two such
+devices having memory BARs within the same 4k page.
+
 Not compatible with migration, populate-on-demand, altp2m,
 introspection, memory sharing, or memory paging.
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Aug 13 15:00:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Aug 2024 15:00:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776399.1186541 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdt0b-0007iT-If; Tue, 13 Aug 2024 15:00:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776399.1186541; Tue, 13 Aug 2024 15:00: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 1sdt0b-0007iL-Fq; Tue, 13 Aug 2024 15:00:25 +0000
Received: by outflank-mailman (input) for mailman id 776399;
 Tue, 13 Aug 2024 15:00:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdt0a-0007i3-Bu
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 15:00:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdt0a-0008HY-B2
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 15:00:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdt0a-0000Dh-AC
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 15:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hCNYNojsvyItWCLyHc+TeM3FqfbkmZdm/S21khrsOL4=; b=ynn+bQ/ww/5glRX40/wifPPbHR
	JGsGQnNrivj5tEJjey1GQ57ToxA+jhAIjVIutpJsC7ni7yA4U4cTTT0TSMQByViYDWCRZCmjziZr6
	AK2GeyhZMhJ7U71PXZLR4EW9YrimCJDJ03yF4m+vnSt3qLlMq68AsXb8hGfjWn/0p9kA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] x86/IOMMU: move tracking in iommu_identity_mapping()
Message-Id: <E1sdt0a-0000Dh-AC@xenbits.xenproject.org>
Date: Tue, 13 Aug 2024 15:00:24 +0000

commit c638866e99d28279a92879db6f2ae85f76a35ee6
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Tue Aug 13 16:50:32 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:50:32 2024 +0200

    x86/IOMMU: move tracking in iommu_identity_mapping()
    
    If for some reason xmalloc() fails after having mapped the reserved
    regions, an error is reported, but the regions remain mapped in the P2M.
    
    Similarly if an error occurs during set_identity_p2m_entry() (except on
    the first call), the partial mappings of the region would be retained
    without being tracked anywhere, and hence without there being a way to
    remove them again from the domain's P2M.
    
    Move the setting up of the list entry ahead of trying to map the region.
    In cases other than the first mapping failing, keep record of the full
    region, such that a subsequent unmapping request can be properly torn
    down.
    
    To compensate for the potentially excess unmapping requests, don't log a
    warning from p2m_remove_identity_entry() when there really was nothing
    mapped at a given GFN.
    
    This is XSA-460 / CVE-2024-31145.
    
    Fixes: 2201b67b9128 ("VT-d: improve RMRR region handling")
    Fixes: c0e19d7c6c42 ("IOMMU: generalize VT-d's tracking of mapped RMRR regions")
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: beadd68b5490ada053d72f8a9ce6fd696d626596
    master date: 2024-08-13 16:36:40 +0200
---
 xen/arch/x86/mm/p2m.c               |  8 +++++---
 xen/drivers/passthrough/x86/iommu.c | 30 +++++++++++++++++++++---------
 2 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 1fa9e01012..5014caa173 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1265,9 +1265,11 @@ int p2m_remove_identity_entry(struct domain *d, unsigned long gfn_l)
     else
     {
         gfn_unlock(p2m, gfn, 0);
-        printk(XENLOG_G_WARNING
-               "non-identity map d%d:%lx not cleared (mapped to %lx)\n",
-               d->domain_id, gfn_l, mfn_x(mfn));
+        if ( (p2mt != p2m_invalid && p2mt != p2m_mmio_dm) ||
+             a != p2m_access_n || !mfn_eq(mfn, INVALID_MFN) )
+           printk(XENLOG_G_WARNING
+                  "non-identity map %pd:%lx not cleared (mapped to %lx)\n",
+                  d, gfn_l, mfn_x(mfn));
         ret = 0;
     }
 
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index 22d67b4fd2..9cf0017a84 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -251,24 +251,36 @@ int iommu_identity_mapping(struct domain *d, p2m_access_t p2ma,
     if ( p2ma == p2m_access_x )
         return -ENOENT;
 
-    while ( base_pfn < end_pfn )
-    {
-        int err = set_identity_p2m_entry(d, base_pfn, p2ma, flag);
-
-        if ( err )
-            return err;
-        base_pfn++;
-    }
-
     map = xmalloc(struct identity_map);
     if ( !map )
         return -ENOMEM;
+
     map->base = base;
     map->end = end;
     map->access = p2ma;
     map->count = 1;
+
+    /*
+     * Insert into list ahead of mapping, so the range can be found when
+     * trying to clean up.
+     */
     list_add_tail(&map->list, &hd->arch.identity_maps);
 
+    for ( ; base_pfn < end_pfn; ++base_pfn )
+    {
+        int err = set_identity_p2m_entry(d, base_pfn, p2ma, flag);
+
+        if ( !err )
+            continue;
+
+        if ( (map->base >> PAGE_SHIFT_4K) == base_pfn )
+        {
+            list_del(&map->list);
+            xfree(map);
+        }
+        return err;
+    }
+
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Tue Aug 13 15:00:36 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Aug 2024 15:00:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776400.1186546 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdt0m-0007mE-LV; Tue, 13 Aug 2024 15:00:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776400.1186546; Tue, 13 Aug 2024 15:00:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdt0m-0007m6-Ip; Tue, 13 Aug 2024 15:00:36 +0000
Received: by outflank-mailman (input) for mailman id 776400;
 Tue, 13 Aug 2024 15:00:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdt0k-0007ll-G3
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 15:00:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdt0k-0008Hf-ER
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 15:00:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdt0k-0000Ei-DK
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 15:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZLZOZ9JNtmw25y/0fpSjBUmenLPg/HODPC6MVSCgSEM=; b=y9FOlQ4oLuZp7yUMh5ZO0BS30k
	zUMVcMQ5E5Xhv7YyJTvc4/RGhfmnZCw+4/QLVtFl4iSOokLDxxGJRZD7BQPhVaAAjSHDTIgb6FZD3
	JSJWt6vTQ5GuJVXN7nZO/wWf4muljIwc26bSRGvNir3IogaFzrWwG2j3R03OZsjLVO74=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] x86/pass-through: documents as security-unsupported when sharing resources
Message-Id: <E1sdt0k-0000Ei-DK@xenbits.xenproject.org>
Date: Tue, 13 Aug 2024 15:00:34 +0000

commit f95a6b010b9a2633d5186f7a53e4607bbe56f618
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Aug 13 16:51:14 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:51:14 2024 +0200

    x86/pass-through: documents as security-unsupported when sharing resources
    
    When multiple devices share resources and one of them is to be passed
    through to a guest, security of the entire system and of respective
    guests individually cannot really be guaranteed without knowing
    internals of any of the involved guests.  Therefore such a configuration
    cannot really be security-supported, yet making that explicit was so far
    missing.
    
    This is XSA-461 / CVE-2024-31146.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    master commit: 9c94eda1e3790820699a6de3f6a7c959ecf30600
    master date: 2024-08-13 16:37:25 +0200
---
 SUPPORT.md | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index c94c9cfe8f..f039d12352 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -775,6 +775,11 @@ This feature is not security supported: see https://xenbits.xen.org/xsa/advisory
 
 Only systems using IOMMUs are supported.
 
+Passing through of devices sharing resources with another device is not
+security supported.  Such sharing could e.g. be the same line interrupt being
+used by multiple devices, one of which is to be passed through, or two such
+devices having memory BARs within the same 4k page.
+
 Not compatible with migration, populate-on-demand, altp2m,
 introspection, memory sharing, or memory paging.
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Tue Aug 13 15:00:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Aug 2024 15:00:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776401.1186549 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdt0v-0007or-N0; Tue, 13 Aug 2024 15:00:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776401.1186549; Tue, 13 Aug 2024 15:00: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 1sdt0v-0007oj-KE; Tue, 13 Aug 2024 15:00:45 +0000
Received: by outflank-mailman (input) for mailman id 776401;
 Tue, 13 Aug 2024 15:00:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdt0u-0007ob-RZ
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 15:00:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdt0u-0008Hp-Qm
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 15:00:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdt0u-0000Gl-Pq
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 15:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7d3a7OE/Dhp4ogtxolgRapC24+AdBi7rML59JrVCUi4=; b=PRC2FZMgiRJ520DljOn+0h7LHt
	o4bF6w+AihnpZkNJq9YxIV8RvFH00gruuIJnL5rxfjYVDx32hHdnc4JsDth4YFRZQMsplDHZqbkcA
	HZWzrh0RiAh8E2CRCvDh5vvSPRadH9XfmBybT756ZALTGlwaIocEqIH5LH//fVkboaCU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] x86/IOMMU: move tracking in iommu_identity_mapping()
Message-Id: <E1sdt0u-0000Gl-Pq@xenbits.xenproject.org>
Date: Tue, 13 Aug 2024 15:00:44 +0000

commit 10d6cba5989d8acb94ae293f22eb434d85f735cb
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Tue Aug 13 16:52:06 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:52:06 2024 +0200

    x86/IOMMU: move tracking in iommu_identity_mapping()
    
    If for some reason xmalloc() fails after having mapped the reserved
    regions, an error is reported, but the regions remain mapped in the P2M.
    
    Similarly if an error occurs during set_identity_p2m_entry() (except on
    the first call), the partial mappings of the region would be retained
    without being tracked anywhere, and hence without there being a way to
    remove them again from the domain's P2M.
    
    Move the setting up of the list entry ahead of trying to map the region.
    In cases other than the first mapping failing, keep record of the full
    region, such that a subsequent unmapping request can be properly torn
    down.
    
    To compensate for the potentially excess unmapping requests, don't log a
    warning from p2m_remove_identity_entry() when there really was nothing
    mapped at a given GFN.
    
    This is XSA-460 / CVE-2024-31145.
    
    Fixes: 2201b67b9128 ("VT-d: improve RMRR region handling")
    Fixes: c0e19d7c6c42 ("IOMMU: generalize VT-d's tracking of mapped RMRR regions")
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: beadd68b5490ada053d72f8a9ce6fd696d626596
    master date: 2024-08-13 16:36:40 +0200
---
 xen/arch/x86/mm/p2m.c               |  8 +++++---
 xen/drivers/passthrough/x86/iommu.c | 30 +++++++++++++++++++++---------
 2 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index ddd2f861c3..c4c653d7fe 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1618,9 +1618,11 @@ int clear_identity_p2m_entry(struct domain *d, unsigned long gfn_l)
     else
     {
         gfn_unlock(p2m, gfn, 0);
-        printk(XENLOG_G_WARNING
-               "non-identity map d%d:%lx not cleared (mapped to %lx)\n",
-               d->domain_id, gfn_l, mfn_x(mfn));
+        if ( (p2mt != p2m_invalid && p2mt != p2m_mmio_dm) ||
+             a != p2m_access_n || !mfn_eq(mfn, INVALID_MFN) )
+           printk(XENLOG_G_WARNING
+                  "non-identity map %pd:%lx not cleared (mapped to %lx)\n",
+                  d, gfn_l, mfn_x(mfn));
         ret = 0;
     }
 
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index dc9936e169..b9a50f6ea9 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -238,24 +238,36 @@ int iommu_identity_mapping(struct domain *d, p2m_access_t p2ma,
     if ( p2ma == p2m_access_x )
         return -ENOENT;
 
-    while ( base_pfn < end_pfn )
-    {
-        int err = set_identity_p2m_entry(d, base_pfn, p2ma, flag);
-
-        if ( err )
-            return err;
-        base_pfn++;
-    }
-
     map = xmalloc(struct identity_map);
     if ( !map )
         return -ENOMEM;
+
     map->base = base;
     map->end = end;
     map->access = p2ma;
     map->count = 1;
+
+    /*
+     * Insert into list ahead of mapping, so the range can be found when
+     * trying to clean up.
+     */
     list_add_tail(&map->list, &hd->arch.identity_maps);
 
+    for ( ; base_pfn < end_pfn; ++base_pfn )
+    {
+        int err = set_identity_p2m_entry(d, base_pfn, p2ma, flag);
+
+        if ( !err )
+            continue;
+
+        if ( (map->base >> PAGE_SHIFT_4K) == base_pfn )
+        {
+            list_del(&map->list);
+            xfree(map);
+        }
+        return err;
+    }
+
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Aug 13 15:00:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Aug 2024 15:00:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776402.1186554 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdt15-0007rh-OL; Tue, 13 Aug 2024 15:00:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776402.1186554; Tue, 13 Aug 2024 15:00: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 1sdt15-0007rZ-Lr; Tue, 13 Aug 2024 15:00:55 +0000
Received: by outflank-mailman (input) for mailman id 776402;
 Tue, 13 Aug 2024 15:00:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdt14-0007rL-UU
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 15:00:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdt14-0008I0-Th
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 15:00:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdt14-0000I2-Ss
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 15:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=u9RaGRPnIeo5Zhg1u5xweVmyC2mt1ffoHfMDMzv8O9o=; b=NFZFY6m6IL/uOu4FF52ZVVj+64
	fIriTcqTNisRRYKs3kYso5S/aKZAxtwvjR9zCIaJ8t6AvaWUzIh4QVvYgx53FXJqGP+SfKHyrCiUU
	0m5vT/y1ZAw092IElyHjRgaBNrTJJqIUckIzBr7miXZuctaCnoCEW1z8N+vwvOLA+kYc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.16] x86/pass-through: documents as security-unsupported when sharing resources
Message-Id: <E1sdt14-0000I2-Ss@xenbits.xenproject.org>
Date: Tue, 13 Aug 2024 15:00:54 +0000

commit 638f21616a7a9e94ebae134573ca42d977a65063
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Aug 13 16:52:44 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:52:44 2024 +0200

    x86/pass-through: documents as security-unsupported when sharing resources
    
    When multiple devices share resources and one of them is to be passed
    through to a guest, security of the entire system and of respective
    guests individually cannot really be guaranteed without knowing
    internals of any of the involved guests.  Therefore such a configuration
    cannot really be security-supported, yet making that explicit was so far
    missing.
    
    This is XSA-461 / CVE-2024-31146.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    master commit: 9c94eda1e3790820699a6de3f6a7c959ecf30600
    master date: 2024-08-13 16:37:25 +0200
---
 SUPPORT.md | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index 15fbad84a7..fbbb267bf1 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -704,6 +704,11 @@ This feature is not security supported: see https://xenbits.xen.org/xsa/advisory
 
 Only systems using IOMMUs are supported.
 
+Passing through of devices sharing resources with another device is not
+security supported.  Such sharing could e.g. be the same line interrupt being
+used by multiple devices, one of which is to be passed through, or two such
+devices having memory BARs within the same 4k page.
+
 Not compatible with migration, populate-on-demand, altp2m,
 introspection, memory sharing, or memory paging.
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.16


From xen-changelog-bounces@lists.xenproject.org Tue Aug 13 20:22:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Aug 2024 20:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776606.1186758 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdy1q-0001bH-Ub; Tue, 13 Aug 2024 20:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776606.1186758; Tue, 13 Aug 2024 20: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 1sdy1q-0001bA-S3; Tue, 13 Aug 2024 20:22:02 +0000
Received: by outflank-mailman (input) for mailman id 776606;
 Tue, 13 Aug 2024 20:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdy1q-0001b4-0t
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 20:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdy1p-0006PP-TG
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 20:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdy1p-0004bJ-Qt
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 20: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8TgHc8JdDp9Fyrak0lba9c4m711RH3XAEXO7pQL3AvQ=; b=NamQwTceclTwR1hZ954Lq1lWqm
	riHISZ0PkRTDdZZo7ndUkbXmZNC4RCPWb4jOCSthjKQd3ZO2Yfq8P0zU9rx+8hn7OSZS2VMInc0rO
	cB0y73rJIhNvnKpV10IRt95JHDSa0iK3ipylZTY3nCkLETi0Ezo5BjV8s15jRnE5sChc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: disable Yocto jobs
Message-Id: <E1sdy1p-0004bJ-Qt@xenbits.xenproject.org>
Date: Tue, 13 Aug 2024 20:22:01 +0000

commit 1c24bca387136d73f88f46ce3db82d34411702e8
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Aug 9 23:59:18 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Aug 12 15:20:16 2024 -0700

    automation: disable Yocto jobs
    
    The Yocto jobs take a long time to run. We are changing Gitlab ARM64
    runners and the new runners might not be able to finish the Yocto jobs
    in a reasonable time.
    
    For now, disable the Yocto jobs by turning them into "manual" trigger
    (they need to be manually executed.)
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 automation/gitlab-ci/build.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 32045cef0c..c668736bdc 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -470,17 +470,20 @@ yocto-qemuarm64:
   extends: .yocto-test-arm64
   variables:
     YOCTO_BOARD: qemuarm64
+  when: manual
 
 yocto-qemuarm:
   extends: .yocto-test-arm64
   variables:
     YOCTO_BOARD: qemuarm
     YOCTO_OUTPUT: --copy-output
+  when: manual
 
 yocto-qemux86-64:
   extends: .yocto-test-x86-64
   variables:
     YOCTO_BOARD: qemux86-64
+  when: manual
 
 # Cppcheck analysis jobs
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Aug 13 20:22:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Aug 2024 20:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776607.1186761 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdy21-0001dB-0D; Tue, 13 Aug 2024 20:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776607.1186761; Tue, 13 Aug 2024 20: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 1sdy20-0001d2-Ti; Tue, 13 Aug 2024 20:22:12 +0000
Received: by outflank-mailman (input) for mailman id 776607;
 Tue, 13 Aug 2024 20:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdy20-0001cq-1j
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 20:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdy20-0006PZ-0s
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 20:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdy1z-0004cU-VR
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 20: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5diF2fbXek8kGrxXibV8bsWUtZvFUpIPSlZNnPDZXB0=; b=Zo5sHhBni4ySj5d3udTN7YrFYO
	2i+NWLeewofJkEHgMJFnYm2LSJNIGfVTMY/Nd7HYwgNZN5erQnwZutjdhSmCXoCGeozSRGj6CP3D/
	9Y+xtqN4PYZPZmZvkrNdJPDrlLRJBLy022OWTyBRkpo/oIGvvIXRbuntZ02r82R9qBlA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: add "expect" to containers used to run QEMU tests
Message-Id: <E1sdy1z-0004cU-VR@xenbits.xenproject.org>
Date: Tue, 13 Aug 2024 20:22:11 +0000

commit 98a462f8b169f93ab7463023f0ed94575f8225b4
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Aug 9 23:59:19 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Mon Aug 12 15:20:30 2024 -0700

    automation: add "expect" to containers used to run QEMU tests
    
    It will be used for QEMU tests.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 automation/build/debian/12-ppc64le.dockerfile       | 1 +
 automation/build/debian/12-riscv64.dockerfile       | 1 +
 automation/build/debian/bookworm-arm64v8.dockerfile | 1 +
 automation/build/debian/bookworm.dockerfile         | 1 +
 4 files changed, 4 insertions(+)

diff --git a/automation/build/debian/12-ppc64le.dockerfile b/automation/build/debian/12-ppc64le.dockerfile
index 3b311e675e..1d5b486bb4 100644
--- a/automation/build/debian/12-ppc64le.dockerfile
+++ b/automation/build/debian/12-ppc64le.dockerfile
@@ -26,6 +26,7 @@ RUN <<EOF
 
         # Qemu for test phase
         qemu-system-ppc
+        expect
     )
 
     apt-get -y --no-install-recommends install "${DEPS[@]}"
diff --git a/automation/build/debian/12-riscv64.dockerfile b/automation/build/debian/12-riscv64.dockerfile
index 03fd4b0305..8d7233d675 100644
--- a/automation/build/debian/12-riscv64.dockerfile
+++ b/automation/build/debian/12-riscv64.dockerfile
@@ -26,6 +26,7 @@ RUN <<EOF
 
         # Qemu for test phase
         qemu-system-riscv64
+        expect
     )
 
     apt-get -y --no-install-recommends install "${DEPS[@]}"
diff --git a/automation/build/debian/bookworm-arm64v8.dockerfile b/automation/build/debian/bookworm-arm64v8.dockerfile
index 11acc07bff..da8ae75125 100644
--- a/automation/build/debian/bookworm-arm64v8.dockerfile
+++ b/automation/build/debian/bookworm-arm64v8.dockerfile
@@ -48,6 +48,7 @@ RUN apt-get update && \
         curl \
         cpio \
         busybox-static \
+        expect \
         && \
         apt-get autoremove -y && \
         apt-get clean && \
diff --git a/automation/build/debian/bookworm.dockerfile b/automation/build/debian/bookworm.dockerfile
index db866fde30..3dd70cb6b2 100644
--- a/automation/build/debian/bookworm.dockerfile
+++ b/automation/build/debian/bookworm.dockerfile
@@ -45,6 +45,7 @@ RUN apt-get update && \
         golang \
         # for test phase, qemu-smoke-* jobs
         qemu-system-x86 \
+        expect \
         # for test phase, qemu-alpine-* jobs
         cpio \
         busybox-static \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Aug 13 20:55:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Aug 2024 20:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776620.1186788 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdyXo-0006ow-OT; Tue, 13 Aug 2024 20:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776620.1186788; Tue, 13 Aug 2024 20: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 1sdyXo-0006op-Lk; Tue, 13 Aug 2024 20:55:04 +0000
Received: by outflank-mailman (input) for mailman id 776620;
 Tue, 13 Aug 2024 20:55:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdyXn-0006oG-LQ
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 20:55:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdyXn-0006yU-Kf
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 20:55:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdyXn-0007QD-Jk
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 20:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FgKJ/de1Zhnk6BN/mE+UG2/1s+Lgxo/cP2E0fntBcNo=; b=a3eQrprNr9zQ2b4hGGpiaX4ewH
	vRyVabOD7f7WTyNmmZtuQQk9aFhRq6xV5CLdZce3FC9DKKba/Loh29Di2g8N0+g5ZUBXEvBVdFjtN
	khXlnMd9iqbiNVx4YpZmoFfRk6qRc4w7qAQKe+CdlwMliKIhLG8Yb1ZCk5N8EiPBVR/A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Arm: correct FIXADDR_TOP
Message-Id: <E1sdyXn-0007QD-Jk@xenbits.xenproject.org>
Date: Tue, 13 Aug 2024 20:55:03 +0000

commit fe3412ab83cc53c2bf2c497be3794bc09751efa5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Aug 13 13:49:39 2024 +0200
Commit:     Julien Grall <julien@xen.org>
CommitDate: Tue Aug 13 21:50:55 2024 +0100

    Arm: correct FIXADDR_TOP
    
    While reviewing a RISC-V patch cloning the Arm code, I noticed an
    off-by-1 here: FIX_PMAP_{BEGIN,END} being an inclusive range and
    FIX_LAST being the same as FIX_PMAP_END, FIXADDR_TOP cannot derive from
    FIX_LAST alone, or else the BUG_ON() in virt_to_fix() would trigger if
    FIX_PMAP_END ended up being used.
    
    While touching this area also add a check for fixmap and boot FDT area
    to not only not overlap, but to have at least one (unmapped) page in
    between.
    
    Fixes: 4f17357b52f6 ("xen/arm: add Persistent Map (PMAP) infrastructure")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/include/asm/fixmap.h | 2 +-
 xen/arch/arm/mmu/setup.c          | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/include/asm/fixmap.h b/xen/arch/arm/include/asm/fixmap.h
index a823456ecb..0cb5d54d1c 100644
--- a/xen/arch/arm/include/asm/fixmap.h
+++ b/xen/arch/arm/include/asm/fixmap.h
@@ -18,7 +18,7 @@
 #define FIX_LAST FIX_PMAP_END
 
 #define FIXADDR_START FIXMAP_ADDR(0)
-#define FIXADDR_TOP FIXMAP_ADDR(FIX_LAST)
+#define FIXADDR_TOP FIXMAP_ADDR(FIX_LAST + 1)
 
 #ifndef __ASSEMBLY__
 
diff --git a/xen/arch/arm/mmu/setup.c b/xen/arch/arm/mmu/setup.c
index f4bb424c3c..57042ed57b 100644
--- a/xen/arch/arm/mmu/setup.c
+++ b/xen/arch/arm/mmu/setup.c
@@ -128,6 +128,12 @@ static void __init __maybe_unused build_assertions(void)
 
 #undef CHECK_SAME_SLOT
 #undef CHECK_DIFFERENT_SLOT
+
+    /*
+     * Fixmaps must not overlap with boot FDT mapping area. Make sure there's
+     * at least one guard page in between.
+     */
+    BUILD_BUG_ON(FIXADDR_TOP >= BOOT_FDT_VIRT_START);
 }
 
 lpae_t __init pte_of_xenaddr(vaddr_t va)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 13 20:55:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Aug 2024 20:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776621.1186794 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdyXy-0006uT-R9; Tue, 13 Aug 2024 20:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776621.1186794; Tue, 13 Aug 2024 20:55:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdyXy-0006uH-NA; Tue, 13 Aug 2024 20:55:14 +0000
Received: by outflank-mailman (input) for mailman id 776621;
 Tue, 13 Aug 2024 20:55:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdyXx-0006tp-OO
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 20:55:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdyXx-0006yc-NX
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 20:55:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdyXx-0007Qh-Mk
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 20:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=J+5T8IXLK6OidgNaqevdaEkC0CJncyNcAPJ+f3OQ8tw=; b=ghAxsCocSKfk6Q5Fk8QXd3/7lc
	MBhWblh776antUY5hc2bZtHC8bkxjzy56yt3PJVelAn7o0H+CdbXbkXBZTSX8Y8x9CiLtc3xDdkel
	vUggvC+H2bZ22BX8NmYBEEVz5AOQFFg/EJbZEXSQEgXXkvocRw78IBZwqRy/sZk3+KjI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: smmuv3: Mark more init-only functions with __init
Message-Id: <E1sdyXx-0007Qh-Mk@xenbits.xenproject.org>
Date: Tue, 13 Aug 2024 20:55:13 +0000

commit 8fc1b356afb396d9113b10b29f3becadbe66c706
Author:     Edgar E. Iglesias <edgar.iglesias@amd.com>
AuthorDate: Wed May 22 15:28:29 2024 +0200
Commit:     Julien Grall <julien@xen.org>
CommitDate: Tue Aug 13 21:53:41 2024 +0100

    xen/arm: smmuv3: Mark more init-only functions with __init
    
    Move more functions that are only called at init to
    the .init.text section.
    
    Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Rahul Singh <rahul.singh@arm.com>
    Tested-by: Rahul Singh <rahul.singh@arm.com>
---
 xen/drivers/passthrough/arm/smmu-v3.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthrough/arm/smmu-v3.c
index 6904962467..cee5724022 100644
--- a/xen/drivers/passthrough/arm/smmu-v3.c
+++ b/xen/drivers/passthrough/arm/smmu-v3.c
@@ -1545,7 +1545,7 @@ static int arm_smmu_dt_xlate(struct device *dev,
 }
 
 /* Probing and initialisation functions */
-static int arm_smmu_init_one_queue(struct arm_smmu_device *smmu,
+static int __init arm_smmu_init_one_queue(struct arm_smmu_device *smmu,
 				   struct arm_smmu_queue *q,
 				   void __iomem *page,
 				   unsigned long prod_off,
@@ -1588,7 +1588,7 @@ static int arm_smmu_init_one_queue(struct arm_smmu_device *smmu,
 	return 0;
 }
 
-static int arm_smmu_init_queues(struct arm_smmu_device *smmu)
+static int __init arm_smmu_init_queues(struct arm_smmu_device *smmu)
 {
 	int ret;
 
@@ -1724,7 +1724,7 @@ static int arm_smmu_init_strtab(struct arm_smmu_device *smmu)
 	return 0;
 }
 
-static int arm_smmu_init_structures(struct arm_smmu_device *smmu)
+static int __init arm_smmu_init_structures(struct arm_smmu_device *smmu)
 {
 	int ret;
 
@@ -1746,7 +1746,8 @@ static int arm_smmu_write_reg_sync(struct arm_smmu_device *smmu, u32 val,
 }
 
 /* GBPA is "special" */
-static int arm_smmu_update_gbpa(struct arm_smmu_device *smmu, u32 set, u32 clr)
+static int __init arm_smmu_update_gbpa(struct arm_smmu_device *smmu,
+                                       u32 set, u32 clr)
 {
 	int ret;
 	u32 reg, __iomem *gbpa = smmu->base + ARM_SMMU_GBPA;
@@ -1842,7 +1843,7 @@ static void arm_smmu_setup_msis(struct arm_smmu_device *smmu)
 static inline void arm_smmu_setup_msis(struct arm_smmu_device *smmu) { }
 #endif /* CONFIG_MSI */
 
-static void arm_smmu_free_irqs(struct arm_smmu_device *smmu)
+static void __init arm_smmu_free_irqs(struct arm_smmu_device *smmu)
 {
 	int irq;
 
@@ -1926,7 +1927,7 @@ err_free_evtq_irq:
 	return ret;
 }
 
-static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
+static int __init arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
 {
 	int ret, irq;
 	u32 irqen_flags = IRQ_CTRL_EVTQ_IRQEN | IRQ_CTRL_GERROR_IRQEN;
@@ -1988,7 +1989,7 @@ static int arm_smmu_device_disable(struct arm_smmu_device *smmu)
 	return ret;
 }
 
-static int arm_smmu_device_reset(struct arm_smmu_device *smmu)
+static int __init arm_smmu_device_reset(struct arm_smmu_device *smmu)
 {
 	int ret;
 	u32 reg, enables;
@@ -2405,7 +2406,7 @@ static void arm_smmu_free_structures(struct arm_smmu_device *smmu)
 		xfree(smmu->strtab_cfg.l1_desc);
 }
 
-static int arm_smmu_device_probe(struct platform_device *pdev)
+static int __init arm_smmu_device_probe(struct platform_device *pdev)
 {
 	int irq, ret;
 	paddr_t ioaddr, iosize;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 13 21:00:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 13 Aug 2024 21:00:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776638.1186808 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sdyce-0000L2-EP; Tue, 13 Aug 2024 21:00:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776638.1186808; Tue, 13 Aug 2024 21: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 1sdyce-0000Kf-BE; Tue, 13 Aug 2024 21:00:04 +0000
Received: by outflank-mailman (input) for mailman id 776638;
 Tue, 13 Aug 2024 21:00:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdycd-0000CR-M0
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 21:00:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdycd-00075z-LC
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 21:00:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sdycd-0007ro-Jd
 for xen-changelog@lists.xenproject.org; Tue, 13 Aug 2024 21:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Mfms+nTgeRfcgyD7taBLqi+nNAxlV6VO5mKMuUAzB5w=; b=jVhGivVsC3VbJqyfFU9xyp+Xbd
	ze17cMoZhOiARlDclRkheBNG5kOUzhvgDYbOUWp+8x1tfGjef6H1dg9D/AIHt9GdytuB+r/1U7dGf
	VUt/EAaxyjllUntqNyopLlg67Uypy+AMYdhFy5H9Q31IP7iH+OYBWuwgio4LC/1Gf36U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm64: entry: Actually skip do_trap_*() when an SError is triggered
Message-Id: <E1sdycd-0007ro-Jd@xenbits.xenproject.org>
Date: Tue, 13 Aug 2024 21:00:03 +0000

commit 35c64c3dce01c2d0689a8c13240bf48a10cef783
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Aug 6 13:48:15 2024 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Tue Aug 13 21:58:24 2024 +0100

    xen/arm64: entry: Actually skip do_trap_*() when an SError is triggered
    
    For SErrors, we support two configurations:
      * Every SErrors will result to a panic in Xen
      * We will forward SErrors triggered by a VM back to itself
    
    For the latter case, we want to skip the call to do_trap_*() because the PC
    was already adjusted.
    
    However, the alternative used to decide between the two configurations
    is inverted. This would result to the VM corrupting itself if:
      * x19 is non-zero in the panic case
      * advance PC too much in the second case
    
    Solve the issue by switch from alternative_if to alternative_if_not.
    
    Fixes: a458d3bd0d25 ("xen/arm: entry: Ensure the guest state is synced when receiving a vSError")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/arm64/entry.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/arm64/entry.S b/xen/arch/arm/arm64/entry.S
index 6251135ebd..fab10f8a0d 100644
--- a/xen/arch/arm/arm64/entry.S
+++ b/xen/arch/arm/arm64/entry.S
@@ -259,7 +259,7 @@
          * apart. The easiest way is to duplicate the few instructions
          * that need to be skipped.
          */
-        alternative_if SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT
+        alternative_if_not SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT
         cbnz      x19, 1f
         mov       x0, sp
         bl        do_trap_\trap
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 14 00:44:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Aug 2024 00:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776701.1186861 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1se27Q-0003bH-2h; Wed, 14 Aug 2024 00:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776701.1186861; Wed, 14 Aug 2024 00: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 1se27P-0003b9-Vt; Wed, 14 Aug 2024 00:44:03 +0000
Received: by outflank-mailman (input) for mailman id 776701;
 Wed, 14 Aug 2024 00:44:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se27P-0003b3-AH
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 00:44:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se27P-00032R-6Q
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 00:44:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se27P-0007ah-3q
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 00:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UPxYdQV+4yCFXLzV2cvWnUD+iaE2VzbU7dsv2RoZs9Y=; b=mjf9+Dl3NKeuFWTPhLQaAOQzyF
	4nXi7PKrUMNbhoyNHNpGSn8DvsOjIAwIOtF/txgQJjxj3AO5GaXnjLElWLo0Xzr/nB1MirpsRbhXb
	091EZf8vLN3ct3IG0ZgkxdoIxU2/uLDO2bZ6qKiIWsay0Oalp4NLJbBDAHySfqtmCCd4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: use expect to run QEMU
Message-Id: <E1se27P-0007ah-3q@xenbits.xenproject.org>
Date: Wed, 14 Aug 2024 00:44:03 +0000

commit c36efb7fcea6ef9f31a20e60ec79ed3ae293feee
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Aug 9 23:59:20 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Aug 13 16:05:05 2024 -0700

    automation: use expect to run QEMU
    
    Use expect to invoke QEMU so that we can terminate the test as soon as
    we get the right string in the output instead of waiting until the
    final timeout.
    
    For timeout, instead of an hardcoding the value, use a Gitlab CI
    variable "QEMU_TIMEOUT" that can be changed depending on the latest
    status of the Gitlab CI runners.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 automation/scripts/qemu-alpine-x86_64.sh        | 16 ++++-----
 automation/scripts/qemu-key.exp                 | 45 +++++++++++++++++++++++++
 automation/scripts/qemu-smoke-dom0-arm32.sh     | 16 ++++-----
 automation/scripts/qemu-smoke-dom0-arm64.sh     | 16 ++++-----
 automation/scripts/qemu-smoke-dom0less-arm32.sh | 18 +++++-----
 automation/scripts/qemu-smoke-dom0less-arm64.sh | 16 ++++-----
 automation/scripts/qemu-smoke-ppc64le.sh        | 13 ++++---
 automation/scripts/qemu-smoke-riscv64.sh        | 13 ++++---
 automation/scripts/qemu-smoke-x86-64.sh         | 15 +++++----
 automation/scripts/qemu-xtf-dom0less-arm64.sh   | 15 ++++-----
 10 files changed, 112 insertions(+), 71 deletions(-)

diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index 8e398dcea3..5359e0820b 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -77,18 +77,16 @@ EOF
 # Run the test
 rm -f smoke.serial
 set +e
-timeout -k 1 720 \
-qemu-system-x86_64 \
+export QEMU_CMD="qemu-system-x86_64 \
     -cpu qemu64,+svm \
     -m 2G -smp 2 \
     -monitor none -serial stdio \
     -nographic \
     -device virtio-net-pci,netdev=n0 \
-    -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0 |& \
-        # Remove carriage returns from the stdout output, as gitlab
-        # interface chokes on them
-        tee smoke.serial | sed 's/\r//'
+    -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0"
 
-set -e
-(grep -q "Domain-0" smoke.serial && grep -q "BusyBox" smoke.serial) || exit 1
-exit 0
+export QEMU_LOG="smoke.serial"
+export LOG_MSG="Domain-0"
+export PASSED="BusyBox"
+
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-key.exp b/automation/scripts/qemu-key.exp
new file mode 100755
index 0000000000..35eb903a31
--- /dev/null
+++ b/automation/scripts/qemu-key.exp
@@ -0,0 +1,45 @@
+#!/usr/bin/expect -f
+
+set timeout $env(QEMU_TIMEOUT)
+
+log_file -a $env(QEMU_LOG)
+
+match_max 10000
+
+eval spawn $env(QEMU_CMD)
+
+expect_after {
+    -re "(.*)\r" {
+        exp_continue
+    }
+    timeout {send_error "ERROR-Timeout!\n"; exit 1}
+    eof {send_error "ERROR-EOF!\n"; exit 1}
+}
+
+if {[info exists env(UBOOT_CMD)]} {
+    expect "=>"
+
+    send "$env(UBOOT_CMD)\r"
+}
+
+if {[info exists env(LOG_MSG)]} {
+    expect {
+        "$env(PASSED)" {
+            expect "$env(LOG_MSG)"
+            exit 0
+        }
+        "$env(LOG_MSG)" {
+            expect "$env(PASSED)"
+            exit 0
+        }
+    }
+}
+
+expect {
+    "$env(PASSED)" {
+        exit 0
+    }
+}
+
+expect eof
+
diff --git a/automation/scripts/qemu-smoke-dom0-arm32.sh b/automation/scripts/qemu-smoke-dom0-arm32.sh
index eaaea5a982..bbdcb39f1a 100755
--- a/automation/scripts/qemu-smoke-dom0-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm32.sh
@@ -78,9 +78,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 
 rm -f ${serial_log}
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 720 \
-./qemu-system-arm \
+export QEMU_CMD="./qemu-system-arm \
    -machine virt \
    -machine virtualization=true \
    -smp 4 \
@@ -91,9 +89,11 @@ timeout -k 1 720 \
    -no-reboot \
    -device virtio-net-pci,netdev=n0 \
    -netdev user,id=n0,tftp=./ \
-   -bios /usr/lib/u-boot/qemu_arm/u-boot.bin |& \
-      tee ${serial_log} | sed 's/\r//'
+   -bios /usr/lib/u-boot/qemu_arm/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="${serial_log}"
+export LOG_MSG="Domain-0"
+export PASSED="/ #"
 
-set -e
-(grep -q "Domain-0" ${serial_log} && grep -q "^/ #" ${serial_log}) || exit 1
-exit 0
+../automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
index 352963a741..0094bfc8e1 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -94,9 +94,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 # Run the test
 rm -f smoke.serial
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 720 \
-./binaries/qemu-system-aarch64 \
+export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
     -m 2048 -monitor none -serial stdio \
@@ -104,9 +102,11 @@ timeout -k 1 720 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& \
-        tee smoke.serial | sed 's/\r//'
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="smoke.serial"
+export LOG_MSG="Domain-0"
+export PASSED="BusyBox"
 
-set -e
-(grep -q "Domain-0" smoke.serial && grep -q "BusyBox" smoke.serial) || exit 1
-exit 0
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
index c027c8c5c8..68ffbabdb8 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -5,7 +5,7 @@ set -ex
 test_variant=$1
 
 # Prompt to grep for to check if dom0 booted successfully
-dom0_prompt="^/ #"
+dom0_prompt="/ #"
 
 serial_log="$(pwd)/smoke.serial"
 
@@ -131,9 +131,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 # Run the test
 rm -f ${serial_log}
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 240 \
-./qemu-system-arm \
+export QEMU_CMD="./qemu-system-arm \
     -machine virt \
     -machine virtualization=true \
     -smp 4 \
@@ -144,9 +142,11 @@ timeout -k 1 240 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=./ \
-    -bios /usr/lib/u-boot/qemu_arm/u-boot.bin |& \
-        tee ${serial_log} | sed 's/\r//'
+    -bios /usr/lib/u-boot/qemu_arm/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="${serial_log}"
+export LOG_MSG="${dom0_prompt}"
+export PASSED="${passed}"
 
-set -e
-(grep -q "${dom0_prompt}" ${serial_log} && grep -q "${passed}" ${serial_log}) || exit 1
-exit 0
+../automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index 15258692d5..eb25c4af4b 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -205,9 +205,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 # Run the test
 rm -f smoke.serial
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 240 \
-./binaries/qemu-system-aarch64 \
+export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt,gic-version=$gic_version \
     -m 2048 -monitor none -serial stdio \
@@ -215,9 +213,11 @@ timeout -k 1 240 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& \
-        tee smoke.serial | sed 's/\r//'
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="smoke.serial"
+export LOG_MSG="Welcome to Alpine Linux"
+export PASSED="${passed}"
 
-set -e
-(grep -q "^Welcome to Alpine Linux" smoke.serial && grep -q "${passed}" smoke.serial) || exit 1
-exit 0
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-ppc64le.sh b/automation/scripts/qemu-smoke-ppc64le.sh
index 9088881b73..ccb4a576f4 100755
--- a/automation/scripts/qemu-smoke-ppc64le.sh
+++ b/automation/scripts/qemu-smoke-ppc64le.sh
@@ -11,8 +11,7 @@ machine=$1
 rm -f ${serial_log}
 set +e
 
-timeout -k 1 20 \
-qemu-system-ppc64 \
+export QEMU_CMD="qemu-system-ppc64 \
     -bios skiboot.lid \
     -M $machine \
     -m 2g \
@@ -21,9 +20,9 @@ qemu-system-ppc64 \
     -monitor none \
     -nographic \
     -serial stdio \
-    -kernel binaries/xen \
-    |& tee ${serial_log} | sed 's/\r//'
+    -kernel binaries/xen"
 
-set -e
-(grep -q "Hello, ppc64le!" ${serial_log}) || exit 1
-exit 0
+export QEMU_LOG="${serial_log}"
+export PASSED="Hello, ppc64le!"
+
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-riscv64.sh b/automation/scripts/qemu-smoke-riscv64.sh
index f90df3c051..0355c075b7 100755
--- a/automation/scripts/qemu-smoke-riscv64.sh
+++ b/automation/scripts/qemu-smoke-riscv64.sh
@@ -6,15 +6,14 @@ set -ex
 rm -f smoke.serial
 set +e
 
-timeout -k 1 2 \
-qemu-system-riscv64 \
+export QEMU_CMD="qemu-system-riscv64 \
     -M virt \
     -smp 1 \
     -nographic \
     -m 2g \
-    -kernel binaries/xen \
-    |& tee smoke.serial | sed 's/\r//'
+    -kernel binaries/xen"
 
-set -e
-(grep -q "All set up" smoke.serial) || exit 1
-exit 0
+export QEMU_LOG="smoke.serial"
+export PASSED="All set up"
+
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-x86-64.sh b/automation/scripts/qemu-smoke-x86-64.sh
index 3014d07314..37ac10e068 100755
--- a/automation/scripts/qemu-smoke-x86-64.sh
+++ b/automation/scripts/qemu-smoke-x86-64.sh
@@ -16,11 +16,12 @@ esac
 
 rm -f smoke.serial
 set +e
-timeout -k 1 30 \
-qemu-system-x86_64 -nographic -kernel binaries/xen \
+export QEMU_CMD="qemu-system-x86_64 -nographic -kernel binaries/xen \
         -initrd xtf/tests/example/$k \
-        -append "loglvl=all console=com1 noreboot console_timestamps=boot $extra" \
-        -m 512 -monitor none -serial file:smoke.serial
-set -e
-grep -q 'Test result: SUCCESS' smoke.serial || exit 1
-exit 0
+        -append \"loglvl=all console=com1 noreboot console_timestamps=boot $extra\" \
+        -m 512 -monitor none -serial stdio"
+
+export QEMU_LOG="smoke.serial"
+export PASSED="Test result: SUCCESS"
+
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-xtf-dom0less-arm64.sh b/automation/scripts/qemu-xtf-dom0less-arm64.sh
index b08c2d44fb..0666f6363e 100755
--- a/automation/scripts/qemu-xtf-dom0less-arm64.sh
+++ b/automation/scripts/qemu-xtf-dom0less-arm64.sh
@@ -51,9 +51,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 # Run the test
 rm -f smoke.serial
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 120 \
-./binaries/qemu-system-aarch64 \
+export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
     -m 2048 -monitor none -serial stdio \
@@ -61,9 +59,10 @@ timeout -k 1 120 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& \
-        tee smoke.serial | sed 's/\r//'
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="smoke.serial"
+export PASSED="${passed}"
 
-set -e
-(grep -q "${passed}" smoke.serial) || exit 1
-exit 0
+./automation/scripts/qemu-key.exp
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 14 02:44:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Aug 2024 02:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776725.1186881 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1se3zX-0004HK-H3; Wed, 14 Aug 2024 02:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776725.1186881; Wed, 14 Aug 2024 02: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 1se3zX-0004HD-ED; Wed, 14 Aug 2024 02:44:03 +0000
Received: by outflank-mailman (input) for mailman id 776725;
 Wed, 14 Aug 2024 02:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se3zW-0004H7-9y
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 02:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se3zW-0004mh-7Q
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 02:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se3zW-0007or-5D
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 02: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CSex+BiA1w4FInklECgKFeRiKTxvK2QKgetrtlug6iA=; b=E20ocynGb4po4idi5IJpZp3GoI
	nCzwKNTLkpLLXracHxNsS63YxWG0RfXMq6BuhNYsqXPXp1hedH4N63Op7gc/ctaKdyK6nAGZ6wN+s
	nrttNf772dxuXhGLGS8tMsVPyg0AAQkrBdpux7zaCA0eFGODTbU98CnwqB8SnNw1bKL4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/IOMMU: move tracking in iommu_identity_mapping()
Message-Id: <E1se3zW-0007or-5D@xenbits.xenproject.org>
Date: Wed, 14 Aug 2024 02:44:02 +0000

commit 10d6cba5989d8acb94ae293f22eb434d85f735cb
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Tue Aug 13 16:52:06 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:52:06 2024 +0200

    x86/IOMMU: move tracking in iommu_identity_mapping()
    
    If for some reason xmalloc() fails after having mapped the reserved
    regions, an error is reported, but the regions remain mapped in the P2M.
    
    Similarly if an error occurs during set_identity_p2m_entry() (except on
    the first call), the partial mappings of the region would be retained
    without being tracked anywhere, and hence without there being a way to
    remove them again from the domain's P2M.
    
    Move the setting up of the list entry ahead of trying to map the region.
    In cases other than the first mapping failing, keep record of the full
    region, such that a subsequent unmapping request can be properly torn
    down.
    
    To compensate for the potentially excess unmapping requests, don't log a
    warning from p2m_remove_identity_entry() when there really was nothing
    mapped at a given GFN.
    
    This is XSA-460 / CVE-2024-31145.
    
    Fixes: 2201b67b9128 ("VT-d: improve RMRR region handling")
    Fixes: c0e19d7c6c42 ("IOMMU: generalize VT-d's tracking of mapped RMRR regions")
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: beadd68b5490ada053d72f8a9ce6fd696d626596
    master date: 2024-08-13 16:36:40 +0200
---
 xen/arch/x86/mm/p2m.c               |  8 +++++---
 xen/drivers/passthrough/x86/iommu.c | 30 +++++++++++++++++++++---------
 2 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index ddd2f861c3..c4c653d7fe 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1618,9 +1618,11 @@ int clear_identity_p2m_entry(struct domain *d, unsigned long gfn_l)
     else
     {
         gfn_unlock(p2m, gfn, 0);
-        printk(XENLOG_G_WARNING
-               "non-identity map d%d:%lx not cleared (mapped to %lx)\n",
-               d->domain_id, gfn_l, mfn_x(mfn));
+        if ( (p2mt != p2m_invalid && p2mt != p2m_mmio_dm) ||
+             a != p2m_access_n || !mfn_eq(mfn, INVALID_MFN) )
+           printk(XENLOG_G_WARNING
+                  "non-identity map %pd:%lx not cleared (mapped to %lx)\n",
+                  d, gfn_l, mfn_x(mfn));
         ret = 0;
     }
 
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index dc9936e169..b9a50f6ea9 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -238,24 +238,36 @@ int iommu_identity_mapping(struct domain *d, p2m_access_t p2ma,
     if ( p2ma == p2m_access_x )
         return -ENOENT;
 
-    while ( base_pfn < end_pfn )
-    {
-        int err = set_identity_p2m_entry(d, base_pfn, p2ma, flag);
-
-        if ( err )
-            return err;
-        base_pfn++;
-    }
-
     map = xmalloc(struct identity_map);
     if ( !map )
         return -ENOMEM;
+
     map->base = base;
     map->end = end;
     map->access = p2ma;
     map->count = 1;
+
+    /*
+     * Insert into list ahead of mapping, so the range can be found when
+     * trying to clean up.
+     */
     list_add_tail(&map->list, &hd->arch.identity_maps);
 
+    for ( ; base_pfn < end_pfn; ++base_pfn )
+    {
+        int err = set_identity_p2m_entry(d, base_pfn, p2ma, flag);
+
+        if ( !err )
+            continue;
+
+        if ( (map->base >> PAGE_SHIFT_4K) == base_pfn )
+        {
+            list_del(&map->list);
+            xfree(map);
+        }
+        return err;
+    }
+
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Wed Aug 14 02:44:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Aug 2024 02:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776726.1186885 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1se3zh-0004K0-IO; Wed, 14 Aug 2024 02:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776726.1186885; Wed, 14 Aug 2024 02: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 1se3zh-0004Jn-Fl; Wed, 14 Aug 2024 02:44:13 +0000
Received: by outflank-mailman (input) for mailman id 776726;
 Wed, 14 Aug 2024 02:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se3zg-0004J3-C8
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 02:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se3zg-0004mx-AU
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 02:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se3zg-0007pS-9a
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 02: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZSaNk4YzOQRSO/0xIrJh4ffuJsMYgF8N+HtKXC38+oE=; b=SDVwjM6sTgQ3yDMtJ4drTVhtSD
	WAfLph9mGpoiBNeltEf9zQbJgaopKZ0bYwtbNRZygJvebcGLahM6wiQvLp0NSRyIyobEidZ4Mvxxn
	nNAOguLV0OH3rO1VFBQ1sJrITtQDem68Vhx+GVaCrsaeqSpX8+BPdkfWNMM6GF8OAjWs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.16] x86/pass-through: documents as security-unsupported when sharing resources
Message-Id: <E1se3zg-0007pS-9a@xenbits.xenproject.org>
Date: Wed, 14 Aug 2024 02:44:12 +0000

commit 638f21616a7a9e94ebae134573ca42d977a65063
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Aug 13 16:52:44 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:52:44 2024 +0200

    x86/pass-through: documents as security-unsupported when sharing resources
    
    When multiple devices share resources and one of them is to be passed
    through to a guest, security of the entire system and of respective
    guests individually cannot really be guaranteed without knowing
    internals of any of the involved guests.  Therefore such a configuration
    cannot really be security-supported, yet making that explicit was so far
    missing.
    
    This is XSA-461 / CVE-2024-31146.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    master commit: 9c94eda1e3790820699a6de3f6a7c959ecf30600
    master date: 2024-08-13 16:37:25 +0200
---
 SUPPORT.md | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index 15fbad84a7..fbbb267bf1 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -704,6 +704,11 @@ This feature is not security supported: see https://xenbits.xen.org/xsa/advisory
 
 Only systems using IOMMUs are supported.
 
+Passing through of devices sharing resources with another device is not
+security supported.  Such sharing could e.g. be the same line interrupt being
+used by multiple devices, one of which is to be passed through, or two such
+devices having memory BARs within the same 4k page.
+
 Not compatible with migration, populate-on-demand, altp2m,
 introspection, memory sharing, or memory paging.
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16


From xen-changelog-bounces@lists.xenproject.org Wed Aug 14 06:55:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Aug 2024 06:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776762.1186919 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1se7uT-0000Mh-3z; Wed, 14 Aug 2024 06:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776762.1186919; Wed, 14 Aug 2024 06:55: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 1se7uT-0000MZ-1E; Wed, 14 Aug 2024 06:55:05 +0000
Received: by outflank-mailman (input) for mailman id 776762;
 Wed, 14 Aug 2024 06:55:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se7uR-0000MT-GE
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 06:55:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se7uR-0001it-Ar
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 06:55:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se7uR-0007yi-8e
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 06:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ql/oprqkN9CIqxRXFtU1zLz95ZoZ1PLWM9UBy9lXQK0=; b=PC5bs/ZCcBORu2eia0zUkyCLpw
	D2HNSv+2sO4aXhDIMfxBdqdJOSIV2ghbAtt4gF5OxFeW7t//klrk6PGEILPqkyLGttsKB7BsWoVkn
	XFsJ8lXJ2rnjDzUmR5OnOz97bQVHwHzH2gh3plLtCLdQVSsKiLGZloDaolG8cAHuJlsQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstored: switch stubdom live update to use file for state
Message-Id: <E1se7uR-0007yi-8e@xenbits.xenproject.org>
Date: Wed, 14 Aug 2024 06:55:03 +0000

commit e4d19a2dad80b847930d1742e92798448ae59ad6
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Aug 14 08:46:54 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 14 08:46:54 2024 +0200

    tools/xenstored: switch stubdom live update to use file for state
    
    With the introduction of 9pfs for Xenstore-stubdom it is now possible
    to use a file for saving the state when doing live update.
    
    This allows to move some environment specific actions back to the
    common source file lu.c.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstored/lu.c        | 75 ++++++++++++++++++++++++++++++++++++++++++++-
 tools/xenstored/lu.h        | 19 +-----------
 tools/xenstored/lu_daemon.c | 72 -------------------------------------------
 tools/xenstored/lu_minios.c | 49 -----------------------------
 4 files changed, 75 insertions(+), 140 deletions(-)

diff --git a/tools/xenstored/lu.c b/tools/xenstored/lu.c
index 2f41d10c95..bec2a84e10 100644
--- a/tools/xenstored/lu.c
+++ b/tools/xenstored/lu.c
@@ -11,6 +11,8 @@
 #include <stdlib.h>
 #include <syslog.h>
 #include <time.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
 
 #include "talloc.h"
 #include "core.h"
@@ -19,11 +21,18 @@
 #include "watch.h"
 
 #ifndef NO_LIVE_UPDATE
+
+struct lu_dump_state {
+	void *buf;
+	unsigned int size;
+	int fd;
+	char *filename;
+};
+
 struct live_update *lu_status;
 
 static int lu_destroy(void *data)
 {
-	lu_destroy_arch(data);
 	lu_status = NULL;
 
 	return 0;
@@ -70,6 +79,48 @@ bool lu_is_pending(void)
 	return lu_status != NULL;
 }
 
+static void lu_get_dump_state(struct lu_dump_state *state)
+{
+	struct stat statbuf;
+
+	state->size = 0;
+
+	state->filename = talloc_asprintf(NULL, "%s/state_dump",
+					  xenstore_rundir());
+	if (!state->filename)
+		barf("Allocation failure");
+
+	state->fd = open(state->filename, O_RDONLY);
+	if (state->fd < 0)
+		return;
+	if (fstat(state->fd, &statbuf) != 0)
+		goto out_close;
+	state->size = statbuf.st_size;
+
+	state->buf = mmap(NULL, state->size, PROT_READ, MAP_PRIVATE,
+			  state->fd, 0);
+	if (state->buf == MAP_FAILED) {
+		state->size = 0;
+		goto out_close;
+	}
+
+	return;
+
+ out_close:
+	close(state->fd);
+}
+
+static void lu_close_dump_state(struct lu_dump_state *state)
+{
+	assert(state->filename != NULL);
+
+	munmap(state->buf, state->size);
+	close(state->fd);
+
+	unlink(state->filename);
+	talloc_free(state->filename);
+}
+
 void lu_read_state(void)
 {
 	struct lu_dump_state state = {};
@@ -197,6 +248,28 @@ static const char *lu_reject_reason(const void *ctx)
 	return ret ? (const char *)ret : "Overlapping transactions";
 }
 
+static FILE *lu_dump_open(const void *ctx)
+{
+	char *filename;
+	int fd;
+
+	filename = talloc_asprintf(ctx, "%s/state_dump",
+				   xenstore_rundir());
+	if (!filename)
+		return NULL;
+
+	fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
+	if (fd < 0)
+		return NULL;
+
+	return fdopen(fd, "w");
+}
+
+static void lu_dump_close(FILE *fp)
+{
+	fclose(fp);
+}
+
 static const char *lu_dump_state(const void *ctx, struct connection *conn)
 {
 	FILE *fp;
diff --git a/tools/xenstored/lu.h b/tools/xenstored/lu.h
index ac3c572ca8..dacc9b6e42 100644
--- a/tools/xenstored/lu.h
+++ b/tools/xenstored/lu.h
@@ -18,12 +18,9 @@ struct live_update {
 	unsigned int kernel_size;
 	unsigned int kernel_off;
 
-	void *dump_state;
-	unsigned long dump_size;
-#else
-	char *filename;
 #endif
 
+	char *filename;
 	char *cmdline;
 
 	/* Start parameters. */
@@ -32,15 +29,6 @@ struct live_update {
 	time_t started_at;
 };
 
-struct lu_dump_state {
-	void *buf;
-	unsigned int size;
-#ifndef __MINIOS__
-	int fd;
-	char *filename;
-#endif
-};
-
 extern struct live_update *lu_status;
 
 struct connection *lu_get_connection(void);
@@ -54,15 +42,10 @@ int do_control_lu(const void *ctx, struct connection *conn, const char **vec,
 		  int num);
 
 /* Live update private interfaces. */
-void lu_get_dump_state(struct lu_dump_state *state);
-void lu_close_dump_state(struct lu_dump_state *state);
-FILE *lu_dump_open(const void *ctx);
-void lu_dump_close(FILE *fp);
 char *lu_exec(const void *ctx, int argc, char **argv);
 const char *lu_arch(const void *ctx, struct connection *conn, const char **vec,
 		    int num);
 const char *lu_begin(struct connection *conn);
-void lu_destroy_arch(void *data);
 #else
 static inline struct connection *lu_get_connection(void)
 {
diff --git a/tools/xenstored/lu_daemon.c b/tools/xenstored/lu_daemon.c
index 6351111ab0..6df6c80a2a 100644
--- a/tools/xenstored/lu_daemon.c
+++ b/tools/xenstored/lu_daemon.c
@@ -5,82 +5,14 @@
  * Copyright (C) 2022 Juergen Gross, SUSE LLC
  */
 
-#include <assert.h>
-#include <stdio.h>
 #include <syslog.h>
 #include <sys/stat.h>
-#include <sys/mman.h>
-#include <xen-tools/xenstore-common.h>
 
 #include "talloc.h"
 #include "core.h"
 #include "lu.h"
 
 #ifndef NO_LIVE_UPDATE
-void lu_get_dump_state(struct lu_dump_state *state)
-{
-	struct stat statbuf;
-
-	state->size = 0;
-
-	state->filename = talloc_asprintf(NULL, "%s/state_dump",
-					  xenstore_rundir());
-	if (!state->filename)
-		barf("Allocation failure");
-
-	state->fd = open(state->filename, O_RDONLY);
-	if (state->fd < 0)
-		return;
-	if (fstat(state->fd, &statbuf) != 0)
-		goto out_close;
-	state->size = statbuf.st_size;
-
-	state->buf = mmap(NULL, state->size, PROT_READ, MAP_PRIVATE,
-			  state->fd, 0);
-	if (state->buf == MAP_FAILED) {
-		state->size = 0;
-		goto out_close;
-	}
-
-	return;
-
- out_close:
-	close(state->fd);
-}
-
-void lu_close_dump_state(struct lu_dump_state *state)
-{
-	assert(state->filename != NULL);
-
-	munmap(state->buf, state->size);
-	close(state->fd);
-
-	unlink(state->filename);
-	talloc_free(state->filename);
-}
-
-FILE *lu_dump_open(const void *ctx)
-{
-	char *filename;
-	int fd;
-
-	filename = talloc_asprintf(ctx, "%s/state_dump",
-				   xenstore_rundir());
-	if (!filename)
-		return NULL;
-
-	fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
-	if (fd < 0)
-		return NULL;
-
-	return fdopen(fd, "w");
-}
-
-void lu_dump_close(FILE *fp)
-{
-	fclose(fp);
-}
-
 char *lu_exec(const void *ctx, int argc, char **argv)
 {
 	argv[0] = lu_status->filename;
@@ -89,10 +21,6 @@ char *lu_exec(const void *ctx, int argc, char **argv)
 	return "Error activating new binary.";
 }
 
-void lu_destroy_arch(void *data)
-{
-}
-
 static const char *lu_binary(const void *ctx, struct connection *conn,
 			     const char *filename)
 {
diff --git a/tools/xenstored/lu_minios.c b/tools/xenstored/lu_minios.c
index ede8b4dd47..b14a0b29d5 100644
--- a/tools/xenstored/lu_minios.c
+++ b/tools/xenstored/lu_minios.c
@@ -5,67 +5,18 @@
  * Copyright (C) 2022 Juergen Gross, SUSE LLC
  */
 
-#include <stdbool.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <syslog.h>
-#include <sys/mman.h>
-#include <xenctrl.h>
-#include <xen-tools/common-macros.h>
 
 #include "talloc.h"
 #include "lu.h"
 
-/* Mini-OS only knows about MAP_ANON. */
-#ifndef MAP_ANONYMOUS
-#define MAP_ANONYMOUS MAP_ANON
-#endif
-
 #ifndef NO_LIVE_UPDATE
-void lu_get_dump_state(struct lu_dump_state *state)
-{
-}
-
-void lu_close_dump_state(struct lu_dump_state *state)
-{
-}
-
-FILE *lu_dump_open(const void *ctx)
-{
-	lu_status->dump_size = ROUNDUP(talloc_total_size(NULL) * 2,
-				       XC_PAGE_SHIFT);
-	lu_status->dump_state = mmap(NULL, lu_status->dump_size,
-				     PROT_READ | PROT_WRITE,
-				     MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-	if (lu_status->dump_state == MAP_FAILED)
-		return NULL;
-
-	return fmemopen(lu_status->dump_state, lu_status->dump_size, "w");
-}
-
-void lu_dump_close(FILE *fp)
-{
-	size_t size;
-
-	size = ftell(fp);
-	size = ROUNDUP(size, XC_PAGE_SHIFT);
-	munmap(lu_status->dump_state + size, lu_status->dump_size - size);
-	lu_status->dump_size = size;
-
-	fclose(fp);
-}
-
 char *lu_exec(const void *ctx, int argc, char **argv)
 {
 	return "NYI";
 }
 
-void lu_destroy_arch(void *data)
-{
-	if (lu_status->dump_state)
-		munmap(lu_status->dump_state, lu_status->dump_size);
-}
-
 static const char *lu_binary_alloc(const void *ctx, struct connection *conn,
 				   unsigned long size)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 14 06:55:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Aug 2024 06:55:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776763.1186923 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1se7ud-0000P5-7v; Wed, 14 Aug 2024 06:55:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776763.1186923; Wed, 14 Aug 2024 06:55: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 1se7ud-0000Ox-5D; Wed, 14 Aug 2024 06:55:15 +0000
Received: by outflank-mailman (input) for mailman id 776763;
 Wed, 14 Aug 2024 06:55:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se7ub-0000Ol-Gk
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 06:55:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se7ub-0001j2-FW
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 06:55:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se7ub-0007zJ-DJ
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 06:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=oKYR+JBCVeKbr39E1VW1YLipsSzieqDRsDEZwHywHc8=; b=6pdzX+2HVD+6cqInd3e6feQLMk
	34F4lNHW2YjlVMIGgUVk8MYnBpwwNnu5BKR+W22VMw0twdL++BVEpQbVM/ViTOx8pR/X8t8dcTyCJ
	kQ7cE+QnnCQp+TCLvxPe8v4Vrf8AWcfju0NC01FwO1zuPK+/BfzZCYcfrdtWeaZD9Hfc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] mm: introduce xvmalloc() et al and use for grant table allocations
Message-Id: <E1se7ub-0007zJ-DJ@xenbits.xenproject.org>
Date: Wed, 14 Aug 2024 06:55:13 +0000

commit 9102fcd9579fb195749e96b99b36ee14f1314a55
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Aug 14 08:47:58 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 14 08:47:58 2024 +0200

    mm: introduce xvmalloc() et al and use for grant table allocations
    
    All of the array allocations in grant_table_init() can exceed a page's
    worth of memory, which xmalloc()-based interfaces aren't really suitable
    for after boot. We also don't need any of these allocations to be
    physically contiguous. Introduce interfaces dynamically switching
    between xmalloc() et al and vmalloc() et al, based on requested size,
    and use them instead.
    
    All the wrappers in the new header are cloned mostly verbatim from
    xmalloc.h, with the sole adjustment to switch unsigned long to size_t
    for sizes and to unsigned int for alignments, and with the cloning of
    x[mz]alloc_bytes() avoided. The exception is xvmemdup(), where the
    const related comment on xmemdup() is actually addressed and hence
    dropped.
    
    While adjusting grant_table_destroy() also move ahead the clearing of
    the struct domain field.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/grant_table.c   | 30 ++++++++--------
 xen/common/vmap.c          | 88 ++++++++++++++++++++++++++++++++++++++++------
 xen/include/xen/xmalloc.h  |  3 ++
 xen/include/xen/xvmalloc.h | 75 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 172 insertions(+), 24 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index ebe2d2a3ce..ab36f45ded 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -39,7 +39,7 @@
 #include <xen/paging.h>
 #include <xen/keyhandler.h>
 #include <xen/radix-tree.h>
-#include <xen/vmap.h>
+#include <xen/xvmalloc.h>
 #include <xen/nospec.h>
 #include <xsm/xsm.h>
 #include <asm/flushtlb.h>
@@ -1995,7 +1995,7 @@ int grant_table_init(struct domain *d, int max_grant_frames,
         return -EINVAL;
     }
 
-    if ( (gt = xzalloc(struct grant_table)) == NULL )
+    if ( (gt = xvzalloc(struct grant_table)) == NULL )
         return -ENOMEM;
 
     /* Simple stuff. */
@@ -2012,15 +2012,16 @@ int grant_table_init(struct domain *d, int max_grant_frames,
     d->grant_table = gt;
 
     /* Active grant table. */
-    gt->active = xzalloc_array(struct active_grant_entry *,
-                               max_nr_active_grant_frames(gt));
+    gt->active = xvzalloc_array(struct active_grant_entry *,
+                                max_nr_active_grant_frames(gt));
     if ( gt->active == NULL )
         goto out;
 
     /* Tracking of mapped foreign frames table */
     if ( gt->max_maptrack_frames )
     {
-        gt->maptrack = vzalloc(gt->max_maptrack_frames * sizeof(*gt->maptrack));
+        gt->maptrack = xvzalloc_array(struct grant_mapping *,
+                                      gt->max_maptrack_frames);
         if ( gt->maptrack == NULL )
             goto out;
 
@@ -2028,13 +2029,13 @@ int grant_table_init(struct domain *d, int max_grant_frames,
     }
 
     /* Shared grant table. */
-    gt->shared_raw = xzalloc_array(void *, gt->max_grant_frames);
+    gt->shared_raw = xvzalloc_array(void *, gt->max_grant_frames);
     if ( gt->shared_raw == NULL )
         goto out;
 
     /* Status pages for grant table - for version 2 */
-    gt->status = xzalloc_array(grant_status_t *,
-                               grant_to_status_frames(gt->max_grant_frames));
+    gt->status = xvzalloc_array(grant_status_t *,
+                                grant_to_status_frames(gt->max_grant_frames));
     if ( gt->status == NULL )
         goto out;
 
@@ -4010,23 +4011,24 @@ grant_table_destroy(
     if ( t == NULL )
         return;
 
+    d->grant_table = NULL;
+
     for ( i = 0; i < nr_grant_frames(t); i++ )
         free_xenheap_page(t->shared_raw[i]);
-    xfree(t->shared_raw);
+    xvfree(t->shared_raw);
 
     ASSERT(!t->maptrack_limit);
-    vfree(t->maptrack);
+    xvfree(t->maptrack);
 
     for ( i = 0; i < nr_active_grant_frames(t); i++ )
         free_xenheap_page(t->active[i]);
-    xfree(t->active);
+    xvfree(t->active);
 
     for ( i = 0; i < nr_status_frames(t); i++ )
         free_xenheap_page(t->status[i]);
-    xfree(t->status);
+    xvfree(t->status);
 
-    xfree(t);
-    d->grant_table = NULL;
+    xvfree(t);
 }
 
 void grant_table_init_vcpu(struct vcpu *v)
diff --git a/xen/common/vmap.c b/xen/common/vmap.c
index b3b4ddf653..ced9cbf26f 100644
--- a/xen/common/vmap.c
+++ b/xen/common/vmap.c
@@ -7,6 +7,7 @@
 #include <xen/spinlock.h>
 #include <xen/types.h>
 #include <xen/vmap.h>
+#include <xen/xvmalloc.h>
 #include <asm/page.h>
 
 static DEFINE_SPINLOCK(vm_lock);
@@ -335,28 +336,95 @@ void *vzalloc(size_t size)
     return p;
 }
 
-void vfree(void *va)
+static void _vfree(const void *va, unsigned int pages)
 {
-    unsigned int i, pages;
+    unsigned int i;
     struct page_info *pg;
     PAGE_LIST_HEAD(pg_list);
 
-    if ( !va )
-        return;
-
-    pages = vmap_size(va);
     ASSERT(pages);
 
     for ( i = 0; i < pages; i++ )
     {
-        struct page_info *page = vmap_to_page(va + i * PAGE_SIZE);
-
-        ASSERT(page);
-        page_list_add(page, &pg_list);
+        pg = vmap_to_page(va + i * PAGE_SIZE);
+        ASSERT(pg);
+        page_list_add(pg, &pg_list);
     }
     vunmap(va);
 
     while ( (pg = page_list_remove_head(&pg_list)) != NULL )
         free_domheap_page(pg);
 }
+
+void vfree(void *va)
+{
+    if ( !va )
+        return;
+
+    _vfree(va, vmap_size(va));
+}
+
+void xvfree(void *va)
+{
+    unsigned int pages = vm_size(va, VMAP_DEFAULT);
+
+    if ( pages )
+        _vfree(va, pages);
+    else
+        xfree(va);
+}
+
+void *_xvmalloc(size_t size, unsigned int align)
+{
+    ASSERT(align <= PAGE_SIZE);
+    return size <= PAGE_SIZE ? _xmalloc(size, align) : vmalloc(size);
+}
+
+void *_xvzalloc(size_t size, unsigned int align)
+{
+    ASSERT(align <= PAGE_SIZE);
+    return size <= PAGE_SIZE ? _xzalloc(size, align) : vzalloc(size);
+}
+
+void *_xvrealloc(void *va, size_t size, unsigned int align)
+{
+    size_t pages = vm_size(va, VMAP_DEFAULT);
+    void *ptr;
+
+    ASSERT(align <= PAGE_SIZE);
+
+    if ( !pages )
+    {
+        if ( size <= PAGE_SIZE )
+            return _xrealloc(va, size, align);
+
+        ptr = vmalloc(size);
+        if ( ptr && va && va != ZERO_BLOCK_PTR )
+        {
+            /*
+             * xmalloc-based allocations up to PAGE_SIZE don't cross page
+             * boundaries. Therefore, without needing to know the exact
+             * prior allocation size, simply copy the entire tail of the
+             * page containing the earlier allocation.
+             */
+            memcpy(ptr, va, PAGE_SIZE - PAGE_OFFSET(va));
+            xfree(va);
+        }
+    }
+    else if ( pages == PFN_UP(size) )
+        ptr = va;
+    else
+    {
+        ptr = _xvmalloc(size, align);
+        if ( ptr )
+        {
+            memcpy(ptr, va, min(size, pages << PAGE_SHIFT));
+            vfree(va);
+        }
+        else if ( pages > PFN_UP(size) )
+            ptr = va;
+    }
+
+    return ptr;
+}
 #endif
diff --git a/xen/include/xen/xmalloc.h b/xen/include/xen/xmalloc.h
index 1b88a83be8..b903fa2e26 100644
--- a/xen/include/xen/xmalloc.h
+++ b/xen/include/xen/xmalloc.h
@@ -7,6 +7,9 @@
 
 /*
  * Xen malloc/free-style interface.
+ *
+ * NOTE: Unless physically contiguous memory space is required, the interfaces
+ *       in xvmalloc.h are to be used in preference to the ones here.
  */
 
 /* Allocate space for typed object. */
diff --git a/xen/include/xen/xvmalloc.h b/xen/include/xen/xvmalloc.h
new file mode 100644
index 0000000000..ab71a1e1a7
--- /dev/null
+++ b/xen/include/xen/xvmalloc.h
@@ -0,0 +1,75 @@
+#ifndef XEN__XVMALLOC_H
+#define XEN__XVMALLOC_H
+
+#include <xen/types.h>
+
+/*
+ * Xen malloc/free-style interface, as long as there's no need to have
+ * physically contiguous memory allocated.  These should be used in preference
+ * to xmalloc() et al.
+ */
+
+/* Allocate space for typed object. */
+#define xvmalloc(_type) ((_type *)_xvmalloc(sizeof(_type), __alignof__(_type)))
+#define xvzalloc(_type) ((_type *)_xvzalloc(sizeof(_type), __alignof__(_type)))
+
+/* Allocate space for a typed object and copy an existing instance. */
+#define xvmemdup(ptr)                                          \
+({                                                             \
+    void *p_ = _xvmalloc(sizeof(*(ptr)), __alignof__(*(ptr))); \
+    if ( p_ )                                                  \
+        memcpy(p_, ptr, sizeof(*(ptr)));                       \
+    (typeof(*(ptr)) *)p_;                                      \
+})
+
+/* Allocate space for array of typed objects. */
+#define xvmalloc_array(_type, _num) \
+    ((_type *)_xvmalloc_array(sizeof(_type), __alignof__(_type), _num))
+#define xvzalloc_array(_type, _num) \
+    ((_type *)_xvzalloc_array(sizeof(_type), __alignof__(_type), _num))
+
+/* Allocate space for a structure with a flexible array of typed objects. */
+#define xvzalloc_flex_struct(type, field, nr) \
+    ((type *)_xvzalloc(offsetof(type, field[nr]), __alignof__(type)))
+
+#define xvmalloc_flex_struct(type, field, nr) \
+    ((type *)_xvmalloc(offsetof(type, field[nr]), __alignof__(type)))
+
+/* Re-allocate space for a structure with a flexible array of typed objects. */
+#define xvrealloc_flex_struct(ptr, field, nr)                          \
+    ((typeof(ptr))_xvrealloc(ptr, offsetof(typeof(*(ptr)), field[nr]), \
+                             __alignof__(typeof(*(ptr)))))
+
+/* Free any of the above. */
+void xvfree(void *);
+
+/* Free an allocation, and zero the pointer to it. */
+#define XVFREE(p) do { \
+    xvfree(p);         \
+    (p) = NULL;        \
+} while ( false )
+
+/* Underlying functions */
+void *_xvmalloc(size_t size, unsigned int align);
+void *_xvzalloc(size_t size, unsigned int align);
+void *_xvrealloc(void *ptr, size_t size, unsigned int align);
+
+static inline void *_xvmalloc_array(
+    size_t size, unsigned int align, unsigned long num)
+{
+    /* Check for overflow. */
+    if ( size && num > UINT_MAX / size )
+        return NULL;
+    return _xvmalloc(size * num, align);
+}
+
+static inline void *_xvzalloc_array(
+    size_t size, unsigned int align, unsigned long num)
+{
+    /* Check for overflow. */
+    if ( size && num > UINT_MAX / size )
+        return NULL;
+    return _xvzalloc(size * num, align);
+}
+
+#endif /* XEN__XVMALLOC_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 14 06:55:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Aug 2024 06:55:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776764.1186927 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1se7un-0000Rt-9M; Wed, 14 Aug 2024 06:55:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776764.1186927; Wed, 14 Aug 2024 06:55: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 1se7un-0000Rl-6e; Wed, 14 Aug 2024 06:55:25 +0000
Received: by outflank-mailman (input) for mailman id 776764;
 Wed, 14 Aug 2024 06:55:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se7ul-0000RW-Jo
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 06:55:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se7ul-0001jF-Iy
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 06:55:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se7ul-000808-Hw
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 06:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZPhChmNPQdjpquWUrcHZWoBvW28cpBnoO+cUOuAwLlk=; b=W5xPF7OnhAx0JUvWFM8WGc1Sh/
	++7nj2RTZXybtvfdm5zO30p2vKPnC/FLQJl/l0M45IWcW6BNNqVeh82ivRb6f0iarOQXEMA24L5gZ
	dmWKSLrGHQh4/omSRiAem9ZJnjfWgCs+0xOIhaznSJWDJMXOy3aHyIQTSKvdOqRkvOdo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xl: fix incorrect output in "help" command
Message-Id: <E1se7ul-000808-Hw@xenbits.xenproject.org>
Date: Wed, 14 Aug 2024 06:55:23 +0000

commit 09226d165b57d919150458044c5b594d3d1dc23a
Author:     John E. Krokes <mag@netherworld.org>
AuthorDate: Wed Aug 14 08:49:44 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 14 08:49:44 2024 +0200

    xl: fix incorrect output in "help" command
    
    In "xl help", the output includes this line:
    
     vsnd-list           List virtual display devices for a domain
    
    This should obviously say "sound devices" instead of "display devices".
    
    Signed-off-by: John E. Krokes <mag@netherworld.org>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xl/xl_cmdtable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
index 42751228c1..53fc22d344 100644
--- a/tools/xl/xl_cmdtable.c
+++ b/tools/xl/xl_cmdtable.c
@@ -433,7 +433,7 @@ const struct cmd_spec cmd_table[] = {
     },
     { "vsnd-list",
       &main_vsndlist, 0, 0,
-      "List virtual display devices for a domain",
+      "List virtual sound devices for a domain",
       "<Domain(s)>",
     },
     { "vsnd-detach",
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 14 06:55:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Aug 2024 06:55:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776765.1186931 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1se7ux-0000UX-Ab; Wed, 14 Aug 2024 06:55:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776765.1186931; Wed, 14 Aug 2024 06:55: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 1se7ux-0000UP-82; Wed, 14 Aug 2024 06:55:35 +0000
Received: by outflank-mailman (input) for mailman id 776765;
 Wed, 14 Aug 2024 06:55:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se7uv-0000UD-NT
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 06:55:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se7uv-0001jj-M2
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 06:55:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se7uv-00080t-L5
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 06: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=H4xAEo2ksAqVhovim7TwjENys4kEZWzv3ANT0cptvYA=; b=l5ADA8bfiBAYPlLAbKD3LNijm2
	E+EgsE6GHyxKxGKeAlSxnKkjCbX0ukT1Ga/Fn1nrLut2wwY3TTk0cgsVw2KvgYrel6xRZHzInbY6v
	N+a/s+ygIdODHUR0Rmt8j4zBholoekNBLDqSjJ12SPcPU8EtSaqQYlCqdXL1rfwUxbhE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxl/disk: avoid aliasing of abs()
Message-Id: <E1se7uv-00080t-L5@xenbits.xenproject.org>
Date: Wed, 14 Aug 2024 06:55:33 +0000

commit a73f8d19445a70b72701a7a95b6c3e274168918a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Aug 14 08:50:14 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 14 08:50:14 2024 +0200

    libxl/disk: avoid aliasing of abs()
    
    Tool chains with -Wshadow enabled by default won't like the function
    parameter name "abs", for aliasing stdlib.h's abs(). Rename the
    parameter to what other similar functions use.
    
    Fixes: a18b50614d97 ("libxl: Enable stubdom cdrom changing")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/libs/light/libxl_disk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libs/light/libxl_disk.c b/tools/libs/light/libxl_disk.c
index da1d973bf5..15055380c6 100644
--- a/tools/libs/light/libxl_disk.c
+++ b/tools/libs/light/libxl_disk.c
@@ -935,7 +935,7 @@ static void cdrom_insert_stubdom_disk_add_cb(libxl__egc *egc,
                                              libxl__ao_device *aodev);
 static void cdrom_insert_stubdom_query_fdset(libxl__egc *egc,
                                              libxl__ev_time *ev,
-                                             const struct timeval *abs,
+                                             const struct timeval *requested_abs,
                                              int rc);
 static void cdrom_insert_stubdom_parse_fdset(libxl__egc *egc,
                                              libxl__ev_qmp *qmp,
@@ -1259,7 +1259,7 @@ static void cdrom_insert_stubdom_disk_add_cb(libxl__egc *egc,
 
 static void cdrom_insert_stubdom_query_fdset(libxl__egc *egc,
                                              libxl__ev_time *ev,
-                                             const struct timeval *abs,
+                                             const struct timeval *requested_abs,
                                              int rc)
 {
     EGC_GC;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 14 08:11:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Aug 2024 08:11:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776810.1186978 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1se95z-0006sR-Jp; Wed, 14 Aug 2024 08:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776810.1186978; Wed, 14 Aug 2024 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 1se95z-0006sJ-HE; Wed, 14 Aug 2024 08:11:03 +0000
Received: by outflank-mailman (input) for mailman id 776810;
 Wed, 14 Aug 2024 08:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se95y-0006sD-6C
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 08:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se95y-0003YE-2r
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 08:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se95y-0006fI-0t
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tYQyBQ2fo719ESzMKewOC1Z+kUdJxiGYL+kdsB7MRcs=; b=PySzmWgT9i8044Gd+uC41z05T2
	rim66HywPtsNKl7bQWB1uONc3UZRBbStN7mEGZVN5a8Vtpp4lCOm8bjcpyAQbE9EmYoSSO3n/E5PA
	5P8RzLp0E+tB7HUHgYTm84oRWZg5XMqRKu52ps+WwcQu3o20N8sFzUKA+kV6nQ9T91ME=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/IOMMU: move tracking in iommu_identity_mapping()
Message-Id: <E1se95y-0006fI-0t@xenbits.xenproject.org>
Date: Wed, 14 Aug 2024 08:11:02 +0000

commit c638866e99d28279a92879db6f2ae85f76a35ee6
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Tue Aug 13 16:50:32 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:50:32 2024 +0200

    x86/IOMMU: move tracking in iommu_identity_mapping()
    
    If for some reason xmalloc() fails after having mapped the reserved
    regions, an error is reported, but the regions remain mapped in the P2M.
    
    Similarly if an error occurs during set_identity_p2m_entry() (except on
    the first call), the partial mappings of the region would be retained
    without being tracked anywhere, and hence without there being a way to
    remove them again from the domain's P2M.
    
    Move the setting up of the list entry ahead of trying to map the region.
    In cases other than the first mapping failing, keep record of the full
    region, such that a subsequent unmapping request can be properly torn
    down.
    
    To compensate for the potentially excess unmapping requests, don't log a
    warning from p2m_remove_identity_entry() when there really was nothing
    mapped at a given GFN.
    
    This is XSA-460 / CVE-2024-31145.
    
    Fixes: 2201b67b9128 ("VT-d: improve RMRR region handling")
    Fixes: c0e19d7c6c42 ("IOMMU: generalize VT-d's tracking of mapped RMRR regions")
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: beadd68b5490ada053d72f8a9ce6fd696d626596
    master date: 2024-08-13 16:36:40 +0200
---
 xen/arch/x86/mm/p2m.c               |  8 +++++---
 xen/drivers/passthrough/x86/iommu.c | 30 +++++++++++++++++++++---------
 2 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 1fa9e01012..5014caa173 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1265,9 +1265,11 @@ int p2m_remove_identity_entry(struct domain *d, unsigned long gfn_l)
     else
     {
         gfn_unlock(p2m, gfn, 0);
-        printk(XENLOG_G_WARNING
-               "non-identity map d%d:%lx not cleared (mapped to %lx)\n",
-               d->domain_id, gfn_l, mfn_x(mfn));
+        if ( (p2mt != p2m_invalid && p2mt != p2m_mmio_dm) ||
+             a != p2m_access_n || !mfn_eq(mfn, INVALID_MFN) )
+           printk(XENLOG_G_WARNING
+                  "non-identity map %pd:%lx not cleared (mapped to %lx)\n",
+                  d, gfn_l, mfn_x(mfn));
         ret = 0;
     }
 
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index 22d67b4fd2..9cf0017a84 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -251,24 +251,36 @@ int iommu_identity_mapping(struct domain *d, p2m_access_t p2ma,
     if ( p2ma == p2m_access_x )
         return -ENOENT;
 
-    while ( base_pfn < end_pfn )
-    {
-        int err = set_identity_p2m_entry(d, base_pfn, p2ma, flag);
-
-        if ( err )
-            return err;
-        base_pfn++;
-    }
-
     map = xmalloc(struct identity_map);
     if ( !map )
         return -ENOMEM;
+
     map->base = base;
     map->end = end;
     map->access = p2ma;
     map->count = 1;
+
+    /*
+     * Insert into list ahead of mapping, so the range can be found when
+     * trying to clean up.
+     */
     list_add_tail(&map->list, &hd->arch.identity_maps);
 
+    for ( ; base_pfn < end_pfn; ++base_pfn )
+    {
+        int err = set_identity_p2m_entry(d, base_pfn, p2ma, flag);
+
+        if ( !err )
+            continue;
+
+        if ( (map->base >> PAGE_SHIFT_4K) == base_pfn )
+        {
+            list_del(&map->list);
+            xfree(map);
+        }
+        return err;
+    }
+
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Wed Aug 14 08:11:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Aug 2024 08:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.776811.1186982 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1se969-0006uF-La; Wed, 14 Aug 2024 08:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 776811.1186982; Wed, 14 Aug 2024 08: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 1se969-0006u6-Ig; Wed, 14 Aug 2024 08:11:13 +0000
Received: by outflank-mailman (input) for mailman id 776811;
 Wed, 14 Aug 2024 08:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se968-0006tu-8K
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 08:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se968-0003YL-6N
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 08:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1se968-0006g8-4w
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 08: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kC1Y85FLXOzA2NiF0WDTJoZjHOxUHoeqz60PyUFg9BU=; b=t4Nh8BCCT2HFZ6QsfiCtt5bCvY
	TCKPrhckenA/Ro9y0Be7ZtI4mhai/OkIboEEufQh311SN1EfU6L73nVqxSvqBOG3nNFaOFPs30uOH
	w+5oTsgXGYiuvFa3gE3tpYqJuVT/jbZ/Ec8KMGsy/l/egjDcqm+VN9rIiNs726iwdlWQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] x86/pass-through: documents as security-unsupported when sharing resources
Message-Id: <E1se968-0006g8-4w@xenbits.xenproject.org>
Date: Wed, 14 Aug 2024 08:11:12 +0000

commit f95a6b010b9a2633d5186f7a53e4607bbe56f618
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Aug 13 16:51:14 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:51:14 2024 +0200

    x86/pass-through: documents as security-unsupported when sharing resources
    
    When multiple devices share resources and one of them is to be passed
    through to a guest, security of the entire system and of respective
    guests individually cannot really be guaranteed without knowing
    internals of any of the involved guests.  Therefore such a configuration
    cannot really be security-supported, yet making that explicit was so far
    missing.
    
    This is XSA-461 / CVE-2024-31146.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    master commit: 9c94eda1e3790820699a6de3f6a7c959ecf30600
    master date: 2024-08-13 16:37:25 +0200
---
 SUPPORT.md | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index c94c9cfe8f..f039d12352 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -775,6 +775,11 @@ This feature is not security supported: see https://xenbits.xen.org/xsa/advisory
 
 Only systems using IOMMUs are supported.
 
+Passing through of devices sharing resources with another device is not
+security supported.  Such sharing could e.g. be the same line interrupt being
+used by multiple devices, one of which is to be passed through, or two such
+devices having memory BARs within the same 4k page.
+
 Not compatible with migration, populate-on-demand, altp2m,
 introspection, memory sharing, or memory paging.
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Wed Aug 14 09:11:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Aug 2024 09:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.777009.1187196 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seA24-0005WW-Mm; Wed, 14 Aug 2024 09:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 777009.1187196; Wed, 14 Aug 2024 09: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 1seA24-0005WM-K5; Wed, 14 Aug 2024 09:11:04 +0000
Received: by outflank-mailman (input) for mailman id 777009;
 Wed, 14 Aug 2024 09:11:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seA23-0005WG-E6
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 09:11:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seA23-0004bF-Bu
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 09:11:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seA23-0002T3-8Z
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 09:11: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FGKaf57STcsSTlG7OnLQFK7ST2ojvYnRy8Bv/IcecdI=; b=qYJwWUrM5S1uOpJVF5DYKYIq4F
	EtEjn9pW252f5fluayrsRuzAbvFN2BRtUQ3MlwnOmLBVTzjcKLAw2mTPoGb8E5I3N9bz9cnfn0ac/
	5IayDqB9NFcdI0qQO1Aqd5qOXjVS0u/Oln4wSH9uKnrgiPSGfnu4Suyx+ymR472zkk3o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] update Xen version to 4.17.5
Message-Id: <E1seA23-0002T3-8Z@xenbits.xenproject.org>
Date: Wed, 14 Aug 2024 09:11:03 +0000

commit 430ce6cd936546ad883ecd1c85ddea32d790604b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Aug 14 11:03:57 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 14 11:03:57 2024 +0200

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

diff --git a/xen/Makefile b/xen/Makefile
index dfb3686d3b..45f204865e 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    = 17
-export XEN_EXTRAVERSION ?= .5-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .5$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Wed Aug 14 13:44:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Aug 2024 13:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.777373.1187523 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seEIE-0002nR-Q2; Wed, 14 Aug 2024 13:44:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 777373.1187523; Wed, 14 Aug 2024 13: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 1seEIE-0002nH-NC; Wed, 14 Aug 2024 13:44:02 +0000
Received: by outflank-mailman (input) for mailman id 777373;
 Wed, 14 Aug 2024 13:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seEID-0002nB-Nz
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 13:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seEID-0001Qm-N1
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 13:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seEID-00037C-M7
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=F9D6/XV0vlKoqCnFGb6YFOIjwMagEfFQ+hmv5iQulls=; b=OWOpCF01852bR7f18FKg/W9etk
	7pIrWUnnkbpHarQbxJR/XmD7+nsZzH3sGPOIo8LIVQp1MHTOFdLZJLT8CU8siLN+QpjKDGEfQ8ES/
	LyyTTMCvuvY+r9UsLrherXHlz+47krF0WeqCrXY+mHwdk7SPihsD1PAcIXY0gSUn3dbw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/IOMMU: move tracking in iommu_identity_mapping()
Message-Id: <E1seEID-00037C-M7@xenbits.xenproject.org>
Date: Wed, 14 Aug 2024 13:44:01 +0000

commit 255d6518ce993cf1d11b5d34dcc3ec696f36f8e1
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Tue Aug 13 16:49:06 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:49:06 2024 +0200

    x86/IOMMU: move tracking in iommu_identity_mapping()
    
    If for some reason xmalloc() fails after having mapped the reserved
    regions, an error is reported, but the regions remain mapped in the P2M.
    
    Similarly if an error occurs during set_identity_p2m_entry() (except on
    the first call), the partial mappings of the region would be retained
    without being tracked anywhere, and hence without there being a way to
    remove them again from the domain's P2M.
    
    Move the setting up of the list entry ahead of trying to map the region.
    In cases other than the first mapping failing, keep record of the full
    region, such that a subsequent unmapping request can be properly torn
    down.
    
    To compensate for the potentially excess unmapping requests, don't log a
    warning from p2m_remove_identity_entry() when there really was nothing
    mapped at a given GFN.
    
    This is XSA-460 / CVE-2024-31145.
    
    Fixes: 2201b67b9128 ("VT-d: improve RMRR region handling")
    Fixes: c0e19d7c6c42 ("IOMMU: generalize VT-d's tracking of mapped RMRR regions")
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: beadd68b5490ada053d72f8a9ce6fd696d626596
    master date: 2024-08-13 16:36:40 +0200
---
 xen/arch/x86/mm/p2m.c               |  8 +++++---
 xen/drivers/passthrough/x86/iommu.c | 30 +++++++++++++++++++++---------
 2 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index 22ab1d606e..4d5a41898a 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1255,9 +1255,11 @@ int p2m_remove_identity_entry(struct domain *d, unsigned long gfn_l)
     else
     {
         gfn_unlock(p2m, gfn, 0);
-        printk(XENLOG_G_WARNING
-               "non-identity map d%d:%lx not cleared (mapped to %lx)\n",
-               d->domain_id, gfn_l, mfn_x(mfn));
+        if ( (p2mt != p2m_invalid && p2mt != p2m_mmio_dm) ||
+             a != p2m_access_n || !mfn_eq(mfn, INVALID_MFN) )
+           printk(XENLOG_G_WARNING
+                  "non-identity map %pd:%lx not cleared (mapped to %lx)\n",
+                  d, gfn_l, mfn_x(mfn));
         ret = 0;
     }
 
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index 857dccb6a4..c3f6d013e5 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -267,24 +267,36 @@ int iommu_identity_mapping(struct domain *d, p2m_access_t p2ma,
     if ( p2ma == p2m_access_x )
         return -ENOENT;
 
-    while ( base_pfn < end_pfn )
-    {
-        int err = set_identity_p2m_entry(d, base_pfn, p2ma, flag);
-
-        if ( err )
-            return err;
-        base_pfn++;
-    }
-
     map = xmalloc(struct identity_map);
     if ( !map )
         return -ENOMEM;
+
     map->base = base;
     map->end = end;
     map->access = p2ma;
     map->count = 1;
+
+    /*
+     * Insert into list ahead of mapping, so the range can be found when
+     * trying to clean up.
+     */
     list_add_tail(&map->list, &hd->arch.identity_maps);
 
+    for ( ; base_pfn < end_pfn; ++base_pfn )
+    {
+        int err = set_identity_p2m_entry(d, base_pfn, p2ma, flag);
+
+        if ( !err )
+            continue;
+
+        if ( (map->base >> PAGE_SHIFT_4K) == base_pfn )
+        {
+            list_del(&map->list);
+            xfree(map);
+        }
+        return err;
+    }
+
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Aug 14 13:44:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Aug 2024 13:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.777374.1187528 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seEIP-0002q7-TQ; Wed, 14 Aug 2024 13:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 777374.1187528; Wed, 14 Aug 2024 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 1seEIP-0002q2-Oh; Wed, 14 Aug 2024 13:44:13 +0000
Received: by outflank-mailman (input) for mailman id 777374;
 Wed, 14 Aug 2024 13:44:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seEIN-0002p1-RU
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 13:44:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seEIN-0001Qx-Px
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 13:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seEIN-00037n-P5
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=klRREkw/TVRcoFVGZYE+laze1zfHQNH5QA+1rEcGOBo=; b=PFVbgK2rnqUGe04TW7mcugRaKt
	NyQv2nlfSo//RW07/OXqT3BAnZjq+IHqWdc9jLiFKLz5r1LjC6OhS+uJIp65XyaNVoLfD06oxIHn/
	ZYLqHkvtZ9iYKKOCt39VZRfPxQ4dmr8Jji1u0f23KvaGd1fORV6BNXALtPzAWXBy0nc8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] x86/pass-through: documents as security-unsupported when sharing resources
Message-Id: <E1seEIN-00037n-P5@xenbits.xenproject.org>
Date: Wed, 14 Aug 2024 13:44:11 +0000

commit c70619e2b758f2c9c2c7a8683ab7897d01461cd0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Aug 13 16:49:45 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:49:45 2024 +0200

    x86/pass-through: documents as security-unsupported when sharing resources
    
    When multiple devices share resources and one of them is to be passed
    through to a guest, security of the entire system and of respective
    guests individually cannot really be guaranteed without knowing
    internals of any of the involved guests.  Therefore such a configuration
    cannot really be security-supported, yet making that explicit was so far
    missing.
    
    This is XSA-461 / CVE-2024-31146.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    master commit: 9c94eda1e3790820699a6de3f6a7c959ecf30600
    master date: 2024-08-13 16:37:25 +0200
---
 SUPPORT.md | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index 30ca5b15ed..b4715a65b5 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -804,6 +804,11 @@ This feature is not security supported: see https://xenbits.xen.org/xsa/advisory
 
 Only systems using IOMMUs are supported.
 
+Passing through of devices sharing resources with another device is not
+security supported.  Such sharing could e.g. be the same line interrupt being
+used by multiple devices, one of which is to be passed through, or two such
+devices having memory BARs within the same 4k page.
+
 Not compatible with migration, populate-on-demand, altp2m,
 introspection, memory sharing, or memory paging.
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Aug 14 13:44:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Aug 2024 13:44:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.777375.1187530 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seEIb-0002tn-T2; Wed, 14 Aug 2024 13:44:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 777375.1187530; Wed, 14 Aug 2024 13:44: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 1seEIb-0002tf-QK; Wed, 14 Aug 2024 13:44:25 +0000
Received: by outflank-mailman (input) for mailman id 777375;
 Wed, 14 Aug 2024 13:44:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seEIZ-0002tM-VT
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 13:44:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seEIZ-0001RB-Ul
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 13:44:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seEIZ-0003Hv-Tq
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 13:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pxn0lEkL0GBPFqFTeXncE9aIh1Lik0Y+J9meqTSyxh4=; b=OPslOn+17C9hZ1LAD46fEgwtJp
	UbgzkhkedXlkv9Oz/yXHMzOWelCaN+wLO5nxQF/okfnIKKsk0k8IED+Th8+7wG3IgaGjgmnVd0wA7
	P0GoN6S9BFb5aph6KPuRGrVC7okgNKe2JXGDXRCGeaTmttCdmSyCF0kxfxGaN/aWaGt0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/xstate: use xvzalloc() for save area allocation
Message-Id: <E1seEIZ-0003Hv-Tq@xenbits.xenproject.org>
Date: Wed, 14 Aug 2024 13:44:23 +0000

commit b12da0cc86ce383a9d13b8117fb6a53e3e34dc25
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Aug 14 15:38:14 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 14 15:38:14 2024 +0200

    x86/xstate: use xvzalloc() for save area allocation
    
    This is in preparation for the area size exceeding a page's worth of
    space, as will happen with AMX as well as Architectural LBR.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/xstate.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 5c4144d55e..1e1abfc029 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -8,6 +8,7 @@
 #include <xen/param.h>
 #include <xen/percpu.h>
 #include <xen/sched.h>
+#include <xen/xvmalloc.h>
 
 #include <asm/cpu-policy.h>
 #include <asm/current.h>
@@ -530,7 +531,7 @@ int xstate_alloc_save_area(struct vcpu *v)
 
     /* XSAVE/XRSTOR requires the save area be 64-byte-boundary aligned. */
     BUILD_BUG_ON(__alignof(*save_area) < 64);
-    save_area = _xzalloc(size, __alignof(*save_area));
+    save_area = _xvzalloc(size, __alignof(*save_area));
     if ( save_area == NULL )
         return -ENOMEM;
 
@@ -551,8 +552,7 @@ int xstate_alloc_save_area(struct vcpu *v)
 
 void xstate_free_save_area(struct vcpu *v)
 {
-    xfree(v->arch.xsave_area);
-    v->arch.xsave_area = NULL;
+    XVFREE(v->arch.xsave_area);
 }
 
 static bool valid_xcr0(uint64_t xcr0)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 14 13:44:36 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Aug 2024 13:44:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.777376.1187534 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seEIl-0002wr-UW; Wed, 14 Aug 2024 13:44:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 777376.1187534; Wed, 14 Aug 2024 13:44: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 1seEIl-0002wj-Rl; Wed, 14 Aug 2024 13:44:35 +0000
Received: by outflank-mailman (input) for mailman id 777376;
 Wed, 14 Aug 2024 13:44:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seEIk-0002wW-3N
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 13:44:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seEIk-0001Ra-2a
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 13:44:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seEIk-0003Ij-0r
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 13:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6Ve2EEIJvHrUN8ieuqyHaQwAaU0zcQfXbuNg0NJtop4=; b=bkxeJC97zwZdDlj/DC9i3ss+fO
	Qdri6f5H33x59fkbP9ojh6JfARQ0Xu5InJynwQKauzI5FHSjTDGCsigahufyDXZ+VPJ8qs6Fdr8pu
	cNWKnOwll8CyBIExSabqmTo1+RohNOY/5Uek4ij2YbPF+6EvAPbX7bOFsQAZEPuJvDqw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/spec-ctrl: initialize per-domain XPTI in spec_ctrl_init_domain()
Message-Id: <E1seEIk-0003Ij-0r@xenbits.xenproject.org>
Date: Wed, 14 Aug 2024 13:44:34 +0000

commit d18f8153be4c57e452495f468e2e22d2b749f07f
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Aug 14 15:39:26 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 14 15:39:26 2024 +0200

    x86/spec-ctrl: initialize per-domain XPTI in spec_ctrl_init_domain()
    
    XPTI being a speculation mitigation feels better to be initialized in
    spec_ctrl_init_domain().
    
    No functional change intended, although the call to spec_ctrl_init_domain() in
    arch_domain_create() needs to be moved ahead of pv_domain_initialise() for
    d->->arch.pv.xpti to be correctly set.
    
    Move it ahead of most of the initialization functions, since
    spec_ctrl_init_domain() doesn't depend on any member in the struct domain being
    set.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domain.c    | 4 ++--
 xen/arch/x86/pv/domain.c | 2 --
 xen/arch/x86/spec_ctrl.c | 4 ++++
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index d977ec71ca..89aad7e897 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -830,6 +830,8 @@ int arch_domain_create(struct domain *d,
         is_pv_domain(d) ? __HYPERVISOR_COMPAT_VIRT_START : ~0u;
 #endif
 
+    spec_ctrl_init_domain(d);
+
     if ( (rc = paging_domain_init(d)) != 0 )
         goto fail;
     paging_initialised = true;
@@ -896,8 +898,6 @@ int arch_domain_create(struct domain *d,
 
     d->arch.msr_relaxed = config->arch.misc_flags & XEN_X86_MSR_RELAXED;
 
-    spec_ctrl_init_domain(d);
-
     return 0;
 
  fail:
diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c
index 2a445bb17b..86b74fb372 100644
--- a/xen/arch/x86/pv/domain.c
+++ b/xen/arch/x86/pv/domain.c
@@ -383,8 +383,6 @@ int pv_domain_initialise(struct domain *d)
 
     d->arch.ctxt_switch = &pv_csw;
 
-    d->arch.pv.xpti = is_hardware_domain(d) ? opt_xpti_hwdom : opt_xpti_domu;
-
     if ( !is_pv_32bit_domain(d) && use_invpcid && cpu_has_pcid )
         switch ( ACCESS_ONCE(opt_pcid) )
         {
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 92405b8be7..75a4177a75 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -1748,6 +1748,10 @@ void spec_ctrl_init_domain(struct domain *d)
         (ibpb   ? SCF_entry_ibpb   : 0) |
         (bhb    ? SCF_entry_bhb    : 0) |
         0;
+
+    if ( pv )
+        d->arch.pv.xpti = is_hardware_domain(d) ? opt_xpti_hwdom
+                                                : opt_xpti_domu;
 }
 
 void __init init_speculation_mitigations(void)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 14 13:44:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Aug 2024 13:44:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.777377.1187538 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seEIv-0002zo-Vn; Wed, 14 Aug 2024 13:44:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 777377.1187538; Wed, 14 Aug 2024 13:44: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 1seEIv-0002zh-TD; Wed, 14 Aug 2024 13:44:45 +0000
Received: by outflank-mailman (input) for mailman id 777377;
 Wed, 14 Aug 2024 13:44:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seEIu-0002zb-6c
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 13:44:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seEIu-0001Rm-5u
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 13:44:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seEIu-0003Jp-4x
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 13:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=c8Bhmj0ahnv/it7VxTLHeJfHo3PAzYgJqSnuRSCqxpU=; b=MAWJ+uN9PPJZzk9kBuWRypELVE
	HlVsMygAP5Bk5BzAjAjfIgV2xuCFWwPAQVjA1rExvH3xD5a2qYIbq3ENIlbDp9MsYineg6JkJEOF5
	VKkwAFxNjvJG9pq5KHLspeesDcBMcj4pBpw+IlH8UTYtFjLkvXWGNplkmt/PtqRKaLFU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul: don't call ->read_segment() with x86_seg_none
Message-Id: <E1seEIu-0003Jp-4x@xenbits.xenproject.org>
Date: Wed, 14 Aug 2024 13:44:44 +0000

commit 5ed317c45d7323a6985797dc9a2d39d8c5df8201
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Aug 14 15:40:06 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 14 15:40:06 2024 +0200

    x86emul: don't call ->read_segment() with x86_seg_none
    
    LAR, LSL, VERR, and VERW emulation involve calling protmode_load_seg()
    with x86_seg_none. The fuzzer's read_segment() hook function has an
    assertion which triggers in this case. Calling the hook function,
    however, makes little sense for those insns, as there's no data to
    retrieve. Instead zero-filling the output structure is what properly
    corresponds to those insns being invoked with a NUL selector.
    
    While there also add a related comment at the VERR/VERW call site.
    
    Fixes: 06a3b8cd7ad2 ("x86emul: support LAR/LSL/VERR/VERW")
    Link: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=70918
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 9025382670..34b0b0fe73 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -839,7 +839,8 @@ protmode_load_seg(
         case x86_seg_tr:
             goto raise_exn;
         }
-        if ( !_amd_like(cp) || vcpu_has_nscb() || !ops->read_segment ||
+        if ( seg == x86_seg_none || !_amd_like(cp) || vcpu_has_nscb() ||
+             !ops->read_segment ||
              ops->read_segment(seg, sreg, ctxt) != X86EMUL_OKAY )
             memset(sreg, 0, sizeof(*sreg));
         else
@@ -2852,7 +2853,7 @@ x86_emulate(
                                             &sreg, ctxt, ops) )
             {
             case X86EMUL_OKAY:
-                if ( sreg.s &&
+                if ( sreg.s /* Excludes NUL selectors too. */ &&
                      ((modrm_reg & 1) ? ((sreg.type & 0xa) == 0x2)
                                       : ((sreg.type & 0xa) != 0x8)) )
                     _regs.eflags |= X86_EFLAGS_ZF;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 14 13:44:56 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Aug 2024 13:44:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.777378.1187542 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seEJ6-00032l-1G; Wed, 14 Aug 2024 13:44:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 777378.1187542; Wed, 14 Aug 2024 13:44:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seEJ5-00032a-Uf; Wed, 14 Aug 2024 13:44:55 +0000
Received: by outflank-mailman (input) for mailman id 777378;
 Wed, 14 Aug 2024 13:44:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seEJ4-00032C-AK
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 13:44:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seEJ4-0001S3-9X
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 13:44:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seEJ4-0003KQ-7v
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 13:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Pn6FsDQGXFSgzL9amVo/f5H7rERFIAK9Mv81ltXnMWY=; b=maNLd4jb3Q1Bv3TFYT1jDzrghd
	ojkJ7FAop3lcmmCxU49T6xh/Xp8rnNXnndnfsYaMz1Khlq7qDjzW9GXULtv5YCFMQaJRCXaprY10+
	38hiyqt1OwEH35zJfpVMc+LiSDW3uuXWU8ULt2Wi4z/Le9jGlC+aA3dVHOu7h2kNhv7s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xvmalloc: please Misra C:2012 Rule 8.2
Message-Id: <E1seEJ4-0003KQ-7v@xenbits.xenproject.org>
Date: Wed, 14 Aug 2024 13:44:54 +0000

commit cbe73b848286f1e6b855c0ba328d56e0014d19e6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Aug 14 15:40:30 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 14 15:40:30 2024 +0200

    xvmalloc: please Misra C:2012 Rule 8.2
    
    The cloning from xmalloc.h happened long before Misra work started in
    earnest, leading to the missing parameter name having been overlooked
    later on.
    
    Fixes: 9102fcd9579f ("mm: introduce xvmalloc() et al and use for grant table allocations")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/xen/xvmalloc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/xen/xvmalloc.h b/xen/include/xen/xvmalloc.h
index ab71a1e1a7..e1969c8596 100644
--- a/xen/include/xen/xvmalloc.h
+++ b/xen/include/xen/xvmalloc.h
@@ -41,7 +41,7 @@
                              __alignof__(typeof(*(ptr)))))
 
 /* Free any of the above. */
-void xvfree(void *);
+void xvfree(void *va);
 
 /* Free an allocation, and zero the pointer to it. */
 #define XVFREE(p) do { \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 14 13:55:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Aug 2024 13:55:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.777386.1187545 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seESu-0005Iu-Np; Wed, 14 Aug 2024 13:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 777386.1187545; Wed, 14 Aug 2024 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 1seESu-0005Im-LL; Wed, 14 Aug 2024 13:55:04 +0000
Received: by outflank-mailman (input) for mailman id 777386;
 Wed, 14 Aug 2024 13:55:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seESt-0005Ig-3j
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 13:55:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seESt-0001i2-25
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 13:55:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seESt-0003wm-11
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 13:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ewnop980y2paZP2QEaSJo2SVyY1UOemXF0zloagqdxA=; b=glByb5I24BdrxI+DlqeVP/hnRc
	M5pr2/7VmZFXCK3NFky3pMw2eRgtiM8EeszWvmQgI2bb0tHeiePwUIE2SNKtE5e/KCDvEqK2hlfNE
	BFxvxiCkT1VnL5av9N+5mm+8vl+iMKALPr6rAprZkQV/NJVoCm47wBV5L4pcM1Dkoymc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] update Xen version to 4.18.3
Message-Id: <E1seESt-0003wm-11@xenbits.xenproject.org>
Date: Wed, 14 Aug 2024 13:55:03 +0000

commit bd51e573a730efc569646379cd59ccba967cde97
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Aug 14 15:45:06 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 14 15:45:06 2024 +0200

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

diff --git a/xen/Makefile b/xen/Makefile
index 786ab61600..56000ae82c 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    = 18
-export XEN_EXTRAVERSION ?= .3-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .3$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Aug 14 16:33:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Aug 2024 16:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.777554.1187669 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seGvn-0002kB-F2; Wed, 14 Aug 2024 16:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 777554.1187669; Wed, 14 Aug 2024 16:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seGvn-0002k3-By; Wed, 14 Aug 2024 16:33:03 +0000
Received: by outflank-mailman (input) for mailman id 777554;
 Wed, 14 Aug 2024 16:33:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seGvl-0002jx-Fp
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 16:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seGvl-00050G-E5
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 16:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seGvl-00070u-CG
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jat51hEUvJ+J95VKsm5cGaxlvJ7nXWgBQ9+Tjt14tPA=; b=fmjAzjAVYfH3O/auaDjtyvAn35
	DZi44I3Z0JSlUMK03jUfsH+b6/fzgOd/UnCN3Pxwri1TQ0qPNaVXc/FJtZNA49/O+t35FjMCZk6Uq
	dpJZJGiEDwKig4GRnmp4GNOlRCCnIiB+JWxp0e1XGRdgbIdTU7GO8lgg/WWxNmoeCq78=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/IOMMU: move tracking in iommu_identity_mapping()
Message-Id: <E1seGvl-00070u-CG@xenbits.xenproject.org>
Date: Wed, 14 Aug 2024 16:33:01 +0000

commit c61d4264d26d1ffb26563bfb6dc2f0b06cd72128
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Tue Aug 13 16:47:19 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:47:19 2024 +0200

    x86/IOMMU: move tracking in iommu_identity_mapping()
    
    If for some reason xmalloc() fails after having mapped the reserved
    regions, an error is reported, but the regions remain mapped in the P2M.
    
    Similarly if an error occurs during set_identity_p2m_entry() (except on
    the first call), the partial mappings of the region would be retained
    without being tracked anywhere, and hence without there being a way to
    remove them again from the domain's P2M.
    
    Move the setting up of the list entry ahead of trying to map the region.
    In cases other than the first mapping failing, keep record of the full
    region, such that a subsequent unmapping request can be properly torn
    down.
    
    To compensate for the potentially excess unmapping requests, don't log a
    warning from p2m_remove_identity_entry() when there really was nothing
    mapped at a given GFN.
    
    This is XSA-460 / CVE-2024-31145.
    
    Fixes: 2201b67b9128 ("VT-d: improve RMRR region handling")
    Fixes: c0e19d7c6c42 ("IOMMU: generalize VT-d's tracking of mapped RMRR regions")
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: beadd68b5490ada053d72f8a9ce6fd696d626596
    master date: 2024-08-13 16:36:40 +0200
---
 xen/arch/x86/mm/p2m.c               |  8 +++++---
 xen/drivers/passthrough/x86/iommu.c | 30 +++++++++++++++++++++---------
 2 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index e7e327d6a6..1739133fc2 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1267,9 +1267,11 @@ int p2m_remove_identity_entry(struct domain *d, unsigned long gfn_l)
     else
     {
         gfn_unlock(p2m, gfn, 0);
-        printk(XENLOG_G_WARNING
-               "non-identity map d%d:%lx not cleared (mapped to %lx)\n",
-               d->domain_id, gfn_l, mfn_x(mfn));
+        if ( (p2mt != p2m_invalid && p2mt != p2m_mmio_dm) ||
+             a != p2m_access_n || !mfn_eq(mfn, INVALID_MFN) )
+           printk(XENLOG_G_WARNING
+                  "non-identity map %pd:%lx not cleared (mapped to %lx)\n",
+                  d, gfn_l, mfn_x(mfn));
         ret = 0;
     }
 
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index cc0062b027..8b1e0596b8 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -267,24 +267,36 @@ int iommu_identity_mapping(struct domain *d, p2m_access_t p2ma,
     if ( p2ma == p2m_access_x )
         return -ENOENT;
 
-    while ( base_pfn < end_pfn )
-    {
-        int err = set_identity_p2m_entry(d, base_pfn, p2ma, flag);
-
-        if ( err )
-            return err;
-        base_pfn++;
-    }
-
     map = xmalloc(struct identity_map);
     if ( !map )
         return -ENOMEM;
+
     map->base = base;
     map->end = end;
     map->access = p2ma;
     map->count = 1;
+
+    /*
+     * Insert into list ahead of mapping, so the range can be found when
+     * trying to clean up.
+     */
     list_add_tail(&map->list, &hd->arch.identity_maps);
 
+    for ( ; base_pfn < end_pfn; ++base_pfn )
+    {
+        int err = set_identity_p2m_entry(d, base_pfn, p2ma, flag);
+
+        if ( !err )
+            continue;
+
+        if ( (map->base >> PAGE_SHIFT_4K) == base_pfn )
+        {
+            list_del(&map->list);
+            xfree(map);
+        }
+        return err;
+    }
+
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Aug 14 16:33:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 14 Aug 2024 16:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.777555.1187674 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seGvx-0002mf-Hc; Wed, 14 Aug 2024 16:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 777555.1187674; Wed, 14 Aug 2024 16:33:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seGvx-0002mX-F5; Wed, 14 Aug 2024 16:33:13 +0000
Received: by outflank-mailman (input) for mailman id 777555;
 Wed, 14 Aug 2024 16:33:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seGvv-0002mJ-Hp
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 16:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seGvv-00050O-H5
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 16:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seGvv-00078u-GA
 for xen-changelog@lists.xenproject.org; Wed, 14 Aug 2024 16:33:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=r3J9X3v1EKIAGmJDdJvFtAKyzCfS9Ln2cU5KtCNKuVA=; b=ebW6GB/m5zrj8faU40wKevbqez
	3mCTC7niEeWGpbONBV/F+3zb50Iwlw0wp5Xv3hQxZrdh5+fOQz0BV6h3GDpJf5F1XUS8XM2HIOgdX
	7vqv/LJ+R/oaEWsK5+8a6IdJdOnS3Syaol6+hi1w4adykV8OIZmDX2ij4b7uD78WmB1s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] x86/pass-through: documents as security-unsupported when sharing resources
Message-Id: <E1seGvv-00078u-GA@xenbits.xenproject.org>
Date: Wed, 14 Aug 2024 16:33:11 +0000

commit 3e8a2217f211d49dd771f7918d72df057121109f
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Aug 13 16:48:13 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:48:13 2024 +0200

    x86/pass-through: documents as security-unsupported when sharing resources
    
    When multiple devices share resources and one of them is to be passed
    through to a guest, security of the entire system and of respective
    guests individually cannot really be guaranteed without knowing
    internals of any of the involved guests.  Therefore such a configuration
    cannot really be security-supported, yet making that explicit was so far
    missing.
    
    This is XSA-461 / CVE-2024-31146.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    master commit: 9c94eda1e3790820699a6de3f6a7c959ecf30600
    master date: 2024-08-13 16:37:25 +0200
---
 SUPPORT.md | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index 8b998d9bc7..1d8b38cbd0 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -841,6 +841,11 @@ This feature is not security supported: see https://xenbits.xen.org/xsa/advisory
 
 Only systems using IOMMUs are supported.
 
+Passing through of devices sharing resources with another device is not
+security supported.  Such sharing could e.g. be the same line interrupt being
+used by multiple devices, one of which is to be passed through, or two such
+devices having memory BARs within the same 4k page.
+
 Not compatible with migration, populate-on-demand, altp2m,
 introspection, memory sharing, or memory paging.
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Aug 15 03:55:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Aug 2024 03:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.777801.1187867 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seRZm-00021U-Rq; Thu, 15 Aug 2024 03:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 777801.1187867; Thu, 15 Aug 2024 03: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 1seRZm-00021N-PP; Thu, 15 Aug 2024 03:55:02 +0000
Received: by outflank-mailman (input) for mailman id 777801;
 Thu, 15 Aug 2024 03:55:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seRZl-00021H-HB
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 03:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seRZl-0000ml-9c
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 03:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seRZl-0000Qi-80
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 03: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kzs8HhRk8ZidRPDFNECtQwFmyscsvQT+S2AGOFqxf/s=; b=Ifed1yuWEBdp2I5XGTt7ltHSUq
	f2CyYypsIvMcxzXkW7HAt/aQa1LswrINBgOqNfCC2R267JaW69JMRcD9u/ZVXTAHC8HqWRd5+D854
	1FXpwZT00FGKSKm1azV051E6u+cFZEuXjUoHI1txkoeBCX+0pGwCBFy+6MdTAlTqj0rA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] update Xen version to 4.17.5
Message-Id: <E1seRZl-0000Qi-80@xenbits.xenproject.org>
Date: Thu, 15 Aug 2024 03:55:01 +0000

commit 430ce6cd936546ad883ecd1c85ddea32d790604b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Aug 14 11:03:57 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 14 11:03:57 2024 +0200

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

diff --git a/xen/Makefile b/xen/Makefile
index dfb3686d3b..45f204865e 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    = 17
-export XEN_EXTRAVERSION ?= .5-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .5$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Thu Aug 15 11:00:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Aug 2024 11:00:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778000.1188071 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seYD5-0003hf-HW; Thu, 15 Aug 2024 11:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778000.1188071; Thu, 15 Aug 2024 11: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 1seYD5-0003hX-En; Thu, 15 Aug 2024 11:00:03 +0000
Received: by outflank-mailman (input) for mailman id 778000;
 Thu, 15 Aug 2024 11:00:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seYD3-0003OS-Ml
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 11:00:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seYD3-0001QW-Iq
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 11:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seYD3-0006bc-GQ
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 11: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=s5kjZ4FUTk8trttYk2jJS3T6XXM4JMhfwwIHwgCQ3uE=; b=LlVr0G66+8jLNxCQSWpx+mOcc/
	Uchtt5LR3xY69ygG0cZDGPafWoqJK9Ew39QFOZGp9JpQAYhQLDgz7lFx4xy/7Q7tGQG+3AJa1TKVQ
	qJhYrZacuOALUleFtiaoEoOf5WvETPZqJh4pPO5IGND7ExIhrwrQFmZGmbNQaig95Ag0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] update Xen version to 4.18.3
Message-Id: <E1seYD3-0006bc-GQ@xenbits.xenproject.org>
Date: Thu, 15 Aug 2024 11:00:01 +0000

commit bd51e573a730efc569646379cd59ccba967cde97
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Aug 14 15:45:06 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 14 15:45:06 2024 +0200

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

diff --git a/xen/Makefile b/xen/Makefile
index 786ab61600..56000ae82c 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    = 18
-export XEN_EXTRAVERSION ?= .3-pre$(XEN_VENDORVERSION)
+export XEN_EXTRAVERSION ?= .3$(XEN_VENDORVERSION)
 export XEN_FULLVERSION   = $(XEN_VERSION).$(XEN_SUBVERSION)$(XEN_EXTRAVERSION)
 -include xen-version
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Aug 15 18:00:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Aug 2024 18:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778213.1188246 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seelW-0003v8-On; Thu, 15 Aug 2024 18:00:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778213.1188246; Thu, 15 Aug 2024 18: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 1seelW-0003ux-La; Thu, 15 Aug 2024 18:00:02 +0000
Received: by outflank-mailman (input) for mailman id 778213;
 Thu, 15 Aug 2024 18:00:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seelV-0003mW-PI
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:00:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seelV-00010I-N2
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seelV-0006z6-Kn
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iGSGxRrnqf3oiKQTwAoNt67LfHAZpHRcUdhq50w6OUY=; b=Z9es15XS7CgA+DoqqZOok/92w7
	2Gh04ScHGW7vRAyDLpWrW/WQ7DjPEWARetpj+ycM6JU4q+O+vplqpe3397Dse0tyfcuAmKu0BpVYx
	9o4OWnXXI4VMMxgD6+zLTmwnRkeR/Ri638kILvn8E6ETapW7umWlpj2D+EiiDVACUsiw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/IOMMU: move tracking in iommu_identity_mapping()
Message-Id: <E1seelV-0006z6-Kn@xenbits.xenproject.org>
Date: Thu, 15 Aug 2024 18:00:01 +0000

commit beadd68b5490ada053d72f8a9ce6fd696d626596
Author:     Teddy Astie <teddy.astie@vates.tech>
AuthorDate: Tue Aug 13 16:36:40 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:36:40 2024 +0200

    x86/IOMMU: move tracking in iommu_identity_mapping()
    
    If for some reason xmalloc() fails after having mapped the reserved
    regions, an error is reported, but the regions remain mapped in the P2M.
    
    Similarly if an error occurs during set_identity_p2m_entry() (except on
    the first call), the partial mappings of the region would be retained
    without being tracked anywhere, and hence without there being a way to
    remove them again from the domain's P2M.
    
    Move the setting up of the list entry ahead of trying to map the region.
    In cases other than the first mapping failing, keep record of the full
    region, such that a subsequent unmapping request can be properly torn
    down.
    
    To compensate for the potentially excess unmapping requests, don't log a
    warning from p2m_remove_identity_entry() when there really was nothing
    mapped at a given GFN.
    
    This is XSA-460 / CVE-2024-31145.
    
    Fixes: 2201b67b9128 ("VT-d: improve RMRR region handling")
    Fixes: c0e19d7c6c42 ("IOMMU: generalize VT-d's tracking of mapped RMRR regions")
    Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/mm/p2m.c               |  8 +++++---
 xen/drivers/passthrough/x86/iommu.c | 30 +++++++++++++++++++++---------
 2 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index e7e327d6a6..1739133fc2 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -1267,9 +1267,11 @@ int p2m_remove_identity_entry(struct domain *d, unsigned long gfn_l)
     else
     {
         gfn_unlock(p2m, gfn, 0);
-        printk(XENLOG_G_WARNING
-               "non-identity map d%d:%lx not cleared (mapped to %lx)\n",
-               d->domain_id, gfn_l, mfn_x(mfn));
+        if ( (p2mt != p2m_invalid && p2mt != p2m_mmio_dm) ||
+             a != p2m_access_n || !mfn_eq(mfn, INVALID_MFN) )
+           printk(XENLOG_G_WARNING
+                  "non-identity map %pd:%lx not cleared (mapped to %lx)\n",
+                  d, gfn_l, mfn_x(mfn));
         ret = 0;
     }
 
diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c
index cc0062b027..8b1e0596b8 100644
--- a/xen/drivers/passthrough/x86/iommu.c
+++ b/xen/drivers/passthrough/x86/iommu.c
@@ -267,24 +267,36 @@ int iommu_identity_mapping(struct domain *d, p2m_access_t p2ma,
     if ( p2ma == p2m_access_x )
         return -ENOENT;
 
-    while ( base_pfn < end_pfn )
-    {
-        int err = set_identity_p2m_entry(d, base_pfn, p2ma, flag);
-
-        if ( err )
-            return err;
-        base_pfn++;
-    }
-
     map = xmalloc(struct identity_map);
     if ( !map )
         return -ENOMEM;
+
     map->base = base;
     map->end = end;
     map->access = p2ma;
     map->count = 1;
+
+    /*
+     * Insert into list ahead of mapping, so the range can be found when
+     * trying to clean up.
+     */
     list_add_tail(&map->list, &hd->arch.identity_maps);
 
+    for ( ; base_pfn < end_pfn; ++base_pfn )
+    {
+        int err = set_identity_p2m_entry(d, base_pfn, p2ma, flag);
+
+        if ( !err )
+            continue;
+
+        if ( (map->base >> PAGE_SHIFT_4K) == base_pfn )
+        {
+            list_del(&map->list);
+            xfree(map);
+        }
+        return err;
+    }
+
     return 0;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 15 18:00:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Aug 2024 18:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778214.1188250 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seelg-0004dv-QA; Thu, 15 Aug 2024 18:00:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778214.1188250; Thu, 15 Aug 2024 18: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 1seelg-0004dm-N1; Thu, 15 Aug 2024 18:00:12 +0000
Received: by outflank-mailman (input) for mailman id 778214;
 Thu, 15 Aug 2024 18:00:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seelf-0004dV-Sx
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:00:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seelf-00014M-S6
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:00:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seelf-000714-PB
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:00:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=OrvI+ZtEbR0tA9Yg80UHeUbh4COK2C4a02kUx5uders=; b=LWV3nmyTj4x4flqe4ILNUtUFlv
	BhJi91dK11vPA8gEZ2I5FLBKpkIpbBDEzrapszEezP+ZuKjuWoFmEm3AV4J7N2ULGt2kUKfgn/SpJ
	GkU/NcGH0gi793IDtbSF8sevRXZtyGes8uOrnXs9D6FrygiwjvDmJ5a5CDeb9srN5rSw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pass-through: documents as security-unsupported when sharing resources
Message-Id: <E1seelf-000714-PB@xenbits.xenproject.org>
Date: Thu, 15 Aug 2024 18:00:11 +0000

commit 9c94eda1e3790820699a6de3f6a7c959ecf30600
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Aug 13 16:37:25 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:37:25 2024 +0200

    x86/pass-through: documents as security-unsupported when sharing resources
    
    When multiple devices share resources and one of them is to be passed
    through to a guest, security of the entire system and of respective
    guests individually cannot really be guaranteed without knowing
    internals of any of the involved guests.  Therefore such a configuration
    cannot really be security-supported, yet making that explicit was so far
    missing.
    
    This is XSA-461 / CVE-2024-31146.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 SUPPORT.md | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/SUPPORT.md b/SUPPORT.md
index 0c36cb2ed4..f822a7e607 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -842,6 +842,11 @@ This feature is not security supported: see https://xenbits.xen.org/xsa/advisory
 
 Only systems using IOMMUs are supported.
 
+Passing through of devices sharing resources with another device is not
+security supported.  Such sharing could e.g. be the same line interrupt being
+used by multiple devices, one of which is to be passed through, or two such
+devices having memory BARs within the same 4k page.
+
 Not compatible with migration, populate-on-demand, altp2m,
 introspection, memory sharing, or memory paging.
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 15 18:00:22 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Aug 2024 18:00:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778215.1188253 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seelq-0004g8-RC; Thu, 15 Aug 2024 18:00:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778215.1188253; Thu, 15 Aug 2024 18:00: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 1seelq-0004g0-OU; Thu, 15 Aug 2024 18:00:22 +0000
Received: by outflank-mailman (input) for mailman id 778215;
 Thu, 15 Aug 2024 18:00:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seelq-0004fq-2H
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:00:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seelq-00014X-0G
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:00:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seelp-00071x-UH
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CS17SGx89OhDIGib6bvi2CluqCXlCS4+4nl8ievSFcs=; b=KygZvtw1fSeRM45eMJ7/g0kUrM
	G8jcYnkiFiPaDDjh3lw09sAMZ7C7sd6plj7Ms3RHoiJCJ7jtjuzZnFqoujzHiMFDIkSOoJUeLafai
	tLJf82skq4TtGYm4Nn76fyDMV47xdltLLpU7+z4v/Cr8Fu5P87BIdKMJjxWAmXrNBAeY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: enable GENERIC_BUG_FRAME
Message-Id: <E1seelp-00071x-UH@xenbits.xenproject.org>
Date: Thu, 15 Aug 2024 18:00:21 +0000

commit a8d9b750458f7e91fbb8ab63b5b9341ffb6f6bed
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Aug 13 16:38:15 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:38:15 2024 +0200

    xen/riscv: enable GENERIC_BUG_FRAME
    
    Enable GENERIC_BUG_FRAME to support BUG(), WARN(), ASSERT,
    and run_in_exception_handler().
    
    "UNIMP" is used for BUG_INSTR, which, when macros from <xen/bug.h>
    are used, triggers an exception with the ILLEGAL_INSTRUCTION cause.
    This instruction is encoded as a 2-byte instruction when
    CONFIG_RISCV_ISA_C is enabled:
      ffffffffc0046ba0:       0000                    unimp
    and is encoded as a 4-byte instruction when CONFIG_RISCV_ISA_C
    ins't enabled:
      ffffffffc005a460:       c0001073                unimp
    
    Using 'ebreak' as BUG_INSTR does not guarantee proper handling of macros
    from <xen/bug.h>. If a debugger inserts a breakpoint (using the 'ebreak'
    instruction) at a location where Xen already uses 'ebreak', it
    creates ambiguity. Xen cannot distinguish whether the 'ebreak'
    instruction is inserted by the debugger or is part of Xen's own code.
    
    Remove BUG_INSN_32 and BUG_INSN_16 macros as they encode the ebreak
    instruction, which is no longer used for BUG_INSN.
    
    Update the comment above the definition of INS_LENGTH_MASK as instead of
    'ebreak' instruction 'unimp' instruction is used.
    
    <xen/lib.h> is included for the reason that panic() and printk() are
    used in common/bug.c and RISC-V fails if it is not included.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/Kconfig           |  1 +
 xen/arch/riscv/include/asm/bug.h |  8 +++-----
 xen/arch/riscv/traps.c           | 26 +++++++++++++++++++++++++-
 xen/common/bug.c                 |  1 +
 4 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
index b4b354a778..f531e96657 100644
--- a/xen/arch/riscv/Kconfig
+++ b/xen/arch/riscv/Kconfig
@@ -1,6 +1,7 @@
 config RISCV
 	def_bool y
 	select FUNCTION_ALIGNMENT_16B
+	select GENERIC_BUG_FRAME
 
 config RISCV_64
 	def_bool y
diff --git a/xen/arch/riscv/include/asm/bug.h b/xen/arch/riscv/include/asm/bug.h
index f5ff96140f..e3d41f411a 100644
--- a/xen/arch/riscv/include/asm/bug.h
+++ b/xen/arch/riscv/include/asm/bug.h
@@ -9,7 +9,7 @@
 
 #ifndef __ASSEMBLY__
 
-#define BUG_INSTR "ebreak"
+#define BUG_INSTR "unimp"
 
 /*
  * The base instruction set has a fixed length of 32-bit naturally aligned
@@ -18,15 +18,13 @@
  * There are extensions of variable length ( where each instruction can be
  * any number of 16-bit parcels in length ).
  *
- * Compressed ISA is used now where the instruction length is 16 bit  and
- * 'ebreak' instruction, in this case, can be either 16 or 32 bit (
+ * Compressed ISA is used now where the instruction length is 16 bit and
+ * 'unimp' instruction, in this case, can be either 16 or 32 bit (
  * depending on if compressed ISA is used or not )
  */
 #define INSN_LENGTH_MASK        _UL(0x3)
 #define INSN_LENGTH_32          _UL(0x3)
 
-#define BUG_INSN_32             _UL(0x00100073) /* ebreak */
-#define BUG_INSN_16             _UL(0x9002)     /* c.ebreak */
 #define COMPRESSED_INSN_MASK    _UL(0xffff)
 
 #define GET_INSN_LENGTH(insn)                               \
diff --git a/xen/arch/riscv/traps.c b/xen/arch/riscv/traps.c
index 7149504ebc..d55a4a827b 100644
--- a/xen/arch/riscv/traps.c
+++ b/xen/arch/riscv/traps.c
@@ -5,6 +5,8 @@
  * RISC-V Trap handlers
  */
 
+#include <xen/bug.h>
+#include <xen/compiler.h>
 #include <xen/lib.h>
 #include <xen/nospec.h>
 #include <xen/sched.h>
@@ -106,7 +108,29 @@ static void do_unexpected_trap(const struct cpu_user_regs *regs)
 
 void do_trap(struct cpu_user_regs *cpu_regs)
 {
-    do_unexpected_trap(cpu_regs);
+    register_t pc = cpu_regs->sepc;
+    unsigned long cause = csr_read(CSR_SCAUSE);
+
+    switch ( cause )
+    {
+    case CAUSE_ILLEGAL_INSTRUCTION:
+        if ( do_bug_frame(cpu_regs, pc) >= 0 )
+        {
+            if ( !(is_kernel_text(pc) || is_kernel_inittext(pc)) )
+            {
+                printk("Something wrong with PC: %#lx\n", pc);
+                die();
+            }
+
+            cpu_regs->sepc += GET_INSN_LENGTH(*(uint16_t *)pc);
+
+            break;
+        }
+        fallthrough;
+    default:
+        do_unexpected_trap(cpu_regs);
+        break;
+    }
 }
 
 void vcpu_show_execution_state(struct vcpu *v)
diff --git a/xen/common/bug.c b/xen/common/bug.c
index b7c5d8fd4d..75cb35fcfa 100644
--- a/xen/common/bug.c
+++ b/xen/common/bug.c
@@ -1,6 +1,7 @@
 #include <xen/bug.h>
 #include <xen/errno.h>
 #include <xen/kernel.h>
+#include <xen/lib.h>
 #include <xen/livepatch.h>
 #include <xen/string.h>
 #include <xen/types.h>
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 15 18:00:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Aug 2024 18:00:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778216.1188258 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seem1-0004ps-T3; Thu, 15 Aug 2024 18:00:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778216.1188258; Thu, 15 Aug 2024 18: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 1seem1-0004pM-QC; Thu, 15 Aug 2024 18:00:33 +0000
Received: by outflank-mailman (input) for mailman id 778216;
 Thu, 15 Aug 2024 18:00:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seem0-0004j4-4o
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:00:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seem0-00014f-45
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:00:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seem0-00072y-2R
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hOdnK2jVloIzsc3Qtb00LbBOKLTvKlVkT7U55mBAuKE=; b=eBVXMUzKA9qKibqT1N8xodMKip
	q7bKs3aS0czC6zZ8eCB103qyBKBmdQvW/9FVDAVqUiSRQfvRPYfczrdZCmVYpyzRfX0BXG0MBCfD8
	nF9ZGaz7uBvEakZHgeO+xVUOVePnP/hUUUPZKI/HiyRNO83Y7+GG5X9slOX508ViDmMw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vmx: guard access to cpu_has_vmx_* in common code
Message-Id: <E1seem0-00072y-2R@xenbits.xenproject.org>
Date: Thu, 15 Aug 2024 18:00:32 +0000

commit b2e8c8f42083afcac8b4720c50680d7c9eaaf90a
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Tue Aug 13 16:38:40 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:38:40 2024 +0200

    x86/vmx: guard access to cpu_has_vmx_* in common code
    
    There're several places in common code, outside of arch/x86/hvm/vmx,
    where cpu_has_vmx_* get accessed without checking whether VMX supported first.
    These macros rely on global variables defined in vmx code, so when VMX support
    is disabled accesses to these variables turn into build failures.
    
    To overcome these failures, build-time check is done before accessing global
    variables, so that DCE would remove these variables.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Paul Durrant <paul@xen.org>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/hvm/vmx/vmcs.h | 90 ++++++++++++++++++++++-----------
 1 file changed, 60 insertions(+), 30 deletions(-)

diff --git a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
index 58140af691..939b87eb50 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmcs.h
@@ -298,69 +298,99 @@ extern u64 vmx_ept_vpid_cap;
 #define VMX_TSC_MULTIPLIER_MAX                  0xffffffffffffffffULL
 
 #define cpu_has_wbinvd_exiting \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_WBINVD_EXITING)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_WBINVD_EXITING)
 #define cpu_has_vmx_virtualize_apic_accesses \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)
 #define cpu_has_vmx_tpr_shadow \
-    (vmx_cpu_based_exec_control & CPU_BASED_TPR_SHADOW)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_cpu_based_exec_control & CPU_BASED_TPR_SHADOW)
 #define cpu_has_vmx_vnmi \
-    (vmx_pin_based_exec_control & PIN_BASED_VIRTUAL_NMIS)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_pin_based_exec_control & PIN_BASED_VIRTUAL_NMIS)
 #define cpu_has_vmx_msr_bitmap \
-    (vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_MSR_BITMAP)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_MSR_BITMAP)
 #define cpu_has_vmx_secondary_exec_control \
-    (vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS)
 #define cpu_has_vmx_tertiary_exec_control \
-    (vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_TERTIARY_CONTROLS)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_cpu_based_exec_control & CPU_BASED_ACTIVATE_TERTIARY_CONTROLS)
 #define cpu_has_vmx_ept \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_EPT)
 #define cpu_has_vmx_dt_exiting \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_DESCRIPTOR_TABLE_EXITING)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_DESCRIPTOR_TABLE_EXITING)
 #define cpu_has_vmx_rdtscp \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_RDTSCP)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_RDTSCP)
 #define cpu_has_vmx_vpid \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VPID)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VPID)
 #define cpu_has_monitor_trap_flag \
-    (vmx_cpu_based_exec_control & CPU_BASED_MONITOR_TRAP_FLAG)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_cpu_based_exec_control & CPU_BASED_MONITOR_TRAP_FLAG)
 #define cpu_has_vmx_pat \
-    (vmx_vmentry_control & VM_ENTRY_LOAD_GUEST_PAT)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_vmentry_control & VM_ENTRY_LOAD_GUEST_PAT)
 #define cpu_has_vmx_efer \
-    (vmx_vmentry_control & VM_ENTRY_LOAD_GUEST_EFER)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_vmentry_control & VM_ENTRY_LOAD_GUEST_EFER)
 #define cpu_has_vmx_unrestricted_guest \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_UNRESTRICTED_GUEST)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_UNRESTRICTED_GUEST)
 #define vmx_unrestricted_guest(v)               \
     ((v)->arch.hvm.vmx.secondary_exec_control & \
      SECONDARY_EXEC_UNRESTRICTED_GUEST)
 #define cpu_has_vmx_ple \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_PAUSE_LOOP_EXITING)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_PAUSE_LOOP_EXITING)
 #define cpu_has_vmx_invpcid \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_INVPCID)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_INVPCID)
 #define cpu_has_vmx_apic_reg_virt \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_APIC_REGISTER_VIRT)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_APIC_REGISTER_VIRT)
 #define cpu_has_vmx_virtual_intr_delivery \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY)
 #define cpu_has_vmx_virtualize_x2apic_mode \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE)
 #define cpu_has_vmx_posted_intr_processing \
-    (vmx_pin_based_exec_control & PIN_BASED_POSTED_INTERRUPT)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_pin_based_exec_control & PIN_BASED_POSTED_INTERRUPT)
 #define cpu_has_vmx_vmcs_shadowing \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VMCS_SHADOWING)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VMCS_SHADOWING)
 #define cpu_has_vmx_vmfunc \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VM_FUNCTIONS)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VM_FUNCTIONS)
 #define cpu_has_vmx_virt_exceptions \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VIRT_EXCEPTIONS)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VIRT_EXCEPTIONS)
 #define cpu_has_vmx_pml \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_PML)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_PML)
 #define cpu_has_vmx_mpx \
-    ((vmx_vmexit_control & VM_EXIT_CLEAR_BNDCFGS) && \
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     (vmx_vmexit_control & VM_EXIT_CLEAR_BNDCFGS) && \
      (vmx_vmentry_control & VM_ENTRY_LOAD_BNDCFGS))
 #define cpu_has_vmx_xsaves \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_XSAVES)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_XSAVES)
 #define cpu_has_vmx_tsc_scaling \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_TSC_SCALING)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_TSC_SCALING)
 #define cpu_has_vmx_bus_lock_detection \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_BUS_LOCK_DETECTION)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_BUS_LOCK_DETECTION)
 #define cpu_has_vmx_notify_vm_exiting \
-    (vmx_secondary_exec_control & SECONDARY_EXEC_NOTIFY_VM_EXITING)
+    (IS_ENABLED(CONFIG_INTEL_VMX) && \
+     vmx_secondary_exec_control & SECONDARY_EXEC_NOTIFY_VM_EXITING)
 
 #define VMCS_RID_TYPE_MASK              0x80000000U
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 15 18:00:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Aug 2024 18:00:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778217.1188262 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seemB-00055g-UX; Thu, 15 Aug 2024 18:00:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778217.1188262; Thu, 15 Aug 2024 18: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 1seemB-00055Z-Rc; Thu, 15 Aug 2024 18:00:43 +0000
Received: by outflank-mailman (input) for mailman id 778217;
 Thu, 15 Aug 2024 18:00:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seemA-00055R-84
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:00:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seemA-00014p-78
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:00:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seemA-00073q-6D
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8AxLNUwHvW+Q7o/cpM0qFqdUWX0Al0f6cAk+MPccCLY=; b=pD0yX3OrLQhSImLnwyU6q8KoUp
	z9hgOl5Xjse2HT0X+K103Qu3pYQ+eOsOJgNrTQ4miKZJoNci78IxVV4Un/Hhj/DURiBEwNq7MPd8u
	/suxgEKINTPkfVITq3QLXIo5vNT1jrvY5iPvD8rxFZyFWRWF9fMbzzUNy5EObyezLDL0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/hvmloader: Fix non-deterministic cpuid()
Message-Id: <E1seemA-00073q-6D@xenbits.xenproject.org>
Date: Thu, 15 Aug 2024 18:00:42 +0000

commit cc47813c4a2c07a5c6c6a1491b98f3f8549835a7
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Tue Aug 13 16:39:10 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:39:10 2024 +0200

    tools/hvmloader: Fix non-deterministic cpuid()
    
    hvmloader's cpuid() implementation deviates from Xen's in that the value
    passed on ecx is unspecified. This means that when used on leaves that
    implement subleaves it's unspecified which one you get; though it's more
    than likely an invalid one.
    
    Import Xen's implementation so there are no surprises.
    
    Fixes: 318ac791f9f9 ("Add utilities needed for SMBIOS generation to hvmloader")
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/firmware/hvmloader/util.c |  9 ---------
 tools/firmware/hvmloader/util.h | 27 ++++++++++++++++++++++++---
 2 files changed, 24 insertions(+), 12 deletions(-)

diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c
index c34f077b38..d3b3f9038e 100644
--- a/tools/firmware/hvmloader/util.c
+++ b/tools/firmware/hvmloader/util.c
@@ -267,15 +267,6 @@ memcmp(const void *s1, const void *s2, unsigned n)
     return 0;
 }
 
-void
-cpuid(uint32_t idx, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
-{
-    asm volatile (
-        "cpuid"
-        : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
-        : "0" (idx) );
-}
-
 static const char hex_digits[] = "0123456789abcdef";
 
 /* Write a two-character hex representation of 'byte' to digits[].
diff --git a/tools/firmware/hvmloader/util.h b/tools/firmware/hvmloader/util.h
index deb823a892..17ed3783f2 100644
--- a/tools/firmware/hvmloader/util.h
+++ b/tools/firmware/hvmloader/util.h
@@ -184,9 +184,30 @@ int uart_exists(uint16_t uart_base);
 int lpt_exists(uint16_t lpt_base);
 int hpet_exists(unsigned long hpet_base);
 
-/* Do cpuid instruction, with operation 'idx' */
-void cpuid(uint32_t idx, uint32_t *eax, uint32_t *ebx,
-           uint32_t *ecx, uint32_t *edx);
+/* Some CPUID calls want 'count' to be placed in ecx */
+static inline void cpuid_count(
+    uint32_t leaf,
+    uint32_t subleaf,
+    uint32_t *eax,
+    uint32_t *ebx,
+    uint32_t *ecx,
+    uint32_t *edx)
+{
+    asm volatile ( "cpuid"
+                   : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
+                   : "a" (leaf), "c" (subleaf) );
+}
+
+/* Generic CPUID function (subleaf 0) */
+static inline void cpuid(
+    uint32_t leaf,
+    uint32_t *eax,
+    uint32_t *ebx,
+    uint32_t *ecx,
+    uint32_t *edx)
+{
+    cpuid_count(leaf, 0, eax, ebx, ecx, edx);
+}
 
 /* Read the TSC register. */
 static inline uint64_t rdtsc(void)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 15 18:00:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Aug 2024 18:00:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778218.1188266 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seemM-00058h-1x; Thu, 15 Aug 2024 18:00:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778218.1188266; Thu, 15 Aug 2024 18: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 1seemL-00058Z-VJ; Thu, 15 Aug 2024 18:00:53 +0000
Received: by outflank-mailman (input) for mailman id 778218;
 Thu, 15 Aug 2024 18:00:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seemK-00058D-B5
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:00:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seemK-00015C-AI
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:00:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seemK-00074n-9D
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mnUapjG+uDqZAQCBkDSHTO4jNRamcycZFfWpCfAzl2E=; b=JFz1BUmNGqqJnJ2UnI1KaommrU
	BpVa43Ee6cjciirBfHhiT+P/9y5mlEm6nDKEdaPA/mL1HDWt6hKGpnSTgh01e0jaPZ6TTBcvskrQM
	k8xDgoOGtGPnRf2Q95qp6xafIC0fuFmOqXYhxYF2kqgfb6IyspstzPOeXSksKZObIw5c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: enable CONFIG_HAS_DEVICE_TREE
Message-Id: <E1seemK-00074n-9D@xenbits.xenproject.org>
Date: Thu, 15 Aug 2024 18:00:52 +0000

commit 8fb49f2697f74886742096e84193c4c7496def4a
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Aug 13 16:39:43 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:39:43 2024 +0200

    xen/riscv: enable CONFIG_HAS_DEVICE_TREE
    
    Enable build of generic functionality for working with device
    tree for RISC-V.
    Also, a collection of functions for parsing memory map and other
    boot information from a device tree are available now.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
index f531e96657..259eea8d3b 100644
--- a/xen/arch/riscv/Kconfig
+++ b/xen/arch/riscv/Kconfig
@@ -2,6 +2,7 @@ config RISCV
 	def_bool y
 	select FUNCTION_ALIGNMENT_16B
 	select GENERIC_BUG_FRAME
+	select HAS_DEVICE_TREE
 
 config RISCV_64
 	def_bool y
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 15 18:01:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Aug 2024 18:01:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778219.1188269 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seemW-0005C1-2z; Thu, 15 Aug 2024 18:01:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778219.1188269; Thu, 15 Aug 2024 18: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 1seemW-0005Bt-0R; Thu, 15 Aug 2024 18:01:04 +0000
Received: by outflank-mailman (input) for mailman id 778219;
 Thu, 15 Aug 2024 18:01:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seemU-0005Bc-EE
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:01:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seemU-00015W-Dc
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:01:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seemU-000762-Cq
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=g0/kAmc7OvXxbQYWrw1EOU0lrrNRsVW0QLxkYiHunfw=; b=brSEP3lpkPTxHI0e2Ft5eOAAR0
	KBCWyWeB7WDPSg9z6LBfsW40acoPKEzdB4sKOgAb7e0hKfZIA2i1ZCSvCNzHi3xVupP/UJ356hEdd
	uox2Mkn7mbwxDM+KkVHSDLUpru5VYPKGHTKo9WGIr0llEYl0XdMEo1FirH0BIMfgB/cg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul: fix UB multiplications in S/G handling
Message-Id: <E1seemU-000762-Cq@xenbits.xenproject.org>
Date: Thu, 15 Aug 2024 18:01:02 +0000

commit 69e99b5d4b087cfe508b4776703c5a9380cfb6d8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Aug 13 16:41:25 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 13 16:41:25 2024 +0200

    x86emul: fix UB multiplications in S/G handling
    
    The conversion of the shifts to multiplications by the commits tagged
    below still wasn't quite right: The multiplications (of signed values)
    can overflow, too. As of 298556c7b5f8 ("x86emul: correct 32-bit address
    handling for AVX2 gathers") signed multiplication wasn't necessary
    anymore, though: The necessary sign-extension (if any) will happen as
    well when using intermediate variables of unsigned long types, and
    excess address bits are chopped off by truncate_ea().
    
    Fixes: b6a907f8c83d ("x86emul: replace UB shifts")
    Fixes: 21de9680eb59 ("x86emul: replace further UB shifts")
    Oss-fuzz: 71138
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index a0deafbd3b..9025382670 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6369,11 +6369,11 @@ x86_emulate(
         {
             if ( (vex.w ? mask.qw[i] : mask.dw[i]) < 0 )
             {
-                signed long idx = b & 1 ? index.qw[i] : index.dw[i];
+                unsigned long idx = b & 1 ? index.qw[i] : index.dw[i];
 
                 rc = ops->read(ea.mem.seg,
                                truncate_ea(ea.mem.off +
-                                           idx * (1 << state->sib_scale)),
+                                           (idx << state->sib_scale)),
                                (void *)mmvalp + i * op_bytes, op_bytes, ctxt);
                 if ( rc != X86EMUL_OKAY )
                 {
@@ -6489,14 +6489,14 @@ x86_emulate(
 
         for ( i = 0; op_mask; ++i )
         {
-            long idx = b & 1 ? index.qw[i] : index.dw[i];
+            unsigned long idx = b & 1 ? index.qw[i] : index.dw[i];
 
             if ( !(op_mask & (1 << i)) )
                 continue;
 
             rc = ops->read(ea.mem.seg,
                            truncate_ea(ea.mem.off +
-                                       idx * (1 << state->sib_scale)),
+                                       (idx << state->sib_scale)),
                            (void *)mmvalp + i * op_bytes, op_bytes, ctxt);
             if ( rc != X86EMUL_OKAY )
             {
@@ -6643,9 +6643,9 @@ x86_emulate(
 
         for ( i = 0; op_mask; ++i )
         {
-            long idx = (b & 1 ? index.qw[i]
-                              : index.dw[i]) * (1 << state->sib_scale);
-            unsigned long offs = truncate_ea(ea.mem.off + idx);
+            unsigned long idx = b & 1 ? index.qw[i] : index.dw[i];
+            unsigned long offs = truncate_ea(ea.mem.off +
+                                             (idx << state->sib_scale));
             unsigned int j, slot;
 
             if ( !(op_mask & (1 << i)) )
@@ -6663,11 +6663,10 @@ x86_emulate(
              */
             for ( j = (slot = i) + 1; j < n; ++j )
             {
-                long idx2 = (b & 1 ? index.qw[j]
-                                   : index.dw[j]) * (1 << state->sib_scale);
-
+                idx = b & 1 ? index.qw[j] : index.dw[j];
                 if ( (op_mask & (1 << j)) &&
-                     truncate_ea(ea.mem.off + idx2) == offs )
+                     truncate_ea(ea.mem.off +
+                                 (idx << state->sib_scale)) == offs )
                     slot = j;
             }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 15 18:01:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Aug 2024 18:01:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778220.1188273 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seemg-0005Ef-4Q; Thu, 15 Aug 2024 18:01:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778220.1188273; Thu, 15 Aug 2024 18: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 1seemg-0005EX-1u; Thu, 15 Aug 2024 18:01:14 +0000
Received: by outflank-mailman (input) for mailman id 778220;
 Thu, 15 Aug 2024 18:01:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seeme-0005EN-Ik
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:01:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seeme-00015d-HI
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:01:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seeme-000770-Fl
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9hj8OlX4uqzzJFknQ3ceJFC4tGxZeVRLDW6mQYnQSNQ=; b=ZiMzbRmPDzSo8nS8jfc7vS5CQl
	z9FlPzOfTX0NfUBi2mQudI+yWXYThWiy7qz9zqLyRooG/+p0skoTlHbfg2+LU7U76r1eCuTigiPJz
	pAX7isZUpdibSFMXEuyNVFHsBhowmPZmRlM7+41p0CItUs4wf0vYrEwwwZw1exarPM3Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Arm: correct FIXADDR_TOP
Message-Id: <E1seeme-000770-Fl@xenbits.xenproject.org>
Date: Thu, 15 Aug 2024 18:01:12 +0000

commit fe3412ab83cc53c2bf2c497be3794bc09751efa5
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Aug 13 13:49:39 2024 +0200
Commit:     Julien Grall <julien@xen.org>
CommitDate: Tue Aug 13 21:50:55 2024 +0100

    Arm: correct FIXADDR_TOP
    
    While reviewing a RISC-V patch cloning the Arm code, I noticed an
    off-by-1 here: FIX_PMAP_{BEGIN,END} being an inclusive range and
    FIX_LAST being the same as FIX_PMAP_END, FIXADDR_TOP cannot derive from
    FIX_LAST alone, or else the BUG_ON() in virt_to_fix() would trigger if
    FIX_PMAP_END ended up being used.
    
    While touching this area also add a check for fixmap and boot FDT area
    to not only not overlap, but to have at least one (unmapped) page in
    between.
    
    Fixes: 4f17357b52f6 ("xen/arm: add Persistent Map (PMAP) infrastructure")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/include/asm/fixmap.h | 2 +-
 xen/arch/arm/mmu/setup.c          | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/include/asm/fixmap.h b/xen/arch/arm/include/asm/fixmap.h
index a823456ecb..0cb5d54d1c 100644
--- a/xen/arch/arm/include/asm/fixmap.h
+++ b/xen/arch/arm/include/asm/fixmap.h
@@ -18,7 +18,7 @@
 #define FIX_LAST FIX_PMAP_END
 
 #define FIXADDR_START FIXMAP_ADDR(0)
-#define FIXADDR_TOP FIXMAP_ADDR(FIX_LAST)
+#define FIXADDR_TOP FIXMAP_ADDR(FIX_LAST + 1)
 
 #ifndef __ASSEMBLY__
 
diff --git a/xen/arch/arm/mmu/setup.c b/xen/arch/arm/mmu/setup.c
index f4bb424c3c..57042ed57b 100644
--- a/xen/arch/arm/mmu/setup.c
+++ b/xen/arch/arm/mmu/setup.c
@@ -128,6 +128,12 @@ static void __init __maybe_unused build_assertions(void)
 
 #undef CHECK_SAME_SLOT
 #undef CHECK_DIFFERENT_SLOT
+
+    /*
+     * Fixmaps must not overlap with boot FDT mapping area. Make sure there's
+     * at least one guard page in between.
+     */
+    BUILD_BUG_ON(FIXADDR_TOP >= BOOT_FDT_VIRT_START);
 }
 
 lpae_t __init pte_of_xenaddr(vaddr_t va)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 15 18:01:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Aug 2024 18:01:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778221.1188279 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seemq-0005HH-6W; Thu, 15 Aug 2024 18:01:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778221.1188279; Thu, 15 Aug 2024 18: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 1seemq-0005H9-3I; Thu, 15 Aug 2024 18:01:24 +0000
Received: by outflank-mailman (input) for mailman id 778221;
 Thu, 15 Aug 2024 18:01:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seemo-0005Gv-L7
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:01:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seemo-00015k-KN
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:01:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seemo-00078C-JU
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=y9ZAHlPs0L7p3yY2OrouBHD/DIKHiF+JWg8rQaHZ9J0=; b=xiVqLyrWmbKpDfOuqlsW5f8lC1
	kgtutcbkFYa8xtXUlg2mGUh+r6qcdLipGBtb1diJ3xLmBpf5gxpCWjw2eTbboYAueKC8OZMfcYZ+k
	+c627WzLJ+Lzd3pn/P0ElTjoK6qTPRno49XD3QwLN2kSGsYXk3dELsLyfaupsnD2T/cA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: smmuv3: Mark more init-only functions with __init
Message-Id: <E1seemo-00078C-JU@xenbits.xenproject.org>
Date: Thu, 15 Aug 2024 18:01:22 +0000

commit 8fc1b356afb396d9113b10b29f3becadbe66c706
Author:     Edgar E. Iglesias <edgar.iglesias@amd.com>
AuthorDate: Wed May 22 15:28:29 2024 +0200
Commit:     Julien Grall <julien@xen.org>
CommitDate: Tue Aug 13 21:53:41 2024 +0100

    xen/arm: smmuv3: Mark more init-only functions with __init
    
    Move more functions that are only called at init to
    the .init.text section.
    
    Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Rahul Singh <rahul.singh@arm.com>
    Tested-by: Rahul Singh <rahul.singh@arm.com>
---
 xen/drivers/passthrough/arm/smmu-v3.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/xen/drivers/passthrough/arm/smmu-v3.c b/xen/drivers/passthrough/arm/smmu-v3.c
index 6904962467..cee5724022 100644
--- a/xen/drivers/passthrough/arm/smmu-v3.c
+++ b/xen/drivers/passthrough/arm/smmu-v3.c
@@ -1545,7 +1545,7 @@ static int arm_smmu_dt_xlate(struct device *dev,
 }
 
 /* Probing and initialisation functions */
-static int arm_smmu_init_one_queue(struct arm_smmu_device *smmu,
+static int __init arm_smmu_init_one_queue(struct arm_smmu_device *smmu,
 				   struct arm_smmu_queue *q,
 				   void __iomem *page,
 				   unsigned long prod_off,
@@ -1588,7 +1588,7 @@ static int arm_smmu_init_one_queue(struct arm_smmu_device *smmu,
 	return 0;
 }
 
-static int arm_smmu_init_queues(struct arm_smmu_device *smmu)
+static int __init arm_smmu_init_queues(struct arm_smmu_device *smmu)
 {
 	int ret;
 
@@ -1724,7 +1724,7 @@ static int arm_smmu_init_strtab(struct arm_smmu_device *smmu)
 	return 0;
 }
 
-static int arm_smmu_init_structures(struct arm_smmu_device *smmu)
+static int __init arm_smmu_init_structures(struct arm_smmu_device *smmu)
 {
 	int ret;
 
@@ -1746,7 +1746,8 @@ static int arm_smmu_write_reg_sync(struct arm_smmu_device *smmu, u32 val,
 }
 
 /* GBPA is "special" */
-static int arm_smmu_update_gbpa(struct arm_smmu_device *smmu, u32 set, u32 clr)
+static int __init arm_smmu_update_gbpa(struct arm_smmu_device *smmu,
+                                       u32 set, u32 clr)
 {
 	int ret;
 	u32 reg, __iomem *gbpa = smmu->base + ARM_SMMU_GBPA;
@@ -1842,7 +1843,7 @@ static void arm_smmu_setup_msis(struct arm_smmu_device *smmu)
 static inline void arm_smmu_setup_msis(struct arm_smmu_device *smmu) { }
 #endif /* CONFIG_MSI */
 
-static void arm_smmu_free_irqs(struct arm_smmu_device *smmu)
+static void __init arm_smmu_free_irqs(struct arm_smmu_device *smmu)
 {
 	int irq;
 
@@ -1926,7 +1927,7 @@ err_free_evtq_irq:
 	return ret;
 }
 
-static int arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
+static int __init arm_smmu_setup_irqs(struct arm_smmu_device *smmu)
 {
 	int ret, irq;
 	u32 irqen_flags = IRQ_CTRL_EVTQ_IRQEN | IRQ_CTRL_GERROR_IRQEN;
@@ -1988,7 +1989,7 @@ static int arm_smmu_device_disable(struct arm_smmu_device *smmu)
 	return ret;
 }
 
-static int arm_smmu_device_reset(struct arm_smmu_device *smmu)
+static int __init arm_smmu_device_reset(struct arm_smmu_device *smmu)
 {
 	int ret;
 	u32 reg, enables;
@@ -2405,7 +2406,7 @@ static void arm_smmu_free_structures(struct arm_smmu_device *smmu)
 		xfree(smmu->strtab_cfg.l1_desc);
 }
 
-static int arm_smmu_device_probe(struct platform_device *pdev)
+static int __init arm_smmu_device_probe(struct platform_device *pdev)
 {
 	int irq, ret;
 	paddr_t ioaddr, iosize;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 15 18:01:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Aug 2024 18:01:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778222.1188281 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seen0-0005Jy-7O; Thu, 15 Aug 2024 18:01:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778222.1188281; Thu, 15 Aug 2024 18: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 1seen0-0005Js-4l; Thu, 15 Aug 2024 18:01:34 +0000
Received: by outflank-mailman (input) for mailman id 778222;
 Thu, 15 Aug 2024 18:01:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seemy-0005Jg-Nv
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:01:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seemy-00015t-NF
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:01:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seemy-00079J-MP
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5ak2UJHP1xP5+UL5q9zkXUhoBOQVxyePe6hLSLZi0fI=; b=aDwyRQPEPQ2ddbLSCOUBQFdrK3
	bycMWzf5S3v2D/VTLB5Emok3ol8hCyJ5zSuLbxg5tzztW2LOpEa3GfH6mGwSvDY4rIEDb8CHZa0IT
	dKU8r7DtvOpE4Ys6mJ34b5iI/OL3DdQctQ2p/f2I8JbLo2/JoLYL1C2wlZnkcgt3P6B0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm64: entry: Actually skip do_trap_*() when an SError is triggered
Message-Id: <E1seemy-00079J-MP@xenbits.xenproject.org>
Date: Thu, 15 Aug 2024 18:01:32 +0000

commit 35c64c3dce01c2d0689a8c13240bf48a10cef783
Author:     Julien Grall <jgrall@amazon.com>
AuthorDate: Tue Aug 6 13:48:15 2024 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Tue Aug 13 21:58:24 2024 +0100

    xen/arm64: entry: Actually skip do_trap_*() when an SError is triggered
    
    For SErrors, we support two configurations:
      * Every SErrors will result to a panic in Xen
      * We will forward SErrors triggered by a VM back to itself
    
    For the latter case, we want to skip the call to do_trap_*() because the PC
    was already adjusted.
    
    However, the alternative used to decide between the two configurations
    is inverted. This would result to the VM corrupting itself if:
      * x19 is non-zero in the panic case
      * advance PC too much in the second case
    
    Solve the issue by switch from alternative_if to alternative_if_not.
    
    Fixes: a458d3bd0d25 ("xen/arm: entry: Ensure the guest state is synced when receiving a vSError")
    Signed-off-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/arm64/entry.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/arm64/entry.S b/xen/arch/arm/arm64/entry.S
index 6251135ebd..fab10f8a0d 100644
--- a/xen/arch/arm/arm64/entry.S
+++ b/xen/arch/arm/arm64/entry.S
@@ -259,7 +259,7 @@
          * apart. The easiest way is to duplicate the few instructions
          * that need to be skipped.
          */
-        alternative_if SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT
+        alternative_if_not SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT
         cbnz      x19, 1f
         mov       x0, sp
         bl        do_trap_\trap
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 15 18:01:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Aug 2024 18:01:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778223.1188286 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seenA-0005Mg-90; Thu, 15 Aug 2024 18:01:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778223.1188286; Thu, 15 Aug 2024 18: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 1seenA-0005MY-69; Thu, 15 Aug 2024 18:01:44 +0000
Received: by outflank-mailman (input) for mailman id 778223;
 Thu, 15 Aug 2024 18:01:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seen8-0005MO-Qw
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:01:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seen8-000160-QH
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:01:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seen8-0007AL-PV
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5xQ8BKnY9JpZvjDBw91cy4B0/NbUevQUd/m/yoBpjrs=; b=V+N86tb0DM9SGDVjBn6fsigy9B
	CaKJLL7jeyYwwU0Ux6JIeH5RearuU+LodaQsNsui++/ka6JN+eiJDjgYxmaoseDlvuuKiInPlVSiS
	s+y2S+eREdLDDH8bo5knQq7CmIlZy2T0DphK7UrsTFE2eGNnaNCd9tkHqHpqDUBOYAJc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: use expect to run QEMU
Message-Id: <E1seen8-0007AL-PV@xenbits.xenproject.org>
Date: Thu, 15 Aug 2024 18:01:42 +0000

commit c36efb7fcea6ef9f31a20e60ec79ed3ae293feee
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Aug 9 23:59:20 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Aug 13 16:05:05 2024 -0700

    automation: use expect to run QEMU
    
    Use expect to invoke QEMU so that we can terminate the test as soon as
    we get the right string in the output instead of waiting until the
    final timeout.
    
    For timeout, instead of an hardcoding the value, use a Gitlab CI
    variable "QEMU_TIMEOUT" that can be changed depending on the latest
    status of the Gitlab CI runners.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 automation/scripts/qemu-alpine-x86_64.sh        | 16 ++++-----
 automation/scripts/qemu-key.exp                 | 45 +++++++++++++++++++++++++
 automation/scripts/qemu-smoke-dom0-arm32.sh     | 16 ++++-----
 automation/scripts/qemu-smoke-dom0-arm64.sh     | 16 ++++-----
 automation/scripts/qemu-smoke-dom0less-arm32.sh | 18 +++++-----
 automation/scripts/qemu-smoke-dom0less-arm64.sh | 16 ++++-----
 automation/scripts/qemu-smoke-ppc64le.sh        | 13 ++++---
 automation/scripts/qemu-smoke-riscv64.sh        | 13 ++++---
 automation/scripts/qemu-smoke-x86-64.sh         | 15 +++++----
 automation/scripts/qemu-xtf-dom0less-arm64.sh   | 15 ++++-----
 10 files changed, 112 insertions(+), 71 deletions(-)

diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index 8e398dcea3..5359e0820b 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -77,18 +77,16 @@ EOF
 # Run the test
 rm -f smoke.serial
 set +e
-timeout -k 1 720 \
-qemu-system-x86_64 \
+export QEMU_CMD="qemu-system-x86_64 \
     -cpu qemu64,+svm \
     -m 2G -smp 2 \
     -monitor none -serial stdio \
     -nographic \
     -device virtio-net-pci,netdev=n0 \
-    -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0 |& \
-        # Remove carriage returns from the stdout output, as gitlab
-        # interface chokes on them
-        tee smoke.serial | sed 's/\r//'
+    -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0"
 
-set -e
-(grep -q "Domain-0" smoke.serial && grep -q "BusyBox" smoke.serial) || exit 1
-exit 0
+export QEMU_LOG="smoke.serial"
+export LOG_MSG="Domain-0"
+export PASSED="BusyBox"
+
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-key.exp b/automation/scripts/qemu-key.exp
new file mode 100755
index 0000000000..35eb903a31
--- /dev/null
+++ b/automation/scripts/qemu-key.exp
@@ -0,0 +1,45 @@
+#!/usr/bin/expect -f
+
+set timeout $env(QEMU_TIMEOUT)
+
+log_file -a $env(QEMU_LOG)
+
+match_max 10000
+
+eval spawn $env(QEMU_CMD)
+
+expect_after {
+    -re "(.*)\r" {
+        exp_continue
+    }
+    timeout {send_error "ERROR-Timeout!\n"; exit 1}
+    eof {send_error "ERROR-EOF!\n"; exit 1}
+}
+
+if {[info exists env(UBOOT_CMD)]} {
+    expect "=>"
+
+    send "$env(UBOOT_CMD)\r"
+}
+
+if {[info exists env(LOG_MSG)]} {
+    expect {
+        "$env(PASSED)" {
+            expect "$env(LOG_MSG)"
+            exit 0
+        }
+        "$env(LOG_MSG)" {
+            expect "$env(PASSED)"
+            exit 0
+        }
+    }
+}
+
+expect {
+    "$env(PASSED)" {
+        exit 0
+    }
+}
+
+expect eof
+
diff --git a/automation/scripts/qemu-smoke-dom0-arm32.sh b/automation/scripts/qemu-smoke-dom0-arm32.sh
index eaaea5a982..bbdcb39f1a 100755
--- a/automation/scripts/qemu-smoke-dom0-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm32.sh
@@ -78,9 +78,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 
 rm -f ${serial_log}
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 720 \
-./qemu-system-arm \
+export QEMU_CMD="./qemu-system-arm \
    -machine virt \
    -machine virtualization=true \
    -smp 4 \
@@ -91,9 +89,11 @@ timeout -k 1 720 \
    -no-reboot \
    -device virtio-net-pci,netdev=n0 \
    -netdev user,id=n0,tftp=./ \
-   -bios /usr/lib/u-boot/qemu_arm/u-boot.bin |& \
-      tee ${serial_log} | sed 's/\r//'
+   -bios /usr/lib/u-boot/qemu_arm/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="${serial_log}"
+export LOG_MSG="Domain-0"
+export PASSED="/ #"
 
-set -e
-(grep -q "Domain-0" ${serial_log} && grep -q "^/ #" ${serial_log}) || exit 1
-exit 0
+../automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
index 352963a741..0094bfc8e1 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -94,9 +94,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 # Run the test
 rm -f smoke.serial
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 720 \
-./binaries/qemu-system-aarch64 \
+export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
     -m 2048 -monitor none -serial stdio \
@@ -104,9 +102,11 @@ timeout -k 1 720 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& \
-        tee smoke.serial | sed 's/\r//'
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="smoke.serial"
+export LOG_MSG="Domain-0"
+export PASSED="BusyBox"
 
-set -e
-(grep -q "Domain-0" smoke.serial && grep -q "BusyBox" smoke.serial) || exit 1
-exit 0
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
index c027c8c5c8..68ffbabdb8 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -5,7 +5,7 @@ set -ex
 test_variant=$1
 
 # Prompt to grep for to check if dom0 booted successfully
-dom0_prompt="^/ #"
+dom0_prompt="/ #"
 
 serial_log="$(pwd)/smoke.serial"
 
@@ -131,9 +131,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 # Run the test
 rm -f ${serial_log}
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 240 \
-./qemu-system-arm \
+export QEMU_CMD="./qemu-system-arm \
     -machine virt \
     -machine virtualization=true \
     -smp 4 \
@@ -144,9 +142,11 @@ timeout -k 1 240 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=./ \
-    -bios /usr/lib/u-boot/qemu_arm/u-boot.bin |& \
-        tee ${serial_log} | sed 's/\r//'
+    -bios /usr/lib/u-boot/qemu_arm/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="${serial_log}"
+export LOG_MSG="${dom0_prompt}"
+export PASSED="${passed}"
 
-set -e
-(grep -q "${dom0_prompt}" ${serial_log} && grep -q "${passed}" ${serial_log}) || exit 1
-exit 0
+../automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index 15258692d5..eb25c4af4b 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -205,9 +205,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 # Run the test
 rm -f smoke.serial
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 240 \
-./binaries/qemu-system-aarch64 \
+export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt,gic-version=$gic_version \
     -m 2048 -monitor none -serial stdio \
@@ -215,9 +213,11 @@ timeout -k 1 240 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& \
-        tee smoke.serial | sed 's/\r//'
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="smoke.serial"
+export LOG_MSG="Welcome to Alpine Linux"
+export PASSED="${passed}"
 
-set -e
-(grep -q "^Welcome to Alpine Linux" smoke.serial && grep -q "${passed}" smoke.serial) || exit 1
-exit 0
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-ppc64le.sh b/automation/scripts/qemu-smoke-ppc64le.sh
index 9088881b73..ccb4a576f4 100755
--- a/automation/scripts/qemu-smoke-ppc64le.sh
+++ b/automation/scripts/qemu-smoke-ppc64le.sh
@@ -11,8 +11,7 @@ machine=$1
 rm -f ${serial_log}
 set +e
 
-timeout -k 1 20 \
-qemu-system-ppc64 \
+export QEMU_CMD="qemu-system-ppc64 \
     -bios skiboot.lid \
     -M $machine \
     -m 2g \
@@ -21,9 +20,9 @@ qemu-system-ppc64 \
     -monitor none \
     -nographic \
     -serial stdio \
-    -kernel binaries/xen \
-    |& tee ${serial_log} | sed 's/\r//'
+    -kernel binaries/xen"
 
-set -e
-(grep -q "Hello, ppc64le!" ${serial_log}) || exit 1
-exit 0
+export QEMU_LOG="${serial_log}"
+export PASSED="Hello, ppc64le!"
+
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-riscv64.sh b/automation/scripts/qemu-smoke-riscv64.sh
index f90df3c051..0355c075b7 100755
--- a/automation/scripts/qemu-smoke-riscv64.sh
+++ b/automation/scripts/qemu-smoke-riscv64.sh
@@ -6,15 +6,14 @@ set -ex
 rm -f smoke.serial
 set +e
 
-timeout -k 1 2 \
-qemu-system-riscv64 \
+export QEMU_CMD="qemu-system-riscv64 \
     -M virt \
     -smp 1 \
     -nographic \
     -m 2g \
-    -kernel binaries/xen \
-    |& tee smoke.serial | sed 's/\r//'
+    -kernel binaries/xen"
 
-set -e
-(grep -q "All set up" smoke.serial) || exit 1
-exit 0
+export QEMU_LOG="smoke.serial"
+export PASSED="All set up"
+
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-x86-64.sh b/automation/scripts/qemu-smoke-x86-64.sh
index 3014d07314..37ac10e068 100755
--- a/automation/scripts/qemu-smoke-x86-64.sh
+++ b/automation/scripts/qemu-smoke-x86-64.sh
@@ -16,11 +16,12 @@ esac
 
 rm -f smoke.serial
 set +e
-timeout -k 1 30 \
-qemu-system-x86_64 -nographic -kernel binaries/xen \
+export QEMU_CMD="qemu-system-x86_64 -nographic -kernel binaries/xen \
         -initrd xtf/tests/example/$k \
-        -append "loglvl=all console=com1 noreboot console_timestamps=boot $extra" \
-        -m 512 -monitor none -serial file:smoke.serial
-set -e
-grep -q 'Test result: SUCCESS' smoke.serial || exit 1
-exit 0
+        -append \"loglvl=all console=com1 noreboot console_timestamps=boot $extra\" \
+        -m 512 -monitor none -serial stdio"
+
+export QEMU_LOG="smoke.serial"
+export PASSED="Test result: SUCCESS"
+
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-xtf-dom0less-arm64.sh b/automation/scripts/qemu-xtf-dom0less-arm64.sh
index b08c2d44fb..0666f6363e 100755
--- a/automation/scripts/qemu-xtf-dom0less-arm64.sh
+++ b/automation/scripts/qemu-xtf-dom0less-arm64.sh
@@ -51,9 +51,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 # Run the test
 rm -f smoke.serial
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 120 \
-./binaries/qemu-system-aarch64 \
+export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
     -m 2048 -monitor none -serial stdio \
@@ -61,9 +59,10 @@ timeout -k 1 120 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& \
-        tee smoke.serial | sed 's/\r//'
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="smoke.serial"
+export PASSED="${passed}"
 
-set -e
-(grep -q "${passed}" smoke.serial) || exit 1
-exit 0
+./automation/scripts/qemu-key.exp
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 15 18:01:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Aug 2024 18:01:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778224.1188289 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seenK-0005Ps-BP; Thu, 15 Aug 2024 18:01:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778224.1188289; Thu, 15 Aug 2024 18: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 1seenK-0005Pl-90; Thu, 15 Aug 2024 18:01:54 +0000
Received: by outflank-mailman (input) for mailman id 778224;
 Thu, 15 Aug 2024 18:01:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seenI-0005Pb-Tw
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:01:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seenI-00016W-TF
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:01:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seenI-0007BJ-SO
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gu7zZkAlEDq4cFASzPNqSVhSsWZecnmpU0L6Cw68YWM=; b=1I4bL69bGfZ4eal5W4NR+ZFvdl
	U14f9ysi5OMAaoIydGCL9qDaY9a/6rROzmCaJTPRO6n+nT8dMTSAeKJSUJNo769iklLYgirPv2xNH
	FM0nQKyxMjm9KaU2oJZvYhYvwtYX3pEzDGyLjdLLc9XF1PVVTxw9qbKeN2BHEd5C/YIY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstored: switch stubdom live update to use file for state
Message-Id: <E1seenI-0007BJ-SO@xenbits.xenproject.org>
Date: Thu, 15 Aug 2024 18:01:52 +0000

commit e4d19a2dad80b847930d1742e92798448ae59ad6
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Aug 14 08:46:54 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 14 08:46:54 2024 +0200

    tools/xenstored: switch stubdom live update to use file for state
    
    With the introduction of 9pfs for Xenstore-stubdom it is now possible
    to use a file for saving the state when doing live update.
    
    This allows to move some environment specific actions back to the
    common source file lu.c.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 tools/xenstored/lu.c        | 75 ++++++++++++++++++++++++++++++++++++++++++++-
 tools/xenstored/lu.h        | 19 +-----------
 tools/xenstored/lu_daemon.c | 72 -------------------------------------------
 tools/xenstored/lu_minios.c | 49 -----------------------------
 4 files changed, 75 insertions(+), 140 deletions(-)

diff --git a/tools/xenstored/lu.c b/tools/xenstored/lu.c
index 2f41d10c95..bec2a84e10 100644
--- a/tools/xenstored/lu.c
+++ b/tools/xenstored/lu.c
@@ -11,6 +11,8 @@
 #include <stdlib.h>
 #include <syslog.h>
 #include <time.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
 
 #include "talloc.h"
 #include "core.h"
@@ -19,11 +21,18 @@
 #include "watch.h"
 
 #ifndef NO_LIVE_UPDATE
+
+struct lu_dump_state {
+	void *buf;
+	unsigned int size;
+	int fd;
+	char *filename;
+};
+
 struct live_update *lu_status;
 
 static int lu_destroy(void *data)
 {
-	lu_destroy_arch(data);
 	lu_status = NULL;
 
 	return 0;
@@ -70,6 +79,48 @@ bool lu_is_pending(void)
 	return lu_status != NULL;
 }
 
+static void lu_get_dump_state(struct lu_dump_state *state)
+{
+	struct stat statbuf;
+
+	state->size = 0;
+
+	state->filename = talloc_asprintf(NULL, "%s/state_dump",
+					  xenstore_rundir());
+	if (!state->filename)
+		barf("Allocation failure");
+
+	state->fd = open(state->filename, O_RDONLY);
+	if (state->fd < 0)
+		return;
+	if (fstat(state->fd, &statbuf) != 0)
+		goto out_close;
+	state->size = statbuf.st_size;
+
+	state->buf = mmap(NULL, state->size, PROT_READ, MAP_PRIVATE,
+			  state->fd, 0);
+	if (state->buf == MAP_FAILED) {
+		state->size = 0;
+		goto out_close;
+	}
+
+	return;
+
+ out_close:
+	close(state->fd);
+}
+
+static void lu_close_dump_state(struct lu_dump_state *state)
+{
+	assert(state->filename != NULL);
+
+	munmap(state->buf, state->size);
+	close(state->fd);
+
+	unlink(state->filename);
+	talloc_free(state->filename);
+}
+
 void lu_read_state(void)
 {
 	struct lu_dump_state state = {};
@@ -197,6 +248,28 @@ static const char *lu_reject_reason(const void *ctx)
 	return ret ? (const char *)ret : "Overlapping transactions";
 }
 
+static FILE *lu_dump_open(const void *ctx)
+{
+	char *filename;
+	int fd;
+
+	filename = talloc_asprintf(ctx, "%s/state_dump",
+				   xenstore_rundir());
+	if (!filename)
+		return NULL;
+
+	fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
+	if (fd < 0)
+		return NULL;
+
+	return fdopen(fd, "w");
+}
+
+static void lu_dump_close(FILE *fp)
+{
+	fclose(fp);
+}
+
 static const char *lu_dump_state(const void *ctx, struct connection *conn)
 {
 	FILE *fp;
diff --git a/tools/xenstored/lu.h b/tools/xenstored/lu.h
index ac3c572ca8..dacc9b6e42 100644
--- a/tools/xenstored/lu.h
+++ b/tools/xenstored/lu.h
@@ -18,12 +18,9 @@ struct live_update {
 	unsigned int kernel_size;
 	unsigned int kernel_off;
 
-	void *dump_state;
-	unsigned long dump_size;
-#else
-	char *filename;
 #endif
 
+	char *filename;
 	char *cmdline;
 
 	/* Start parameters. */
@@ -32,15 +29,6 @@ struct live_update {
 	time_t started_at;
 };
 
-struct lu_dump_state {
-	void *buf;
-	unsigned int size;
-#ifndef __MINIOS__
-	int fd;
-	char *filename;
-#endif
-};
-
 extern struct live_update *lu_status;
 
 struct connection *lu_get_connection(void);
@@ -54,15 +42,10 @@ int do_control_lu(const void *ctx, struct connection *conn, const char **vec,
 		  int num);
 
 /* Live update private interfaces. */
-void lu_get_dump_state(struct lu_dump_state *state);
-void lu_close_dump_state(struct lu_dump_state *state);
-FILE *lu_dump_open(const void *ctx);
-void lu_dump_close(FILE *fp);
 char *lu_exec(const void *ctx, int argc, char **argv);
 const char *lu_arch(const void *ctx, struct connection *conn, const char **vec,
 		    int num);
 const char *lu_begin(struct connection *conn);
-void lu_destroy_arch(void *data);
 #else
 static inline struct connection *lu_get_connection(void)
 {
diff --git a/tools/xenstored/lu_daemon.c b/tools/xenstored/lu_daemon.c
index 6351111ab0..6df6c80a2a 100644
--- a/tools/xenstored/lu_daemon.c
+++ b/tools/xenstored/lu_daemon.c
@@ -5,82 +5,14 @@
  * Copyright (C) 2022 Juergen Gross, SUSE LLC
  */
 
-#include <assert.h>
-#include <stdio.h>
 #include <syslog.h>
 #include <sys/stat.h>
-#include <sys/mman.h>
-#include <xen-tools/xenstore-common.h>
 
 #include "talloc.h"
 #include "core.h"
 #include "lu.h"
 
 #ifndef NO_LIVE_UPDATE
-void lu_get_dump_state(struct lu_dump_state *state)
-{
-	struct stat statbuf;
-
-	state->size = 0;
-
-	state->filename = talloc_asprintf(NULL, "%s/state_dump",
-					  xenstore_rundir());
-	if (!state->filename)
-		barf("Allocation failure");
-
-	state->fd = open(state->filename, O_RDONLY);
-	if (state->fd < 0)
-		return;
-	if (fstat(state->fd, &statbuf) != 0)
-		goto out_close;
-	state->size = statbuf.st_size;
-
-	state->buf = mmap(NULL, state->size, PROT_READ, MAP_PRIVATE,
-			  state->fd, 0);
-	if (state->buf == MAP_FAILED) {
-		state->size = 0;
-		goto out_close;
-	}
-
-	return;
-
- out_close:
-	close(state->fd);
-}
-
-void lu_close_dump_state(struct lu_dump_state *state)
-{
-	assert(state->filename != NULL);
-
-	munmap(state->buf, state->size);
-	close(state->fd);
-
-	unlink(state->filename);
-	talloc_free(state->filename);
-}
-
-FILE *lu_dump_open(const void *ctx)
-{
-	char *filename;
-	int fd;
-
-	filename = talloc_asprintf(ctx, "%s/state_dump",
-				   xenstore_rundir());
-	if (!filename)
-		return NULL;
-
-	fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
-	if (fd < 0)
-		return NULL;
-
-	return fdopen(fd, "w");
-}
-
-void lu_dump_close(FILE *fp)
-{
-	fclose(fp);
-}
-
 char *lu_exec(const void *ctx, int argc, char **argv)
 {
 	argv[0] = lu_status->filename;
@@ -89,10 +21,6 @@ char *lu_exec(const void *ctx, int argc, char **argv)
 	return "Error activating new binary.";
 }
 
-void lu_destroy_arch(void *data)
-{
-}
-
 static const char *lu_binary(const void *ctx, struct connection *conn,
 			     const char *filename)
 {
diff --git a/tools/xenstored/lu_minios.c b/tools/xenstored/lu_minios.c
index ede8b4dd47..b14a0b29d5 100644
--- a/tools/xenstored/lu_minios.c
+++ b/tools/xenstored/lu_minios.c
@@ -5,67 +5,18 @@
  * Copyright (C) 2022 Juergen Gross, SUSE LLC
  */
 
-#include <stdbool.h>
-#include <stdio.h>
 #include <stdlib.h>
 #include <syslog.h>
-#include <sys/mman.h>
-#include <xenctrl.h>
-#include <xen-tools/common-macros.h>
 
 #include "talloc.h"
 #include "lu.h"
 
-/* Mini-OS only knows about MAP_ANON. */
-#ifndef MAP_ANONYMOUS
-#define MAP_ANONYMOUS MAP_ANON
-#endif
-
 #ifndef NO_LIVE_UPDATE
-void lu_get_dump_state(struct lu_dump_state *state)
-{
-}
-
-void lu_close_dump_state(struct lu_dump_state *state)
-{
-}
-
-FILE *lu_dump_open(const void *ctx)
-{
-	lu_status->dump_size = ROUNDUP(talloc_total_size(NULL) * 2,
-				       XC_PAGE_SHIFT);
-	lu_status->dump_state = mmap(NULL, lu_status->dump_size,
-				     PROT_READ | PROT_WRITE,
-				     MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
-	if (lu_status->dump_state == MAP_FAILED)
-		return NULL;
-
-	return fmemopen(lu_status->dump_state, lu_status->dump_size, "w");
-}
-
-void lu_dump_close(FILE *fp)
-{
-	size_t size;
-
-	size = ftell(fp);
-	size = ROUNDUP(size, XC_PAGE_SHIFT);
-	munmap(lu_status->dump_state + size, lu_status->dump_size - size);
-	lu_status->dump_size = size;
-
-	fclose(fp);
-}
-
 char *lu_exec(const void *ctx, int argc, char **argv)
 {
 	return "NYI";
 }
 
-void lu_destroy_arch(void *data)
-{
-	if (lu_status->dump_state)
-		munmap(lu_status->dump_state, lu_status->dump_size);
-}
-
 static const char *lu_binary_alloc(const void *ctx, struct connection *conn,
 				   unsigned long size)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 15 18:02:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Aug 2024 18:02:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778225.1188294 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seenU-0005Sz-DU; Thu, 15 Aug 2024 18:02:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778225.1188294; Thu, 15 Aug 2024 18:02:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seenU-0005Sr-Ag; Thu, 15 Aug 2024 18:02:04 +0000
Received: by outflank-mailman (input) for mailman id 778225;
 Thu, 15 Aug 2024 18:02:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seenT-0005SV-0q
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:02:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seenS-00016q-WF
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:02:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seenS-0007ER-VT
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:02: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JSa7SPq66CsUP1j0yS2T2iLzUFH2nxz5dzDUoAVTRWw=; b=Cm47H9iPoN07wQf7z+EMnkOrnj
	bTdK3/cqd2c0vCN1SdfjuBeB/jeckBjCihQLcDnjQTCHLxBeO+MYdp9aF1gF2pTSkJvX75pd+Cfjz
	b7+iPqFB5FaNbVdsUp6p0Aim9YADa675E7amfKwcKOeFlRGRL6LjQ+TunBRrUuCCMNL0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] mm: introduce xvmalloc() et al and use for grant table allocations
Message-Id: <E1seenS-0007ER-VT@xenbits.xenproject.org>
Date: Thu, 15 Aug 2024 18:02:02 +0000

commit 9102fcd9579fb195749e96b99b36ee14f1314a55
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Aug 14 08:47:58 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 14 08:47:58 2024 +0200

    mm: introduce xvmalloc() et al and use for grant table allocations
    
    All of the array allocations in grant_table_init() can exceed a page's
    worth of memory, which xmalloc()-based interfaces aren't really suitable
    for after boot. We also don't need any of these allocations to be
    physically contiguous. Introduce interfaces dynamically switching
    between xmalloc() et al and vmalloc() et al, based on requested size,
    and use them instead.
    
    All the wrappers in the new header are cloned mostly verbatim from
    xmalloc.h, with the sole adjustment to switch unsigned long to size_t
    for sizes and to unsigned int for alignments, and with the cloning of
    x[mz]alloc_bytes() avoided. The exception is xvmemdup(), where the
    const related comment on xmemdup() is actually addressed and hence
    dropped.
    
    While adjusting grant_table_destroy() also move ahead the clearing of
    the struct domain field.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/grant_table.c   | 30 ++++++++--------
 xen/common/vmap.c          | 88 ++++++++++++++++++++++++++++++++++++++++------
 xen/include/xen/xmalloc.h  |  3 ++
 xen/include/xen/xvmalloc.h | 75 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 172 insertions(+), 24 deletions(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index ebe2d2a3ce..ab36f45ded 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -39,7 +39,7 @@
 #include <xen/paging.h>
 #include <xen/keyhandler.h>
 #include <xen/radix-tree.h>
-#include <xen/vmap.h>
+#include <xen/xvmalloc.h>
 #include <xen/nospec.h>
 #include <xsm/xsm.h>
 #include <asm/flushtlb.h>
@@ -1995,7 +1995,7 @@ int grant_table_init(struct domain *d, int max_grant_frames,
         return -EINVAL;
     }
 
-    if ( (gt = xzalloc(struct grant_table)) == NULL )
+    if ( (gt = xvzalloc(struct grant_table)) == NULL )
         return -ENOMEM;
 
     /* Simple stuff. */
@@ -2012,15 +2012,16 @@ int grant_table_init(struct domain *d, int max_grant_frames,
     d->grant_table = gt;
 
     /* Active grant table. */
-    gt->active = xzalloc_array(struct active_grant_entry *,
-                               max_nr_active_grant_frames(gt));
+    gt->active = xvzalloc_array(struct active_grant_entry *,
+                                max_nr_active_grant_frames(gt));
     if ( gt->active == NULL )
         goto out;
 
     /* Tracking of mapped foreign frames table */
     if ( gt->max_maptrack_frames )
     {
-        gt->maptrack = vzalloc(gt->max_maptrack_frames * sizeof(*gt->maptrack));
+        gt->maptrack = xvzalloc_array(struct grant_mapping *,
+                                      gt->max_maptrack_frames);
         if ( gt->maptrack == NULL )
             goto out;
 
@@ -2028,13 +2029,13 @@ int grant_table_init(struct domain *d, int max_grant_frames,
     }
 
     /* Shared grant table. */
-    gt->shared_raw = xzalloc_array(void *, gt->max_grant_frames);
+    gt->shared_raw = xvzalloc_array(void *, gt->max_grant_frames);
     if ( gt->shared_raw == NULL )
         goto out;
 
     /* Status pages for grant table - for version 2 */
-    gt->status = xzalloc_array(grant_status_t *,
-                               grant_to_status_frames(gt->max_grant_frames));
+    gt->status = xvzalloc_array(grant_status_t *,
+                                grant_to_status_frames(gt->max_grant_frames));
     if ( gt->status == NULL )
         goto out;
 
@@ -4010,23 +4011,24 @@ grant_table_destroy(
     if ( t == NULL )
         return;
 
+    d->grant_table = NULL;
+
     for ( i = 0; i < nr_grant_frames(t); i++ )
         free_xenheap_page(t->shared_raw[i]);
-    xfree(t->shared_raw);
+    xvfree(t->shared_raw);
 
     ASSERT(!t->maptrack_limit);
-    vfree(t->maptrack);
+    xvfree(t->maptrack);
 
     for ( i = 0; i < nr_active_grant_frames(t); i++ )
         free_xenheap_page(t->active[i]);
-    xfree(t->active);
+    xvfree(t->active);
 
     for ( i = 0; i < nr_status_frames(t); i++ )
         free_xenheap_page(t->status[i]);
-    xfree(t->status);
+    xvfree(t->status);
 
-    xfree(t);
-    d->grant_table = NULL;
+    xvfree(t);
 }
 
 void grant_table_init_vcpu(struct vcpu *v)
diff --git a/xen/common/vmap.c b/xen/common/vmap.c
index b3b4ddf653..ced9cbf26f 100644
--- a/xen/common/vmap.c
+++ b/xen/common/vmap.c
@@ -7,6 +7,7 @@
 #include <xen/spinlock.h>
 #include <xen/types.h>
 #include <xen/vmap.h>
+#include <xen/xvmalloc.h>
 #include <asm/page.h>
 
 static DEFINE_SPINLOCK(vm_lock);
@@ -335,28 +336,95 @@ void *vzalloc(size_t size)
     return p;
 }
 
-void vfree(void *va)
+static void _vfree(const void *va, unsigned int pages)
 {
-    unsigned int i, pages;
+    unsigned int i;
     struct page_info *pg;
     PAGE_LIST_HEAD(pg_list);
 
-    if ( !va )
-        return;
-
-    pages = vmap_size(va);
     ASSERT(pages);
 
     for ( i = 0; i < pages; i++ )
     {
-        struct page_info *page = vmap_to_page(va + i * PAGE_SIZE);
-
-        ASSERT(page);
-        page_list_add(page, &pg_list);
+        pg = vmap_to_page(va + i * PAGE_SIZE);
+        ASSERT(pg);
+        page_list_add(pg, &pg_list);
     }
     vunmap(va);
 
     while ( (pg = page_list_remove_head(&pg_list)) != NULL )
         free_domheap_page(pg);
 }
+
+void vfree(void *va)
+{
+    if ( !va )
+        return;
+
+    _vfree(va, vmap_size(va));
+}
+
+void xvfree(void *va)
+{
+    unsigned int pages = vm_size(va, VMAP_DEFAULT);
+
+    if ( pages )
+        _vfree(va, pages);
+    else
+        xfree(va);
+}
+
+void *_xvmalloc(size_t size, unsigned int align)
+{
+    ASSERT(align <= PAGE_SIZE);
+    return size <= PAGE_SIZE ? _xmalloc(size, align) : vmalloc(size);
+}
+
+void *_xvzalloc(size_t size, unsigned int align)
+{
+    ASSERT(align <= PAGE_SIZE);
+    return size <= PAGE_SIZE ? _xzalloc(size, align) : vzalloc(size);
+}
+
+void *_xvrealloc(void *va, size_t size, unsigned int align)
+{
+    size_t pages = vm_size(va, VMAP_DEFAULT);
+    void *ptr;
+
+    ASSERT(align <= PAGE_SIZE);
+
+    if ( !pages )
+    {
+        if ( size <= PAGE_SIZE )
+            return _xrealloc(va, size, align);
+
+        ptr = vmalloc(size);
+        if ( ptr && va && va != ZERO_BLOCK_PTR )
+        {
+            /*
+             * xmalloc-based allocations up to PAGE_SIZE don't cross page
+             * boundaries. Therefore, without needing to know the exact
+             * prior allocation size, simply copy the entire tail of the
+             * page containing the earlier allocation.
+             */
+            memcpy(ptr, va, PAGE_SIZE - PAGE_OFFSET(va));
+            xfree(va);
+        }
+    }
+    else if ( pages == PFN_UP(size) )
+        ptr = va;
+    else
+    {
+        ptr = _xvmalloc(size, align);
+        if ( ptr )
+        {
+            memcpy(ptr, va, min(size, pages << PAGE_SHIFT));
+            vfree(va);
+        }
+        else if ( pages > PFN_UP(size) )
+            ptr = va;
+    }
+
+    return ptr;
+}
 #endif
diff --git a/xen/include/xen/xmalloc.h b/xen/include/xen/xmalloc.h
index 1b88a83be8..b903fa2e26 100644
--- a/xen/include/xen/xmalloc.h
+++ b/xen/include/xen/xmalloc.h
@@ -7,6 +7,9 @@
 
 /*
  * Xen malloc/free-style interface.
+ *
+ * NOTE: Unless physically contiguous memory space is required, the interfaces
+ *       in xvmalloc.h are to be used in preference to the ones here.
  */
 
 /* Allocate space for typed object. */
diff --git a/xen/include/xen/xvmalloc.h b/xen/include/xen/xvmalloc.h
new file mode 100644
index 0000000000..ab71a1e1a7
--- /dev/null
+++ b/xen/include/xen/xvmalloc.h
@@ -0,0 +1,75 @@
+#ifndef XEN__XVMALLOC_H
+#define XEN__XVMALLOC_H
+
+#include <xen/types.h>
+
+/*
+ * Xen malloc/free-style interface, as long as there's no need to have
+ * physically contiguous memory allocated.  These should be used in preference
+ * to xmalloc() et al.
+ */
+
+/* Allocate space for typed object. */
+#define xvmalloc(_type) ((_type *)_xvmalloc(sizeof(_type), __alignof__(_type)))
+#define xvzalloc(_type) ((_type *)_xvzalloc(sizeof(_type), __alignof__(_type)))
+
+/* Allocate space for a typed object and copy an existing instance. */
+#define xvmemdup(ptr)                                          \
+({                                                             \
+    void *p_ = _xvmalloc(sizeof(*(ptr)), __alignof__(*(ptr))); \
+    if ( p_ )                                                  \
+        memcpy(p_, ptr, sizeof(*(ptr)));                       \
+    (typeof(*(ptr)) *)p_;                                      \
+})
+
+/* Allocate space for array of typed objects. */
+#define xvmalloc_array(_type, _num) \
+    ((_type *)_xvmalloc_array(sizeof(_type), __alignof__(_type), _num))
+#define xvzalloc_array(_type, _num) \
+    ((_type *)_xvzalloc_array(sizeof(_type), __alignof__(_type), _num))
+
+/* Allocate space for a structure with a flexible array of typed objects. */
+#define xvzalloc_flex_struct(type, field, nr) \
+    ((type *)_xvzalloc(offsetof(type, field[nr]), __alignof__(type)))
+
+#define xvmalloc_flex_struct(type, field, nr) \
+    ((type *)_xvmalloc(offsetof(type, field[nr]), __alignof__(type)))
+
+/* Re-allocate space for a structure with a flexible array of typed objects. */
+#define xvrealloc_flex_struct(ptr, field, nr)                          \
+    ((typeof(ptr))_xvrealloc(ptr, offsetof(typeof(*(ptr)), field[nr]), \
+                             __alignof__(typeof(*(ptr)))))
+
+/* Free any of the above. */
+void xvfree(void *);
+
+/* Free an allocation, and zero the pointer to it. */
+#define XVFREE(p) do { \
+    xvfree(p);         \
+    (p) = NULL;        \
+} while ( false )
+
+/* Underlying functions */
+void *_xvmalloc(size_t size, unsigned int align);
+void *_xvzalloc(size_t size, unsigned int align);
+void *_xvrealloc(void *ptr, size_t size, unsigned int align);
+
+static inline void *_xvmalloc_array(
+    size_t size, unsigned int align, unsigned long num)
+{
+    /* Check for overflow. */
+    if ( size && num > UINT_MAX / size )
+        return NULL;
+    return _xvmalloc(size * num, align);
+}
+
+static inline void *_xvzalloc_array(
+    size_t size, unsigned int align, unsigned long num)
+{
+    /* Check for overflow. */
+    if ( size && num > UINT_MAX / size )
+        return NULL;
+    return _xvzalloc(size * num, align);
+}
+
+#endif /* XEN__XVMALLOC_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 15 18:02:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Aug 2024 18:02:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778229.1188307 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seend-0005li-PD; Thu, 15 Aug 2024 18:02:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778229.1188307; Thu, 15 Aug 2024 18:02: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 1seend-0005lc-Mi; Thu, 15 Aug 2024 18:02:13 +0000
Received: by outflank-mailman (input) for mailman id 778229;
 Thu, 15 Aug 2024 18:02:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seend-0005lH-3a
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:02:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seend-00017C-2r
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:02:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seend-0007FX-23
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:02:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=L5PCQJ1O8b1abHKBgR/SsOkk80RSePeOKoacPMmykek=; b=nHpQI4njMkEtSNGmwTOrcXQzvx
	eV1DEj0tDz6lLG25+mPf6lhewORhxkNc3CgpCg6YcVSP4TmHw3dbyMQ9JRz1v7UR11EKDiyFFFK9y
	0RBMrHY9kSOox6QbiX7WEQvjeo4dixpirYArOL0Tz7jlt2chS8DaZYimwnFT/xIt6dcs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xl: fix incorrect output in "help" command
Message-Id: <E1seend-0007FX-23@xenbits.xenproject.org>
Date: Thu, 15 Aug 2024 18:02:13 +0000

commit 09226d165b57d919150458044c5b594d3d1dc23a
Author:     John E. Krokes <mag@netherworld.org>
AuthorDate: Wed Aug 14 08:49:44 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 14 08:49:44 2024 +0200

    xl: fix incorrect output in "help" command
    
    In "xl help", the output includes this line:
    
     vsnd-list           List virtual display devices for a domain
    
    This should obviously say "sound devices" instead of "display devices".
    
    Signed-off-by: John E. Krokes <mag@netherworld.org>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/xl/xl_cmdtable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/xl/xl_cmdtable.c b/tools/xl/xl_cmdtable.c
index 42751228c1..53fc22d344 100644
--- a/tools/xl/xl_cmdtable.c
+++ b/tools/xl/xl_cmdtable.c
@@ -433,7 +433,7 @@ const struct cmd_spec cmd_table[] = {
     },
     { "vsnd-list",
       &main_vsndlist, 0, 0,
-      "List virtual display devices for a domain",
+      "List virtual sound devices for a domain",
       "<Domain(s)>",
     },
     { "vsnd-detach",
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 15 18:02:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Aug 2024 18:02:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778232.1188312 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seenn-0005vD-Qo; Thu, 15 Aug 2024 18:02:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778232.1188312; Thu, 15 Aug 2024 18:02: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 1seenn-0005v1-O8; Thu, 15 Aug 2024 18:02:23 +0000
Received: by outflank-mailman (input) for mailman id 778232;
 Thu, 15 Aug 2024 18:02:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seenn-0005ul-6G
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:02:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seenn-00017K-5c
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:02:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seenn-0007Gb-4v
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:02:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=edMhCQA/r5TNkte9aHiZiX5HYVABfb38I5urCCxGHoI=; b=TTxEVoJ2uA03db0awrUJybqeO3
	Mmhaw5gsWmxfGn3TQTdAfhKB+c2JkIXBNaOnEvL1ESLx8uZ5dExdAIjSrafCIzVJ4v71COWLl8SPF
	t/Ce2dVRSxQ7MHD65HkgqB1PB7mky4OkqZcRnP0aYfxt1daDiu9IaAjGxbPkwMBVMFNU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl/disk: avoid aliasing of abs()
Message-Id: <E1seenn-0007Gb-4v@xenbits.xenproject.org>
Date: Thu, 15 Aug 2024 18:02:23 +0000

commit a73f8d19445a70b72701a7a95b6c3e274168918a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Aug 14 08:50:14 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 14 08:50:14 2024 +0200

    libxl/disk: avoid aliasing of abs()
    
    Tool chains with -Wshadow enabled by default won't like the function
    parameter name "abs", for aliasing stdlib.h's abs(). Rename the
    parameter to what other similar functions use.
    
    Fixes: a18b50614d97 ("libxl: Enable stubdom cdrom changing")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/libs/light/libxl_disk.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libs/light/libxl_disk.c b/tools/libs/light/libxl_disk.c
index da1d973bf5..15055380c6 100644
--- a/tools/libs/light/libxl_disk.c
+++ b/tools/libs/light/libxl_disk.c
@@ -935,7 +935,7 @@ static void cdrom_insert_stubdom_disk_add_cb(libxl__egc *egc,
                                              libxl__ao_device *aodev);
 static void cdrom_insert_stubdom_query_fdset(libxl__egc *egc,
                                              libxl__ev_time *ev,
-                                             const struct timeval *abs,
+                                             const struct timeval *requested_abs,
                                              int rc);
 static void cdrom_insert_stubdom_parse_fdset(libxl__egc *egc,
                                              libxl__ev_qmp *qmp,
@@ -1259,7 +1259,7 @@ static void cdrom_insert_stubdom_disk_add_cb(libxl__egc *egc,
 
 static void cdrom_insert_stubdom_query_fdset(libxl__egc *egc,
                                              libxl__ev_time *ev,
-                                             const struct timeval *abs,
+                                             const struct timeval *requested_abs,
                                              int rc)
 {
     EGC_GC;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 15 18:02:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Aug 2024 18:02:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778236.1188315 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seenx-000663-TZ; Thu, 15 Aug 2024 18:02:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778236.1188315; Thu, 15 Aug 2024 18:02: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 1seenx-00065u-Qu; Thu, 15 Aug 2024 18:02:33 +0000
Received: by outflank-mailman (input) for mailman id 778236;
 Thu, 15 Aug 2024 18:02:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seenx-00065e-93
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:02:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seenx-00017O-8M
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:02:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seenx-0007HG-7g
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:02:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2Uxl2yWu+/gnzVITV6sfbOE0qYzEDkWSFK3XZcpkQ7o=; b=fE22FyTPRXLYIAoBKNc4kFfPcc
	pbpp4QSTunATbpeuWJKCX4sKOWhErC61SlJhSLMxXEsrhOAk06FyEX8erOyo+Sw8YkIaFxQ5iprxi
	5mGrhfN0J3AbsH44gkUVUa6x8xo8Xl7ikNW4uJm2hPgP+WDyDlSLxEThm/Fyyay/frFU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/xstate: use xvzalloc() for save area allocation
Message-Id: <E1seenx-0007HG-7g@xenbits.xenproject.org>
Date: Thu, 15 Aug 2024 18:02:33 +0000

commit b12da0cc86ce383a9d13b8117fb6a53e3e34dc25
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Aug 14 15:38:14 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 14 15:38:14 2024 +0200

    x86/xstate: use xvzalloc() for save area allocation
    
    This is in preparation for the area size exceeding a page's worth of
    space, as will happen with AMX as well as Architectural LBR.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/xstate.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 5c4144d55e..1e1abfc029 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -8,6 +8,7 @@
 #include <xen/param.h>
 #include <xen/percpu.h>
 #include <xen/sched.h>
+#include <xen/xvmalloc.h>
 
 #include <asm/cpu-policy.h>
 #include <asm/current.h>
@@ -530,7 +531,7 @@ int xstate_alloc_save_area(struct vcpu *v)
 
     /* XSAVE/XRSTOR requires the save area be 64-byte-boundary aligned. */
     BUILD_BUG_ON(__alignof(*save_area) < 64);
-    save_area = _xzalloc(size, __alignof(*save_area));
+    save_area = _xvzalloc(size, __alignof(*save_area));
     if ( save_area == NULL )
         return -ENOMEM;
 
@@ -551,8 +552,7 @@ int xstate_alloc_save_area(struct vcpu *v)
 
 void xstate_free_save_area(struct vcpu *v)
 {
-    xfree(v->arch.xsave_area);
-    v->arch.xsave_area = NULL;
+    XVFREE(v->arch.xsave_area);
 }
 
 static bool valid_xcr0(uint64_t xcr0)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 15 18:02:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Aug 2024 18:02:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778238.1188321 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seeo7-00069Z-Ve; Thu, 15 Aug 2024 18:02:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778238.1188321; Thu, 15 Aug 2024 18:02: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 1seeo7-00069R-SM; Thu, 15 Aug 2024 18:02:43 +0000
Received: by outflank-mailman (input) for mailman id 778238;
 Thu, 15 Aug 2024 18:02:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seeo7-00069F-CV
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:02:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seeo7-00017S-Be
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:02:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seeo7-0007I3-Ap
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:02:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cZ34dzAVESJhXlkAZHO5Z+ufGdtzV4AQ9YekOBXunhs=; b=MV43FsOo4cLM6CfJM8WBWT+N7D
	E37rl6u10gxE5t+Ms3/PJgZn9GyryCbuPWx8ANdPiFtqz/+GWp9ViR+UUcOSFMfIuO090ubCnPn6u
	pFo63cDvS96250+9No9S194SxZ2TdcvZZgn4I58IkmRHXvrDtYB05p/6aZjKNOXz02rU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/spec-ctrl: initialize per-domain XPTI in spec_ctrl_init_domain()
Message-Id: <E1seeo7-0007I3-Ap@xenbits.xenproject.org>
Date: Thu, 15 Aug 2024 18:02:43 +0000

commit d18f8153be4c57e452495f468e2e22d2b749f07f
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Aug 14 15:39:26 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 14 15:39:26 2024 +0200

    x86/spec-ctrl: initialize per-domain XPTI in spec_ctrl_init_domain()
    
    XPTI being a speculation mitigation feels better to be initialized in
    spec_ctrl_init_domain().
    
    No functional change intended, although the call to spec_ctrl_init_domain() in
    arch_domain_create() needs to be moved ahead of pv_domain_initialise() for
    d->->arch.pv.xpti to be correctly set.
    
    Move it ahead of most of the initialization functions, since
    spec_ctrl_init_domain() doesn't depend on any member in the struct domain being
    set.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domain.c    | 4 ++--
 xen/arch/x86/pv/domain.c | 2 --
 xen/arch/x86/spec_ctrl.c | 4 ++++
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index d977ec71ca..89aad7e897 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -830,6 +830,8 @@ int arch_domain_create(struct domain *d,
         is_pv_domain(d) ? __HYPERVISOR_COMPAT_VIRT_START : ~0u;
 #endif
 
+    spec_ctrl_init_domain(d);
+
     if ( (rc = paging_domain_init(d)) != 0 )
         goto fail;
     paging_initialised = true;
@@ -896,8 +898,6 @@ int arch_domain_create(struct domain *d,
 
     d->arch.msr_relaxed = config->arch.misc_flags & XEN_X86_MSR_RELAXED;
 
-    spec_ctrl_init_domain(d);
-
     return 0;
 
  fail:
diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c
index 2a445bb17b..86b74fb372 100644
--- a/xen/arch/x86/pv/domain.c
+++ b/xen/arch/x86/pv/domain.c
@@ -383,8 +383,6 @@ int pv_domain_initialise(struct domain *d)
 
     d->arch.ctxt_switch = &pv_csw;
 
-    d->arch.pv.xpti = is_hardware_domain(d) ? opt_xpti_hwdom : opt_xpti_domu;
-
     if ( !is_pv_32bit_domain(d) && use_invpcid && cpu_has_pcid )
         switch ( ACCESS_ONCE(opt_pcid) )
         {
diff --git a/xen/arch/x86/spec_ctrl.c b/xen/arch/x86/spec_ctrl.c
index 92405b8be7..75a4177a75 100644
--- a/xen/arch/x86/spec_ctrl.c
+++ b/xen/arch/x86/spec_ctrl.c
@@ -1748,6 +1748,10 @@ void spec_ctrl_init_domain(struct domain *d)
         (ibpb   ? SCF_entry_ibpb   : 0) |
         (bhb    ? SCF_entry_bhb    : 0) |
         0;
+
+    if ( pv )
+        d->arch.pv.xpti = is_hardware_domain(d) ? opt_xpti_hwdom
+                                                : opt_xpti_domu;
 }
 
 void __init init_speculation_mitigations(void)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 15 18:02:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Aug 2024 18:02:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778240.1188324 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seeoI-0006Cn-0P; Thu, 15 Aug 2024 18:02:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778240.1188324; Thu, 15 Aug 2024 18:02: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 1seeoH-0006Cf-Tm; Thu, 15 Aug 2024 18:02:53 +0000
Received: by outflank-mailman (input) for mailman id 778240;
 Thu, 15 Aug 2024 18:02:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seeoH-0006CY-FU
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:02:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seeoH-00017m-Em
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:02:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seeoH-0007If-E4
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:02:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4+qxi4YbN3475CKelp4I0TuxGkefDknUprV46YtgYE4=; b=AkWsFK4H92NU9+grkEVR2PYVge
	9gpWpx7GRqbfZr/yrWdVo4Q42+jW2GXQTyASBv+cpkh/NaT6CtE2V/NU6ODRBLV2/qurhksxYVOZV
	TrjRCeMXF7iRNVhseJoL2kdCXB85ZfCPfigwhdQnxNF9U4yVPqBpeqrc+R8uddFcrTss=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul: don't call ->read_segment() with x86_seg_none
Message-Id: <E1seeoH-0007If-E4@xenbits.xenproject.org>
Date: Thu, 15 Aug 2024 18:02:53 +0000

commit 5ed317c45d7323a6985797dc9a2d39d8c5df8201
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Aug 14 15:40:06 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 14 15:40:06 2024 +0200

    x86emul: don't call ->read_segment() with x86_seg_none
    
    LAR, LSL, VERR, and VERW emulation involve calling protmode_load_seg()
    with x86_seg_none. The fuzzer's read_segment() hook function has an
    assertion which triggers in this case. Calling the hook function,
    however, makes little sense for those insns, as there's no data to
    retrieve. Instead zero-filling the output structure is what properly
    corresponds to those insns being invoked with a NUL selector.
    
    While there also add a related comment at the VERR/VERW call site.
    
    Fixes: 06a3b8cd7ad2 ("x86emul: support LAR/LSL/VERR/VERW")
    Link: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=70918
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 9025382670..34b0b0fe73 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -839,7 +839,8 @@ protmode_load_seg(
         case x86_seg_tr:
             goto raise_exn;
         }
-        if ( !_amd_like(cp) || vcpu_has_nscb() || !ops->read_segment ||
+        if ( seg == x86_seg_none || !_amd_like(cp) || vcpu_has_nscb() ||
+             !ops->read_segment ||
              ops->read_segment(seg, sreg, ctxt) != X86EMUL_OKAY )
             memset(sreg, 0, sizeof(*sreg));
         else
@@ -2852,7 +2853,7 @@ x86_emulate(
                                             &sreg, ctxt, ops) )
             {
             case X86EMUL_OKAY:
-                if ( sreg.s &&
+                if ( sreg.s /* Excludes NUL selectors too. */ &&
                      ((modrm_reg & 1) ? ((sreg.type & 0xa) == 0x2)
                                       : ((sreg.type & 0xa) != 0x8)) )
                     _regs.eflags |= X86_EFLAGS_ZF;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 15 18:03:05 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 15 Aug 2024 18:03:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778241.1188328 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seeoT-0006G3-1X; Thu, 15 Aug 2024 18:03:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778241.1188328; Thu, 15 Aug 2024 18:03:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1seeoS-0006Fu-VH; Thu, 15 Aug 2024 18:03:04 +0000
Received: by outflank-mailman (input) for mailman id 778241;
 Thu, 15 Aug 2024 18:03:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seeoR-0006Fl-I4
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:03:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seeoR-000187-HT
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:03:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1seeoR-0007JN-Gk
 for xen-changelog@lists.xenproject.org; Thu, 15 Aug 2024 18:03:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hntUmn++TwYVo3ndE4tHvfv0uirfUf4NUXGXAu93gqc=; b=pqaw0HPXAeFBNz0Hh/xSU+Er8g
	MS8Z/GA/qAT6jcKZUvN8NYWvuJ8Yl03kCTtoCXf7coB3JwHpkLpZ4Cim/fYI/LUah//Bdn2luhn9F
	rksR+Up/l0AGgSawukybbv2vBjAd/ezXFmdz/VsT+AntqKH/79kYgXmIJUdzXHoq1980=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xvmalloc: please Misra C:2012 Rule 8.2
Message-Id: <E1seeoR-0007JN-Gk@xenbits.xenproject.org>
Date: Thu, 15 Aug 2024 18:03:03 +0000

commit cbe73b848286f1e6b855c0ba328d56e0014d19e6
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Aug 14 15:40:30 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Aug 14 15:40:30 2024 +0200

    xvmalloc: please Misra C:2012 Rule 8.2
    
    The cloning from xmalloc.h happened long before Misra work started in
    earnest, leading to the missing parameter name having been overlooked
    later on.
    
    Fixes: 9102fcd9579f ("mm: introduce xvmalloc() et al and use for grant table allocations")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/include/xen/xvmalloc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/include/xen/xvmalloc.h b/xen/include/xen/xvmalloc.h
index ab71a1e1a7..e1969c8596 100644
--- a/xen/include/xen/xvmalloc.h
+++ b/xen/include/xen/xvmalloc.h
@@ -41,7 +41,7 @@
                              __alignof__(typeof(*(ptr)))))
 
 /* Free any of the above. */
-void xvfree(void *);
+void xvfree(void *va);
 
 /* Free an allocation, and zero the pointer to it. */
 #define XVFREE(p) do { \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 16 23:55:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Aug 2024 23:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778831.1188808 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sf6mf-0003dI-Hb; Fri, 16 Aug 2024 23:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778831.1188808; Fri, 16 Aug 2024 23:55: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 1sf6mf-0003dA-Eq; Fri, 16 Aug 2024 23:55:05 +0000
Received: by outflank-mailman (input) for mailman id 778831;
 Fri, 16 Aug 2024 23:55:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6md-0003d4-F8
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:55:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6md-00039s-A6
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:55:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6md-0004AJ-7P
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rnOH+8n/xL2FaumAXEjgDHegAP16iFpRxODoP3QvtG4=; b=MqG/MRMQqyOMAdmJM+I7BSpTUy
	bE5pDTk+8Yi2nRGF0SOUSvaLbmJ6UCv2x74UJGbuJaQgm487TkIEpBeO+wicnYMVRXX5VilYZVfc3
	DqZCseKmWunGBRgZKV0XSCj4uc8TkhOTiD7vXm809WL/BFz+KN6X9LlmUfS3dEj3arD4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: add default QEMU_TIMEOUT value if not already set
Message-Id: <E1sf6md-0004AJ-7P@xenbits.xenproject.org>
Date: Fri, 16 Aug 2024 23:55:03 +0000

commit 1e2a5f991f86979b89aa9a60ca3ba8106ee7d987
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Thu Aug 15 18:00:34 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 16 16:50:19 2024 -0700

    automation: add default QEMU_TIMEOUT value if not already set
    
    The expectation is that QEMU_TIMEOUT should be set as a Gitlab CI/CD
    variable but if not we should be able to run the pipeline anyway.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 automation/scripts/qemu-key.exp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/automation/scripts/qemu-key.exp b/automation/scripts/qemu-key.exp
index 35eb903a31..787f1f08cb 100755
--- a/automation/scripts/qemu-key.exp
+++ b/automation/scripts/qemu-key.exp
@@ -1,6 +1,10 @@
 #!/usr/bin/expect -f
 
-set timeout $env(QEMU_TIMEOUT)
+if {[info exists env(QEMU_TIMEOUT)]} {
+    set timeout $env(QEMU_TIMEOUT)
+} else {
+    set timeout 1500
+}
 
 log_file -a $env(QEMU_LOG)
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 16 23:55:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Aug 2024 23:55:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778832.1188813 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sf6mp-0003f3-Ja; Fri, 16 Aug 2024 23:55:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778832.1188813; Fri, 16 Aug 2024 23:55: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 1sf6mp-0003ev-GL; Fri, 16 Aug 2024 23:55:15 +0000
Received: by outflank-mailman (input) for mailman id 778832;
 Fri, 16 Aug 2024 23:55:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6mn-0003ek-Ok
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:55:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6mn-0003AE-Nx
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:55:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6mn-0004BN-LT
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hDturzqf44hVD7audXfxXH0xgr3pVjTYay7eF1V9Rtg=; b=KdW2ibHnEiYSXF3halqAUQOyhC
	NptBa8GNMZjCUb5wW1fnP5Rqpm60J8MHfULNT9CRQM0c8IMv3ycvaU9bRd6vr2aiGcuDpFB7+Wupo
	FKbkLCNL+rFhnwKxIGbU9vKG/14KDV7UJWEWHo3C7Q+3fUFua6Ye9zd7ovFubw3JRSik=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] automation: disable Yocto jobs
Message-Id: <E1sf6mn-0004BN-LT@xenbits.xenproject.org>
Date: Fri, 16 Aug 2024 23:55:13 +0000

commit 51ae51301f2b4bccd365353f78510c1bdac522c9
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Aug 9 23:59:18 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 16 15:20:37 2024 -0700

    automation: disable Yocto jobs
    
    The Yocto jobs take a long time to run. We are changing Gitlab ARM64
    runners and the new runners might not be able to finish the Yocto jobs
    in a reasonable time.
    
    For now, disable the Yocto jobs by turning them into "manual" trigger
    (they need to be manually executed.)
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    master commit: 1c24bca387136d73f88f46ce3db82d34411702e8
    master date: 2024-08-09 23:59:18 -0700
---
 automation/gitlab-ci/build.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 7ce88d38e7..09895d1fbd 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -470,17 +470,20 @@ yocto-qemuarm64:
   extends: .yocto-test-arm64
   variables:
     YOCTO_BOARD: qemuarm64
+  when: manual
 
 yocto-qemuarm:
   extends: .yocto-test-arm64
   variables:
     YOCTO_BOARD: qemuarm
     YOCTO_OUTPUT: --copy-output
+  when: manual
 
 yocto-qemux86-64:
   extends: .yocto-test-x86-64
   variables:
     YOCTO_BOARD: qemux86-64
+  when: manual
 
 # Cppcheck analysis jobs
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Fri Aug 16 23:55:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Aug 2024 23:55:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778833.1188816 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sf6mz-0003i8-Kb; Fri, 16 Aug 2024 23:55:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778833.1188816; Fri, 16 Aug 2024 23:55: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 1sf6mz-0003i0-Hl; Fri, 16 Aug 2024 23:55:25 +0000
Received: by outflank-mailman (input) for mailman id 778833;
 Fri, 16 Aug 2024 23:55:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6mx-0003hl-UK
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:55:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6mx-0003AT-S0
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:55:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6mx-0004Bo-QG
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VkU8xBuBLsoRur7COk97yY0nQ2ofeOBGJ3nj6ZoJ11U=; b=DBE7J0PIm4WR/Q1sZkb42LGyuI
	kUfaSmSFIEzb1gAQkvt3D1srmo2CevO8bRvPh8zCleYcirJzglxim9YBW2VT0bkviKDHM8AjhGsYy
	/IL/9MNuuYoKMXdlTb47wlYJR5K6SPh/FrYj1OQwubpgNBRk7rDG+fr02NMq0wNO7Qpk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] automation: use expect to run QEMU
Message-Id: <E1sf6mx-0004Bo-QG@xenbits.xenproject.org>
Date: Fri, 16 Aug 2024 23:55:23 +0000

commit 0918434e0fbee48c9dccc5fe262de5a81e380c15
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Aug 9 23:59:20 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 16 15:20:54 2024 -0700

    automation: use expect to run QEMU
    
    Use expect to invoke QEMU so that we can terminate the test as soon as
    we get the right string in the output instead of waiting until the
    final timeout.
    
    For timeout, instead of an hardcoding the value, use a Gitlab CI
    variable "QEMU_TIMEOUT" that can be changed depending on the latest
    status of the Gitlab CI runners.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    master commit: c36efb7fcea6ef9f31a20e60ec79ed3ae293feee
    master date: 2024-08-09 23:59:20 -0700
---
 automation/scripts/qemu-alpine-x86_64.sh        | 16 ++++-----
 automation/scripts/qemu-key.exp                 | 45 +++++++++++++++++++++++++
 automation/scripts/qemu-smoke-dom0-arm32.sh     | 16 ++++-----
 automation/scripts/qemu-smoke-dom0-arm64.sh     | 16 ++++-----
 automation/scripts/qemu-smoke-dom0less-arm32.sh | 18 +++++-----
 automation/scripts/qemu-smoke-dom0less-arm64.sh | 16 ++++-----
 automation/scripts/qemu-smoke-ppc64le.sh        | 13 ++++---
 automation/scripts/qemu-smoke-riscv64.sh        | 13 ++++---
 automation/scripts/qemu-smoke-x86-64.sh         | 15 +++++----
 automation/scripts/qemu-xtf-dom0less-arm64.sh   | 15 ++++-----
 10 files changed, 112 insertions(+), 71 deletions(-)

diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index 8e398dcea3..5359e0820b 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -77,18 +77,16 @@ EOF
 # Run the test
 rm -f smoke.serial
 set +e
-timeout -k 1 720 \
-qemu-system-x86_64 \
+export QEMU_CMD="qemu-system-x86_64 \
     -cpu qemu64,+svm \
     -m 2G -smp 2 \
     -monitor none -serial stdio \
     -nographic \
     -device virtio-net-pci,netdev=n0 \
-    -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0 |& \
-        # Remove carriage returns from the stdout output, as gitlab
-        # interface chokes on them
-        tee smoke.serial | sed 's/\r//'
+    -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0"
 
-set -e
-(grep -q "Domain-0" smoke.serial && grep -q "BusyBox" smoke.serial) || exit 1
-exit 0
+export QEMU_LOG="smoke.serial"
+export LOG_MSG="Domain-0"
+export PASSED="BusyBox"
+
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-key.exp b/automation/scripts/qemu-key.exp
new file mode 100755
index 0000000000..35eb903a31
--- /dev/null
+++ b/automation/scripts/qemu-key.exp
@@ -0,0 +1,45 @@
+#!/usr/bin/expect -f
+
+set timeout $env(QEMU_TIMEOUT)
+
+log_file -a $env(QEMU_LOG)
+
+match_max 10000
+
+eval spawn $env(QEMU_CMD)
+
+expect_after {
+    -re "(.*)\r" {
+        exp_continue
+    }
+    timeout {send_error "ERROR-Timeout!\n"; exit 1}
+    eof {send_error "ERROR-EOF!\n"; exit 1}
+}
+
+if {[info exists env(UBOOT_CMD)]} {
+    expect "=>"
+
+    send "$env(UBOOT_CMD)\r"
+}
+
+if {[info exists env(LOG_MSG)]} {
+    expect {
+        "$env(PASSED)" {
+            expect "$env(LOG_MSG)"
+            exit 0
+        }
+        "$env(LOG_MSG)" {
+            expect "$env(PASSED)"
+            exit 0
+        }
+    }
+}
+
+expect {
+    "$env(PASSED)" {
+        exit 0
+    }
+}
+
+expect eof
+
diff --git a/automation/scripts/qemu-smoke-dom0-arm32.sh b/automation/scripts/qemu-smoke-dom0-arm32.sh
index 31c05cc840..bab66bfe44 100755
--- a/automation/scripts/qemu-smoke-dom0-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm32.sh
@@ -78,9 +78,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 
 rm -f ${serial_log}
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 720 \
-./qemu-system-arm \
+export QEMU_CMD="./qemu-system-arm \
    -machine virt \
    -machine virtualization=true \
    -smp 4 \
@@ -91,9 +89,11 @@ timeout -k 1 720 \
    -no-reboot \
    -device virtio-net-pci,netdev=n0 \
    -netdev user,id=n0,tftp=./ \
-   -bios /usr/lib/u-boot/qemu_arm/u-boot.bin |& \
-      tee ${serial_log} | sed 's/\r//'
+   -bios /usr/lib/u-boot/qemu_arm/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="${serial_log}"
+export LOG_MSG="Domain-0"
+export PASSED="/ #"
 
-set -e
-(grep -q "Domain-0" ${serial_log} && grep -q "^/ #" ${serial_log}) || exit 1
-exit 0
+../automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
index 352963a741..0094bfc8e1 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -94,9 +94,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 # Run the test
 rm -f smoke.serial
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 720 \
-./binaries/qemu-system-aarch64 \
+export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
     -m 2048 -monitor none -serial stdio \
@@ -104,9 +102,11 @@ timeout -k 1 720 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& \
-        tee smoke.serial | sed 's/\r//'
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="smoke.serial"
+export LOG_MSG="Domain-0"
+export PASSED="BusyBox"
 
-set -e
-(grep -q "Domain-0" smoke.serial && grep -q "BusyBox" smoke.serial) || exit 1
-exit 0
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
index c027c8c5c8..68ffbabdb8 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -5,7 +5,7 @@ set -ex
 test_variant=$1
 
 # Prompt to grep for to check if dom0 booted successfully
-dom0_prompt="^/ #"
+dom0_prompt="/ #"
 
 serial_log="$(pwd)/smoke.serial"
 
@@ -131,9 +131,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 # Run the test
 rm -f ${serial_log}
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 240 \
-./qemu-system-arm \
+export QEMU_CMD="./qemu-system-arm \
     -machine virt \
     -machine virtualization=true \
     -smp 4 \
@@ -144,9 +142,11 @@ timeout -k 1 240 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=./ \
-    -bios /usr/lib/u-boot/qemu_arm/u-boot.bin |& \
-        tee ${serial_log} | sed 's/\r//'
+    -bios /usr/lib/u-boot/qemu_arm/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="${serial_log}"
+export LOG_MSG="${dom0_prompt}"
+export PASSED="${passed}"
 
-set -e
-(grep -q "${dom0_prompt}" ${serial_log} && grep -q "${passed}" ${serial_log}) || exit 1
-exit 0
+../automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index 15258692d5..eb25c4af4b 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -205,9 +205,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 # Run the test
 rm -f smoke.serial
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 240 \
-./binaries/qemu-system-aarch64 \
+export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt,gic-version=$gic_version \
     -m 2048 -monitor none -serial stdio \
@@ -215,9 +213,11 @@ timeout -k 1 240 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& \
-        tee smoke.serial | sed 's/\r//'
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="smoke.serial"
+export LOG_MSG="Welcome to Alpine Linux"
+export PASSED="${passed}"
 
-set -e
-(grep -q "^Welcome to Alpine Linux" smoke.serial && grep -q "${passed}" smoke.serial) || exit 1
-exit 0
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-ppc64le.sh b/automation/scripts/qemu-smoke-ppc64le.sh
index 9088881b73..ccb4a576f4 100755
--- a/automation/scripts/qemu-smoke-ppc64le.sh
+++ b/automation/scripts/qemu-smoke-ppc64le.sh
@@ -11,8 +11,7 @@ machine=$1
 rm -f ${serial_log}
 set +e
 
-timeout -k 1 20 \
-qemu-system-ppc64 \
+export QEMU_CMD="qemu-system-ppc64 \
     -bios skiboot.lid \
     -M $machine \
     -m 2g \
@@ -21,9 +20,9 @@ qemu-system-ppc64 \
     -monitor none \
     -nographic \
     -serial stdio \
-    -kernel binaries/xen \
-    |& tee ${serial_log} | sed 's/\r//'
+    -kernel binaries/xen"
 
-set -e
-(grep -q "Hello, ppc64le!" ${serial_log}) || exit 1
-exit 0
+export QEMU_LOG="${serial_log}"
+export PASSED="Hello, ppc64le!"
+
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-riscv64.sh b/automation/scripts/qemu-smoke-riscv64.sh
index f90df3c051..0355c075b7 100755
--- a/automation/scripts/qemu-smoke-riscv64.sh
+++ b/automation/scripts/qemu-smoke-riscv64.sh
@@ -6,15 +6,14 @@ set -ex
 rm -f smoke.serial
 set +e
 
-timeout -k 1 2 \
-qemu-system-riscv64 \
+export QEMU_CMD="qemu-system-riscv64 \
     -M virt \
     -smp 1 \
     -nographic \
     -m 2g \
-    -kernel binaries/xen \
-    |& tee smoke.serial | sed 's/\r//'
+    -kernel binaries/xen"
 
-set -e
-(grep -q "All set up" smoke.serial) || exit 1
-exit 0
+export QEMU_LOG="smoke.serial"
+export PASSED="All set up"
+
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-x86-64.sh b/automation/scripts/qemu-smoke-x86-64.sh
index 3014d07314..37ac10e068 100755
--- a/automation/scripts/qemu-smoke-x86-64.sh
+++ b/automation/scripts/qemu-smoke-x86-64.sh
@@ -16,11 +16,12 @@ esac
 
 rm -f smoke.serial
 set +e
-timeout -k 1 30 \
-qemu-system-x86_64 -nographic -kernel binaries/xen \
+export QEMU_CMD="qemu-system-x86_64 -nographic -kernel binaries/xen \
         -initrd xtf/tests/example/$k \
-        -append "loglvl=all console=com1 noreboot console_timestamps=boot $extra" \
-        -m 512 -monitor none -serial file:smoke.serial
-set -e
-grep -q 'Test result: SUCCESS' smoke.serial || exit 1
-exit 0
+        -append \"loglvl=all console=com1 noreboot console_timestamps=boot $extra\" \
+        -m 512 -monitor none -serial stdio"
+
+export QEMU_LOG="smoke.serial"
+export PASSED="Test result: SUCCESS"
+
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-xtf-dom0less-arm64.sh b/automation/scripts/qemu-xtf-dom0less-arm64.sh
index b08c2d44fb..0666f6363e 100755
--- a/automation/scripts/qemu-xtf-dom0less-arm64.sh
+++ b/automation/scripts/qemu-xtf-dom0less-arm64.sh
@@ -51,9 +51,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 # Run the test
 rm -f smoke.serial
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 120 \
-./binaries/qemu-system-aarch64 \
+export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
     -m 2048 -monitor none -serial stdio \
@@ -61,9 +59,10 @@ timeout -k 1 120 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& \
-        tee smoke.serial | sed 's/\r//'
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="smoke.serial"
+export PASSED="${passed}"
 
-set -e
-(grep -q "${passed}" smoke.serial) || exit 1
-exit 0
+./automation/scripts/qemu-key.exp
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Fri Aug 16 23:55:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Aug 2024 23:55:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778834.1188820 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sf6n9-0003ku-M8; Fri, 16 Aug 2024 23:55:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778834.1188820; Fri, 16 Aug 2024 23:55: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 1sf6n9-0003km-JM; Fri, 16 Aug 2024 23:55:35 +0000
Received: by outflank-mailman (input) for mailman id 778834;
 Fri, 16 Aug 2024 23:55:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6n8-0003kb-9p
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:55:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6n8-0003Aa-8I
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:55:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6n8-0004D3-7O
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/nto167Jt1mJANiWWez76MvLk73FjO6kpvu4VcpW8MU=; b=O3FASk9YExcDZXmsPd5AToF+oa
	RBcl3zkFP+lE4Rb0Z2Ae0uR4FI16QJjl62+0Xf6IqiC1Wr8CvJo+FaSWcOV4Imj6AnNYxu2wCuzNr
	9BbxyaLpFZOoFDtWe99QevSufNLE2R70+60hvMjM/pmbAESukSskTO6+fEZcYys234sw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] automation: update tests to use Debian Bookworm
Message-Id: <E1sf6n8-0004D3-7O@xenbits.xenproject.org>
Date: Fri, 16 Aug 2024 23:55:34 +0000

commit 868a0985bf10b9c6f6139471c292f1232ee847aa
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Nov 21 17:03:56 2023 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 16 15:25:44 2024 -0700

    automation: update tests to use Debian Bookworm
    
    Switch tests using Stretch to Bookworm, as Stretch is EOL.
    
    Note the packages are not removed from the Stretch dockerfile, because the
    tests in stable branches will run using the old containers.
    
    [backport: leave the XTF jobs on x86 unchanged as they don't seem to
    work with the newer containers]
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    master commit: b78b4de1c51b741d48817aae562d9e040b072b83
    master date: 2023-11-21 17:03:56 +0100
---
 automation/build/debian/bookworm.dockerfile |  5 +++++
 automation/gitlab-ci/test.yaml              | 12 ++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/automation/build/debian/bookworm.dockerfile b/automation/build/debian/bookworm.dockerfile
index ae008c8d46..7aea081c13 100644
--- a/automation/build/debian/bookworm.dockerfile
+++ b/automation/build/debian/bookworm.dockerfile
@@ -46,6 +46,11 @@ RUN apt-get update && \
         gnupg \
         apt-transport-https \
         golang \
+        # for test phase, qemu-smoke-* jobs
+        qemu-system-x86 \
+        # for test phase, qemu-alpine-* jobs
+        cpio \
+        busybox-static \
         && \
         apt-get autoremove -y && \
         apt-get clean && \
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 61e642cce0..4d190777e1 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -43,7 +43,7 @@
 .qemu-x86-64:
   extends: .test-jobs-common
   variables:
-    CONTAINER: debian:stretch
+    CONTAINER: debian:bookworm
     LOGFILE: qemu-smoke-x86-64.log
   artifacts:
     paths:
@@ -130,7 +130,7 @@
 build-each-commit-gcc:
   extends: .test-jobs-common
   variables:
-    CONTAINER: debian:stretch
+    CONTAINER: debian:bookworm
     XEN_TARGET_ARCH: x86_64
     CC: gcc
   script:
@@ -419,6 +419,8 @@ qemu-alpine-x86_64-gcc:
 
 qemu-smoke-x86-64-gcc:
   extends: .qemu-x86-64
+  variables:
+    CONTAINER: debian:stretch
   script:
     - ./automation/scripts/qemu-smoke-x86-64.sh pv 2>&1 | tee ${LOGFILE}
   needs:
@@ -426,6 +428,8 @@ qemu-smoke-x86-64-gcc:
 
 qemu-smoke-x86-64-clang:
   extends: .qemu-x86-64
+  variables:
+    CONTAINER: debian:stretch
   script:
     - ./automation/scripts/qemu-smoke-x86-64.sh pv 2>&1 | tee ${LOGFILE}
   needs:
@@ -433,6 +437,8 @@ qemu-smoke-x86-64-clang:
 
 qemu-smoke-x86-64-gcc-pvh:
   extends: .qemu-x86-64
+  variables:
+    CONTAINER: debian:stretch
   script:
     - ./automation/scripts/qemu-smoke-x86-64.sh pvh 2>&1 | tee ${LOGFILE}
   needs:
@@ -440,6 +446,8 @@ qemu-smoke-x86-64-gcc-pvh:
 
 qemu-smoke-x86-64-clang-pvh:
   extends: .qemu-x86-64
+  variables:
+    CONTAINER: debian:stretch
   script:
     - ./automation/scripts/qemu-smoke-x86-64.sh pvh 2>&1 | tee ${LOGFILE}
   needs:
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Fri Aug 16 23:55:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Aug 2024 23:55:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778835.1188824 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sf6nJ-0003nR-NX; Fri, 16 Aug 2024 23:55:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778835.1188824; Fri, 16 Aug 2024 23:55: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 1sf6nJ-0003nJ-Ko; Fri, 16 Aug 2024 23:55:45 +0000
Received: by outflank-mailman (input) for mailman id 778835;
 Fri, 16 Aug 2024 23:55:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6nI-0003n5-Cv
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:55:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6nI-0003Ak-C6
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:55:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6nI-0004DZ-AP
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5FPUvqpIrr64L19KkqK99gswhApxT8iWt+Gol0C3m+M=; b=OaH1UybAbU07B/T6MrFWv91cBf
	YJeo5chpcyZcxac9Cu4fwJ+MyCZbBWQM3O2EcILjxVwvKNrRN3FeZnY0DkHw+2wPavdWU1KyXQe82
	SgfMBckCSXDTyAqDkTcL07LJKFxjvrp+/HWoZqkvX9sG5qXzl55FN7hNjIEAxcbJoMqc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] automation: disable Yocto jobs
Message-Id: <E1sf6nI-0004DZ-AP@xenbits.xenproject.org>
Date: Fri, 16 Aug 2024 23:55:44 +0000

commit 9530cae01ad3fc44509d1cb1d348f406c12de961
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Aug 9 23:59:18 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 16 15:26:14 2024 -0700

    automation: disable Yocto jobs
    
    The Yocto jobs take a long time to run. We are changing Gitlab ARM64
    runners and the new runners might not be able to finish the Yocto jobs
    in a reasonable time.
    
    For now, disable the Yocto jobs by turning them into "manual" trigger
    (they need to be manually executed.)
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    master commit: 1c24bca387136d73f88f46ce3db82d34411702e8
    master date: 2024-08-09 23:59:18 -0700
---
 automation/gitlab-ci/build.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 32af30cced..84e9dde25a 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -568,17 +568,20 @@ yocto-qemuarm64:
   extends: .yocto-test-arm64
   variables:
     YOCTO_BOARD: qemuarm64
+  when: manual
 
 yocto-qemuarm:
   extends: .yocto-test-arm64
   variables:
     YOCTO_BOARD: qemuarm
     YOCTO_OUTPUT: --copy-output
+  when: manual
 
 yocto-qemux86-64:
   extends: .yocto-test-arm64
   variables:
     YOCTO_BOARD: qemux86-64
+  when: manual
 
 # Cppcheck analysis jobs
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Fri Aug 16 23:55:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Aug 2024 23:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778836.1188828 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sf6nS-0003q7-Ot; Fri, 16 Aug 2024 23:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778836.1188828; Fri, 16 Aug 2024 23: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 1sf6nS-0003pz-MB; Fri, 16 Aug 2024 23:55:54 +0000
Received: by outflank-mailman (input) for mailman id 778836;
 Fri, 16 Aug 2024 23:55:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6nS-0003pq-Fk
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:55:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6nS-0003At-Ez
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:55:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6nS-0004EE-ED
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NqcBC6j+Wvqe0na89XM2n5SQsLKT7QNKc56MUiVKIXw=; b=nRdHW2EqSoRB3BAXLSzV2MepZu
	/A8AFX8ZO7VZ9VVw3Ebpeo+oKwG+sgvKObBbasgO9Ussqiaq0PsL69kDKzD2fqtkbx4QUBzlcvW5R
	0p8iTGfckL2Cn4b6dutx8Bp6jxwZ5YtmpaaOdt3UDxPtaCboI6frBXx9gbNIlXihnKyo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] automation: use expect to run QEMU
Message-Id: <E1sf6nS-0004EE-ED@xenbits.xenproject.org>
Date: Fri, 16 Aug 2024 23:55:54 +0000

commit 781c25126117f664b3ac42643b832d9ff98cc03a
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Wed Aug 14 17:49:51 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 16 15:26:14 2024 -0700

    automation: use expect to run QEMU
    
    Use expect to invoke QEMU so that we can terminate the test as soon as
    we get the right string in the output instead of waiting until the
    final timeout.
    
    For timeout, instead of an hardcoding the value, use a Gitlab CI
    variable "QEMU_TIMEOUT" that can be changed depending on the latest
    status of the Gitlab CI runners.
    
    [This backport skips the PPC and RISC scripts as well as the XTF
    scripts on x86]
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    master commit: c36efb7fcea6ef9f31a20e60ec79ed3ae293feee
    master date: 2024-08-09 23:59:20 -0700
---
 automation/scripts/qemu-alpine-x86_64.sh        | 13 +++----
 automation/scripts/qemu-key.exp                 | 45 +++++++++++++++++++++++++
 automation/scripts/qemu-smoke-dom0-arm32.sh     | 15 +++++----
 automation/scripts/qemu-smoke-dom0-arm64.sh     | 15 +++++----
 automation/scripts/qemu-smoke-dom0less-arm32.sh | 17 +++++-----
 automation/scripts/qemu-smoke-dom0less-arm64.sh | 15 +++++----
 automation/scripts/qemu-xtf-dom0less-arm64.sh   | 14 ++++----
 7 files changed, 92 insertions(+), 42 deletions(-)

diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index 8c8d0b0cd7..17eae877cf 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -77,15 +77,16 @@ EOF
 # Run the test
 rm -f smoke.serial
 set +e
-timeout -k 1 720 \
-qemu-system-x86_64 \
+export QEMU_CMD="qemu-system-x86_64 \
     -cpu qemu64,+svm \
     -m 2G -smp 2 \
     -monitor none -serial stdio \
     -nographic \
     -device virtio-net-pci,netdev=n0 \
-    -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0 |& tee smoke.serial
+    -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0"
 
-set -e
-(grep -q "Domain-0" smoke.serial && grep -q "BusyBox" smoke.serial) || exit 1
-exit 0
+export QEMU_LOG="smoke.serial"
+export LOG_MSG="Domain-0"
+export PASSED="BusyBox"
+
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-key.exp b/automation/scripts/qemu-key.exp
new file mode 100755
index 0000000000..35eb903a31
--- /dev/null
+++ b/automation/scripts/qemu-key.exp
@@ -0,0 +1,45 @@
+#!/usr/bin/expect -f
+
+set timeout $env(QEMU_TIMEOUT)
+
+log_file -a $env(QEMU_LOG)
+
+match_max 10000
+
+eval spawn $env(QEMU_CMD)
+
+expect_after {
+    -re "(.*)\r" {
+        exp_continue
+    }
+    timeout {send_error "ERROR-Timeout!\n"; exit 1}
+    eof {send_error "ERROR-EOF!\n"; exit 1}
+}
+
+if {[info exists env(UBOOT_CMD)]} {
+    expect "=>"
+
+    send "$env(UBOOT_CMD)\r"
+}
+
+if {[info exists env(LOG_MSG)]} {
+    expect {
+        "$env(PASSED)" {
+            expect "$env(LOG_MSG)"
+            exit 0
+        }
+        "$env(LOG_MSG)" {
+            expect "$env(PASSED)"
+            exit 0
+        }
+    }
+}
+
+expect {
+    "$env(PASSED)" {
+        exit 0
+    }
+}
+
+expect eof
+
diff --git a/automation/scripts/qemu-smoke-dom0-arm32.sh b/automation/scripts/qemu-smoke-dom0-arm32.sh
index e6f303064a..b90a75e427 100755
--- a/automation/scripts/qemu-smoke-dom0-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm32.sh
@@ -78,9 +78,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 
 rm -f ${serial_log}
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 720 \
-./qemu-system-arm \
+export QEMU_CMD="./qemu-system-arm \
    -machine virt \
    -machine virtualization=true \
    -smp 4 \
@@ -91,8 +89,11 @@ timeout -k 1 720 \
    -no-reboot \
    -device virtio-net-pci,netdev=n0 \
    -netdev user,id=n0,tftp=./ \
-   -bios /usr/lib/u-boot/qemu_arm/u-boot.bin |& tee ${serial_log}
+   -bios /usr/lib/u-boot/qemu_arm/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="${serial_log}"
+export LOG_MSG="Domain-0"
+export PASSED="/ #"
 
-set -e
-(grep -q "Domain-0" ${serial_log} && grep -q "^/ #" ${serial_log}) || exit 1
-exit 0
+../automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
index 0bf5cfdc61..d10f3be194 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -94,9 +94,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 # Run the test
 rm -f smoke.serial
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 720 \
-./binaries/qemu-system-aarch64 \
+export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
     -m 2048 -monitor none -serial stdio \
@@ -104,8 +102,11 @@ timeout -k 1 720 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& tee smoke.serial
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="smoke.serial"
+export LOG_MSG="Domain-0"
+export PASSED="BusyBox"
 
-set -e
-(grep -q "Domain-0" smoke.serial && grep -q "BusyBox" smoke.serial) || exit 1
-exit 0
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
index fb8f044a51..73f239a87f 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -5,7 +5,7 @@ set -ex
 test_variant=$1
 
 # Prompt to grep for to check if dom0 booted successfully
-dom0_prompt="^/ #"
+dom0_prompt="/ #"
 
 serial_log="$(pwd)/smoke.serial"
 
@@ -124,9 +124,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 # Run the test
 rm -f ${serial_log}
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 240 \
-./qemu-system-arm \
+export QEMU_CMD="./qemu-system-arm \
     -machine virt \
     -machine virtualization=true \
     -smp 4 \
@@ -137,8 +135,11 @@ timeout -k 1 240 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=./ \
-    -bios /usr/lib/u-boot/qemu_arm/u-boot.bin |& tee ${serial_log}
+    -bios /usr/lib/u-boot/qemu_arm/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="${serial_log}"
+export LOG_MSG="${dom0_prompt}"
+export PASSED="${passed}"
 
-set -e
-(grep -q "${dom0_prompt}" ${serial_log} && grep -q "${passed}" ${serial_log}) || exit 1
-exit 0
+../automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index 75f575424a..32591f5a3c 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -191,9 +191,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 # Run the test
 rm -f smoke.serial
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 240 \
-./binaries/qemu-system-aarch64 \
+export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
     -m 2048 -monitor none -serial stdio \
@@ -201,8 +199,11 @@ timeout -k 1 240 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& tee smoke.serial
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="smoke.serial"
+export LOG_MSG="Welcome to Alpine Linux"
+export PASSED="${passed}"
 
-set -e
-(grep -q "^Welcome to Alpine Linux" smoke.serial && grep -q "${passed}" smoke.serial) || exit 1
-exit 0
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-xtf-dom0less-arm64.sh b/automation/scripts/qemu-xtf-dom0less-arm64.sh
index 3ec9cf74e1..51807c3cd4 100755
--- a/automation/scripts/qemu-xtf-dom0less-arm64.sh
+++ b/automation/scripts/qemu-xtf-dom0less-arm64.sh
@@ -51,9 +51,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 # Run the test
 rm -f smoke.serial
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 120 \
-./binaries/qemu-system-aarch64 \
+export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
     -m 2048 -monitor none -serial stdio \
@@ -61,8 +59,10 @@ timeout -k 1 120 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& tee smoke.serial
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="smoke.serial"
+export PASSED="${passed}"
 
-set -e
-(grep -q "${passed}" smoke.serial) || exit 1
-exit 0
+./automation/scripts/qemu-key.exp
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Fri Aug 16 23:56:05 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Aug 2024 23:56:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778837.1188831 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sf6nd-0003ti-Ra; Fri, 16 Aug 2024 23:56:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778837.1188831; Fri, 16 Aug 2024 23:56: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 1sf6nd-0003tb-P7; Fri, 16 Aug 2024 23:56:05 +0000
Received: by outflank-mailman (input) for mailman id 778837;
 Fri, 16 Aug 2024 23:56:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6nc-0003tU-TG
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:56:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6nc-0003BD-SW
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:56:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6nc-0004GH-Rb
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:56: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Bh6/8I4yeaI+tS/B0RBSj9XY4H0KuYvjtQn6Bx14bV8=; b=X5ktcrKwSPiBcRLkTyZAkzRTRz
	HpU6aP8GyiVXLxT5mf3erVo9/ZWFHGPU+fQAoCFLSypWWiXwCU+xYG7WyQxwzvoNX5/zRB8w2uUTL
	7tLGSJ86T4jFlA/S84eadwfu2WJPPQPMmU6b2UgeFL+hcHNk9juRohvjWFE7HKaK7rs4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] automation: switch from Debian unstable to bookworm
Message-Id: <E1sf6nc-0004GH-Rb@xenbits.xenproject.org>
Date: Fri, 16 Aug 2024 23:56:04 +0000

commit d772df55c6ffa0051929e9cfca17cd52cf8acdfc
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Aug 11 19:06:49 2023 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 16 15:49:08 2024 -0700

    automation: switch from Debian unstable to bookworm
    
    Debian unstable used in the Xen containers is actually bookworm.
    Switching to bookworm which is now stable means we are not basing our
    containers on a moving target anymore.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    master commit: 8ab05119df02081f2b1c3ab471a33b9f931050ad
    master date: 2023-08-11 19:06:49 -0700
---
 .../debian/bookworm-arm64v8-arm32-gcc.dockerfile   | 23 ++++++++++
 .../build/debian/bookworm-arm64v8.dockerfile       | 49 ++++++++++++++++++++
 automation/build/debian/bookworm-i386.dockerfile   | 52 +++++++++++++++++++++
 automation/build/debian/bookworm.dockerfile        | 53 ++++++++++++++++++++++
 .../debian/unstable-arm64v8-arm32-gcc.dockerfile   | 23 ----------
 .../build/debian/unstable-arm64v8.dockerfile       | 49 --------------------
 automation/build/debian/unstable-i386.dockerfile   | 52 ---------------------
 automation/build/debian/unstable.dockerfile        | 53 ----------------------
 automation/scripts/containerize                    |  2 +-
 9 files changed, 178 insertions(+), 178 deletions(-)

diff --git a/automation/build/debian/bookworm-arm64v8-arm32-gcc.dockerfile b/automation/build/debian/bookworm-arm64v8-arm32-gcc.dockerfile
new file mode 100644
index 0000000000..b3295c435e
--- /dev/null
+++ b/automation/build/debian/bookworm-arm64v8-arm32-gcc.dockerfile
@@ -0,0 +1,23 @@
+FROM arm64v8/debian:bookworm
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV USER root
+ENV CROSS_COMPILE /usr/bin/arm-linux-gnueabihf-
+
+RUN mkdir /build
+WORKDIR /build
+
+# build depends
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        build-essential \
+        flex \
+        bison \
+        git \
+        gcc-arm-linux-gnueabihf \
+        && \
+        apt-get autoremove -y && \
+        apt-get clean && \
+        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/build/debian/bookworm-arm64v8.dockerfile b/automation/build/debian/bookworm-arm64v8.dockerfile
new file mode 100644
index 0000000000..aa5566504d
--- /dev/null
+++ b/automation/build/debian/bookworm-arm64v8.dockerfile
@@ -0,0 +1,49 @@
+FROM arm64v8/debian:bookworm
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV USER root
+
+RUN mkdir /build
+WORKDIR /build
+
+# build depends
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        build-essential \
+        zlib1g-dev \
+        libncurses5-dev \
+        libssl-dev \
+        python3-dev \
+        xorg-dev \
+        uuid-dev \
+        libyajl-dev \
+        libaio-dev \
+        libglib2.0-dev \
+        clang \
+        libpixman-1-dev \
+        pkg-config \
+        flex \
+        bison \
+        # gettext for Xen < 4.13
+        gettext \
+        acpica-tools \
+        libfdt-dev \
+        bin86 \
+        bcc \
+        liblzma-dev \
+        libnl-3-dev \
+        ocaml-nox \
+        libfindlib-ocaml-dev \
+        markdown \
+        transfig \
+        pandoc \
+        checkpolicy \
+        wget \
+        git \
+        nasm \
+        && \
+        apt-get autoremove -y && \
+        apt-get clean && \
+        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/build/debian/bookworm-i386.dockerfile b/automation/build/debian/bookworm-i386.dockerfile
new file mode 100644
index 0000000000..f663f0ef48
--- /dev/null
+++ b/automation/build/debian/bookworm-i386.dockerfile
@@ -0,0 +1,52 @@
+FROM i386/debian:bookworm
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV USER root
+
+RUN mkdir /build
+WORKDIR /build
+
+ENTRYPOINT ["linux32"]
+
+# build depends
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        build-essential \
+        zlib1g-dev \
+        libncurses5-dev \
+        libssl-dev \
+        python3-dev \
+        xorg-dev \
+        uuid-dev \
+        libyajl-dev \
+        libaio-dev \
+        libglib2.0-dev \
+        clang \
+        libpixman-1-dev \
+        pkg-config \
+        flex \
+        bison \
+        # gettext for Xen < 4.13
+        gettext \
+        acpica-tools \
+        bin86 \
+        bcc \
+        liblzma-dev \
+        libc6-dev \
+        libnl-3-dev \
+        ocaml-nox \
+        libfindlib-ocaml-dev \
+        markdown \
+        transfig \
+        pandoc \
+        checkpolicy \
+        wget \
+        git \
+        nasm \
+        apt-transport-https \
+        && \
+        apt-get autoremove -y && \
+        apt-get clean && \
+        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/build/debian/bookworm.dockerfile b/automation/build/debian/bookworm.dockerfile
new file mode 100644
index 0000000000..9f0c180b74
--- /dev/null
+++ b/automation/build/debian/bookworm.dockerfile
@@ -0,0 +1,53 @@
+FROM debian:bookworm
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV USER root
+
+RUN mkdir /build
+WORKDIR /build
+
+# build depends
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        build-essential \
+        zlib1g-dev \
+        libncurses5-dev \
+        libssl-dev \
+        python3-dev \
+        xorg-dev \
+        uuid-dev \
+        libyajl-dev \
+        libaio-dev \
+        libglib2.0-dev \
+        clang \
+        libpixman-1-dev \
+        pkg-config \
+        flex \
+        bison \
+        # gettext for Xen < 4.13
+        gettext \
+        acpica-tools \
+        bin86 \
+        bcc \
+        liblzma-dev \
+        # libc6-dev-i386 for Xen < 4.15
+        libc6-dev-i386 \
+        libnl-3-dev \
+        ocaml-nox \
+        libfindlib-ocaml-dev \
+        markdown \
+        transfig \
+        pandoc \
+        checkpolicy \
+        wget \
+        git \
+        nasm \
+        gnupg \
+        apt-transport-https \
+        golang \
+        && \
+        apt-get autoremove -y && \
+        apt-get clean && \
+        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/build/debian/unstable-arm64v8-arm32-gcc.dockerfile b/automation/build/debian/unstable-arm64v8-arm32-gcc.dockerfile
deleted file mode 100644
index 11860425a6..0000000000
--- a/automation/build/debian/unstable-arm64v8-arm32-gcc.dockerfile
+++ /dev/null
@@ -1,23 +0,0 @@
-FROM arm64v8/debian:unstable
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="xen-devel@lists.xenproject.org"
-
-ENV DEBIAN_FRONTEND=noninteractive
-ENV USER root
-ENV CROSS_COMPILE /usr/bin/arm-linux-gnueabihf-
-
-RUN mkdir /build
-WORKDIR /build
-
-# build depends
-RUN apt-get update && \
-    apt-get --quiet --yes install \
-        build-essential \
-        flex \
-        bison \
-        git \
-        gcc-arm-linux-gnueabihf \
-        && \
-        apt-get autoremove -y && \
-        apt-get clean && \
-        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/build/debian/unstable-arm64v8.dockerfile b/automation/build/debian/unstable-arm64v8.dockerfile
deleted file mode 100644
index 5c73458d9d..0000000000
--- a/automation/build/debian/unstable-arm64v8.dockerfile
+++ /dev/null
@@ -1,49 +0,0 @@
-FROM arm64v8/debian:unstable
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="xen-devel@lists.xenproject.org"
-
-ENV DEBIAN_FRONTEND=noninteractive
-ENV USER root
-
-RUN mkdir /build
-WORKDIR /build
-
-# build depends
-RUN apt-get update && \
-    apt-get --quiet --yes install \
-        build-essential \
-        zlib1g-dev \
-        libncurses5-dev \
-        libssl-dev \
-        python3-dev \
-        xorg-dev \
-        uuid-dev \
-        libyajl-dev \
-        libaio-dev \
-        libglib2.0-dev \
-        clang \
-        libpixman-1-dev \
-        pkg-config \
-        flex \
-        bison \
-        # gettext for Xen < 4.13
-        gettext \
-        acpica-tools \
-        libfdt-dev \
-        bin86 \
-        bcc \
-        liblzma-dev \
-        libnl-3-dev \
-        ocaml-nox \
-        libfindlib-ocaml-dev \
-        markdown \
-        transfig \
-        pandoc \
-        checkpolicy \
-        wget \
-        git \
-        nasm \
-        && \
-        apt-get autoremove -y && \
-        apt-get clean && \
-        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/build/debian/unstable-i386.dockerfile b/automation/build/debian/unstable-i386.dockerfile
deleted file mode 100644
index 6ce54a481b..0000000000
--- a/automation/build/debian/unstable-i386.dockerfile
+++ /dev/null
@@ -1,52 +0,0 @@
-FROM i386/debian:unstable
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="xen-devel@lists.xenproject.org"
-
-ENV DEBIAN_FRONTEND=noninteractive
-ENV USER root
-
-RUN mkdir /build
-WORKDIR /build
-
-ENTRYPOINT ["linux32"]
-
-# build depends
-RUN apt-get update && \
-    apt-get --quiet --yes install \
-        build-essential \
-        zlib1g-dev \
-        libncurses5-dev \
-        libssl-dev \
-        python3-dev \
-        xorg-dev \
-        uuid-dev \
-        libyajl-dev \
-        libaio-dev \
-        libglib2.0-dev \
-        clang \
-        libpixman-1-dev \
-        pkg-config \
-        flex \
-        bison \
-        # gettext for Xen < 4.13
-        gettext \
-        acpica-tools \
-        bin86 \
-        bcc \
-        liblzma-dev \
-        libc6-dev \
-        libnl-3-dev \
-        ocaml-nox \
-        libfindlib-ocaml-dev \
-        markdown \
-        transfig \
-        pandoc \
-        checkpolicy \
-        wget \
-        git \
-        nasm \
-        apt-transport-https \
-        && \
-        apt-get autoremove -y && \
-        apt-get clean && \
-        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/build/debian/unstable.dockerfile b/automation/build/debian/unstable.dockerfile
deleted file mode 100644
index b560337b7a..0000000000
--- a/automation/build/debian/unstable.dockerfile
+++ /dev/null
@@ -1,53 +0,0 @@
-FROM debian:unstable
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="xen-devel@lists.xenproject.org"
-
-ENV DEBIAN_FRONTEND=noninteractive
-ENV USER root
-
-RUN mkdir /build
-WORKDIR /build
-
-# build depends
-RUN apt-get update && \
-    apt-get --quiet --yes install \
-        build-essential \
-        zlib1g-dev \
-        libncurses5-dev \
-        libssl-dev \
-        python3-dev \
-        xorg-dev \
-        uuid-dev \
-        libyajl-dev \
-        libaio-dev \
-        libglib2.0-dev \
-        clang \
-        libpixman-1-dev \
-        pkg-config \
-        flex \
-        bison \
-        # gettext for Xen < 4.13
-        gettext \
-        acpica-tools \
-        bin86 \
-        bcc \
-        liblzma-dev \
-        # libc6-dev-i386 for Xen < 4.15
-        libc6-dev-i386 \
-        libnl-3-dev \
-        ocaml-nox \
-        libfindlib-ocaml-dev \
-        markdown \
-        transfig \
-        pandoc \
-        checkpolicy \
-        wget \
-        git \
-        nasm \
-        gnupg \
-        apt-transport-https \
-        golang \
-        && \
-        apt-get autoremove -y && \
-        apt-get clean && \
-        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index 9d4beca4fa..bb0f150ef2 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -34,7 +34,7 @@ case "_${CONTAINER}" in
     _jessie) CONTAINER="${BASE}/debian:jessie" ;;
     _stretch|_) CONTAINER="${BASE}/debian:stretch" ;;
     _buster-gcc-ibt) CONTAINER="${BASE}/debian:buster-gcc-ibt" ;;
-    _unstable|_) CONTAINER="${BASE}/debian:unstable" ;;
+    _bookworm|_) CONTAINER="${BASE}/debian:bookworm" ;;
     _trusty) CONTAINER="${BASE}/ubuntu:trusty" ;;
     _xenial) CONTAINER="${BASE}/ubuntu:xenial" ;;
     _opensuse-leap|_leap) CONTAINER="${BASE}/suse:opensuse-leap" ;;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Aug 16 23:56:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Aug 2024 23:56:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778839.1188836 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sf6nn-0004FO-T6; Fri, 16 Aug 2024 23:56:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778839.1188836; Fri, 16 Aug 2024 23: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 1sf6nn-0004FG-Qc; Fri, 16 Aug 2024 23:56:15 +0000
Received: by outflank-mailman (input) for mailman id 778839;
 Fri, 16 Aug 2024 23:56:15 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6nm-0004F7-WE
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:56:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6nm-0003Bg-VU
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:56:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6nm-0004H5-UZ
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:56: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jkiAxDFOlPHnoFW4giR3tmemvggKM+ACtgNhWPXaO7I=; b=ppdkxliw2M3GzvrD/Tkt99C85k
	ass6bCXzwJsRZWw6tc9nK6D7Jc3g5cf4iaWJOa4epiEPQFZ+RHvU0+H7glAhf26MbqulcbQ88Yp6X
	g5+fse7I5bvK5Q1UVl9OGu7vLktJ+VR7FCqYWqr0u0wkXm0gMPlqvCdZOWNeAvYYFBAA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] automation: update test-artifacts to use Debian Bookworm instead of unstable
Message-Id: <E1sf6nm-0004H5-UZ@xenbits.xenproject.org>
Date: Fri, 16 Aug 2024 23:56:14 +0000

commit 9f6e0151b7e279884249a82f4198eab99461f0b8
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Aug 11 19:06:50 2023 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 16 15:50:01 2024 -0700

    automation: update test-artifacts to use Debian Bookworm instead of unstable
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    master commit: 33a1c443d9808c0cd1aae761bcf517854229b38b
    master date: 2023-08-11 19:06:50 -0700
---
 automation/tests-artifacts/kernel/5.10.74.dockerfile                    | 2 +-
 automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile               | 2 +-
 automation/tests-artifacts/qemu-system-aarch64/6.0.0-arm64v8.dockerfile | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/automation/tests-artifacts/kernel/5.10.74.dockerfile b/automation/tests-artifacts/kernel/5.10.74.dockerfile
index 112e27fe45..c679f5e85a 100644
--- a/automation/tests-artifacts/kernel/5.10.74.dockerfile
+++ b/automation/tests-artifacts/kernel/5.10.74.dockerfile
@@ -1,4 +1,4 @@
-FROM debian:unstable
+FROM debian:bookworm
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
 
diff --git a/automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile b/automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile
index e445c1f03a..a53a97d727 100644
--- a/automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile
+++ b/automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile
@@ -1,4 +1,4 @@
-FROM arm64v8/debian:unstable
+FROM arm64v8/debian:bookworm
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
 
diff --git a/automation/tests-artifacts/qemu-system-aarch64/6.0.0-arm64v8.dockerfile b/automation/tests-artifacts/qemu-system-aarch64/6.0.0-arm64v8.dockerfile
index 793432d40b..e277e13b60 100644
--- a/automation/tests-artifacts/qemu-system-aarch64/6.0.0-arm64v8.dockerfile
+++ b/automation/tests-artifacts/qemu-system-aarch64/6.0.0-arm64v8.dockerfile
@@ -1,4 +1,4 @@
-FROM arm64v8/debian:unstable
+FROM arm64v8/debian:bookworm
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Aug 16 23:56:26 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Aug 2024 23:56:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778840.1188839 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sf6nx-0004VJ-Uc; Fri, 16 Aug 2024 23:56:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778840.1188839; Fri, 16 Aug 2024 23: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 1sf6nx-0004VC-SB; Fri, 16 Aug 2024 23:56:25 +0000
Received: by outflank-mailman (input) for mailman id 778840;
 Fri, 16 Aug 2024 23:56:25 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6nx-0004V6-38
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:56:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6nx-0003Bn-2K
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:56:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6nx-0004Ht-1J
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:56: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6lkE+jpn4mJ0BZL/Di21GoSE6zNMprsSW5TiXMwBc4o=; b=n7tJebmmHRYfXiRbEf7NYaHP7+
	XZYhTRecv5k6db6pXDYbcPReXdaRtEAWhbdamHrcqhUNK4gsOoVIgeK0nKdcjf4gb5pPsnJRPEO51
	SF36DTIW08r444QlLBcQuy8QnGttoLche0RbT1lN1bJKLiABcjNbAMC91wegvHTKwDvw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] automation: update jobs to use Debian Bookworm instead of unstable
Message-Id: <E1sf6nx-0004Ht-1J@xenbits.xenproject.org>
Date: Fri, 16 Aug 2024 23:56:25 +0000

commit b72f32e964cdbd58e463fad175c376a0af184a61
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Aug 11 19:06:51 2023 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 16 15:50:35 2024 -0700

    automation: update jobs to use Debian Bookworm instead of unstable
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    master commit: 2763c33c6e52583f4f599d0e195bf5b1b859df22
    master date: 2023-08-11 19:06:51 -0700
---
 automation/gitlab-ci/build.yaml | 64 ++++++++++++++++++++---------------------
 automation/gitlab-ci/test.yaml  | 16 +++++------
 2 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 802449cb96..7f170ec320 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -255,47 +255,47 @@ debian-buster-gcc-ibt:
     EXTRA_FIXED_RANDCONFIG: |
       CONFIG_XEN_IBT=y
 
-debian-unstable-clang:
+debian-bookworm-clang:
   extends: .clang-x86-64-build
   variables:
-    CONTAINER: debian:unstable
+    CONTAINER: debian:bookworm
 
-debian-unstable-clang-debug:
+debian-bookworm-clang-debug:
   extends: .clang-x86-64-build-debug
   variables:
-    CONTAINER: debian:unstable
+    CONTAINER: debian:bookworm
 
-debian-unstable-gcc:
+debian-bookworm-gcc:
   extends: .gcc-x86-64-build
   variables:
-    CONTAINER: debian:unstable
+    CONTAINER: debian:bookworm
 
-debian-unstable-gcc-debug:
+debian-bookworm-gcc-debug:
   extends: .gcc-x86-64-build-debug
   variables:
-    CONTAINER: debian:unstable
+    CONTAINER: debian:bookworm
 
-debian-unstable-gcc-randconfig:
+debian-bookworm-gcc-randconfig:
   extends: .gcc-x86-64-build
   variables:
-    CONTAINER: debian:unstable
+    CONTAINER: debian:bookworm
     RANDCONFIG: y
 
-debian-unstable-gcc-debug-randconfig:
+debian-bookworm-gcc-debug-randconfig:
   extends: .gcc-x86-64-build-debug
   variables:
-    CONTAINER: debian:unstable
+    CONTAINER: debian:bookworm
     RANDCONFIG: y
 
-debian-unstable-32-clang-debug:
+debian-bookworm-32-clang-debug:
   extends: .clang-x86-32-build-debug
   variables:
-    CONTAINER: debian:unstable-i386
+    CONTAINER: debian:bookworm-i386
 
-debian-unstable-32-gcc-debug:
+debian-bookworm-32-gcc-debug:
   extends: .gcc-x86-32-build-debug
   variables:
-    CONTAINER: debian:unstable-i386
+    CONTAINER: debian:bookworm-i386
 
 fedora-gcc:
   extends: .gcc-x86-64-build
@@ -445,50 +445,50 @@ alpine-3.12-clang-debug:
 
 # Arm32 cross-build
 
-debian-unstable-gcc-arm32:
+debian-bookworm-gcc-arm32:
   extends: .gcc-arm32-cross-build
   variables:
-    CONTAINER: debian:unstable-arm64v8-arm32-gcc
+    CONTAINER: debian:bookworm-arm64v8-arm32-gcc
 
-debian-unstable-gcc-arm32-debug:
+debian-bookworm-gcc-arm32-debug:
   extends: .gcc-arm32-cross-build-debug
   variables:
-    CONTAINER: debian:unstable-arm64v8-arm32-gcc
+    CONTAINER: debian:bookworm-arm64v8-arm32-gcc
 
-debian-unstable-gcc-arm32-randconfig:
+debian-bookworm-gcc-arm32-randconfig:
   extends: .gcc-arm32-cross-build
   variables:
-    CONTAINER: debian:unstable-arm64v8-arm32-gcc
+    CONTAINER: debian:bookworm-arm64v8-arm32-gcc
     RANDCONFIG: y
 
-debian-unstable-gcc-arm32-debug-randconfig:
+debian-bookworm-gcc-arm32-debug-randconfig:
   extends: .gcc-arm32-cross-build-debug
   variables:
-    CONTAINER: debian:unstable-arm64v8-arm32-gcc
+    CONTAINER: debian:bookworm-arm64v8-arm32-gcc
     RANDCONFIG: y
 
 # Arm builds
 
-debian-unstable-gcc-arm64:
+debian-bookworm-gcc-arm64:
   extends: .gcc-arm64-build
   variables:
-    CONTAINER: debian:unstable-arm64v8
+    CONTAINER: debian:bookworm-arm64v8
 
-debian-unstable-gcc-debug-arm64:
+debian-bookworm-gcc-debug-arm64:
   extends: .gcc-arm64-build-debug
   variables:
-    CONTAINER: debian:unstable-arm64v8
+    CONTAINER: debian:bookworm-arm64v8
 
-debian-unstable-gcc-arm64-randconfig:
+debian-bookworm-gcc-arm64-randconfig:
   extends: .gcc-arm64-build
   variables:
-    CONTAINER: debian:unstable-arm64v8
+    CONTAINER: debian:bookworm-arm64v8
     RANDCONFIG: y
 
-debian-unstable-gcc-debug-arm64-randconfig:
+debian-bookworm-gcc-debug-arm64-randconfig:
   extends: .gcc-arm64-build-debug
   variables:
-    CONTAINER: debian:unstable-arm64v8
+    CONTAINER: debian:bookworm-arm64v8
     RANDCONFIG: y
 
 alpine-3.12-gcc-arm64:
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 4f96e6e322..f1fd26d650 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -28,7 +28,7 @@ build-each-commit-gcc:
 qemu-alpine-arm64-gcc:
   extends: .test-jobs-common
   variables:
-    CONTAINER: debian:unstable-arm64v8
+    CONTAINER: debian:bookworm-arm64v8
   script:
     - ./automation/scripts/qemu-alpine-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
   needs:
@@ -65,7 +65,7 @@ qemu-alpine-x86_64-gcc:
 qemu-smoke-arm64-gcc:
   extends: .test-jobs-common
   variables:
-    CONTAINER: debian:unstable-arm64v8
+    CONTAINER: debian:bookworm-arm64v8
   script:
     - ./automation/scripts/qemu-smoke-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
   needs:
@@ -84,7 +84,7 @@ qemu-smoke-arm64-gcc:
 qemu-smoke-arm64-gcc-staticmem:
   extends: .test-jobs-common
   variables:
-    CONTAINER: debian:unstable-arm64v8
+    CONTAINER: debian:bookworm-arm64v8
   script:
     - ./automation/scripts/qemu-smoke-arm64.sh static-mem 2>&1 | tee qemu-smoke-arm64.log
   needs:
@@ -103,7 +103,7 @@ qemu-smoke-arm64-gcc-staticmem:
 qemu-smoke-arm64-gcc-boot-cpupools:
   extends: .test-jobs-common
   variables:
-    CONTAINER: debian:unstable-arm64v8
+    CONTAINER: debian:bookworm-arm64v8
   script:
     - ./automation/scripts/qemu-smoke-arm64.sh boot-cpupools 2>&1 | tee qemu-smoke-arm64.log
   needs:
@@ -122,11 +122,11 @@ qemu-smoke-arm64-gcc-boot-cpupools:
 qemu-smoke-arm32-gcc:
   extends: .test-jobs-common
   variables:
-    CONTAINER: debian:unstable-arm64v8
+    CONTAINER: debian:bookworm-arm64v8
   script:
     - ./automation/scripts/qemu-smoke-arm32.sh 2>&1 | tee qemu-smoke-arm32.log
   needs:
-    - debian-unstable-gcc-arm32
+    - debian-bookworm-gcc-arm32
     - qemu-system-aarch64-6.0.0-arm32-export
   artifacts:
     paths:
@@ -164,7 +164,7 @@ qemu-smoke-x86-64-clang:
       - '*.log'
     when: always
   needs:
-    - debian-unstable-clang-debug
+    - debian-bookworm-clang-debug
   tags:
     - x86_64
 
@@ -196,6 +196,6 @@ qemu-smoke-x86-64-clang-pvh:
       - '*.log'
     when: always
   needs:
-    - debian-unstable-clang-debug
+    - debian-bookworm-clang-debug
   tags:
     - x86_64
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Aug 16 23:56:36 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Aug 2024 23:56:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778841.1188843 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sf6o7-0004Xn-W8; Fri, 16 Aug 2024 23:56:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778841.1188843; Fri, 16 Aug 2024 23: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 1sf6o7-0004Xf-Te; Fri, 16 Aug 2024 23:56:35 +0000
Received: by outflank-mailman (input) for mailman id 778841;
 Fri, 16 Aug 2024 23:56:35 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6o7-0004XX-5t
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:56:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6o7-0003Bw-5A
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:56:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6o7-0004IM-4N
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:56:35 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=j2ungvYZe3ejJN43Wye2zSpCVHAYg2Jl+CIvbrUMIyE=; b=U8FPBdb2BK1EvClxPqg8LNN0aH
	OfBWCgGXi+smnrf9DPOTfIbb7DbltDVkjeoqKuwMtVhZ68e1eUConYvtxIJdJgDu0uwTZXjTuMtt0
	7FuUejmB0eI2mscJ3FnVHBVd7GQpbVzfyvxA8D1Uakf7SDP8xrX+RATVQBhhxznB7wDc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] automation: update tests to use Debian Bookworm
Message-Id: <E1sf6o7-0004IM-4N@xenbits.xenproject.org>
Date: Fri, 16 Aug 2024 23:56:35 +0000

commit 265aa7f52c4ab908472ea9dc4568b28e63671b23
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Nov 21 17:03:56 2023 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 16 15:51:04 2024 -0700

    automation: update tests to use Debian Bookworm
    
    Switch tests using Stretch to Bookworm, as Stretch is EOL.
    
    Note the packages are not removed from the Stretch dockerfile, because the
    tests in stable branches will run using the old containers.
    
    [backport: leave the XTF jobs on x86 unchanged as they don't seem to
    work with the newer containers]
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    master commit: b78b4de1c51b741d48817aae562d9e040b072b83
    master date: 2023-11-21 17:03:56 +0100
---
 automation/build/debian/bookworm.dockerfile | 5 +++++
 automation/gitlab-ci/test.yaml              | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/automation/build/debian/bookworm.dockerfile b/automation/build/debian/bookworm.dockerfile
index 9f0c180b74..2b1aa7b909 100644
--- a/automation/build/debian/bookworm.dockerfile
+++ b/automation/build/debian/bookworm.dockerfile
@@ -47,6 +47,11 @@ RUN apt-get update && \
         gnupg \
         apt-transport-https \
         golang \
+        # for test phase, qemu-smoke-* jobs
+        qemu-system-x86 \
+        # for test phase, qemu-alpine-* jobs
+        cpio \
+        busybox-static \
         && \
         apt-get autoremove -y && \
         apt-get clean && \
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index f1fd26d650..59698e9044 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -47,7 +47,7 @@ qemu-alpine-arm64-gcc:
 qemu-alpine-x86_64-gcc:
   extends: .test-jobs-common
   variables:
-    CONTAINER: debian:stretch
+    CONTAINER: debian:bookworm
   script:
     - ./automation/scripts/qemu-alpine-x86_64.sh 2>&1 | tee qemu-smoke-x86_64.log
   needs:
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Fri Aug 16 23:56:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 16 Aug 2024 23:56:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778842.1188847 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sf6oI-0004bS-31; Fri, 16 Aug 2024 23:56:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778842.1188847; Fri, 16 Aug 2024 23:56:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sf6oI-0004bJ-0C; Fri, 16 Aug 2024 23:56:46 +0000
Received: by outflank-mailman (input) for mailman id 778842;
 Fri, 16 Aug 2024 23:56:45 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6oH-0004bB-8e
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:56:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6oH-0003C8-7w
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:56:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sf6oH-0004Iy-79
 for xen-changelog@lists.xenproject.org; Fri, 16 Aug 2024 23:56:45 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/HijNceWqBh+/eaY3ac2sLPk9gg/IV9gfhVvJU6BQQM=; b=hMARPMiN4SvCrg9q2R+2HsitWp
	PHVhMLpjyV9bETSuA9ghOrAURTlzkrzsU1JvSmTcPLSaIrssHkYpJrDUVxWdLqI5XgBzBddvz2Wpj
	Jg+4eyUBTgoCRzKCei0AmghCunNhaAldNJbq8fk9ab0qYsn8Cg2l3gRB8XjXj2c8w7OM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.17] automation: use expect to run QEMU
Message-Id: <E1sf6oH-0004Iy-79@xenbits.xenproject.org>
Date: Fri, 16 Aug 2024 23:56:45 +0000

commit 1db6ce307b2ded04aa1f97cada1512c4395f7b51
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Wed Aug 14 17:57:54 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 16 16:03:31 2024 -0700

    automation: use expect to run QEMU
    
    Use expect to invoke QEMU so that we can terminate the test as soon as
    we get the right string in the output instead of waiting until the
    final timeout.
    
    For timeout, instead of an hardcoding the value, use a Gitlab CI
    variable "QEMU_TIMEOUT" that can be changed depending on the latest
    status of the Gitlab CI runners.
    
    [This backport skips the PPC and RISC scripts as well as the XTF
    scripts on x86]
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    master commit: c36efb7fcea6ef9f31a20e60ec79ed3ae293feee
    master date: 2024-08-09 23:59:20 -0700
---
 automation/scripts/qemu-alpine-arm64.sh  | 15 ++++++-----
 automation/scripts/qemu-alpine-x86_64.sh | 13 ++++-----
 automation/scripts/qemu-key.exp          | 45 ++++++++++++++++++++++++++++++++
 automation/scripts/qemu-smoke-arm32.sh   | 12 ++++-----
 automation/scripts/qemu-smoke-arm64.sh   | 15 ++++++-----
 5 files changed, 74 insertions(+), 26 deletions(-)

diff --git a/automation/scripts/qemu-alpine-arm64.sh b/automation/scripts/qemu-alpine-arm64.sh
index e191de3765..c76155edf9 100755
--- a/automation/scripts/qemu-alpine-arm64.sh
+++ b/automation/scripts/qemu-alpine-arm64.sh
@@ -95,9 +95,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 # Run the test
 rm -f smoke.serial
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 720 \
-./binaries/qemu-system-aarch64 \
+export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
     -m 2048 -monitor none -serial stdio \
@@ -105,8 +103,11 @@ timeout -k 1 720 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& tee smoke.serial
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="smoke.serial"
+export LOG_MSG="Domain-0"
+export PASSED="BusyBox"
 
-set -e
-(grep -q "Domain-0" smoke.serial && grep -q "BusyBox" smoke.serial) || exit 1
-exit 0
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index 8c8d0b0cd7..17eae877cf 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -77,15 +77,16 @@ EOF
 # Run the test
 rm -f smoke.serial
 set +e
-timeout -k 1 720 \
-qemu-system-x86_64 \
+export QEMU_CMD="qemu-system-x86_64 \
     -cpu qemu64,+svm \
     -m 2G -smp 2 \
     -monitor none -serial stdio \
     -nographic \
     -device virtio-net-pci,netdev=n0 \
-    -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0 |& tee smoke.serial
+    -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0"
 
-set -e
-(grep -q "Domain-0" smoke.serial && grep -q "BusyBox" smoke.serial) || exit 1
-exit 0
+export QEMU_LOG="smoke.serial"
+export LOG_MSG="Domain-0"
+export PASSED="BusyBox"
+
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-key.exp b/automation/scripts/qemu-key.exp
new file mode 100755
index 0000000000..35eb903a31
--- /dev/null
+++ b/automation/scripts/qemu-key.exp
@@ -0,0 +1,45 @@
+#!/usr/bin/expect -f
+
+set timeout $env(QEMU_TIMEOUT)
+
+log_file -a $env(QEMU_LOG)
+
+match_max 10000
+
+eval spawn $env(QEMU_CMD)
+
+expect_after {
+    -re "(.*)\r" {
+        exp_continue
+    }
+    timeout {send_error "ERROR-Timeout!\n"; exit 1}
+    eof {send_error "ERROR-EOF!\n"; exit 1}
+}
+
+if {[info exists env(UBOOT_CMD)]} {
+    expect "=>"
+
+    send "$env(UBOOT_CMD)\r"
+}
+
+if {[info exists env(LOG_MSG)]} {
+    expect {
+        "$env(PASSED)" {
+            expect "$env(LOG_MSG)"
+            exit 0
+        }
+        "$env(LOG_MSG)" {
+            expect "$env(PASSED)"
+            exit 0
+        }
+    }
+}
+
+expect {
+    "$env(PASSED)" {
+        exit 0
+    }
+}
+
+expect eof
+
diff --git a/automation/scripts/qemu-smoke-arm32.sh b/automation/scripts/qemu-smoke-arm32.sh
index 5da9533bcf..20ea90936f 100755
--- a/automation/scripts/qemu-smoke-arm32.sh
+++ b/automation/scripts/qemu-smoke-arm32.sh
@@ -55,8 +55,7 @@ dtc -I dts -O dtb virt.dts > virt.dtb
 
 rm -f smoke.serial
 set +e
-timeout -k 1 240 \
-./qemu-system-arm \
+export QEMU_CMD="./qemu-system-arm \
    -machine virt \
    -machine virtualization=true \
    -smp 4 \
@@ -68,8 +67,9 @@ timeout -k 1 240 \
    -no-reboot \
    -kernel ./xen \
    -device loader,file=./vmlinuz,addr=0x1000000 \
-   -device loader,file=./initrd.gz,addr=0x3200000 |& tee smoke.serial
+   -device loader,file=./initrd.gz,addr=0x3200000"
+
+export QEMU_LOG="smoke.serial"
+export PASSED="/ #"
 
-set -e
-(grep -q "^/ #" smoke.serial) || exit 1
-exit 0
+../automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-arm64.sh b/automation/scripts/qemu-smoke-arm64.sh
index 2b59346fdc..a9b0c22a3a 100755
--- a/automation/scripts/qemu-smoke-arm64.sh
+++ b/automation/scripts/qemu-smoke-arm64.sh
@@ -144,9 +144,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 # Run the test
 rm -f smoke.serial
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 240 \
-./binaries/qemu-system-aarch64 \
+export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
     -m 2048 -monitor none -serial stdio \
@@ -154,8 +152,11 @@ timeout -k 1 240 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& tee smoke.serial
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="smoke.serial"
+export LOG_MSG="Welcome to Alpine Linux"
+export PASSED="${passed}"
 
-set -e
-(grep -q "^Welcome to Alpine Linux" smoke.serial && grep -q "${passed}" smoke.serial) || exit 1
-exit 0
+./automation/scripts/qemu-key.exp
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17


From xen-changelog-bounces@lists.xenproject.org Sat Aug 17 13:22:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Aug 2024 13:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778981.1188918 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sfJNa-0003iq-Pi; Sat, 17 Aug 2024 13:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778981.1188918; Sat, 17 Aug 2024 13: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 1sfJNa-0003ii-Mb; Sat, 17 Aug 2024 13:22:02 +0000
Received: by outflank-mailman (input) for mailman id 778981;
 Sat, 17 Aug 2024 13:22:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfJNZ-0003ic-Sa
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 13:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfJNZ-00013W-Rd
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 13:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfJNZ-0006Q9-QQ
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 13:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7MREbP+tSzrIYD07XeJerdwkigxS1M7GkPRV0qe0ynI=; b=j+IGJKSMC2P5sHlsTwMn5z9jqC
	BSZL/At16XGR9irP3iGqqxJv5/DQUHaS4oga1PM8/EfcGeeBwbAkZCl3ie6uQz2JhK6urfHcduD6P
	QNHgO6+Q2tXkowqUQ1FFm3yHtA+Ncv7PaU3K0BqKQ7aaFaRuyZxzQERHckv4xgczbEqs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] automation: switch from Debian unstable to bookworm
Message-Id: <E1sfJNZ-0006Q9-QQ@xenbits.xenproject.org>
Date: Sat, 17 Aug 2024 13:22:01 +0000

commit d772df55c6ffa0051929e9cfca17cd52cf8acdfc
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Aug 11 19:06:49 2023 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 16 15:49:08 2024 -0700

    automation: switch from Debian unstable to bookworm
    
    Debian unstable used in the Xen containers is actually bookworm.
    Switching to bookworm which is now stable means we are not basing our
    containers on a moving target anymore.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    master commit: 8ab05119df02081f2b1c3ab471a33b9f931050ad
    master date: 2023-08-11 19:06:49 -0700
---
 .../debian/bookworm-arm64v8-arm32-gcc.dockerfile   | 23 ++++++++++
 .../build/debian/bookworm-arm64v8.dockerfile       | 49 ++++++++++++++++++++
 automation/build/debian/bookworm-i386.dockerfile   | 52 +++++++++++++++++++++
 automation/build/debian/bookworm.dockerfile        | 53 ++++++++++++++++++++++
 .../debian/unstable-arm64v8-arm32-gcc.dockerfile   | 23 ----------
 .../build/debian/unstable-arm64v8.dockerfile       | 49 --------------------
 automation/build/debian/unstable-i386.dockerfile   | 52 ---------------------
 automation/build/debian/unstable.dockerfile        | 53 ----------------------
 automation/scripts/containerize                    |  2 +-
 9 files changed, 178 insertions(+), 178 deletions(-)

diff --git a/automation/build/debian/bookworm-arm64v8-arm32-gcc.dockerfile b/automation/build/debian/bookworm-arm64v8-arm32-gcc.dockerfile
new file mode 100644
index 0000000000..b3295c435e
--- /dev/null
+++ b/automation/build/debian/bookworm-arm64v8-arm32-gcc.dockerfile
@@ -0,0 +1,23 @@
+FROM arm64v8/debian:bookworm
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV USER root
+ENV CROSS_COMPILE /usr/bin/arm-linux-gnueabihf-
+
+RUN mkdir /build
+WORKDIR /build
+
+# build depends
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        build-essential \
+        flex \
+        bison \
+        git \
+        gcc-arm-linux-gnueabihf \
+        && \
+        apt-get autoremove -y && \
+        apt-get clean && \
+        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/build/debian/bookworm-arm64v8.dockerfile b/automation/build/debian/bookworm-arm64v8.dockerfile
new file mode 100644
index 0000000000..aa5566504d
--- /dev/null
+++ b/automation/build/debian/bookworm-arm64v8.dockerfile
@@ -0,0 +1,49 @@
+FROM arm64v8/debian:bookworm
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV USER root
+
+RUN mkdir /build
+WORKDIR /build
+
+# build depends
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        build-essential \
+        zlib1g-dev \
+        libncurses5-dev \
+        libssl-dev \
+        python3-dev \
+        xorg-dev \
+        uuid-dev \
+        libyajl-dev \
+        libaio-dev \
+        libglib2.0-dev \
+        clang \
+        libpixman-1-dev \
+        pkg-config \
+        flex \
+        bison \
+        # gettext for Xen < 4.13
+        gettext \
+        acpica-tools \
+        libfdt-dev \
+        bin86 \
+        bcc \
+        liblzma-dev \
+        libnl-3-dev \
+        ocaml-nox \
+        libfindlib-ocaml-dev \
+        markdown \
+        transfig \
+        pandoc \
+        checkpolicy \
+        wget \
+        git \
+        nasm \
+        && \
+        apt-get autoremove -y && \
+        apt-get clean && \
+        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/build/debian/bookworm-i386.dockerfile b/automation/build/debian/bookworm-i386.dockerfile
new file mode 100644
index 0000000000..f663f0ef48
--- /dev/null
+++ b/automation/build/debian/bookworm-i386.dockerfile
@@ -0,0 +1,52 @@
+FROM i386/debian:bookworm
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV USER root
+
+RUN mkdir /build
+WORKDIR /build
+
+ENTRYPOINT ["linux32"]
+
+# build depends
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        build-essential \
+        zlib1g-dev \
+        libncurses5-dev \
+        libssl-dev \
+        python3-dev \
+        xorg-dev \
+        uuid-dev \
+        libyajl-dev \
+        libaio-dev \
+        libglib2.0-dev \
+        clang \
+        libpixman-1-dev \
+        pkg-config \
+        flex \
+        bison \
+        # gettext for Xen < 4.13
+        gettext \
+        acpica-tools \
+        bin86 \
+        bcc \
+        liblzma-dev \
+        libc6-dev \
+        libnl-3-dev \
+        ocaml-nox \
+        libfindlib-ocaml-dev \
+        markdown \
+        transfig \
+        pandoc \
+        checkpolicy \
+        wget \
+        git \
+        nasm \
+        apt-transport-https \
+        && \
+        apt-get autoremove -y && \
+        apt-get clean && \
+        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/build/debian/bookworm.dockerfile b/automation/build/debian/bookworm.dockerfile
new file mode 100644
index 0000000000..9f0c180b74
--- /dev/null
+++ b/automation/build/debian/bookworm.dockerfile
@@ -0,0 +1,53 @@
+FROM debian:bookworm
+LABEL maintainer.name="The Xen Project" \
+      maintainer.email="xen-devel@lists.xenproject.org"
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV USER root
+
+RUN mkdir /build
+WORKDIR /build
+
+# build depends
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        build-essential \
+        zlib1g-dev \
+        libncurses5-dev \
+        libssl-dev \
+        python3-dev \
+        xorg-dev \
+        uuid-dev \
+        libyajl-dev \
+        libaio-dev \
+        libglib2.0-dev \
+        clang \
+        libpixman-1-dev \
+        pkg-config \
+        flex \
+        bison \
+        # gettext for Xen < 4.13
+        gettext \
+        acpica-tools \
+        bin86 \
+        bcc \
+        liblzma-dev \
+        # libc6-dev-i386 for Xen < 4.15
+        libc6-dev-i386 \
+        libnl-3-dev \
+        ocaml-nox \
+        libfindlib-ocaml-dev \
+        markdown \
+        transfig \
+        pandoc \
+        checkpolicy \
+        wget \
+        git \
+        nasm \
+        gnupg \
+        apt-transport-https \
+        golang \
+        && \
+        apt-get autoremove -y && \
+        apt-get clean && \
+        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/build/debian/unstable-arm64v8-arm32-gcc.dockerfile b/automation/build/debian/unstable-arm64v8-arm32-gcc.dockerfile
deleted file mode 100644
index 11860425a6..0000000000
--- a/automation/build/debian/unstable-arm64v8-arm32-gcc.dockerfile
+++ /dev/null
@@ -1,23 +0,0 @@
-FROM arm64v8/debian:unstable
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="xen-devel@lists.xenproject.org"
-
-ENV DEBIAN_FRONTEND=noninteractive
-ENV USER root
-ENV CROSS_COMPILE /usr/bin/arm-linux-gnueabihf-
-
-RUN mkdir /build
-WORKDIR /build
-
-# build depends
-RUN apt-get update && \
-    apt-get --quiet --yes install \
-        build-essential \
-        flex \
-        bison \
-        git \
-        gcc-arm-linux-gnueabihf \
-        && \
-        apt-get autoremove -y && \
-        apt-get clean && \
-        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/build/debian/unstable-arm64v8.dockerfile b/automation/build/debian/unstable-arm64v8.dockerfile
deleted file mode 100644
index 5c73458d9d..0000000000
--- a/automation/build/debian/unstable-arm64v8.dockerfile
+++ /dev/null
@@ -1,49 +0,0 @@
-FROM arm64v8/debian:unstable
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="xen-devel@lists.xenproject.org"
-
-ENV DEBIAN_FRONTEND=noninteractive
-ENV USER root
-
-RUN mkdir /build
-WORKDIR /build
-
-# build depends
-RUN apt-get update && \
-    apt-get --quiet --yes install \
-        build-essential \
-        zlib1g-dev \
-        libncurses5-dev \
-        libssl-dev \
-        python3-dev \
-        xorg-dev \
-        uuid-dev \
-        libyajl-dev \
-        libaio-dev \
-        libglib2.0-dev \
-        clang \
-        libpixman-1-dev \
-        pkg-config \
-        flex \
-        bison \
-        # gettext for Xen < 4.13
-        gettext \
-        acpica-tools \
-        libfdt-dev \
-        bin86 \
-        bcc \
-        liblzma-dev \
-        libnl-3-dev \
-        ocaml-nox \
-        libfindlib-ocaml-dev \
-        markdown \
-        transfig \
-        pandoc \
-        checkpolicy \
-        wget \
-        git \
-        nasm \
-        && \
-        apt-get autoremove -y && \
-        apt-get clean && \
-        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/build/debian/unstable-i386.dockerfile b/automation/build/debian/unstable-i386.dockerfile
deleted file mode 100644
index 6ce54a481b..0000000000
--- a/automation/build/debian/unstable-i386.dockerfile
+++ /dev/null
@@ -1,52 +0,0 @@
-FROM i386/debian:unstable
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="xen-devel@lists.xenproject.org"
-
-ENV DEBIAN_FRONTEND=noninteractive
-ENV USER root
-
-RUN mkdir /build
-WORKDIR /build
-
-ENTRYPOINT ["linux32"]
-
-# build depends
-RUN apt-get update && \
-    apt-get --quiet --yes install \
-        build-essential \
-        zlib1g-dev \
-        libncurses5-dev \
-        libssl-dev \
-        python3-dev \
-        xorg-dev \
-        uuid-dev \
-        libyajl-dev \
-        libaio-dev \
-        libglib2.0-dev \
-        clang \
-        libpixman-1-dev \
-        pkg-config \
-        flex \
-        bison \
-        # gettext for Xen < 4.13
-        gettext \
-        acpica-tools \
-        bin86 \
-        bcc \
-        liblzma-dev \
-        libc6-dev \
-        libnl-3-dev \
-        ocaml-nox \
-        libfindlib-ocaml-dev \
-        markdown \
-        transfig \
-        pandoc \
-        checkpolicy \
-        wget \
-        git \
-        nasm \
-        apt-transport-https \
-        && \
-        apt-get autoremove -y && \
-        apt-get clean && \
-        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/build/debian/unstable.dockerfile b/automation/build/debian/unstable.dockerfile
deleted file mode 100644
index b560337b7a..0000000000
--- a/automation/build/debian/unstable.dockerfile
+++ /dev/null
@@ -1,53 +0,0 @@
-FROM debian:unstable
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="xen-devel@lists.xenproject.org"
-
-ENV DEBIAN_FRONTEND=noninteractive
-ENV USER root
-
-RUN mkdir /build
-WORKDIR /build
-
-# build depends
-RUN apt-get update && \
-    apt-get --quiet --yes install \
-        build-essential \
-        zlib1g-dev \
-        libncurses5-dev \
-        libssl-dev \
-        python3-dev \
-        xorg-dev \
-        uuid-dev \
-        libyajl-dev \
-        libaio-dev \
-        libglib2.0-dev \
-        clang \
-        libpixman-1-dev \
-        pkg-config \
-        flex \
-        bison \
-        # gettext for Xen < 4.13
-        gettext \
-        acpica-tools \
-        bin86 \
-        bcc \
-        liblzma-dev \
-        # libc6-dev-i386 for Xen < 4.15
-        libc6-dev-i386 \
-        libnl-3-dev \
-        ocaml-nox \
-        libfindlib-ocaml-dev \
-        markdown \
-        transfig \
-        pandoc \
-        checkpolicy \
-        wget \
-        git \
-        nasm \
-        gnupg \
-        apt-transport-https \
-        golang \
-        && \
-        apt-get autoremove -y && \
-        apt-get clean && \
-        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index 9d4beca4fa..bb0f150ef2 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -34,7 +34,7 @@ case "_${CONTAINER}" in
     _jessie) CONTAINER="${BASE}/debian:jessie" ;;
     _stretch|_) CONTAINER="${BASE}/debian:stretch" ;;
     _buster-gcc-ibt) CONTAINER="${BASE}/debian:buster-gcc-ibt" ;;
-    _unstable|_) CONTAINER="${BASE}/debian:unstable" ;;
+    _bookworm|_) CONTAINER="${BASE}/debian:bookworm" ;;
     _trusty) CONTAINER="${BASE}/ubuntu:trusty" ;;
     _xenial) CONTAINER="${BASE}/ubuntu:xenial" ;;
     _opensuse-leap|_leap) CONTAINER="${BASE}/suse:opensuse-leap" ;;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Sat Aug 17 13:22:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Aug 2024 13:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778982.1188921 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sfJNk-0003ko-Ql; Sat, 17 Aug 2024 13:22:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778982.1188921; Sat, 17 Aug 2024 13: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 1sfJNk-0003kg-OC; Sat, 17 Aug 2024 13:22:12 +0000
Received: by outflank-mailman (input) for mailman id 778982;
 Sat, 17 Aug 2024 13:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfJNk-0003kY-0F
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 13:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfJNj-00013a-Vi
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 13:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfJNj-0006RB-Ty
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 13:22:11 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9uwbfsp0H/VlzcqXPfQlu1joJaGyFOBOCoGI/2SjZQQ=; b=y8+KLk38CZ+Jx8oQAzHHwzjbbu
	0mL9jvYU7zEwyFUx9OmcELzVhBpUQHCztFBUZGzzTVv0xLFuotrRMIqt3Wj7QNBCg9E47nfzHceJf
	rJ6Tw/zY9OR1RMs+p9SRpR4AgUFL2KntHCC0U3wAGali1UQA7YOpCEA57kSQsD2eY8Go=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] automation: update test-artifacts to use Debian Bookworm instead of unstable
Message-Id: <E1sfJNj-0006RB-Ty@xenbits.xenproject.org>
Date: Sat, 17 Aug 2024 13:22:11 +0000

commit 9f6e0151b7e279884249a82f4198eab99461f0b8
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Aug 11 19:06:50 2023 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 16 15:50:01 2024 -0700

    automation: update test-artifacts to use Debian Bookworm instead of unstable
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    master commit: 33a1c443d9808c0cd1aae761bcf517854229b38b
    master date: 2023-08-11 19:06:50 -0700
---
 automation/tests-artifacts/kernel/5.10.74.dockerfile                    | 2 +-
 automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile               | 2 +-
 automation/tests-artifacts/qemu-system-aarch64/6.0.0-arm64v8.dockerfile | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/automation/tests-artifacts/kernel/5.10.74.dockerfile b/automation/tests-artifacts/kernel/5.10.74.dockerfile
index 112e27fe45..c679f5e85a 100644
--- a/automation/tests-artifacts/kernel/5.10.74.dockerfile
+++ b/automation/tests-artifacts/kernel/5.10.74.dockerfile
@@ -1,4 +1,4 @@
-FROM debian:unstable
+FROM debian:bookworm
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
 
diff --git a/automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile b/automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile
index e445c1f03a..a53a97d727 100644
--- a/automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile
+++ b/automation/tests-artifacts/kernel/5.19-arm64v8.dockerfile
@@ -1,4 +1,4 @@
-FROM arm64v8/debian:unstable
+FROM arm64v8/debian:bookworm
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
 
diff --git a/automation/tests-artifacts/qemu-system-aarch64/6.0.0-arm64v8.dockerfile b/automation/tests-artifacts/qemu-system-aarch64/6.0.0-arm64v8.dockerfile
index 793432d40b..e277e13b60 100644
--- a/automation/tests-artifacts/qemu-system-aarch64/6.0.0-arm64v8.dockerfile
+++ b/automation/tests-artifacts/qemu-system-aarch64/6.0.0-arm64v8.dockerfile
@@ -1,4 +1,4 @@
-FROM arm64v8/debian:unstable
+FROM arm64v8/debian:bookworm
 LABEL maintainer.name="The Xen Project" \
       maintainer.email="xen-devel@lists.xenproject.org"
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Sat Aug 17 13:22:22 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Aug 2024 13:22:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778983.1188926 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sfJNu-0003nt-SI; Sat, 17 Aug 2024 13:22:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778983.1188926; Sat, 17 Aug 2024 13:22:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sfJNu-0003nl-Pc; Sat, 17 Aug 2024 13:22:22 +0000
Received: by outflank-mailman (input) for mailman id 778983;
 Sat, 17 Aug 2024 13:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfJNu-0003na-4Y
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 13:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfJNu-00014A-30
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 13:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfJNu-0006Rg-1c
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 13:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Yt5tlaJRQytArQnZWPwDmgFAtvE6750D49KAKsmODZg=; b=Kt0m6u/VLfwc4tLXSE7sgKgA5z
	aQdumOwBPQSlAU9jl32gn0AAnJxUZVDnWlcI11akmRxLSH654K0iB/YdMHg2aUv2gknF4T7PEjbYg
	+q0dpCGfyLKR736jK4GZfPo1NztI+SuxSGT5VRtpFN3BIV+kW936xQJq2M07hLLcMKJY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] automation: update jobs to use Debian Bookworm instead of unstable
Message-Id: <E1sfJNu-0006Rg-1c@xenbits.xenproject.org>
Date: Sat, 17 Aug 2024 13:22:22 +0000

commit b72f32e964cdbd58e463fad175c376a0af184a61
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Aug 11 19:06:51 2023 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 16 15:50:35 2024 -0700

    automation: update jobs to use Debian Bookworm instead of unstable
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    master commit: 2763c33c6e52583f4f599d0e195bf5b1b859df22
    master date: 2023-08-11 19:06:51 -0700
---
 automation/gitlab-ci/build.yaml | 64 ++++++++++++++++++++---------------------
 automation/gitlab-ci/test.yaml  | 16 +++++------
 2 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 802449cb96..7f170ec320 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -255,47 +255,47 @@ debian-buster-gcc-ibt:
     EXTRA_FIXED_RANDCONFIG: |
       CONFIG_XEN_IBT=y
 
-debian-unstable-clang:
+debian-bookworm-clang:
   extends: .clang-x86-64-build
   variables:
-    CONTAINER: debian:unstable
+    CONTAINER: debian:bookworm
 
-debian-unstable-clang-debug:
+debian-bookworm-clang-debug:
   extends: .clang-x86-64-build-debug
   variables:
-    CONTAINER: debian:unstable
+    CONTAINER: debian:bookworm
 
-debian-unstable-gcc:
+debian-bookworm-gcc:
   extends: .gcc-x86-64-build
   variables:
-    CONTAINER: debian:unstable
+    CONTAINER: debian:bookworm
 
-debian-unstable-gcc-debug:
+debian-bookworm-gcc-debug:
   extends: .gcc-x86-64-build-debug
   variables:
-    CONTAINER: debian:unstable
+    CONTAINER: debian:bookworm
 
-debian-unstable-gcc-randconfig:
+debian-bookworm-gcc-randconfig:
   extends: .gcc-x86-64-build
   variables:
-    CONTAINER: debian:unstable
+    CONTAINER: debian:bookworm
     RANDCONFIG: y
 
-debian-unstable-gcc-debug-randconfig:
+debian-bookworm-gcc-debug-randconfig:
   extends: .gcc-x86-64-build-debug
   variables:
-    CONTAINER: debian:unstable
+    CONTAINER: debian:bookworm
     RANDCONFIG: y
 
-debian-unstable-32-clang-debug:
+debian-bookworm-32-clang-debug:
   extends: .clang-x86-32-build-debug
   variables:
-    CONTAINER: debian:unstable-i386
+    CONTAINER: debian:bookworm-i386
 
-debian-unstable-32-gcc-debug:
+debian-bookworm-32-gcc-debug:
   extends: .gcc-x86-32-build-debug
   variables:
-    CONTAINER: debian:unstable-i386
+    CONTAINER: debian:bookworm-i386
 
 fedora-gcc:
   extends: .gcc-x86-64-build
@@ -445,50 +445,50 @@ alpine-3.12-clang-debug:
 
 # Arm32 cross-build
 
-debian-unstable-gcc-arm32:
+debian-bookworm-gcc-arm32:
   extends: .gcc-arm32-cross-build
   variables:
-    CONTAINER: debian:unstable-arm64v8-arm32-gcc
+    CONTAINER: debian:bookworm-arm64v8-arm32-gcc
 
-debian-unstable-gcc-arm32-debug:
+debian-bookworm-gcc-arm32-debug:
   extends: .gcc-arm32-cross-build-debug
   variables:
-    CONTAINER: debian:unstable-arm64v8-arm32-gcc
+    CONTAINER: debian:bookworm-arm64v8-arm32-gcc
 
-debian-unstable-gcc-arm32-randconfig:
+debian-bookworm-gcc-arm32-randconfig:
   extends: .gcc-arm32-cross-build
   variables:
-    CONTAINER: debian:unstable-arm64v8-arm32-gcc
+    CONTAINER: debian:bookworm-arm64v8-arm32-gcc
     RANDCONFIG: y
 
-debian-unstable-gcc-arm32-debug-randconfig:
+debian-bookworm-gcc-arm32-debug-randconfig:
   extends: .gcc-arm32-cross-build-debug
   variables:
-    CONTAINER: debian:unstable-arm64v8-arm32-gcc
+    CONTAINER: debian:bookworm-arm64v8-arm32-gcc
     RANDCONFIG: y
 
 # Arm builds
 
-debian-unstable-gcc-arm64:
+debian-bookworm-gcc-arm64:
   extends: .gcc-arm64-build
   variables:
-    CONTAINER: debian:unstable-arm64v8
+    CONTAINER: debian:bookworm-arm64v8
 
-debian-unstable-gcc-debug-arm64:
+debian-bookworm-gcc-debug-arm64:
   extends: .gcc-arm64-build-debug
   variables:
-    CONTAINER: debian:unstable-arm64v8
+    CONTAINER: debian:bookworm-arm64v8
 
-debian-unstable-gcc-arm64-randconfig:
+debian-bookworm-gcc-arm64-randconfig:
   extends: .gcc-arm64-build
   variables:
-    CONTAINER: debian:unstable-arm64v8
+    CONTAINER: debian:bookworm-arm64v8
     RANDCONFIG: y
 
-debian-unstable-gcc-debug-arm64-randconfig:
+debian-bookworm-gcc-debug-arm64-randconfig:
   extends: .gcc-arm64-build-debug
   variables:
-    CONTAINER: debian:unstable-arm64v8
+    CONTAINER: debian:bookworm-arm64v8
     RANDCONFIG: y
 
 alpine-3.12-gcc-arm64:
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 4f96e6e322..f1fd26d650 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -28,7 +28,7 @@ build-each-commit-gcc:
 qemu-alpine-arm64-gcc:
   extends: .test-jobs-common
   variables:
-    CONTAINER: debian:unstable-arm64v8
+    CONTAINER: debian:bookworm-arm64v8
   script:
     - ./automation/scripts/qemu-alpine-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
   needs:
@@ -65,7 +65,7 @@ qemu-alpine-x86_64-gcc:
 qemu-smoke-arm64-gcc:
   extends: .test-jobs-common
   variables:
-    CONTAINER: debian:unstable-arm64v8
+    CONTAINER: debian:bookworm-arm64v8
   script:
     - ./automation/scripts/qemu-smoke-arm64.sh 2>&1 | tee qemu-smoke-arm64.log
   needs:
@@ -84,7 +84,7 @@ qemu-smoke-arm64-gcc:
 qemu-smoke-arm64-gcc-staticmem:
   extends: .test-jobs-common
   variables:
-    CONTAINER: debian:unstable-arm64v8
+    CONTAINER: debian:bookworm-arm64v8
   script:
     - ./automation/scripts/qemu-smoke-arm64.sh static-mem 2>&1 | tee qemu-smoke-arm64.log
   needs:
@@ -103,7 +103,7 @@ qemu-smoke-arm64-gcc-staticmem:
 qemu-smoke-arm64-gcc-boot-cpupools:
   extends: .test-jobs-common
   variables:
-    CONTAINER: debian:unstable-arm64v8
+    CONTAINER: debian:bookworm-arm64v8
   script:
     - ./automation/scripts/qemu-smoke-arm64.sh boot-cpupools 2>&1 | tee qemu-smoke-arm64.log
   needs:
@@ -122,11 +122,11 @@ qemu-smoke-arm64-gcc-boot-cpupools:
 qemu-smoke-arm32-gcc:
   extends: .test-jobs-common
   variables:
-    CONTAINER: debian:unstable-arm64v8
+    CONTAINER: debian:bookworm-arm64v8
   script:
     - ./automation/scripts/qemu-smoke-arm32.sh 2>&1 | tee qemu-smoke-arm32.log
   needs:
-    - debian-unstable-gcc-arm32
+    - debian-bookworm-gcc-arm32
     - qemu-system-aarch64-6.0.0-arm32-export
   artifacts:
     paths:
@@ -164,7 +164,7 @@ qemu-smoke-x86-64-clang:
       - '*.log'
     when: always
   needs:
-    - debian-unstable-clang-debug
+    - debian-bookworm-clang-debug
   tags:
     - x86_64
 
@@ -196,6 +196,6 @@ qemu-smoke-x86-64-clang-pvh:
       - '*.log'
     when: always
   needs:
-    - debian-unstable-clang-debug
+    - debian-bookworm-clang-debug
   tags:
     - x86_64
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Sat Aug 17 13:22:32 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Aug 2024 13:22:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778984.1188930 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sfJO4-0003r3-Ty; Sat, 17 Aug 2024 13:22:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778984.1188930; Sat, 17 Aug 2024 13:22:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sfJO4-0003qt-R7; Sat, 17 Aug 2024 13:22:32 +0000
Received: by outflank-mailman (input) for mailman id 778984;
 Sat, 17 Aug 2024 13:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfJO4-0003ql-6i
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 13:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfJO4-00014H-60
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 13:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfJO4-0006SC-5B
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 13:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rQT43jLRrPjNl2cxkZBUx94/iHLQ2gxttpBcr/x01v4=; b=Bxun5m06zZnuPsHXh91TNuoLNZ
	W9uPzJvMIUbq4m2cE+1g8r93au8p1LIlAPcL/mZyzKTG/39jlXbdh5EcIadb2CkWNhYekOgvSVTo4
	DFTm/teeSHOIY9eZ1yGHjXNV4WNAqmQddMXGeXmZY0RjqxfO7nRf6kRzXbUlnJExVKuA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] automation: update tests to use Debian Bookworm
Message-Id: <E1sfJO4-0006SC-5B@xenbits.xenproject.org>
Date: Sat, 17 Aug 2024 13:22:32 +0000

commit 265aa7f52c4ab908472ea9dc4568b28e63671b23
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Nov 21 17:03:56 2023 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 16 15:51:04 2024 -0700

    automation: update tests to use Debian Bookworm
    
    Switch tests using Stretch to Bookworm, as Stretch is EOL.
    
    Note the packages are not removed from the Stretch dockerfile, because the
    tests in stable branches will run using the old containers.
    
    [backport: leave the XTF jobs on x86 unchanged as they don't seem to
    work with the newer containers]
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    master commit: b78b4de1c51b741d48817aae562d9e040b072b83
    master date: 2023-11-21 17:03:56 +0100
---
 automation/build/debian/bookworm.dockerfile | 5 +++++
 automation/gitlab-ci/test.yaml              | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/automation/build/debian/bookworm.dockerfile b/automation/build/debian/bookworm.dockerfile
index 9f0c180b74..2b1aa7b909 100644
--- a/automation/build/debian/bookworm.dockerfile
+++ b/automation/build/debian/bookworm.dockerfile
@@ -47,6 +47,11 @@ RUN apt-get update && \
         gnupg \
         apt-transport-https \
         golang \
+        # for test phase, qemu-smoke-* jobs
+        qemu-system-x86 \
+        # for test phase, qemu-alpine-* jobs
+        cpio \
+        busybox-static \
         && \
         apt-get autoremove -y && \
         apt-get clean && \
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index f1fd26d650..59698e9044 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -47,7 +47,7 @@ qemu-alpine-arm64-gcc:
 qemu-alpine-x86_64-gcc:
   extends: .test-jobs-common
   variables:
-    CONTAINER: debian:stretch
+    CONTAINER: debian:bookworm
   script:
     - ./automation/scripts/qemu-alpine-x86_64.sh 2>&1 | tee qemu-smoke-x86_64.log
   needs:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Sat Aug 17 13:22:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Aug 2024 13:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.778985.1188934 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sfJOF-0003uX-0E; Sat, 17 Aug 2024 13:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 778985.1188934; Sat, 17 Aug 2024 13:22:42 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sfJOE-0003uQ-U3; Sat, 17 Aug 2024 13:22:42 +0000
Received: by outflank-mailman (input) for mailman id 778985;
 Sat, 17 Aug 2024 13:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfJOE-0003uI-9h
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 13:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfJOE-00014O-8q
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 13:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfJOE-0006Sd-87
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 13:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+RMZO2vm7kFZu7DZYLKqqKLrkTLqdGw+g358juUhQs0=; b=Dm8UAA96FfqN3FTcfsY1X7NNif
	cje8menSgJBVrQWEbYbJz82mifirFQd03TNqLH0GiTZaFVIb5RMSupFejyeQUDAOgYkZ0Jb4p2GSI
	wwULnSS2Hh+BfBS69oPkvvYhWN7g+UEnpenSC0hOrNEe9ByY8sFnXRzChlzTQjiMGdPY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.17] automation: use expect to run QEMU
Message-Id: <E1sfJOE-0006Sd-87@xenbits.xenproject.org>
Date: Sat, 17 Aug 2024 13:22:42 +0000

commit 1db6ce307b2ded04aa1f97cada1512c4395f7b51
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Wed Aug 14 17:57:54 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 16 16:03:31 2024 -0700

    automation: use expect to run QEMU
    
    Use expect to invoke QEMU so that we can terminate the test as soon as
    we get the right string in the output instead of waiting until the
    final timeout.
    
    For timeout, instead of an hardcoding the value, use a Gitlab CI
    variable "QEMU_TIMEOUT" that can be changed depending on the latest
    status of the Gitlab CI runners.
    
    [This backport skips the PPC and RISC scripts as well as the XTF
    scripts on x86]
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    master commit: c36efb7fcea6ef9f31a20e60ec79ed3ae293feee
    master date: 2024-08-09 23:59:20 -0700
---
 automation/scripts/qemu-alpine-arm64.sh  | 15 ++++++-----
 automation/scripts/qemu-alpine-x86_64.sh | 13 ++++-----
 automation/scripts/qemu-key.exp          | 45 ++++++++++++++++++++++++++++++++
 automation/scripts/qemu-smoke-arm32.sh   | 12 ++++-----
 automation/scripts/qemu-smoke-arm64.sh   | 15 ++++++-----
 5 files changed, 74 insertions(+), 26 deletions(-)

diff --git a/automation/scripts/qemu-alpine-arm64.sh b/automation/scripts/qemu-alpine-arm64.sh
index e191de3765..c76155edf9 100755
--- a/automation/scripts/qemu-alpine-arm64.sh
+++ b/automation/scripts/qemu-alpine-arm64.sh
@@ -95,9 +95,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 # Run the test
 rm -f smoke.serial
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 720 \
-./binaries/qemu-system-aarch64 \
+export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
     -m 2048 -monitor none -serial stdio \
@@ -105,8 +103,11 @@ timeout -k 1 720 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& tee smoke.serial
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="smoke.serial"
+export LOG_MSG="Domain-0"
+export PASSED="BusyBox"
 
-set -e
-(grep -q "Domain-0" smoke.serial && grep -q "BusyBox" smoke.serial) || exit 1
-exit 0
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index 8c8d0b0cd7..17eae877cf 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -77,15 +77,16 @@ EOF
 # Run the test
 rm -f smoke.serial
 set +e
-timeout -k 1 720 \
-qemu-system-x86_64 \
+export QEMU_CMD="qemu-system-x86_64 \
     -cpu qemu64,+svm \
     -m 2G -smp 2 \
     -monitor none -serial stdio \
     -nographic \
     -device virtio-net-pci,netdev=n0 \
-    -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0 |& tee smoke.serial
+    -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0"
 
-set -e
-(grep -q "Domain-0" smoke.serial && grep -q "BusyBox" smoke.serial) || exit 1
-exit 0
+export QEMU_LOG="smoke.serial"
+export LOG_MSG="Domain-0"
+export PASSED="BusyBox"
+
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-key.exp b/automation/scripts/qemu-key.exp
new file mode 100755
index 0000000000..35eb903a31
--- /dev/null
+++ b/automation/scripts/qemu-key.exp
@@ -0,0 +1,45 @@
+#!/usr/bin/expect -f
+
+set timeout $env(QEMU_TIMEOUT)
+
+log_file -a $env(QEMU_LOG)
+
+match_max 10000
+
+eval spawn $env(QEMU_CMD)
+
+expect_after {
+    -re "(.*)\r" {
+        exp_continue
+    }
+    timeout {send_error "ERROR-Timeout!\n"; exit 1}
+    eof {send_error "ERROR-EOF!\n"; exit 1}
+}
+
+if {[info exists env(UBOOT_CMD)]} {
+    expect "=>"
+
+    send "$env(UBOOT_CMD)\r"
+}
+
+if {[info exists env(LOG_MSG)]} {
+    expect {
+        "$env(PASSED)" {
+            expect "$env(LOG_MSG)"
+            exit 0
+        }
+        "$env(LOG_MSG)" {
+            expect "$env(PASSED)"
+            exit 0
+        }
+    }
+}
+
+expect {
+    "$env(PASSED)" {
+        exit 0
+    }
+}
+
+expect eof
+
diff --git a/automation/scripts/qemu-smoke-arm32.sh b/automation/scripts/qemu-smoke-arm32.sh
index 5da9533bcf..20ea90936f 100755
--- a/automation/scripts/qemu-smoke-arm32.sh
+++ b/automation/scripts/qemu-smoke-arm32.sh
@@ -55,8 +55,7 @@ dtc -I dts -O dtb virt.dts > virt.dtb
 
 rm -f smoke.serial
 set +e
-timeout -k 1 240 \
-./qemu-system-arm \
+export QEMU_CMD="./qemu-system-arm \
    -machine virt \
    -machine virtualization=true \
    -smp 4 \
@@ -68,8 +67,9 @@ timeout -k 1 240 \
    -no-reboot \
    -kernel ./xen \
    -device loader,file=./vmlinuz,addr=0x1000000 \
-   -device loader,file=./initrd.gz,addr=0x3200000 |& tee smoke.serial
+   -device loader,file=./initrd.gz,addr=0x3200000"
+
+export QEMU_LOG="smoke.serial"
+export PASSED="/ #"
 
-set -e
-(grep -q "^/ #" smoke.serial) || exit 1
-exit 0
+../automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-arm64.sh b/automation/scripts/qemu-smoke-arm64.sh
index 2b59346fdc..a9b0c22a3a 100755
--- a/automation/scripts/qemu-smoke-arm64.sh
+++ b/automation/scripts/qemu-smoke-arm64.sh
@@ -144,9 +144,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 # Run the test
 rm -f smoke.serial
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 240 \
-./binaries/qemu-system-aarch64 \
+export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
     -m 2048 -monitor none -serial stdio \
@@ -154,8 +152,11 @@ timeout -k 1 240 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& tee smoke.serial
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="smoke.serial"
+export LOG_MSG="Welcome to Alpine Linux"
+export PASSED="${passed}"
 
-set -e
-(grep -q "^Welcome to Alpine Linux" smoke.serial && grep -q "${passed}" smoke.serial) || exit 1
-exit 0
+./automation/scripts/qemu-key.exp
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17


From xen-changelog-bounces@lists.xenproject.org Sat Aug 17 15:22:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Aug 2024 15:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.779019.1188939 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sfLFj-0004qB-7Y; Sat, 17 Aug 2024 15:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 779019.1188939; Sat, 17 Aug 2024 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 1sfLFj-0004q3-3g; Sat, 17 Aug 2024 15:22:03 +0000
Received: by outflank-mailman (input) for mailman id 779019;
 Sat, 17 Aug 2024 15:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfLFh-0004px-Ss
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 15:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfLFh-00033f-N1
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 15:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfLFh-0005UP-Lc
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9Lcuapl+AKRs+z036FDHKYMNq20Ixgr3dn72G/yNZB4=; b=lUOdF2eDTBRV1aQH/G/CMdd5Gb
	7QlCMkVZRbiwTuS1Cmm2K5qMWPmq3rIIyae4eLiqTnOH6T+FgfY+wshqrYcMotUJMFpSaS+Z8k3Di
	sqqqtyCaN+GX+W4/PRMFD3Ao3h8qkidjrFmRgzH+ub/wCNm/teZt2sTP4S5ObUqbReFI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] automation: update tests to use Debian Bookworm
Message-Id: <E1sfLFh-0005UP-Lc@xenbits.xenproject.org>
Date: Sat, 17 Aug 2024 15:22:01 +0000

commit 868a0985bf10b9c6f6139471c292f1232ee847aa
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Nov 21 17:03:56 2023 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 16 15:25:44 2024 -0700

    automation: update tests to use Debian Bookworm
    
    Switch tests using Stretch to Bookworm, as Stretch is EOL.
    
    Note the packages are not removed from the Stretch dockerfile, because the
    tests in stable branches will run using the old containers.
    
    [backport: leave the XTF jobs on x86 unchanged as they don't seem to
    work with the newer containers]
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    master commit: b78b4de1c51b741d48817aae562d9e040b072b83
    master date: 2023-11-21 17:03:56 +0100
---
 automation/build/debian/bookworm.dockerfile |  5 +++++
 automation/gitlab-ci/test.yaml              | 12 ++++++++++--
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/automation/build/debian/bookworm.dockerfile b/automation/build/debian/bookworm.dockerfile
index ae008c8d46..7aea081c13 100644
--- a/automation/build/debian/bookworm.dockerfile
+++ b/automation/build/debian/bookworm.dockerfile
@@ -46,6 +46,11 @@ RUN apt-get update && \
         gnupg \
         apt-transport-https \
         golang \
+        # for test phase, qemu-smoke-* jobs
+        qemu-system-x86 \
+        # for test phase, qemu-alpine-* jobs
+        cpio \
+        busybox-static \
         && \
         apt-get autoremove -y && \
         apt-get clean && \
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 61e642cce0..4d190777e1 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -43,7 +43,7 @@
 .qemu-x86-64:
   extends: .test-jobs-common
   variables:
-    CONTAINER: debian:stretch
+    CONTAINER: debian:bookworm
     LOGFILE: qemu-smoke-x86-64.log
   artifacts:
     paths:
@@ -130,7 +130,7 @@
 build-each-commit-gcc:
   extends: .test-jobs-common
   variables:
-    CONTAINER: debian:stretch
+    CONTAINER: debian:bookworm
     XEN_TARGET_ARCH: x86_64
     CC: gcc
   script:
@@ -419,6 +419,8 @@ qemu-alpine-x86_64-gcc:
 
 qemu-smoke-x86-64-gcc:
   extends: .qemu-x86-64
+  variables:
+    CONTAINER: debian:stretch
   script:
     - ./automation/scripts/qemu-smoke-x86-64.sh pv 2>&1 | tee ${LOGFILE}
   needs:
@@ -426,6 +428,8 @@ qemu-smoke-x86-64-gcc:
 
 qemu-smoke-x86-64-clang:
   extends: .qemu-x86-64
+  variables:
+    CONTAINER: debian:stretch
   script:
     - ./automation/scripts/qemu-smoke-x86-64.sh pv 2>&1 | tee ${LOGFILE}
   needs:
@@ -433,6 +437,8 @@ qemu-smoke-x86-64-clang:
 
 qemu-smoke-x86-64-gcc-pvh:
   extends: .qemu-x86-64
+  variables:
+    CONTAINER: debian:stretch
   script:
     - ./automation/scripts/qemu-smoke-x86-64.sh pvh 2>&1 | tee ${LOGFILE}
   needs:
@@ -440,6 +446,8 @@ qemu-smoke-x86-64-gcc-pvh:
 
 qemu-smoke-x86-64-clang-pvh:
   extends: .qemu-x86-64
+  variables:
+    CONTAINER: debian:stretch
   script:
     - ./automation/scripts/qemu-smoke-x86-64.sh pvh 2>&1 | tee ${LOGFILE}
   needs:
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Sat Aug 17 15:22:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Aug 2024 15:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.779020.1188943 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sfLFt-0004ro-8G; Sat, 17 Aug 2024 15:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 779020.1188943; Sat, 17 Aug 2024 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 1sfLFt-0004rg-5F; Sat, 17 Aug 2024 15:22:13 +0000
Received: by outflank-mailman (input) for mailman id 779020;
 Sat, 17 Aug 2024 15:22:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfLFr-0004rP-SL
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 15:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfLFr-00033y-RW
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 15:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfLFr-0005VA-PI
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bihb0o7LF6n+nUzyqv0cMC0Rbtxn5E7DXOIQ2uS9jMo=; b=WGNxtleSaUWwi33h3tQWGRXudH
	sX8oPFPGRyBwUJCFFONyRtNcfZKkjD70h7EQgeWhQW3UPaXk3vBlT4SvFmLv0KRjSJpx2cdHcAnLg
	qLFT+2PbKrsdqJNDRgOeVAYyuDxnlY61ixehWPRCjF82UTr5RnDKHwlIFhLGh7+nQawE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] automation: disable Yocto jobs
Message-Id: <E1sfLFr-0005VA-PI@xenbits.xenproject.org>
Date: Sat, 17 Aug 2024 15:22:11 +0000

commit 9530cae01ad3fc44509d1cb1d348f406c12de961
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Aug 9 23:59:18 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 16 15:26:14 2024 -0700

    automation: disable Yocto jobs
    
    The Yocto jobs take a long time to run. We are changing Gitlab ARM64
    runners and the new runners might not be able to finish the Yocto jobs
    in a reasonable time.
    
    For now, disable the Yocto jobs by turning them into "manual" trigger
    (they need to be manually executed.)
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    master commit: 1c24bca387136d73f88f46ce3db82d34411702e8
    master date: 2024-08-09 23:59:18 -0700
---
 automation/gitlab-ci/build.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 32af30cced..84e9dde25a 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -568,17 +568,20 @@ yocto-qemuarm64:
   extends: .yocto-test-arm64
   variables:
     YOCTO_BOARD: qemuarm64
+  when: manual
 
 yocto-qemuarm:
   extends: .yocto-test-arm64
   variables:
     YOCTO_BOARD: qemuarm
     YOCTO_OUTPUT: --copy-output
+  when: manual
 
 yocto-qemux86-64:
   extends: .yocto-test-arm64
   variables:
     YOCTO_BOARD: qemux86-64
+  when: manual
 
 # Cppcheck analysis jobs
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Sat Aug 17 15:22:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Aug 2024 15:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.779021.1188945 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sfLG3-0004uS-9V; Sat, 17 Aug 2024 15:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 779021.1188945; Sat, 17 Aug 2024 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 1sfLG3-0004uL-6c; Sat, 17 Aug 2024 15:22:23 +0000
Received: by outflank-mailman (input) for mailman id 779021;
 Sat, 17 Aug 2024 15:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfLG2-0004tz-0G
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 15:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfLG1-00034Z-Va
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 15:22:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfLG1-0005Vm-Tv
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 15: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IwSo+SqpEikhplSfsTTro2p+uPl3MuM7T7Jp/qzgYM4=; b=qAkvvh90cxCaS06HeXFagr5Au5
	AAMKEmChk0gWcmv81wD4OzRWbSfhqbicGF+s2hG6SxRFk3G92+AocIyBi2NRS7pstNP654Z4EbsAg
	HRml9Y0iZi64YMIdrx4q0EmfgMS90MoTec2UBI6jv0tl3yZNvXcqacIA+na22uFANLP0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.18] automation: use expect to run QEMU
Message-Id: <E1sfLG1-0005Vm-Tv@xenbits.xenproject.org>
Date: Sat, 17 Aug 2024 15:22:21 +0000

commit 781c25126117f664b3ac42643b832d9ff98cc03a
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Wed Aug 14 17:49:51 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 16 15:26:14 2024 -0700

    automation: use expect to run QEMU
    
    Use expect to invoke QEMU so that we can terminate the test as soon as
    we get the right string in the output instead of waiting until the
    final timeout.
    
    For timeout, instead of an hardcoding the value, use a Gitlab CI
    variable "QEMU_TIMEOUT" that can be changed depending on the latest
    status of the Gitlab CI runners.
    
    [This backport skips the PPC and RISC scripts as well as the XTF
    scripts on x86]
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    master commit: c36efb7fcea6ef9f31a20e60ec79ed3ae293feee
    master date: 2024-08-09 23:59:20 -0700
---
 automation/scripts/qemu-alpine-x86_64.sh        | 13 +++----
 automation/scripts/qemu-key.exp                 | 45 +++++++++++++++++++++++++
 automation/scripts/qemu-smoke-dom0-arm32.sh     | 15 +++++----
 automation/scripts/qemu-smoke-dom0-arm64.sh     | 15 +++++----
 automation/scripts/qemu-smoke-dom0less-arm32.sh | 17 +++++-----
 automation/scripts/qemu-smoke-dom0less-arm64.sh | 15 +++++----
 automation/scripts/qemu-xtf-dom0less-arm64.sh   | 14 ++++----
 7 files changed, 92 insertions(+), 42 deletions(-)

diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index 8c8d0b0cd7..17eae877cf 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -77,15 +77,16 @@ EOF
 # Run the test
 rm -f smoke.serial
 set +e
-timeout -k 1 720 \
-qemu-system-x86_64 \
+export QEMU_CMD="qemu-system-x86_64 \
     -cpu qemu64,+svm \
     -m 2G -smp 2 \
     -monitor none -serial stdio \
     -nographic \
     -device virtio-net-pci,netdev=n0 \
-    -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0 |& tee smoke.serial
+    -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0"
 
-set -e
-(grep -q "Domain-0" smoke.serial && grep -q "BusyBox" smoke.serial) || exit 1
-exit 0
+export QEMU_LOG="smoke.serial"
+export LOG_MSG="Domain-0"
+export PASSED="BusyBox"
+
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-key.exp b/automation/scripts/qemu-key.exp
new file mode 100755
index 0000000000..35eb903a31
--- /dev/null
+++ b/automation/scripts/qemu-key.exp
@@ -0,0 +1,45 @@
+#!/usr/bin/expect -f
+
+set timeout $env(QEMU_TIMEOUT)
+
+log_file -a $env(QEMU_LOG)
+
+match_max 10000
+
+eval spawn $env(QEMU_CMD)
+
+expect_after {
+    -re "(.*)\r" {
+        exp_continue
+    }
+    timeout {send_error "ERROR-Timeout!\n"; exit 1}
+    eof {send_error "ERROR-EOF!\n"; exit 1}
+}
+
+if {[info exists env(UBOOT_CMD)]} {
+    expect "=>"
+
+    send "$env(UBOOT_CMD)\r"
+}
+
+if {[info exists env(LOG_MSG)]} {
+    expect {
+        "$env(PASSED)" {
+            expect "$env(LOG_MSG)"
+            exit 0
+        }
+        "$env(LOG_MSG)" {
+            expect "$env(PASSED)"
+            exit 0
+        }
+    }
+}
+
+expect {
+    "$env(PASSED)" {
+        exit 0
+    }
+}
+
+expect eof
+
diff --git a/automation/scripts/qemu-smoke-dom0-arm32.sh b/automation/scripts/qemu-smoke-dom0-arm32.sh
index e6f303064a..b90a75e427 100755
--- a/automation/scripts/qemu-smoke-dom0-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm32.sh
@@ -78,9 +78,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 
 rm -f ${serial_log}
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 720 \
-./qemu-system-arm \
+export QEMU_CMD="./qemu-system-arm \
    -machine virt \
    -machine virtualization=true \
    -smp 4 \
@@ -91,8 +89,11 @@ timeout -k 1 720 \
    -no-reboot \
    -device virtio-net-pci,netdev=n0 \
    -netdev user,id=n0,tftp=./ \
-   -bios /usr/lib/u-boot/qemu_arm/u-boot.bin |& tee ${serial_log}
+   -bios /usr/lib/u-boot/qemu_arm/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="${serial_log}"
+export LOG_MSG="Domain-0"
+export PASSED="/ #"
 
-set -e
-(grep -q "Domain-0" ${serial_log} && grep -q "^/ #" ${serial_log}) || exit 1
-exit 0
+../automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
index 0bf5cfdc61..d10f3be194 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -94,9 +94,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 # Run the test
 rm -f smoke.serial
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 720 \
-./binaries/qemu-system-aarch64 \
+export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
     -m 2048 -monitor none -serial stdio \
@@ -104,8 +102,11 @@ timeout -k 1 720 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& tee smoke.serial
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="smoke.serial"
+export LOG_MSG="Domain-0"
+export PASSED="BusyBox"
 
-set -e
-(grep -q "Domain-0" smoke.serial && grep -q "BusyBox" smoke.serial) || exit 1
-exit 0
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
index fb8f044a51..73f239a87f 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -5,7 +5,7 @@ set -ex
 test_variant=$1
 
 # Prompt to grep for to check if dom0 booted successfully
-dom0_prompt="^/ #"
+dom0_prompt="/ #"
 
 serial_log="$(pwd)/smoke.serial"
 
@@ -124,9 +124,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 # Run the test
 rm -f ${serial_log}
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 240 \
-./qemu-system-arm \
+export QEMU_CMD="./qemu-system-arm \
     -machine virt \
     -machine virtualization=true \
     -smp 4 \
@@ -137,8 +135,11 @@ timeout -k 1 240 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=./ \
-    -bios /usr/lib/u-boot/qemu_arm/u-boot.bin |& tee ${serial_log}
+    -bios /usr/lib/u-boot/qemu_arm/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="${serial_log}"
+export LOG_MSG="${dom0_prompt}"
+export PASSED="${passed}"
 
-set -e
-(grep -q "${dom0_prompt}" ${serial_log} && grep -q "${passed}" ${serial_log}) || exit 1
-exit 0
+../automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index 75f575424a..32591f5a3c 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -191,9 +191,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 # Run the test
 rm -f smoke.serial
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 240 \
-./binaries/qemu-system-aarch64 \
+export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
     -m 2048 -monitor none -serial stdio \
@@ -201,8 +199,11 @@ timeout -k 1 240 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& tee smoke.serial
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="smoke.serial"
+export LOG_MSG="Welcome to Alpine Linux"
+export PASSED="${passed}"
 
-set -e
-(grep -q "^Welcome to Alpine Linux" smoke.serial && grep -q "${passed}" smoke.serial) || exit 1
-exit 0
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-xtf-dom0less-arm64.sh b/automation/scripts/qemu-xtf-dom0less-arm64.sh
index 3ec9cf74e1..51807c3cd4 100755
--- a/automation/scripts/qemu-xtf-dom0less-arm64.sh
+++ b/automation/scripts/qemu-xtf-dom0less-arm64.sh
@@ -51,9 +51,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 # Run the test
 rm -f smoke.serial
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 120 \
-./binaries/qemu-system-aarch64 \
+export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
     -m 2048 -monitor none -serial stdio \
@@ -61,8 +59,10 @@ timeout -k 1 120 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& tee smoke.serial
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="smoke.serial"
+export PASSED="${passed}"
 
-set -e
-(grep -q "${passed}" smoke.serial) || exit 1
-exit 0
+./automation/scripts/qemu-key.exp
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Sat Aug 17 18:44:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Aug 2024 18:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.779051.1188961 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sfOPC-0001sD-Vo; Sat, 17 Aug 2024 18:44:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 779051.1188961; Sat, 17 Aug 2024 18: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 1sfOPC-0001s4-S4; Sat, 17 Aug 2024 18:44:02 +0000
Received: by outflank-mailman (input) for mailman id 779051;
 Sat, 17 Aug 2024 18:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfOPB-0001ry-FE
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 18:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfOPB-0006wo-Dk
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 18:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfOPB-0005SH-C4
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 18: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8T3HPSmZVKWB4qS45Mrpik9mRtZ9R4+DuljQRql/LFY=; b=483wACTkBs+0BfQHbJzQEwoEDY
	PHhwXDR2Xog/q/BJRaPuGMEeVYpOarzFMt1/fMVLZaJI7Zz0D36aU/LMK5yCJu4/CiHXRIopYIr9s
	Ur7dvleU8pWYntiAG4/HMUGLMUbLw9GTV/kiwbwcgXZA0I70JqeHv9waT4u9cr5acMyA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] automation: disable Yocto jobs
Message-Id: <E1sfOPB-0005SH-C4@xenbits.xenproject.org>
Date: Sat, 17 Aug 2024 18:44:01 +0000

commit 51ae51301f2b4bccd365353f78510c1bdac522c9
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Aug 9 23:59:18 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 16 15:20:37 2024 -0700

    automation: disable Yocto jobs
    
    The Yocto jobs take a long time to run. We are changing Gitlab ARM64
    runners and the new runners might not be able to finish the Yocto jobs
    in a reasonable time.
    
    For now, disable the Yocto jobs by turning them into "manual" trigger
    (they need to be manually executed.)
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    master commit: 1c24bca387136d73f88f46ce3db82d34411702e8
    master date: 2024-08-09 23:59:18 -0700
---
 automation/gitlab-ci/build.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 7ce88d38e7..09895d1fbd 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -470,17 +470,20 @@ yocto-qemuarm64:
   extends: .yocto-test-arm64
   variables:
     YOCTO_BOARD: qemuarm64
+  when: manual
 
 yocto-qemuarm:
   extends: .yocto-test-arm64
   variables:
     YOCTO_BOARD: qemuarm
     YOCTO_OUTPUT: --copy-output
+  when: manual
 
 yocto-qemux86-64:
   extends: .yocto-test-x86-64
   variables:
     YOCTO_BOARD: qemux86-64
+  when: manual
 
 # Cppcheck analysis jobs
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Sat Aug 17 18:44:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 17 Aug 2024 18:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.779052.1188964 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sfOPO-0001v7-2m; Sat, 17 Aug 2024 18:44:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 779052.1188964; Sat, 17 Aug 2024 18: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 1sfOPN-0001uz-Vc; Sat, 17 Aug 2024 18:44:13 +0000
Received: by outflank-mailman (input) for mailman id 779052;
 Sat, 17 Aug 2024 18:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfOPM-0001u8-C9
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 18:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfOPL-0006x9-H0
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 18:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sfOPL-0005T9-G4
 for xen-changelog@lists.xenproject.org; Sat, 17 Aug 2024 18: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cUP63r/zZGNL2mAgmPmScs8yhbeGVCuwyf1ZxQiWWEk=; b=xIXDuvIJcvU5gV6ugoy0WmCtvC
	oVNZOxKRdCBh/Hse/U/f/JrKzwknvVSBiDP0rlSi4wb3G7rZV6R78/I1sZlDOdM5QXhagrkn7kk87
	v96uaVRkkoyFL3ST3vn/yIWHizMY1qI9ssb7+h/E+iP6BRfVNBNabdoYI63XlPG92VuM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen stable-4.19] automation: use expect to run QEMU
Message-Id: <E1sfOPL-0005T9-G4@xenbits.xenproject.org>
Date: Sat, 17 Aug 2024 18:44:11 +0000

commit 0918434e0fbee48c9dccc5fe262de5a81e380c15
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Fri Aug 9 23:59:20 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 16 15:20:54 2024 -0700

    automation: use expect to run QEMU
    
    Use expect to invoke QEMU so that we can terminate the test as soon as
    we get the right string in the output instead of waiting until the
    final timeout.
    
    For timeout, instead of an hardcoding the value, use a Gitlab CI
    variable "QEMU_TIMEOUT" that can be changed depending on the latest
    status of the Gitlab CI runners.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
    master commit: c36efb7fcea6ef9f31a20e60ec79ed3ae293feee
    master date: 2024-08-09 23:59:20 -0700
---
 automation/scripts/qemu-alpine-x86_64.sh        | 16 ++++-----
 automation/scripts/qemu-key.exp                 | 45 +++++++++++++++++++++++++
 automation/scripts/qemu-smoke-dom0-arm32.sh     | 16 ++++-----
 automation/scripts/qemu-smoke-dom0-arm64.sh     | 16 ++++-----
 automation/scripts/qemu-smoke-dom0less-arm32.sh | 18 +++++-----
 automation/scripts/qemu-smoke-dom0less-arm64.sh | 16 ++++-----
 automation/scripts/qemu-smoke-ppc64le.sh        | 13 ++++---
 automation/scripts/qemu-smoke-riscv64.sh        | 13 ++++---
 automation/scripts/qemu-smoke-x86-64.sh         | 15 +++++----
 automation/scripts/qemu-xtf-dom0less-arm64.sh   | 15 ++++-----
 10 files changed, 112 insertions(+), 71 deletions(-)

diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index 8e398dcea3..5359e0820b 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -77,18 +77,16 @@ EOF
 # Run the test
 rm -f smoke.serial
 set +e
-timeout -k 1 720 \
-qemu-system-x86_64 \
+export QEMU_CMD="qemu-system-x86_64 \
     -cpu qemu64,+svm \
     -m 2G -smp 2 \
     -monitor none -serial stdio \
     -nographic \
     -device virtio-net-pci,netdev=n0 \
-    -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0 |& \
-        # Remove carriage returns from the stdout output, as gitlab
-        # interface chokes on them
-        tee smoke.serial | sed 's/\r//'
+    -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0"
 
-set -e
-(grep -q "Domain-0" smoke.serial && grep -q "BusyBox" smoke.serial) || exit 1
-exit 0
+export QEMU_LOG="smoke.serial"
+export LOG_MSG="Domain-0"
+export PASSED="BusyBox"
+
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-key.exp b/automation/scripts/qemu-key.exp
new file mode 100755
index 0000000000..35eb903a31
--- /dev/null
+++ b/automation/scripts/qemu-key.exp
@@ -0,0 +1,45 @@
+#!/usr/bin/expect -f
+
+set timeout $env(QEMU_TIMEOUT)
+
+log_file -a $env(QEMU_LOG)
+
+match_max 10000
+
+eval spawn $env(QEMU_CMD)
+
+expect_after {
+    -re "(.*)\r" {
+        exp_continue
+    }
+    timeout {send_error "ERROR-Timeout!\n"; exit 1}
+    eof {send_error "ERROR-EOF!\n"; exit 1}
+}
+
+if {[info exists env(UBOOT_CMD)]} {
+    expect "=>"
+
+    send "$env(UBOOT_CMD)\r"
+}
+
+if {[info exists env(LOG_MSG)]} {
+    expect {
+        "$env(PASSED)" {
+            expect "$env(LOG_MSG)"
+            exit 0
+        }
+        "$env(LOG_MSG)" {
+            expect "$env(PASSED)"
+            exit 0
+        }
+    }
+}
+
+expect {
+    "$env(PASSED)" {
+        exit 0
+    }
+}
+
+expect eof
+
diff --git a/automation/scripts/qemu-smoke-dom0-arm32.sh b/automation/scripts/qemu-smoke-dom0-arm32.sh
index 31c05cc840..bab66bfe44 100755
--- a/automation/scripts/qemu-smoke-dom0-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm32.sh
@@ -78,9 +78,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 
 rm -f ${serial_log}
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 720 \
-./qemu-system-arm \
+export QEMU_CMD="./qemu-system-arm \
    -machine virt \
    -machine virtualization=true \
    -smp 4 \
@@ -91,9 +89,11 @@ timeout -k 1 720 \
    -no-reboot \
    -device virtio-net-pci,netdev=n0 \
    -netdev user,id=n0,tftp=./ \
-   -bios /usr/lib/u-boot/qemu_arm/u-boot.bin |& \
-      tee ${serial_log} | sed 's/\r//'
+   -bios /usr/lib/u-boot/qemu_arm/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="${serial_log}"
+export LOG_MSG="Domain-0"
+export PASSED="/ #"
 
-set -e
-(grep -q "Domain-0" ${serial_log} && grep -q "^/ #" ${serial_log}) || exit 1
-exit 0
+../automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
index 352963a741..0094bfc8e1 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -94,9 +94,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 # Run the test
 rm -f smoke.serial
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 720 \
-./binaries/qemu-system-aarch64 \
+export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
     -m 2048 -monitor none -serial stdio \
@@ -104,9 +102,11 @@ timeout -k 1 720 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& \
-        tee smoke.serial | sed 's/\r//'
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="smoke.serial"
+export LOG_MSG="Domain-0"
+export PASSED="BusyBox"
 
-set -e
-(grep -q "Domain-0" smoke.serial && grep -q "BusyBox" smoke.serial) || exit 1
-exit 0
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
index c027c8c5c8..68ffbabdb8 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -5,7 +5,7 @@ set -ex
 test_variant=$1
 
 # Prompt to grep for to check if dom0 booted successfully
-dom0_prompt="^/ #"
+dom0_prompt="/ #"
 
 serial_log="$(pwd)/smoke.serial"
 
@@ -131,9 +131,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 # Run the test
 rm -f ${serial_log}
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 240 \
-./qemu-system-arm \
+export QEMU_CMD="./qemu-system-arm \
     -machine virt \
     -machine virtualization=true \
     -smp 4 \
@@ -144,9 +142,11 @@ timeout -k 1 240 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=./ \
-    -bios /usr/lib/u-boot/qemu_arm/u-boot.bin |& \
-        tee ${serial_log} | sed 's/\r//'
+    -bios /usr/lib/u-boot/qemu_arm/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="${serial_log}"
+export LOG_MSG="${dom0_prompt}"
+export PASSED="${passed}"
 
-set -e
-(grep -q "${dom0_prompt}" ${serial_log} && grep -q "${passed}" ${serial_log}) || exit 1
-exit 0
+../automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index 15258692d5..eb25c4af4b 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -205,9 +205,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 # Run the test
 rm -f smoke.serial
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 240 \
-./binaries/qemu-system-aarch64 \
+export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt,gic-version=$gic_version \
     -m 2048 -monitor none -serial stdio \
@@ -215,9 +213,11 @@ timeout -k 1 240 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& \
-        tee smoke.serial | sed 's/\r//'
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="smoke.serial"
+export LOG_MSG="Welcome to Alpine Linux"
+export PASSED="${passed}"
 
-set -e
-(grep -q "^Welcome to Alpine Linux" smoke.serial && grep -q "${passed}" smoke.serial) || exit 1
-exit 0
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-ppc64le.sh b/automation/scripts/qemu-smoke-ppc64le.sh
index 9088881b73..ccb4a576f4 100755
--- a/automation/scripts/qemu-smoke-ppc64le.sh
+++ b/automation/scripts/qemu-smoke-ppc64le.sh
@@ -11,8 +11,7 @@ machine=$1
 rm -f ${serial_log}
 set +e
 
-timeout -k 1 20 \
-qemu-system-ppc64 \
+export QEMU_CMD="qemu-system-ppc64 \
     -bios skiboot.lid \
     -M $machine \
     -m 2g \
@@ -21,9 +20,9 @@ qemu-system-ppc64 \
     -monitor none \
     -nographic \
     -serial stdio \
-    -kernel binaries/xen \
-    |& tee ${serial_log} | sed 's/\r//'
+    -kernel binaries/xen"
 
-set -e
-(grep -q "Hello, ppc64le!" ${serial_log}) || exit 1
-exit 0
+export QEMU_LOG="${serial_log}"
+export PASSED="Hello, ppc64le!"
+
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-riscv64.sh b/automation/scripts/qemu-smoke-riscv64.sh
index f90df3c051..0355c075b7 100755
--- a/automation/scripts/qemu-smoke-riscv64.sh
+++ b/automation/scripts/qemu-smoke-riscv64.sh
@@ -6,15 +6,14 @@ set -ex
 rm -f smoke.serial
 set +e
 
-timeout -k 1 2 \
-qemu-system-riscv64 \
+export QEMU_CMD="qemu-system-riscv64 \
     -M virt \
     -smp 1 \
     -nographic \
     -m 2g \
-    -kernel binaries/xen \
-    |& tee smoke.serial | sed 's/\r//'
+    -kernel binaries/xen"
 
-set -e
-(grep -q "All set up" smoke.serial) || exit 1
-exit 0
+export QEMU_LOG="smoke.serial"
+export PASSED="All set up"
+
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-smoke-x86-64.sh b/automation/scripts/qemu-smoke-x86-64.sh
index 3014d07314..37ac10e068 100755
--- a/automation/scripts/qemu-smoke-x86-64.sh
+++ b/automation/scripts/qemu-smoke-x86-64.sh
@@ -16,11 +16,12 @@ esac
 
 rm -f smoke.serial
 set +e
-timeout -k 1 30 \
-qemu-system-x86_64 -nographic -kernel binaries/xen \
+export QEMU_CMD="qemu-system-x86_64 -nographic -kernel binaries/xen \
         -initrd xtf/tests/example/$k \
-        -append "loglvl=all console=com1 noreboot console_timestamps=boot $extra" \
-        -m 512 -monitor none -serial file:smoke.serial
-set -e
-grep -q 'Test result: SUCCESS' smoke.serial || exit 1
-exit 0
+        -append \"loglvl=all console=com1 noreboot console_timestamps=boot $extra\" \
+        -m 512 -monitor none -serial stdio"
+
+export QEMU_LOG="smoke.serial"
+export PASSED="Test result: SUCCESS"
+
+./automation/scripts/qemu-key.exp
diff --git a/automation/scripts/qemu-xtf-dom0less-arm64.sh b/automation/scripts/qemu-xtf-dom0less-arm64.sh
index b08c2d44fb..0666f6363e 100755
--- a/automation/scripts/qemu-xtf-dom0less-arm64.sh
+++ b/automation/scripts/qemu-xtf-dom0less-arm64.sh
@@ -51,9 +51,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 # Run the test
 rm -f smoke.serial
 set +e
-echo "  virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"| \
-timeout -k 1 120 \
-./binaries/qemu-system-aarch64 \
+export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
     -m 2048 -monitor none -serial stdio \
@@ -61,9 +59,10 @@ timeout -k 1 120 \
     -no-reboot \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=binaries \
-    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin |& \
-        tee smoke.serial | sed 's/\r//'
+    -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
+
+export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
+export QEMU_LOG="smoke.serial"
+export PASSED="${passed}"
 
-set -e
-(grep -q "${passed}" smoke.serial) || exit 1
-exit 0
+./automation/scripts/qemu-key.exp
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Mon Aug 19 03:44:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 19 Aug 2024 03:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.779319.1189072 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sftJK-000683-CB; Mon, 19 Aug 2024 03:44:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 779319.1189072; Mon, 19 Aug 2024 03: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 1sftJK-00067v-9k; Mon, 19 Aug 2024 03:44:02 +0000
Received: by outflank-mailman (input) for mailman id 779319;
 Mon, 19 Aug 2024 03:44:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sftJJ-00067p-Dg
 for xen-changelog@lists.xenproject.org; Mon, 19 Aug 2024 03:44:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sftJJ-0001Z3-Cn
 for xen-changelog@lists.xenproject.org; Mon, 19 Aug 2024 03:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sftJJ-00029p-AI
 for xen-changelog@lists.xenproject.org; Mon, 19 Aug 2024 03: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WMnyCTOR8PsCrX8Gn5ltdF3LU2gweKsZqkJXG+lNe0Y=; b=RMu7Pfu9nGpDDEDi3DnKx0C7JY
	q7EbKobCrCR2XIiBoeG74Iumuq8UilJL6Qon0YIqCP5Q58MeLLavWQMZkFYjokKUQS/mchEnJ2KK/
	6ZQvLTMND+1kCLEhDfaCqSqqIzO4Gpn4wDtSex+GLL5k3WczYtVr9b0segnEEJ4wkH8I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: add default QEMU_TIMEOUT value if not already set
Message-Id: <E1sftJJ-00029p-AI@xenbits.xenproject.org>
Date: Mon, 19 Aug 2024 03:44:01 +0000

commit 1e2a5f991f86979b89aa9a60ca3ba8106ee7d987
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Thu Aug 15 18:00:34 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 16 16:50:19 2024 -0700

    automation: add default QEMU_TIMEOUT value if not already set
    
    The expectation is that QEMU_TIMEOUT should be set as a Gitlab CI/CD
    variable but if not we should be able to run the pipeline anyway.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 automation/scripts/qemu-key.exp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/automation/scripts/qemu-key.exp b/automation/scripts/qemu-key.exp
index 35eb903a31..787f1f08cb 100755
--- a/automation/scripts/qemu-key.exp
+++ b/automation/scripts/qemu-key.exp
@@ -1,6 +1,10 @@
 #!/usr/bin/expect -f
 
-set timeout $env(QEMU_TIMEOUT)
+if {[info exists env(QEMU_TIMEOUT)]} {
+    set timeout $env(QEMU_TIMEOUT)
+} else {
+    set timeout 1500
+}
 
 log_file -a $env(QEMU_LOG)
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Aug 19 13:44:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 19 Aug 2024 13:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.779727.1189420 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sg2g1-0004tz-2U; Mon, 19 Aug 2024 13:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 779727.1189420; Mon, 19 Aug 2024 13:44: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 1sg2g0-0004tr-W8; Mon, 19 Aug 2024 13:44:04 +0000
Received: by outflank-mailman (input) for mailman id 779727;
 Mon, 19 Aug 2024 13:44:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sg2fz-0004tk-PB
 for xen-changelog@lists.xenproject.org; Mon, 19 Aug 2024 13:44:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sg2fz-0004ln-In
 for xen-changelog@lists.xenproject.org; Mon, 19 Aug 2024 13:44:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sg2fz-0003tG-HN
 for xen-changelog@lists.xenproject.org; Mon, 19 Aug 2024 13:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0huK/rCO06QgRReAYcGjgQBrKediPuCMAL9eyMUPAc0=; b=TtfcSwUQX7A8YhkeMTWseUYPlU
	u/ven9IWZ4b9XgayOxj2nntdyzpSfON70bGoActeTcwJPOF5CQnaKwHt60wsWtztlNcfmK9aGTne+
	UCefb/q2KFQPNySMPvLxF7XKaKO4gBnkikTqM7DcpmPhOCfTDndObuKUJoTjO8opv6KU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul: correct #UD check for AVX512-FP16 complex multiplications
Message-Id: <E1sg2fz-0003tG-HN@xenbits.xenproject.org>
Date: Mon, 19 Aug 2024 13:44:03 +0000

commit a30d438ce58b70c5955f5d37f776086ab8f88623
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Aug 19 15:32:31 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 19 15:32:31 2024 +0200

    x86emul: correct #UD check for AVX512-FP16 complex multiplications
    
    avx512_vlen_check()'s argument was inverted, while the surrounding
    conditional wrongly forced the EVEX.L'L check for the scalar forms when
    embedded rounding was in effect.
    
    Fixes: d14c52cba0f5 ("x86emul: handle AVX512-FP16 complex multiplication insns")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 34b0b0fe73..3c5f9ce309 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -7852,8 +7852,8 @@ x86_emulate(
         generate_exception_if(modrm_reg == src1 ||
                               (ea.type != OP_MEM && modrm_reg == modrm_rm),
                               X86_EXC_UD);
-        if ( ea.type != OP_REG || (b & 1) || !evex.brs )
-            avx512_vlen_check(!(b & 1));
+        if ( ea.type != OP_REG || !evex.brs )
+            avx512_vlen_check(b & 1);
         goto simd_zmm;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 20 09:55:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Aug 2024 09:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.780250.1189873 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sgLZv-0000iZ-Tj; Tue, 20 Aug 2024 09:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 780250.1189873; Tue, 20 Aug 2024 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 1sgLZv-0000iS-RI; Tue, 20 Aug 2024 09:55:03 +0000
Received: by outflank-mailman (input) for mailman id 780250;
 Tue, 20 Aug 2024 09:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sgLZu-0000iM-6c
 for xen-changelog@lists.xenproject.org; Tue, 20 Aug 2024 09:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sgLZt-0002tr-Po
 for xen-changelog@lists.xenproject.org; Tue, 20 Aug 2024 09:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sgLZt-0004h8-OB
 for xen-changelog@lists.xenproject.org; Tue, 20 Aug 2024 09: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=N3QF/MV4uvUmwOUjtz4OR/tOrMMXiwuOS4MONG3sP1s=; b=00FQlPKu1BWi0jwTsjSPGxFMcA
	4XJdxHiuGEGXslr6TT4W7TCKJSufVm1xQrl9ocFz4JC4GAAZZFUZJSYaqAkeEHjOM7c9Pofdzrhxr
	++4Y4JChL9dwx1jGHwozwXkGGRQBnDiB7zkl86o0pHWjf8bvKasgEHkmL64N2YKw5YU0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul: correct #UD check for AVX512-FP16 complex multiplications
Message-Id: <E1sgLZt-0004h8-OB@xenbits.xenproject.org>
Date: Tue, 20 Aug 2024 09:55:01 +0000

commit a30d438ce58b70c5955f5d37f776086ab8f88623
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Aug 19 15:32:31 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 19 15:32:31 2024 +0200

    x86emul: correct #UD check for AVX512-FP16 complex multiplications
    
    avx512_vlen_check()'s argument was inverted, while the surrounding
    conditional wrongly forced the EVEX.L'L check for the scalar forms when
    embedded rounding was in effect.
    
    Fixes: d14c52cba0f5 ("x86emul: handle AVX512-FP16 complex multiplication insns")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 34b0b0fe73..3c5f9ce309 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -7852,8 +7852,8 @@ x86_emulate(
         generate_exception_if(modrm_reg == src1 ||
                               (ea.type != OP_MEM && modrm_reg == modrm_rm),
                               X86_EXC_UD);
-        if ( ea.type != OP_REG || (b & 1) || !evex.brs )
-            avx512_vlen_check(!(b & 1));
+        if ( ea.type != OP_REG || !evex.brs )
+            avx512_vlen_check(b & 1);
         goto simd_zmm;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Aug 20 14:22:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Aug 2024 14:22:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.780523.1190140 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sgPkK-0007qH-BB; Tue, 20 Aug 2024 14:22:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 780523.1190140; Tue, 20 Aug 2024 14:22:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sgPkK-0007q9-8Z; Tue, 20 Aug 2024 14:22:04 +0000
Received: by outflank-mailman (input) for mailman id 780523;
 Tue, 20 Aug 2024 14:22:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sgPkJ-0007q3-1C
 for xen-changelog@lists.xenproject.org; Tue, 20 Aug 2024 14:22:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sgPkI-00080r-Oo
 for xen-changelog@lists.xenproject.org; Tue, 20 Aug 2024 14:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sgPkI-0006kY-Ns
 for xen-changelog@lists.xenproject.org; Tue, 20 Aug 2024 14:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FgSaI7wgyeJyX5UKllVf+6CuAaeJNiSwtqQysUXaPSw=; b=SMcmrBVcugnu8bO8aXMlsAXc7t
	ep23GP7i8VPYt8BfSsfiQd7DL0chBI3a8TwNQ8NjzIH7DtGWuQGywfmC5WoP9HLgDBPBvi9s5LSMy
	QyTj654CmqHo6n/I+ngNVb5vlY/pWZLcKMtxCbw4EOpCBl3gpmXhu8Eys3VgXnKRPpLY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] mini-os: mm: introduce generic page table walk function
Message-Id: <E1sgPkI-0006kY-Ns@xenbits.xenproject.org>
Date: Tue, 20 Aug 2024 14:22:02 +0000

commit c5a8cb5876c3bb416d255e9c8bba0bc4bc8a654c
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Aug 20 16:10:45 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 20 16:10:45 2024 +0200

    mini-os: mm: introduce generic page table walk function
    
    In x86 mm code there are multiple instances of page table walks for
    different purposes.
    
    Introduce a generic page table walker being able to cover the current
    use cases. It will be used for other cases in future, too.
    
    The page table walker needs some per-level data, so add a table for
    that data. Merge it with the already existing pt_prot[] array.
    
    Rewrite get_pgt() to use the new walker.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 arch/x86/mm.c | 157 +++++++++++++++++++++++++++++++++++++++++++---------------
 1 file changed, 118 insertions(+), 39 deletions(-)

diff --git a/arch/x86/mm.c b/arch/x86/mm.c
index 7ddf16e..9849b98 100644
--- a/arch/x86/mm.c
+++ b/arch/x86/mm.c
@@ -125,20 +125,30 @@ void arch_mm_preinit(void *p)
 }
 #endif
 
+static const struct {
+    unsigned int shift;
+    unsigned int entries;
+    pgentry_t prot;
+} ptdata[PAGETABLE_LEVELS + 1] = {
+    { 0, 0, 0 },
+    { L1_PAGETABLE_SHIFT, L1_PAGETABLE_ENTRIES, L1_PROT },
+    { L2_PAGETABLE_SHIFT, L2_PAGETABLE_ENTRIES, L2_PROT },
+    { L3_PAGETABLE_SHIFT, L3_PAGETABLE_ENTRIES, L3_PROT },
+#if defined(__x86_64__)
+    { L4_PAGETABLE_SHIFT, L4_PAGETABLE_ENTRIES, L4_PROT },
+#endif
+};
+
+static inline unsigned int idx_from_va_lvl(unsigned long va, unsigned int lvl)
+{
+    return (va >> ptdata[lvl].shift) & (ptdata[lvl].entries - 1);
+}
+
 /*
  * Make pt_pfn a new 'level' page table frame and hook it into the page
  * table at offset in previous level MFN (pref_l_mfn). pt_pfn is a guest
  * PFN.
  */
-static pgentry_t pt_prot[PAGETABLE_LEVELS] = {
-    L1_PROT,
-    L2_PROT,
-    L3_PROT,
-#if defined(__x86_64__)
-    L4_PROT,
-#endif
-};
-
 static void new_pt_frame(unsigned long *pt_pfn, unsigned long prev_l_mfn, 
                          unsigned long offset, unsigned long level)
 {   
@@ -170,7 +180,7 @@ static void new_pt_frame(unsigned long *pt_pfn, unsigned long prev_l_mfn,
     mmu_updates[0].ptr = (tab[l2_table_offset(pt_page)] & PAGE_MASK) + 
         sizeof(pgentry_t) * l1_table_offset(pt_page);
     mmu_updates[0].val = (pgentry_t)pfn_to_mfn(*pt_pfn) << PAGE_SHIFT | 
-        (pt_prot[level - 1] & ~_PAGE_RW);
+        (ptdata[level].prot & ~_PAGE_RW);
     
     if ( (rc = HYPERVISOR_mmu_update(mmu_updates, 1, NULL, DOMID_SELF)) < 0 )
     {
@@ -183,7 +193,7 @@ static void new_pt_frame(unsigned long *pt_pfn, unsigned long prev_l_mfn,
     mmu_updates[0].ptr =
         ((pgentry_t)prev_l_mfn << PAGE_SHIFT) + sizeof(pgentry_t) * offset;
     mmu_updates[0].val = (pgentry_t)pfn_to_mfn(*pt_pfn) << PAGE_SHIFT |
-        pt_prot[level];
+        ptdata[level + 1].prot;
 
     if ( (rc = HYPERVISOR_mmu_update(mmu_updates, 1, NULL, DOMID_SELF)) < 0 ) 
     {
@@ -192,7 +202,7 @@ static void new_pt_frame(unsigned long *pt_pfn, unsigned long prev_l_mfn,
     }
 #else
     tab = mfn_to_virt(prev_l_mfn);
-    tab[offset] = (*pt_pfn << PAGE_SHIFT) | pt_prot[level];
+    tab[offset] = (*pt_pfn << PAGE_SHIFT) | ptdata[level + 1].prot;
 #endif
 
     *pt_pfn += 1;
@@ -202,6 +212,82 @@ static void new_pt_frame(unsigned long *pt_pfn, unsigned long prev_l_mfn,
 static mmu_update_t mmu_updates[L1_PAGETABLE_ENTRIES + 1];
 #endif
 
+/*
+ * Walk recursively through all PTEs calling a specified function. The function
+ * is allowed to change the PTE, the walker will follow the new value.
+ * The walk will cover the virtual address range [from_va .. to_va].
+ * The supplied function will be called with the following parameters:
+ * va: base virtual address of the area covered by the current PTE
+ * lvl: page table level of the PTE (1 = lowest level, PAGETABLE_LEVELS =
+ *      PTE in page table addressed by %cr3)
+ * is_leaf: true if PTE doesn't address another page table (it is either at
+ *          level 1, or invalid, or has its PSE bit set)
+ * pte: address of the PTE
+ * par: parameter, passed to walk_pt() by caller
+ * Return value of func() being non-zero will terminate walk_pt(), walk_pt()
+ * will return that value in this case, zero else.
+ */
+static int walk_pt(unsigned long from_va, unsigned long to_va,
+                   int (func)(unsigned long va, unsigned int lvl,
+                              bool is_leaf, pgentry_t *pte, void *par),
+                   void *par)
+{
+    unsigned int lvl = PAGETABLE_LEVELS;
+    unsigned int ptindex[PAGETABLE_LEVELS + 1];
+    unsigned long va = round_pgdown(from_va);
+    unsigned long va_lvl;
+    pgentry_t *tab[PAGETABLE_LEVELS + 1];
+    pgentry_t *pte;
+    bool is_leaf;
+    int ret;
+
+    /* Start at top level page table. */
+    tab[lvl] = pt_base;
+    ptindex[lvl] = idx_from_va_lvl(va, lvl);
+
+    while ( va < (to_va | (PAGE_SIZE - 1)) )
+    {
+        pte = tab[lvl] + ptindex[lvl];
+        is_leaf = (lvl == L1_FRAME) || (*pte & _PAGE_PSE) ||
+                  !(*pte & _PAGE_PRESENT);
+        va_lvl = va & ~((1UL << ptdata[lvl].shift) - 1);
+        ret = func(va_lvl, lvl, is_leaf, pte, par);
+        if ( ret )
+            return ret;
+
+        /* PTE might have been modified by func(), reevaluate leaf state. */
+        is_leaf = (lvl == L1_FRAME) || (*pte & _PAGE_PSE) ||
+                  !(*pte & _PAGE_PRESENT);
+
+        if ( is_leaf )
+        {
+            /* Reached a leaf PTE. Advance to next page. */
+            va += 1UL << ptdata[lvl].shift;
+            ptindex[lvl]++;
+
+            /* Check for the need to traverse up again. */
+            while ( ptindex[lvl] == ptdata[lvl].entries )
+            {
+                /* End of virtual address space? */
+                if ( lvl == PAGETABLE_LEVELS )
+                    return 0;
+                /* Reached end of current page table, one level up. */
+                lvl++;
+                ptindex[lvl]++;
+            }
+        }
+        else
+        {
+            /* Not a leaf, walk one level down. */
+            lvl--;
+            tab[lvl] = mfn_to_virt(pte_to_mfn(*pte));
+            ptindex[lvl] = idx_from_va_lvl(va, lvl);
+        }
+    }
+
+    return 0;
+}
+
 /*
  * Build the initial pagetable.
  */
@@ -407,36 +493,29 @@ static void set_readonly(void *text, void *etext)
 /*
  * get the PTE for virtual address va if it exists. Otherwise NULL.
  */
-static pgentry_t *get_pgt(unsigned long va)
+static int get_pgt_func(unsigned long va, unsigned int lvl, bool is_leaf,
+                        pgentry_t *pte, void *par)
 {
-    unsigned long mfn;
-    pgentry_t *tab;
-    unsigned offset;
+    pgentry_t **result;
 
-    tab = pt_base;
-    mfn = virt_to_mfn(pt_base);
+    if ( !(*pte & _PAGE_PRESENT) && lvl > L1_FRAME )
+        return -1;
 
-#if defined(__x86_64__)
-    offset = l4_table_offset(va);
-    if ( !(tab[offset] & _PAGE_PRESENT) )
-        return NULL;
-    mfn = pte_to_mfn(tab[offset]);
-    tab = mfn_to_virt(mfn);
-#endif
-    offset = l3_table_offset(va);
-    if ( !(tab[offset] & _PAGE_PRESENT) )
-        return NULL;
-    mfn = pte_to_mfn(tab[offset]);
-    tab = mfn_to_virt(mfn);
-    offset = l2_table_offset(va);
-    if ( !(tab[offset] & _PAGE_PRESENT) )
-        return NULL;
-    if ( tab[offset] & _PAGE_PSE )
-        return &tab[offset];
-    mfn = pte_to_mfn(tab[offset]);
-    tab = mfn_to_virt(mfn);
-    offset = l1_table_offset(va);
-    return &tab[offset];
+    if ( lvl > L1_FRAME && !(*pte & _PAGE_PSE) )
+        return 0;
+
+    result = par;
+    *result = pte;
+
+    return 0;
+}
+
+static pgentry_t *get_pgt(unsigned long va)
+{
+    pgentry_t *tab = NULL;
+
+    walk_pt(va, va, get_pgt_func, &tab);
+    return tab;
 }
 
 
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Aug 20 14:22:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Aug 2024 14:22:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.780524.1190144 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sgPkU-0007sp-CV; Tue, 20 Aug 2024 14:22:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 780524.1190144; Tue, 20 Aug 2024 14:22:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sgPkU-0007sh-A0; Tue, 20 Aug 2024 14:22:14 +0000
Received: by outflank-mailman (input) for mailman id 780524;
 Tue, 20 Aug 2024 14:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sgPkS-0007sQ-Te
 for xen-changelog@lists.xenproject.org; Tue, 20 Aug 2024 14:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sgPkS-00081C-S4
 for xen-changelog@lists.xenproject.org; Tue, 20 Aug 2024 14:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sgPkS-0006l6-Qv
 for xen-changelog@lists.xenproject.org; Tue, 20 Aug 2024 14:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=e4RmQgaZrwlOFecojoERt8GOOkDUgz8H4KOB7FyMfYk=; b=p6ZjdNAmjV6aIL/5dV4ieHGEQF
	q0R5BsEDKfN4v5txR0lrZRiwbe8eIPu2taqkRSLmiv5S0voy9QJvLgLjm3zHT5VPSiUXvJfObr1n3
	iznJzS3DYuDrJENMo7ORDUiP2CHbU9o2bUDt7aZQmfCXIWRlA6szzCpvV8wMtn09pNxk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] mini-os: mm: switch need_pgt() to use walk_pt()
Message-Id: <E1sgPkS-0006l6-Qv@xenbits.xenproject.org>
Date: Tue, 20 Aug 2024 14:22:12 +0000

commit 34bce475c42c844d382f00f799f332c380d38f1d
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Aug 20 16:11:13 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 20 16:11:13 2024 +0200

    mini-os: mm: switch need_pgt() to use walk_pt()
    
    Instead of open coding a page table walk, use walk_pt() in need_pgt().
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 arch/x86/mm.c | 72 +++++++++++++++++++++++++----------------------------------
 1 file changed, 30 insertions(+), 42 deletions(-)

diff --git a/arch/x86/mm.c b/arch/x86/mm.c
index 9849b98..84a6d7f 100644
--- a/arch/x86/mm.c
+++ b/arch/x86/mm.c
@@ -523,57 +523,45 @@ static pgentry_t *get_pgt(unsigned long va)
  * return a valid PTE for a given virtual address. If PTE does not exist,
  * allocate page-table pages.
  */
-pgentry_t *need_pgt(unsigned long va)
+static int need_pgt_func(unsigned long va, unsigned int lvl, bool is_leaf,
+                         pgentry_t *pte, void *par)
 {
+    pgentry_t **result = par;
     unsigned long pt_mfn;
-    pgentry_t *tab;
     unsigned long pt_pfn;
-    unsigned offset;
+    unsigned int idx;
 
-    tab = pt_base;
-    pt_mfn = virt_to_mfn(pt_base);
+    if ( !is_leaf )
+        return 0;
 
-#if defined(__x86_64__)
-    offset = l4_table_offset(va);
-    if ( !(tab[offset] & _PAGE_PRESENT) )
-    {
-        pt_pfn = virt_to_pfn(alloc_page());
-        if ( !pt_pfn )
-            return NULL;
-        new_pt_frame(&pt_pfn, pt_mfn, offset, L3_FRAME);
-    }
-    ASSERT(tab[offset] & _PAGE_PRESENT);
-    pt_mfn = pte_to_mfn(tab[offset]);
-    tab = mfn_to_virt(pt_mfn);
-#endif
-    offset = l3_table_offset(va);
-    if ( !(tab[offset] & _PAGE_PRESENT) ) 
-    {
-        pt_pfn = virt_to_pfn(alloc_page());
-        if ( !pt_pfn )
-            return NULL;
-        new_pt_frame(&pt_pfn, pt_mfn, offset, L2_FRAME);
-    }
-    ASSERT(tab[offset] & _PAGE_PRESENT);
-    pt_mfn = pte_to_mfn(tab[offset]);
-    tab = mfn_to_virt(pt_mfn);
-    offset = l2_table_offset(va);
-    if ( !(tab[offset] & _PAGE_PRESENT) )
+    if ( lvl == L1_FRAME || (*pte & _PAGE_PRESENT) )
     {
-        pt_pfn = virt_to_pfn(alloc_page());
-        if ( !pt_pfn )
-            return NULL;
-        new_pt_frame(&pt_pfn, pt_mfn, offset, L1_FRAME);
+        /*
+         * The PTE is not addressing a page table (is_leaf is true). If we are
+         * either at the lowest level or we have a valid large page, we don't
+         * need to allocate a page table.
+         */
+        ASSERT(lvl == L1_FRAME || (*pte & _PAGE_PSE));
+        *result = pte;
+        return 1;
     }
-    ASSERT(tab[offset] & _PAGE_PRESENT);
-    if ( tab[offset] & _PAGE_PSE )
-        return &tab[offset];
 
-    pt_mfn = pte_to_mfn(tab[offset]);
-    tab = mfn_to_virt(pt_mfn);
+    pt_mfn = virt_to_mfn(pte);
+    pt_pfn = virt_to_pfn(alloc_page());
+    if ( !pt_pfn )
+        return -1;
+    idx = idx_from_va_lvl(va, lvl);
+    new_pt_frame(&pt_pfn, pt_mfn, idx, lvl - 1);
 
-    offset = l1_table_offset(va);
-    return &tab[offset];
+    return 0;
+}
+
+pgentry_t *need_pgt(unsigned long va)
+{
+    pgentry_t *tab = NULL;
+
+    walk_pt(va, va, need_pgt_func, &tab);
+    return tab;
 }
 EXPORT_SYMBOL(need_pgt);
 
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Aug 20 14:22:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 20 Aug 2024 14:22:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.780525.1190148 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sgPke-0007wO-EG; Tue, 20 Aug 2024 14:22:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 780525.1190148; Tue, 20 Aug 2024 14:22:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sgPke-0007wG-BR; Tue, 20 Aug 2024 14:22:24 +0000
Received: by outflank-mailman (input) for mailman id 780525;
 Tue, 20 Aug 2024 14:22:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sgPkc-0007w2-Vt
 for xen-changelog@lists.xenproject.org; Tue, 20 Aug 2024 14:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sgPkc-00081S-V1
 for xen-changelog@lists.xenproject.org; Tue, 20 Aug 2024 14:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sgPkc-0006ln-U7
 for xen-changelog@lists.xenproject.org; Tue, 20 Aug 2024 14: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+4P0PYxsjnxj8r7Puyqu92WuVBBXXlBwz2YcLo3SDIE=; b=B1gGuYtTSyTDzOLQnIS080hdjD
	2ItfLDITa0wgVal/03QYHqllYmT3JNXUiuphHn4GsMcXsLLcW3Ydllve+ZtfWWvTpk4VZxxgjbthc
	wdmByS6ugVeStCIGhag5NWdpEIvaJUuuGplZCHWpBG+gke3GORuu3HCI1MY2L1L0e2eQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] mini-os: mm: convert set_readonly() to use walk_pt()
Message-Id: <E1sgPkc-0006ln-U7@xenbits.xenproject.org>
Date: Tue, 20 Aug 2024 14:22:22 +0000

commit 3932490a01cfb1bf69a1bf95c9b1f37a3fdce8b3
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Aug 20 16:11:31 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Aug 20 16:11:31 2024 +0200

    mini-os: mm: convert set_readonly() to use walk_pt()
    
    Instead of having another copy of a page table walk in set_readonly(),
    just use walk_pt().
    
    As it will be needed later anyway, split out the TLB flushing into a
    dedicated function.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 arch/x86/mm.c | 124 ++++++++++++++++++++++++++--------------------------------
 1 file changed, 56 insertions(+), 68 deletions(-)

diff --git a/arch/x86/mm.c b/arch/x86/mm.c
index 84a6d7f..572e762 100644
--- a/arch/x86/mm.c
+++ b/arch/x86/mm.c
@@ -402,92 +402,80 @@ static void build_pagetable(unsigned long *start_pfn, unsigned long *max_pfn)
  * Mark portion of the address space read only.
  */
 extern struct shared_info shared_info;
-static void set_readonly(void *text, void *etext)
-{
-    unsigned long start_address =
-        ((unsigned long) text + PAGE_SIZE - 1) & PAGE_MASK;
-    unsigned long end_address = (unsigned long) etext;
-    pgentry_t *tab = pt_base, page;
-    unsigned long mfn = pfn_to_mfn(virt_to_pfn(pt_base));
-    unsigned long offset;
-    unsigned long page_size = PAGE_SIZE;
+
+struct set_readonly_par {
+    unsigned long etext;
 #ifdef CONFIG_PARAVIRT
-    int count = 0;
-    int rc;
+    unsigned int count;
 #endif
+};
 
-    printk("setting %p-%p readonly\n", text, etext);
+static int set_readonly_func(unsigned long va, unsigned int lvl, bool is_leaf,
+                             pgentry_t *pte, void *par)
+{
+    struct set_readonly_par *ro = par;
 
-    while ( start_address + page_size <= end_address )
-    {
-        tab = pt_base;
-        mfn = pfn_to_mfn(virt_to_pfn(pt_base));
+    if ( !is_leaf )
+        return 0;
 
-#if defined(__x86_64__)
-        offset = l4_table_offset(start_address);
-        page = tab[offset];
-        mfn = pte_to_mfn(page);
-        tab = to_virt(mfn_to_pfn(mfn) << PAGE_SHIFT);
-#endif
-        offset = l3_table_offset(start_address);
-        page = tab[offset];
-        mfn = pte_to_mfn(page);
-        tab = to_virt(mfn_to_pfn(mfn) << PAGE_SHIFT);
-        offset = l2_table_offset(start_address);        
-        if ( !(tab[offset] & _PAGE_PSE) )
-        {
-            page = tab[offset];
-            mfn = pte_to_mfn(page);
-            tab = to_virt(mfn_to_pfn(mfn) << PAGE_SHIFT);
+    if ( va + (1UL << ptdata[lvl].shift) > ro->etext )
+        return 1;
 
-            offset = l1_table_offset(start_address);
-        }
+    if ( va == (unsigned long)&shared_info )
+    {
+        printk("skipped %lx\n", va);
+        return 0;
+    }
 
-        if ( start_address != (unsigned long)&shared_info )
-        {
 #ifdef CONFIG_PARAVIRT
-            mmu_updates[count].ptr = 
-                ((pgentry_t)mfn << PAGE_SHIFT) + sizeof(pgentry_t) * offset;
-            mmu_updates[count].val = tab[offset] & ~_PAGE_RW;
-            count++;
+    mmu_updates[ro->count].ptr = virt_to_mach(pte);
+    mmu_updates[ro->count].val = *pte & ~_PAGE_RW;
+    ro->count++;
+
+    if ( ro->count == L1_PAGETABLE_ENTRIES )
+    {
+         if ( HYPERVISOR_mmu_update(mmu_updates, ro->count, NULL,
+                                    DOMID_SELF) < 0 )
+             BUG();
+         ro->count = 0;
+    }
 #else
-            tab[offset] &= ~_PAGE_RW;
+    *pte &= ~_PAGE_RW;
 #endif
-        }
-        else
-            printk("skipped %lx\n", start_address);
 
-        start_address += page_size;
+    return 0;
+}
 
 #ifdef CONFIG_PARAVIRT
-        if ( count == L1_PAGETABLE_ENTRIES || 
-             start_address + page_size > end_address )
-        {
-            rc = HYPERVISOR_mmu_update(mmu_updates, count, NULL, DOMID_SELF);
-            if ( rc < 0 )
-            {
-                printk("ERROR: set_readonly(): PTE could not be updated\n");
-                do_exit();
-            }
-            count = 0;
-        }
+static void tlb_flush(void)
+{
+    mmuext_op_t op = { .cmd = MMUEXT_TLB_FLUSH_ALL };
+    int count;
+
+    HYPERVISOR_mmuext_op(&op, 1, &count, DOMID_SELF);
+}
 #else
-        if ( start_address == (1UL << L2_PAGETABLE_SHIFT) )
-            page_size = 1UL << L2_PAGETABLE_SHIFT;
+static void tlb_flush(void)
+{
+    write_cr3((unsigned long)pt_base);
+}
 #endif
-    }
+
+static void set_readonly(void *text, void *etext)
+{
+    struct set_readonly_par setro = { .etext = (unsigned long)etext };
+    unsigned long start_address = PAGE_ALIGN((unsigned long)text);
+
+    printk("setting %p-%p readonly\n", text, etext);
+    walk_pt(start_address, setro.etext, set_readonly_func, &setro);
 
 #ifdef CONFIG_PARAVIRT
-    {
-        mmuext_op_t op = {
-            .cmd = MMUEXT_TLB_FLUSH_ALL,
-        };
-        int count;
-        HYPERVISOR_mmuext_op(&op, 1, &count, DOMID_SELF);
-    }
-#else
-    write_cr3((unsigned long)pt_base);
+    if ( setro.count &&
+         HYPERVISOR_mmu_update(mmu_updates, setro.count, NULL, DOMID_SELF) < 0)
+        BUG();
 #endif
+
+    tlb_flush();
 }
 
 /*
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 21 23:00:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Aug 2024 23:00:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.781531.1191026 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sguJB-0007Am-KZ; Wed, 21 Aug 2024 23:00:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 781531.1191026; Wed, 21 Aug 2024 23:00: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 1sguJB-0007AK-Hj; Wed, 21 Aug 2024 23:00:05 +0000
Received: by outflank-mailman (input) for mailman id 781531;
 Wed, 21 Aug 2024 23:00:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sguJA-0006vy-CQ
 for xen-changelog@lists.xenproject.org; Wed, 21 Aug 2024 23:00:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sguJA-0005Y9-4K
 for xen-changelog@lists.xenproject.org; Wed, 21 Aug 2024 23:00:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sguJA-00007M-2N
 for xen-changelog@lists.xenproject.org; Wed, 21 Aug 2024 23:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rpmO5cuRjpb7Ay8qT+85IqHY1qtjtkZwcM/yIzFKLHk=; b=lRQpVgY3H8CoBC3upsA42MUQEE
	tS8DeKhqXUqaYOXDisV1lXQE4s7sePFVlV4DeJlwxQzth+Tat1fL1vR2Du57WFpsaeorQZLLP5WE9
	FauDRBXx33X0cFwPGLc7v6oBhL96sFnVIh3dJC05Ua8RidsHAKvHE0WF9HwLcdKDdjNQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/pv: Introduce x86_merge_dr6() and fix do_debug()
Message-Id: <E1sguJA-00007M-2N@xenbits.xenproject.org>
Date: Wed, 21 Aug 2024 23:00:04 +0000

commit 54ef601a66e8d812a6a6a308f02524e81201825e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon May 28 15:20:18 2018 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Aug 21 23:59:19 2024 +0100

    x86/pv: Introduce x86_merge_dr6() and fix do_debug()
    
    Pretty much everywhere in Xen the logic to update %dr6 when injecting #DB is
    buggy.  Introduce a new x86_merge_dr6() helper, and start fixing the mess by
    adjusting the dr6 merge in do_debug().  Also correct the comment.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/debug.c                 | 40 ++++++++++++++++++++++++++++++++++++
 xen/arch/x86/include/asm/debugreg.h  |  7 +++++++
 xen/arch/x86/include/asm/x86-defns.h |  7 +++++++
 xen/arch/x86/traps.c                 | 11 +++++++---
 4 files changed, 62 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/debug.c b/xen/arch/x86/debug.c
index 127fe83021..b10f1f12b6 100644
--- a/xen/arch/x86/debug.c
+++ b/xen/arch/x86/debug.c
@@ -2,12 +2,52 @@
 /*
  * Copyright (C) 2023 XenServer.
  */
+#include <xen/bug.h>
 #include <xen/kernel.h>
 
 #include <xen/lib/x86/cpu-policy.h>
 
 #include <asm/debugreg.h>
 
+/*
+ * Merge new bits into dr6.  'new' is always given in positive polarity,
+ * matching the Intel VMCS PENDING_DBG semantics.
+ *
+ * At the time of writing (August 2024), on the subject of %dr6 updates the
+ * manuals are either vague (Intel "certain exceptions may clear bits 0-3"),
+ * or disputed (AMD makes statements which don't match observed behaviour).
+ *
+ * The only debug exception I can find which doesn't clear the breakpoint bits
+ * is ICEBP(/INT1) on AMD systems.  This is also the one source of #DB that
+ * doesn't have an explicit status bit, meaning we can't easily identify this
+ * case either (AMD systems don't virtualise PENDING_DBG and only provide a
+ * post-merge %dr6 value).
+ *
+ * Treat %dr6 merging as unconditionally writing the breakpoint bits.
+ *
+ * We can't really manage any better, and guest kernels handling #DB as
+ * instructed by the SDM/APM (i.e. reading %dr6 then resetting it back to
+ * default) wont notice.
+ */
+unsigned int x86_merge_dr6(const struct cpu_policy *p, unsigned int dr6,
+                           unsigned int new)
+{
+    /* Flip dr6 to have positive polarity. */
+    dr6 ^= X86_DR6_DEFAULT;
+
+    /* Sanity check that only known values are passed in. */
+    ASSERT(!(dr6 & ~X86_DR6_KNOWN_MASK));
+    ASSERT(!(new & ~X86_DR6_KNOWN_MASK));
+
+    /* Breakpoint bits overridden.  All others accumulate. */
+    dr6 = (dr6 & ~X86_DR6_BP_MASK) | new;
+
+    /* Flip dr6 back to having default polarity. */
+    dr6 ^= X86_DR6_DEFAULT;
+
+    return x86_adj_dr6_rsvd(p, dr6);
+}
+
 unsigned int x86_adj_dr6_rsvd(const struct cpu_policy *p, unsigned int dr6)
 {
     unsigned int ones = X86_DR6_DEFAULT;
diff --git a/xen/arch/x86/include/asm/debugreg.h b/xen/arch/x86/include/asm/debugreg.h
index 96c406ad53..6baa725441 100644
--- a/xen/arch/x86/include/asm/debugreg.h
+++ b/xen/arch/x86/include/asm/debugreg.h
@@ -108,4 +108,11 @@ struct cpu_policy;
 unsigned int x86_adj_dr6_rsvd(const struct cpu_policy *p, unsigned int dr6);
 unsigned int x86_adj_dr7_rsvd(const struct cpu_policy *p, unsigned int dr7);
 
+/*
+ * Merge new bits into dr6.  'new' is always given in positive polarity,
+ * matching the Intel VMCS PENDING_DBG semantics.
+ */
+unsigned int x86_merge_dr6(const struct cpu_policy *p, unsigned int dr6,
+                           unsigned int new);
+
 #endif /* _X86_DEBUGREG_H */
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index 3bcdbaccd3..caa92829ea 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -132,6 +132,13 @@
 #define X86_DR6_ZEROS           _AC(0x00001000, UL)  /* %dr6 bits forced to 0       */
 #define X86_DR6_DEFAULT         _AC(0xffff0ff0, UL)  /* Default %dr6 value          */
 
+#define X86_DR6_BP_MASK                                 \
+    (X86_DR6_B0 | X86_DR6_B1 | X86_DR6_B2 | X86_DR6_B3)
+
+#define X86_DR6_KNOWN_MASK                                              \
+    (X86_DR6_BP_MASK | X86_DR6_BLD | X86_DR6_BD | X86_DR6_BS |          \
+     X86_DR6_BT | X86_DR6_RTM)
+
 /*
  * Debug control flags in DR7.
  */
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 552a07e6aa..feef6faa50 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2016,9 +2016,14 @@ void asmlinkage do_debug(struct cpu_user_regs *regs)
         return;
     }
 
-    /* Save debug status register where guest OS can peek at it */
-    v->arch.dr6 |= (dr6 & ~X86_DR6_DEFAULT);
-    v->arch.dr6 &= (dr6 | ~X86_DR6_DEFAULT);
+    /*
+     * Update the guest's dr6 so the debugger can peek at it.
+     *
+     * TODO: This should be passed out-of-band, so guest state is not modified
+     * by debugging actions completed behind it's back.
+     */
+    v->arch.dr6 = x86_merge_dr6(v->domain->arch.cpu_policy,
+                                v->arch.dr6, dr6 ^ X86_DR6_DEFAULT);
 
     if ( guest_kernel_mode(v, regs) && v->domain->debugger_attached )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 21 23:00:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Aug 2024 23:00:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.781532.1191030 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sguJL-0007KL-MK; Wed, 21 Aug 2024 23:00:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 781532.1191030; Wed, 21 Aug 2024 23:00: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 1sguJL-0007KD-JL; Wed, 21 Aug 2024 23:00:15 +0000
Received: by outflank-mailman (input) for mailman id 781532;
 Wed, 21 Aug 2024 23:00:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sguJK-0007K6-9B
 for xen-changelog@lists.xenproject.org; Wed, 21 Aug 2024 23:00:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sguJK-0005YD-7p
 for xen-changelog@lists.xenproject.org; Wed, 21 Aug 2024 23:00:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sguJK-00009T-6l
 for xen-changelog@lists.xenproject.org; Wed, 21 Aug 2024 23:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FPVtPMEZTiVP9x9gSNjcNJ50Z331ph/qIcNhaDlR1wE=; b=kJ5xbJ9H+dMs84E0bx2MzI1z0/
	HzsGFFjU/QLojAqfii0a2v6JRjVsyQFTmMnzE7EyjN7/vC85T7q7LNhq2DTQF0hJBTgb2K10QJOz+
	cAjILORmwUYLm2WaPAUU/FzEOHl6SK3vWGbN0KobpgPwMVHUURGQffKwUsuKEbV7pnUg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/pv: Fix merging of new status bits into %dr6
Message-Id: <E1sguJK-00009T-6l@xenbits.xenproject.org>
Date: Wed, 21 Aug 2024 23:00:14 +0000

commit db39fa4b27ea470902d4625567cb6fa24030ddfa
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu May 24 12:39:00 2018 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Aug 21 23:59:19 2024 +0100

    x86/pv: Fix merging of new status bits into %dr6
    
    All #DB exceptions result in an update of %dr6, but this isn't captured in
    Xen's handling, and is buggy just about everywhere.
    
    To begin resolving this issue, add a new pending_dbg field to x86_event
    (unioned with cr2 to avoid taking any extra space, adjusting users to avoid
    old-GCC bugs with anonymous unions), and introduce pv_inject_DB() to replace
    the current callers using pv_inject_hw_exception().
    
    Push the adjustment of v->arch.dr6 into pv_inject_event(), and use the new
    x86_merge_dr6() rather than the current incorrect logic.
    
    A key property is that pending_dbg is taken with positive polarity to deal
    with RTM/BLD sensibly.  Most callers pass in a constant, but callers passing
    in a hardware %dr6 value need to XOR the value with X86_DR6_DEFAULT to flip to
    positive polarity.
    
    This fixes the behaviour of the breakpoint status bits; that any left pending
    are generally discarded when a new #DB is raised.  In principle it would fix
    RTM/BLD too, except PV guests can't turn these capabilities on to start with.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/domain.h      | 18 ++++++++++++++++--
 xen/arch/x86/include/asm/hvm/hvm.h     |  3 ++-
 xen/arch/x86/pv/emul-priv-op.c         |  5 +----
 xen/arch/x86/pv/emulate.c              |  9 +++++++--
 xen/arch/x86/pv/ro-page-fault.c        |  2 +-
 xen/arch/x86/pv/traps.c                | 16 ++++++++++++----
 xen/arch/x86/traps.c                   |  2 +-
 xen/arch/x86/x86_emulate/x86_emulate.h |  5 ++++-
 8 files changed, 44 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index bca3258d69..811251852f 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -731,15 +731,29 @@ static inline void pv_inject_hw_exception(unsigned int vector, int errcode)
     pv_inject_event(&event);
 }
 
+static inline void pv_inject_DB(unsigned long pending_dbg)
+{
+    struct x86_event event = {
+        .vector      = X86_EXC_DB,
+        .type        = X86_EVENTTYPE_HW_EXCEPTION,
+        .error_code  = X86_EVENT_NO_EC,
+    };
+
+    event.pending_dbg = pending_dbg;
+
+    pv_inject_event(&event);
+}
+
 static inline void pv_inject_page_fault(int errcode, unsigned long cr2)
 {
-    const struct x86_event event = {
+    struct x86_event event = {
         .vector = X86_EXC_PF,
         .type = X86_EVENTTYPE_HW_EXCEPTION,
         .error_code = errcode,
-        .cr2 = cr2,
     };
 
+    event.cr2 = cr2;
+
     pv_inject_event(&event);
 }
 
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 518ba5319b..d5aaa5b710 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -535,9 +535,10 @@ static inline void hvm_inject_page_fault(int errcode, unsigned long cr2)
         .vector = X86_EXC_PF,
         .type = X86_EVENTTYPE_HW_EXCEPTION,
         .error_code = errcode,
-        .cr2 = cr2,
     };
 
+    event.cr2 = cr2;
+
     hvm_inject_event(&event);
 }
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index aa11ecadaa..15c83b9d23 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -1366,10 +1366,7 @@ int pv_emulate_privileged_op(struct cpu_user_regs *regs)
             ctxt.bpmatch |= DR_STEP;
 
         if ( ctxt.bpmatch )
-        {
-            curr->arch.dr6 |= ctxt.bpmatch | DR_STATUS_RESERVED_ONE;
-            pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
-        }
+            pv_inject_DB(ctxt.bpmatch);
 
         /* fall through */
     case X86EMUL_RETRY:
diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
index e7a1c0a2cc..8c44dea123 100644
--- a/xen/arch/x86/pv/emulate.c
+++ b/xen/arch/x86/pv/emulate.c
@@ -71,10 +71,15 @@ void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip)
 {
     regs->rip = rip;
     regs->eflags &= ~X86_EFLAGS_RF;
+
     if ( regs->eflags & X86_EFLAGS_TF )
     {
-        current->arch.dr6 |= DR_STEP | DR_STATUS_RESERVED_ONE;
-        pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
+        /*
+         * TODO: this should generally use TF from the start of the
+         * instruction.  It's only a latent bug for now, as this path isn't
+         * used for any instruction which modifies eflags.
+         */
+        pv_inject_DB(X86_DR6_BS);
     }
 }
 
diff --git a/xen/arch/x86/pv/ro-page-fault.c b/xen/arch/x86/pv/ro-page-fault.c
index cad28ef928..d0fe07e3a1 100644
--- a/xen/arch/x86/pv/ro-page-fault.c
+++ b/xen/arch/x86/pv/ro-page-fault.c
@@ -390,7 +390,7 @@ int pv_ro_page_fault(unsigned long addr, struct cpu_user_regs *regs)
         /* Fallthrough */
     case X86EMUL_OKAY:
         if ( ctxt.retire.singlestep )
-            pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
+            pv_inject_DB(X86_DR6_BS);
 
         /* Fallthrough */
     case X86EMUL_RETRY:
diff --git a/xen/arch/x86/pv/traps.c b/xen/arch/x86/pv/traps.c
index 83e84e2762..5a7341abf0 100644
--- a/xen/arch/x86/pv/traps.c
+++ b/xen/arch/x86/pv/traps.c
@@ -12,6 +12,7 @@
 #include <xen/lib.h>
 #include <xen/softirq.h>
 
+#include <asm/debugreg.h>
 #include <asm/pv/trace.h>
 #include <asm/shared.h>
 #include <asm/traps.h>
@@ -50,9 +51,9 @@ void pv_inject_event(const struct x86_event *event)
     tb->cs    = ti->cs;
     tb->eip   = ti->address;
 
-    if ( event->type == X86_EVENTTYPE_HW_EXCEPTION &&
-         vector == X86_EXC_PF )
+    switch ( vector | -(event->type == X86_EVENTTYPE_SW_INTERRUPT) )
     {
+    case X86_EXC_PF:
         curr->arch.pv.ctrlreg[2] = event->cr2;
         arch_set_cr2(curr, event->cr2);
 
@@ -62,9 +63,16 @@ void pv_inject_event(const struct x86_event *event)
             error_code |= PFEC_user_mode;
 
         trace_pv_page_fault(event->cr2, error_code);
-    }
-    else
+        break;
+
+    case X86_EXC_DB:
+        curr->arch.dr6 = x86_merge_dr6(curr->domain->arch.cpu_policy,
+                                       curr->arch.dr6, event->pending_dbg);
+        fallthrough;
+    default:
         trace_pv_trap(vector, regs->rip, use_error_code, error_code);
+        break;
+    }
 
     if ( use_error_code )
     {
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index feef6faa50..b796c2f7df 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2031,7 +2031,7 @@ void asmlinkage do_debug(struct cpu_user_regs *regs)
         return;
     }
 
-    pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
+    pv_inject_DB(0 /* N/A, already merged */);
 }
 
 void asmlinkage do_entry_CP(struct cpu_user_regs *regs)
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.h b/xen/arch/x86/x86_emulate/x86_emulate.h
index d92be69d84..e8a0e57228 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.h
+++ b/xen/arch/x86/x86_emulate/x86_emulate.h
@@ -78,7 +78,10 @@ struct x86_event {
     uint8_t       type;         /* X86_EVENTTYPE_* */
     uint8_t       insn_len;     /* Instruction length */
     int32_t       error_code;   /* X86_EVENT_NO_EC if n/a */
-    unsigned long cr2;          /* Only for X86_EXC_PF h/w exception */
+    union {
+        unsigned long cr2;         /* #PF */
+        unsigned long pending_dbg; /* #DB (new DR6 bits, positive polarity) */
+    };
 };
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 21 23:00:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 21 Aug 2024 23:00:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.781533.1191034 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sguJV-0007Mx-Nf; Wed, 21 Aug 2024 23:00:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 781533.1191034; Wed, 21 Aug 2024 23:00: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 1sguJV-0007Mp-Kp; Wed, 21 Aug 2024 23:00:25 +0000
Received: by outflank-mailman (input) for mailman id 781533;
 Wed, 21 Aug 2024 23:00:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sguJU-0007MY-By
 for xen-changelog@lists.xenproject.org; Wed, 21 Aug 2024 23:00:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sguJU-0005YP-Az
 for xen-changelog@lists.xenproject.org; Wed, 21 Aug 2024 23:00:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sguJU-0000Aj-A2
 for xen-changelog@lists.xenproject.org; Wed, 21 Aug 2024 23:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=E73wHMngR49if6mJEn6dPgX6DZKlmCHi3sQC0hxbpus=; b=U1m+oh2aA4kCIpHnatdJvCWq4C
	M/wwuVHDYq0tpmXwaf5gvabiom/WytZwXAT2l2ZiWAoASSmNqGAO11Moqsn021XRLamUYPvDrGZW5
	MzDEio15atYsmuaEnzGCU7HwCHf7XRTD7z5ENjbJiwnZco1UgNfM2hjL8OT1GSDiS48E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/pv: Address Coverity complaint in check_guest_io_breakpoint()
Message-Id: <E1sguJU-0000Aj-A2@xenbits.xenproject.org>
Date: Wed, 21 Aug 2024 23:00:24 +0000

commit 6d41a9d8a12ff89adabdc286e63e9391a0481699
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 15 13:18:08 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Aug 21 23:59:19 2024 +0100

    x86/pv: Address Coverity complaint in check_guest_io_breakpoint()
    
    Commit 08aacc392d86 ("x86/emul: Fix misaligned IO breakpoint behaviour in PV
    guests") caused a Coverity INTEGER_OVERFLOW complaint based on the reasoning
    that width could be 0.
    
    It can't, but digging into the code generation, GCC 8 and later (bisected on
    godbolt) choose to emit a CSWITCH lookup table, and because the range (bottom
    2 bits clear), it's a 16-entry lookup table.
    
    So Coverity is understandable, given that GCC did emit a (dead) logic path
    where width stayed 0.
    
    Rewrite the logic.  Introduce x86_bp_width() which compiles to a single basic
    block, which replaces the switch() statement.  Take the opportunity to also
    make start and width be loop-scope variables.
    
    No practical change, but it should compile better and placate Coverity.
    
    Fixes: 08aacc392d86 ("x86/emul: Fix misaligned IO breakpoint behaviour in PV guests")
    Coverity-ID: 1616152
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/debugreg.h | 25 +++++++++++++++++++++++++
 xen/arch/x86/pv/emul-priv-op.c      | 21 ++++++---------------
 2 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/include/asm/debugreg.h b/xen/arch/x86/include/asm/debugreg.h
index 6baa725441..23aa592e40 100644
--- a/xen/arch/x86/include/asm/debugreg.h
+++ b/xen/arch/x86/include/asm/debugreg.h
@@ -115,4 +115,29 @@ unsigned int x86_adj_dr7_rsvd(const struct cpu_policy *p, unsigned int dr7);
 unsigned int x86_merge_dr6(const struct cpu_policy *p, unsigned int dr6,
                            unsigned int new);
 
+/*
+ * Calculate the width of a breakpoint from its dr7 encoding.
+ *
+ * The LEN encoding in dr7 is 2 bits wide per breakpoint and encoded as a X-1
+ * (0, 1 and 3) for widths of 1, 2 and 4 respectively in the 32bit days.
+ *
+ * In 64bit, the unused value (2) was given a meaning of width 8, which is
+ * great for efficiency but less great for nicely calculating the width.
+ */
+static inline unsigned int x86_bp_width(unsigned int dr7, unsigned int bp)
+{
+    unsigned int raw = (dr7 >> (DR_CONTROL_SHIFT +
+                                DR_CONTROL_SIZE * bp + 2)) & 3;
+
+    /*
+     * If the top bit is set (i.e. we've got an 4 or 8 byte wide breakpoint),
+     * flip the bottom to reverse their order, making them sorted properly.
+     * Then it's a simple shift to calculate the width.
+     */
+    if ( raw & 2 )
+        raw ^= 1;
+
+    return 1U << raw;
+}
+
 #endif /* _X86_DEBUGREG_H */
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 15c83b9d23..b90f745c75 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -323,30 +323,21 @@ static unsigned int check_guest_io_breakpoint(struct vcpu *v,
                                               unsigned int port,
                                               unsigned int len)
 {
-    unsigned int width, i, match = 0;
-    unsigned long start;
+    unsigned int i, match = 0;
 
     if ( !v->arch.pv.dr7_emul || !(v->arch.pv.ctrlreg[4] & X86_CR4_DE) )
         return 0;
 
     for ( i = 0; i < 4; i++ )
     {
+        unsigned long start;
+        unsigned int width;
+
         if ( !(v->arch.pv.dr7_emul & (3 << (i * DR_ENABLE_SIZE))) )
             continue;
 
-        start = v->arch.dr[i];
-        width = 0;
-
-        switch ( (v->arch.dr7 >>
-                  (DR_CONTROL_SHIFT + i * DR_CONTROL_SIZE)) & 0xc )
-        {
-        case DR_LEN_1: width = 1; break;
-        case DR_LEN_2: width = 2; break;
-        case DR_LEN_4: width = 4; break;
-        case DR_LEN_8: width = 8; break;
-        }
-
-        start &= ~(width - 1UL);
+        width = x86_bp_width(v->arch.dr7, i);
+        start = v->arch.dr[i] & ~(width - 1UL);
 
         if ( (start < (port + len)) && ((start + width) > port) )
             match |= 1u << i;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 22 10:44:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Aug 2024 10:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.781735.1191228 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sh5IS-0000P6-Ui; Thu, 22 Aug 2024 10:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 781735.1191228; Thu, 22 Aug 2024 10: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 1sh5IS-0000Oy-S5; Thu, 22 Aug 2024 10:44:04 +0000
Received: by outflank-mailman (input) for mailman id 781735;
 Thu, 22 Aug 2024 10:44:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sh5IR-0000Os-LE
 for xen-changelog@lists.xenproject.org; Thu, 22 Aug 2024 10:44:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sh5IR-0002Y5-Di
 for xen-changelog@lists.xenproject.org; Thu, 22 Aug 2024 10:44:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sh5IR-0004PY-CW
 for xen-changelog@lists.xenproject.org; Thu, 22 Aug 2024 10:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=py7vYex+BNUNgIU2Du99J5DnebtivYRC/g+MCFakYwk=; b=6iBQ6vYXdRrJhgbWpgNOTe9/Tb
	UfYi7TzmH6XRS3fdqFKH83xpT5DvzQObIqBNzdlW6ZBNGICA66N6vRhxm/u9pvpBonZ5PXF/+qfLN
	wmRuQgCCAf+q33YyWJgBPQ4cktu8peMZMo2HT3hHMvTwZa6h4/PwN4fkWS7qAKWVzZoU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] drivers: char: omap-uart: provide a default clock frequency
Message-Id: <E1sh5IR-0004PY-CW@xenbits.xenproject.org>
Date: Thu, 22 Aug 2024 10:44:03 +0000

commit be9b405aef1c01bbb5af16b4ee519c648c26f556
Author:     Amneesh Singh <a-singh21@ti.com>
AuthorDate: Tue Aug 20 13:52:03 2024 +0530
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Aug 22 10:59:52 2024 +0100

    drivers: char: omap-uart: provide a default clock frequency
    
    Quite a few TI K3 devices do not have clock-frequency specified in their
    respective UART nodes. However hard-coding the frequency is not a
    solution as the function clock input can differ between SoCs. So, use a
    default frequency of 48MHz, which is the same as the linux default (see
    8250_omap.c), if the device tree does not specify it.
    
    Signed-off-by: Amneesh Singh <a-singh21@ti.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/drivers/char/omap-uart.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/char/omap-uart.c b/xen/drivers/char/omap-uart.c
index 1079198a8d..9f73d822ad 100644
--- a/xen/drivers/char/omap-uart.c
+++ b/xen/drivers/char/omap-uart.c
@@ -48,6 +48,9 @@
 /* System configuration register */
 #define UART_OMAP_SYSC_DEF_CONF   0x0d   /* autoidle mode, wakeup is enabled */
 
+/* default clock frequency in hz */
+#define UART_OMAP_DEFAULT_CLK_SPEED 48000000
+
 #define omap_read(uart, off)       readl((uart)->regs + ((off) << REG_SHIFT))
 #define omap_write(uart, off, val) writel(val, \
                                           (uart)->regs + ((off) << REG_SHIFT))
@@ -322,8 +325,9 @@ static int __init omap_uart_init(struct dt_device_node *dev,
     res = dt_property_read_u32(dev, "clock-frequency", &clkspec);
     if ( !res )
     {
-        printk("omap-uart: Unable to retrieve the clock frequency\n");
-        return -EINVAL;
+        printk("omap-uart: Unable to retrieve the clock frequency, defaulting to %uHz\n",
+               UART_OMAP_DEFAULT_CLK_SPEED);
+        clkspec = UART_OMAP_DEFAULT_CLK_SPEED;
     }
 
     uart->clock_hz = clkspec;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 22 10:44:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Aug 2024 10:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.781736.1191232 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sh5Id-0000SN-01; Thu, 22 Aug 2024 10:44:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 781736.1191232; Thu, 22 Aug 2024 10: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 1sh5Ic-0000SF-TX; Thu, 22 Aug 2024 10:44:14 +0000
Received: by outflank-mailman (input) for mailman id 781736;
 Thu, 22 Aug 2024 10:44:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sh5Ib-0000RJ-He
 for xen-changelog@lists.xenproject.org; Thu, 22 Aug 2024 10:44:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sh5Ib-0002YA-Gt
 for xen-changelog@lists.xenproject.org; Thu, 22 Aug 2024 10:44:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sh5Ib-0004Qa-Fq
 for xen-changelog@lists.xenproject.org; Thu, 22 Aug 2024 10:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wgHkkcD2ns5TazDsg15m619RTANKBuQXo3g06Zw4KN0=; b=OKpPu8tKTOb0uDjm0L7U52WB0v
	qPzkiI1oYZviwc8e6fLO0rlx8XlFmrAkmQjgILlvUgMADwFGoDHaB1wVNCRHR9gJhhZ2FaXKnSHgV
	nStZLLMARFH75gqzD3o3kTocrLuH+egZ0J9f7YB7dkHmbH5Z1C1TZfdCwXbF713XCxOw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: arm: Add a new helper update_boot_mapping()
Message-Id: <E1sh5Ib-0004Qa-Fq@xenbits.xenproject.org>
Date: Thu, 22 Aug 2024 10:44:13 +0000

commit 6df7c21b6331f5e21be41ba88dff8b2aad864ac1
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Wed Aug 21 13:25:00 2024 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Aug 22 11:06:33 2024 +0100

    xen: arm: Add a new helper update_boot_mapping()
    
    update_boot_mapping() invokes update_identity_mapping() for the MMU specific
    code.
    Later when the MPU code is added, update_boot_mapping() will invoke the
    equivalent.
    
    The common code now invokes update_boot_mapping() instead of
    update_identity_mapping(). So, that there is clear abstraction between the
    common and MMU/MPU specific logic.
    
    This is in continuation to commit
    f661a20aa880: "Extract MMU-specific MM code".
    
    update_identity_mapping() is now marked as static as it is called from
    xen/arch/arm/arm64/mmu/mm.c only. Also, amend the prototype to
    update_boot_mapping() which is now invoked from other files.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/arm64/mmu/mm.c         | 14 +++++++++++++-
 xen/arch/arm/arm64/smpboot.c        |  6 +++---
 xen/arch/arm/include/asm/arm64/mm.h |  9 +--------
 3 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/xen/arch/arm/arm64/mmu/mm.c b/xen/arch/arm/arm64/mmu/mm.c
index 293acb67e0..0de4f3c079 100644
--- a/xen/arch/arm/arm64/mmu/mm.c
+++ b/xen/arch/arm/arm64/mmu/mm.c
@@ -111,7 +111,14 @@ void __init arch_setup_page_tables(void)
     prepare_runtime_identity_mapping();
 }
 
-void update_identity_mapping(bool enable)
+/*
+ * Enable/disable the identity mapping in the live page-tables (i.e.
+ * the one pointed by TTBR_EL2).
+ *
+ * Note that nested call (e.g. enable=true, enable=true) is not
+ * supported.
+ */
+static void update_identity_mapping(bool enable)
 {
     paddr_t id_addr = virt_to_maddr(_start);
     int rc;
@@ -125,6 +132,11 @@ void update_identity_mapping(bool enable)
     BUG_ON(rc);
 }
 
+void update_boot_mapping(bool enable)
+{
+    update_identity_mapping(enable);
+}
+
 extern void switch_ttbr_id(uint64_t ttbr);
 
 typedef void (switch_ttbr_fn)(uint64_t ttbr);
diff --git a/xen/arch/arm/arm64/smpboot.c b/xen/arch/arm/arm64/smpboot.c
index a225fae64d..789f352ab6 100644
--- a/xen/arch/arm/arm64/smpboot.c
+++ b/xen/arch/arm/arm64/smpboot.c
@@ -112,18 +112,18 @@ int arch_cpu_up(int cpu)
     if ( !smp_enable_ops[cpu].prepare_cpu )
         return -ENODEV;
 
-    update_identity_mapping(true);
+    update_boot_mapping(true);
 
     rc = smp_enable_ops[cpu].prepare_cpu(cpu);
     if ( rc )
-        update_identity_mapping(false);
+        update_boot_mapping(false);
 
     return rc;
 }
 
 void arch_cpu_up_finish(void)
 {
-    update_identity_mapping(false);
+    update_boot_mapping(false);
 }
 
 /*
diff --git a/xen/arch/arm/include/asm/arm64/mm.h b/xen/arch/arm/include/asm/arm64/mm.h
index e0bd23a6ed..b4f7545d2c 100644
--- a/xen/arch/arm/include/asm/arm64/mm.h
+++ b/xen/arch/arm/include/asm/arm64/mm.h
@@ -14,14 +14,7 @@ static inline bool arch_mfns_in_directmap(unsigned long mfn, unsigned long nr)
 
 void arch_setup_page_tables(void);
 
-/*
- * Enable/disable the identity mapping in the live page-tables (i.e.
- * the one pointed by TTBR_EL2).
- *
- * Note that nested call (e.g. enable=true, enable=true) is not
- * supported.
- */
-void update_identity_mapping(bool enable);
+void update_boot_mapping(bool enable);
 
 #endif /* __ARM_ARM64_MM_H__ */
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 22 10:44:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Aug 2024 10:44:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.781737.1191235 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sh5In-0000Vy-2u; Thu, 22 Aug 2024 10:44:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 781737.1191235; Thu, 22 Aug 2024 10:44: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 1sh5In-0000Vq-0I; Thu, 22 Aug 2024 10:44:25 +0000
Received: by outflank-mailman (input) for mailman id 781737;
 Thu, 22 Aug 2024 10:44:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sh5Il-0000VY-KY
 for xen-changelog@lists.xenproject.org; Thu, 22 Aug 2024 10:44:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sh5Il-0002YK-Jr
 for xen-changelog@lists.xenproject.org; Thu, 22 Aug 2024 10:44:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sh5Il-0004RV-Iv
 for xen-changelog@lists.xenproject.org; Thu, 22 Aug 2024 10:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Zu4IkkQ7rJtJ93mDcJlDkbtwdchmfGvcRB4sdV27jS0=; b=v6Gfq4mIdduuv99IUKokJg0kaM
	6I6R9hiWMKU7vDNSdoIsgSuJCW5+747uEKXSX3AjB8N4sVshpnmbbwfZ4EAkhUU7CexjNXMf/+asf
	6kNfEqW8zoNMpuqESXo4kBp9ZIUqZGGtNkAz4Sw5E8/FDpadOc6pTIBp17qPOXsLGu5o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: arm: Move domain_page.c to MMU specific
Message-Id: <E1sh5Il-0004RV-Iv@xenbits.xenproject.org>
Date: Thu, 22 Aug 2024 10:44:23 +0000

commit 576459a06ad55fd1c4cea912fc0bc26b9f901f1e
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Wed Aug 21 13:25:01 2024 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Aug 22 11:06:33 2024 +0100

    xen: arm: Move domain_page.c to MMU specific
    
    domain_page.c is moved to mmu/domain_page.c. The reason
    being this file implements MMU specific logic for mapping,
    unmapping, etc domain page.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/Makefile          |   1 -
 xen/arch/arm/domain_page.c     | 194 -----------------------------------------
 xen/arch/arm/mmu/Makefile      |   1 +
 xen/arch/arm/mmu/domain_page.c | 194 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 195 insertions(+), 195 deletions(-)

diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index da9c979dc4..7792bff597 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -18,7 +18,6 @@ obj-$(CONFIG_IOREQ_SERVER) += dm.o
 obj-$(CONFIG_DOM0LESS_BOOT) += dom0less-build.init.o
 obj-y += domain.o
 obj-y += domain_build.init.o
-obj-$(CONFIG_ARCH_MAP_DOMAIN_PAGE) += domain_page.o
 obj-y += domctl.o
 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
 obj-y += efi/
diff --git a/xen/arch/arm/domain_page.c b/xen/arch/arm/domain_page.c
deleted file mode 100644
index 3a43601623..0000000000
--- a/xen/arch/arm/domain_page.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-#include <xen/mm.h>
-#include <xen/pmap.h>
-#include <xen/vmap.h>
-
-/* Override macros from asm/page.h to make them work with mfn_t */
-#undef virt_to_mfn
-#define virt_to_mfn(va) _mfn(__virt_to_mfn(va))
-
-/* cpu0's domheap page tables */
-static DEFINE_PAGE_TABLES(cpu0_dommap, DOMHEAP_SECOND_PAGES);
-
-/*
- * xen_dommap == pages used by map_domain_page, these pages contain
- * the second level pagetables which map the domheap region
- * starting at DOMHEAP_VIRT_START in 2MB chunks.
- */
-static DEFINE_PER_CPU(lpae_t *, xen_dommap);
-
-/*
- * Prepare the area that will be used to map domheap pages. They are
- * mapped in 2MB chunks, so we need to allocate the page-tables up to
- * the 2nd level.
- *
- * The caller should make sure the root page-table for @cpu has been
- * allocated.
- */
-bool init_domheap_mappings(unsigned int cpu)
-{
-    unsigned int order = get_order_from_pages(DOMHEAP_SECOND_PAGES);
-    lpae_t *root = per_cpu(xen_pgtable, cpu);
-    unsigned int i, first_idx;
-    lpae_t *domheap;
-    mfn_t mfn;
-
-    ASSERT(root);
-    ASSERT(!per_cpu(xen_dommap, cpu));
-
-    /*
-     * The domheap for cpu0 is initialized before the heap is initialized.
-     * So we need to use pre-allocated pages.
-     */
-    if ( !cpu )
-        domheap = cpu0_dommap;
-    else
-        domheap = alloc_xenheap_pages(order, 0);
-
-    if ( !domheap )
-        return false;
-
-    /* Ensure the domheap has no stray mappings */
-    memset(domheap, 0, DOMHEAP_SECOND_PAGES * PAGE_SIZE);
-
-    /*
-     * Update the first level mapping to reference the local CPUs
-     * domheap mapping pages.
-     */
-    mfn = virt_to_mfn(domheap);
-    first_idx = first_table_offset(DOMHEAP_VIRT_START);
-    for ( i = 0; i < DOMHEAP_SECOND_PAGES; i++ )
-    {
-        lpae_t pte = mfn_to_xen_entry(mfn_add(mfn, i), MT_NORMAL);
-        pte.pt.table = 1;
-        write_pte(&root[first_idx + i], pte);
-    }
-
-    per_cpu(xen_dommap, cpu) = domheap;
-
-    return true;
-}
-
-void *map_domain_page_global(mfn_t mfn)
-{
-    return vmap(&mfn, 1);
-}
-
-void unmap_domain_page_global(const void *ptr)
-{
-    vunmap(ptr);
-}
-
-/* Map a page of domheap memory */
-void *map_domain_page(mfn_t mfn)
-{
-    unsigned long flags;
-    lpae_t *map = this_cpu(xen_dommap);
-    unsigned long slot_mfn = mfn_x(mfn) & ~XEN_PT_LPAE_ENTRY_MASK;
-    vaddr_t va;
-    lpae_t pte;
-    int i, slot;
-
-    local_irq_save(flags);
-
-    /* The map is laid out as an open-addressed hash table where each
-     * entry is a 2MB superpage pte.  We use the available bits of each
-     * PTE as a reference count; when the refcount is zero the slot can
-     * be reused. */
-    for ( slot = (slot_mfn >> XEN_PT_LPAE_SHIFT) % DOMHEAP_ENTRIES, i = 0;
-          i < DOMHEAP_ENTRIES;
-          slot = (slot + 1) % DOMHEAP_ENTRIES, i++ )
-    {
-        if ( map[slot].pt.avail < 0xf &&
-             map[slot].pt.base == slot_mfn &&
-             map[slot].pt.valid )
-        {
-            /* This slot already points to the right place; reuse it */
-            map[slot].pt.avail++;
-            break;
-        }
-        else if ( map[slot].pt.avail == 0 )
-        {
-            /* Commandeer this 2MB slot */
-            pte = mfn_to_xen_entry(_mfn(slot_mfn), MT_NORMAL);
-            pte.pt.avail = 1;
-            write_pte(map + slot, pte);
-            break;
-        }
-
-    }
-    /* If the map fills up, the callers have misbehaved. */
-    BUG_ON(i == DOMHEAP_ENTRIES);
-
-#ifndef NDEBUG
-    /* Searching the hash could get slow if the map starts filling up.
-     * Cross that bridge when we come to it */
-    {
-        static int max_tries = 32;
-        if ( i >= max_tries )
-        {
-            dprintk(XENLOG_WARNING, "Domheap map is filling: %i tries\n", i);
-            max_tries *= 2;
-        }
-    }
-#endif
-
-    local_irq_restore(flags);
-
-    va = (DOMHEAP_VIRT_START
-          + (slot << SECOND_SHIFT)
-          + ((mfn_x(mfn) & XEN_PT_LPAE_ENTRY_MASK) << THIRD_SHIFT));
-
-    /*
-     * We may not have flushed this specific subpage at map time,
-     * since we only flush the 4k page not the superpage
-     */
-    flush_xen_tlb_range_va_local(va, PAGE_SIZE);
-
-    return (void *)va;
-}
-
-/* Release a mapping taken with map_domain_page() */
-void unmap_domain_page(const void *ptr)
-{
-    unsigned long flags;
-    lpae_t *map = this_cpu(xen_dommap);
-    int slot = ((unsigned long)ptr - DOMHEAP_VIRT_START) >> SECOND_SHIFT;
-
-    if ( !ptr )
-        return;
-
-    local_irq_save(flags);
-
-    ASSERT(slot >= 0 && slot < DOMHEAP_ENTRIES);
-    ASSERT(map[slot].pt.avail != 0);
-
-    map[slot].pt.avail--;
-
-    local_irq_restore(flags);
-}
-
-mfn_t domain_page_map_to_mfn(const void *ptr)
-{
-    unsigned long va = (unsigned long)ptr;
-    lpae_t *map = this_cpu(xen_dommap);
-    int slot = (va - DOMHEAP_VIRT_START) >> SECOND_SHIFT;
-    unsigned long offset = (va>>THIRD_SHIFT) & XEN_PT_LPAE_ENTRY_MASK;
-
-    if ( (va >= VMAP_VIRT_START) && ((va - VMAP_VIRT_START) < VMAP_VIRT_SIZE) )
-        return virt_to_mfn(va);
-
-    ASSERT(slot >= 0 && slot < DOMHEAP_ENTRIES);
-    ASSERT(map[slot].pt.avail != 0);
-
-    return mfn_add(lpae_get_mfn(map[slot]), offset);
-}
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/xen/arch/arm/mmu/Makefile b/xen/arch/arm/mmu/Makefile
index 67475fcd80..2cb44b857d 100644
--- a/xen/arch/arm/mmu/Makefile
+++ b/xen/arch/arm/mmu/Makefile
@@ -2,3 +2,4 @@ obj-y += p2m.o
 obj-y += pt.o
 obj-y += setup.o
 obj-y += smpboot.o
+obj-$(CONFIG_ARCH_MAP_DOMAIN_PAGE) += domain_page.o
diff --git a/xen/arch/arm/mmu/domain_page.c b/xen/arch/arm/mmu/domain_page.c
new file mode 100644
index 0000000000..3a43601623
--- /dev/null
+++ b/xen/arch/arm/mmu/domain_page.c
@@ -0,0 +1,194 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#include <xen/mm.h>
+#include <xen/pmap.h>
+#include <xen/vmap.h>
+
+/* Override macros from asm/page.h to make them work with mfn_t */
+#undef virt_to_mfn
+#define virt_to_mfn(va) _mfn(__virt_to_mfn(va))
+
+/* cpu0's domheap page tables */
+static DEFINE_PAGE_TABLES(cpu0_dommap, DOMHEAP_SECOND_PAGES);
+
+/*
+ * xen_dommap == pages used by map_domain_page, these pages contain
+ * the second level pagetables which map the domheap region
+ * starting at DOMHEAP_VIRT_START in 2MB chunks.
+ */
+static DEFINE_PER_CPU(lpae_t *, xen_dommap);
+
+/*
+ * Prepare the area that will be used to map domheap pages. They are
+ * mapped in 2MB chunks, so we need to allocate the page-tables up to
+ * the 2nd level.
+ *
+ * The caller should make sure the root page-table for @cpu has been
+ * allocated.
+ */
+bool init_domheap_mappings(unsigned int cpu)
+{
+    unsigned int order = get_order_from_pages(DOMHEAP_SECOND_PAGES);
+    lpae_t *root = per_cpu(xen_pgtable, cpu);
+    unsigned int i, first_idx;
+    lpae_t *domheap;
+    mfn_t mfn;
+
+    ASSERT(root);
+    ASSERT(!per_cpu(xen_dommap, cpu));
+
+    /*
+     * The domheap for cpu0 is initialized before the heap is initialized.
+     * So we need to use pre-allocated pages.
+     */
+    if ( !cpu )
+        domheap = cpu0_dommap;
+    else
+        domheap = alloc_xenheap_pages(order, 0);
+
+    if ( !domheap )
+        return false;
+
+    /* Ensure the domheap has no stray mappings */
+    memset(domheap, 0, DOMHEAP_SECOND_PAGES * PAGE_SIZE);
+
+    /*
+     * Update the first level mapping to reference the local CPUs
+     * domheap mapping pages.
+     */
+    mfn = virt_to_mfn(domheap);
+    first_idx = first_table_offset(DOMHEAP_VIRT_START);
+    for ( i = 0; i < DOMHEAP_SECOND_PAGES; i++ )
+    {
+        lpae_t pte = mfn_to_xen_entry(mfn_add(mfn, i), MT_NORMAL);
+        pte.pt.table = 1;
+        write_pte(&root[first_idx + i], pte);
+    }
+
+    per_cpu(xen_dommap, cpu) = domheap;
+
+    return true;
+}
+
+void *map_domain_page_global(mfn_t mfn)
+{
+    return vmap(&mfn, 1);
+}
+
+void unmap_domain_page_global(const void *ptr)
+{
+    vunmap(ptr);
+}
+
+/* Map a page of domheap memory */
+void *map_domain_page(mfn_t mfn)
+{
+    unsigned long flags;
+    lpae_t *map = this_cpu(xen_dommap);
+    unsigned long slot_mfn = mfn_x(mfn) & ~XEN_PT_LPAE_ENTRY_MASK;
+    vaddr_t va;
+    lpae_t pte;
+    int i, slot;
+
+    local_irq_save(flags);
+
+    /* The map is laid out as an open-addressed hash table where each
+     * entry is a 2MB superpage pte.  We use the available bits of each
+     * PTE as a reference count; when the refcount is zero the slot can
+     * be reused. */
+    for ( slot = (slot_mfn >> XEN_PT_LPAE_SHIFT) % DOMHEAP_ENTRIES, i = 0;
+          i < DOMHEAP_ENTRIES;
+          slot = (slot + 1) % DOMHEAP_ENTRIES, i++ )
+    {
+        if ( map[slot].pt.avail < 0xf &&
+             map[slot].pt.base == slot_mfn &&
+             map[slot].pt.valid )
+        {
+            /* This slot already points to the right place; reuse it */
+            map[slot].pt.avail++;
+            break;
+        }
+        else if ( map[slot].pt.avail == 0 )
+        {
+            /* Commandeer this 2MB slot */
+            pte = mfn_to_xen_entry(_mfn(slot_mfn), MT_NORMAL);
+            pte.pt.avail = 1;
+            write_pte(map + slot, pte);
+            break;
+        }
+
+    }
+    /* If the map fills up, the callers have misbehaved. */
+    BUG_ON(i == DOMHEAP_ENTRIES);
+
+#ifndef NDEBUG
+    /* Searching the hash could get slow if the map starts filling up.
+     * Cross that bridge when we come to it */
+    {
+        static int max_tries = 32;
+        if ( i >= max_tries )
+        {
+            dprintk(XENLOG_WARNING, "Domheap map is filling: %i tries\n", i);
+            max_tries *= 2;
+        }
+    }
+#endif
+
+    local_irq_restore(flags);
+
+    va = (DOMHEAP_VIRT_START
+          + (slot << SECOND_SHIFT)
+          + ((mfn_x(mfn) & XEN_PT_LPAE_ENTRY_MASK) << THIRD_SHIFT));
+
+    /*
+     * We may not have flushed this specific subpage at map time,
+     * since we only flush the 4k page not the superpage
+     */
+    flush_xen_tlb_range_va_local(va, PAGE_SIZE);
+
+    return (void *)va;
+}
+
+/* Release a mapping taken with map_domain_page() */
+void unmap_domain_page(const void *ptr)
+{
+    unsigned long flags;
+    lpae_t *map = this_cpu(xen_dommap);
+    int slot = ((unsigned long)ptr - DOMHEAP_VIRT_START) >> SECOND_SHIFT;
+
+    if ( !ptr )
+        return;
+
+    local_irq_save(flags);
+
+    ASSERT(slot >= 0 && slot < DOMHEAP_ENTRIES);
+    ASSERT(map[slot].pt.avail != 0);
+
+    map[slot].pt.avail--;
+
+    local_irq_restore(flags);
+}
+
+mfn_t domain_page_map_to_mfn(const void *ptr)
+{
+    unsigned long va = (unsigned long)ptr;
+    lpae_t *map = this_cpu(xen_dommap);
+    int slot = (va - DOMHEAP_VIRT_START) >> SECOND_SHIFT;
+    unsigned long offset = (va>>THIRD_SHIFT) & XEN_PT_LPAE_ENTRY_MASK;
+
+    if ( (va >= VMAP_VIRT_START) && ((va - VMAP_VIRT_START) < VMAP_VIRT_SIZE) )
+        return virt_to_mfn(va);
+
+    ASSERT(slot >= 0 && slot < DOMHEAP_ENTRIES);
+    ASSERT(map[slot].pt.avail != 0);
+
+    return mfn_add(lpae_get_mfn(map[slot]), offset);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 22 10:44:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Aug 2024 10:44:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.781738.1191240 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sh5Ix-0000YY-4M; Thu, 22 Aug 2024 10:44:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 781738.1191240; Thu, 22 Aug 2024 10:44: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 1sh5Ix-0000YQ-1j; Thu, 22 Aug 2024 10:44:35 +0000
Received: by outflank-mailman (input) for mailman id 781738;
 Thu, 22 Aug 2024 10:44:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sh5Iv-0000YG-NY
 for xen-changelog@lists.xenproject.org; Thu, 22 Aug 2024 10:44:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sh5Iv-0002YS-Mi
 for xen-changelog@lists.xenproject.org; Thu, 22 Aug 2024 10:44:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sh5Iv-0004SM-Lt
 for xen-changelog@lists.xenproject.org; Thu, 22 Aug 2024 10:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=21OOCplgjqsHFBV3ixqTHNsN+0D3TColyFfhkDQnav8=; b=ynX5UJ52qves0LRLQ50BI9TheU
	BLL+OoXsKmn6s4oXznYnxyyQOv7r3KoiVdYvDk0Q/hH7KIqjX3O3VZwpmJB6ftm/6CjOvidlvOlkT
	VZlOYH2acsGo+n9Lu/fFSNfASQ0RCxjX2DNAvAzB2CjRW5JwadpPqVHXQ7w9hXEluBMw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: arm: Enclose access to EL2 MMU specific registers under CONFIG_MMU
Message-Id: <E1sh5Iv-0004SM-Lt@xenbits.xenproject.org>
Date: Thu, 22 Aug 2024 10:44:33 +0000

commit 405c2b4b9971b6ab10d630f81f83c96a550e4811
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Wed Aug 21 13:25:02 2024 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Aug 22 11:06:33 2024 +0100

    xen: arm: Enclose access to EL2 MMU specific registers under CONFIG_MMU
    
    All the EL2 MMU specific registers are enclosed within CONFIG_MMU.
    Also, protect vttbr_el2 field of struct reg_ctxt and accesses to it.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/traps.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index aac6c599f8..737f4d65e3 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -720,8 +720,10 @@ struct reg_ctxt {
     uint32_t ifsr32_el2;
 #endif
 
+#ifdef CONFIG_MMU
     /* Hypervisor-side state */
     uint64_t vttbr_el2;
+#endif
 };
 
 static const char *mode_string(register_t cpsr)
@@ -919,12 +921,16 @@ static void _show_registers(const struct cpu_user_regs *regs,
 #endif
     }
     printk("  VTCR_EL2: %"PRIregister"\n", READ_SYSREG(VTCR_EL2));
+#ifdef CONFIG_MMU
     printk(" VTTBR_EL2: %016"PRIx64"\n", ctxt->vttbr_el2);
+#endif
     printk("\n");
 
     printk(" SCTLR_EL2: %"PRIregister"\n", READ_SYSREG(SCTLR_EL2));
     printk("   HCR_EL2: %"PRIregister"\n", READ_SYSREG(HCR_EL2));
+#ifdef CONFIG_MMU
     printk(" TTBR0_EL2: %016"PRIx64"\n", READ_SYSREG64(TTBR0_EL2));
+#endif
     printk("\n");
     printk("   ESR_EL2: %"PRIregister"\n", regs->hsr);
     printk(" HPFAR_EL2: %"PRIregister"\n", READ_SYSREG(HPFAR_EL2));
@@ -956,7 +962,9 @@ void show_registers(const struct cpu_user_regs *regs)
     if ( guest_mode(regs) && is_32bit_domain(current->domain) )
         ctxt.ifsr32_el2 = READ_SYSREG(IFSR32_EL2);
 #endif
+#ifdef CONFIG_MMU
     ctxt.vttbr_el2 = READ_SYSREG64(VTTBR_EL2);
+#endif
 
     _show_registers(regs, &ctxt, guest_mode(regs), current);
 }
@@ -979,7 +987,9 @@ void vcpu_show_registers(const struct vcpu *v)
     ctxt.ifsr32_el2 = v->arch.ifsr;
 #endif
 
+#ifdef CONFIG_MMU
     ctxt.vttbr_el2 = v->domain->arch.p2m.vttbr;
+#endif
 
     _show_registers(&v->arch.cpu_info->guest_cpu_user_regs, &ctxt, 1, v);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 22 10:44:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Aug 2024 10:44:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.781739.1191244 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sh5J7-0000be-6I; Thu, 22 Aug 2024 10:44:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 781739.1191244; Thu, 22 Aug 2024 10:44: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 1sh5J7-0000bW-3W; Thu, 22 Aug 2024 10:44:45 +0000
Received: by outflank-mailman (input) for mailman id 781739;
 Thu, 22 Aug 2024 10:44:43 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sh5J5-0000ax-QR
 for xen-changelog@lists.xenproject.org; Thu, 22 Aug 2024 10:44:43 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sh5J5-0002Yp-PY
 for xen-changelog@lists.xenproject.org; Thu, 22 Aug 2024 10:44:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sh5J5-0004TM-Ol
 for xen-changelog@lists.xenproject.org; Thu, 22 Aug 2024 10:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=s8y8iPkngwSh6LMO8UsWdVPhKkpcC94RDphbhvVe10c=; b=0f8H6N/oQZSwy1iQQ06is1AzFm
	pxp8DSTA3S9WlCoEs5fH0g7z1bMaY1JmdOjx5av8R744EluYTBI7pplA9cc0DDGJNJf0IjFH9vuZE
	LhWneUPV6UCczAXW+IDa64BzI4Cusv/7cu1yM44XuWv5JMKWZ+qAwaNzzgJWdOmMetMY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm64: Hide FEAT_SME
Message-Id: <E1sh5J5-0004TM-Ol@xenbits.xenproject.org>
Date: Thu, 22 Aug 2024 10:44:43 +0000

commit 98060fc4a31ff56f1375446b21dc4b52836e22bd
Author:     Julien Grall <julien@xen.org>
AuthorDate: Wed Aug 14 22:00:54 2024 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Aug 22 11:09:42 2024 +0100

    xen/arm64: Hide FEAT_SME
    
    Newer hardware may support FEAT_SME. Xen doesn't have any knowledge but
    it will still expose the feature to the VM. If the OS is trying to use
    SME, then it will crash.
    
    Solve by hiding FEAT_SME.
    
    Signed-off-by: Julien Grall <julien@xen.org>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
---
 xen/arch/arm/cpufeature.c             | 3 +++
 xen/arch/arm/include/asm/cpufeature.h | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/cpufeature.c b/xen/arch/arm/cpufeature.c
index ef77473bf8..b45dbe3c66 100644
--- a/xen/arch/arm/cpufeature.c
+++ b/xen/arch/arm/cpufeature.c
@@ -208,6 +208,9 @@ static int __init create_domain_cpuinfo(void)
     domain_cpuinfo.pfr64.sve = 0;
     domain_cpuinfo.zfr64.bits[0] = 0;
 
+    /* Hide SMT support as Xen does not support it */
+    domain_cpuinfo.pfr64.sme = 0;
+
     /* Hide MTE support as Xen does not support it */
     domain_cpuinfo.pfr64.mte = 0;
 
diff --git a/xen/arch/arm/include/asm/cpufeature.h b/xen/arch/arm/include/asm/cpufeature.h
index c95582044a..969e043f5b 100644
--- a/xen/arch/arm/include/asm/cpufeature.h
+++ b/xen/arch/arm/include/asm/cpufeature.h
@@ -207,7 +207,9 @@ struct cpuinfo_arm {
             unsigned long mte:4;
             unsigned long ras_frac:4;
             unsigned long mpam_frac:4;
-            unsigned long __res1:44;
+            unsigned long __res1:4;
+            unsigned long sme:4;
+            unsigned long __res2:36;
         };
     } pfr64;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 22 10:44:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Aug 2024 10:44:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.781740.1191249 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sh5JH-0000eC-7u; Thu, 22 Aug 2024 10:44:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 781740.1191249; Thu, 22 Aug 2024 10:44: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 1sh5JH-0000e2-4t; Thu, 22 Aug 2024 10:44:55 +0000
Received: by outflank-mailman (input) for mailman id 781740;
 Thu, 22 Aug 2024 10:44:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sh5JF-0000dr-TA
 for xen-changelog@lists.xenproject.org; Thu, 22 Aug 2024 10:44:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sh5JF-0002Z0-SY
 for xen-changelog@lists.xenproject.org; Thu, 22 Aug 2024 10:44:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sh5JF-0004Tw-Re
 for xen-changelog@lists.xenproject.org; Thu, 22 Aug 2024 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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=I/Lzz78Du5ZbgY5CrQ46LQe1WnP44CkpL+Ty/IKsXAY=; b=zKi3gLdxCyiY9IWQg/dBLPOLYK
	mK/voaDvZ1zpDmczlkFURMnzKjlvczHpNDZxq8cMkEJ+nP0vkpaOHgBsRrj/bVuS19us1mAakJc47
	dMp9nb6GAhGTWNuiWiNrSu9M+7ZJq3RekBn5cWna2/I2qAmX7JvUt4xlRWj8rPUudKeI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Drop {boot_}phys_offset usage
Message-Id: <E1sh5JF-0004Tw-Re@xenbits.xenproject.org>
Date: Thu, 22 Aug 2024 10:44:53 +0000

commit 0cc09bdfafebe95a54a64f77c6ac80e5b5988fb7
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Wed Aug 14 11:43:02 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Aug 22 11:35:05 2024 +0100

    xen/arm: Drop {boot_}phys_offset usage
    
    boot_phys_offset stores the physical offset (PA-VA), is calculated in
    the startup head.S code and passed to start_xen() as a first argument.
    There is no point in using it given that we can ask MMU to translate
    a VA for us using e.g. virt_to_{mfn,maddr}. Drop usage of these
    variables from the C world.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/mm.h |  2 +-
 xen/arch/arm/mmu/setup.c      | 16 ++++++----------
 xen/arch/arm/setup.c          |  2 +-
 3 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h
index f6ba611f01..5abd4b0d1c 100644
--- a/xen/arch/arm/include/asm/mm.h
+++ b/xen/arch/arm/include/asm/mm.h
@@ -199,7 +199,7 @@ extern unsigned long frametable_base_pdx;
 #define PDX_GROUP_SHIFT SECOND_SHIFT
 
 /* Boot-time pagetable setup */
-extern void setup_pagetables(unsigned long boot_phys_offset);
+extern void setup_pagetables(void);
 /* Map FDT in boot pagetable */
 extern void *early_fdt_map(paddr_t fdt_paddr);
 /* Remove early mappings */
diff --git a/xen/arch/arm/mmu/setup.c b/xen/arch/arm/mmu/setup.c
index 57042ed57b..9664e85ee6 100644
--- a/xen/arch/arm/mmu/setup.c
+++ b/xen/arch/arm/mmu/setup.c
@@ -17,6 +17,8 @@
 /* Override macros from asm/page.h to make them work with mfn_t */
 #undef mfn_to_virt
 #define mfn_to_virt(mfn) __mfn_to_virt(mfn_x(mfn))
+#undef virt_to_mfn
+#define virt_to_mfn(va) _mfn(__virt_to_mfn(va))
 
 /* Main runtime page tables */
 
@@ -52,8 +54,6 @@ DEFINE_BOOT_PAGE_TABLE(xen_fixmap);
  */
 static DEFINE_PAGE_TABLES(xen_xenmap, XEN_NR_ENTRIES(2));
 
-static paddr_t phys_offset;
-
 /* Limits of the Xen heap */
 mfn_t directmap_mfn_start __read_mostly = INVALID_MFN_INITIALIZER;
 mfn_t directmap_mfn_end __read_mostly;
@@ -138,9 +138,7 @@ static void __init __maybe_unused build_assertions(void)
 
 lpae_t __init pte_of_xenaddr(vaddr_t va)
 {
-    paddr_t ma = va + phys_offset;
-
-    return mfn_to_xen_entry(maddr_to_mfn(ma), MT_NORMAL);
+    return mfn_to_xen_entry(virt_to_mfn(va), MT_NORMAL);
 }
 
 void * __init early_fdt_map(paddr_t fdt_paddr)
@@ -228,14 +226,12 @@ static void xen_pt_enforce_wnx(void)
  * Boot-time pagetable setup.
  * Changes here may need matching changes in head.S
  */
-void __init setup_pagetables(unsigned long boot_phys_offset)
+void __init setup_pagetables(void)
 {
     uint64_t ttbr;
     lpae_t pte, *p;
     int i;
 
-    phys_offset = boot_phys_offset;
-
     arch_setup_page_tables();
 
 #ifdef CONFIG_ARM_64
@@ -290,9 +286,9 @@ void __init setup_pagetables(unsigned long boot_phys_offset)
     xen_second[second_table_offset(FIXMAP_ADDR(0))] = pte;
 
 #ifdef CONFIG_ARM_64
-    ttbr = (uintptr_t) xen_pgtable + phys_offset;
+    ttbr = virt_to_maddr(xen_pgtable);
 #else
-    ttbr = (uintptr_t) cpu0_pgtable + phys_offset;
+    ttbr = virt_to_maddr(cpu0_pgtable);
 #endif
 
     switch_ttbr(ttbr);
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index cb2c0a16b8..cfe19e15b0 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -304,7 +304,7 @@ void asmlinkage __init start_xen(unsigned long boot_phys_offset,
     /* Initialize traps early allow us to get backtrace when an error occurred */
     init_traps();
 
-    setup_pagetables(boot_phys_offset);
+    setup_pagetables();
 
     smp_clear_cpu_maps();
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 22 10:45:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Aug 2024 10:45:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.781741.1191251 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sh5JQ-0000gj-8z; Thu, 22 Aug 2024 10:45:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 781741.1191251; Thu, 22 Aug 2024 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 1sh5JQ-0000gb-6H; Thu, 22 Aug 2024 10:45:04 +0000
Received: by outflank-mailman (input) for mailman id 781741;
 Thu, 22 Aug 2024 10:45:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sh5JP-0000gV-W6
 for xen-changelog@lists.xenproject.org; Thu, 22 Aug 2024 10:45:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sh5JP-0002b4-VQ
 for xen-changelog@lists.xenproject.org; Thu, 22 Aug 2024 10:45:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sh5JP-0004Ui-UX
 for xen-changelog@lists.xenproject.org; Thu, 22 Aug 2024 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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bzG0t4UZKn18Vr5aHErb393t/ZqBI2Vf2+lElPhG+nA=; b=DBZBJZBe/3aT6KjzzCN8Xncvm5
	o5cxk3odsnHY38CQkd98XW95sQ5aSobDYxRAKKc75AmSjzLyLRnUoJwIn++sLCLg01dcWmX1SgIvf
	1edJF5M2MQCHbauZjnZ0hLnnXqqRypbZE2u2EWPsZODJfaUoe7WcJ+EOBqO4kUh5BcWM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: head: Do not pass physical offset to start_xen
Message-Id: <E1sh5JP-0004Ui-UX@xenbits.xenproject.org>
Date: Thu, 22 Aug 2024 10:45:03 +0000

commit 394c9d88858cd99fcb5a189dbabe2af34dbabfd3
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Wed Aug 14 11:43:03 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Aug 22 11:35:05 2024 +0100

    xen/arm: head: Do not pass physical offset to start_xen
    
    Given no further use in C world of boot_phys_offset, drop it from the
    argument list of start_xen() and do the necessary changes in the startup
    code head.S (most notably modifying launch not to expect 2 arguments to
    pass to C entry point).
    
    Both on arm64 and arm32, phys offset (stored in x20 or r10 respectively)
    is still needed, so that it can be used in e.g. create_table_entry,
    therefore keep it on the list of common register usage.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/arm32/head.S | 12 +++++-------
 xen/arch/arm/arm64/head.S | 12 +++++-------
 xen/arch/arm/setup.c      |  3 +--
 3 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
index b488a21a71..a96d5d3503 100644
--- a/xen/arch/arm/arm32/head.S
+++ b/xen/arch/arm/arm32/head.S
@@ -101,9 +101,8 @@ primary_switched:
         bl    zero_bss
         PRINT("- Ready -\r\n")
         /* Setup the arguments for start_xen and jump to C world */
-        mov   r0, r10                /* r0 := Physical offset */
-        mov   r1, r8                 /* r1 := paddr(FDT) */
-        mov_w r2, start_xen
+        mov   r0, r8                 /* r0 := paddr(FDT) */
+        mov_w r1, start_xen
         b     launch
 ENDPROC(start)
 
@@ -141,7 +140,7 @@ GLOBAL(init_secondary)
 secondary_switched:
         PRINT("- Ready -\r\n")
         /* Jump to C world */
-        mov_w r2, start_secondary
+        mov_w r1, start_secondary
         b     launch
 ENDPROC(init_secondary)
 
@@ -243,8 +242,7 @@ ENDPROC(cpu_init)
  *
  * Inputs:
  *   r0 : Argument 0 of the C function to call
- *   r1 : Argument 1 of the C function to call
- *   r2 : C entry point
+ *   r1 : C entry point
  *
  * Clobbers r3
  */
@@ -256,7 +254,7 @@ launch:
         sub   sp, #CPUINFO_sizeof    /* Make room for CPU save record */
 
         /* Jump to C world */
-       bx    r2
+       bx    r1
 ENDPROC(launch)
 
 /* Fail-stop */
diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index 2fa07dc3a0..14c3720d80 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -260,9 +260,8 @@ primary_switched:
         bl    zero_bss
         PRINT("- Ready -\r\n")
         /* Setup the arguments for start_xen and jump to C world */
-        mov   x0, x20                /* x0 := Physical offset */
-        mov   x1, x21                /* x1 := paddr(FDT) */
-        ldr   x2, =start_xen
+        mov   x0, x21                /* x0 := paddr(FDT) */
+        ldr   x1, =start_xen
         b     launch
 END(real_start)
 
@@ -303,7 +302,7 @@ FUNC(init_secondary)
 secondary_switched:
         PRINT("- Ready -\r\n")
         /* Jump to C world */
-        ldr   x2, =start_secondary
+        ldr   x1, =start_secondary
         b     launch
 END(init_secondary)
 
@@ -407,8 +406,7 @@ END(cpu_init)
  *
  * Inputs:
  *   x0 : Argument 0 of the C function to call
- *   x1 : Argument 1 of the C function to call
- *   x2 : C entry point
+ *   x1 : C entry point
  *
  * Clobbers x3
  */
@@ -421,7 +419,7 @@ FUNC_LOCAL(launch)
         mov   sp, x3
 
         /* Jump to C world */
-        br    x2
+        br    x1
 END(launch)
 
 /* Fail-stop */
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index cfe19e15b0..961d3ea670 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -287,8 +287,7 @@ void __init init_pdx(void)
 size_t __read_mostly dcache_line_bytes;
 
 /* C entry point for boot CPU */
-void asmlinkage __init start_xen(unsigned long boot_phys_offset,
-                                 unsigned long fdt_paddr)
+void asmlinkage __init start_xen(unsigned long fdt_paddr)
 {
     size_t fdt_size;
     const char *cmdline;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 22 20:11:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 22 Aug 2024 20:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.781975.1191445 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shE9B-0002r1-5U; Thu, 22 Aug 2024 20:11:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 781975.1191445; Thu, 22 Aug 2024 20:11: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 1shE9B-0002qu-35; Thu, 22 Aug 2024 20:11:05 +0000
Received: by outflank-mailman (input) for mailman id 781975;
 Thu, 22 Aug 2024 20:11:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shE99-0002qo-Od
 for xen-changelog@lists.xenproject.org; Thu, 22 Aug 2024 20:11:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shE99-0004bt-HT
 for xen-changelog@lists.xenproject.org; Thu, 22 Aug 2024 20:11:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shE99-0002HU-EB
 for xen-changelog@lists.xenproject.org; Thu, 22 Aug 2024 20:11: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wo0jXA+hg2HsjFLovivjc5pp6N6609RLADD/jMH2p1k=; b=z81f3ZV4xvNyuybGOXNbE74AdJ
	PDHb7D1JJk/rwfHX4hvqceVEdG3m5djwXBM13wSwItYxziBEVOv6J2d+Ml5xAAr0tC2rYwF/CSIbF
	w2SBX9AUR5YKIjIfTUO4EEQDsTOUWVxW01x1T85eOgKTQ2MgGd48StJyWmCodjuQvbYQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: restore CR filtering
Message-Id: <E1shE99-0002HU-EB@xenbits.xenproject.org>
Date: Thu, 22 Aug 2024 20:11:03 +0000

commit aa80a04df488528d90a0d892f0752571b1759e8b
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Wed Aug 21 13:29:58 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Aug 22 13:07:39 2024 -0700

    automation: restore CR filtering
    
    After commit c36efb7fcea6 ("automation: use expect to run QEMU") we lost
    the \r filtering introduced by b576497e3b7d ("automation: remove CR
    characters from serial output"). This patch reintroduced it.
    
    Fixes: c36efb7fcea6 ("automation: use expect to run QEMU")
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 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/qemu-smoke-x86-64.sh         | 2 +-
 automation/scripts/qemu-xtf-dom0less-arm64.sh   | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index 5359e0820b..42a89e86b0 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -89,4 +89,4 @@ export QEMU_LOG="smoke.serial"
 export LOG_MSG="Domain-0"
 export PASSED="BusyBox"
 
-./automation/scripts/qemu-key.exp
+./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-dom0-arm32.sh b/automation/scripts/qemu-smoke-dom0-arm32.sh
index bbdcb39f1a..fd64b19358 100755
--- a/automation/scripts/qemu-smoke-dom0-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm32.sh
@@ -96,4 +96,4 @@ export QEMU_LOG="${serial_log}"
 export LOG_MSG="Domain-0"
 export PASSED="/ #"
 
-../automation/scripts/qemu-key.exp
+../automation/scripts/qemu-key.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
index 0094bfc8e1..e0cea742b0 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -109,4 +109,4 @@ export QEMU_LOG="smoke.serial"
 export LOG_MSG="Domain-0"
 export PASSED="BusyBox"
 
-./automation/scripts/qemu-key.exp
+./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
index 68ffbabdb8..e824cb7c2a 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -149,4 +149,4 @@ export QEMU_LOG="${serial_log}"
 export LOG_MSG="${dom0_prompt}"
 export PASSED="${passed}"
 
-../automation/scripts/qemu-key.exp
+../automation/scripts/qemu-key.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index eb25c4af4b..f42ba5d196 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -220,4 +220,4 @@ export QEMU_LOG="smoke.serial"
 export LOG_MSG="Welcome to Alpine Linux"
 export PASSED="${passed}"
 
-./automation/scripts/qemu-key.exp
+./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-ppc64le.sh b/automation/scripts/qemu-smoke-ppc64le.sh
index ccb4a576f4..594f92c19c 100755
--- a/automation/scripts/qemu-smoke-ppc64le.sh
+++ b/automation/scripts/qemu-smoke-ppc64le.sh
@@ -25,4 +25,4 @@ export QEMU_CMD="qemu-system-ppc64 \
 export QEMU_LOG="${serial_log}"
 export PASSED="Hello, ppc64le!"
 
-./automation/scripts/qemu-key.exp
+./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-riscv64.sh b/automation/scripts/qemu-smoke-riscv64.sh
index 0355c075b7..c2595f657f 100755
--- a/automation/scripts/qemu-smoke-riscv64.sh
+++ b/automation/scripts/qemu-smoke-riscv64.sh
@@ -16,4 +16,4 @@ export QEMU_CMD="qemu-system-riscv64 \
 export QEMU_LOG="smoke.serial"
 export PASSED="All set up"
 
-./automation/scripts/qemu-key.exp
+./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-x86-64.sh b/automation/scripts/qemu-smoke-x86-64.sh
index 37ac10e068..3440b1761d 100755
--- a/automation/scripts/qemu-smoke-x86-64.sh
+++ b/automation/scripts/qemu-smoke-x86-64.sh
@@ -24,4 +24,4 @@ export QEMU_CMD="qemu-system-x86_64 -nographic -kernel binaries/xen \
 export QEMU_LOG="smoke.serial"
 export PASSED="Test result: SUCCESS"
 
-./automation/scripts/qemu-key.exp
+./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-xtf-dom0less-arm64.sh b/automation/scripts/qemu-xtf-dom0less-arm64.sh
index 0666f6363e..4042fe5060 100755
--- a/automation/scripts/qemu-xtf-dom0less-arm64.sh
+++ b/automation/scripts/qemu-xtf-dom0less-arm64.sh
@@ -65,4 +65,4 @@ export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x4000000
 export QEMU_LOG="smoke.serial"
 export PASSED="${passed}"
 
-./automation/scripts/qemu-key.exp
+./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 23 07:22:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Aug 2024 07:22:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782174.1191640 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shOcX-0000Bu-DZ; Fri, 23 Aug 2024 07:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782174.1191640; Fri, 23 Aug 2024 07:22: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 1shOcX-0000Bm-Av; Fri, 23 Aug 2024 07:22:05 +0000
Received: by outflank-mailman (input) for mailman id 782174;
 Fri, 23 Aug 2024 07:22:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shOcV-0000Bg-N8
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 07:22:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shOcV-0000bk-C0
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 07:22:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shOcV-00023l-AG
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 07:22: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UgSkL2F5V8AcEHmgrWsWMtVGteyz5afs4FN3MWyt5MU=; b=fp3EbT+RipanCgKaJfTq4RSiSc
	tZsXBHHE48hA1jUSiUfuWbtAAuDdwAFMEyGf3QUdsK2l3Lzr1sz7kY9VS8VmQvBOq1jXWKhC7mFuT
	H1KHLyD0X6CpL8E0DOupIxquM2H2SMt/mVn+qEuUAz3Gjix+j3OB0V5glIO6vuKhC4Mc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul: always set operand size for AVX-VNNI-INT8 insns
Message-Id: <E1shOcV-00023l-AG@xenbits.xenproject.org>
Date: Fri, 23 Aug 2024 07:22:03 +0000

commit d45687cca2450bfebe1dfbddb22f4f03c6fbc9cb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Aug 23 09:11:15 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 23 09:11:15 2024 +0200

    x86emul: always set operand size for AVX-VNNI-INT8 insns
    
    Unlike for AVX-VNNI-INT16 I failed to notice that op_bytes may still be
    zero when reaching the respective case block: With the ext0f38_table[]
    entries having simd_packed_int, the defaulting at the bottom of
    x86emul_decode() won't set the field to non-zero for F3- or F2-prefixed
    insns.
    
    Fixes: 842acaa743a5 ("x86emul: support AVX-VNNI-INT8")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 3c5f9ce309..eda691868d 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6075,6 +6075,7 @@ x86_emulate(
     case X86EMUL_OPC_VEX_F2(0x0f38, 0x51): /* vpdpbssds [xy]mm/mem,[xy]mm,[xy]mm */
         host_and_vcpu_must_have(avx_vnni_int8);
         generate_exception_if(vex.w, X86_EXC_UD);
+        op_bytes = 16 << vex.l;
         goto simd_0f_ymm;
 
     case X86EMUL_OPC_VEX_66(0x0f38, 0x50): /* vpdpbusd [xy]mm/mem,[xy]mm,[xy]mm */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 23 07:22:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Aug 2024 07:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782175.1191643 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shOch-0000Dp-Ew; Fri, 23 Aug 2024 07:22:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782175.1191643; Fri, 23 Aug 2024 07:22: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 1shOch-0000Di-CJ; Fri, 23 Aug 2024 07:22:15 +0000
Received: by outflank-mailman (input) for mailman id 782175;
 Fri, 23 Aug 2024 07:22:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shOcf-0000Da-Gu
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 07:22:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shOcf-0000by-FK
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 07:22:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shOcf-00024R-EN
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 07:22: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wlnlfhYG2gvNqktIra/dyC8w3ZRJXQQvXz1JEy72x2g=; b=cr00PP8+8I+eIbc05H2sfA9e67
	L/f3iv4fz1MVUFtbA/g2z/67rLKFfJuFs4VISGtco35jiwVZby3Z3ohPaaJUMakS9B5dWKMUJaAf9
	5MP+gxpbKB+yYn1xaKMY3YouoMp8tWEIskAB3pIZM2/K5WP7QtlQypLs7amdqdCku/II=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul: set (fake) operand size for AVX512CD broadcast insns
Message-Id: <E1shOcf-00024R-EN@xenbits.xenproject.org>
Date: Fri, 23 Aug 2024 07:22:13 +0000

commit 6fa6b7feaafd622db3a2f3436750cf07782f4c12
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Aug 23 09:12:24 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 23 09:12:24 2024 +0200

    x86emul: set (fake) operand size for AVX512CD broadcast insns
    
    Back at the time I failed to pay attention to op_bytes still being zero
    when reaching the respective case block: With the ext0f38_table[]
    entries having simd_packed_int, the defaulting at the bottom of
    x86emul_decode() won't set the field to non-zero for F3-prefixed insns.
    
    Fixes: 37ccca740c26 ("x86emul: support AVX512CD insns")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index eda691868d..0a7552de96 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -5929,6 +5929,7 @@ x86_emulate(
                                evex.w == ((b >> 4) & 1)),
                               X86_EXC_UD);
         d |= TwoOp;
+        op_bytes = 1; /* fake */
         /* fall through */
     case X86EMUL_OPC_EVEX_66(0x0f38, 0xc4): /* vpconflict{d,q} [xyz]mm/mem,[xyz]mm{k} */
         fault_suppression = false;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 23 07:22:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Aug 2024 07:22:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782176.1191648 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shOcr-0000Ga-GY; Fri, 23 Aug 2024 07:22:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782176.1191648; Fri, 23 Aug 2024 07:22: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 1shOcr-0000GR-Dm; Fri, 23 Aug 2024 07:22:25 +0000
Received: by outflank-mailman (input) for mailman id 782176;
 Fri, 23 Aug 2024 07:22:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shOcp-0000G9-Jq
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 07:22:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shOcp-0000cB-Ig
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 07:22:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shOcp-000258-Hi
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 07:22: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/37IJMA5jv4ZUpbmD2MMhsiYwX0IdsvK5rngfnDjJcc=; b=gis7iDltwkHU2nc5HbCiMTZMeZ
	rSVSJaRlXgTrIjLm/JGTwi/La23tLUmvVLWUMYaum0uDDjdS5yZ69kKSVQpS1wzMqtseIaKG/6Ve3
	ZhRA7dB0T0tCpTyZ/mDxVKNBrmcehliGkiVwIdy8zopk8C8vsETZUS35wmVK1tgEbWnU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul: convert op_bytes/opc checks in SIMD emulation
Message-Id: <E1shOcp-000258-Hi@xenbits.xenproject.org>
Date: Fri, 23 Aug 2024 07:22:23 +0000

commit 5231765a4e6528a3208e49885b9eeff42519a6c1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Aug 23 09:13:07 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 23 09:13:07 2024 +0200

    x86emul: convert op_bytes/opc checks in SIMD emulation
    
    Raising #UD for an internal shortcoming of the emulator isn't quite
    right. Similarly BUG() is bigger a hammer than needed.
    
    Switch to using EXPECT() instead. This way even for insns not covered by
    the test harness fuzzers will have a chance of noticing issues, should
    any still exist or new ones be introduced.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 0a7552de96..0a6d5a35b1 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -8116,13 +8116,13 @@ x86_emulate(
     }
     else if ( state->simd_size != simd_none )
     {
-        generate_exception_if(!op_bytes, X86_EXC_UD);
         generate_exception_if((vex.opcx && (d & TwoOp) &&
                                (vex.reg != 0xf || (evex_encoded() && !evex.RX))),
                               X86_EXC_UD);
 
-        if ( !opc )
-            BUG();
+        EXPECT(op_bytes);
+        EXPECT(opc);
+
         if ( evex_encoded() )
         {
             opc[insn_bytes - EVEX_PFX_BYTES] = 0xc3;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 23 08:22:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Aug 2024 08:22:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782192.1191662 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shPYa-0002Wr-04; Fri, 23 Aug 2024 08:22:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782192.1191662; Fri, 23 Aug 2024 08:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shPYZ-0002Wj-Tc; Fri, 23 Aug 2024 08:22:03 +0000
Received: by outflank-mailman (input) for mailman id 782192;
 Fri, 23 Aug 2024 08:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shPYY-0002Wc-JS
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 08:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shPYY-0002Gj-D4
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 08:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shPYY-00067V-Ba
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 08:22:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pqka5k2zoEKvhlz23l71dtneiYYfnM5SmE+8e9Aa8Yc=; b=tE1JW+m+fiY4lhPLnnqL5q3aX8
	hyEvJbn6Dlz8iaLQgT8DGhWP2p538SY1iMkfOjiACIeS/DuAe3IaqwwUnHhDEhB5AdhNi/oK3Pykw
	4FQE0L5Vw8NIx0bc6UgbDrlZJ682eSrj4VlW+J4iTYgzgPmzV/205vWy9iySxaHlsx1o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pv: Introduce x86_merge_dr6() and fix do_debug()
Message-Id: <E1shPYY-00067V-Ba@xenbits.xenproject.org>
Date: Fri, 23 Aug 2024 08:22:02 +0000

commit 54ef601a66e8d812a6a6a308f02524e81201825e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon May 28 15:20:18 2018 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Aug 21 23:59:19 2024 +0100

    x86/pv: Introduce x86_merge_dr6() and fix do_debug()
    
    Pretty much everywhere in Xen the logic to update %dr6 when injecting #DB is
    buggy.  Introduce a new x86_merge_dr6() helper, and start fixing the mess by
    adjusting the dr6 merge in do_debug().  Also correct the comment.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/debug.c                 | 40 ++++++++++++++++++++++++++++++++++++
 xen/arch/x86/include/asm/debugreg.h  |  7 +++++++
 xen/arch/x86/include/asm/x86-defns.h |  7 +++++++
 xen/arch/x86/traps.c                 | 11 +++++++---
 4 files changed, 62 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/debug.c b/xen/arch/x86/debug.c
index 127fe83021..b10f1f12b6 100644
--- a/xen/arch/x86/debug.c
+++ b/xen/arch/x86/debug.c
@@ -2,12 +2,52 @@
 /*
  * Copyright (C) 2023 XenServer.
  */
+#include <xen/bug.h>
 #include <xen/kernel.h>
 
 #include <xen/lib/x86/cpu-policy.h>
 
 #include <asm/debugreg.h>
 
+/*
+ * Merge new bits into dr6.  'new' is always given in positive polarity,
+ * matching the Intel VMCS PENDING_DBG semantics.
+ *
+ * At the time of writing (August 2024), on the subject of %dr6 updates the
+ * manuals are either vague (Intel "certain exceptions may clear bits 0-3"),
+ * or disputed (AMD makes statements which don't match observed behaviour).
+ *
+ * The only debug exception I can find which doesn't clear the breakpoint bits
+ * is ICEBP(/INT1) on AMD systems.  This is also the one source of #DB that
+ * doesn't have an explicit status bit, meaning we can't easily identify this
+ * case either (AMD systems don't virtualise PENDING_DBG and only provide a
+ * post-merge %dr6 value).
+ *
+ * Treat %dr6 merging as unconditionally writing the breakpoint bits.
+ *
+ * We can't really manage any better, and guest kernels handling #DB as
+ * instructed by the SDM/APM (i.e. reading %dr6 then resetting it back to
+ * default) wont notice.
+ */
+unsigned int x86_merge_dr6(const struct cpu_policy *p, unsigned int dr6,
+                           unsigned int new)
+{
+    /* Flip dr6 to have positive polarity. */
+    dr6 ^= X86_DR6_DEFAULT;
+
+    /* Sanity check that only known values are passed in. */
+    ASSERT(!(dr6 & ~X86_DR6_KNOWN_MASK));
+    ASSERT(!(new & ~X86_DR6_KNOWN_MASK));
+
+    /* Breakpoint bits overridden.  All others accumulate. */
+    dr6 = (dr6 & ~X86_DR6_BP_MASK) | new;
+
+    /* Flip dr6 back to having default polarity. */
+    dr6 ^= X86_DR6_DEFAULT;
+
+    return x86_adj_dr6_rsvd(p, dr6);
+}
+
 unsigned int x86_adj_dr6_rsvd(const struct cpu_policy *p, unsigned int dr6)
 {
     unsigned int ones = X86_DR6_DEFAULT;
diff --git a/xen/arch/x86/include/asm/debugreg.h b/xen/arch/x86/include/asm/debugreg.h
index 96c406ad53..6baa725441 100644
--- a/xen/arch/x86/include/asm/debugreg.h
+++ b/xen/arch/x86/include/asm/debugreg.h
@@ -108,4 +108,11 @@ struct cpu_policy;
 unsigned int x86_adj_dr6_rsvd(const struct cpu_policy *p, unsigned int dr6);
 unsigned int x86_adj_dr7_rsvd(const struct cpu_policy *p, unsigned int dr7);
 
+/*
+ * Merge new bits into dr6.  'new' is always given in positive polarity,
+ * matching the Intel VMCS PENDING_DBG semantics.
+ */
+unsigned int x86_merge_dr6(const struct cpu_policy *p, unsigned int dr6,
+                           unsigned int new);
+
 #endif /* _X86_DEBUGREG_H */
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index 3bcdbaccd3..caa92829ea 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -132,6 +132,13 @@
 #define X86_DR6_ZEROS           _AC(0x00001000, UL)  /* %dr6 bits forced to 0       */
 #define X86_DR6_DEFAULT         _AC(0xffff0ff0, UL)  /* Default %dr6 value          */
 
+#define X86_DR6_BP_MASK                                 \
+    (X86_DR6_B0 | X86_DR6_B1 | X86_DR6_B2 | X86_DR6_B3)
+
+#define X86_DR6_KNOWN_MASK                                              \
+    (X86_DR6_BP_MASK | X86_DR6_BLD | X86_DR6_BD | X86_DR6_BS |          \
+     X86_DR6_BT | X86_DR6_RTM)
+
 /*
  * Debug control flags in DR7.
  */
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 552a07e6aa..feef6faa50 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2016,9 +2016,14 @@ void asmlinkage do_debug(struct cpu_user_regs *regs)
         return;
     }
 
-    /* Save debug status register where guest OS can peek at it */
-    v->arch.dr6 |= (dr6 & ~X86_DR6_DEFAULT);
-    v->arch.dr6 &= (dr6 | ~X86_DR6_DEFAULT);
+    /*
+     * Update the guest's dr6 so the debugger can peek at it.
+     *
+     * TODO: This should be passed out-of-band, so guest state is not modified
+     * by debugging actions completed behind it's back.
+     */
+    v->arch.dr6 = x86_merge_dr6(v->domain->arch.cpu_policy,
+                                v->arch.dr6, dr6 ^ X86_DR6_DEFAULT);
 
     if ( guest_kernel_mode(v, regs) && v->domain->debugger_attached )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 23 08:22:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Aug 2024 08:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782193.1191667 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shPYj-0002YR-2M; Fri, 23 Aug 2024 08:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782193.1191667; Fri, 23 Aug 2024 08:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shPYi-0002YJ-V6; Fri, 23 Aug 2024 08:22:12 +0000
Received: by outflank-mailman (input) for mailman id 782193;
 Fri, 23 Aug 2024 08:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shPYi-0002YD-I5
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 08:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shPYi-0002Go-Gq
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 08:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shPYi-00068G-FX
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 08:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=358Q7UFKDIUvRIWg8PabopxfLcJpNvAAml6Gw7WHef0=; b=Vh4bJ43/Wktq7E5W3Sx8VTjHJa
	LImGPDFZcmM4p3bFxNCDylQO/VgFe4JQuNfJqYLxTXRKfis7hIUg1Qc/kjKd/Qmbb6EQgiVTDLExy
	hBzLE5mWGtDs6RF51LAo9To1Uk5GDIKSnBfrWduy2dGD8R2Dgc/m9aN386bJQ1f4uWHw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pv: Fix merging of new status bits into %dr6
Message-Id: <E1shPYi-00068G-FX@xenbits.xenproject.org>
Date: Fri, 23 Aug 2024 08:22:12 +0000

commit db39fa4b27ea470902d4625567cb6fa24030ddfa
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu May 24 12:39:00 2018 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Aug 21 23:59:19 2024 +0100

    x86/pv: Fix merging of new status bits into %dr6
    
    All #DB exceptions result in an update of %dr6, but this isn't captured in
    Xen's handling, and is buggy just about everywhere.
    
    To begin resolving this issue, add a new pending_dbg field to x86_event
    (unioned with cr2 to avoid taking any extra space, adjusting users to avoid
    old-GCC bugs with anonymous unions), and introduce pv_inject_DB() to replace
    the current callers using pv_inject_hw_exception().
    
    Push the adjustment of v->arch.dr6 into pv_inject_event(), and use the new
    x86_merge_dr6() rather than the current incorrect logic.
    
    A key property is that pending_dbg is taken with positive polarity to deal
    with RTM/BLD sensibly.  Most callers pass in a constant, but callers passing
    in a hardware %dr6 value need to XOR the value with X86_DR6_DEFAULT to flip to
    positive polarity.
    
    This fixes the behaviour of the breakpoint status bits; that any left pending
    are generally discarded when a new #DB is raised.  In principle it would fix
    RTM/BLD too, except PV guests can't turn these capabilities on to start with.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/domain.h      | 18 ++++++++++++++++--
 xen/arch/x86/include/asm/hvm/hvm.h     |  3 ++-
 xen/arch/x86/pv/emul-priv-op.c         |  5 +----
 xen/arch/x86/pv/emulate.c              |  9 +++++++--
 xen/arch/x86/pv/ro-page-fault.c        |  2 +-
 xen/arch/x86/pv/traps.c                | 16 ++++++++++++----
 xen/arch/x86/traps.c                   |  2 +-
 xen/arch/x86/x86_emulate/x86_emulate.h |  5 ++++-
 8 files changed, 44 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index bca3258d69..811251852f 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -731,15 +731,29 @@ static inline void pv_inject_hw_exception(unsigned int vector, int errcode)
     pv_inject_event(&event);
 }
 
+static inline void pv_inject_DB(unsigned long pending_dbg)
+{
+    struct x86_event event = {
+        .vector      = X86_EXC_DB,
+        .type        = X86_EVENTTYPE_HW_EXCEPTION,
+        .error_code  = X86_EVENT_NO_EC,
+    };
+
+    event.pending_dbg = pending_dbg;
+
+    pv_inject_event(&event);
+}
+
 static inline void pv_inject_page_fault(int errcode, unsigned long cr2)
 {
-    const struct x86_event event = {
+    struct x86_event event = {
         .vector = X86_EXC_PF,
         .type = X86_EVENTTYPE_HW_EXCEPTION,
         .error_code = errcode,
-        .cr2 = cr2,
     };
 
+    event.cr2 = cr2;
+
     pv_inject_event(&event);
 }
 
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index 518ba5319b..d5aaa5b710 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -535,9 +535,10 @@ static inline void hvm_inject_page_fault(int errcode, unsigned long cr2)
         .vector = X86_EXC_PF,
         .type = X86_EVENTTYPE_HW_EXCEPTION,
         .error_code = errcode,
-        .cr2 = cr2,
     };
 
+    event.cr2 = cr2;
+
     hvm_inject_event(&event);
 }
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index aa11ecadaa..15c83b9d23 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -1366,10 +1366,7 @@ int pv_emulate_privileged_op(struct cpu_user_regs *regs)
             ctxt.bpmatch |= DR_STEP;
 
         if ( ctxt.bpmatch )
-        {
-            curr->arch.dr6 |= ctxt.bpmatch | DR_STATUS_RESERVED_ONE;
-            pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
-        }
+            pv_inject_DB(ctxt.bpmatch);
 
         /* fall through */
     case X86EMUL_RETRY:
diff --git a/xen/arch/x86/pv/emulate.c b/xen/arch/x86/pv/emulate.c
index e7a1c0a2cc..8c44dea123 100644
--- a/xen/arch/x86/pv/emulate.c
+++ b/xen/arch/x86/pv/emulate.c
@@ -71,10 +71,15 @@ void pv_emul_instruction_done(struct cpu_user_regs *regs, unsigned long rip)
 {
     regs->rip = rip;
     regs->eflags &= ~X86_EFLAGS_RF;
+
     if ( regs->eflags & X86_EFLAGS_TF )
     {
-        current->arch.dr6 |= DR_STEP | DR_STATUS_RESERVED_ONE;
-        pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
+        /*
+         * TODO: this should generally use TF from the start of the
+         * instruction.  It's only a latent bug for now, as this path isn't
+         * used for any instruction which modifies eflags.
+         */
+        pv_inject_DB(X86_DR6_BS);
     }
 }
 
diff --git a/xen/arch/x86/pv/ro-page-fault.c b/xen/arch/x86/pv/ro-page-fault.c
index cad28ef928..d0fe07e3a1 100644
--- a/xen/arch/x86/pv/ro-page-fault.c
+++ b/xen/arch/x86/pv/ro-page-fault.c
@@ -390,7 +390,7 @@ int pv_ro_page_fault(unsigned long addr, struct cpu_user_regs *regs)
         /* Fallthrough */
     case X86EMUL_OKAY:
         if ( ctxt.retire.singlestep )
-            pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
+            pv_inject_DB(X86_DR6_BS);
 
         /* Fallthrough */
     case X86EMUL_RETRY:
diff --git a/xen/arch/x86/pv/traps.c b/xen/arch/x86/pv/traps.c
index 83e84e2762..5a7341abf0 100644
--- a/xen/arch/x86/pv/traps.c
+++ b/xen/arch/x86/pv/traps.c
@@ -12,6 +12,7 @@
 #include <xen/lib.h>
 #include <xen/softirq.h>
 
+#include <asm/debugreg.h>
 #include <asm/pv/trace.h>
 #include <asm/shared.h>
 #include <asm/traps.h>
@@ -50,9 +51,9 @@ void pv_inject_event(const struct x86_event *event)
     tb->cs    = ti->cs;
     tb->eip   = ti->address;
 
-    if ( event->type == X86_EVENTTYPE_HW_EXCEPTION &&
-         vector == X86_EXC_PF )
+    switch ( vector | -(event->type == X86_EVENTTYPE_SW_INTERRUPT) )
     {
+    case X86_EXC_PF:
         curr->arch.pv.ctrlreg[2] = event->cr2;
         arch_set_cr2(curr, event->cr2);
 
@@ -62,9 +63,16 @@ void pv_inject_event(const struct x86_event *event)
             error_code |= PFEC_user_mode;
 
         trace_pv_page_fault(event->cr2, error_code);
-    }
-    else
+        break;
+
+    case X86_EXC_DB:
+        curr->arch.dr6 = x86_merge_dr6(curr->domain->arch.cpu_policy,
+                                       curr->arch.dr6, event->pending_dbg);
+        fallthrough;
+    default:
         trace_pv_trap(vector, regs->rip, use_error_code, error_code);
+        break;
+    }
 
     if ( use_error_code )
     {
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index feef6faa50..b796c2f7df 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2031,7 +2031,7 @@ void asmlinkage do_debug(struct cpu_user_regs *regs)
         return;
     }
 
-    pv_inject_hw_exception(X86_EXC_DB, X86_EVENT_NO_EC);
+    pv_inject_DB(0 /* N/A, already merged */);
 }
 
 void asmlinkage do_entry_CP(struct cpu_user_regs *regs)
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.h b/xen/arch/x86/x86_emulate/x86_emulate.h
index d92be69d84..e8a0e57228 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.h
+++ b/xen/arch/x86/x86_emulate/x86_emulate.h
@@ -78,7 +78,10 @@ struct x86_event {
     uint8_t       type;         /* X86_EVENTTYPE_* */
     uint8_t       insn_len;     /* Instruction length */
     int32_t       error_code;   /* X86_EVENT_NO_EC if n/a */
-    unsigned long cr2;          /* Only for X86_EXC_PF h/w exception */
+    union {
+        unsigned long cr2;         /* #PF */
+        unsigned long pending_dbg; /* #DB (new DR6 bits, positive polarity) */
+    };
 };
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 23 08:22:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Aug 2024 08:22:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782194.1191669 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shPYu-0002bg-4E; Fri, 23 Aug 2024 08:22:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782194.1191669; Fri, 23 Aug 2024 08:22:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shPYu-0002ba-1f; Fri, 23 Aug 2024 08:22:24 +0000
Received: by outflank-mailman (input) for mailman id 782194;
 Fri, 23 Aug 2024 08:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shPYs-0002bH-MW
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 08:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shPYs-0002H5-L2
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 08:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shPYs-00068x-J8
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 08:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Cz6Pzmh0DUPUw/eKsI2o+5cFSvLPqDppt5utoPsookY=; b=J5+OIaV9k8c3p8LbbRMOpakutf
	t5nl2cXz8LVL4fNErCJQ8p0o6q1/K2zhAYRS8CRKHjdHixnEBSRzuh2wcSB8Hm1gncVNWUKVucv18
	PW5MJ/Qu3bsh6gb9qlGf7AsPrYbetvLYW0C17fCCe34dmmoRfpSPPSjvAHEtAi+GoC0k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pv: Address Coverity complaint in check_guest_io_breakpoint()
Message-Id: <E1shPYs-00068x-J8@xenbits.xenproject.org>
Date: Fri, 23 Aug 2024 08:22:22 +0000

commit 6d41a9d8a12ff89adabdc286e63e9391a0481699
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Aug 15 13:18:08 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Aug 21 23:59:19 2024 +0100

    x86/pv: Address Coverity complaint in check_guest_io_breakpoint()
    
    Commit 08aacc392d86 ("x86/emul: Fix misaligned IO breakpoint behaviour in PV
    guests") caused a Coverity INTEGER_OVERFLOW complaint based on the reasoning
    that width could be 0.
    
    It can't, but digging into the code generation, GCC 8 and later (bisected on
    godbolt) choose to emit a CSWITCH lookup table, and because the range (bottom
    2 bits clear), it's a 16-entry lookup table.
    
    So Coverity is understandable, given that GCC did emit a (dead) logic path
    where width stayed 0.
    
    Rewrite the logic.  Introduce x86_bp_width() which compiles to a single basic
    block, which replaces the switch() statement.  Take the opportunity to also
    make start and width be loop-scope variables.
    
    No practical change, but it should compile better and placate Coverity.
    
    Fixes: 08aacc392d86 ("x86/emul: Fix misaligned IO breakpoint behaviour in PV guests")
    Coverity-ID: 1616152
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/debugreg.h | 25 +++++++++++++++++++++++++
 xen/arch/x86/pv/emul-priv-op.c      | 21 ++++++---------------
 2 files changed, 31 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/include/asm/debugreg.h b/xen/arch/x86/include/asm/debugreg.h
index 6baa725441..23aa592e40 100644
--- a/xen/arch/x86/include/asm/debugreg.h
+++ b/xen/arch/x86/include/asm/debugreg.h
@@ -115,4 +115,29 @@ unsigned int x86_adj_dr7_rsvd(const struct cpu_policy *p, unsigned int dr7);
 unsigned int x86_merge_dr6(const struct cpu_policy *p, unsigned int dr6,
                            unsigned int new);
 
+/*
+ * Calculate the width of a breakpoint from its dr7 encoding.
+ *
+ * The LEN encoding in dr7 is 2 bits wide per breakpoint and encoded as a X-1
+ * (0, 1 and 3) for widths of 1, 2 and 4 respectively in the 32bit days.
+ *
+ * In 64bit, the unused value (2) was given a meaning of width 8, which is
+ * great for efficiency but less great for nicely calculating the width.
+ */
+static inline unsigned int x86_bp_width(unsigned int dr7, unsigned int bp)
+{
+    unsigned int raw = (dr7 >> (DR_CONTROL_SHIFT +
+                                DR_CONTROL_SIZE * bp + 2)) & 3;
+
+    /*
+     * If the top bit is set (i.e. we've got an 4 or 8 byte wide breakpoint),
+     * flip the bottom to reverse their order, making them sorted properly.
+     * Then it's a simple shift to calculate the width.
+     */
+    if ( raw & 2 )
+        raw ^= 1;
+
+    return 1U << raw;
+}
+
 #endif /* _X86_DEBUGREG_H */
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index 15c83b9d23..b90f745c75 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -323,30 +323,21 @@ static unsigned int check_guest_io_breakpoint(struct vcpu *v,
                                               unsigned int port,
                                               unsigned int len)
 {
-    unsigned int width, i, match = 0;
-    unsigned long start;
+    unsigned int i, match = 0;
 
     if ( !v->arch.pv.dr7_emul || !(v->arch.pv.ctrlreg[4] & X86_CR4_DE) )
         return 0;
 
     for ( i = 0; i < 4; i++ )
     {
+        unsigned long start;
+        unsigned int width;
+
         if ( !(v->arch.pv.dr7_emul & (3 << (i * DR_ENABLE_SIZE))) )
             continue;
 
-        start = v->arch.dr[i];
-        width = 0;
-
-        switch ( (v->arch.dr7 >>
-                  (DR_CONTROL_SHIFT + i * DR_CONTROL_SIZE)) & 0xc )
-        {
-        case DR_LEN_1: width = 1; break;
-        case DR_LEN_2: width = 2; break;
-        case DR_LEN_4: width = 4; break;
-        case DR_LEN_8: width = 8; break;
-        }
-
-        start &= ~(width - 1UL);
+        width = x86_bp_width(v->arch.dr7, i);
+        start = v->arch.dr[i] & ~(width - 1UL);
 
         if ( (start < (port + len)) && ((start + width) > port) )
             match |= 1u << i;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 23 10:55:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Aug 2024 10:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782286.1191773 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shRwf-0006uy-M7; Fri, 23 Aug 2024 10:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782286.1191773; Fri, 23 Aug 2024 10:55: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 1shRwf-0006uq-JV; Fri, 23 Aug 2024 10:55:05 +0000
Received: by outflank-mailman (input) for mailman id 782286;
 Fri, 23 Aug 2024 10:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shRwe-0006ui-93
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 10:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shRwe-00058A-5N
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 10:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shRwe-0007W9-2t
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 10:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=U47wc01Yn1tkJFEDwSF1ZGq2nrIXcBbDWVGmallzuvM=; b=z8mQqoXY4WH51nAPPz80PLnOw5
	Q6I2nLbQdjoC6CdGAGQDA+UDcPaM5fOGN99Lj3NI0SrjNPlCZP2DzZE0cKzGNJMpqJGs8KmMhFRoi
	sge2M8EUQZjaOuFyNoEHAfhEIAGCQ9Os5rJ7xY0OicvVcLkiJ1l/XzRi1lKY3ldVxfb8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/ocaml: Remove '-cc $(CC)' from OCAMLOPTFLAGS
Message-Id: <E1shRwe-0007W9-2t@xenbits.xenproject.org>
Date: Fri, 23 Aug 2024 10:55:04 +0000

commit 0d69635d27cb1d011ccdf419b2bc85cc7809ac92
Author:     Andrii Sultanov <andrii.sultanov@cloud.com>
AuthorDate: Thu Aug 22 10:06:02 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 23 10:44:24 2024 +0100

    tools/ocaml: Remove '-cc $(CC)' from OCAMLOPTFLAGS
    
    This option does not work as one might expect, and needs to be the full
    compiler invocation including linking arguments to operate correctly.
    
    See https://github.com/ocaml/ocaml/issues/12284 for more details.
    
    Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/ocaml/common.make | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/common.make b/tools/ocaml/common.make
index 0c8a597d5b..cc126b749f 100644
--- a/tools/ocaml/common.make
+++ b/tools/ocaml/common.make
@@ -12,7 +12,7 @@ OCAMLFIND ?= ocamlfind
 CFLAGS += -fPIC -I$(shell ocamlc -where)
 
 OCAMLOPTFLAG_G := $(shell $(OCAMLOPT) -h 2>&1 | sed -n 's/^  *\(-g\) .*/\1/p')
-OCAMLOPTFLAGS = $(OCAMLOPTFLAG_G) -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -cc $(CC) -w F -warn-error F
+OCAMLOPTFLAGS = $(OCAMLOPTFLAG_G) -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -w F -warn-error F
 OCAMLCFLAGS += -g $(OCAMLINCLUDE) -w F -warn-error F
 
 VERSION := 4.1
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 23 10:55:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Aug 2024 10:55:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782287.1191778 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shRwp-0006wl-NV; Fri, 23 Aug 2024 10:55:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782287.1191778; Fri, 23 Aug 2024 10:55: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 1shRwp-0006we-Kx; Fri, 23 Aug 2024 10:55:15 +0000
Received: by outflank-mailman (input) for mailman id 782287;
 Fri, 23 Aug 2024 10:55:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shRwo-0006wW-9a
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 10:55:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shRwo-00058E-8n
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 10:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shRwo-0007X6-7P
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 10:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=30bavuQsaqtA9hKOzOqdZCtzicDeBjUhKWyMZElmXQw=; b=OhQOB8iYMOt4caUFfQwMvf+NyL
	4izxMbgQBETvmOt8korxXC+O+8eviubhTNqJzw1L4RzSKRvHuPSwXUYkhTKFqpKgpmP+ofAzp/Ia3
	kYhW0lbDj7P/5GiCNRa4DtroYU26aVXV6IJrF6GNnZp1qGi2ErAi963UDHOcm/y81qGU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/ocaml: Fix OCaml libs rules
Message-Id: <E1shRwo-0007X6-7P@xenbits.xenproject.org>
Date: Fri, 23 Aug 2024 10:55:14 +0000

commit 8ffcf184affbc2ff1860dabe1757388509d5ed67
Author:     Andrii Sultanov <andrii.sultanov@cloud.com>
AuthorDate: Thu Aug 22 10:06:05 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 23 10:48:52 2024 +0100

    tools/ocaml: Fix OCaml libs rules
    
    This has been sat in the XenServer patchqueue for more than a decade.
    
    Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/ocaml/Makefile.rules | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules
index 0d3c6ac839..5638193edf 100644
--- a/tools/ocaml/Makefile.rules
+++ b/tools/ocaml/Makefile.rules
@@ -61,18 +61,18 @@ mk-caml-lib-bytecode = $(call quiet-command, $(OCAMLC) $(OCAMLCFLAGS) -a -o $1 $
 
 mk-caml-stubs = $(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a` $2,MKLIB,$1)
 mk-caml-lib-stubs = \
-	$(call quiet-command, $(AR) rcs $1 $2 && $(OCAMLMKLIB) -o `basename $1 .a | sed -e 's/^lib//'` $2,MKLIB,$1)
+	$(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a | sed -e 's/^lib//'` $2 $3,MKLIB,$1)
 
 # define a library target <name>.cmxa and <name>.cma
 define OCAML_LIBRARY_template
  $(1).cmxa: lib$(1)_stubs.a $(foreach obj,$($(1)_OBJS),$(obj).cmx)
 	$(call mk-caml-lib-native,$$@, -cclib -l$(1)_stubs $(foreach lib,$(LIBS_$(1)),-cclib $(lib)), $(foreach obj,$($(1)_OBJS),$(obj).cmx))
  $(1).cma: $(foreach obj,$($(1)_OBJS),$(obj).cmo)
-	$(call mk-caml-lib-bytecode,$$@, -dllib dll$(1)_stubs.so -cclib -l$(1)_stubs, $$+)
+	$(call mk-caml-lib-bytecode,$$@, -dllib dll$(1)_stubs.so -cclib -l$(1)_stubs $(foreach lib,$(LIBS_$(1)),-cclib $(lib)), $$+)
  $(1)_stubs.a: $(foreach obj,$$($(1)_C_OBJS),$(obj).o)
 	$(call mk-caml-stubs,$$@, $$+)
  lib$(1)_stubs.a: $(foreach obj,$($(1)_C_OBJS),$(obj).o)
-	$(call mk-caml-lib-stubs,$$@, $$+)
+	$(call mk-caml-lib-stubs,$$@, $$+, $(foreach lib,$(LIBS_$(1)),$(lib)))
 endef
 
 define OCAML_NOC_LIBRARY_template
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 23 14:11:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Aug 2024 14:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782381.1191865 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shV0K-0002r2-Lu; Fri, 23 Aug 2024 14:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782381.1191865; Fri, 23 Aug 2024 14:11:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shV0K-0002qu-JG; Fri, 23 Aug 2024 14:11:04 +0000
Received: by outflank-mailman (input) for mailman id 782381;
 Fri, 23 Aug 2024 14:11:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shV0J-0002qo-H6
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 14:11:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shV0J-00009C-6Y
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 14:11:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shV0J-0003Iz-4p
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 14:11: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=N9A/JnFeBt14Zkne1pxIOodkCf0FUjxBaOdF+ytMIgY=; b=Mo5InUaY3I5Uz75MeUq55gU33v
	GytLuUlQMDkgpNYKcj8ov2KgP6QL4d6oFbLa5xVLxLChNdloExIDn5dISw9tX2AIvbJY+LuLt66QY
	ybpW4s8h0TXfemI4s+PjVm7J9qeZwJlpNu4rSsA7orjzXfWRvvKTtTxEFnkNT1knzxI8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/ocaml: Drop the OCAMLOPTFLAG_G invocation
Message-Id: <E1shV0J-0003Iz-4p@xenbits.xenproject.org>
Date: Fri, 23 Aug 2024 14:11:03 +0000

commit 126293eae6485089471ebdfd91fe944a0274e613
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 23 10:52:41 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 23 15:02:27 2024 +0100

    tools/ocaml: Drop the OCAMLOPTFLAG_G invocation
    
    These days, `ocamlopt -h` asks you whether you meant --help instead, meaning
    that the $(shell ) invocation here isn't going end up containing '-g'.
    
    Make it unconditional, like it is in OCAMLCFLAGS already.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Reviewed-by: Edwin Török <edwin.torok@cloud.com>
---
 tools/ocaml/common.make | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/ocaml/common.make b/tools/ocaml/common.make
index cc126b749f..708d74617c 100644
--- a/tools/ocaml/common.make
+++ b/tools/ocaml/common.make
@@ -11,8 +11,7 @@ OCAMLFIND ?= ocamlfind
 
 CFLAGS += -fPIC -I$(shell ocamlc -where)
 
-OCAMLOPTFLAG_G := $(shell $(OCAMLOPT) -h 2>&1 | sed -n 's/^  *\(-g\) .*/\1/p')
-OCAMLOPTFLAGS = $(OCAMLOPTFLAG_G) -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -w F -warn-error F
+OCAMLOPTFLAGS = -g -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -w F -warn-error F
 OCAMLCFLAGS += -g $(OCAMLINCLUDE) -w F -warn-error F
 
 VERSION := 4.1
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 23 14:11:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Aug 2024 14:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782382.1191868 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shV0U-0002sq-Nj; Fri, 23 Aug 2024 14:11:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782382.1191868; Fri, 23 Aug 2024 14:11:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shV0U-0002si-L2; Fri, 23 Aug 2024 14:11:14 +0000
Received: by outflank-mailman (input) for mailman id 782382;
 Fri, 23 Aug 2024 14:11:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shV0T-0002sc-BJ
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 14:11:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shV0T-00009G-AS
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 14:11:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shV0T-0003Jv-8a
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 14:11: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1F0m97yeuA8+E2blOSsjp+NG2dWr58yEIjQqUKQgDNM=; b=G/ggOQg3k1uVeDZQrPea9ahDYk
	diihzQFFfJxixbbg2teNdTJQ8q6fspI8g2yIhgFwgJGxBwlwImy+3sZ21uhA8necBuGut5AA2wBqZ
	Iib0hqz+qYuCheWSaUQz0NUE+OwRELrp/WEKL/iKZ2fNAwfZfp25i50FMYmXN3euGA24=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/ocaml: Drop the o= variable
Message-Id: <E1shV0T-0003Jv-8a@xenbits.xenproject.org>
Date: Fri, 23 Aug 2024 14:11:13 +0000

commit 5246924acf7913854e8422443e390b7ab6dab306
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 23 11:18:25 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 23 15:02:27 2024 +0100

    tools/ocaml: Drop the o= variable
    
    This hides a shell redirection which is quite rude.  It also opencodes
    $(move-if-changed) without the benefit of short-circuiting dependent logic
    when the content hasn't changed.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Reviewed-by: Edwin Török <edwin.torok@cloud.com>
---
 tools/ocaml/Makefile.rules | 5 +++--
 tools/ocaml/common.make    | 2 --
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules
index 5638193edf..5d534d8754 100644
--- a/tools/ocaml/Makefile.rules
+++ b/tools/ocaml/Makefile.rules
@@ -40,13 +40,14 @@ ALL_OCAML_OBJS ?= $(OBJS)
 	$(call quiet-command, $(CC) $(CFLAGS) -c -o $@ $<,CC,$@)
 
 META: META.in
-	sed 's/@VERSION@/$(VERSION)/g' < $< $o
+	sed 's/@VERSION@/$(VERSION)/g' < $< > $@.tmp
+	$(call move-if-changed,$@.tmp,$@)
 
 ALL_OCAML_OBJ_SOURCES=$(addsuffix .ml, $(ALL_OCAML_OBJS))
 
 ifneq ($(MAKECMDGOALS),clean)
 .ocamldep.make: $(ALL_OCAML_OBJ_SOURCES) Makefile $(OCAML_TOPLEVEL)/Makefile.rules
-	$(call quiet-command, $(OCAMLDEP) $(ALL_OCAML_OBJ_SOURCES) *.mli $o,MLDEP,)
+	$(call quiet-command, $(OCAMLDEP) $(ALL_OCAML_OBJ_SOURCES) *.mli > $@.tmp; $(call move-if-changed,$@.tmp,$@),MLDEP,)
 endif
 
 clean: $(CLEAN_HOOKS)
diff --git a/tools/ocaml/common.make b/tools/ocaml/common.make
index 708d74617c..979cbe0845 100644
--- a/tools/ocaml/common.make
+++ b/tools/ocaml/common.make
@@ -17,5 +17,3 @@ OCAMLCFLAGS += -g $(OCAMLINCLUDE) -w F -warn-error F
 VERSION := 4.1
 
 OCAMLDESTDIR ?= $(DESTDIR)$(shell $(OCAMLFIND) printconf destdir)
-
-o= >$@.new && mv -f $@.new $@
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 23 14:11:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Aug 2024 14:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782383.1191872 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shV0e-0002vX-P5; Fri, 23 Aug 2024 14:11:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782383.1191872; Fri, 23 Aug 2024 14:11:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shV0e-0002vP-MT; Fri, 23 Aug 2024 14:11:24 +0000
Received: by outflank-mailman (input) for mailman id 782383;
 Fri, 23 Aug 2024 14:11:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shV0d-0002v5-EL
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 14:11:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shV0d-00009S-DY
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 14:11:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shV0d-0003Kn-Cb
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 14:11: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=O57og3qW1A30HMyqgmb3qBwRAen/2asBFJ+Nlt3nXAw=; b=NGUU8/aJ01yqDqZ2UZiYBMZNy9
	B614IXaGcNUYQJmGFw7zEii8WDzzWv7lxkP+HvMEaNSXqVIztfEjONE16HcY9JbvWxmunoKK9onlt
	pOASs4ihXalBYfFE4T/hDP2mE7LJpTOgHgZI8WZ5ZS7CVyQJfYYGAoZfxtx93GklnD6s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/ocaml: Fix the version embedded in META files
Message-Id: <E1shV0d-0003Kn-Cb@xenbits.xenproject.org>
Date: Fri, 23 Aug 2024 14:11:23 +0000

commit 1965e9a930740b37637ac450f4752fd53edf63c4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 23 11:37:35 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 23 15:02:27 2024 +0100

    tools/ocaml: Fix the version embedded in META files
    
    Xen 4.1 is more than a decade stale now.  Use the same mechanism as elsewhere
    in the tree to get the current version number.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Reviewed-by: Edwin Török <edwin.torok@cloud.com>
---
 tools/ocaml/common.make | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/common.make b/tools/ocaml/common.make
index 979cbe0845..c7eefceeb4 100644
--- a/tools/ocaml/common.make
+++ b/tools/ocaml/common.make
@@ -14,6 +14,6 @@ CFLAGS += -fPIC -I$(shell ocamlc -where)
 OCAMLOPTFLAGS = -g -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -w F -warn-error F
 OCAMLCFLAGS += -g $(OCAMLINCLUDE) -w F -warn-error F
 
-VERSION := 4.1
+VERSION := $(shell $(XEN_ROOT)/version.sh $(XEN_ROOT)/xen/Makefile)
 
 OCAMLDESTDIR ?= $(DESTDIR)$(shell $(OCAMLFIND) printconf destdir)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 23 18:44:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Aug 2024 18:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782584.1192086 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shZGX-0001um-Bz; Fri, 23 Aug 2024 18:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782584.1192086; Fri, 23 Aug 2024 18:44: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 1shZGX-0001ue-9N; Fri, 23 Aug 2024 18:44:05 +0000
Received: by outflank-mailman (input) for mailman id 782584;
 Fri, 23 Aug 2024 18:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shZGW-0001uI-BQ
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 18:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shZGW-0005kM-53
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 18:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shZGW-00027I-2f
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 18:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=51V70dulrxdwcsfa1/tU4auHpfbiNAWOQ06NYsM88MY=; b=qt6PUpn+iLhH8bA0sOqwIM7JJ1
	UsY7gPLnLWZV9paTlRTK4rTtRm5Q4xqOEAtlnTYSq1PuNR+PwicT7B7C3Qv/CG8VfeudKmS00hGja
	DOENmkZS86yaJtBf8gcrwTHD5HnDjX8Q0Xe/N/GnpW6wbHLaG+ogcuFDwf1iw05z2YUU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xen-ucode: Refactor to use getopt for cmdline handling
Message-Id: <E1shZGW-00027I-2f@xenbits.xenproject.org>
Date: Fri, 23 Aug 2024 18:44:04 +0000

commit e2c40d1e69543c6b4807b9d127f3fc6f8bae9fd4
Author:     Fouad Hilly <fouad.hilly@cloud.com>
AuthorDate: Thu Aug 22 14:04:24 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 23 18:47:19 2024 +0100

    tools/xen-ucode: Refactor to use getopt for cmdline handling
    
    Use getopt_long() to handle command line arguments.
    Introduce ext_err for common errors exit.
    
    Signed-off-by: Fouad Hilly <fouad.hilly@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/misc/xen-ucode.c | 56 ++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 48 insertions(+), 8 deletions(-)

diff --git a/tools/misc/xen-ucode.c b/tools/misc/xen-ucode.c
index 390969db3d..e4a846c8dc 100644
--- a/tools/misc/xen-ucode.c
+++ b/tools/misc/xen-ucode.c
@@ -11,6 +11,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <xenctrl.h>
+#include <getopt.h>
 
 static xc_interface *xch;
 
@@ -71,12 +72,31 @@ static void show_curr_cpu(FILE *f)
     }
 }
 
+static void usage(FILE *stream, const char *name)
+{
+    fprintf(stream,
+            "%s: Xen microcode updating tool\n"
+            "Usage: %s [options] [<microcode file> | show-cpu-info]\n"
+            "options:\n"
+            "  -h, --help               display this help\n"
+            "  -s, --show-cpu-info      show CPU information\n",
+            name, name);
+    show_curr_cpu(stream);
+}
+
 int main(int argc, char *argv[])
 {
+    static const struct option options[] = {
+        { "help",          no_argument, NULL, 'h' },
+        { "show-cpu-info", no_argument, NULL, 's' },
+        {}
+    };
+
     int fd, ret;
     char *filename, *buf;
     size_t len;
     struct stat st;
+    int opt;
 
     xch = xc_interface_open(NULL, NULL, 0);
     if ( xch == NULL )
@@ -86,22 +106,38 @@ int main(int argc, char *argv[])
         exit(1);
     }
 
-    if ( argc < 2 )
+    while ( (opt = getopt_long(argc, argv, "hs", options, NULL)) != -1 )
     {
-        fprintf(stderr,
-                "xen-ucode: Xen microcode updating tool\n"
-                "Usage: %s [<microcode file> | show-cpu-info]\n", argv[0]);
-        show_curr_cpu(stderr);
-        exit(2);
+        switch ( opt )
+        {
+        case 'h':
+            usage(stdout, argv[0]);
+            exit(EXIT_SUCCESS);
+
+        case 's':
+            show_curr_cpu(stdout);
+            exit(EXIT_SUCCESS);
+
+        default:
+            fprintf(stderr, "%s: unknown option\n", argv[0]);
+            goto ext_err;
+        }
     }
 
-    if ( !strcmp(argv[1], "show-cpu-info") )
+    if ( optind == argc )
+    {
+        fprintf(stderr, "%s: missing microcode file\n", argv[0]);
+        goto ext_err;
+    }
+
+    /* For backwards compatibility to the pre-getopt() cmdline handling */
+    if ( !strcmp(argv[optind], "show-cpu-info") )
     {
         show_curr_cpu(stdout);
         return 0;
     }
 
-    filename = argv[1];
+    filename = argv[optind];
     fd = open(filename, O_RDONLY);
     if ( fd < 0 )
     {
@@ -146,4 +182,8 @@ int main(int argc, char *argv[])
     close(fd);
 
     return 0;
+
+ ext_err:
+    usage(stderr, argv[0]);
+    exit(EXIT_FAILURE);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 23 18:44:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Aug 2024 18:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782585.1192091 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shZGh-0001xt-E6; Fri, 23 Aug 2024 18:44:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782585.1192091; Fri, 23 Aug 2024 18:44: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 1shZGh-0001xm-An; Fri, 23 Aug 2024 18:44:15 +0000
Received: by outflank-mailman (input) for mailman id 782585;
 Fri, 23 Aug 2024 18:44:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shZGg-0001xN-9r
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 18:44:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shZGg-0005kQ-8w
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 18:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shZGg-00028a-7K
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 18:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aTebNa9Rlu0gieKVPoOw55vGzpIUsp3e5NSzieCLmuI=; b=MFSBL4PErdiPFul7kgH82bTKfT
	s3e/0pnpWb3GxLoG65X4rV8aUoqr86qgFYplcUYDyH188Yu8XgoMaCFB9Ty7vzfzt3G+2nZu+6xOp
	hgEwbzzUjoJ4ScUZ+a4rMngH6G1s4591UEJv5NXRG/y4papInzTWjb381Vk0y2gy5/+8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xen-ucode: Introduce a --force option to xen-ucode
Message-Id: <E1shZGg-00028a-7K@xenbits.xenproject.org>
Date: Fri, 23 Aug 2024 18:44:14 +0000

commit 9db5e896ec91d6318c91d1d66eb8bd7fc57c6389
Author:     Fouad Hilly <fouad.hilly@cloud.com>
AuthorDate: Thu Aug 22 14:04:25 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 23 18:50:00 2024 +0100

    tools/xen-ucode: Introduce a --force option to xen-ucode
    
    Introduce a --force option to xen-ucode, in order to bypass certain checks
    when applying microcode.
    
    Update libxc's xc_microcode_update() to take an extra parameter, and to use
    the new XENPF_microcode_update2 hypercall instead.
    
    Signed-off-by: Fouad Hilly <fouad.hilly@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/include/xenctrl.h   |  3 ++-
 tools/libs/ctrl/xc_misc.c | 12 +++++++-----
 tools/misc/xen-ucode.c    | 17 ++++++++++++++---
 3 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 9ceca0cffc..2c4608c09a 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -1171,7 +1171,8 @@ typedef uint32_t xc_node_to_node_dist_t;
 int xc_physinfo(xc_interface *xch, xc_physinfo_t *info);
 int xc_cputopoinfo(xc_interface *xch, unsigned *max_cpus,
                    xc_cputopo_t *cputopo);
-int xc_microcode_update(xc_interface *xch, const void *buf, size_t len);
+int xc_microcode_update(xc_interface *xch, const void *buf,
+                        size_t len, unsigned int flags);
 int xc_get_cpu_version(xc_interface *xch, struct xenpf_pcpu_version *cpu_ver);
 int xc_get_ucode_revision(xc_interface *xch,
                           struct xenpf_ucode_revision *ucode_rev);
diff --git a/tools/libs/ctrl/xc_misc.c b/tools/libs/ctrl/xc_misc.c
index 50282fd60d..6a60216bda 100644
--- a/tools/libs/ctrl/xc_misc.c
+++ b/tools/libs/ctrl/xc_misc.c
@@ -203,11 +203,12 @@ int xc_physinfo(xc_interface *xch,
     return 0;
 }
 
-int xc_microcode_update(xc_interface *xch, const void *buf, size_t len)
+int xc_microcode_update(xc_interface *xch, const void *buf,
+                        size_t len, unsigned int flags)
 {
     int ret;
     struct xen_platform_op platform_op = {};
-    DECLARE_HYPERCALL_BUFFER(struct xenpf_microcode_update, uc);
+    DECLARE_HYPERCALL_BUFFER(struct xenpf_microcode_update2, uc);
 
     uc = xc_hypercall_buffer_alloc(xch, uc, len);
     if ( uc == NULL )
@@ -215,9 +216,10 @@ int xc_microcode_update(xc_interface *xch, const void *buf, size_t len)
 
     memcpy(uc, buf, len);
 
-    platform_op.cmd = XENPF_microcode_update;
-    platform_op.u.microcode.length = len;
-    set_xen_guest_handle(platform_op.u.microcode.data, uc);
+    platform_op.cmd = XENPF_microcode_update2;
+    platform_op.u.microcode2.length = len;
+    platform_op.u.microcode2.flags = flags;
+    set_xen_guest_handle(platform_op.u.microcode2.data, uc);
 
     ret = do_platform_op(xch, &platform_op);
 
diff --git a/tools/misc/xen-ucode.c b/tools/misc/xen-ucode.c
index e4a846c8dc..1f4ca0f162 100644
--- a/tools/misc/xen-ucode.c
+++ b/tools/misc/xen-ucode.c
@@ -13,6 +13,8 @@
 #include <xenctrl.h>
 #include <getopt.h>
 
+#include <xen/platform.h>
+
 static xc_interface *xch;
 
 static const char intel_id[] = "GenuineIntel";
@@ -79,7 +81,10 @@ static void usage(FILE *stream, const char *name)
             "Usage: %s [options] [<microcode file> | show-cpu-info]\n"
             "options:\n"
             "  -h, --help               display this help\n"
-            "  -s, --show-cpu-info      show CPU information\n",
+            "  -s, --show-cpu-info      show CPU information\n"
+            "  -f, --force              skip certain checks when applying\n"
+            "                           microcode; do not use unless you know\n"
+            "                           exactly what you are doing\n",
             name, name);
     show_curr_cpu(stream);
 }
@@ -89,6 +94,7 @@ int main(int argc, char *argv[])
     static const struct option options[] = {
         { "help",          no_argument, NULL, 'h' },
         { "show-cpu-info", no_argument, NULL, 's' },
+        { "force",         no_argument, NULL, 'f' },
         {}
     };
 
@@ -97,6 +103,7 @@ int main(int argc, char *argv[])
     size_t len;
     struct stat st;
     int opt;
+    uint32_t ucode_flags = 0;
 
     xch = xc_interface_open(NULL, NULL, 0);
     if ( xch == NULL )
@@ -106,7 +113,7 @@ int main(int argc, char *argv[])
         exit(1);
     }
 
-    while ( (opt = getopt_long(argc, argv, "hs", options, NULL)) != -1 )
+    while ( (opt = getopt_long(argc, argv, "hsf", options, NULL)) != -1 )
     {
         switch ( opt )
         {
@@ -118,6 +125,10 @@ int main(int argc, char *argv[])
             show_curr_cpu(stdout);
             exit(EXIT_SUCCESS);
 
+        case 'f':
+            ucode_flags |= XENPF_UCODE_FORCE;
+            break;
+
         default:
             fprintf(stderr, "%s: unknown option\n", argv[0]);
             goto ext_err;
@@ -162,7 +173,7 @@ int main(int argc, char *argv[])
     }
 
     errno = 0;
-    ret = xc_microcode_update(xch, buf, len);
+    ret = xc_microcode_update(xch, buf, len, ucode_flags);
     if ( ret == -1 && errno == EEXIST )
         printf("Microcode already up to date\n");
     else if ( ret )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 23 20:55:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Aug 2024 20:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782678.1192184 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shbJK-00049W-0x; Fri, 23 Aug 2024 20:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782678.1192184; Fri, 23 Aug 2024 20:55: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 1shbJJ-00049P-Tz; Fri, 23 Aug 2024 20:55:05 +0000
Received: by outflank-mailman (input) for mailman id 782678;
 Fri, 23 Aug 2024 20:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shbJH-00049J-TW
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 20:55:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shbJH-0007y7-PX
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 20:55:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shbJH-0003Xh-OS
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 20:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=KC4nGIDkhJwRJJApDGRUfmDXhXc+4hxRLt0B2EprXyk=; b=UUrYitQO4zg5pnlkbq2efPD0O7
	6Tkk8qOJKy0gFjXdDfnRsO6YshEp1qcA/FxGSWaJB6q9ozrycckg9vnAPHVVHPi15/2YWmPvKVhCW
	k5ccBEdfgCfl1cXqHmw+9pk/DPo+fnr5mfO0oBv0TtAznArX3EsYEqLsoerO9ek29k9I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/bitops: Rename for_each_set_bit() to bitmap_for_each()
Message-Id: <E1shbJH-0003Xh-OS@xenbits.xenproject.org>
Date: Fri, 23 Aug 2024 20:55:03 +0000

commit fbad3859821f3ed534f2a237fd60bf70903a5c3a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jun 18 23:23:11 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 23 21:50:57 2024 +0100

    xen/bitops: Rename for_each_set_bit() to bitmap_for_each()
    
    The current implementation wants to take an in-memory bitmap.  However, all
    ARM callers and all-but-1 x86 callers spill a scalar to the stack in order to
    use the "generic arbitrary bitmap" helpers under the hood.
    
    This works, but is far from ideal.
    
    Rename the construct and move it into bitmap.h, because having an iterator for
    an arbitrary bitmap is a useful thing.
    
    This will allow us to re-implement for_each_set_bit() to be more appropriate
    for scalar values.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/gic-vgic.c          |  2 +-
 xen/arch/arm/vgic.c              |  6 +++---
 xen/arch/arm/vgic/vgic-mmio-v2.c |  2 +-
 xen/arch/arm/vgic/vgic-mmio.c    | 12 ++++++------
 xen/arch/x86/cpu-policy.c        |  8 ++++----
 xen/arch/x86/hvm/vmx/vmx.c       |  2 +-
 xen/arch/x86/xstate.c            |  4 ++--
 xen/include/xen/bitmap.h         | 12 ++++++++++++
 xen/include/xen/bitops.h         | 11 -----------
 9 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/xen/arch/arm/gic-vgic.c b/xen/arch/arm/gic-vgic.c
index b99e287224..9aa245a36d 100644
--- a/xen/arch/arm/gic-vgic.c
+++ b/xen/arch/arm/gic-vgic.c
@@ -111,7 +111,7 @@ static unsigned int gic_find_unused_lr(struct vcpu *v,
     {
         unsigned int used_lr;
 
-        for_each_set_bit(used_lr, lr_mask, nr_lrs)
+        bitmap_for_each ( used_lr, lr_mask, nr_lrs )
         {
             gic_hw_ops->read_lr(used_lr, &lr_val);
             if ( lr_val.virq == p->irq )
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index c04fc4f83f..3fe1d89c4d 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -429,7 +429,7 @@ void vgic_set_irqs_pending(struct vcpu *v, uint32_t r, unsigned int rank)
     /* LPIs will never be set pending via this function */
     ASSERT(!is_lpi(32 * rank + 31));
 
-    for_each_set_bit( i, &mask, 32 )
+    bitmap_for_each ( i, &mask, 32 )
     {
         unsigned int irq = i + 32 * rank;
 
@@ -483,7 +483,7 @@ bool vgic_to_sgi(struct vcpu *v, register_t sgir, enum gic_sgi_mode irqmode,
         perfc_incr(vgic_sgi_list);
         base = target->aff1 << 4;
         bitmap = target->list;
-        for_each_set_bit( i, &bitmap, sizeof(target->list) * 8 )
+        bitmap_for_each ( i, &bitmap, sizeof(target->list) * 8 )
         {
             vcpuid = base + i;
             if ( vcpuid >= d->max_vcpus || d->vcpu[vcpuid] == NULL ||
@@ -728,7 +728,7 @@ void vgic_check_inflight_irqs_pending(struct domain *d, struct vcpu *v,
     const unsigned long mask = r;
     unsigned int i;
 
-    for_each_set_bit( i, &mask, 32 )
+    bitmap_for_each ( i, &mask, 32 )
     {
         struct pending_irq *p;
         struct vcpu *v_target;
diff --git a/xen/arch/arm/vgic/vgic-mmio-v2.c b/xen/arch/arm/vgic/vgic-mmio-v2.c
index 2e507b10fe..670b335db2 100644
--- a/xen/arch/arm/vgic/vgic-mmio-v2.c
+++ b/xen/arch/arm/vgic/vgic-mmio-v2.c
@@ -108,7 +108,7 @@ static void vgic_mmio_write_sgir(struct vcpu *source_vcpu,
         return;
     }
 
-    for_each_set_bit( vcpu_id, &targets, 8 )
+    bitmap_for_each ( vcpu_id, &targets, 8 )
     {
         struct vcpu *vcpu = d->vcpu[vcpu_id];
         struct vgic_irq *irq = vgic_get_irq(d, vcpu, intid);
diff --git a/xen/arch/arm/vgic/vgic-mmio.c b/xen/arch/arm/vgic/vgic-mmio.c
index 5d935a7301..bd4caf7fc3 100644
--- a/xen/arch/arm/vgic/vgic-mmio.c
+++ b/xen/arch/arm/vgic/vgic-mmio.c
@@ -71,7 +71,7 @@ void vgic_mmio_write_senable(struct vcpu *vcpu,
     uint32_t intid = VGIC_ADDR_TO_INTID(addr, 1);
     unsigned int i;
 
-    for_each_set_bit( i, &val, len * 8 )
+    bitmap_for_each ( i, &val, len * 8 )
     {
         struct vgic_irq *irq = vgic_get_irq(vcpu->domain, vcpu, intid + i);
         unsigned long flags;
@@ -116,7 +116,7 @@ void vgic_mmio_write_cenable(struct vcpu *vcpu,
     uint32_t intid = VGIC_ADDR_TO_INTID(addr, 1);
     unsigned int i;
 
-    for_each_set_bit( i, &val, len * 8 )
+    bitmap_for_each ( i, &val, len * 8 )
     {
         struct vgic_irq *irq;
         unsigned long flags;
@@ -186,7 +186,7 @@ void vgic_mmio_write_spending(struct vcpu *vcpu,
     unsigned long flags;
     irq_desc_t *desc;
 
-    for_each_set_bit( i, &val, len * 8 )
+    bitmap_for_each ( i, &val, len * 8 )
     {
         struct vgic_irq *irq = vgic_get_irq(vcpu->domain, vcpu, intid + i);
 
@@ -234,7 +234,7 @@ void vgic_mmio_write_cpending(struct vcpu *vcpu,
     unsigned long flags;
     irq_desc_t *desc;
 
-    for_each_set_bit( i, &val, len * 8 )
+    bitmap_for_each ( i, &val, len * 8 )
     {
         struct vgic_irq *irq = vgic_get_irq(vcpu->domain, vcpu, intid + i);
 
@@ -328,7 +328,7 @@ void vgic_mmio_write_cactive(struct vcpu *vcpu,
     uint32_t intid = VGIC_ADDR_TO_INTID(addr, 1);
     unsigned int i;
 
-    for_each_set_bit( i, &val, len * 8 )
+    bitmap_for_each ( i, &val, len * 8 )
     {
         struct vgic_irq *irq = vgic_get_irq(vcpu->domain, vcpu, intid + i);
 
@@ -358,7 +358,7 @@ void vgic_mmio_write_sactive(struct vcpu *vcpu,
     uint32_t intid = VGIC_ADDR_TO_INTID(addr, 1);
     unsigned int i;
 
-    for_each_set_bit( i, &val, len * 8 )
+    bitmap_for_each ( i, &val, len * 8 )
     {
         struct vgic_irq *irq = vgic_get_irq(vcpu->domain, vcpu, intid + i);
 
diff --git a/xen/arch/x86/cpu-policy.c b/xen/arch/x86/cpu-policy.c
index 304dc20cfa..649ab6088f 100644
--- a/xen/arch/x86/cpu-policy.c
+++ b/xen/arch/x86/cpu-policy.c
@@ -157,7 +157,7 @@ static void zero_leaves(struct cpuid_leaf *l,
 
 static void sanitise_featureset(uint32_t *fs)
 {
-    /* for_each_set_bit() uses unsigned longs.  Extend with zeroes. */
+    /* bitmap_for_each() uses unsigned longs.  Extend with zeroes. */
     uint32_t disabled_features[
         ROUNDUP(FSCAPINTS, sizeof(unsigned long)/sizeof(uint32_t))] = {};
     unsigned int i;
@@ -174,8 +174,8 @@ static void sanitise_featureset(uint32_t *fs)
         disabled_features[i] = ~fs[i] & deep_features[i];
     }
 
-    for_each_set_bit(i, (void *)disabled_features,
-                     sizeof(disabled_features) * 8)
+    bitmap_for_each ( i, (void *)disabled_features,
+                      sizeof(disabled_features) * 8 )
     {
         const uint32_t *dfs = x86_cpu_policy_lookup_deep_deps(i);
         unsigned int j;
@@ -237,7 +237,7 @@ static void recalculate_xstate(struct cpu_policy *p)
     /* Subleafs 2+ */
     xstates &= ~XSTATE_FP_SSE;
     BUILD_BUG_ON(ARRAY_SIZE(p->xstate.comp) < 63);
-    for_each_set_bit ( i, &xstates, 63 )
+    bitmap_for_each ( i, &xstates, 63 )
     {
         /*
          * Pass through size (eax) and offset (ebx) directly.  Visbility of
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 2f7add834a..12f8a66458 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2327,7 +2327,7 @@ static void cf_check vmx_sync_pir_to_irr(struct vcpu *v)
     for ( group = 0; group < ARRAY_SIZE(pending_intr); group++ )
         pending_intr[group] = pi_get_pir(&v->arch.hvm.vmx.pi_desc, group);
 
-    for_each_set_bit(i, pending_intr, X86_NR_VECTORS)
+    bitmap_for_each ( i, pending_intr, X86_NR_VECTORS )
         vlapic_set_vector(i, &vlapic->regs->data[APIC_IRR]);
 }
 
diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 1e1abfc029..13fae41504 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -606,7 +606,7 @@ unsigned int xstate_uncompressed_size(uint64_t xcr0)
      * with respect their index.
      */
     xcr0 &= ~(X86_XCR0_SSE | X86_XCR0_X87);
-    for_each_set_bit ( i, &xcr0, 63 )
+    bitmap_for_each ( i, &xcr0, 63 )
     {
         const struct xstate_component *c = &raw_cpu_policy.xstate.comp[i];
         unsigned int s = c->offset + c->size;
@@ -634,7 +634,7 @@ unsigned int xstate_compressed_size(uint64_t xstates)
      * componenets require aligning to 64 first.
      */
     xstates &= ~(X86_XCR0_SSE | X86_XCR0_X87);
-    for_each_set_bit ( i, &xstates, 63 )
+    bitmap_for_each ( i, &xstates, 63 )
     {
         const struct xstate_component *c = &raw_cpu_policy.xstate.comp[i];
 
diff --git a/xen/include/xen/bitmap.h b/xen/include/xen/bitmap.h
index 6ee39aa35a..5d668053b0 100644
--- a/xen/include/xen/bitmap.h
+++ b/xen/include/xen/bitmap.h
@@ -274,6 +274,18 @@ static inline void bitmap_clear(unsigned long *map, unsigned int start,
 #undef bitmap_switch
 #undef bitmap_bytes
 
+/**
+ * bitmap_for_each - bitate over every set bit in a memory region
+ * @bit: The integer bitator
+ * @addr: The address to base the search on
+ * @size: The maximum size to search
+ */
+#define bitmap_for_each(bit, addr, size)                        \
+    for ( (bit) = find_first_bit(addr, size);                   \
+          (bit) < (size);                                       \
+          (bit) = find_next_bit(addr, size, (bit) + 1) )
+
+
 struct xenctl_bitmap;
 int xenctl_bitmap_to_bitmap(unsigned long *bitmap,
                             const struct xenctl_bitmap *xenctl_bitmap,
diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index 3d88d2f3f1..fbbab96c97 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -428,17 +428,6 @@ static inline __u32 ror32(__u32 word, unsigned int shift)
 #define __L16(x) (((x) & 0x0000ff00U) ? ( 8 + __L8( (x) >> 8))  : __L8( x))
 #define ilog2(x) (((x) & 0xffff0000U) ? (16 + __L16((x) >> 16)) : __L16(x))
 
-/**
- * for_each_set_bit - iterate over every set bit in a memory region
- * @bit: The integer iterator
- * @addr: The address to base the search on
- * @size: The maximum size to search
- */
-#define for_each_set_bit(bit, addr, size)               \
-    for ( (bit) = find_first_bit(addr, size);           \
-          (bit) < (size);                               \
-          (bit) = find_next_bit(addr, size, (bit) + 1) )
-
 #define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
 
 #endif /* XEN_BITOPS_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 23 20:55:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Aug 2024 20:55:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782679.1192187 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shbJT-0004C2-33; Fri, 23 Aug 2024 20:55:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782679.1192187; Fri, 23 Aug 2024 20:55: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 1shbJT-0004Bu-0S; Fri, 23 Aug 2024 20:55:15 +0000
Received: by outflank-mailman (input) for mailman id 782679;
 Fri, 23 Aug 2024 20:55:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shbJR-0004Bc-UI
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 20:55:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shbJR-0007yR-T0
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 20:55:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shbJR-0003YK-Rb
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 20:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8oyw9HYr/cP06A1YwN/z99Tk3/lvVHCQvp73KyViK/8=; b=I1K1q9YEx2SPpaLTEg24VtNWbc
	xomRFIqDpOlOeBssgbZN5P0JmYmcfQWVEN+VM8NueNrwymRe9EEvijam+1UT7EBGGAluovYjf+K4S
	QLmW85zik/DCCQQMlL23xVYnpgXkx0J99kdXFsGDLVVjxLyIJ/ARJdV2cM49Dn4+tqpg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/macros: Introduce BUILD_ERROR()
Message-Id: <E1shbJR-0003YK-Rb@xenbits.xenproject.org>
Date: Fri, 23 Aug 2024 20:55:13 +0000

commit 1b30ac12814cce506193fc39acce45b131fad8e8
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 19 15:46:47 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 23 21:50:57 2024 +0100

    xen/macros: Introduce BUILD_ERROR()
    
    ... and use it in self-tests.h.
    
    This is intended to replace constructs such as __bitop_bad_size().  It
    produces a better diagnostic, and is MISRA-friendly.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/macros.h     | 8 ++++++++
 xen/include/xen/self-tests.h | 4 ++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/xen/include/xen/macros.h b/xen/include/xen/macros.h
index ec89f4654f..44d723fd12 100644
--- a/xen/include/xen/macros.h
+++ b/xen/include/xen/macros.h
@@ -59,6 +59,14 @@
 #define BUILD_BUG_ON(cond) ((void)BUILD_BUG_ON_ZERO(cond))
 #endif
 
+/*
+ * Force a compilation error.  This is for code which, in the normal case,
+ * should be Dead Code Eliminated, but a failure to eliminate constitutes an
+ * error.  e.g. behind a __builtin_constant_p(), or an illegal case within a
+ * switch(sizeof(...)) construct.
+ */
+#define BUILD_ERROR(msg) asm ( ".error \"" msg "\"" )
+
 /* Hide a value from the optimiser. */
 #define HIDE(x)                                 \
     ({                                          \
diff --git a/xen/include/xen/self-tests.h b/xen/include/xen/self-tests.h
index 58484fe5a8..e9a8794893 100644
--- a/xen/include/xen/self-tests.h
+++ b/xen/include/xen/self-tests.h
@@ -22,9 +22,9 @@
         typeof((fn)(val)) real = (fn)(val);                             \
                                                                         \
         if ( !__builtin_constant_p(real) )                              \
-            asm ( ".error \"'" STR(fn(val)) "' not compile-time constant\"" ); \
+            BUILD_ERROR("'" STR(fn(val)) "' not compile-time constant"); \
         else if ( real != (res) )                                       \
-            asm ( ".error \"Compile time check '" STR(fn(val) == res) "' failed\"" ); \
+            BUILD_ERROR("Compile time check '" STR(fn(val) == res) "' failed"); \
     } while ( 0 )
 #else
 #define COMPILE_CHECK(fn, val, res)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 23 20:55:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Aug 2024 20:55:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782680.1192192 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shbJd-0004Ef-4e; Fri, 23 Aug 2024 20:55:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782680.1192192; Fri, 23 Aug 2024 20:55: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 1shbJd-0004EX-1u; Fri, 23 Aug 2024 20:55:25 +0000
Received: by outflank-mailman (input) for mailman id 782680;
 Fri, 23 Aug 2024 20:55:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shbJc-0004EL-3a
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 20:55:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shbJc-0007yc-28
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 20:55:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shbJb-0003Yx-V7
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 20:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GA5YC2EJY+g+CaUBDuyAVzIWoq4vNtdq3ry53AHrl7w=; b=3MRLs2ohHWlRW/NNIO6JQkoje9
	v0HmjA/UeOzrecYSqrZp9pmu24dyL/+z9GlzPcB5uIEVEqMgTl/TVTlRO6X5+63apx/Q4GVdUeMfz
	aGur5xOePu1W0r3RfbLWlmFBMRE4KvscBAIIdb7pfURoCN39lJS7ft9LkO18PPvdMS58=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/bitops: Introduce for_each_set_bit()
Message-Id: <E1shbJb-0003Yx-V7@xenbits.xenproject.org>
Date: Fri, 23 Aug 2024 20:55:23 +0000

commit ed26376f20bffc8b542e2434a2643a1d788012d5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 19 15:46:47 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 23 21:50:57 2024 +0100

    xen/bitops: Introduce for_each_set_bit()
    
    The prior version (renamed to bitmap_for_each()) was inefficeint when used
    over a scalar, but this is the more common usage even before accounting for
    the many opencoded forms.
    
    Introduce a new version which operates on scalars only and does so without
    spilling them to memory.  This in turn requires the addition of a type-generic
    form of ffs().
    
    Add testing for the new construct alongside the ffs/fls testing.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/bitops.c      | 29 +++++++++++++++++++++++++++++
 xen/include/xen/bitops.h | 24 ++++++++++++++++++++++++
 2 files changed, 53 insertions(+)

diff --git a/xen/common/bitops.c b/xen/common/bitops.c
index 94a8983af9..9e532f0d87 100644
--- a/xen/common/bitops.c
+++ b/xen/common/bitops.c
@@ -84,8 +84,37 @@ static void __init test_fls(void)
     CHECK(fls64, 0x8000000000000001ULL, 64);
 }
 
+static void __init test_for_each_set_bit(void)
+{
+    unsigned int  ui,  ui_res = 0;
+    unsigned long ul,  ul_res = 0;
+    uint64_t      ull, ull_res = 0;
+
+    ui = HIDE(0x80008001U);
+    for_each_set_bit ( i, ui )
+        ui_res |= 1U << i;
+
+    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);
+    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);
+    for_each_set_bit ( i, ull )
+        ull_res |= 1ULL << i;
+
+    if ( ull != ull_res )
+        panic("for_each_set_bit(uint64) expected %#"PRIx64", got %#"PRIx64"\n", ull, ull_res);
+}
+
 static void __init __constructor test_bitops(void)
 {
     test_ffs();
     test_fls();
+    test_for_each_set_bit();
 }
diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index fbbab96c97..1cd43e464d 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -236,6 +236,16 @@ static always_inline __pure unsigned int ffs64(uint64_t x)
         return !x || (uint32_t)x ? ffs(x) : ffs(x >> 32) + 32;
 }
 
+/*
+ * A type-generic ffs() which picks the appropriate ffs{,l,64}() based on it's
+ * argument.
+ */
+#define ffs_g(x)                                        \
+    (sizeof(x) <= sizeof(int)      ? ffs(x) :           \
+     sizeof(x) <= sizeof(long)     ? ffsl(x) :          \
+     sizeof(x) <= sizeof(uint64_t) ? ffs64(x) :         \
+     ({ BUILD_ERROR("ffs_g() Bad input type"); 0; }))
+
 static always_inline __pure unsigned int fls(unsigned int x)
 {
     if ( __builtin_constant_p(x) )
@@ -272,6 +282,20 @@ static always_inline __pure unsigned int fls64(uint64_t x)
     }
 }
 
+/*
+ * for_each_set_bit() - Iterate over all set bits in a scalar value.
+ *
+ * @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(iter, val)                     \
+    for ( typeof(val) __v = (val); __v; )               \
+        for ( unsigned int (iter);                      \
+              __v && ((iter) = ffs_g(__v) - 1, true);   \
+              __v &= __v - 1 )
+
 /* --------------------- Please tidy below here --------------------- */
 
 #ifndef find_next_bit
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 23 20:55:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Aug 2024 20:55:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782681.1192196 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shbJn-0004Hj-6D; Fri, 23 Aug 2024 20:55:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782681.1192196; Fri, 23 Aug 2024 20:55: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 1shbJn-0004Hb-3W; Fri, 23 Aug 2024 20:55:35 +0000
Received: by outflank-mailman (input) for mailman id 782681;
 Fri, 23 Aug 2024 20:55:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shbJm-0004HQ-5o
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 20:55:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shbJm-0007yk-4y
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 20:55:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shbJm-0003Zj-4A
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 20:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=aN8oDJ86kdnlmkJhpBDxq12a+sgkVu5ztd5rdR2JGKU=; b=pTruhxCJXVRtUc0FUWcNQvCHPI
	t6CgxTSADHGORPlG78VLhpfcgo2soRwjq5O8hEqOOFcY8LIbJeA8Jx16bhGutRx6qc589umoqXmux
	AucBjrqMUx4JfydGMh6hxW7XQIcPzMj+ra2OFI/psyvIEBZ4WFqkSsAyvijnzcHzE6iE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ARM/vgic: Use for_each_set_bit() in vgic_set_irqs_pending()
Message-Id: <E1shbJm-0003Zj-4A@xenbits.xenproject.org>
Date: Fri, 23 Aug 2024 20:55:34 +0000

commit 2387c460eb103a37f1772d82be91b67518522372
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 19 01:58:35 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 23 21:50:57 2024 +0100

    ARM/vgic: Use for_each_set_bit() in vgic_set_irqs_pending()
    
    ... which is better optimised for scalar values, rather than using the
    arbitrary-sized bitmap helpers.
    
    For ARM32:
    
      add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-16 (-16)
      Function                                     old     new   delta
      vgic_set_irqs_pending                        284     268     -16
    
    including removing calls to _find_{first,next}_bit_le(), and two stack-spilled
    words too.
    
    For ARM64:
    
      add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-40 (-40)
      Function                                     old     new   delta
      vgic_set_irqs_pending                        268     228     -40
    
    including removing three calls to find_next_bit().
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/vgic.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 3fe1d89c4d..905e5eeb66 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -421,15 +421,13 @@ void vgic_enable_irqs(struct vcpu *v, uint32_t r, unsigned int n)
 
 void vgic_set_irqs_pending(struct vcpu *v, uint32_t r, unsigned int rank)
 {
-    const unsigned long mask = r;
-    unsigned int i;
     /* The first rank is always per-vCPU */
     bool private = rank == 0;
 
     /* LPIs will never be set pending via this function */
     ASSERT(!is_lpi(32 * rank + 31));
 
-    bitmap_for_each ( i, &mask, 32 )
+    for_each_set_bit ( i, r )
     {
         unsigned int irq = i + 32 * rank;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 23 20:55:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 23 Aug 2024 20:55:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782682.1192200 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shbJx-0004KY-7n; Fri, 23 Aug 2024 20:55:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782682.1192200; Fri, 23 Aug 2024 20:55: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 1shbJx-0004KQ-57; Fri, 23 Aug 2024 20:55:45 +0000
Received: by outflank-mailman (input) for mailman id 782682;
 Fri, 23 Aug 2024 20:55:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shbJw-0004KA-8r
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 20:55:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shbJw-0007yu-82
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 20:55:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shbJw-0003am-76
 for xen-changelog@lists.xenproject.org; Fri, 23 Aug 2024 20:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=R3wA9Hc45JhL69yx9QNluol0/6BE2T3mDM2GbGWAbfc=; b=cw3SkSOXo194xxn4XcX16v9+6L
	VoN5q8KcjQs2hu+vmuZDT9eFdV0MtZtR6TmJGIrGbWMhQErOVuZanbh9cLBzA67mCQbU86Eee0OOH
	B3KtqXUQNyNAHS0ATPiXdxhEvx5vPbecGwbIGtWCdnqQz9VsQBEcL4TykAVbKv18lVSg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/xstate: Switch back to for_each_set_bit()
Message-Id: <E1shbJw-0003am-76@xenbits.xenproject.org>
Date: Fri, 23 Aug 2024 20:55:44 +0000

commit 20885a36ce114f235d9d38cfcf4952c72ecda051
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 19 20:39:54 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 23 21:50:57 2024 +0100

    x86/xstate: Switch back to for_each_set_bit()
    
    In all 3 examples, we're iterating over a scaler.  They have an upper bound of
    63 which is to exclude the top bit; the COMPRESSED bit.
    
    recalculate_xstate() calculates xstates directly and doesn't set the
    COMPRESSED bit.  Both xstate_{un,}compressed_size() take architectural
    register values, neither of which permit the COMPRESSED bit either.
    
    xstate_uncompressed_size() has an ASSERT() covering this properly; add a
    equivelent ASSERT() to xstate_compressed_size() too.
    
    This alone produces:
    
      add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-161 (-161)
      Function                                     old     new   delta
      compress_xsave_states                         66      58      -8
      xstate_uncompressed_size                     119      71     -48
      xstate_compressed_size                       124      76     -48
      recalculate_xstate                           347     290     -57
    
    where xstate_{un,}compressed_size() have practically halved in size despite
    being small before.
    
    The change in compress_xsave_states() is unexpected.  The function is almost
    entirely dead code, and within what remains there's a smaller stack frame.  I
    suspect it's leftovers that the optimiser couldn't fully discard.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu-policy.c |  4 ++--
 xen/arch/x86/xstate.c     | 10 ++++++----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/cpu-policy.c b/xen/arch/x86/cpu-policy.c
index 649ab6088f..888e7ac4d4 100644
--- a/xen/arch/x86/cpu-policy.c
+++ b/xen/arch/x86/cpu-policy.c
@@ -193,7 +193,7 @@ static void sanitise_featureset(uint32_t *fs)
 static void recalculate_xstate(struct cpu_policy *p)
 {
     uint64_t xstates = XSTATE_FP_SSE;
-    unsigned int i, ecx_mask = 0, Da1 = p->xstate.Da1;
+    unsigned int ecx_mask = 0, Da1 = p->xstate.Da1;
 
     /*
      * The Da1 leaf is the only piece of information preserved in the common
@@ -237,7 +237,7 @@ static void recalculate_xstate(struct cpu_policy *p)
     /* Subleafs 2+ */
     xstates &= ~XSTATE_FP_SSE;
     BUILD_BUG_ON(ARRAY_SIZE(p->xstate.comp) < 63);
-    bitmap_for_each ( i, &xstates, 63 )
+    for_each_set_bit ( i, xstates )
     {
         /*
          * Pass through size (eax) and offset (ebx) directly.  Visbility of
diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 13fae41504..57a0749f0d 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -589,7 +589,7 @@ static bool valid_xcr0(uint64_t xcr0)
 
 unsigned int xstate_uncompressed_size(uint64_t xcr0)
 {
-    unsigned int size = XSTATE_AREA_MIN_SIZE, i;
+    unsigned int size = XSTATE_AREA_MIN_SIZE;
 
     /* Non-XCR0 states don't exist in an uncompressed image. */
     ASSERT((xcr0 & ~X86_XCR0_STATES) == 0);
@@ -606,7 +606,7 @@ unsigned int xstate_uncompressed_size(uint64_t xcr0)
      * with respect their index.
      */
     xcr0 &= ~(X86_XCR0_SSE | X86_XCR0_X87);
-    bitmap_for_each ( i, &xcr0, 63 )
+    for_each_set_bit ( i, xcr0 )
     {
         const struct xstate_component *c = &raw_cpu_policy.xstate.comp[i];
         unsigned int s = c->offset + c->size;
@@ -621,7 +621,9 @@ unsigned int xstate_uncompressed_size(uint64_t xcr0)
 
 unsigned int xstate_compressed_size(uint64_t xstates)
 {
-    unsigned int i, size = XSTATE_AREA_MIN_SIZE;
+    unsigned int size = XSTATE_AREA_MIN_SIZE;
+
+    ASSERT((xstates & ~(X86_XCR0_STATES | X86_XSS_STATES)) == 0);
 
     if ( xstates == 0 )
         return 0;
@@ -634,7 +636,7 @@ unsigned int xstate_compressed_size(uint64_t xstates)
      * componenets require aligning to 64 first.
      */
     xstates &= ~(X86_XCR0_SSE | X86_XCR0_X87);
-    bitmap_for_each ( i, &xstates, 63 )
+    for_each_set_bit ( i, xstates )
     {
         const struct xstate_component *c = &raw_cpu_policy.xstate.comp[i];
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 01:11:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 01:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782782.1192274 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shfJ2-0007sV-Bw; Sat, 24 Aug 2024 01:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782782.1192274; Sat, 24 Aug 2024 01: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 1shfJ2-0007sN-9F; Sat, 24 Aug 2024 01:11:04 +0000
Received: by outflank-mailman (input) for mailman id 782782;
 Sat, 24 Aug 2024 01:11:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shfJ1-0007sH-Bg
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 01:11:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shfJ1-0003WL-5J
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 01:11:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shfJ1-0006bm-31
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 01:11: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pre4JsO5Lz5bklN32GavPQd2dg+5iDJYXtp7Gw7qPCg=; b=5hq0z7ZRM6GlRRuEhVB+Axsgkt
	IMCrr6ykMCgw9PmbXV1IrXfM+0YRkAg5WeMzWH9M/UkwI9YiKQp5ckq7jNvRPzasvEmJ6GviRQPqv
	4tUziG8jGqfh0FVMbvFMOAUWBDzHi0hbiQNMy1GpuAZKuJQhbiDUPsEtLShLKmghlXAg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: update xilinx test scripts (tty)
Message-Id: <E1shfJ1-0006bm-31@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 01:11:03 +0000

commit 95764a0817a51741b7ffb1f78cba2a19b08ab2d1
Author:     Victor Lira <victorm.lira@amd.com>
AuthorDate: Fri Aug 23 15:29:04 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 23 18:06:59 2024 -0700

    automation: update xilinx test scripts (tty)
    
    Update serial device names from ttyUSB* to test board specific names.
    
    Update xilinx-smoke-dom0-x86_64 with new Xen command line console options,
    which are now set as Gitlab CI/CD variables. Abstract the directory where
    binaries are stored. Increase the timeout to match new setup.
    
    Signed-off-by: Victor Lira <victorm.lira@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/test.yaml                    |  2 ++
 automation/scripts/xilinx-smoke-dom0-x86_64.sh    | 28 +++++++++++------------
 automation/scripts/xilinx-smoke-dom0less-arm64.sh |  5 ++--
 3 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 4e74946419..3b339f387f 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -101,6 +101,8 @@
   variables:
     CONTAINER: ubuntu:xenial-xilinx
     LOGFILE: xilinx-smoke-x86_64.log
+    XEN_CMD_CONSOLE: "console=com2 com2=115200,8n1,0x2F8,4"
+    TEST_BOARD: "crater"
   artifacts:
     paths:
       - smoke.serial
diff --git a/automation/scripts/xilinx-smoke-dom0-x86_64.sh b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
index e6e6fac6a5..4559e2b9ee 100755
--- a/automation/scripts/xilinx-smoke-dom0-x86_64.sh
+++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
@@ -12,7 +12,6 @@ fatal() {
 # Test parameter defaults.
 TEST="$1"
 PASS_MSG="Test passed: ${TEST}"
-XEN_CMD_CONSOLE="console=com1 com1=115200,8n1,0x3F8,4"
 XEN_CMD_DOM0="dom0=pvh dom0_max_vcpus=4 dom0_mem=4G"
 XEN_CMD_XEN="sched=null loglvl=all guest_loglvl=all console_timestamps=boot"
 XEN_CMD_EXTRA=""
@@ -28,7 +27,7 @@ memory = 512
 vif = [ "bridge=xenbr0", ]
 disk = [ ]
 '
-TIMEOUT_SECONDS=120
+TIMEOUT_SECONDS=200
 
 # Select test variant.
 if [ "${TEST}" = "ping" ]; then
@@ -113,27 +112,28 @@ cd ..
 # Load software into TFTP server directory.
 TFTP="/scratch/gitlab-runner/tftp"
 XEN_CMDLINE="${XEN_CMD_CONSOLE} ${XEN_CMD_XEN} ${XEN_CMD_DOM0} ${XEN_CMD_EXTRA}"
-cp -f binaries/xen ${TFTP}/pxelinux.cfg/xen
-cp -f binaries/bzImage ${TFTP}/pxelinux.cfg/vmlinuz
-cp -f binaries/dom0-rootfs.cpio.gz ${TFTP}/pxelinux.cfg/initrd-dom0
+cp -f binaries/xen ${TFTP}/${TEST_BOARD}/xen
+cp -f binaries/bzImage ${TFTP}/${TEST_BOARD}/vmlinuz
+cp -f binaries/dom0-rootfs.cpio.gz ${TFTP}/${TEST_BOARD}/initrd-dom0
 echo "
 net_default_server=10.0.6.1
-multiboot2 (tftp)/pxelinux.cfg/xen ${XEN_CMDLINE}
-module2 (tftp)/pxelinux.cfg/vmlinuz console=hvc0 root=/dev/ram0 earlyprintk=xen
-module2 (tftp)/pxelinux.cfg/initrd-dom0
+multiboot2 (tftp)/${TEST_BOARD}/xen ${XEN_CMDLINE}
+module2 (tftp)/${TEST_BOARD}/vmlinuz console=hvc0 root=/dev/ram0 earlyprintk=xen
+module2 (tftp)/${TEST_BOARD}/initrd-dom0
 boot
-" > ${TFTP}/pxelinux.cfg/grub.cfg
+" > ${TFTP}/${TEST_BOARD}/grub.cfg
 
 # Power cycle board and collect serial port output.
-SERIAL_CMD="cat /dev/ttyUSB9 | tee smoke.serial | sed 's/\r//'"
-sh /scratch/gitlab-runner/v2000a.sh 2
+SERIAL_DEV="/dev/serial/${TEST_BOARD}"
+SERIAL_CMD="cat ${SERIAL_DEV} | tee smoke.serial | sed 's/\r//'"
+sh /scratch/gitlab-runner/${TEST_BOARD}.sh 2
 sleep 5
-sh /scratch/gitlab-runner/v2000a.sh 1
+sh /scratch/gitlab-runner/${TEST_BOARD}.sh 1
 sleep 5
 set +e
-stty -F /dev/ttyUSB9 115200
+stty -F ${SERIAL_DEV} 115200
 timeout -k 1 ${TIMEOUT_SECONDS} nohup sh -c "${SERIAL_CMD}"
-sh /scratch/gitlab-runner/v2000a.sh 2
+sh /scratch/gitlab-runner/${TEST_BOARD}.sh 2
 
 set -e
 
diff --git a/automation/scripts/xilinx-smoke-dom0less-arm64.sh b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
index 666411d6a0..18aa07f0a2 100755
--- a/automation/scripts/xilinx-smoke-dom0less-arm64.sh
+++ b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
@@ -134,9 +134,10 @@ sleep 5
 cd $START
 
 # connect to serial
+SERIAL_DEV="/dev/serial/zynq"
 set +e
-stty -F /dev/ttyUSB0 115200
-timeout -k 1 120 nohup sh -c "cat /dev/ttyUSB0 | tee smoke.serial | sed 's/\r//'"
+stty -F ${SERIAL_DEV} 115200
+timeout -k 1 120 nohup sh -c "cat ${SERIAL_DEV} | tee smoke.serial | sed 's/\r//'"
 
 # stop the board
 cd /scratch/gitlab-runner
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 07:55:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 07:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782858.1192348 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shlbz-00088h-SL; Sat, 24 Aug 2024 07:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782858.1192348; Sat, 24 Aug 2024 07: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 1shlbz-00088Z-Pa; Sat, 24 Aug 2024 07:55:03 +0000
Received: by outflank-mailman (input) for mailman id 782858;
 Sat, 24 Aug 2024 07:55:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shlby-00088T-9b
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 07:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shlby-0003RR-49
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 07:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shlby-0004Wp-2I
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 07: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xQqueaKHuKObYdLSwIjv32Xr9OX+z020S2rvdJh6V68=; b=3CHxpomvIfro3K3LfVGBcYoDIq
	oYTV9eEsJ8JNSUwII/JkvxDNjjQgCoVF3cYHhG3KX2b3+Mwrk0WAGi1xWh5WHVHMoDhYQ1s8i8sgq
	q2akdL4AA80sQAslashx37Vqo41MoIgnJcZajyD9z/dEJpGXOxXltM9SumgrzlGyAWR4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] drivers: char: omap-uart: provide a default clock frequency
Message-Id: <E1shlby-0004Wp-2I@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 07:55:02 +0000

commit be9b405aef1c01bbb5af16b4ee519c648c26f556
Author:     Amneesh Singh <a-singh21@ti.com>
AuthorDate: Tue Aug 20 13:52:03 2024 +0530
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Aug 22 10:59:52 2024 +0100

    drivers: char: omap-uart: provide a default clock frequency
    
    Quite a few TI K3 devices do not have clock-frequency specified in their
    respective UART nodes. However hard-coding the frequency is not a
    solution as the function clock input can differ between SoCs. So, use a
    default frequency of 48MHz, which is the same as the linux default (see
    8250_omap.c), if the device tree does not specify it.
    
    Signed-off-by: Amneesh Singh <a-singh21@ti.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/drivers/char/omap-uart.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/char/omap-uart.c b/xen/drivers/char/omap-uart.c
index 1079198a8d..9f73d822ad 100644
--- a/xen/drivers/char/omap-uart.c
+++ b/xen/drivers/char/omap-uart.c
@@ -48,6 +48,9 @@
 /* System configuration register */
 #define UART_OMAP_SYSC_DEF_CONF   0x0d   /* autoidle mode, wakeup is enabled */
 
+/* default clock frequency in hz */
+#define UART_OMAP_DEFAULT_CLK_SPEED 48000000
+
 #define omap_read(uart, off)       readl((uart)->regs + ((off) << REG_SHIFT))
 #define omap_write(uart, off, val) writel(val, \
                                           (uart)->regs + ((off) << REG_SHIFT))
@@ -322,8 +325,9 @@ static int __init omap_uart_init(struct dt_device_node *dev,
     res = dt_property_read_u32(dev, "clock-frequency", &clkspec);
     if ( !res )
     {
-        printk("omap-uart: Unable to retrieve the clock frequency\n");
-        return -EINVAL;
+        printk("omap-uart: Unable to retrieve the clock frequency, defaulting to %uHz\n",
+               UART_OMAP_DEFAULT_CLK_SPEED);
+        clkspec = UART_OMAP_DEFAULT_CLK_SPEED;
     }
 
     uart->clock_hz = clkspec;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 07:55:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 07:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782859.1192352 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shlc9-0008BC-VO; Sat, 24 Aug 2024 07:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782859.1192352; Sat, 24 Aug 2024 07: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 1shlc9-0008B4-Sp; Sat, 24 Aug 2024 07:55:13 +0000
Received: by outflank-mailman (input) for mailman id 782859;
 Sat, 24 Aug 2024 07:55:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shlc8-0008Ab-9Y
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 07:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shlc8-0003Rl-8j
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 07:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shlc8-0004Xd-6U
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 07: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=G373qaAvTxMsfl2jnznvn8HT33I2QQzGU/njI3dZBOc=; b=eRioe6xSOqYm+5KpLibg3qRte4
	fp7nRIOxBnGLJ6O0NH/+kljUiPTR0TW6yGC3rBgBY2b87Y5RSzoBOje7kwFPp4B2JNLzeBDq7m5gB
	IEUQkypU1apdbsvJmYAeLi+aCidYSKqaYOB6S66yXST7rmkBoQR4S0PRejhZpvDgpaZs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: arm: Add a new helper update_boot_mapping()
Message-Id: <E1shlc8-0004Xd-6U@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 07:55:12 +0000

commit 6df7c21b6331f5e21be41ba88dff8b2aad864ac1
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Wed Aug 21 13:25:00 2024 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Aug 22 11:06:33 2024 +0100

    xen: arm: Add a new helper update_boot_mapping()
    
    update_boot_mapping() invokes update_identity_mapping() for the MMU specific
    code.
    Later when the MPU code is added, update_boot_mapping() will invoke the
    equivalent.
    
    The common code now invokes update_boot_mapping() instead of
    update_identity_mapping(). So, that there is clear abstraction between the
    common and MMU/MPU specific logic.
    
    This is in continuation to commit
    f661a20aa880: "Extract MMU-specific MM code".
    
    update_identity_mapping() is now marked as static as it is called from
    xen/arch/arm/arm64/mmu/mm.c only. Also, amend the prototype to
    update_boot_mapping() which is now invoked from other files.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/arm64/mmu/mm.c         | 14 +++++++++++++-
 xen/arch/arm/arm64/smpboot.c        |  6 +++---
 xen/arch/arm/include/asm/arm64/mm.h |  9 +--------
 3 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/xen/arch/arm/arm64/mmu/mm.c b/xen/arch/arm/arm64/mmu/mm.c
index 293acb67e0..0de4f3c079 100644
--- a/xen/arch/arm/arm64/mmu/mm.c
+++ b/xen/arch/arm/arm64/mmu/mm.c
@@ -111,7 +111,14 @@ void __init arch_setup_page_tables(void)
     prepare_runtime_identity_mapping();
 }
 
-void update_identity_mapping(bool enable)
+/*
+ * Enable/disable the identity mapping in the live page-tables (i.e.
+ * the one pointed by TTBR_EL2).
+ *
+ * Note that nested call (e.g. enable=true, enable=true) is not
+ * supported.
+ */
+static void update_identity_mapping(bool enable)
 {
     paddr_t id_addr = virt_to_maddr(_start);
     int rc;
@@ -125,6 +132,11 @@ void update_identity_mapping(bool enable)
     BUG_ON(rc);
 }
 
+void update_boot_mapping(bool enable)
+{
+    update_identity_mapping(enable);
+}
+
 extern void switch_ttbr_id(uint64_t ttbr);
 
 typedef void (switch_ttbr_fn)(uint64_t ttbr);
diff --git a/xen/arch/arm/arm64/smpboot.c b/xen/arch/arm/arm64/smpboot.c
index a225fae64d..789f352ab6 100644
--- a/xen/arch/arm/arm64/smpboot.c
+++ b/xen/arch/arm/arm64/smpboot.c
@@ -112,18 +112,18 @@ int arch_cpu_up(int cpu)
     if ( !smp_enable_ops[cpu].prepare_cpu )
         return -ENODEV;
 
-    update_identity_mapping(true);
+    update_boot_mapping(true);
 
     rc = smp_enable_ops[cpu].prepare_cpu(cpu);
     if ( rc )
-        update_identity_mapping(false);
+        update_boot_mapping(false);
 
     return rc;
 }
 
 void arch_cpu_up_finish(void)
 {
-    update_identity_mapping(false);
+    update_boot_mapping(false);
 }
 
 /*
diff --git a/xen/arch/arm/include/asm/arm64/mm.h b/xen/arch/arm/include/asm/arm64/mm.h
index e0bd23a6ed..b4f7545d2c 100644
--- a/xen/arch/arm/include/asm/arm64/mm.h
+++ b/xen/arch/arm/include/asm/arm64/mm.h
@@ -14,14 +14,7 @@ static inline bool arch_mfns_in_directmap(unsigned long mfn, unsigned long nr)
 
 void arch_setup_page_tables(void);
 
-/*
- * Enable/disable the identity mapping in the live page-tables (i.e.
- * the one pointed by TTBR_EL2).
- *
- * Note that nested call (e.g. enable=true, enable=true) is not
- * supported.
- */
-void update_identity_mapping(bool enable);
+void update_boot_mapping(bool enable);
 
 #endif /* __ARM_ARM64_MM_H__ */
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 07:55:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 07:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782860.1192356 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shlcK-0008Dr-1L; Sat, 24 Aug 2024 07:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782860.1192356; Sat, 24 Aug 2024 07: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 1shlcJ-0008Dk-UT; Sat, 24 Aug 2024 07:55:23 +0000
Received: by outflank-mailman (input) for mailman id 782860;
 Sat, 24 Aug 2024 07:55:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shlcI-0008DO-Cm
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 07:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shlcI-0003Rz-By
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 07:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shlcI-0004YJ-Az
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 07: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HNm8QwSk/D4E++2Zw9BH+TKQwfPxP+Hts2YPwGDckPU=; b=fCzGP9vHlhFU/QGbLeyXf42xo7
	GbuuJTdmIhP+MHXp/oz0Mp/1EFRa00wO5XD+ONaF0S/brg5c2xHE1iRQjje8PhSj3vqYyz/X6tHLX
	jC6Jri1IWspuiWbtJlmFFkNng4lHO8XlU8UUJxfABQ0nJ/TIilksfOivmvLzs/heYMWY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: arm: Move domain_page.c to MMU specific
Message-Id: <E1shlcI-0004YJ-Az@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 07:55:22 +0000

commit 576459a06ad55fd1c4cea912fc0bc26b9f901f1e
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Wed Aug 21 13:25:01 2024 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Aug 22 11:06:33 2024 +0100

    xen: arm: Move domain_page.c to MMU specific
    
    domain_page.c is moved to mmu/domain_page.c. The reason
    being this file implements MMU specific logic for mapping,
    unmapping, etc domain page.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/Makefile          |   1 -
 xen/arch/arm/domain_page.c     | 194 -----------------------------------------
 xen/arch/arm/mmu/Makefile      |   1 +
 xen/arch/arm/mmu/domain_page.c | 194 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 195 insertions(+), 195 deletions(-)

diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index da9c979dc4..7792bff597 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -18,7 +18,6 @@ obj-$(CONFIG_IOREQ_SERVER) += dm.o
 obj-$(CONFIG_DOM0LESS_BOOT) += dom0less-build.init.o
 obj-y += domain.o
 obj-y += domain_build.init.o
-obj-$(CONFIG_ARCH_MAP_DOMAIN_PAGE) += domain_page.o
 obj-y += domctl.o
 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
 obj-y += efi/
diff --git a/xen/arch/arm/domain_page.c b/xen/arch/arm/domain_page.c
deleted file mode 100644
index 3a43601623..0000000000
--- a/xen/arch/arm/domain_page.c
+++ /dev/null
@@ -1,194 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-#include <xen/mm.h>
-#include <xen/pmap.h>
-#include <xen/vmap.h>
-
-/* Override macros from asm/page.h to make them work with mfn_t */
-#undef virt_to_mfn
-#define virt_to_mfn(va) _mfn(__virt_to_mfn(va))
-
-/* cpu0's domheap page tables */
-static DEFINE_PAGE_TABLES(cpu0_dommap, DOMHEAP_SECOND_PAGES);
-
-/*
- * xen_dommap == pages used by map_domain_page, these pages contain
- * the second level pagetables which map the domheap region
- * starting at DOMHEAP_VIRT_START in 2MB chunks.
- */
-static DEFINE_PER_CPU(lpae_t *, xen_dommap);
-
-/*
- * Prepare the area that will be used to map domheap pages. They are
- * mapped in 2MB chunks, so we need to allocate the page-tables up to
- * the 2nd level.
- *
- * The caller should make sure the root page-table for @cpu has been
- * allocated.
- */
-bool init_domheap_mappings(unsigned int cpu)
-{
-    unsigned int order = get_order_from_pages(DOMHEAP_SECOND_PAGES);
-    lpae_t *root = per_cpu(xen_pgtable, cpu);
-    unsigned int i, first_idx;
-    lpae_t *domheap;
-    mfn_t mfn;
-
-    ASSERT(root);
-    ASSERT(!per_cpu(xen_dommap, cpu));
-
-    /*
-     * The domheap for cpu0 is initialized before the heap is initialized.
-     * So we need to use pre-allocated pages.
-     */
-    if ( !cpu )
-        domheap = cpu0_dommap;
-    else
-        domheap = alloc_xenheap_pages(order, 0);
-
-    if ( !domheap )
-        return false;
-
-    /* Ensure the domheap has no stray mappings */
-    memset(domheap, 0, DOMHEAP_SECOND_PAGES * PAGE_SIZE);
-
-    /*
-     * Update the first level mapping to reference the local CPUs
-     * domheap mapping pages.
-     */
-    mfn = virt_to_mfn(domheap);
-    first_idx = first_table_offset(DOMHEAP_VIRT_START);
-    for ( i = 0; i < DOMHEAP_SECOND_PAGES; i++ )
-    {
-        lpae_t pte = mfn_to_xen_entry(mfn_add(mfn, i), MT_NORMAL);
-        pte.pt.table = 1;
-        write_pte(&root[first_idx + i], pte);
-    }
-
-    per_cpu(xen_dommap, cpu) = domheap;
-
-    return true;
-}
-
-void *map_domain_page_global(mfn_t mfn)
-{
-    return vmap(&mfn, 1);
-}
-
-void unmap_domain_page_global(const void *ptr)
-{
-    vunmap(ptr);
-}
-
-/* Map a page of domheap memory */
-void *map_domain_page(mfn_t mfn)
-{
-    unsigned long flags;
-    lpae_t *map = this_cpu(xen_dommap);
-    unsigned long slot_mfn = mfn_x(mfn) & ~XEN_PT_LPAE_ENTRY_MASK;
-    vaddr_t va;
-    lpae_t pte;
-    int i, slot;
-
-    local_irq_save(flags);
-
-    /* The map is laid out as an open-addressed hash table where each
-     * entry is a 2MB superpage pte.  We use the available bits of each
-     * PTE as a reference count; when the refcount is zero the slot can
-     * be reused. */
-    for ( slot = (slot_mfn >> XEN_PT_LPAE_SHIFT) % DOMHEAP_ENTRIES, i = 0;
-          i < DOMHEAP_ENTRIES;
-          slot = (slot + 1) % DOMHEAP_ENTRIES, i++ )
-    {
-        if ( map[slot].pt.avail < 0xf &&
-             map[slot].pt.base == slot_mfn &&
-             map[slot].pt.valid )
-        {
-            /* This slot already points to the right place; reuse it */
-            map[slot].pt.avail++;
-            break;
-        }
-        else if ( map[slot].pt.avail == 0 )
-        {
-            /* Commandeer this 2MB slot */
-            pte = mfn_to_xen_entry(_mfn(slot_mfn), MT_NORMAL);
-            pte.pt.avail = 1;
-            write_pte(map + slot, pte);
-            break;
-        }
-
-    }
-    /* If the map fills up, the callers have misbehaved. */
-    BUG_ON(i == DOMHEAP_ENTRIES);
-
-#ifndef NDEBUG
-    /* Searching the hash could get slow if the map starts filling up.
-     * Cross that bridge when we come to it */
-    {
-        static int max_tries = 32;
-        if ( i >= max_tries )
-        {
-            dprintk(XENLOG_WARNING, "Domheap map is filling: %i tries\n", i);
-            max_tries *= 2;
-        }
-    }
-#endif
-
-    local_irq_restore(flags);
-
-    va = (DOMHEAP_VIRT_START
-          + (slot << SECOND_SHIFT)
-          + ((mfn_x(mfn) & XEN_PT_LPAE_ENTRY_MASK) << THIRD_SHIFT));
-
-    /*
-     * We may not have flushed this specific subpage at map time,
-     * since we only flush the 4k page not the superpage
-     */
-    flush_xen_tlb_range_va_local(va, PAGE_SIZE);
-
-    return (void *)va;
-}
-
-/* Release a mapping taken with map_domain_page() */
-void unmap_domain_page(const void *ptr)
-{
-    unsigned long flags;
-    lpae_t *map = this_cpu(xen_dommap);
-    int slot = ((unsigned long)ptr - DOMHEAP_VIRT_START) >> SECOND_SHIFT;
-
-    if ( !ptr )
-        return;
-
-    local_irq_save(flags);
-
-    ASSERT(slot >= 0 && slot < DOMHEAP_ENTRIES);
-    ASSERT(map[slot].pt.avail != 0);
-
-    map[slot].pt.avail--;
-
-    local_irq_restore(flags);
-}
-
-mfn_t domain_page_map_to_mfn(const void *ptr)
-{
-    unsigned long va = (unsigned long)ptr;
-    lpae_t *map = this_cpu(xen_dommap);
-    int slot = (va - DOMHEAP_VIRT_START) >> SECOND_SHIFT;
-    unsigned long offset = (va>>THIRD_SHIFT) & XEN_PT_LPAE_ENTRY_MASK;
-
-    if ( (va >= VMAP_VIRT_START) && ((va - VMAP_VIRT_START) < VMAP_VIRT_SIZE) )
-        return virt_to_mfn(va);
-
-    ASSERT(slot >= 0 && slot < DOMHEAP_ENTRIES);
-    ASSERT(map[slot].pt.avail != 0);
-
-    return mfn_add(lpae_get_mfn(map[slot]), offset);
-}
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/xen/arch/arm/mmu/Makefile b/xen/arch/arm/mmu/Makefile
index 67475fcd80..2cb44b857d 100644
--- a/xen/arch/arm/mmu/Makefile
+++ b/xen/arch/arm/mmu/Makefile
@@ -2,3 +2,4 @@ obj-y += p2m.o
 obj-y += pt.o
 obj-y += setup.o
 obj-y += smpboot.o
+obj-$(CONFIG_ARCH_MAP_DOMAIN_PAGE) += domain_page.o
diff --git a/xen/arch/arm/mmu/domain_page.c b/xen/arch/arm/mmu/domain_page.c
new file mode 100644
index 0000000000..3a43601623
--- /dev/null
+++ b/xen/arch/arm/mmu/domain_page.c
@@ -0,0 +1,194 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#include <xen/mm.h>
+#include <xen/pmap.h>
+#include <xen/vmap.h>
+
+/* Override macros from asm/page.h to make them work with mfn_t */
+#undef virt_to_mfn
+#define virt_to_mfn(va) _mfn(__virt_to_mfn(va))
+
+/* cpu0's domheap page tables */
+static DEFINE_PAGE_TABLES(cpu0_dommap, DOMHEAP_SECOND_PAGES);
+
+/*
+ * xen_dommap == pages used by map_domain_page, these pages contain
+ * the second level pagetables which map the domheap region
+ * starting at DOMHEAP_VIRT_START in 2MB chunks.
+ */
+static DEFINE_PER_CPU(lpae_t *, xen_dommap);
+
+/*
+ * Prepare the area that will be used to map domheap pages. They are
+ * mapped in 2MB chunks, so we need to allocate the page-tables up to
+ * the 2nd level.
+ *
+ * The caller should make sure the root page-table for @cpu has been
+ * allocated.
+ */
+bool init_domheap_mappings(unsigned int cpu)
+{
+    unsigned int order = get_order_from_pages(DOMHEAP_SECOND_PAGES);
+    lpae_t *root = per_cpu(xen_pgtable, cpu);
+    unsigned int i, first_idx;
+    lpae_t *domheap;
+    mfn_t mfn;
+
+    ASSERT(root);
+    ASSERT(!per_cpu(xen_dommap, cpu));
+
+    /*
+     * The domheap for cpu0 is initialized before the heap is initialized.
+     * So we need to use pre-allocated pages.
+     */
+    if ( !cpu )
+        domheap = cpu0_dommap;
+    else
+        domheap = alloc_xenheap_pages(order, 0);
+
+    if ( !domheap )
+        return false;
+
+    /* Ensure the domheap has no stray mappings */
+    memset(domheap, 0, DOMHEAP_SECOND_PAGES * PAGE_SIZE);
+
+    /*
+     * Update the first level mapping to reference the local CPUs
+     * domheap mapping pages.
+     */
+    mfn = virt_to_mfn(domheap);
+    first_idx = first_table_offset(DOMHEAP_VIRT_START);
+    for ( i = 0; i < DOMHEAP_SECOND_PAGES; i++ )
+    {
+        lpae_t pte = mfn_to_xen_entry(mfn_add(mfn, i), MT_NORMAL);
+        pte.pt.table = 1;
+        write_pte(&root[first_idx + i], pte);
+    }
+
+    per_cpu(xen_dommap, cpu) = domheap;
+
+    return true;
+}
+
+void *map_domain_page_global(mfn_t mfn)
+{
+    return vmap(&mfn, 1);
+}
+
+void unmap_domain_page_global(const void *ptr)
+{
+    vunmap(ptr);
+}
+
+/* Map a page of domheap memory */
+void *map_domain_page(mfn_t mfn)
+{
+    unsigned long flags;
+    lpae_t *map = this_cpu(xen_dommap);
+    unsigned long slot_mfn = mfn_x(mfn) & ~XEN_PT_LPAE_ENTRY_MASK;
+    vaddr_t va;
+    lpae_t pte;
+    int i, slot;
+
+    local_irq_save(flags);
+
+    /* The map is laid out as an open-addressed hash table where each
+     * entry is a 2MB superpage pte.  We use the available bits of each
+     * PTE as a reference count; when the refcount is zero the slot can
+     * be reused. */
+    for ( slot = (slot_mfn >> XEN_PT_LPAE_SHIFT) % DOMHEAP_ENTRIES, i = 0;
+          i < DOMHEAP_ENTRIES;
+          slot = (slot + 1) % DOMHEAP_ENTRIES, i++ )
+    {
+        if ( map[slot].pt.avail < 0xf &&
+             map[slot].pt.base == slot_mfn &&
+             map[slot].pt.valid )
+        {
+            /* This slot already points to the right place; reuse it */
+            map[slot].pt.avail++;
+            break;
+        }
+        else if ( map[slot].pt.avail == 0 )
+        {
+            /* Commandeer this 2MB slot */
+            pte = mfn_to_xen_entry(_mfn(slot_mfn), MT_NORMAL);
+            pte.pt.avail = 1;
+            write_pte(map + slot, pte);
+            break;
+        }
+
+    }
+    /* If the map fills up, the callers have misbehaved. */
+    BUG_ON(i == DOMHEAP_ENTRIES);
+
+#ifndef NDEBUG
+    /* Searching the hash could get slow if the map starts filling up.
+     * Cross that bridge when we come to it */
+    {
+        static int max_tries = 32;
+        if ( i >= max_tries )
+        {
+            dprintk(XENLOG_WARNING, "Domheap map is filling: %i tries\n", i);
+            max_tries *= 2;
+        }
+    }
+#endif
+
+    local_irq_restore(flags);
+
+    va = (DOMHEAP_VIRT_START
+          + (slot << SECOND_SHIFT)
+          + ((mfn_x(mfn) & XEN_PT_LPAE_ENTRY_MASK) << THIRD_SHIFT));
+
+    /*
+     * We may not have flushed this specific subpage at map time,
+     * since we only flush the 4k page not the superpage
+     */
+    flush_xen_tlb_range_va_local(va, PAGE_SIZE);
+
+    return (void *)va;
+}
+
+/* Release a mapping taken with map_domain_page() */
+void unmap_domain_page(const void *ptr)
+{
+    unsigned long flags;
+    lpae_t *map = this_cpu(xen_dommap);
+    int slot = ((unsigned long)ptr - DOMHEAP_VIRT_START) >> SECOND_SHIFT;
+
+    if ( !ptr )
+        return;
+
+    local_irq_save(flags);
+
+    ASSERT(slot >= 0 && slot < DOMHEAP_ENTRIES);
+    ASSERT(map[slot].pt.avail != 0);
+
+    map[slot].pt.avail--;
+
+    local_irq_restore(flags);
+}
+
+mfn_t domain_page_map_to_mfn(const void *ptr)
+{
+    unsigned long va = (unsigned long)ptr;
+    lpae_t *map = this_cpu(xen_dommap);
+    int slot = (va - DOMHEAP_VIRT_START) >> SECOND_SHIFT;
+    unsigned long offset = (va>>THIRD_SHIFT) & XEN_PT_LPAE_ENTRY_MASK;
+
+    if ( (va >= VMAP_VIRT_START) && ((va - VMAP_VIRT_START) < VMAP_VIRT_SIZE) )
+        return virt_to_mfn(va);
+
+    ASSERT(slot >= 0 && slot < DOMHEAP_ENTRIES);
+    ASSERT(map[slot].pt.avail != 0);
+
+    return mfn_add(lpae_get_mfn(map[slot]), offset);
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 07:55:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 07:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782861.1192361 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shlcU-0008Gt-38; Sat, 24 Aug 2024 07:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782861.1192361; Sat, 24 Aug 2024 07: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 1shlcT-0008Gl-WC; Sat, 24 Aug 2024 07:55:33 +0000
Received: by outflank-mailman (input) for mailman id 782861;
 Sat, 24 Aug 2024 07:55:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shlcS-0008GU-Fn
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 07:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shlcS-0003SA-F0
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 07:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shlcS-0004Ys-E5
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 07: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dVcHuL/mI5AFD6NCW3DA6lHWRyV6Nf6QdXIyQo1Q8bw=; b=5SKsmw37wGY6o/Y33cSQqEqiax
	YTJT31IV3BAoIhlrtRN8yhYSyRBfBM/5R4JDyGK4te+9pX3tGJlJCHsxnlTPiJCUiULFQyFg8SR1p
	MGDyuqwMKkatPw9m2YECBC40Oj3PKbalBGCWZ8ZW/OKxc2sJQn81fPfQs02cA2p8mOps=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: arm: Enclose access to EL2 MMU specific registers under CONFIG_MMU
Message-Id: <E1shlcS-0004Ys-E5@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 07:55:32 +0000

commit 405c2b4b9971b6ab10d630f81f83c96a550e4811
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Wed Aug 21 13:25:02 2024 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Aug 22 11:06:33 2024 +0100

    xen: arm: Enclose access to EL2 MMU specific registers under CONFIG_MMU
    
    All the EL2 MMU specific registers are enclosed within CONFIG_MMU.
    Also, protect vttbr_el2 field of struct reg_ctxt and accesses to it.
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/traps.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index aac6c599f8..737f4d65e3 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -720,8 +720,10 @@ struct reg_ctxt {
     uint32_t ifsr32_el2;
 #endif
 
+#ifdef CONFIG_MMU
     /* Hypervisor-side state */
     uint64_t vttbr_el2;
+#endif
 };
 
 static const char *mode_string(register_t cpsr)
@@ -919,12 +921,16 @@ static void _show_registers(const struct cpu_user_regs *regs,
 #endif
     }
     printk("  VTCR_EL2: %"PRIregister"\n", READ_SYSREG(VTCR_EL2));
+#ifdef CONFIG_MMU
     printk(" VTTBR_EL2: %016"PRIx64"\n", ctxt->vttbr_el2);
+#endif
     printk("\n");
 
     printk(" SCTLR_EL2: %"PRIregister"\n", READ_SYSREG(SCTLR_EL2));
     printk("   HCR_EL2: %"PRIregister"\n", READ_SYSREG(HCR_EL2));
+#ifdef CONFIG_MMU
     printk(" TTBR0_EL2: %016"PRIx64"\n", READ_SYSREG64(TTBR0_EL2));
+#endif
     printk("\n");
     printk("   ESR_EL2: %"PRIregister"\n", regs->hsr);
     printk(" HPFAR_EL2: %"PRIregister"\n", READ_SYSREG(HPFAR_EL2));
@@ -956,7 +962,9 @@ void show_registers(const struct cpu_user_regs *regs)
     if ( guest_mode(regs) && is_32bit_domain(current->domain) )
         ctxt.ifsr32_el2 = READ_SYSREG(IFSR32_EL2);
 #endif
+#ifdef CONFIG_MMU
     ctxt.vttbr_el2 = READ_SYSREG64(VTTBR_EL2);
+#endif
 
     _show_registers(regs, &ctxt, guest_mode(regs), current);
 }
@@ -979,7 +987,9 @@ void vcpu_show_registers(const struct vcpu *v)
     ctxt.ifsr32_el2 = v->arch.ifsr;
 #endif
 
+#ifdef CONFIG_MMU
     ctxt.vttbr_el2 = v->domain->arch.p2m.vttbr;
+#endif
 
     _show_registers(&v->arch.cpu_info->guest_cpu_user_regs, &ctxt, 1, v);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 07:55:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 07:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782862.1192365 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shlce-0008Ja-4g; Sat, 24 Aug 2024 07:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782862.1192365; Sat, 24 Aug 2024 07: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 1shlce-0008JT-1P; Sat, 24 Aug 2024 07:55:44 +0000
Received: by outflank-mailman (input) for mailman id 782862;
 Sat, 24 Aug 2024 07:55:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shlcc-0008JJ-Jf
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 07:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shlcc-0003ST-Iq
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 07:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shlcc-0004ZR-HB
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 07: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YXWhXv9q8A3zSHoouzWhCELwK54UtIaCeTGzongo5pA=; b=ETWEr/v9aG4mbJD0pg41h0LQVZ
	xzGpuWIPIMQ/cAeuTErIQ8uZCebYE226uFrgxPGwbDxRA22TSlQBVT7g6OmD2XiYoFprKi05Y0V6q
	VUFvP+hRk5FUblz1onfR9Cv0yHucHyoBf27TdO5Xerf7GtSLU1FeiTvfIgS2C0K9G5+c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm64: Hide FEAT_SME
Message-Id: <E1shlcc-0004ZR-HB@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 07:55:42 +0000

commit 98060fc4a31ff56f1375446b21dc4b52836e22bd
Author:     Julien Grall <julien@xen.org>
AuthorDate: Wed Aug 14 22:00:54 2024 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Aug 22 11:09:42 2024 +0100

    xen/arm64: Hide FEAT_SME
    
    Newer hardware may support FEAT_SME. Xen doesn't have any knowledge but
    it will still expose the feature to the VM. If the OS is trying to use
    SME, then it will crash.
    
    Solve by hiding FEAT_SME.
    
    Signed-off-by: Julien Grall <julien@xen.org>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
---
 xen/arch/arm/cpufeature.c             | 3 +++
 xen/arch/arm/include/asm/cpufeature.h | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/cpufeature.c b/xen/arch/arm/cpufeature.c
index ef77473bf8..b45dbe3c66 100644
--- a/xen/arch/arm/cpufeature.c
+++ b/xen/arch/arm/cpufeature.c
@@ -208,6 +208,9 @@ static int __init create_domain_cpuinfo(void)
     domain_cpuinfo.pfr64.sve = 0;
     domain_cpuinfo.zfr64.bits[0] = 0;
 
+    /* Hide SMT support as Xen does not support it */
+    domain_cpuinfo.pfr64.sme = 0;
+
     /* Hide MTE support as Xen does not support it */
     domain_cpuinfo.pfr64.mte = 0;
 
diff --git a/xen/arch/arm/include/asm/cpufeature.h b/xen/arch/arm/include/asm/cpufeature.h
index c95582044a..969e043f5b 100644
--- a/xen/arch/arm/include/asm/cpufeature.h
+++ b/xen/arch/arm/include/asm/cpufeature.h
@@ -207,7 +207,9 @@ struct cpuinfo_arm {
             unsigned long mte:4;
             unsigned long ras_frac:4;
             unsigned long mpam_frac:4;
-            unsigned long __res1:44;
+            unsigned long __res1:4;
+            unsigned long sme:4;
+            unsigned long __res2:36;
         };
     } pfr64;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 07:55:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 07:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782863.1192368 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shlco-0008MN-5m; Sat, 24 Aug 2024 07:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782863.1192368; Sat, 24 Aug 2024 07: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 1shlco-0008MG-2q; Sat, 24 Aug 2024 07:55:54 +0000
Received: by outflank-mailman (input) for mailman id 782863;
 Sat, 24 Aug 2024 07:55:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shlcm-0008M0-OP
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 07:55:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shlcm-0003Se-Lq
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 07:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shlcm-0004a8-L5
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 07: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0BKS8imuqjbeLbKrtWNhGbd/IBi3sGtcheSYFsM4yXQ=; b=krEQUSksCZVLzo8PLp8tlUOxuE
	aMKiNTKgB6OSV6DN1svUBxQ7LWMOucr1GSnSPhW9L6nSwbcTtzRreo/IAke5CRE5tcjNYjEdj0s1w
	WSuQ0K1/YxEChDZGbh3aI02D28D3lXpYjcCzAgsC9M42u0zoH+Jk103SAwtPSZZOfL7o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Drop {boot_}phys_offset usage
Message-Id: <E1shlcm-0004a8-L5@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 07:55:52 +0000

commit 0cc09bdfafebe95a54a64f77c6ac80e5b5988fb7
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Wed Aug 14 11:43:02 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Aug 22 11:35:05 2024 +0100

    xen/arm: Drop {boot_}phys_offset usage
    
    boot_phys_offset stores the physical offset (PA-VA), is calculated in
    the startup head.S code and passed to start_xen() as a first argument.
    There is no point in using it given that we can ask MMU to translate
    a VA for us using e.g. virt_to_{mfn,maddr}. Drop usage of these
    variables from the C world.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/mm.h |  2 +-
 xen/arch/arm/mmu/setup.c      | 16 ++++++----------
 xen/arch/arm/setup.c          |  2 +-
 3 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/xen/arch/arm/include/asm/mm.h b/xen/arch/arm/include/asm/mm.h
index f6ba611f01..5abd4b0d1c 100644
--- a/xen/arch/arm/include/asm/mm.h
+++ b/xen/arch/arm/include/asm/mm.h
@@ -199,7 +199,7 @@ extern unsigned long frametable_base_pdx;
 #define PDX_GROUP_SHIFT SECOND_SHIFT
 
 /* Boot-time pagetable setup */
-extern void setup_pagetables(unsigned long boot_phys_offset);
+extern void setup_pagetables(void);
 /* Map FDT in boot pagetable */
 extern void *early_fdt_map(paddr_t fdt_paddr);
 /* Remove early mappings */
diff --git a/xen/arch/arm/mmu/setup.c b/xen/arch/arm/mmu/setup.c
index 57042ed57b..9664e85ee6 100644
--- a/xen/arch/arm/mmu/setup.c
+++ b/xen/arch/arm/mmu/setup.c
@@ -17,6 +17,8 @@
 /* Override macros from asm/page.h to make them work with mfn_t */
 #undef mfn_to_virt
 #define mfn_to_virt(mfn) __mfn_to_virt(mfn_x(mfn))
+#undef virt_to_mfn
+#define virt_to_mfn(va) _mfn(__virt_to_mfn(va))
 
 /* Main runtime page tables */
 
@@ -52,8 +54,6 @@ DEFINE_BOOT_PAGE_TABLE(xen_fixmap);
  */
 static DEFINE_PAGE_TABLES(xen_xenmap, XEN_NR_ENTRIES(2));
 
-static paddr_t phys_offset;
-
 /* Limits of the Xen heap */
 mfn_t directmap_mfn_start __read_mostly = INVALID_MFN_INITIALIZER;
 mfn_t directmap_mfn_end __read_mostly;
@@ -138,9 +138,7 @@ static void __init __maybe_unused build_assertions(void)
 
 lpae_t __init pte_of_xenaddr(vaddr_t va)
 {
-    paddr_t ma = va + phys_offset;
-
-    return mfn_to_xen_entry(maddr_to_mfn(ma), MT_NORMAL);
+    return mfn_to_xen_entry(virt_to_mfn(va), MT_NORMAL);
 }
 
 void * __init early_fdt_map(paddr_t fdt_paddr)
@@ -228,14 +226,12 @@ static void xen_pt_enforce_wnx(void)
  * Boot-time pagetable setup.
  * Changes here may need matching changes in head.S
  */
-void __init setup_pagetables(unsigned long boot_phys_offset)
+void __init setup_pagetables(void)
 {
     uint64_t ttbr;
     lpae_t pte, *p;
     int i;
 
-    phys_offset = boot_phys_offset;
-
     arch_setup_page_tables();
 
 #ifdef CONFIG_ARM_64
@@ -290,9 +286,9 @@ void __init setup_pagetables(unsigned long boot_phys_offset)
     xen_second[second_table_offset(FIXMAP_ADDR(0))] = pte;
 
 #ifdef CONFIG_ARM_64
-    ttbr = (uintptr_t) xen_pgtable + phys_offset;
+    ttbr = virt_to_maddr(xen_pgtable);
 #else
-    ttbr = (uintptr_t) cpu0_pgtable + phys_offset;
+    ttbr = virt_to_maddr(cpu0_pgtable);
 #endif
 
     switch_ttbr(ttbr);
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index cb2c0a16b8..cfe19e15b0 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -304,7 +304,7 @@ void asmlinkage __init start_xen(unsigned long boot_phys_offset,
     /* Initialize traps early allow us to get backtrace when an error occurred */
     init_traps();
 
-    setup_pagetables(boot_phys_offset);
+    setup_pagetables();
 
     smp_clear_cpu_maps();
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 07:56:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 07:56:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782864.1192372 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shlcy-0008Pc-8O; Sat, 24 Aug 2024 07:56:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782864.1192372; Sat, 24 Aug 2024 07: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 1shlcy-0008PU-5f; Sat, 24 Aug 2024 07:56:04 +0000
Received: by outflank-mailman (input) for mailman id 782864;
 Sat, 24 Aug 2024 07:56:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shlcw-0008PK-Pk
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 07:56:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shlcw-0003T0-Ox
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 07:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shlcw-0004bR-OB
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 07:56:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=A/b+PfSAwlJIufiIlD5m2pANKeOdN78jG2syeJZbTgw=; b=Gfq0zsbvZ3Gx2r+dfHdC8xgpzc
	G7fyrcM5fiklC99qL5U2NUNwpVsOeVi77ljqDJYSqYXhsoes5Pi8GFq2oO1L11c/M6jCkt7LIfIb9
	LqTUrbt1alA3MX1+kNhRXFv5h0KVKBH90wZm9LuGvTUBdiltOeY04/uaIcCC6jVKH5fI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: head: Do not pass physical offset to start_xen
Message-Id: <E1shlcw-0004bR-OB@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 07:56:02 +0000

commit 394c9d88858cd99fcb5a189dbabe2af34dbabfd3
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Wed Aug 14 11:43:03 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Aug 22 11:35:05 2024 +0100

    xen/arm: head: Do not pass physical offset to start_xen
    
    Given no further use in C world of boot_phys_offset, drop it from the
    argument list of start_xen() and do the necessary changes in the startup
    code head.S (most notably modifying launch not to expect 2 arguments to
    pass to C entry point).
    
    Both on arm64 and arm32, phys offset (stored in x20 or r10 respectively)
    is still needed, so that it can be used in e.g. create_table_entry,
    therefore keep it on the list of common register usage.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/arm32/head.S | 12 +++++-------
 xen/arch/arm/arm64/head.S | 12 +++++-------
 xen/arch/arm/setup.c      |  3 +--
 3 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/xen/arch/arm/arm32/head.S b/xen/arch/arm/arm32/head.S
index b488a21a71..a96d5d3503 100644
--- a/xen/arch/arm/arm32/head.S
+++ b/xen/arch/arm/arm32/head.S
@@ -101,9 +101,8 @@ primary_switched:
         bl    zero_bss
         PRINT("- Ready -\r\n")
         /* Setup the arguments for start_xen and jump to C world */
-        mov   r0, r10                /* r0 := Physical offset */
-        mov   r1, r8                 /* r1 := paddr(FDT) */
-        mov_w r2, start_xen
+        mov   r0, r8                 /* r0 := paddr(FDT) */
+        mov_w r1, start_xen
         b     launch
 ENDPROC(start)
 
@@ -141,7 +140,7 @@ GLOBAL(init_secondary)
 secondary_switched:
         PRINT("- Ready -\r\n")
         /* Jump to C world */
-        mov_w r2, start_secondary
+        mov_w r1, start_secondary
         b     launch
 ENDPROC(init_secondary)
 
@@ -243,8 +242,7 @@ ENDPROC(cpu_init)
  *
  * Inputs:
  *   r0 : Argument 0 of the C function to call
- *   r1 : Argument 1 of the C function to call
- *   r2 : C entry point
+ *   r1 : C entry point
  *
  * Clobbers r3
  */
@@ -256,7 +254,7 @@ launch:
         sub   sp, #CPUINFO_sizeof    /* Make room for CPU save record */
 
         /* Jump to C world */
-       bx    r2
+       bx    r1
 ENDPROC(launch)
 
 /* Fail-stop */
diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S
index 2fa07dc3a0..14c3720d80 100644
--- a/xen/arch/arm/arm64/head.S
+++ b/xen/arch/arm/arm64/head.S
@@ -260,9 +260,8 @@ primary_switched:
         bl    zero_bss
         PRINT("- Ready -\r\n")
         /* Setup the arguments for start_xen and jump to C world */
-        mov   x0, x20                /* x0 := Physical offset */
-        mov   x1, x21                /* x1 := paddr(FDT) */
-        ldr   x2, =start_xen
+        mov   x0, x21                /* x0 := paddr(FDT) */
+        ldr   x1, =start_xen
         b     launch
 END(real_start)
 
@@ -303,7 +302,7 @@ FUNC(init_secondary)
 secondary_switched:
         PRINT("- Ready -\r\n")
         /* Jump to C world */
-        ldr   x2, =start_secondary
+        ldr   x1, =start_secondary
         b     launch
 END(init_secondary)
 
@@ -407,8 +406,7 @@ END(cpu_init)
  *
  * Inputs:
  *   x0 : Argument 0 of the C function to call
- *   x1 : Argument 1 of the C function to call
- *   x2 : C entry point
+ *   x1 : C entry point
  *
  * Clobbers x3
  */
@@ -421,7 +419,7 @@ FUNC_LOCAL(launch)
         mov   sp, x3
 
         /* Jump to C world */
-        br    x2
+        br    x1
 END(launch)
 
 /* Fail-stop */
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index cfe19e15b0..961d3ea670 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -287,8 +287,7 @@ void __init init_pdx(void)
 size_t __read_mostly dcache_line_bytes;
 
 /* C entry point for boot CPU */
-void asmlinkage __init start_xen(unsigned long boot_phys_offset,
-                                 unsigned long fdt_paddr)
+void asmlinkage __init start_xen(unsigned long fdt_paddr)
 {
     size_t fdt_size;
     const char *cmdline;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 07:56:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 07:56:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782865.1192376 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shld8-0000Yy-9t; Sat, 24 Aug 2024 07:56:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782865.1192376; Sat, 24 Aug 2024 07: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 1shld8-0000Yq-7F; Sat, 24 Aug 2024 07:56:14 +0000
Received: by outflank-mailman (input) for mailman id 782865;
 Sat, 24 Aug 2024 07:56:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shld6-0000Lq-Sv
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 07:56:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shld6-0003TZ-SA
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 07:56:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shld6-0004cE-RC
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 07:56:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zUbNeM/5xHbKOevnAhQFca+PxYBDD4bakJY0ONaYUlM=; b=AJFgKT4Y0Bp06hW/RP27GuctI4
	L/diXSfR6KaMN07XDWP8JfmXxDaZ/nYY6CjN98Fvf+oNKgt+3GychU2sVhaTvu0CdzSIYy2D5x9rF
	L9J8RQfk/dOweG2FfdC7LP3oGrpRu7HWRQl4+1z6999sOj8jahn2pK4PHZfl3xwXwbbI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: restore CR filtering
Message-Id: <E1shld6-0004cE-RC@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 07:56:12 +0000

commit aa80a04df488528d90a0d892f0752571b1759e8b
Author:     Stefano Stabellini <stefano.stabellini@amd.com>
AuthorDate: Wed Aug 21 13:29:58 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Aug 22 13:07:39 2024 -0700

    automation: restore CR filtering
    
    After commit c36efb7fcea6 ("automation: use expect to run QEMU") we lost
    the \r filtering introduced by b576497e3b7d ("automation: remove CR
    characters from serial output"). This patch reintroduced it.
    
    Fixes: c36efb7fcea6 ("automation: use expect to run QEMU")
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 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/qemu-smoke-x86-64.sh         | 2 +-
 automation/scripts/qemu-xtf-dom0less-arm64.sh   | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index 5359e0820b..42a89e86b0 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -89,4 +89,4 @@ export QEMU_LOG="smoke.serial"
 export LOG_MSG="Domain-0"
 export PASSED="BusyBox"
 
-./automation/scripts/qemu-key.exp
+./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-dom0-arm32.sh b/automation/scripts/qemu-smoke-dom0-arm32.sh
index bbdcb39f1a..fd64b19358 100755
--- a/automation/scripts/qemu-smoke-dom0-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm32.sh
@@ -96,4 +96,4 @@ export QEMU_LOG="${serial_log}"
 export LOG_MSG="Domain-0"
 export PASSED="/ #"
 
-../automation/scripts/qemu-key.exp
+../automation/scripts/qemu-key.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
index 0094bfc8e1..e0cea742b0 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -109,4 +109,4 @@ export QEMU_LOG="smoke.serial"
 export LOG_MSG="Domain-0"
 export PASSED="BusyBox"
 
-./automation/scripts/qemu-key.exp
+./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
index 68ffbabdb8..e824cb7c2a 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -149,4 +149,4 @@ export QEMU_LOG="${serial_log}"
 export LOG_MSG="${dom0_prompt}"
 export PASSED="${passed}"
 
-../automation/scripts/qemu-key.exp
+../automation/scripts/qemu-key.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index eb25c4af4b..f42ba5d196 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -220,4 +220,4 @@ export QEMU_LOG="smoke.serial"
 export LOG_MSG="Welcome to Alpine Linux"
 export PASSED="${passed}"
 
-./automation/scripts/qemu-key.exp
+./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-ppc64le.sh b/automation/scripts/qemu-smoke-ppc64le.sh
index ccb4a576f4..594f92c19c 100755
--- a/automation/scripts/qemu-smoke-ppc64le.sh
+++ b/automation/scripts/qemu-smoke-ppc64le.sh
@@ -25,4 +25,4 @@ export QEMU_CMD="qemu-system-ppc64 \
 export QEMU_LOG="${serial_log}"
 export PASSED="Hello, ppc64le!"
 
-./automation/scripts/qemu-key.exp
+./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-riscv64.sh b/automation/scripts/qemu-smoke-riscv64.sh
index 0355c075b7..c2595f657f 100755
--- a/automation/scripts/qemu-smoke-riscv64.sh
+++ b/automation/scripts/qemu-smoke-riscv64.sh
@@ -16,4 +16,4 @@ export QEMU_CMD="qemu-system-riscv64 \
 export QEMU_LOG="smoke.serial"
 export PASSED="All set up"
 
-./automation/scripts/qemu-key.exp
+./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-x86-64.sh b/automation/scripts/qemu-smoke-x86-64.sh
index 37ac10e068..3440b1761d 100755
--- a/automation/scripts/qemu-smoke-x86-64.sh
+++ b/automation/scripts/qemu-smoke-x86-64.sh
@@ -24,4 +24,4 @@ export QEMU_CMD="qemu-system-x86_64 -nographic -kernel binaries/xen \
 export QEMU_LOG="smoke.serial"
 export PASSED="Test result: SUCCESS"
 
-./automation/scripts/qemu-key.exp
+./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-xtf-dom0less-arm64.sh b/automation/scripts/qemu-xtf-dom0less-arm64.sh
index 0666f6363e..4042fe5060 100755
--- a/automation/scripts/qemu-xtf-dom0less-arm64.sh
+++ b/automation/scripts/qemu-xtf-dom0less-arm64.sh
@@ -65,4 +65,4 @@ export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x4000000
 export QEMU_LOG="smoke.serial"
 export PASSED="${passed}"
 
-./automation/scripts/qemu-key.exp
+./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 19:22:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 19:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782989.1192410 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwKp-0005Cw-8S; Sat, 24 Aug 2024 19:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782989.1192410; Sat, 24 Aug 2024 19:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwKp-0005Cn-5a; Sat, 24 Aug 2024 19:22:03 +0000
Received: by outflank-mailman (input) for mailman id 782989;
 Sat, 24 Aug 2024 19:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwKn-0005Cf-WC
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwKn-0008Ci-Q7
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwKn-0002QC-N6
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AGO0faqR+rpX9WcMqV7BFC3zNqaeqLQ4td2D18EESTg=; b=jr/hw7VxnUjnDoDeI8pY8NHuzZ
	fRMqZEiNmEmyOyM0CqvyhT3By93RvBk7Zi0wr6TEfBtvRiMPLGeqTnDdpbAJiCkvhMN2rBYYuPxjV
	9zBR6dSZNY2Ro+K+yvDwT5JCnqHUx+DzCaeQW0YoDuciue20FpkFvvH8Ix5Nu9gQxGIc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul: always set operand size for AVX-VNNI-INT8 insns
Message-Id: <E1shwKn-0002QC-N6@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 19:22:01 +0000

commit d45687cca2450bfebe1dfbddb22f4f03c6fbc9cb
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Aug 23 09:11:15 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 23 09:11:15 2024 +0200

    x86emul: always set operand size for AVX-VNNI-INT8 insns
    
    Unlike for AVX-VNNI-INT16 I failed to notice that op_bytes may still be
    zero when reaching the respective case block: With the ext0f38_table[]
    entries having simd_packed_int, the defaulting at the bottom of
    x86emul_decode() won't set the field to non-zero for F3- or F2-prefixed
    insns.
    
    Fixes: 842acaa743a5 ("x86emul: support AVX-VNNI-INT8")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 3c5f9ce309..eda691868d 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6075,6 +6075,7 @@ x86_emulate(
     case X86EMUL_OPC_VEX_F2(0x0f38, 0x51): /* vpdpbssds [xy]mm/mem,[xy]mm,[xy]mm */
         host_and_vcpu_must_have(avx_vnni_int8);
         generate_exception_if(vex.w, X86_EXC_UD);
+        op_bytes = 16 << vex.l;
         goto simd_0f_ymm;
 
     case X86EMUL_OPC_VEX_66(0x0f38, 0x50): /* vpdpbusd [xy]mm/mem,[xy]mm,[xy]mm */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 19:22:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 19:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782990.1192414 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwKz-0005EG-9m; Sat, 24 Aug 2024 19:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782990.1192414; Sat, 24 Aug 2024 19:22:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwKz-0005E9-74; Sat, 24 Aug 2024 19:22:13 +0000
Received: by outflank-mailman (input) for mailman id 782990;
 Sat, 24 Aug 2024 19:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwKx-0005E3-W1
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwKx-0008Cz-VB
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwKx-0002RR-Si
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PXy0WTGP4d/iM20onF2R9l9b4KRjP20uqG08i6PkBh8=; b=vQzHdhGnPNm94LPWWhhxIY4m/X
	WyHJlPNRp0ljjEGox0cR76LMdmJ2vMAnupv6ixUKUn1EXMV7MdWqUufznQ94d4viexRNBZTEkCEMK
	fzBU81DEe4tqBJ/EihbihkXatkQKC/+FoAkvIpZ1W1Xdi9FhVHO81GDxzVfbsXfy9Wck=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul: set (fake) operand size for AVX512CD broadcast insns
Message-Id: <E1shwKx-0002RR-Si@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 19:22:11 +0000

commit 6fa6b7feaafd622db3a2f3436750cf07782f4c12
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Aug 23 09:12:24 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 23 09:12:24 2024 +0200

    x86emul: set (fake) operand size for AVX512CD broadcast insns
    
    Back at the time I failed to pay attention to op_bytes still being zero
    when reaching the respective case block: With the ext0f38_table[]
    entries having simd_packed_int, the defaulting at the bottom of
    x86emul_decode() won't set the field to non-zero for F3-prefixed insns.
    
    Fixes: 37ccca740c26 ("x86emul: support AVX512CD insns")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index eda691868d..0a7552de96 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -5929,6 +5929,7 @@ x86_emulate(
                                evex.w == ((b >> 4) & 1)),
                               X86_EXC_UD);
         d |= TwoOp;
+        op_bytes = 1; /* fake */
         /* fall through */
     case X86EMUL_OPC_EVEX_66(0x0f38, 0xc4): /* vpconflict{d,q} [xyz]mm/mem,[xyz]mm{k} */
         fault_suppression = false;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 19:22:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 19:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782991.1192418 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwL9-0005HA-BQ; Sat, 24 Aug 2024 19:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782991.1192418; Sat, 24 Aug 2024 19:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwL9-0005H1-8l; Sat, 24 Aug 2024 19:22:23 +0000
Received: by outflank-mailman (input) for mailman id 782991;
 Sat, 24 Aug 2024 19:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwL8-0005Gp-3D
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwL8-0008DZ-2I
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwL8-0002T0-1K
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:22:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bb4JgkzLEPxe6L5a8XupA9oe1rHQwOZk1d1/dAbAXs4=; b=SdOJCWL38TVO68rd0AS5b7tktI
	61w/1QfJM2hkpaN9J45nRxMFIoDiRQzhGZ86lYel/Ymv90sOElfD+/pM1zxHrBuj6ISO0Pgz8I//4
	p9BuszzdMSLvRFcQ0ClfmL5LBxbaaV4M28HG1C1otw9gwN5jT0ib4YCX9dFoeu0He0kk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul: convert op_bytes/opc checks in SIMD emulation
Message-Id: <E1shwL8-0002T0-1K@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 19:22:22 +0000

commit 5231765a4e6528a3208e49885b9eeff42519a6c1
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Aug 23 09:13:07 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Aug 23 09:13:07 2024 +0200

    x86emul: convert op_bytes/opc checks in SIMD emulation
    
    Raising #UD for an internal shortcoming of the emulator isn't quite
    right. Similarly BUG() is bigger a hammer than needed.
    
    Switch to using EXPECT() instead. This way even for insns not covered by
    the test harness fuzzers will have a chance of noticing issues, should
    any still exist or new ones be introduced.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 0a7552de96..0a6d5a35b1 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -8116,13 +8116,13 @@ x86_emulate(
     }
     else if ( state->simd_size != simd_none )
     {
-        generate_exception_if(!op_bytes, X86_EXC_UD);
         generate_exception_if((vex.opcx && (d & TwoOp) &&
                                (vex.reg != 0xf || (evex_encoded() && !evex.RX))),
                               X86_EXC_UD);
 
-        if ( !opc )
-            BUG();
+        EXPECT(op_bytes);
+        EXPECT(opc);
+
         if ( evex_encoded() )
         {
             opc[insn_bytes - EVEX_PFX_BYTES] = 0xc3;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 19:22:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 19:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782992.1192422 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwLJ-0005KD-Ch; Sat, 24 Aug 2024 19:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782992.1192422; Sat, 24 Aug 2024 19:22:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwLJ-0005K5-AB; Sat, 24 Aug 2024 19:22:33 +0000
Received: by outflank-mailman (input) for mailman id 782992;
 Sat, 24 Aug 2024 19:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwLI-0005Jn-6G
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwLI-0008Di-5P
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwLI-0002Tm-4S
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:22:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rrJePko4uC0VnVbhqfzOJH4Moxi9W2t6NCTrkouQUkw=; b=rCu5VyVjADLGAmCRK5hd0rJWZi
	2pQRF2ASFNHPFoSed6G2LOfoprLAORx2lFRtZSyfHSMkxskBkcCii8VPlyadjcLVxe9VCUf56bdQn
	QAmib5ezl4N5rivLlnQs3V3W0oE6UlULot0gPOHvU9JL7pKmogoH/NOtDH2Xj6ZO6DLs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml: Remove '-cc $(CC)' from OCAMLOPTFLAGS
Message-Id: <E1shwLI-0002Tm-4S@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 19:22:32 +0000

commit 0d69635d27cb1d011ccdf419b2bc85cc7809ac92
Author:     Andrii Sultanov <andrii.sultanov@cloud.com>
AuthorDate: Thu Aug 22 10:06:02 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 23 10:44:24 2024 +0100

    tools/ocaml: Remove '-cc $(CC)' from OCAMLOPTFLAGS
    
    This option does not work as one might expect, and needs to be the full
    compiler invocation including linking arguments to operate correctly.
    
    See https://github.com/ocaml/ocaml/issues/12284 for more details.
    
    Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/ocaml/common.make | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/common.make b/tools/ocaml/common.make
index 0c8a597d5b..cc126b749f 100644
--- a/tools/ocaml/common.make
+++ b/tools/ocaml/common.make
@@ -12,7 +12,7 @@ OCAMLFIND ?= ocamlfind
 CFLAGS += -fPIC -I$(shell ocamlc -where)
 
 OCAMLOPTFLAG_G := $(shell $(OCAMLOPT) -h 2>&1 | sed -n 's/^  *\(-g\) .*/\1/p')
-OCAMLOPTFLAGS = $(OCAMLOPTFLAG_G) -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -cc $(CC) -w F -warn-error F
+OCAMLOPTFLAGS = $(OCAMLOPTFLAG_G) -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -w F -warn-error F
 OCAMLCFLAGS += -g $(OCAMLINCLUDE) -w F -warn-error F
 
 VERSION := 4.1
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 19:22:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 19:22:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782993.1192427 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwLU-0005NQ-Fs; Sat, 24 Aug 2024 19:22:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782993.1192427; Sat, 24 Aug 2024 19:22:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwLU-0005NI-Bv; Sat, 24 Aug 2024 19:22:44 +0000
Received: by outflank-mailman (input) for mailman id 782993;
 Sat, 24 Aug 2024 19:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwLS-0005Ms-9Q
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwLS-0008Dp-8K
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwLS-0002UO-7U
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:22:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VcGs3tIIO3mvwNWomohbF3MeC30hC0UoAQuEyykpSTI=; b=ujkPKj5zxK/XD517O4ATkFjLYn
	gp0ucLJAlQTQjmbpU47i0mya5Ar/XcMxGt5Z0tMikMphjKo/LTPbwv4i0V882umq9lu0GKc4+ok/B
	RLqriAMdfR7X+PWbV0kC5F4qomttnwKAprBs7e5nelF5RC0SPTzbmQk6rUnjWA2HneYU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml: Fix OCaml libs rules
Message-Id: <E1shwLS-0002UO-7U@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 19:22:42 +0000

commit 8ffcf184affbc2ff1860dabe1757388509d5ed67
Author:     Andrii Sultanov <andrii.sultanov@cloud.com>
AuthorDate: Thu Aug 22 10:06:05 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 23 10:48:52 2024 +0100

    tools/ocaml: Fix OCaml libs rules
    
    This has been sat in the XenServer patchqueue for more than a decade.
    
    Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/ocaml/Makefile.rules | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules
index 0d3c6ac839..5638193edf 100644
--- a/tools/ocaml/Makefile.rules
+++ b/tools/ocaml/Makefile.rules
@@ -61,18 +61,18 @@ mk-caml-lib-bytecode = $(call quiet-command, $(OCAMLC) $(OCAMLCFLAGS) -a -o $1 $
 
 mk-caml-stubs = $(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a` $2,MKLIB,$1)
 mk-caml-lib-stubs = \
-	$(call quiet-command, $(AR) rcs $1 $2 && $(OCAMLMKLIB) -o `basename $1 .a | sed -e 's/^lib//'` $2,MKLIB,$1)
+	$(call quiet-command, $(OCAMLMKLIB) -o `basename $1 .a | sed -e 's/^lib//'` $2 $3,MKLIB,$1)
 
 # define a library target <name>.cmxa and <name>.cma
 define OCAML_LIBRARY_template
  $(1).cmxa: lib$(1)_stubs.a $(foreach obj,$($(1)_OBJS),$(obj).cmx)
 	$(call mk-caml-lib-native,$$@, -cclib -l$(1)_stubs $(foreach lib,$(LIBS_$(1)),-cclib $(lib)), $(foreach obj,$($(1)_OBJS),$(obj).cmx))
  $(1).cma: $(foreach obj,$($(1)_OBJS),$(obj).cmo)
-	$(call mk-caml-lib-bytecode,$$@, -dllib dll$(1)_stubs.so -cclib -l$(1)_stubs, $$+)
+	$(call mk-caml-lib-bytecode,$$@, -dllib dll$(1)_stubs.so -cclib -l$(1)_stubs $(foreach lib,$(LIBS_$(1)),-cclib $(lib)), $$+)
  $(1)_stubs.a: $(foreach obj,$$($(1)_C_OBJS),$(obj).o)
 	$(call mk-caml-stubs,$$@, $$+)
  lib$(1)_stubs.a: $(foreach obj,$($(1)_C_OBJS),$(obj).o)
-	$(call mk-caml-lib-stubs,$$@, $$+)
+	$(call mk-caml-lib-stubs,$$@, $$+, $(foreach lib,$(LIBS_$(1)),$(lib)))
 endef
 
 define OCAML_NOC_LIBRARY_template
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 19:22:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 19:22:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782994.1192430 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwLe-0005Qa-GM; Sat, 24 Aug 2024 19:22:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782994.1192430; Sat, 24 Aug 2024 19:22:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwLe-0005QS-DY; Sat, 24 Aug 2024 19:22:54 +0000
Received: by outflank-mailman (input) for mailman id 782994;
 Sat, 24 Aug 2024 19:22:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwLc-0005QG-C4
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwLc-0008Dx-BM
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwLc-0002Uw-AT
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:22:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xKmOz0iD2ank4WkhqWHQM3Xo7GCwRAWacf9gwk6bNAM=; b=1zdcHA5KBW1RfkKbAy+shCJWwK
	v2kuCdIkyRZFL1s6h71TeBh0aF0DgMlxgM4lwXS2ZBQjGbFhrhPLg4B52qfbhkn8sjxH/0l0OOEa7
	e34cINEfT4zDUidGUbCV+NCVGLqP79Py215JQc9ec9ykNV+tBKV9i+yuWNVHXLufdxRA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml: Drop the OCAMLOPTFLAG_G invocation
Message-Id: <E1shwLc-0002Uw-AT@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 19:22:52 +0000

commit 126293eae6485089471ebdfd91fe944a0274e613
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 23 10:52:41 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 23 15:02:27 2024 +0100

    tools/ocaml: Drop the OCAMLOPTFLAG_G invocation
    
    These days, `ocamlopt -h` asks you whether you meant --help instead, meaning
    that the $(shell ) invocation here isn't going end up containing '-g'.
    
    Make it unconditional, like it is in OCAMLCFLAGS already.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Reviewed-by: Edwin Török <edwin.torok@cloud.com>
---
 tools/ocaml/common.make | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/ocaml/common.make b/tools/ocaml/common.make
index cc126b749f..708d74617c 100644
--- a/tools/ocaml/common.make
+++ b/tools/ocaml/common.make
@@ -11,8 +11,7 @@ OCAMLFIND ?= ocamlfind
 
 CFLAGS += -fPIC -I$(shell ocamlc -where)
 
-OCAMLOPTFLAG_G := $(shell $(OCAMLOPT) -h 2>&1 | sed -n 's/^  *\(-g\) .*/\1/p')
-OCAMLOPTFLAGS = $(OCAMLOPTFLAG_G) -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -w F -warn-error F
+OCAMLOPTFLAGS = -g -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -w F -warn-error F
 OCAMLCFLAGS += -g $(OCAMLINCLUDE) -w F -warn-error F
 
 VERSION := 4.1
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 19:23:03 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 19:23:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782997.1192444 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwLn-0005hm-Pl; Sat, 24 Aug 2024 19:23:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782997.1192444; Sat, 24 Aug 2024 19:23:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwLn-0005hZ-Ml; Sat, 24 Aug 2024 19:23:03 +0000
Received: by outflank-mailman (input) for mailman id 782997;
 Sat, 24 Aug 2024 19:23:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwLm-0005fh-F2
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:23:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwLm-0008EQ-EL
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:23:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwLm-0002Vh-DU
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:23:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VdsRRznzLrmvPtPrsYlGylBB8K3QloX4PKUlZtCnsqQ=; b=XXI8GEikOoPhGCRTAeDj5PVaQA
	TUE5DEhTWtod5xKiwXVRCEv7Lpo6k6xrqJVys+pBTGFEwIp6EFLdhVdE2BBvti35REQ8q6DpnyASA
	WCv9Fg1SDpTpbL8MJFnq153rYmpoFsVqn3fFxnj1SGGLyQEW2GJEho1ThqcPo6RnPQKM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml: Drop the o= variable
Message-Id: <E1shwLm-0002Vh-DU@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 19:23:02 +0000

commit 5246924acf7913854e8422443e390b7ab6dab306
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 23 11:18:25 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 23 15:02:27 2024 +0100

    tools/ocaml: Drop the o= variable
    
    This hides a shell redirection which is quite rude.  It also opencodes
    $(move-if-changed) without the benefit of short-circuiting dependent logic
    when the content hasn't changed.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Reviewed-by: Edwin Török <edwin.torok@cloud.com>
---
 tools/ocaml/Makefile.rules | 5 +++--
 tools/ocaml/common.make    | 2 --
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/ocaml/Makefile.rules b/tools/ocaml/Makefile.rules
index 5638193edf..5d534d8754 100644
--- a/tools/ocaml/Makefile.rules
+++ b/tools/ocaml/Makefile.rules
@@ -40,13 +40,14 @@ ALL_OCAML_OBJS ?= $(OBJS)
 	$(call quiet-command, $(CC) $(CFLAGS) -c -o $@ $<,CC,$@)
 
 META: META.in
-	sed 's/@VERSION@/$(VERSION)/g' < $< $o
+	sed 's/@VERSION@/$(VERSION)/g' < $< > $@.tmp
+	$(call move-if-changed,$@.tmp,$@)
 
 ALL_OCAML_OBJ_SOURCES=$(addsuffix .ml, $(ALL_OCAML_OBJS))
 
 ifneq ($(MAKECMDGOALS),clean)
 .ocamldep.make: $(ALL_OCAML_OBJ_SOURCES) Makefile $(OCAML_TOPLEVEL)/Makefile.rules
-	$(call quiet-command, $(OCAMLDEP) $(ALL_OCAML_OBJ_SOURCES) *.mli $o,MLDEP,)
+	$(call quiet-command, $(OCAMLDEP) $(ALL_OCAML_OBJ_SOURCES) *.mli > $@.tmp; $(call move-if-changed,$@.tmp,$@),MLDEP,)
 endif
 
 clean: $(CLEAN_HOOKS)
diff --git a/tools/ocaml/common.make b/tools/ocaml/common.make
index 708d74617c..979cbe0845 100644
--- a/tools/ocaml/common.make
+++ b/tools/ocaml/common.make
@@ -17,5 +17,3 @@ OCAMLCFLAGS += -g $(OCAMLINCLUDE) -w F -warn-error F
 VERSION := 4.1
 
 OCAMLDESTDIR ?= $(DESTDIR)$(shell $(OCAMLFIND) printconf destdir)
-
-o= >$@.new && mv -f $@.new $@
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 19:23:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 19:23:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.782999.1192448 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwLx-0005n7-Rn; Sat, 24 Aug 2024 19:23:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 782999.1192448; Sat, 24 Aug 2024 19:23: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 1shwLx-0005mz-Op; Sat, 24 Aug 2024 19:23:13 +0000
Received: by outflank-mailman (input) for mailman id 782999;
 Sat, 24 Aug 2024 19:23:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwLw-0005mR-IS
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:23:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwLw-0008Ef-Hl
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:23:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwLw-0002WH-GS
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:23:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1VtUNDCCkrVbcpKgrlbWMto5xqS/lp7M79OdSsEn1/o=; b=oT/iNJQlipPREDmuQjuFebr2XD
	YjaoKX0gcPUIa4NwnBZbKRYU/Uo31hxb+Bf42arooRfPHVqUu9DbeHdfmnLozbEnvzkDBVXX2kbLu
	R++3nsj3fjjfxROzwsZbSg0lx99xF4+BvB0FLQlJx/+p82s0yZFzfrhhsFyIqcmMw19E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/ocaml: Fix the version embedded in META files
Message-Id: <E1shwLw-0002WH-GS@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 19:23:12 +0000

commit 1965e9a930740b37637ac450f4752fd53edf63c4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 23 11:37:35 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 23 15:02:27 2024 +0100

    tools/ocaml: Fix the version embedded in META files
    
    Xen 4.1 is more than a decade stale now.  Use the same mechanism as elsewhere
    in the tree to get the current version number.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
    Reviewed-by: Edwin Török <edwin.torok@cloud.com>
---
 tools/ocaml/common.make | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/common.make b/tools/ocaml/common.make
index 979cbe0845..c7eefceeb4 100644
--- a/tools/ocaml/common.make
+++ b/tools/ocaml/common.make
@@ -14,6 +14,6 @@ CFLAGS += -fPIC -I$(shell ocamlc -where)
 OCAMLOPTFLAGS = -g -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -w F -warn-error F
 OCAMLCFLAGS += -g $(OCAMLINCLUDE) -w F -warn-error F
 
-VERSION := 4.1
+VERSION := $(shell $(XEN_ROOT)/version.sh $(XEN_ROOT)/xen/Makefile)
 
 OCAMLDESTDIR ?= $(DESTDIR)$(shell $(OCAMLFIND) printconf destdir)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 19:23:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 19:23:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.783001.1192451 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwM7-0005vH-Sv; Sat, 24 Aug 2024 19:23:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 783001.1192451; Sat, 24 Aug 2024 19:23: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 1shwM7-0005v9-QH; Sat, 24 Aug 2024 19:23:23 +0000
Received: by outflank-mailman (input) for mailman id 783001;
 Sat, 24 Aug 2024 19:23:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwM6-0005uo-LY
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:23:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwM6-0008F2-Km
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:23:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwM6-0002XM-Jz
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:23:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UmeiQTF/jHssSiJlXCK8aTHgqoMN87Izqx2qWc1qKCU=; b=u3lEkNkY3qxZ9VE6743oSwH5wT
	TXwvOK7UN2aobGva8HXtCxKO5oYCf8i8p3HYDHqtA4j1adan2K3+peCR8LGSrZ+yxsqFd/rokmL9e
	UBJEL2f23GjmJpTtIxYyxgwS2ySd6ZB/k+XnbOZDytolRJG/hG7Id6BKoQX21egWjvps=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xen-ucode: Refactor to use getopt for cmdline handling
Message-Id: <E1shwM6-0002XM-Jz@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 19:23:22 +0000

commit e2c40d1e69543c6b4807b9d127f3fc6f8bae9fd4
Author:     Fouad Hilly <fouad.hilly@cloud.com>
AuthorDate: Thu Aug 22 14:04:24 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 23 18:47:19 2024 +0100

    tools/xen-ucode: Refactor to use getopt for cmdline handling
    
    Use getopt_long() to handle command line arguments.
    Introduce ext_err for common errors exit.
    
    Signed-off-by: Fouad Hilly <fouad.hilly@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/misc/xen-ucode.c | 56 ++++++++++++++++++++++++++++++++++++++++++--------
 1 file changed, 48 insertions(+), 8 deletions(-)

diff --git a/tools/misc/xen-ucode.c b/tools/misc/xen-ucode.c
index 390969db3d..e4a846c8dc 100644
--- a/tools/misc/xen-ucode.c
+++ b/tools/misc/xen-ucode.c
@@ -11,6 +11,7 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <xenctrl.h>
+#include <getopt.h>
 
 static xc_interface *xch;
 
@@ -71,12 +72,31 @@ static void show_curr_cpu(FILE *f)
     }
 }
 
+static void usage(FILE *stream, const char *name)
+{
+    fprintf(stream,
+            "%s: Xen microcode updating tool\n"
+            "Usage: %s [options] [<microcode file> | show-cpu-info]\n"
+            "options:\n"
+            "  -h, --help               display this help\n"
+            "  -s, --show-cpu-info      show CPU information\n",
+            name, name);
+    show_curr_cpu(stream);
+}
+
 int main(int argc, char *argv[])
 {
+    static const struct option options[] = {
+        { "help",          no_argument, NULL, 'h' },
+        { "show-cpu-info", no_argument, NULL, 's' },
+        {}
+    };
+
     int fd, ret;
     char *filename, *buf;
     size_t len;
     struct stat st;
+    int opt;
 
     xch = xc_interface_open(NULL, NULL, 0);
     if ( xch == NULL )
@@ -86,22 +106,38 @@ int main(int argc, char *argv[])
         exit(1);
     }
 
-    if ( argc < 2 )
+    while ( (opt = getopt_long(argc, argv, "hs", options, NULL)) != -1 )
     {
-        fprintf(stderr,
-                "xen-ucode: Xen microcode updating tool\n"
-                "Usage: %s [<microcode file> | show-cpu-info]\n", argv[0]);
-        show_curr_cpu(stderr);
-        exit(2);
+        switch ( opt )
+        {
+        case 'h':
+            usage(stdout, argv[0]);
+            exit(EXIT_SUCCESS);
+
+        case 's':
+            show_curr_cpu(stdout);
+            exit(EXIT_SUCCESS);
+
+        default:
+            fprintf(stderr, "%s: unknown option\n", argv[0]);
+            goto ext_err;
+        }
     }
 
-    if ( !strcmp(argv[1], "show-cpu-info") )
+    if ( optind == argc )
+    {
+        fprintf(stderr, "%s: missing microcode file\n", argv[0]);
+        goto ext_err;
+    }
+
+    /* For backwards compatibility to the pre-getopt() cmdline handling */
+    if ( !strcmp(argv[optind], "show-cpu-info") )
     {
         show_curr_cpu(stdout);
         return 0;
     }
 
-    filename = argv[1];
+    filename = argv[optind];
     fd = open(filename, O_RDONLY);
     if ( fd < 0 )
     {
@@ -146,4 +182,8 @@ int main(int argc, char *argv[])
     close(fd);
 
     return 0;
+
+ ext_err:
+    usage(stderr, argv[0]);
+    exit(EXIT_FAILURE);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 19:23:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 19:23:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.783004.1192456 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwMH-000624-Vw; Sat, 24 Aug 2024 19:23:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 783004.1192456; Sat, 24 Aug 2024 19:23: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 1shwMH-00061w-T5; Sat, 24 Aug 2024 19:23:33 +0000
Received: by outflank-mailman (input) for mailman id 783004;
 Sat, 24 Aug 2024 19:23:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwMG-00061f-Oe
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:23:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwMG-0008FF-Nr
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:23:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwMG-0002Xv-N4
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:23:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xtbWNqPzswPTVIZj7hRVUj6GkXRhXhDEI5FhA+CA54w=; b=adWmQd5Xhrq4FNqJUKySPn2mZU
	c4Et5ZrZ/qh5KW0v7IoUlFNVVaWNRLJQbCygz9Roq98mbvMMEpzWi7KTGjO2o2T59q1ARY6GrV7rd
	MRRVrFuI0XyaQ/o3CizxbeMDaDBd9Um8ypdLmIRaRW2yOlraufT8iutJxFBtqV9TCpIA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xen-ucode: Introduce a --force option to xen-ucode
Message-Id: <E1shwMG-0002Xv-N4@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 19:23:32 +0000

commit 9db5e896ec91d6318c91d1d66eb8bd7fc57c6389
Author:     Fouad Hilly <fouad.hilly@cloud.com>
AuthorDate: Thu Aug 22 14:04:25 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 23 18:50:00 2024 +0100

    tools/xen-ucode: Introduce a --force option to xen-ucode
    
    Introduce a --force option to xen-ucode, in order to bypass certain checks
    when applying microcode.
    
    Update libxc's xc_microcode_update() to take an extra parameter, and to use
    the new XENPF_microcode_update2 hypercall instead.
    
    Signed-off-by: Fouad Hilly <fouad.hilly@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/include/xenctrl.h   |  3 ++-
 tools/libs/ctrl/xc_misc.c | 12 +++++++-----
 tools/misc/xen-ucode.c    | 17 ++++++++++++++---
 3 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 9ceca0cffc..2c4608c09a 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -1171,7 +1171,8 @@ typedef uint32_t xc_node_to_node_dist_t;
 int xc_physinfo(xc_interface *xch, xc_physinfo_t *info);
 int xc_cputopoinfo(xc_interface *xch, unsigned *max_cpus,
                    xc_cputopo_t *cputopo);
-int xc_microcode_update(xc_interface *xch, const void *buf, size_t len);
+int xc_microcode_update(xc_interface *xch, const void *buf,
+                        size_t len, unsigned int flags);
 int xc_get_cpu_version(xc_interface *xch, struct xenpf_pcpu_version *cpu_ver);
 int xc_get_ucode_revision(xc_interface *xch,
                           struct xenpf_ucode_revision *ucode_rev);
diff --git a/tools/libs/ctrl/xc_misc.c b/tools/libs/ctrl/xc_misc.c
index 50282fd60d..6a60216bda 100644
--- a/tools/libs/ctrl/xc_misc.c
+++ b/tools/libs/ctrl/xc_misc.c
@@ -203,11 +203,12 @@ int xc_physinfo(xc_interface *xch,
     return 0;
 }
 
-int xc_microcode_update(xc_interface *xch, const void *buf, size_t len)
+int xc_microcode_update(xc_interface *xch, const void *buf,
+                        size_t len, unsigned int flags)
 {
     int ret;
     struct xen_platform_op platform_op = {};
-    DECLARE_HYPERCALL_BUFFER(struct xenpf_microcode_update, uc);
+    DECLARE_HYPERCALL_BUFFER(struct xenpf_microcode_update2, uc);
 
     uc = xc_hypercall_buffer_alloc(xch, uc, len);
     if ( uc == NULL )
@@ -215,9 +216,10 @@ int xc_microcode_update(xc_interface *xch, const void *buf, size_t len)
 
     memcpy(uc, buf, len);
 
-    platform_op.cmd = XENPF_microcode_update;
-    platform_op.u.microcode.length = len;
-    set_xen_guest_handle(platform_op.u.microcode.data, uc);
+    platform_op.cmd = XENPF_microcode_update2;
+    platform_op.u.microcode2.length = len;
+    platform_op.u.microcode2.flags = flags;
+    set_xen_guest_handle(platform_op.u.microcode2.data, uc);
 
     ret = do_platform_op(xch, &platform_op);
 
diff --git a/tools/misc/xen-ucode.c b/tools/misc/xen-ucode.c
index e4a846c8dc..1f4ca0f162 100644
--- a/tools/misc/xen-ucode.c
+++ b/tools/misc/xen-ucode.c
@@ -13,6 +13,8 @@
 #include <xenctrl.h>
 #include <getopt.h>
 
+#include <xen/platform.h>
+
 static xc_interface *xch;
 
 static const char intel_id[] = "GenuineIntel";
@@ -79,7 +81,10 @@ static void usage(FILE *stream, const char *name)
             "Usage: %s [options] [<microcode file> | show-cpu-info]\n"
             "options:\n"
             "  -h, --help               display this help\n"
-            "  -s, --show-cpu-info      show CPU information\n",
+            "  -s, --show-cpu-info      show CPU information\n"
+            "  -f, --force              skip certain checks when applying\n"
+            "                           microcode; do not use unless you know\n"
+            "                           exactly what you are doing\n",
             name, name);
     show_curr_cpu(stream);
 }
@@ -89,6 +94,7 @@ int main(int argc, char *argv[])
     static const struct option options[] = {
         { "help",          no_argument, NULL, 'h' },
         { "show-cpu-info", no_argument, NULL, 's' },
+        { "force",         no_argument, NULL, 'f' },
         {}
     };
 
@@ -97,6 +103,7 @@ int main(int argc, char *argv[])
     size_t len;
     struct stat st;
     int opt;
+    uint32_t ucode_flags = 0;
 
     xch = xc_interface_open(NULL, NULL, 0);
     if ( xch == NULL )
@@ -106,7 +113,7 @@ int main(int argc, char *argv[])
         exit(1);
     }
 
-    while ( (opt = getopt_long(argc, argv, "hs", options, NULL)) != -1 )
+    while ( (opt = getopt_long(argc, argv, "hsf", options, NULL)) != -1 )
     {
         switch ( opt )
         {
@@ -118,6 +125,10 @@ int main(int argc, char *argv[])
             show_curr_cpu(stdout);
             exit(EXIT_SUCCESS);
 
+        case 'f':
+            ucode_flags |= XENPF_UCODE_FORCE;
+            break;
+
         default:
             fprintf(stderr, "%s: unknown option\n", argv[0]);
             goto ext_err;
@@ -162,7 +173,7 @@ int main(int argc, char *argv[])
     }
 
     errno = 0;
-    ret = xc_microcode_update(xch, buf, len);
+    ret = xc_microcode_update(xch, buf, len, ucode_flags);
     if ( ret == -1 && errno == EEXIST )
         printf("Microcode already up to date\n");
     else if ( ret )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 19:23:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 19:23:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.783006.1192460 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwMS-00067o-1u; Sat, 24 Aug 2024 19:23:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 783006.1192460; Sat, 24 Aug 2024 19:23:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwMR-00067c-Uq; Sat, 24 Aug 2024 19:23:43 +0000
Received: by outflank-mailman (input) for mailman id 783006;
 Sat, 24 Aug 2024 19:23:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwMQ-00066J-Rp
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:23:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwMQ-0008FM-R8
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:23:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwMQ-0002YY-QP
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:23:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2T00xf4BG6iZqDQoReroyY4V8uoqEXXqaQTsq6oHncA=; b=ghkjkTUBpOifSImGo/1He4daa8
	OrjfCzJ7Ti4UrVsMvwdMncJVMpeFwQKqrFkxdPbKQBshxRsZSaaRd6SbsUBM2QSLpUsDkFMmgR0WW
	cxPV4zHFYIGHgIDvlkr3leO+MSOgNYX11IJ8n5CHyM8gEhD11LgZ1i3/+1JET7w5hKoE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/bitops: Rename for_each_set_bit() to bitmap_for_each()
Message-Id: <E1shwMQ-0002YY-QP@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 19:23:42 +0000

commit fbad3859821f3ed534f2a237fd60bf70903a5c3a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jun 18 23:23:11 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 23 21:50:57 2024 +0100

    xen/bitops: Rename for_each_set_bit() to bitmap_for_each()
    
    The current implementation wants to take an in-memory bitmap.  However, all
    ARM callers and all-but-1 x86 callers spill a scalar to the stack in order to
    use the "generic arbitrary bitmap" helpers under the hood.
    
    This works, but is far from ideal.
    
    Rename the construct and move it into bitmap.h, because having an iterator for
    an arbitrary bitmap is a useful thing.
    
    This will allow us to re-implement for_each_set_bit() to be more appropriate
    for scalar values.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/gic-vgic.c          |  2 +-
 xen/arch/arm/vgic.c              |  6 +++---
 xen/arch/arm/vgic/vgic-mmio-v2.c |  2 +-
 xen/arch/arm/vgic/vgic-mmio.c    | 12 ++++++------
 xen/arch/x86/cpu-policy.c        |  8 ++++----
 xen/arch/x86/hvm/vmx/vmx.c       |  2 +-
 xen/arch/x86/xstate.c            |  4 ++--
 xen/include/xen/bitmap.h         | 12 ++++++++++++
 xen/include/xen/bitops.h         | 11 -----------
 9 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/xen/arch/arm/gic-vgic.c b/xen/arch/arm/gic-vgic.c
index b99e287224..9aa245a36d 100644
--- a/xen/arch/arm/gic-vgic.c
+++ b/xen/arch/arm/gic-vgic.c
@@ -111,7 +111,7 @@ static unsigned int gic_find_unused_lr(struct vcpu *v,
     {
         unsigned int used_lr;
 
-        for_each_set_bit(used_lr, lr_mask, nr_lrs)
+        bitmap_for_each ( used_lr, lr_mask, nr_lrs )
         {
             gic_hw_ops->read_lr(used_lr, &lr_val);
             if ( lr_val.virq == p->irq )
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index c04fc4f83f..3fe1d89c4d 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -429,7 +429,7 @@ void vgic_set_irqs_pending(struct vcpu *v, uint32_t r, unsigned int rank)
     /* LPIs will never be set pending via this function */
     ASSERT(!is_lpi(32 * rank + 31));
 
-    for_each_set_bit( i, &mask, 32 )
+    bitmap_for_each ( i, &mask, 32 )
     {
         unsigned int irq = i + 32 * rank;
 
@@ -483,7 +483,7 @@ bool vgic_to_sgi(struct vcpu *v, register_t sgir, enum gic_sgi_mode irqmode,
         perfc_incr(vgic_sgi_list);
         base = target->aff1 << 4;
         bitmap = target->list;
-        for_each_set_bit( i, &bitmap, sizeof(target->list) * 8 )
+        bitmap_for_each ( i, &bitmap, sizeof(target->list) * 8 )
         {
             vcpuid = base + i;
             if ( vcpuid >= d->max_vcpus || d->vcpu[vcpuid] == NULL ||
@@ -728,7 +728,7 @@ void vgic_check_inflight_irqs_pending(struct domain *d, struct vcpu *v,
     const unsigned long mask = r;
     unsigned int i;
 
-    for_each_set_bit( i, &mask, 32 )
+    bitmap_for_each ( i, &mask, 32 )
     {
         struct pending_irq *p;
         struct vcpu *v_target;
diff --git a/xen/arch/arm/vgic/vgic-mmio-v2.c b/xen/arch/arm/vgic/vgic-mmio-v2.c
index 2e507b10fe..670b335db2 100644
--- a/xen/arch/arm/vgic/vgic-mmio-v2.c
+++ b/xen/arch/arm/vgic/vgic-mmio-v2.c
@@ -108,7 +108,7 @@ static void vgic_mmio_write_sgir(struct vcpu *source_vcpu,
         return;
     }
 
-    for_each_set_bit( vcpu_id, &targets, 8 )
+    bitmap_for_each ( vcpu_id, &targets, 8 )
     {
         struct vcpu *vcpu = d->vcpu[vcpu_id];
         struct vgic_irq *irq = vgic_get_irq(d, vcpu, intid);
diff --git a/xen/arch/arm/vgic/vgic-mmio.c b/xen/arch/arm/vgic/vgic-mmio.c
index 5d935a7301..bd4caf7fc3 100644
--- a/xen/arch/arm/vgic/vgic-mmio.c
+++ b/xen/arch/arm/vgic/vgic-mmio.c
@@ -71,7 +71,7 @@ void vgic_mmio_write_senable(struct vcpu *vcpu,
     uint32_t intid = VGIC_ADDR_TO_INTID(addr, 1);
     unsigned int i;
 
-    for_each_set_bit( i, &val, len * 8 )
+    bitmap_for_each ( i, &val, len * 8 )
     {
         struct vgic_irq *irq = vgic_get_irq(vcpu->domain, vcpu, intid + i);
         unsigned long flags;
@@ -116,7 +116,7 @@ void vgic_mmio_write_cenable(struct vcpu *vcpu,
     uint32_t intid = VGIC_ADDR_TO_INTID(addr, 1);
     unsigned int i;
 
-    for_each_set_bit( i, &val, len * 8 )
+    bitmap_for_each ( i, &val, len * 8 )
     {
         struct vgic_irq *irq;
         unsigned long flags;
@@ -186,7 +186,7 @@ void vgic_mmio_write_spending(struct vcpu *vcpu,
     unsigned long flags;
     irq_desc_t *desc;
 
-    for_each_set_bit( i, &val, len * 8 )
+    bitmap_for_each ( i, &val, len * 8 )
     {
         struct vgic_irq *irq = vgic_get_irq(vcpu->domain, vcpu, intid + i);
 
@@ -234,7 +234,7 @@ void vgic_mmio_write_cpending(struct vcpu *vcpu,
     unsigned long flags;
     irq_desc_t *desc;
 
-    for_each_set_bit( i, &val, len * 8 )
+    bitmap_for_each ( i, &val, len * 8 )
     {
         struct vgic_irq *irq = vgic_get_irq(vcpu->domain, vcpu, intid + i);
 
@@ -328,7 +328,7 @@ void vgic_mmio_write_cactive(struct vcpu *vcpu,
     uint32_t intid = VGIC_ADDR_TO_INTID(addr, 1);
     unsigned int i;
 
-    for_each_set_bit( i, &val, len * 8 )
+    bitmap_for_each ( i, &val, len * 8 )
     {
         struct vgic_irq *irq = vgic_get_irq(vcpu->domain, vcpu, intid + i);
 
@@ -358,7 +358,7 @@ void vgic_mmio_write_sactive(struct vcpu *vcpu,
     uint32_t intid = VGIC_ADDR_TO_INTID(addr, 1);
     unsigned int i;
 
-    for_each_set_bit( i, &val, len * 8 )
+    bitmap_for_each ( i, &val, len * 8 )
     {
         struct vgic_irq *irq = vgic_get_irq(vcpu->domain, vcpu, intid + i);
 
diff --git a/xen/arch/x86/cpu-policy.c b/xen/arch/x86/cpu-policy.c
index 304dc20cfa..649ab6088f 100644
--- a/xen/arch/x86/cpu-policy.c
+++ b/xen/arch/x86/cpu-policy.c
@@ -157,7 +157,7 @@ static void zero_leaves(struct cpuid_leaf *l,
 
 static void sanitise_featureset(uint32_t *fs)
 {
-    /* for_each_set_bit() uses unsigned longs.  Extend with zeroes. */
+    /* bitmap_for_each() uses unsigned longs.  Extend with zeroes. */
     uint32_t disabled_features[
         ROUNDUP(FSCAPINTS, sizeof(unsigned long)/sizeof(uint32_t))] = {};
     unsigned int i;
@@ -174,8 +174,8 @@ static void sanitise_featureset(uint32_t *fs)
         disabled_features[i] = ~fs[i] & deep_features[i];
     }
 
-    for_each_set_bit(i, (void *)disabled_features,
-                     sizeof(disabled_features) * 8)
+    bitmap_for_each ( i, (void *)disabled_features,
+                      sizeof(disabled_features) * 8 )
     {
         const uint32_t *dfs = x86_cpu_policy_lookup_deep_deps(i);
         unsigned int j;
@@ -237,7 +237,7 @@ static void recalculate_xstate(struct cpu_policy *p)
     /* Subleafs 2+ */
     xstates &= ~XSTATE_FP_SSE;
     BUILD_BUG_ON(ARRAY_SIZE(p->xstate.comp) < 63);
-    for_each_set_bit ( i, &xstates, 63 )
+    bitmap_for_each ( i, &xstates, 63 )
     {
         /*
          * Pass through size (eax) and offset (ebx) directly.  Visbility of
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 2f7add834a..12f8a66458 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -2327,7 +2327,7 @@ static void cf_check vmx_sync_pir_to_irr(struct vcpu *v)
     for ( group = 0; group < ARRAY_SIZE(pending_intr); group++ )
         pending_intr[group] = pi_get_pir(&v->arch.hvm.vmx.pi_desc, group);
 
-    for_each_set_bit(i, pending_intr, X86_NR_VECTORS)
+    bitmap_for_each ( i, pending_intr, X86_NR_VECTORS )
         vlapic_set_vector(i, &vlapic->regs->data[APIC_IRR]);
 }
 
diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 1e1abfc029..13fae41504 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -606,7 +606,7 @@ unsigned int xstate_uncompressed_size(uint64_t xcr0)
      * with respect their index.
      */
     xcr0 &= ~(X86_XCR0_SSE | X86_XCR0_X87);
-    for_each_set_bit ( i, &xcr0, 63 )
+    bitmap_for_each ( i, &xcr0, 63 )
     {
         const struct xstate_component *c = &raw_cpu_policy.xstate.comp[i];
         unsigned int s = c->offset + c->size;
@@ -634,7 +634,7 @@ unsigned int xstate_compressed_size(uint64_t xstates)
      * componenets require aligning to 64 first.
      */
     xstates &= ~(X86_XCR0_SSE | X86_XCR0_X87);
-    for_each_set_bit ( i, &xstates, 63 )
+    bitmap_for_each ( i, &xstates, 63 )
     {
         const struct xstate_component *c = &raw_cpu_policy.xstate.comp[i];
 
diff --git a/xen/include/xen/bitmap.h b/xen/include/xen/bitmap.h
index 6ee39aa35a..5d668053b0 100644
--- a/xen/include/xen/bitmap.h
+++ b/xen/include/xen/bitmap.h
@@ -274,6 +274,18 @@ static inline void bitmap_clear(unsigned long *map, unsigned int start,
 #undef bitmap_switch
 #undef bitmap_bytes
 
+/**
+ * bitmap_for_each - bitate over every set bit in a memory region
+ * @bit: The integer bitator
+ * @addr: The address to base the search on
+ * @size: The maximum size to search
+ */
+#define bitmap_for_each(bit, addr, size)                        \
+    for ( (bit) = find_first_bit(addr, size);                   \
+          (bit) < (size);                                       \
+          (bit) = find_next_bit(addr, size, (bit) + 1) )
+
+
 struct xenctl_bitmap;
 int xenctl_bitmap_to_bitmap(unsigned long *bitmap,
                             const struct xenctl_bitmap *xenctl_bitmap,
diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index 3d88d2f3f1..fbbab96c97 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -428,17 +428,6 @@ static inline __u32 ror32(__u32 word, unsigned int shift)
 #define __L16(x) (((x) & 0x0000ff00U) ? ( 8 + __L8( (x) >> 8))  : __L8( x))
 #define ilog2(x) (((x) & 0xffff0000U) ? (16 + __L16((x) >> 16)) : __L16(x))
 
-/**
- * for_each_set_bit - iterate over every set bit in a memory region
- * @bit: The integer iterator
- * @addr: The address to base the search on
- * @size: The maximum size to search
- */
-#define for_each_set_bit(bit, addr, size)               \
-    for ( (bit) = find_first_bit(addr, size);           \
-          (bit) < (size);                               \
-          (bit) = find_next_bit(addr, size, (bit) + 1) )
-
 #define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
 
 #endif /* XEN_BITOPS_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 19:23:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 19:23:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.783008.1192463 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwMc-0006BP-30; Sat, 24 Aug 2024 19:23:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 783008.1192463; Sat, 24 Aug 2024 19:23:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwMc-0006BH-0G; Sat, 24 Aug 2024 19:23:54 +0000
Received: by outflank-mailman (input) for mailman id 783008;
 Sat, 24 Aug 2024 19:23:53 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwMa-0006B3-VO
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:23:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwMa-0008FT-Tx
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:23:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwMa-0002ZF-TF
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:23:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9FFN1d/Vq3IHKue9pcAO4doIHai4U6cmNjasEhWPBPo=; b=fmWCv47icyY7GrBAA+60+zbQmS
	0er97ymRFDUNt7ejvagmXINXfquAH+BpfgZF5/o3ZltMrYS+eiAOZENd41zFwfx/WkN7kKQWfypyC
	aDu07Drs2vM78ytM5TBqQpi0B6ieN46kXrr2nalydUc31DZlgXhlOIR4ATvlGfbUvii4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/macros: Introduce BUILD_ERROR()
Message-Id: <E1shwMa-0002ZF-TF@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 19:23:52 +0000

commit 1b30ac12814cce506193fc39acce45b131fad8e8
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 19 15:46:47 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 23 21:50:57 2024 +0100

    xen/macros: Introduce BUILD_ERROR()
    
    ... and use it in self-tests.h.
    
    This is intended to replace constructs such as __bitop_bad_size().  It
    produces a better diagnostic, and is MISRA-friendly.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/macros.h     | 8 ++++++++
 xen/include/xen/self-tests.h | 4 ++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/xen/include/xen/macros.h b/xen/include/xen/macros.h
index ec89f4654f..44d723fd12 100644
--- a/xen/include/xen/macros.h
+++ b/xen/include/xen/macros.h
@@ -59,6 +59,14 @@
 #define BUILD_BUG_ON(cond) ((void)BUILD_BUG_ON_ZERO(cond))
 #endif
 
+/*
+ * Force a compilation error.  This is for code which, in the normal case,
+ * should be Dead Code Eliminated, but a failure to eliminate constitutes an
+ * error.  e.g. behind a __builtin_constant_p(), or an illegal case within a
+ * switch(sizeof(...)) construct.
+ */
+#define BUILD_ERROR(msg) asm ( ".error \"" msg "\"" )
+
 /* Hide a value from the optimiser. */
 #define HIDE(x)                                 \
     ({                                          \
diff --git a/xen/include/xen/self-tests.h b/xen/include/xen/self-tests.h
index 58484fe5a8..e9a8794893 100644
--- a/xen/include/xen/self-tests.h
+++ b/xen/include/xen/self-tests.h
@@ -22,9 +22,9 @@
         typeof((fn)(val)) real = (fn)(val);                             \
                                                                         \
         if ( !__builtin_constant_p(real) )                              \
-            asm ( ".error \"'" STR(fn(val)) "' not compile-time constant\"" ); \
+            BUILD_ERROR("'" STR(fn(val)) "' not compile-time constant"); \
         else if ( real != (res) )                                       \
-            asm ( ".error \"Compile time check '" STR(fn(val) == res) "' failed\"" ); \
+            BUILD_ERROR("Compile time check '" STR(fn(val) == res) "' failed"); \
     } while ( 0 )
 #else
 #define COMPILE_CHECK(fn, val, res)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 19:24:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 19:24:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.783009.1192467 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwMm-0006ED-4F; Sat, 24 Aug 2024 19:24:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 783009.1192467; Sat, 24 Aug 2024 19:24: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 1shwMm-0006E6-1p; Sat, 24 Aug 2024 19:24:04 +0000
Received: by outflank-mailman (input) for mailman id 783009;
 Sat, 24 Aug 2024 19:24:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwMl-0006Du-3D
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:24:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwMl-0008Fo-0Y
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:24:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwMk-0002aT-W4
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:24: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=b8zY+0Uxe0pKVhCbgUrlMSZlHQh336Hv9BX+mGOF9vE=; b=t1De8rGcpM5KsgizqfEZ8glxlk
	5XG75w5t1hbesVFOHu9IZoWPZNinMrjxJ7z7nELA0pRrZioJd7JX98hgTvXt1yBOqNPrzA6T8rY34
	2nSOHzESU7JLpvfpwjzSorzVXH52NF3usDlsGaKohvOc7JIaYWCp+OgRILkRHC7OOvxM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/bitops: Introduce for_each_set_bit()
Message-Id: <E1shwMk-0002aT-W4@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 19:24:02 +0000

commit ed26376f20bffc8b542e2434a2643a1d788012d5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 19 15:46:47 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 23 21:50:57 2024 +0100

    xen/bitops: Introduce for_each_set_bit()
    
    The prior version (renamed to bitmap_for_each()) was inefficeint when used
    over a scalar, but this is the more common usage even before accounting for
    the many opencoded forms.
    
    Introduce a new version which operates on scalars only and does so without
    spilling them to memory.  This in turn requires the addition of a type-generic
    form of ffs().
    
    Add testing for the new construct alongside the ffs/fls testing.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/bitops.c      | 29 +++++++++++++++++++++++++++++
 xen/include/xen/bitops.h | 24 ++++++++++++++++++++++++
 2 files changed, 53 insertions(+)

diff --git a/xen/common/bitops.c b/xen/common/bitops.c
index 94a8983af9..9e532f0d87 100644
--- a/xen/common/bitops.c
+++ b/xen/common/bitops.c
@@ -84,8 +84,37 @@ static void __init test_fls(void)
     CHECK(fls64, 0x8000000000000001ULL, 64);
 }
 
+static void __init test_for_each_set_bit(void)
+{
+    unsigned int  ui,  ui_res = 0;
+    unsigned long ul,  ul_res = 0;
+    uint64_t      ull, ull_res = 0;
+
+    ui = HIDE(0x80008001U);
+    for_each_set_bit ( i, ui )
+        ui_res |= 1U << i;
+
+    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);
+    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);
+    for_each_set_bit ( i, ull )
+        ull_res |= 1ULL << i;
+
+    if ( ull != ull_res )
+        panic("for_each_set_bit(uint64) expected %#"PRIx64", got %#"PRIx64"\n", ull, ull_res);
+}
+
 static void __init __constructor test_bitops(void)
 {
     test_ffs();
     test_fls();
+    test_for_each_set_bit();
 }
diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index fbbab96c97..1cd43e464d 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -236,6 +236,16 @@ static always_inline __pure unsigned int ffs64(uint64_t x)
         return !x || (uint32_t)x ? ffs(x) : ffs(x >> 32) + 32;
 }
 
+/*
+ * A type-generic ffs() which picks the appropriate ffs{,l,64}() based on it's
+ * argument.
+ */
+#define ffs_g(x)                                        \
+    (sizeof(x) <= sizeof(int)      ? ffs(x) :           \
+     sizeof(x) <= sizeof(long)     ? ffsl(x) :          \
+     sizeof(x) <= sizeof(uint64_t) ? ffs64(x) :         \
+     ({ BUILD_ERROR("ffs_g() Bad input type"); 0; }))
+
 static always_inline __pure unsigned int fls(unsigned int x)
 {
     if ( __builtin_constant_p(x) )
@@ -272,6 +282,20 @@ static always_inline __pure unsigned int fls64(uint64_t x)
     }
 }
 
+/*
+ * for_each_set_bit() - Iterate over all set bits in a scalar value.
+ *
+ * @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(iter, val)                     \
+    for ( typeof(val) __v = (val); __v; )               \
+        for ( unsigned int (iter);                      \
+              __v && ((iter) = ffs_g(__v) - 1, true);   \
+              __v &= __v - 1 )
+
 /* --------------------- Please tidy below here --------------------- */
 
 #ifndef find_next_bit
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 19:24:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 19:24:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.783010.1192473 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwMw-0006I7-7J; Sat, 24 Aug 2024 19:24:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 783010.1192473; Sat, 24 Aug 2024 19:24: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 1shwMw-0006Hz-3G; Sat, 24 Aug 2024 19:24:14 +0000
Received: by outflank-mailman (input) for mailman id 783010;
 Sat, 24 Aug 2024 19:24:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwMv-0006H6-46
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:24:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwMv-0008Fx-3P
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:24:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwMv-0002bE-2c
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:24:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RjfdzgXw8yuHNMyH8QylkAPgTe2x10UJrTLam3iC4o4=; b=2oThqh+WxWOajIv282ohp7Kl0S
	FSctxUW28if8aDgx/ioeZnfDR1s7kI6XyqmMr7/2icGlGNUBUr6hAO9umjHTZrrRdA3VT5cELiF8I
	wQ8+/D3pu6SHxoeXTSR6hKOkN+0j1fjMlz+NmR3S/ItSXJvFR460UZfaGXklUpt4oTpI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ARM/vgic: Use for_each_set_bit() in vgic_set_irqs_pending()
Message-Id: <E1shwMv-0002bE-2c@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 19:24:13 +0000

commit 2387c460eb103a37f1772d82be91b67518522372
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 19 01:58:35 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 23 21:50:57 2024 +0100

    ARM/vgic: Use for_each_set_bit() in vgic_set_irqs_pending()
    
    ... which is better optimised for scalar values, rather than using the
    arbitrary-sized bitmap helpers.
    
    For ARM32:
    
      add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-16 (-16)
      Function                                     old     new   delta
      vgic_set_irqs_pending                        284     268     -16
    
    including removing calls to _find_{first,next}_bit_le(), and two stack-spilled
    words too.
    
    For ARM64:
    
      add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-40 (-40)
      Function                                     old     new   delta
      vgic_set_irqs_pending                        268     228     -40
    
    including removing three calls to find_next_bit().
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/vgic.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 3fe1d89c4d..905e5eeb66 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -421,15 +421,13 @@ void vgic_enable_irqs(struct vcpu *v, uint32_t r, unsigned int n)
 
 void vgic_set_irqs_pending(struct vcpu *v, uint32_t r, unsigned int rank)
 {
-    const unsigned long mask = r;
-    unsigned int i;
     /* The first rank is always per-vCPU */
     bool private = rank == 0;
 
     /* LPIs will never be set pending via this function */
     ASSERT(!is_lpi(32 * rank + 31));
 
-    bitmap_for_each ( i, &mask, 32 )
+    for_each_set_bit ( i, r )
     {
         unsigned int irq = i + 32 * rank;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 19:24:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 19:24:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.783011.1192476 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwN6-0006MQ-8h; Sat, 24 Aug 2024 19:24:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 783011.1192476; Sat, 24 Aug 2024 19:24: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 1shwN6-0006MI-64; Sat, 24 Aug 2024 19:24:24 +0000
Received: by outflank-mailman (input) for mailman id 783011;
 Sat, 24 Aug 2024 19:24:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwN5-0006M9-7l
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:24:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwN5-0008GN-75
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:24:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwN5-0002cD-5X
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:24:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=M92fTFHS3daBs4SI4X0/JtbGXVX4T9FWhSxukHPdeDQ=; b=2hA7YGczAdRHjq7VIECzlXU2GA
	W2WIZucC9mq3RxKkI48MI3zKULNTuP0uV3fsWp5hG3xxdNR+9pLzvPfmjoR+Xx9hvdKnLnf5ShcjK
	Sf84cKKTD3z1izFlOwq8aB5MSc83m5EZkvMO4wPc4Bjk/aVhcXGFEGYvatJhwYSYMlN4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/xstate: Switch back to for_each_set_bit()
Message-Id: <E1shwN5-0002cD-5X@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 19:24:23 +0000

commit 20885a36ce114f235d9d38cfcf4952c72ecda051
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 19 20:39:54 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 23 21:50:57 2024 +0100

    x86/xstate: Switch back to for_each_set_bit()
    
    In all 3 examples, we're iterating over a scaler.  They have an upper bound of
    63 which is to exclude the top bit; the COMPRESSED bit.
    
    recalculate_xstate() calculates xstates directly and doesn't set the
    COMPRESSED bit.  Both xstate_{un,}compressed_size() take architectural
    register values, neither of which permit the COMPRESSED bit either.
    
    xstate_uncompressed_size() has an ASSERT() covering this properly; add a
    equivelent ASSERT() to xstate_compressed_size() too.
    
    This alone produces:
    
      add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-161 (-161)
      Function                                     old     new   delta
      compress_xsave_states                         66      58      -8
      xstate_uncompressed_size                     119      71     -48
      xstate_compressed_size                       124      76     -48
      recalculate_xstate                           347     290     -57
    
    where xstate_{un,}compressed_size() have practically halved in size despite
    being small before.
    
    The change in compress_xsave_states() is unexpected.  The function is almost
    entirely dead code, and within what remains there's a smaller stack frame.  I
    suspect it's leftovers that the optimiser couldn't fully discard.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu-policy.c |  4 ++--
 xen/arch/x86/xstate.c     | 10 ++++++----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/cpu-policy.c b/xen/arch/x86/cpu-policy.c
index 649ab6088f..888e7ac4d4 100644
--- a/xen/arch/x86/cpu-policy.c
+++ b/xen/arch/x86/cpu-policy.c
@@ -193,7 +193,7 @@ static void sanitise_featureset(uint32_t *fs)
 static void recalculate_xstate(struct cpu_policy *p)
 {
     uint64_t xstates = XSTATE_FP_SSE;
-    unsigned int i, ecx_mask = 0, Da1 = p->xstate.Da1;
+    unsigned int ecx_mask = 0, Da1 = p->xstate.Da1;
 
     /*
      * The Da1 leaf is the only piece of information preserved in the common
@@ -237,7 +237,7 @@ static void recalculate_xstate(struct cpu_policy *p)
     /* Subleafs 2+ */
     xstates &= ~XSTATE_FP_SSE;
     BUILD_BUG_ON(ARRAY_SIZE(p->xstate.comp) < 63);
-    bitmap_for_each ( i, &xstates, 63 )
+    for_each_set_bit ( i, xstates )
     {
         /*
          * Pass through size (eax) and offset (ebx) directly.  Visbility of
diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 13fae41504..57a0749f0d 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -589,7 +589,7 @@ static bool valid_xcr0(uint64_t xcr0)
 
 unsigned int xstate_uncompressed_size(uint64_t xcr0)
 {
-    unsigned int size = XSTATE_AREA_MIN_SIZE, i;
+    unsigned int size = XSTATE_AREA_MIN_SIZE;
 
     /* Non-XCR0 states don't exist in an uncompressed image. */
     ASSERT((xcr0 & ~X86_XCR0_STATES) == 0);
@@ -606,7 +606,7 @@ unsigned int xstate_uncompressed_size(uint64_t xcr0)
      * with respect their index.
      */
     xcr0 &= ~(X86_XCR0_SSE | X86_XCR0_X87);
-    bitmap_for_each ( i, &xcr0, 63 )
+    for_each_set_bit ( i, xcr0 )
     {
         const struct xstate_component *c = &raw_cpu_policy.xstate.comp[i];
         unsigned int s = c->offset + c->size;
@@ -621,7 +621,9 @@ unsigned int xstate_uncompressed_size(uint64_t xcr0)
 
 unsigned int xstate_compressed_size(uint64_t xstates)
 {
-    unsigned int i, size = XSTATE_AREA_MIN_SIZE;
+    unsigned int size = XSTATE_AREA_MIN_SIZE;
+
+    ASSERT((xstates & ~(X86_XCR0_STATES | X86_XSS_STATES)) == 0);
 
     if ( xstates == 0 )
         return 0;
@@ -634,7 +636,7 @@ unsigned int xstate_compressed_size(uint64_t xstates)
      * componenets require aligning to 64 first.
      */
     xstates &= ~(X86_XCR0_SSE | X86_XCR0_X87);
-    bitmap_for_each ( i, &xstates, 63 )
+    for_each_set_bit ( i, xstates )
     {
         const struct xstate_component *c = &raw_cpu_policy.xstate.comp[i];
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Aug 24 19:24:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 24 Aug 2024 19:24:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.783012.1192480 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1shwNG-0006Pc-AO; Sat, 24 Aug 2024 19:24:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 783012.1192480; Sat, 24 Aug 2024 19:24: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 1shwNG-0006PU-7W; Sat, 24 Aug 2024 19:24:34 +0000
Received: by outflank-mailman (input) for mailman id 783012;
 Sat, 24 Aug 2024 19:24:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwNF-0006PC-Am
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:24:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwNF-0008Gd-9v
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:24:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1shwNF-0002cl-9D
 for xen-changelog@lists.xenproject.org; Sat, 24 Aug 2024 19:24:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dNhTZPsEvV+e2k/yUX/d30MmeK0cPopdd07yWZljOW8=; b=bGD5/zS0Dw3Zp5io7XSoN7tqPY
	1ra3fEKCd81d+FQ/6g0MEKieEpoW3ZleB7Mf15Sno4kqDwoP8Cf48KARAxBFdo0WQAZXy/TE7OBbw
	OEzK6L6wbRBYw4fK400pWdbKezZFn8/W6rbINbxGTXSlLrTzPh/3VGXpOu2+64hjb7qg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: update xilinx test scripts (tty)
Message-Id: <E1shwNF-0002cl-9D@xenbits.xenproject.org>
Date: Sat, 24 Aug 2024 19:24:33 +0000

commit 95764a0817a51741b7ffb1f78cba2a19b08ab2d1
Author:     Victor Lira <victorm.lira@amd.com>
AuthorDate: Fri Aug 23 15:29:04 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Aug 23 18:06:59 2024 -0700

    automation: update xilinx test scripts (tty)
    
    Update serial device names from ttyUSB* to test board specific names.
    
    Update xilinx-smoke-dom0-x86_64 with new Xen command line console options,
    which are now set as Gitlab CI/CD variables. Abstract the directory where
    binaries are stored. Increase the timeout to match new setup.
    
    Signed-off-by: Victor Lira <victorm.lira@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/test.yaml                    |  2 ++
 automation/scripts/xilinx-smoke-dom0-x86_64.sh    | 28 +++++++++++------------
 automation/scripts/xilinx-smoke-dom0less-arm64.sh |  5 ++--
 3 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 4e74946419..3b339f387f 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -101,6 +101,8 @@
   variables:
     CONTAINER: ubuntu:xenial-xilinx
     LOGFILE: xilinx-smoke-x86_64.log
+    XEN_CMD_CONSOLE: "console=com2 com2=115200,8n1,0x2F8,4"
+    TEST_BOARD: "crater"
   artifacts:
     paths:
       - smoke.serial
diff --git a/automation/scripts/xilinx-smoke-dom0-x86_64.sh b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
index e6e6fac6a5..4559e2b9ee 100755
--- a/automation/scripts/xilinx-smoke-dom0-x86_64.sh
+++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
@@ -12,7 +12,6 @@ fatal() {
 # Test parameter defaults.
 TEST="$1"
 PASS_MSG="Test passed: ${TEST}"
-XEN_CMD_CONSOLE="console=com1 com1=115200,8n1,0x3F8,4"
 XEN_CMD_DOM0="dom0=pvh dom0_max_vcpus=4 dom0_mem=4G"
 XEN_CMD_XEN="sched=null loglvl=all guest_loglvl=all console_timestamps=boot"
 XEN_CMD_EXTRA=""
@@ -28,7 +27,7 @@ memory = 512
 vif = [ "bridge=xenbr0", ]
 disk = [ ]
 '
-TIMEOUT_SECONDS=120
+TIMEOUT_SECONDS=200
 
 # Select test variant.
 if [ "${TEST}" = "ping" ]; then
@@ -113,27 +112,28 @@ cd ..
 # Load software into TFTP server directory.
 TFTP="/scratch/gitlab-runner/tftp"
 XEN_CMDLINE="${XEN_CMD_CONSOLE} ${XEN_CMD_XEN} ${XEN_CMD_DOM0} ${XEN_CMD_EXTRA}"
-cp -f binaries/xen ${TFTP}/pxelinux.cfg/xen
-cp -f binaries/bzImage ${TFTP}/pxelinux.cfg/vmlinuz
-cp -f binaries/dom0-rootfs.cpio.gz ${TFTP}/pxelinux.cfg/initrd-dom0
+cp -f binaries/xen ${TFTP}/${TEST_BOARD}/xen
+cp -f binaries/bzImage ${TFTP}/${TEST_BOARD}/vmlinuz
+cp -f binaries/dom0-rootfs.cpio.gz ${TFTP}/${TEST_BOARD}/initrd-dom0
 echo "
 net_default_server=10.0.6.1
-multiboot2 (tftp)/pxelinux.cfg/xen ${XEN_CMDLINE}
-module2 (tftp)/pxelinux.cfg/vmlinuz console=hvc0 root=/dev/ram0 earlyprintk=xen
-module2 (tftp)/pxelinux.cfg/initrd-dom0
+multiboot2 (tftp)/${TEST_BOARD}/xen ${XEN_CMDLINE}
+module2 (tftp)/${TEST_BOARD}/vmlinuz console=hvc0 root=/dev/ram0 earlyprintk=xen
+module2 (tftp)/${TEST_BOARD}/initrd-dom0
 boot
-" > ${TFTP}/pxelinux.cfg/grub.cfg
+" > ${TFTP}/${TEST_BOARD}/grub.cfg
 
 # Power cycle board and collect serial port output.
-SERIAL_CMD="cat /dev/ttyUSB9 | tee smoke.serial | sed 's/\r//'"
-sh /scratch/gitlab-runner/v2000a.sh 2
+SERIAL_DEV="/dev/serial/${TEST_BOARD}"
+SERIAL_CMD="cat ${SERIAL_DEV} | tee smoke.serial | sed 's/\r//'"
+sh /scratch/gitlab-runner/${TEST_BOARD}.sh 2
 sleep 5
-sh /scratch/gitlab-runner/v2000a.sh 1
+sh /scratch/gitlab-runner/${TEST_BOARD}.sh 1
 sleep 5
 set +e
-stty -F /dev/ttyUSB9 115200
+stty -F ${SERIAL_DEV} 115200
 timeout -k 1 ${TIMEOUT_SECONDS} nohup sh -c "${SERIAL_CMD}"
-sh /scratch/gitlab-runner/v2000a.sh 2
+sh /scratch/gitlab-runner/${TEST_BOARD}.sh 2
 
 set -e
 
diff --git a/automation/scripts/xilinx-smoke-dom0less-arm64.sh b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
index 666411d6a0..18aa07f0a2 100755
--- a/automation/scripts/xilinx-smoke-dom0less-arm64.sh
+++ b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
@@ -134,9 +134,10 @@ sleep 5
 cd $START
 
 # connect to serial
+SERIAL_DEV="/dev/serial/zynq"
 set +e
-stty -F /dev/ttyUSB0 115200
-timeout -k 1 120 nohup sh -c "cat /dev/ttyUSB0 | tee smoke.serial | sed 's/\r//'"
+stty -F ${SERIAL_DEV} 115200
+timeout -k 1 120 nohup sh -c "cat ${SERIAL_DEV} | tee smoke.serial | sed 's/\r//'"
 
 # stop the board
 cd /scratch/gitlab-runner
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Aug 26 08:44:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 26 Aug 2024 08:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.783367.1192684 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1siVKX-0001Qs-6b; Mon, 26 Aug 2024 08:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 783367.1192684; Mon, 26 Aug 2024 08:44: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 1siVKX-0001Ql-3u; Mon, 26 Aug 2024 08:44:05 +0000
Received: by outflank-mailman (input) for mailman id 783367;
 Mon, 26 Aug 2024 08:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1siVKW-0001Qd-2a
 for xen-changelog@lists.xenproject.org; Mon, 26 Aug 2024 08:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1siVKV-0000S3-OW
 for xen-changelog@lists.xenproject.org; Mon, 26 Aug 2024 08:44:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1siVKV-0002Gj-N1
 for xen-changelog@lists.xenproject.org; Mon, 26 Aug 2024 08:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vxSOMBkYQqtwYwnp03QF0bF+OUeWQcWwkQCN1VRVU4A=; b=ogUvD/Q3QzALpj/KbTkboP8pfp
	5djePPLaY4pXhj79oafCR0Mon2hEe9L/VauhhNavcOOrBzE8ekNki5KD6khg9DN91FWPsT853EIYy
	XP7bWjjZZGuT5oMuZV20M2I+/HR7j+R60QWlCcuGAFiLIjvqqvHR5MB7ZSv0ARw51oH0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: PE/COFF image header
Message-Id: <E1siVKV-0002Gj-N1@xenbits.xenproject.org>
Date: Mon, 26 Aug 2024 08:44:03 +0000

commit 0cde9fc154ac360e719f959ef48c445cca108de1
Author:     Nikola Jelic <nikola.jelic@rt-rk.com>
AuthorDate: Mon Aug 26 10:27:53 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 26 10:27:53 2024 +0200

    xen: PE/COFF image header
    
    Added PE/COFF generic image header which shall be used for EFI
    application format for x86/risc-v. x86 and risc-v source shall be adjusted
    to use this header in following commits. pe.h header is taken over from
    linux kernel with minor changes in terms of formatting and structure member comments.
    Also, COFF relocation and win cert structures are ommited, since these are not relevant for Xen.
    
    Origin: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 36e4fc57fc16
    Signed-off-by: Nikola Jelic <nikola.jelic@rt-rk.com>
    Signed-off-by: Milan Djokic <milan.djokic@rt-rk.com>
    Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/include/efi/pe.h | 291 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 291 insertions(+)

diff --git a/xen/include/efi/pe.h b/xen/include/efi/pe.h
new file mode 100644
index 0000000000..64e047e88b
--- /dev/null
+++ b/xen/include/efi/pe.h
@@ -0,0 +1,291 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright 2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * Author(s): Peter Jones <pjones@redhat.com>
+ */
+#ifndef EFI__PE_H
+#define EFI__PE_H
+
+#define MZ_MAGIC 0x5a4d /* "MZ" */
+
+#define PE_MAGIC              0x00004550 /* "PE\0\0" */
+#define PE_OPT_MAGIC_PE32     0x010b
+#define PE_OPT_MAGIC_PE32_ROM 0x0107
+#define PE_OPT_MAGIC_PE32PLUS 0x020b
+
+/* machine type */
+#define IMAGE_FILE_MACHINE_UNKNOWN     0x0000
+#define IMAGE_FILE_MACHINE_AM33        0x01d3
+#define IMAGE_FILE_MACHINE_AMD64       0x8664
+#define IMAGE_FILE_MACHINE_ARM         0x01c0
+#define IMAGE_FILE_MACHINE_ARMV7       0x01c4
+#define IMAGE_FILE_MACHINE_ARM64       0xaa64
+#define IMAGE_FILE_MACHINE_EBC         0x0ebc
+#define IMAGE_FILE_MACHINE_I386        0x014c
+#define IMAGE_FILE_MACHINE_IA64        0x0200
+#define IMAGE_FILE_MACHINE_M32R        0x9041
+#define IMAGE_FILE_MACHINE_MIPS16      0x0266
+#define IMAGE_FILE_MACHINE_MIPSFPU     0x0366
+#define IMAGE_FILE_MACHINE_MIPSFPU16   0x0466
+#define IMAGE_FILE_MACHINE_POWERPC     0x01f0
+#define IMAGE_FILE_MACHINE_POWERPCFP   0x01f1
+#define IMAGE_FILE_MACHINE_R4000       0x0166
+#define IMAGE_FILE_MACHINE_RISCV32     0x5032
+#define IMAGE_FILE_MACHINE_RISCV64     0x5064
+#define IMAGE_FILE_MACHINE_RISCV128    0x5128
+#define IMAGE_FILE_MACHINE_SH3         0x01a2
+#define IMAGE_FILE_MACHINE_SH3DSP      0x01a3
+#define IMAGE_FILE_MACHINE_SH3E        0x01a4
+#define IMAGE_FILE_MACHINE_SH4         0x01a6
+#define IMAGE_FILE_MACHINE_SH5         0x01a8
+#define IMAGE_FILE_MACHINE_THUMB       0x01c2
+#define IMAGE_FILE_MACHINE_WCEMIPSV2   0x0169
+#define IMAGE_FILE_MACHINE_LOONGARCH32 0x6232
+#define IMAGE_FILE_MACHINE_LOONGARCH64 0x6264
+
+/* flags */
+#define IMAGE_FILE_RELOCS_STRIPPED         0x0001
+#define IMAGE_FILE_EXECUTABLE_IMAGE        0x0002
+#define IMAGE_FILE_LINE_NUMS_STRIPPED      0x0004
+#define IMAGE_FILE_LOCAL_SYMS_STRIPPED     0x0008
+#define IMAGE_FILE_AGGRESSIVE_WS_TRIM      0x0010
+#define IMAGE_FILE_LARGE_ADDRESS_AWARE     0x0020
+#define IMAGE_FILE_16BIT_MACHINE           0x0040
+#define IMAGE_FILE_BYTES_REVERSED_LO       0x0080
+#define IMAGE_FILE_32BIT_MACHINE           0x0100
+#define IMAGE_FILE_DEBUG_STRIPPED          0x0200
+#define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
+#define IMAGE_FILE_NET_RUN_FROM_SWAP       0x0800
+#define IMAGE_FILE_SYSTEM                  0x1000
+#define IMAGE_FILE_DLL                     0x2000
+#define IMAGE_FILE_UP_SYSTEM_ONLY          0x4000
+#define IMAGE_FILE_BYTES_REVERSED_HI       0x8000
+
+#define IMAGE_SUBSYSTEM_UNKNOWN                 0
+#define IMAGE_SUBSYSTEM_NATIVE                  1
+#define IMAGE_SUBSYSTEM_WINDOWS_GUI             2
+#define IMAGE_SUBSYSTEM_WINDOWS_CUI             3
+#define IMAGE_SUBSYSTEM_POSIX_CUI               7
+#define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI          9
+#define IMAGE_SUBSYSTEM_EFI_APPLICATION         10
+#define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
+#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER      12
+#define IMAGE_SUBSYSTEM_EFI_ROM_IMAGE           13
+#define IMAGE_SUBSYSTEM_XBOX                    14
+
+#define IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE         0x0040
+#define IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY      0x0080
+#define IMAGE_DLL_CHARACTERISTICS_NX_COMPAT            0x0100
+#define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION          0x0200
+#define IMAGE_DLLCHARACTERISTICS_NO_SEH                0x0400
+#define IMAGE_DLLCHARACTERISTICS_NO_BIND               0x0800
+#define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER            0x2000
+#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
+
+#define IMAGE_DLLCHARACTERISTICS_EX_CET_COMPAT         0x0001
+#define IMAGE_DLLCHARACTERISTICS_EX_FORWARD_CFI_COMPAT 0x0040
+
+/* they actually defined 0x00000000 as well, but I think we'll skip that one. */
+#define IMAGE_SCN_RESERVED_0             0x00000001
+#define IMAGE_SCN_RESERVED_1             0x00000002
+#define IMAGE_SCN_RESERVED_2             0x00000004
+#define IMAGE_SCN_TYPE_NO_PAD            0x00000008 /* don't pad - obsolete */
+#define IMAGE_SCN_RESERVED_3             0x00000010
+#define IMAGE_SCN_CNT_CODE               0x00000020 /* .text */
+#define IMAGE_SCN_CNT_INITIALIZED_DATA   0x00000040 /* .data */
+#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 /* .bss */
+#define IMAGE_SCN_LNK_OTHER              0x00000100 /* reserved */
+#define IMAGE_SCN_LNK_INFO               0x00000200 /* .drectve comments */
+#define IMAGE_SCN_RESERVED_4             0x00000400
+#define IMAGE_SCN_LNK_REMOVE             0x00000800 /* .o only - scn to be rm'd*/
+#define IMAGE_SCN_LNK_COMDAT             0x00001000 /* .o only - COMDAT data */
+#define IMAGE_SCN_RESERVED_5             0x00002000 /* spec omits this */
+#define IMAGE_SCN_RESERVED_6             0x00004000 /* spec omits this */
+#define IMAGE_SCN_GPREL                  0x00008000 /* global pointer referenced data */
+/* spec lists 0x20000 twice, I suspect they meant 0x10000 for one of them */
+#define IMAGE_SCN_MEM_PURGEABLE 0x00010000 /* reserved for "future" use */
+#define IMAGE_SCN_16BIT         0x00020000 /* reserved for "future" use */
+#define IMAGE_SCN_LOCKED        0x00040000 /* reserved for "future" use */
+#define IMAGE_SCN_PRELOAD       0x00080000 /* reserved for "future" use */
+/* and here they just stuck a 1-nibble integer in the middle of a bitfield */
+#define IMAGE_SCN_ALIGN_1BYTES    0x00100000 /* it does what it says on the box */
+#define IMAGE_SCN_ALIGN_2BYTES    0x00200000
+#define IMAGE_SCN_ALIGN_4BYTES    0x00300000
+#define IMAGE_SCN_ALIGN_8BYTES    0x00400000
+#define IMAGE_SCN_ALIGN_16BYTES   0x00500000
+#define IMAGE_SCN_ALIGN_32BYTES   0x00600000
+#define IMAGE_SCN_ALIGN_64BYTES   0x00700000
+#define IMAGE_SCN_ALIGN_128BYTES  0x00800000
+#define IMAGE_SCN_ALIGN_256BYTES  0x00900000
+#define IMAGE_SCN_ALIGN_512BYTES  0x00a00000
+#define IMAGE_SCN_ALIGN_1024BYTES 0x00b00000
+#define IMAGE_SCN_ALIGN_2048BYTES 0x00c00000
+#define IMAGE_SCN_ALIGN_4096BYTES 0x00d00000
+#define IMAGE_SCN_ALIGN_8192BYTES 0x00e00000
+#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 /* extended relocations */
+#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 /* scn can be discarded */
+#define IMAGE_SCN_MEM_NOT_CACHED  0x04000000 /* cannot be cached */
+#define IMAGE_SCN_MEM_NOT_PAGED   0x08000000 /* not pageable */
+#define IMAGE_SCN_MEM_SHARED      0x10000000 /* can be shared */
+#define IMAGE_SCN_MEM_EXECUTE     0x20000000 /* can be executed as code */
+#define IMAGE_SCN_MEM_READ        0x40000000 /* readable */
+#define IMAGE_SCN_MEM_WRITE       0x80000000 /* writeable */
+
+#define IMAGE_DEBUG_TYPE_CODEVIEW              2
+#define IMAGE_DEBUG_TYPE_EX_DLLCHARACTERISTICS 20
+
+#ifndef __ASSEMBLY__
+
+struct mz_hdr {
+    uint16_t magic;              /* MZ_MAGIC */
+    uint16_t lbsize;             /* size of last used block */
+    uint16_t blocks;             /* pages in file, 0x3 */
+    uint16_t relocs;             /* relocations */
+    uint16_t hdrsize;            /* header size in "paragraphs" */
+    uint16_t min_extra_pps;      /* .bss */
+    uint16_t max_extra_pps;      /* runtime limit for the arena size */
+    uint16_t ss;                 /* relative stack segment */
+    uint16_t sp;                 /* initial %sp register */
+    uint16_t checksum;           /* word checksum */
+    uint16_t ip;                 /* initial %ip register */
+    uint16_t cs;                 /* initial %cs relative to load segment */
+    uint16_t reloc_table_offset; /* offset of the first relocation */
+    uint16_t overlay_num;        /* overlay number.  set to 0. */
+    uint16_t reserved0[4];       /* reserved */
+    uint16_t oem_id;             /* oem identifier */
+    uint16_t oem_info;           /* oem specific */
+    uint16_t reserved1[10];      /* reserved */
+    uint32_t peaddr;             /* file offset of PE header */
+    char     message[];          /* message to print */
+};
+
+struct mz_reloc {
+    uint16_t offset;
+    uint16_t segment;
+};
+
+struct pe_hdr {
+    uint32_t magic;        /* PE magic */
+    uint16_t machine;      /* machine type */
+    uint16_t sections;     /* number of sections */
+    uint32_t timestamp;    /* time_t */
+    uint32_t symbol_table; /* symbol table offset */
+    uint32_t symbols;      /* number of symbols */
+    uint16_t opt_hdr_size; /* size of optional header */
+    uint16_t flags;        /* flags */
+};
+
+/*
+ * the fact that pe32 isn't padded where pe32+ is 64-bit means union won't
+ * work right.
+ */
+struct pe32_opt_hdr {
+    /* "standard" header */
+    uint16_t magic;       /* file type */
+    uint8_t  ld_major;    /* linker major version */
+    uint8_t  ld_minor;    /* linker minor version */
+    uint32_t text_size;   /* size of text section(s) */
+    uint32_t data_size;   /* size of data section(s) */
+    uint32_t bss_size;    /* size of bss section(s) */
+    uint32_t entry_point; /* file offset of entry point */
+    uint32_t code_base;   /* relative code addr in ram */
+    uint32_t data_base;   /* relative data addr in ram */
+    /* "windows" header */
+    uint32_t image_base;     /* preferred load address */
+    uint32_t section_align;  /* alignment in bytes */
+    uint32_t file_align;     /* file alignment in bytes */
+    uint16_t os_major;       /* major OS version */
+    uint16_t os_minor;       /* minor OS version */
+    uint16_t image_major;    /* major image version */
+    uint16_t image_minor;    /* minor image version */
+    uint16_t subsys_major;   /* major subsystem version */
+    uint16_t subsys_minor;   /* minor subsystem version */
+    uint32_t win32_version;  /* reserved, must be 0 */
+    uint32_t image_size;     /* image size */
+    uint32_t header_size;    /* header size rounded up to file_align */
+    uint32_t csum;           /* checksum */
+    uint16_t subsys;         /* subsystem */
+    uint16_t dll_flags;      /* more flags! */
+    uint32_t stack_size_req; /* amt of stack requested */
+    uint32_t stack_size;     /* amt of stack required */
+    uint32_t heap_size_req;  /* amt of heap requested */
+    uint32_t heap_size;      /* amt of heap required */
+    uint32_t loader_flags;   /* reserved, must be 0 */
+    uint32_t data_dirs;      /* number of data dir entries */
+};
+
+struct pe32plus_opt_hdr {
+    uint16_t magic;       /* file type */
+    uint8_t  ld_major;    /* linker major version */
+    uint8_t  ld_minor;    /* linker minor version */
+    uint32_t text_size;   /* size of text section(s) */
+    uint32_t data_size;   /* size of data section(s) */
+    uint32_t bss_size;    /* size of bss section(s) */
+    uint32_t entry_point; /* file offset of entry point */
+    uint32_t code_base;   /* relative code addr in ram */
+    /* "windows" header */
+    uint64_t image_base;     /* preferred load address */
+    uint32_t section_align;  /* alignment in bytes */
+    uint32_t file_align;     /* file alignment in bytes */
+    uint16_t os_major;       /* major OS version */
+    uint16_t os_minor;       /* minor OS version */
+    uint16_t image_major;    /* major image version */
+    uint16_t image_minor;    /* minor image version */
+    uint16_t subsys_major;   /* major subsystem version */
+    uint16_t subsys_minor;   /* minor subsystem version */
+    uint32_t win32_version;  /* reserved, must be 0 */
+    uint32_t image_size;     /* image size */
+    uint32_t header_size;    /* header size rounded up to file_align */
+    uint32_t csum;           /* checksum */
+    uint16_t subsys;         /* subsystem */
+    uint16_t dll_flags;      /* more flags! */
+    uint64_t stack_size_req; /* amt of stack requested */
+    uint64_t stack_size;     /* amt of stack required */
+    uint64_t heap_size_req;  /* amt of heap requested */
+    uint64_t heap_size;      /* amt of heap required */
+    uint32_t loader_flags;   /* reserved, must be 0 */
+    uint32_t data_dirs;      /* number of data dir entries */
+};
+
+struct data_dirent {
+    uint32_t rva;            /* relative to load address */
+    uint32_t size;
+};
+
+struct data_directory {
+    struct data_dirent exports;          /* .edata */
+    struct data_dirent imports;          /* .idata */
+    struct data_dirent resources;        /* .rsrc */
+    struct data_dirent exceptions;       /* .pdata */
+    struct data_dirent certs;            /* certs */
+    struct data_dirent base_relocations; /* .reloc */
+    struct data_dirent debug;            /* .debug */
+    struct data_dirent arch;             /* reservered */
+    struct data_dirent global_ptr;       /* global pointer reg. Size=0 */
+    struct data_dirent tls;              /* .tls */
+    struct data_dirent load_config;      /* load configuration structure */
+    struct data_dirent bound_imports;    /* no idea */
+    struct data_dirent import_addrs;     /* import address table */
+    struct data_dirent delay_imports;    /* delay-load import table */
+    struct data_dirent clr_runtime_hdr;  /* .cor (object only) */
+    struct data_dirent reserved;
+};
+
+struct section_header {
+    char     name[8];         /* name or string tbl offset */
+    uint32_t virtual_size;    /* size of loaded section in ram */
+    uint32_t rva;             /* relative virtual address */
+    uint32_t raw_data_size;   /* size of the section */
+    uint32_t data_addr;       /* file pointer to first page of sec */
+    uint32_t relocs;          /* file pointer to relocation entries */
+    uint32_t line_numbers;    /* line numbers */
+    uint16_t num_relocs;      /* number of relocations */
+    uint16_t num_lin_numbers; /* COFF line count */
+    uint32_t flags;
+};
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* EFI__PE_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 26 08:44:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 26 Aug 2024 08:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.783368.1192688 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1siVKh-0001Tm-83; Mon, 26 Aug 2024 08:44:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 783368.1192688; Mon, 26 Aug 2024 08:44: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 1siVKh-0001Te-5P; Mon, 26 Aug 2024 08:44:15 +0000
Received: by outflank-mailman (input) for mailman id 783368;
 Mon, 26 Aug 2024 08:44:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1siVKf-0001Sm-TH
 for xen-changelog@lists.xenproject.org; Mon, 26 Aug 2024 08:44:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1siVKf-0000S7-SZ
 for xen-changelog@lists.xenproject.org; Mon, 26 Aug 2024 08:44:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1siVKf-0002He-Qj
 for xen-changelog@lists.xenproject.org; Mon, 26 Aug 2024 08:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2fwbBorO9CUVgo9j9NhXVeE+EEhT42bAAnJ/iQ9O0yg=; b=ghr0ERt/nK45lFlfb9sgscyOjE
	MsEVm7o+IlijHg2N6NeWlWXU2gUjrDSmYj9uCwvaCx183bPLt1oV++UDmO/hpWC8b/2xHtKlq3UeP
	6xRSNBxLzpCaFOvSG7TPwEoHiPWHFFLheg8iKUdc2iTFf2bQyz6wHQv81AMxwpsBKu2Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/x2APIC: correct cluster tracking upon CPUs going down for S3
Message-Id: <E1siVKf-0002He-Qj@xenbits.xenproject.org>
Date: Mon, 26 Aug 2024 08:44:13 +0000

commit ad3ff7b4279d16c91c23cda6e8be5bc670b25c9a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Aug 26 10:30:40 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 26 10:30:40 2024 +0200

    x86/x2APIC: correct cluster tracking upon CPUs going down for S3
    
    Downing CPUs for S3 is somewhat special: Since we can expect the system
    to come back up in exactly the same hardware configuration, per-CPU data
    for the secondary CPUs isn't de-allocated (and then cleared upon re-
    allocation when the CPUs are being brought back up). Therefore the
    cluster_cpus per-CPU pointer will retain its value for all CPUs other
    than the final one in a cluster (i.e. in particular for all CPUs in the
    same cluster as CPU0). That, however, is in conflict with the assertion
    early in init_apic_ldr_x2apic_cluster().
    
    Note that the issue is avoided on Intel hardware, where we park CPUs
    instead of bringing them down.
    
    Extend the bypassing of the freeing to the suspend case, thus making
    suspend/resume also a tiny bit faster.
    
    Fixes: 2e6c8f182c9c ("x86: distinguish CPU offlining from CPU removal")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/genapic/x2apic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c
index 371dd100c7..d531035fa4 100644
--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -228,7 +228,8 @@ static int cf_check update_clusterinfo(
     case CPU_UP_CANCELED:
     case CPU_DEAD:
     case CPU_REMOVE:
-        if ( park_offline_cpus == (action != CPU_REMOVE) )
+        if ( park_offline_cpus == (action != CPU_REMOVE) ||
+             system_state == SYS_STATE_suspend )
             break;
         if ( per_cpu(cluster_cpus, cpu) )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 26 08:44:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 26 Aug 2024 08:44:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.783369.1192691 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1siVKr-0001WJ-9O; Mon, 26 Aug 2024 08:44:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 783369.1192691; Mon, 26 Aug 2024 08:44: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 1siVKr-0001WB-6p; Mon, 26 Aug 2024 08:44:25 +0000
Received: by outflank-mailman (input) for mailman id 783369;
 Mon, 26 Aug 2024 08:44:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1siVKq-0001Vv-0R
 for xen-changelog@lists.xenproject.org; Mon, 26 Aug 2024 08:44:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1siVKp-0000SJ-Vw
 for xen-changelog@lists.xenproject.org; Mon, 26 Aug 2024 08:44:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1siVKp-0002IC-UY
 for xen-changelog@lists.xenproject.org; Mon, 26 Aug 2024 08:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NDCL20PRqPzXz28yabHjsVtR8zmCy+KyzXEwQrkOvN4=; b=2hixckOFZn5G2ykuUKXSx05eUh
	mmfuuIe15IyRO68D+0nkmY0Xw9/gUnzgEkdetZ8d1/MHIxRDvF/mKWehX5pHKa6giWQhVsKQRy9yA
	EFBDwsLpn0bZWTKuri62GJ1blwwE+jILss90Zjd1vfIuV+t4tf7fKjr/wtpFMKavh8+4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/pvh: Add PHYSDEVOP_setup_gsi for PVH dom0
Message-Id: <E1siVKp-0002IC-UY@xenbits.xenproject.org>
Date: Mon, 26 Aug 2024 08:44:23 +0000

commit 43a1f8b38ed1ec20b47bd8c3e7de3eac845057dc
Author:     Jiqian Chen <Jiqian.Chen@amd.com>
AuthorDate: Mon Aug 26 10:32:05 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 26 10:32:05 2024 +0200

    x86/pvh: Add PHYSDEVOP_setup_gsi for PVH dom0
    
    The gsi of a passthrough device must be configured for it to be
    able to be mapped into a hvm domU.
    But When dom0 is PVH, the gsis may not get registered(see below
    clarification), it causes the info of apic, pin and irq not be
    added into irq_2_pin list, and the handler of irq_desc is not set,
    then when passthrough a device, setting ioapic affinity and vector
    will fail.
    
    To fix above problem, on Linux kernel side, a new code will
    need to call PHYSDEVOP_setup_gsi for passthrough devices to
    register gsi when dom0 is PVH.
    
    So, add PHYSDEVOP_setup_gsi into hvm_physdev_op for above
    purpose.
    
    Clarify two questions:
    First, why the gsi of devices belong to PVH dom0 can work?
    Because when probe a driver to a normal device, it uses the normal
    probe function of pci device, in its callstack, it requests irq
    and unmask corresponding ioapic of gsi, then trap into xen and
    register gsi finally.
    Callstack is(on linux kernel side) pci_device_probe->
    request_threaded_irq-> irq_startup-> __unmask_ioapic->
    io_apic_write, then trap into xen hvmemul_do_io->
    hvm_io_intercept-> hvm_process_io_intercept->
    vioapic_write_indirect-> vioapic_hwdom_map_gsi-> mp_register_gsi.
    So that the gsi can be registered.
    
    Second, why the gsi of passthrough device can't work when dom0
    is PVH?
    Because when assign a device to passthrough, it uses the specific
    probe function of pciback, in its callstack, it doesn't install a
    fake irq handler due to the ISR is not running. So that
    mp_register_gsi on Xen side is never called, then the gsi is not
    registered.
    Callstack is(on linux kernel side) pcistub_probe->pcistub_seize->
    pcistub_init_device-> xen_pcibk_reset_device->
    xen_pcibk_control_isr->isr_on==0.
    
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Signed-off-by: Huang Rui <ray.huang@amd.com>
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hypercall.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
index c1bd17571e..44342e7e7f 100644
--- a/xen/arch/x86/hvm/hypercall.c
+++ b/xen/arch/x86/hvm/hypercall.c
@@ -80,6 +80,7 @@ long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
             return -ENOSYS;
         break;
 
+    case PHYSDEVOP_setup_gsi:
     case PHYSDEVOP_pci_mmcfg_reserved:
     case PHYSDEVOP_pci_device_add:
     case PHYSDEVOP_pci_device_remove:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 26 08:44:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 26 Aug 2024 08:44:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.783370.1192695 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1siVL1-0001Zm-At; Mon, 26 Aug 2024 08:44:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 783370.1192695; Mon, 26 Aug 2024 08:44: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 1siVL1-0001Ze-8E; Mon, 26 Aug 2024 08:44:35 +0000
Received: by outflank-mailman (input) for mailman id 783370;
 Mon, 26 Aug 2024 08:44:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1siVL0-0001ZK-4c
 for xen-changelog@lists.xenproject.org; Mon, 26 Aug 2024 08:44:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1siVL0-0000SQ-3t
 for xen-changelog@lists.xenproject.org; Mon, 26 Aug 2024 08:44:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1siVL0-0002JD-1m
 for xen-changelog@lists.xenproject.org; Mon, 26 Aug 2024 08:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0kjC1f6O9FdV3jvQR6AiuDxqj0EPQhGRLyaE+A3CeXM=; b=y69BXZdRkDw1BGnZudzJJEEaMQ
	SeQNbskLfEGzy/o3+r3kQQe6htJlH6DHsQdB2bIUGH7b0AXMHOH5SPIcGUs36DRFaXFyXmRjGOB+s
	navxXyYA+KutXQEjyzQEz3giQvmU9ZaP2SD+wvfMpPinrf9S7ewVjpvU/xXdatVm+RX8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul: drop and avoid use of BUG()
Message-Id: <E1siVL0-0002JD-1m@xenbits.xenproject.org>
Date: Mon, 26 Aug 2024 08:44:34 +0000

commit b8cdfac2be38c98dd3ad0e911a3f7f787f5bcf6b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Aug 26 10:33:09 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 26 10:33:09 2024 +0200

    x86emul: drop and avoid use of BUG()
    
    Generally it is not a good idea to use BUG() in emulator code. Even for
    internal flaws we're better off returning errors to callers, rather than
    crashing the system. Replace the sole remaining use and remove the
    test / fuzzing harness surrogate. Put in place a declaration pleasing
    the compiler when finding uses in Xen headers, while at the same time
    breaking the build (at linking time) in case an active reference would
    newly appear.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/x86_emulator/x86-emulate.h | 1 -
 xen/arch/x86/x86_emulate/decode.c      | 4 +++-
 xen/arch/x86/x86_emulate/private.h     | 3 +++
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/tests/x86_emulator/x86-emulate.h b/tools/tests/x86_emulator/x86-emulate.h
index d2012ab767..4fca051152 100644
--- a/tools/tests/x86_emulator/x86-emulate.h
+++ b/tools/tests/x86_emulator/x86-emulate.h
@@ -42,7 +42,6 @@
 
 #include <xen-tools/common-macros.h>
 
-#define BUG() abort()
 #define ASSERT assert
 #define ASSERT_UNREACHABLE() assert(!__LINE__)
 
diff --git a/xen/arch/x86/x86_emulate/decode.c b/xen/arch/x86/x86_emulate/decode.c
index ee4cbdc000..5a880578c7 100644
--- a/xen/arch/x86/x86_emulate/decode.c
+++ b/xen/arch/x86/x86_emulate/decode.c
@@ -1122,7 +1122,9 @@ int x86emul_decode(struct x86_emulate_state *s,
             switch ( def_ad_bytes )
             {
             default:
-                BUG(); /* Shouldn't be possible. */
+                ASSERT_UNREACHABLE(); /* Shouldn't be possible. */
+                return X86EMUL_UNHANDLEABLE;
+
             case 2:
                 if ( ctxt->regs->eflags & X86_EFLAGS_VM )
                     break;
diff --git a/xen/arch/x86/x86_emulate/private.h b/xen/arch/x86/x86_emulate/private.h
index a2faa8b29b..f735bb6a5a 100644
--- a/xen/arch/x86/x86_emulate/private.h
+++ b/xen/arch/x86/x86_emulate/private.h
@@ -15,6 +15,9 @@
 # include <asm/x86-vendors.h>
 # include <asm/x86_emulate.h>
 
+# undef BUG /* Make sure it's not used anywhere here. */
+void BUG(void);
+
 # ifndef CONFIG_HVM
 #  define X86EMUL_NO_FPU
 #  define X86EMUL_NO_MMX
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Aug 26 20:11:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 26 Aug 2024 20:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.783588.1192880 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sig3L-0005d8-1Q; Mon, 26 Aug 2024 20:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 783588.1192880; Mon, 26 Aug 2024 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 1sig3K-0005cu-Ug; Mon, 26 Aug 2024 20:11:02 +0000
Received: by outflank-mailman (input) for mailman id 783588;
 Mon, 26 Aug 2024 20:11:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sig3K-0005cb-9j
 for xen-changelog@lists.xenproject.org; Mon, 26 Aug 2024 20:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sig3K-00055K-8s
 for xen-changelog@lists.xenproject.org; Mon, 26 Aug 2024 20:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sig3K-0005mB-6x
 for xen-changelog@lists.xenproject.org; Mon, 26 Aug 2024 20: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jG5kjB27O6/9bY/3tOIkP9KS3l9O+eL/IlLkiSWmbF0=; b=SRJ5eSOp3IGIYw9cQD7aU04JOQ
	bdVt9B1ZvyHHtBUDW7CfY1Gn1bhdYmF8YyZrMtBXtzxSjq+Y8/EM0DG4K+Ob0TJicgbFSAZaoW499
	0O0uJ9LLHmJe6YDlm/zq0Tqr37B/mOxAikad60lQ1YYRrmWp2vLvmcBIoHXKualRFGMI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: PE/COFF image header
Message-Id: <E1sig3K-0005mB-6x@xenbits.xenproject.org>
Date: Mon, 26 Aug 2024 20:11:02 +0000

commit 0cde9fc154ac360e719f959ef48c445cca108de1
Author:     Nikola Jelic <nikola.jelic@rt-rk.com>
AuthorDate: Mon Aug 26 10:27:53 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 26 10:27:53 2024 +0200

    xen: PE/COFF image header
    
    Added PE/COFF generic image header which shall be used for EFI
    application format for x86/risc-v. x86 and risc-v source shall be adjusted
    to use this header in following commits. pe.h header is taken over from
    linux kernel with minor changes in terms of formatting and structure member comments.
    Also, COFF relocation and win cert structures are ommited, since these are not relevant for Xen.
    
    Origin: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 36e4fc57fc16
    Signed-off-by: Nikola Jelic <nikola.jelic@rt-rk.com>
    Signed-off-by: Milan Djokic <milan.djokic@rt-rk.com>
    Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/include/efi/pe.h | 291 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 291 insertions(+)

diff --git a/xen/include/efi/pe.h b/xen/include/efi/pe.h
new file mode 100644
index 0000000000..64e047e88b
--- /dev/null
+++ b/xen/include/efi/pe.h
@@ -0,0 +1,291 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright 2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * Author(s): Peter Jones <pjones@redhat.com>
+ */
+#ifndef EFI__PE_H
+#define EFI__PE_H
+
+#define MZ_MAGIC 0x5a4d /* "MZ" */
+
+#define PE_MAGIC              0x00004550 /* "PE\0\0" */
+#define PE_OPT_MAGIC_PE32     0x010b
+#define PE_OPT_MAGIC_PE32_ROM 0x0107
+#define PE_OPT_MAGIC_PE32PLUS 0x020b
+
+/* machine type */
+#define IMAGE_FILE_MACHINE_UNKNOWN     0x0000
+#define IMAGE_FILE_MACHINE_AM33        0x01d3
+#define IMAGE_FILE_MACHINE_AMD64       0x8664
+#define IMAGE_FILE_MACHINE_ARM         0x01c0
+#define IMAGE_FILE_MACHINE_ARMV7       0x01c4
+#define IMAGE_FILE_MACHINE_ARM64       0xaa64
+#define IMAGE_FILE_MACHINE_EBC         0x0ebc
+#define IMAGE_FILE_MACHINE_I386        0x014c
+#define IMAGE_FILE_MACHINE_IA64        0x0200
+#define IMAGE_FILE_MACHINE_M32R        0x9041
+#define IMAGE_FILE_MACHINE_MIPS16      0x0266
+#define IMAGE_FILE_MACHINE_MIPSFPU     0x0366
+#define IMAGE_FILE_MACHINE_MIPSFPU16   0x0466
+#define IMAGE_FILE_MACHINE_POWERPC     0x01f0
+#define IMAGE_FILE_MACHINE_POWERPCFP   0x01f1
+#define IMAGE_FILE_MACHINE_R4000       0x0166
+#define IMAGE_FILE_MACHINE_RISCV32     0x5032
+#define IMAGE_FILE_MACHINE_RISCV64     0x5064
+#define IMAGE_FILE_MACHINE_RISCV128    0x5128
+#define IMAGE_FILE_MACHINE_SH3         0x01a2
+#define IMAGE_FILE_MACHINE_SH3DSP      0x01a3
+#define IMAGE_FILE_MACHINE_SH3E        0x01a4
+#define IMAGE_FILE_MACHINE_SH4         0x01a6
+#define IMAGE_FILE_MACHINE_SH5         0x01a8
+#define IMAGE_FILE_MACHINE_THUMB       0x01c2
+#define IMAGE_FILE_MACHINE_WCEMIPSV2   0x0169
+#define IMAGE_FILE_MACHINE_LOONGARCH32 0x6232
+#define IMAGE_FILE_MACHINE_LOONGARCH64 0x6264
+
+/* flags */
+#define IMAGE_FILE_RELOCS_STRIPPED         0x0001
+#define IMAGE_FILE_EXECUTABLE_IMAGE        0x0002
+#define IMAGE_FILE_LINE_NUMS_STRIPPED      0x0004
+#define IMAGE_FILE_LOCAL_SYMS_STRIPPED     0x0008
+#define IMAGE_FILE_AGGRESSIVE_WS_TRIM      0x0010
+#define IMAGE_FILE_LARGE_ADDRESS_AWARE     0x0020
+#define IMAGE_FILE_16BIT_MACHINE           0x0040
+#define IMAGE_FILE_BYTES_REVERSED_LO       0x0080
+#define IMAGE_FILE_32BIT_MACHINE           0x0100
+#define IMAGE_FILE_DEBUG_STRIPPED          0x0200
+#define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
+#define IMAGE_FILE_NET_RUN_FROM_SWAP       0x0800
+#define IMAGE_FILE_SYSTEM                  0x1000
+#define IMAGE_FILE_DLL                     0x2000
+#define IMAGE_FILE_UP_SYSTEM_ONLY          0x4000
+#define IMAGE_FILE_BYTES_REVERSED_HI       0x8000
+
+#define IMAGE_SUBSYSTEM_UNKNOWN                 0
+#define IMAGE_SUBSYSTEM_NATIVE                  1
+#define IMAGE_SUBSYSTEM_WINDOWS_GUI             2
+#define IMAGE_SUBSYSTEM_WINDOWS_CUI             3
+#define IMAGE_SUBSYSTEM_POSIX_CUI               7
+#define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI          9
+#define IMAGE_SUBSYSTEM_EFI_APPLICATION         10
+#define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
+#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER      12
+#define IMAGE_SUBSYSTEM_EFI_ROM_IMAGE           13
+#define IMAGE_SUBSYSTEM_XBOX                    14
+
+#define IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE         0x0040
+#define IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY      0x0080
+#define IMAGE_DLL_CHARACTERISTICS_NX_COMPAT            0x0100
+#define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION          0x0200
+#define IMAGE_DLLCHARACTERISTICS_NO_SEH                0x0400
+#define IMAGE_DLLCHARACTERISTICS_NO_BIND               0x0800
+#define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER            0x2000
+#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
+
+#define IMAGE_DLLCHARACTERISTICS_EX_CET_COMPAT         0x0001
+#define IMAGE_DLLCHARACTERISTICS_EX_FORWARD_CFI_COMPAT 0x0040
+
+/* they actually defined 0x00000000 as well, but I think we'll skip that one. */
+#define IMAGE_SCN_RESERVED_0             0x00000001
+#define IMAGE_SCN_RESERVED_1             0x00000002
+#define IMAGE_SCN_RESERVED_2             0x00000004
+#define IMAGE_SCN_TYPE_NO_PAD            0x00000008 /* don't pad - obsolete */
+#define IMAGE_SCN_RESERVED_3             0x00000010
+#define IMAGE_SCN_CNT_CODE               0x00000020 /* .text */
+#define IMAGE_SCN_CNT_INITIALIZED_DATA   0x00000040 /* .data */
+#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 /* .bss */
+#define IMAGE_SCN_LNK_OTHER              0x00000100 /* reserved */
+#define IMAGE_SCN_LNK_INFO               0x00000200 /* .drectve comments */
+#define IMAGE_SCN_RESERVED_4             0x00000400
+#define IMAGE_SCN_LNK_REMOVE             0x00000800 /* .o only - scn to be rm'd*/
+#define IMAGE_SCN_LNK_COMDAT             0x00001000 /* .o only - COMDAT data */
+#define IMAGE_SCN_RESERVED_5             0x00002000 /* spec omits this */
+#define IMAGE_SCN_RESERVED_6             0x00004000 /* spec omits this */
+#define IMAGE_SCN_GPREL                  0x00008000 /* global pointer referenced data */
+/* spec lists 0x20000 twice, I suspect they meant 0x10000 for one of them */
+#define IMAGE_SCN_MEM_PURGEABLE 0x00010000 /* reserved for "future" use */
+#define IMAGE_SCN_16BIT         0x00020000 /* reserved for "future" use */
+#define IMAGE_SCN_LOCKED        0x00040000 /* reserved for "future" use */
+#define IMAGE_SCN_PRELOAD       0x00080000 /* reserved for "future" use */
+/* and here they just stuck a 1-nibble integer in the middle of a bitfield */
+#define IMAGE_SCN_ALIGN_1BYTES    0x00100000 /* it does what it says on the box */
+#define IMAGE_SCN_ALIGN_2BYTES    0x00200000
+#define IMAGE_SCN_ALIGN_4BYTES    0x00300000
+#define IMAGE_SCN_ALIGN_8BYTES    0x00400000
+#define IMAGE_SCN_ALIGN_16BYTES   0x00500000
+#define IMAGE_SCN_ALIGN_32BYTES   0x00600000
+#define IMAGE_SCN_ALIGN_64BYTES   0x00700000
+#define IMAGE_SCN_ALIGN_128BYTES  0x00800000
+#define IMAGE_SCN_ALIGN_256BYTES  0x00900000
+#define IMAGE_SCN_ALIGN_512BYTES  0x00a00000
+#define IMAGE_SCN_ALIGN_1024BYTES 0x00b00000
+#define IMAGE_SCN_ALIGN_2048BYTES 0x00c00000
+#define IMAGE_SCN_ALIGN_4096BYTES 0x00d00000
+#define IMAGE_SCN_ALIGN_8192BYTES 0x00e00000
+#define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000 /* extended relocations */
+#define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 /* scn can be discarded */
+#define IMAGE_SCN_MEM_NOT_CACHED  0x04000000 /* cannot be cached */
+#define IMAGE_SCN_MEM_NOT_PAGED   0x08000000 /* not pageable */
+#define IMAGE_SCN_MEM_SHARED      0x10000000 /* can be shared */
+#define IMAGE_SCN_MEM_EXECUTE     0x20000000 /* can be executed as code */
+#define IMAGE_SCN_MEM_READ        0x40000000 /* readable */
+#define IMAGE_SCN_MEM_WRITE       0x80000000 /* writeable */
+
+#define IMAGE_DEBUG_TYPE_CODEVIEW              2
+#define IMAGE_DEBUG_TYPE_EX_DLLCHARACTERISTICS 20
+
+#ifndef __ASSEMBLY__
+
+struct mz_hdr {
+    uint16_t magic;              /* MZ_MAGIC */
+    uint16_t lbsize;             /* size of last used block */
+    uint16_t blocks;             /* pages in file, 0x3 */
+    uint16_t relocs;             /* relocations */
+    uint16_t hdrsize;            /* header size in "paragraphs" */
+    uint16_t min_extra_pps;      /* .bss */
+    uint16_t max_extra_pps;      /* runtime limit for the arena size */
+    uint16_t ss;                 /* relative stack segment */
+    uint16_t sp;                 /* initial %sp register */
+    uint16_t checksum;           /* word checksum */
+    uint16_t ip;                 /* initial %ip register */
+    uint16_t cs;                 /* initial %cs relative to load segment */
+    uint16_t reloc_table_offset; /* offset of the first relocation */
+    uint16_t overlay_num;        /* overlay number.  set to 0. */
+    uint16_t reserved0[4];       /* reserved */
+    uint16_t oem_id;             /* oem identifier */
+    uint16_t oem_info;           /* oem specific */
+    uint16_t reserved1[10];      /* reserved */
+    uint32_t peaddr;             /* file offset of PE header */
+    char     message[];          /* message to print */
+};
+
+struct mz_reloc {
+    uint16_t offset;
+    uint16_t segment;
+};
+
+struct pe_hdr {
+    uint32_t magic;        /* PE magic */
+    uint16_t machine;      /* machine type */
+    uint16_t sections;     /* number of sections */
+    uint32_t timestamp;    /* time_t */
+    uint32_t symbol_table; /* symbol table offset */
+    uint32_t symbols;      /* number of symbols */
+    uint16_t opt_hdr_size; /* size of optional header */
+    uint16_t flags;        /* flags */
+};
+
+/*
+ * the fact that pe32 isn't padded where pe32+ is 64-bit means union won't
+ * work right.
+ */
+struct pe32_opt_hdr {
+    /* "standard" header */
+    uint16_t magic;       /* file type */
+    uint8_t  ld_major;    /* linker major version */
+    uint8_t  ld_minor;    /* linker minor version */
+    uint32_t text_size;   /* size of text section(s) */
+    uint32_t data_size;   /* size of data section(s) */
+    uint32_t bss_size;    /* size of bss section(s) */
+    uint32_t entry_point; /* file offset of entry point */
+    uint32_t code_base;   /* relative code addr in ram */
+    uint32_t data_base;   /* relative data addr in ram */
+    /* "windows" header */
+    uint32_t image_base;     /* preferred load address */
+    uint32_t section_align;  /* alignment in bytes */
+    uint32_t file_align;     /* file alignment in bytes */
+    uint16_t os_major;       /* major OS version */
+    uint16_t os_minor;       /* minor OS version */
+    uint16_t image_major;    /* major image version */
+    uint16_t image_minor;    /* minor image version */
+    uint16_t subsys_major;   /* major subsystem version */
+    uint16_t subsys_minor;   /* minor subsystem version */
+    uint32_t win32_version;  /* reserved, must be 0 */
+    uint32_t image_size;     /* image size */
+    uint32_t header_size;    /* header size rounded up to file_align */
+    uint32_t csum;           /* checksum */
+    uint16_t subsys;         /* subsystem */
+    uint16_t dll_flags;      /* more flags! */
+    uint32_t stack_size_req; /* amt of stack requested */
+    uint32_t stack_size;     /* amt of stack required */
+    uint32_t heap_size_req;  /* amt of heap requested */
+    uint32_t heap_size;      /* amt of heap required */
+    uint32_t loader_flags;   /* reserved, must be 0 */
+    uint32_t data_dirs;      /* number of data dir entries */
+};
+
+struct pe32plus_opt_hdr {
+    uint16_t magic;       /* file type */
+    uint8_t  ld_major;    /* linker major version */
+    uint8_t  ld_minor;    /* linker minor version */
+    uint32_t text_size;   /* size of text section(s) */
+    uint32_t data_size;   /* size of data section(s) */
+    uint32_t bss_size;    /* size of bss section(s) */
+    uint32_t entry_point; /* file offset of entry point */
+    uint32_t code_base;   /* relative code addr in ram */
+    /* "windows" header */
+    uint64_t image_base;     /* preferred load address */
+    uint32_t section_align;  /* alignment in bytes */
+    uint32_t file_align;     /* file alignment in bytes */
+    uint16_t os_major;       /* major OS version */
+    uint16_t os_minor;       /* minor OS version */
+    uint16_t image_major;    /* major image version */
+    uint16_t image_minor;    /* minor image version */
+    uint16_t subsys_major;   /* major subsystem version */
+    uint16_t subsys_minor;   /* minor subsystem version */
+    uint32_t win32_version;  /* reserved, must be 0 */
+    uint32_t image_size;     /* image size */
+    uint32_t header_size;    /* header size rounded up to file_align */
+    uint32_t csum;           /* checksum */
+    uint16_t subsys;         /* subsystem */
+    uint16_t dll_flags;      /* more flags! */
+    uint64_t stack_size_req; /* amt of stack requested */
+    uint64_t stack_size;     /* amt of stack required */
+    uint64_t heap_size_req;  /* amt of heap requested */
+    uint64_t heap_size;      /* amt of heap required */
+    uint32_t loader_flags;   /* reserved, must be 0 */
+    uint32_t data_dirs;      /* number of data dir entries */
+};
+
+struct data_dirent {
+    uint32_t rva;            /* relative to load address */
+    uint32_t size;
+};
+
+struct data_directory {
+    struct data_dirent exports;          /* .edata */
+    struct data_dirent imports;          /* .idata */
+    struct data_dirent resources;        /* .rsrc */
+    struct data_dirent exceptions;       /* .pdata */
+    struct data_dirent certs;            /* certs */
+    struct data_dirent base_relocations; /* .reloc */
+    struct data_dirent debug;            /* .debug */
+    struct data_dirent arch;             /* reservered */
+    struct data_dirent global_ptr;       /* global pointer reg. Size=0 */
+    struct data_dirent tls;              /* .tls */
+    struct data_dirent load_config;      /* load configuration structure */
+    struct data_dirent bound_imports;    /* no idea */
+    struct data_dirent import_addrs;     /* import address table */
+    struct data_dirent delay_imports;    /* delay-load import table */
+    struct data_dirent clr_runtime_hdr;  /* .cor (object only) */
+    struct data_dirent reserved;
+};
+
+struct section_header {
+    char     name[8];         /* name or string tbl offset */
+    uint32_t virtual_size;    /* size of loaded section in ram */
+    uint32_t rva;             /* relative virtual address */
+    uint32_t raw_data_size;   /* size of the section */
+    uint32_t data_addr;       /* file pointer to first page of sec */
+    uint32_t relocs;          /* file pointer to relocation entries */
+    uint32_t line_numbers;    /* line numbers */
+    uint16_t num_relocs;      /* number of relocations */
+    uint16_t num_lin_numbers; /* COFF line count */
+    uint32_t flags;
+};
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* EFI__PE_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Aug 26 20:11:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 26 Aug 2024 20:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.783590.1192884 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sig3V-0005lm-2o; Mon, 26 Aug 2024 20:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 783590.1192884; Mon, 26 Aug 2024 20: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 1sig3U-0005le-WE; Mon, 26 Aug 2024 20:11:13 +0000
Received: by outflank-mailman (input) for mailman id 783590;
 Mon, 26 Aug 2024 20:11:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sig3U-0005lW-EI
 for xen-changelog@lists.xenproject.org; Mon, 26 Aug 2024 20:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sig3U-00055O-Cp
 for xen-changelog@lists.xenproject.org; Mon, 26 Aug 2024 20:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sig3U-0005u2-B1
 for xen-changelog@lists.xenproject.org; Mon, 26 Aug 2024 20: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7tTSVqaHFpIVlKluS2iv60UIkiR8renLiI8N0PH4cEQ=; b=1N2sLeltrzdAGHIjrGFnO5XWQe
	AxtkEx0ZmuyoKxafvPNO2ILY9qkgMez6idJNTQ8OZEMbGUG0GGHbMMxFpXAZ0gqG7OAU1KL8ajKk3
	SyfzDiclnl3T+yEkbShYFtNm562G2qETqclj9jMwOLfuVU6Sx25GCQ9Z4MqNz6NVx3jo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/x2APIC: correct cluster tracking upon CPUs going down for S3
Message-Id: <E1sig3U-0005u2-B1@xenbits.xenproject.org>
Date: Mon, 26 Aug 2024 20:11:12 +0000

commit ad3ff7b4279d16c91c23cda6e8be5bc670b25c9a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Aug 26 10:30:40 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 26 10:30:40 2024 +0200

    x86/x2APIC: correct cluster tracking upon CPUs going down for S3
    
    Downing CPUs for S3 is somewhat special: Since we can expect the system
    to come back up in exactly the same hardware configuration, per-CPU data
    for the secondary CPUs isn't de-allocated (and then cleared upon re-
    allocation when the CPUs are being brought back up). Therefore the
    cluster_cpus per-CPU pointer will retain its value for all CPUs other
    than the final one in a cluster (i.e. in particular for all CPUs in the
    same cluster as CPU0). That, however, is in conflict with the assertion
    early in init_apic_ldr_x2apic_cluster().
    
    Note that the issue is avoided on Intel hardware, where we park CPUs
    instead of bringing them down.
    
    Extend the bypassing of the freeing to the suspend case, thus making
    suspend/resume also a tiny bit faster.
    
    Fixes: 2e6c8f182c9c ("x86: distinguish CPU offlining from CPU removal")
    Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Tested-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/genapic/x2apic.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/genapic/x2apic.c b/xen/arch/x86/genapic/x2apic.c
index 371dd100c7..d531035fa4 100644
--- a/xen/arch/x86/genapic/x2apic.c
+++ b/xen/arch/x86/genapic/x2apic.c
@@ -228,7 +228,8 @@ static int cf_check update_clusterinfo(
     case CPU_UP_CANCELED:
     case CPU_DEAD:
     case CPU_REMOVE:
-        if ( park_offline_cpus == (action != CPU_REMOVE) )
+        if ( park_offline_cpus == (action != CPU_REMOVE) ||
+             system_state == SYS_STATE_suspend )
             break;
         if ( per_cpu(cluster_cpus, cpu) )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Aug 26 20:11:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 26 Aug 2024 20:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.783593.1192888 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sig3g-0005qB-44; Mon, 26 Aug 2024 20:11:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 783593.1192888; Mon, 26 Aug 2024 20:11:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sig3g-0005q3-1T; Mon, 26 Aug 2024 20:11:24 +0000
Received: by outflank-mailman (input) for mailman id 783593;
 Mon, 26 Aug 2024 20:11:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sig3e-0005pp-Gb
 for xen-changelog@lists.xenproject.org; Mon, 26 Aug 2024 20:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sig3e-00055Z-Ft
 for xen-changelog@lists.xenproject.org; Mon, 26 Aug 2024 20:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sig3e-00060H-Es
 for xen-changelog@lists.xenproject.org; Mon, 26 Aug 2024 20: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=S9V19+TfT04gk6TSL7+epgojXQM7fi7wZTD+wAG1mEQ=; b=cb4Bxn/XSHx8mJSTefeGW2eNfM
	a7+KFGqYQXFe8UbS1AqxM361B3nYdIvvRse1ebZpbu3PwM8iq7wVdHN3TWDAfWwdDTid4if9cGAnq
	18Irt93IfueOVmo8L652Z5arXFM8+EJZXmX7FNANG3zdBiBwpaKC6dUL6gPw0JqH6nHI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pvh: Add PHYSDEVOP_setup_gsi for PVH dom0
Message-Id: <E1sig3e-00060H-Es@xenbits.xenproject.org>
Date: Mon, 26 Aug 2024 20:11:22 +0000

commit 43a1f8b38ed1ec20b47bd8c3e7de3eac845057dc
Author:     Jiqian Chen <Jiqian.Chen@amd.com>
AuthorDate: Mon Aug 26 10:32:05 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 26 10:32:05 2024 +0200

    x86/pvh: Add PHYSDEVOP_setup_gsi for PVH dom0
    
    The gsi of a passthrough device must be configured for it to be
    able to be mapped into a hvm domU.
    But When dom0 is PVH, the gsis may not get registered(see below
    clarification), it causes the info of apic, pin and irq not be
    added into irq_2_pin list, and the handler of irq_desc is not set,
    then when passthrough a device, setting ioapic affinity and vector
    will fail.
    
    To fix above problem, on Linux kernel side, a new code will
    need to call PHYSDEVOP_setup_gsi for passthrough devices to
    register gsi when dom0 is PVH.
    
    So, add PHYSDEVOP_setup_gsi into hvm_physdev_op for above
    purpose.
    
    Clarify two questions:
    First, why the gsi of devices belong to PVH dom0 can work?
    Because when probe a driver to a normal device, it uses the normal
    probe function of pci device, in its callstack, it requests irq
    and unmask corresponding ioapic of gsi, then trap into xen and
    register gsi finally.
    Callstack is(on linux kernel side) pci_device_probe->
    request_threaded_irq-> irq_startup-> __unmask_ioapic->
    io_apic_write, then trap into xen hvmemul_do_io->
    hvm_io_intercept-> hvm_process_io_intercept->
    vioapic_write_indirect-> vioapic_hwdom_map_gsi-> mp_register_gsi.
    So that the gsi can be registered.
    
    Second, why the gsi of passthrough device can't work when dom0
    is PVH?
    Because when assign a device to passthrough, it uses the specific
    probe function of pciback, in its callstack, it doesn't install a
    fake irq handler due to the ISR is not running. So that
    mp_register_gsi on Xen side is never called, then the gsi is not
    registered.
    Callstack is(on linux kernel side) pcistub_probe->pcistub_seize->
    pcistub_init_device-> xen_pcibk_reset_device->
    xen_pcibk_control_isr->isr_on==0.
    
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Signed-off-by: Huang Rui <ray.huang@amd.com>
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/hvm/hypercall.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
index c1bd17571e..44342e7e7f 100644
--- a/xen/arch/x86/hvm/hypercall.c
+++ b/xen/arch/x86/hvm/hypercall.c
@@ -80,6 +80,7 @@ long hvm_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
             return -ENOSYS;
         break;
 
+    case PHYSDEVOP_setup_gsi:
     case PHYSDEVOP_pci_mmcfg_reserved:
     case PHYSDEVOP_pci_device_add:
     case PHYSDEVOP_pci_device_remove:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Aug 26 20:11:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 26 Aug 2024 20:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.783594.1192891 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sig3q-0005sv-5q; Mon, 26 Aug 2024 20:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 783594.1192891; Mon, 26 Aug 2024 20: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 1sig3q-0005sn-2t; Mon, 26 Aug 2024 20:11:34 +0000
Received: by outflank-mailman (input) for mailman id 783594;
 Mon, 26 Aug 2024 20:11:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sig3o-0005sX-L2
 for xen-changelog@lists.xenproject.org; Mon, 26 Aug 2024 20:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sig3o-00055i-KG
 for xen-changelog@lists.xenproject.org; Mon, 26 Aug 2024 20:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sig3o-00062s-I9
 for xen-changelog@lists.xenproject.org; Mon, 26 Aug 2024 20: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uQXtPD4g8eE/oI2oEXF4mOfonprKmGZHTXKcO2kMPr4=; b=fbcfrowWDqUqVV91yUTeW9n6dc
	dvE436zRGqYfQ4AnVmgVao0OB0/P7ES/Yl/exiXt7uoUuq1pbF+aDFZT/TPJz6JO8Cy6qzdH6Mgq2
	giozZcQMme/MVkMM9DFgGy2vxJ2RDtbSSI4+LmWel8e8IeDBSQ/RA9vXkhODqab6fnw0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul: drop and avoid use of BUG()
Message-Id: <E1sig3o-00062s-I9@xenbits.xenproject.org>
Date: Mon, 26 Aug 2024 20:11:32 +0000

commit b8cdfac2be38c98dd3ad0e911a3f7f787f5bcf6b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Aug 26 10:33:09 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Aug 26 10:33:09 2024 +0200

    x86emul: drop and avoid use of BUG()
    
    Generally it is not a good idea to use BUG() in emulator code. Even for
    internal flaws we're better off returning errors to callers, rather than
    crashing the system. Replace the sole remaining use and remove the
    test / fuzzing harness surrogate. Put in place a declaration pleasing
    the compiler when finding uses in Xen headers, while at the same time
    breaking the build (at linking time) in case an active reference would
    newly appear.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/x86_emulator/x86-emulate.h | 1 -
 xen/arch/x86/x86_emulate/decode.c      | 4 +++-
 xen/arch/x86/x86_emulate/private.h     | 3 +++
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/tools/tests/x86_emulator/x86-emulate.h b/tools/tests/x86_emulator/x86-emulate.h
index d2012ab767..4fca051152 100644
--- a/tools/tests/x86_emulator/x86-emulate.h
+++ b/tools/tests/x86_emulator/x86-emulate.h
@@ -42,7 +42,6 @@
 
 #include <xen-tools/common-macros.h>
 
-#define BUG() abort()
 #define ASSERT assert
 #define ASSERT_UNREACHABLE() assert(!__LINE__)
 
diff --git a/xen/arch/x86/x86_emulate/decode.c b/xen/arch/x86/x86_emulate/decode.c
index ee4cbdc000..5a880578c7 100644
--- a/xen/arch/x86/x86_emulate/decode.c
+++ b/xen/arch/x86/x86_emulate/decode.c
@@ -1122,7 +1122,9 @@ int x86emul_decode(struct x86_emulate_state *s,
             switch ( def_ad_bytes )
             {
             default:
-                BUG(); /* Shouldn't be possible. */
+                ASSERT_UNREACHABLE(); /* Shouldn't be possible. */
+                return X86EMUL_UNHANDLEABLE;
+
             case 2:
                 if ( ctxt->regs->eflags & X86_EFLAGS_VM )
                     break;
diff --git a/xen/arch/x86/x86_emulate/private.h b/xen/arch/x86/x86_emulate/private.h
index a2faa8b29b..f735bb6a5a 100644
--- a/xen/arch/x86/x86_emulate/private.h
+++ b/xen/arch/x86/x86_emulate/private.h
@@ -15,6 +15,9 @@
 # include <asm/x86-vendors.h>
 # include <asm/x86_emulate.h>
 
+# undef BUG /* Make sure it's not used anywhere here. */
+void BUG(void);
+
 # ifndef CONFIG_HVM
 #  define X86EMUL_NO_FPU
 #  define X86EMUL_NO_MMX
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Aug 27 17:55:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Aug 2024 17:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.784293.1193686 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sj0PJ-0003Pr-UM; Tue, 27 Aug 2024 17:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 784293.1193686; Tue, 27 Aug 2024 17:55: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 1sj0PJ-0003Pj-Ri; Tue, 27 Aug 2024 17:55:05 +0000
Received: by outflank-mailman (input) for mailman id 784293;
 Tue, 27 Aug 2024 17:55:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sj0PI-0003Pd-9R
 for xen-changelog@lists.xenproject.org; Tue, 27 Aug 2024 17:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sj0PH-0003xa-Qz
 for xen-changelog@lists.xenproject.org; Tue, 27 Aug 2024 17:55:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sj0PH-0001oF-Ov
 for xen-changelog@lists.xenproject.org; Tue, 27 Aug 2024 17:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=h68ccHJKatSvlVzk/MHZJtjv5LoK6yOgwrPF4EtgFvM=; b=Hlwz9PbLqhIu1VIfbeqdqAqKzK
	RzG/aHEh2SB0lYIO7Qt80NnU4y6l1O5jS16DTv46i/jQNNVbWSbYT3EsA7eT3AnxiyNDDCKHkya9a
	gMjdyE3jenh8mOWMzorpvmsulGZrM8Olk3YO0me8nnGJSXvAI/6foXqCRArIS7Q4Rjxo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Preserve the value clobbered by the load-base calculation
Message-Id: <E1sj0PH-0001oF-Ov@xenbits.xenproject.org>
Date: Tue, 27 Aug 2024 17:55:03 +0000

commit e58a2858d588ed57ca13200f3d3148d78ad0e491
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Thu Aug 22 15:00:43 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Aug 27 18:08:19 2024 +0100

    x86/boot: Preserve the value clobbered by the load-base calculation
    
    Right now, Xen clobbers the value at 0xffc when performing it's load-base
    calculation.  We've got plenty of free registers at this point, so the value
    can be preserved easily.
    
    This fixes a real bug booting under Coreboot+SeaBIOS, where 0xffc happens to
    be the cbmem pointer (e.g. Coreboot's dmesg ring, among other things).
    
    However, there's also a better choice of memory location to use than 0xffc, as
    all our supported boot protocols have a pointer to an info structure in %ebx.
    
    Update the documentation to match.
    
    Fixes: 1695e53851e5 ("x86/boot: Fix the boot time relocation calculations")
    Fixes: d96bb172e8c9 ("x86/entry: Early PVH boot code")
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 docs/hypervisor-guide/x86/how-xen-boots.rst | 12 ++++++++---
 xen/arch/x86/boot/head.S                    | 33 +++++++++++++++++++----------
 2 files changed, 31 insertions(+), 14 deletions(-)

diff --git a/docs/hypervisor-guide/x86/how-xen-boots.rst b/docs/hypervisor-guide/x86/how-xen-boots.rst
index ca77d7c8a3..8b3229005c 100644
--- a/docs/hypervisor-guide/x86/how-xen-boots.rst
+++ b/docs/hypervisor-guide/x86/how-xen-boots.rst
@@ -96,6 +96,12 @@ Xen, once loaded into memory, identifies its position in order to relocate
 system structures.  For 32bit entrypoints, this necessarily requires a call
 instruction, and therefore a stack, but none of the ABIs provide one.
 
-Overall, given that on a BIOS-based system, the IVT and BDA occupy the first
-5/16ths of the first page of RAM, with the rest free to use, Xen assumes the
-top of the page is safe to use.
+In each supported 32bit entry protocol, ``%ebx`` is a pointer to an info
+structure, and it is highly likely that this structure does not overlap with
+Xen.  Therefore we use this as a temporary stack, preserving the prior value,
+in order to calculate Xen's position in memory.
+
+If this heuristic happens to be wrong (most likely because we were booted by
+some other protocol), the calculation stills works as long as ``%ebx`` points
+at RAM and does not alias the currently-executing instructions.  This is
+reasonably likely, and the best we can manage given no other information.
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index d8ac0f0494..d867b015d9 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -414,17 +414,23 @@ __pvh_start:
         cli
 
         /*
-         * We need one push/pop to determine load address.  Use the same
-         * absolute stack address as the native path, for lack of a better
-         * alternative.
+         * We need one call (i.e. push) to determine the load address.  See
+         * __start for a discussion on how to do this safely using the PVH
+         * info structure.
          */
-        mov     $0x1000, %esp
+
+        /* Preserve the field we're about to clobber. */
+        mov     (%ebx), %edx
+        lea     4(%ebx), %esp
 
         /* Calculate the load base address. */
         call    1f
 1:      pop     %esi
         sub     $sym_offs(1b), %esi
 
+        /* Restore the clobbered field. */
+        mov     %edx, (%ebx)
+
         /* Set up stack. */
         lea     STACK_SIZE - CPUINFO_sizeof + sym_esi(cpu0_stack), %esp
 
@@ -460,21 +466,26 @@ __start:
         /*
          * Multiboot (both 1 and 2) specify the stack pointer as undefined
          * when entering in BIOS circumstances.  This is unhelpful for
-         * relocatable images, where one push/pop is required to calculate
-         * images load address.
+         * relocatable images, where one call (i.e. push) is required to
+         * calculate the image's load address.
          *
-         * On a BIOS-based system, the IVT and BDA occupy the first 5/16ths of
-         * the first page of RAM, with the rest free for use.  Use the top of
-         * this page for a temporary stack, being one of the safest locations
-         * to clobber.
+         * This early in boot, there is one area of memory we know about with
+         * reasonable confidence that it isn't overlapped by Xen, and that's
+         * the Multiboot info structure in %ebx.  Use it as a temporary stack.
          */
-        mov     $0x1000, %esp
+
+        /* Preserve the field we're about to clobber. */
+        mov     (%ebx), %edx
+        lea     4(%ebx), %esp
 
         /* Calculate the load base address. */
         call    1f
 1:      pop     %esi
         sub     $sym_offs(1b), %esi
 
+        /* Restore the clobbered field. */
+        mov     %edx, (%ebx)
+
         /* Set up stack. */
         lea     STACK_SIZE - CPUINFO_sizeof + sym_esi(cpu0_stack), %esp
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 27 17:55:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Aug 2024 17:55:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.784294.1193689 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sj0PS-0003Rn-Vk; Tue, 27 Aug 2024 17:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 784294.1193689; Tue, 27 Aug 2024 17: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 1sj0PS-0003Rf-T9; Tue, 27 Aug 2024 17:55:14 +0000
Received: by outflank-mailman (input) for mailman id 784294;
 Tue, 27 Aug 2024 17:55:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sj0PS-0003RY-02
 for xen-changelog@lists.xenproject.org; Tue, 27 Aug 2024 17:55:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sj0PR-0003xx-UN
 for xen-changelog@lists.xenproject.org; Tue, 27 Aug 2024 17:55:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sj0PR-0001op-TI
 for xen-changelog@lists.xenproject.org; Tue, 27 Aug 2024 17:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5infQ5mDC7FGbHvYQu9dAKycDnbMMuZVXIuldju1I0I=; b=SEbDFwKWoin1VAtyOSBWljv6WI
	huItuEWAlSx/1+4rXUVUnIj1zCWE8Pt/alWe9U5rzufXqpVJkoIQ6udZ9qg3UU5Yx9uOJMbUdPoZK
	05pqvBSXI+4D/4Wd55R15a7ltZA4pAyYp6R1m58dzkvtX1Y4+6G+9Nv6DSHc0zyOjHD4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ARM/vgic: Use for_each_set_bit() in vgic_check_inflight_irqs_pending()
Message-Id: <E1sj0PR-0001op-TI@xenbits.xenproject.org>
Date: Tue, 27 Aug 2024 17:55:13 +0000

commit 8d820e35815c8df0f44d807e487dc42bd4672f92
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 19 02:47:14 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Aug 27 18:08:19 2024 +0100

    ARM/vgic: Use for_each_set_bit() in vgic_check_inflight_irqs_pending()
    
    ... which is better optimised for scalar values, rather than using the
    arbitrary-sized bitmap helpers.
    
    Additionally, unlike other vgic helpers, this takes both a domain and vcpu
    pointer.  The domain parameter isn't used, and the callers pass v->domain.
    
    Strip out the domain pointer.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/include/asm/vgic.h | 2 +-
 xen/arch/arm/vgic-v2.c          | 2 +-
 xen/arch/arm/vgic-v3.c          | 2 +-
 xen/arch/arm/vgic.c             | 8 ++------
 4 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/xen/arch/arm/include/asm/vgic.h b/xen/arch/arm/include/asm/vgic.h
index 79b73a0dbb..e309dca1ad 100644
--- a/xen/arch/arm/include/asm/vgic.h
+++ b/xen/arch/arm/include/asm/vgic.h
@@ -315,7 +315,7 @@ extern bool vgic_to_sgi(struct vcpu *v, register_t sgir,
                         enum gic_sgi_mode irqmode, int virq,
                         const struct sgi_target *target);
 extern bool vgic_migrate_irq(struct vcpu *old, struct vcpu *new, unsigned int irq);
-extern void vgic_check_inflight_irqs_pending(struct domain *d, struct vcpu *v,
+extern void vgic_check_inflight_irqs_pending(struct vcpu *v,
                                              unsigned int rank, uint32_t r);
 
 #endif /* !CONFIG_NEW_VGIC */
diff --git a/xen/arch/arm/vgic-v2.c b/xen/arch/arm/vgic-v2.c
index 0aa10fff0f..a19d610178 100644
--- a/xen/arch/arm/vgic-v2.c
+++ b/xen/arch/arm/vgic-v2.c
@@ -483,7 +483,7 @@ static int vgic_v2_distr_mmio_write(struct vcpu *v, mmio_info_t *info,
         rank = vgic_rank_offset(v, 1, gicd_reg - GICD_ICPENDR, DABT_WORD);
         if ( rank == NULL ) goto write_ignore;
 
-        vgic_check_inflight_irqs_pending(v->domain, v, rank->index, r);
+        vgic_check_inflight_irqs_pending(v, rank->index, r);
 
         goto write_ignore;
 
diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index cc38327701..2eaa48fadb 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -820,7 +820,7 @@ static int __vgic_v3_distr_common_mmio_write(const char *name, struct vcpu *v,
         rank = vgic_rank_offset(v, 1, reg - GICD_ICPENDR, DABT_WORD);
         if ( rank == NULL ) goto write_ignore;
 
-        vgic_check_inflight_irqs_pending(v->domain, v, rank->index, r);
+        vgic_check_inflight_irqs_pending(v, rank->index, r);
 
         goto write_ignore;
 
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 905e5eeb66..7b54ccc7cb 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -720,13 +720,9 @@ unsigned int vgic_max_vcpus(unsigned int domctl_vgic_version)
     }
 }
 
-void vgic_check_inflight_irqs_pending(struct domain *d, struct vcpu *v,
-                                      unsigned int rank, uint32_t r)
+void vgic_check_inflight_irqs_pending(struct vcpu *v, unsigned int rank, uint32_t r)
 {
-    const unsigned long mask = r;
-    unsigned int i;
-
-    bitmap_for_each ( i, &mask, 32 )
+    for_each_set_bit ( i, r )
     {
         struct pending_irq *p;
         struct vcpu *v_target;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Aug 27 17:55:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 27 Aug 2024 17:55:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.784295.1193695 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sj0Pd-0003UA-2A; Tue, 27 Aug 2024 17:55:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 784295.1193695; Tue, 27 Aug 2024 17:55: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 1sj0Pc-0003U2-Uc; Tue, 27 Aug 2024 17:55:24 +0000
Received: by outflank-mailman (input) for mailman id 784295;
 Tue, 27 Aug 2024 17:55:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sj0Pc-0003Tr-2c
 for xen-changelog@lists.xenproject.org; Tue, 27 Aug 2024 17:55:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sj0Pc-0003y8-1C
 for xen-changelog@lists.xenproject.org; Tue, 27 Aug 2024 17:55:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sj0Pc-0001pZ-09
 for xen-changelog@lists.xenproject.org; Tue, 27 Aug 2024 17:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BZEtLs4VGl4VfjkpW7L8qC83bi/tRKtnkCDEfgCo8m0=; b=E+odShuGc9EAbmj6mFwbd2gNY9
	NZTxXOo5Uwh7PTeUtZeueKTGXrwC3upHbKqnpofnnZl4RvdB3aXUAvqHG0JXUeL59bewNTNn+O4Wx
	R5YJf3bK5rBUFJRZhuWi14UnDyESNSy4VsoNVIYPa5gGAGzr937WJRR3Ceyn2Jy8A8Rk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ARM/vgic: Use for_each_set_bit() in vgic_to_sgi()
Message-Id: <E1sj0Pc-0001pZ-09@xenbits.xenproject.org>
Date: Tue, 27 Aug 2024 17:55:24 +0000

commit 9429f1a6c4758ae91f3ae721a036f4bbf76fb2b8
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 23 23:25:28 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Aug 27 18:08:19 2024 +0100

    ARM/vgic: Use for_each_set_bit() in vgic_to_sgi()
    
    The existing expression is just a very complicated way of expressing a loop
    over all bits of target->list.  Simplify the expression.
    
    While here, fix the two gprintk()'s.  Because of a quotes vs line continuation
    issue, there's a line of spaces in the middle of the format string.
    
      $ strings xen-syms-arm32 | grep -e VGIC -e GICD_SGIR
      <G><1>%pv VGIC: write r=%08x                         target->list=%hx, wrong CPUTargetList
      <G><1>%pv vGICD:unhandled GICD_SGIR write %08x                  with wrong mode
    
    not to mention trailing whitespace too.
    
    Rewrite them to be more concise and useful.  Use 0x prefixes for hex, rather
    than being ambiguous, and identify the problem target vCPU / mode, rather than
    simply saying something was wrong.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/vgic.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 7b54ccc7cb..8ffe099bcb 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -470,8 +470,7 @@ bool vgic_to_sgi(struct vcpu *v, register_t sgir, enum gic_sgi_mode irqmode,
     struct domain *d = v->domain;
     int vcpuid;
     int i;
-    unsigned int base;
-    unsigned long int bitmap;
+    unsigned int base, bitmap;
 
     ASSERT( virq < 16 );
 
@@ -481,15 +480,16 @@ bool vgic_to_sgi(struct vcpu *v, register_t sgir, enum gic_sgi_mode irqmode,
         perfc_incr(vgic_sgi_list);
         base = target->aff1 << 4;
         bitmap = target->list;
-        bitmap_for_each ( i, &bitmap, sizeof(target->list) * 8 )
+
+        for_each_set_bit ( i, bitmap )
         {
             vcpuid = base + i;
             if ( vcpuid >= d->max_vcpus || d->vcpu[vcpuid] == NULL ||
                  !is_vcpu_online(d->vcpu[vcpuid]) )
             {
-                gprintk(XENLOG_WARNING, "VGIC: write r=%"PRIregister" \
-                        target->list=%hx, wrong CPUTargetList \n",
-                        sgir, target->list);
+                gprintk(XENLOG_WARNING,
+                        "vGIC: write %#"PRIregister", target->list=%#x, bad target vcpu%d\n",
+                        sgir, target->list, vcpuid);
                 continue;
             }
             vgic_inject_irq(d, d->vcpu[vcpuid], virq, true);
@@ -510,8 +510,8 @@ bool vgic_to_sgi(struct vcpu *v, register_t sgir, enum gic_sgi_mode irqmode,
         break;
     default:
         gprintk(XENLOG_WARNING,
-                "vGICD:unhandled GICD_SGIR write %"PRIregister" \
-                 with wrong mode\n", sgir);
+                "vGICD: GICD_SGIR write %#"PRIregister" with unhandled mode %d\n",
+                sgir, irqmode);
         return false;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 28 06:44:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 28 Aug 2024 06:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.784508.1193868 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjCPT-0000WR-DZ; Wed, 28 Aug 2024 06:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 784508.1193868; Wed, 28 Aug 2024 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 1sjCPT-0000WK-Am; Wed, 28 Aug 2024 06:44:03 +0000
Received: by outflank-mailman (input) for mailman id 784508;
 Wed, 28 Aug 2024 06:44:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjCPS-0000WE-0W
 for xen-changelog@lists.xenproject.org; Wed, 28 Aug 2024 06:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjCPR-0000yY-Vp
 for xen-changelog@lists.xenproject.org; Wed, 28 Aug 2024 06:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjCPR-0006QV-Tz
 for xen-changelog@lists.xenproject.org; Wed, 28 Aug 2024 06: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kuXWYXF9UYG5ASsBUy1vc/C6dxMYZrUGpkZ22qmfYT4=; b=MRDuY0qpeaSpD1X8G3RWpo+Y9o
	iu74crEctlzO70cpoVbSRy2EWG4ZDjPrNFV/C4ZDUEUkRUitFoI7mDduPc9T1TZhXCkcCxzagSu7l
	fDtPHCJyjml/VKb0hRfdG1U8vdYG8VFviEjTUmCsyJl6GSqhiqa1UEGjRqa+IIOILpi4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Preserve the value clobbered by the load-base calculation
Message-Id: <E1sjCPR-0006QV-Tz@xenbits.xenproject.org>
Date: Wed, 28 Aug 2024 06:44:01 +0000

commit e58a2858d588ed57ca13200f3d3148d78ad0e491
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Thu Aug 22 15:00:43 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Aug 27 18:08:19 2024 +0100

    x86/boot: Preserve the value clobbered by the load-base calculation
    
    Right now, Xen clobbers the value at 0xffc when performing it's load-base
    calculation.  We've got plenty of free registers at this point, so the value
    can be preserved easily.
    
    This fixes a real bug booting under Coreboot+SeaBIOS, where 0xffc happens to
    be the cbmem pointer (e.g. Coreboot's dmesg ring, among other things).
    
    However, there's also a better choice of memory location to use than 0xffc, as
    all our supported boot protocols have a pointer to an info structure in %ebx.
    
    Update the documentation to match.
    
    Fixes: 1695e53851e5 ("x86/boot: Fix the boot time relocation calculations")
    Fixes: d96bb172e8c9 ("x86/entry: Early PVH boot code")
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 docs/hypervisor-guide/x86/how-xen-boots.rst | 12 ++++++++---
 xen/arch/x86/boot/head.S                    | 33 +++++++++++++++++++----------
 2 files changed, 31 insertions(+), 14 deletions(-)

diff --git a/docs/hypervisor-guide/x86/how-xen-boots.rst b/docs/hypervisor-guide/x86/how-xen-boots.rst
index ca77d7c8a3..8b3229005c 100644
--- a/docs/hypervisor-guide/x86/how-xen-boots.rst
+++ b/docs/hypervisor-guide/x86/how-xen-boots.rst
@@ -96,6 +96,12 @@ Xen, once loaded into memory, identifies its position in order to relocate
 system structures.  For 32bit entrypoints, this necessarily requires a call
 instruction, and therefore a stack, but none of the ABIs provide one.
 
-Overall, given that on a BIOS-based system, the IVT and BDA occupy the first
-5/16ths of the first page of RAM, with the rest free to use, Xen assumes the
-top of the page is safe to use.
+In each supported 32bit entry protocol, ``%ebx`` is a pointer to an info
+structure, and it is highly likely that this structure does not overlap with
+Xen.  Therefore we use this as a temporary stack, preserving the prior value,
+in order to calculate Xen's position in memory.
+
+If this heuristic happens to be wrong (most likely because we were booted by
+some other protocol), the calculation stills works as long as ``%ebx`` points
+at RAM and does not alias the currently-executing instructions.  This is
+reasonably likely, and the best we can manage given no other information.
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index d8ac0f0494..d867b015d9 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -414,17 +414,23 @@ __pvh_start:
         cli
 
         /*
-         * We need one push/pop to determine load address.  Use the same
-         * absolute stack address as the native path, for lack of a better
-         * alternative.
+         * We need one call (i.e. push) to determine the load address.  See
+         * __start for a discussion on how to do this safely using the PVH
+         * info structure.
          */
-        mov     $0x1000, %esp
+
+        /* Preserve the field we're about to clobber. */
+        mov     (%ebx), %edx
+        lea     4(%ebx), %esp
 
         /* Calculate the load base address. */
         call    1f
 1:      pop     %esi
         sub     $sym_offs(1b), %esi
 
+        /* Restore the clobbered field. */
+        mov     %edx, (%ebx)
+
         /* Set up stack. */
         lea     STACK_SIZE - CPUINFO_sizeof + sym_esi(cpu0_stack), %esp
 
@@ -460,21 +466,26 @@ __start:
         /*
          * Multiboot (both 1 and 2) specify the stack pointer as undefined
          * when entering in BIOS circumstances.  This is unhelpful for
-         * relocatable images, where one push/pop is required to calculate
-         * images load address.
+         * relocatable images, where one call (i.e. push) is required to
+         * calculate the image's load address.
          *
-         * On a BIOS-based system, the IVT and BDA occupy the first 5/16ths of
-         * the first page of RAM, with the rest free for use.  Use the top of
-         * this page for a temporary stack, being one of the safest locations
-         * to clobber.
+         * This early in boot, there is one area of memory we know about with
+         * reasonable confidence that it isn't overlapped by Xen, and that's
+         * the Multiboot info structure in %ebx.  Use it as a temporary stack.
          */
-        mov     $0x1000, %esp
+
+        /* Preserve the field we're about to clobber. */
+        mov     (%ebx), %edx
+        lea     4(%ebx), %esp
 
         /* Calculate the load base address. */
         call    1f
 1:      pop     %esi
         sub     $sym_offs(1b), %esi
 
+        /* Restore the clobbered field. */
+        mov     %edx, (%ebx)
+
         /* Set up stack. */
         lea     STACK_SIZE - CPUINFO_sizeof + sym_esi(cpu0_stack), %esp
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 28 06:44:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 28 Aug 2024 06:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.784509.1193871 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjCPd-0000Y9-FB; Wed, 28 Aug 2024 06:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 784509.1193871; Wed, 28 Aug 2024 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 1sjCPd-0000Y1-CN; Wed, 28 Aug 2024 06:44:13 +0000
Received: by outflank-mailman (input) for mailman id 784509;
 Wed, 28 Aug 2024 06:44:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjCPc-0000Xj-4g
 for xen-changelog@lists.xenproject.org; Wed, 28 Aug 2024 06:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjCPc-0000ye-36
 for xen-changelog@lists.xenproject.org; Wed, 28 Aug 2024 06:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjCPc-0006RL-1z
 for xen-changelog@lists.xenproject.org; Wed, 28 Aug 2024 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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NhJ4fUJlVLxLS/FFNHT3Wnj6jnW4C1N+DyLgOA1QgH8=; b=JeKIGCCai1IaTr2moRbsxrIg4A
	gGBbtAUe0Ho5uE11WnnJgzemPzJIBcxzqEffWEz3FZT8hV2UEMZYNfO40+ATLoyCJzAAC311SxiOw
	p8uKR/DBOBJQy1FlvvQO+cLAqd7iUwwPjDFA9O9/RdQZEBcHunmYHE07FmVwlBt7TJzU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ARM/vgic: Use for_each_set_bit() in vgic_check_inflight_irqs_pending()
Message-Id: <E1sjCPc-0006RL-1z@xenbits.xenproject.org>
Date: Wed, 28 Aug 2024 06:44:12 +0000

commit 8d820e35815c8df0f44d807e487dc42bd4672f92
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Jun 19 02:47:14 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Aug 27 18:08:19 2024 +0100

    ARM/vgic: Use for_each_set_bit() in vgic_check_inflight_irqs_pending()
    
    ... which is better optimised for scalar values, rather than using the
    arbitrary-sized bitmap helpers.
    
    Additionally, unlike other vgic helpers, this takes both a domain and vcpu
    pointer.  The domain parameter isn't used, and the callers pass v->domain.
    
    Strip out the domain pointer.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/include/asm/vgic.h | 2 +-
 xen/arch/arm/vgic-v2.c          | 2 +-
 xen/arch/arm/vgic-v3.c          | 2 +-
 xen/arch/arm/vgic.c             | 8 ++------
 4 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/xen/arch/arm/include/asm/vgic.h b/xen/arch/arm/include/asm/vgic.h
index 79b73a0dbb..e309dca1ad 100644
--- a/xen/arch/arm/include/asm/vgic.h
+++ b/xen/arch/arm/include/asm/vgic.h
@@ -315,7 +315,7 @@ extern bool vgic_to_sgi(struct vcpu *v, register_t sgir,
                         enum gic_sgi_mode irqmode, int virq,
                         const struct sgi_target *target);
 extern bool vgic_migrate_irq(struct vcpu *old, struct vcpu *new, unsigned int irq);
-extern void vgic_check_inflight_irqs_pending(struct domain *d, struct vcpu *v,
+extern void vgic_check_inflight_irqs_pending(struct vcpu *v,
                                              unsigned int rank, uint32_t r);
 
 #endif /* !CONFIG_NEW_VGIC */
diff --git a/xen/arch/arm/vgic-v2.c b/xen/arch/arm/vgic-v2.c
index 0aa10fff0f..a19d610178 100644
--- a/xen/arch/arm/vgic-v2.c
+++ b/xen/arch/arm/vgic-v2.c
@@ -483,7 +483,7 @@ static int vgic_v2_distr_mmio_write(struct vcpu *v, mmio_info_t *info,
         rank = vgic_rank_offset(v, 1, gicd_reg - GICD_ICPENDR, DABT_WORD);
         if ( rank == NULL ) goto write_ignore;
 
-        vgic_check_inflight_irqs_pending(v->domain, v, rank->index, r);
+        vgic_check_inflight_irqs_pending(v, rank->index, r);
 
         goto write_ignore;
 
diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index cc38327701..2eaa48fadb 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -820,7 +820,7 @@ static int __vgic_v3_distr_common_mmio_write(const char *name, struct vcpu *v,
         rank = vgic_rank_offset(v, 1, reg - GICD_ICPENDR, DABT_WORD);
         if ( rank == NULL ) goto write_ignore;
 
-        vgic_check_inflight_irqs_pending(v->domain, v, rank->index, r);
+        vgic_check_inflight_irqs_pending(v, rank->index, r);
 
         goto write_ignore;
 
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 905e5eeb66..7b54ccc7cb 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -720,13 +720,9 @@ unsigned int vgic_max_vcpus(unsigned int domctl_vgic_version)
     }
 }
 
-void vgic_check_inflight_irqs_pending(struct domain *d, struct vcpu *v,
-                                      unsigned int rank, uint32_t r)
+void vgic_check_inflight_irqs_pending(struct vcpu *v, unsigned int rank, uint32_t r)
 {
-    const unsigned long mask = r;
-    unsigned int i;
-
-    bitmap_for_each ( i, &mask, 32 )
+    for_each_set_bit ( i, r )
     {
         struct pending_irq *p;
         struct vcpu *v_target;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 28 06:44:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 28 Aug 2024 06:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.784510.1193877 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjCPn-0000dD-Ii; Wed, 28 Aug 2024 06:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 784510.1193877; Wed, 28 Aug 2024 06: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 1sjCPn-0000d5-Fu; Wed, 28 Aug 2024 06:44:23 +0000
Received: by outflank-mailman (input) for mailman id 784510;
 Wed, 28 Aug 2024 06:44:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjCPm-0000ct-7T
 for xen-changelog@lists.xenproject.org; Wed, 28 Aug 2024 06:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjCPm-0000z8-6W
 for xen-changelog@lists.xenproject.org; Wed, 28 Aug 2024 06:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjCPm-0006S3-56
 for xen-changelog@lists.xenproject.org; Wed, 28 Aug 2024 06: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Dk0HgUZsKvqryDU50OQ5UfD+rcQVbS3O/H+JZ6YY8bo=; b=AxQ1hyovEY08xwQ2NhseH6e0yM
	mJMZamCwQKFh8wsTf5mwafio/rLDykX3RG/TpnoYCCAhrE199XvtFNMZasHudZx3/wZLn3B5PnXo7
	4ETE2XImI0mmnfc0E5cMgD0mPjXgfxNdlLrt72fECWfO710zNM49TnuX3jO+P9PRQamE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ARM/vgic: Use for_each_set_bit() in vgic_to_sgi()
Message-Id: <E1sjCPm-0006S3-56@xenbits.xenproject.org>
Date: Wed, 28 Aug 2024 06:44:22 +0000

commit 9429f1a6c4758ae91f3ae721a036f4bbf76fb2b8
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 23 23:25:28 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Aug 27 18:08:19 2024 +0100

    ARM/vgic: Use for_each_set_bit() in vgic_to_sgi()
    
    The existing expression is just a very complicated way of expressing a loop
    over all bits of target->list.  Simplify the expression.
    
    While here, fix the two gprintk()'s.  Because of a quotes vs line continuation
    issue, there's a line of spaces in the middle of the format string.
    
      $ strings xen-syms-arm32 | grep -e VGIC -e GICD_SGIR
      <G><1>%pv VGIC: write r=%08x                         target->list=%hx, wrong CPUTargetList
      <G><1>%pv vGICD:unhandled GICD_SGIR write %08x                  with wrong mode
    
    not to mention trailing whitespace too.
    
    Rewrite them to be more concise and useful.  Use 0x prefixes for hex, rather
    than being ambiguous, and identify the problem target vCPU / mode, rather than
    simply saying something was wrong.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/vgic.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 7b54ccc7cb..8ffe099bcb 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -470,8 +470,7 @@ bool vgic_to_sgi(struct vcpu *v, register_t sgir, enum gic_sgi_mode irqmode,
     struct domain *d = v->domain;
     int vcpuid;
     int i;
-    unsigned int base;
-    unsigned long int bitmap;
+    unsigned int base, bitmap;
 
     ASSERT( virq < 16 );
 
@@ -481,15 +480,16 @@ bool vgic_to_sgi(struct vcpu *v, register_t sgir, enum gic_sgi_mode irqmode,
         perfc_incr(vgic_sgi_list);
         base = target->aff1 << 4;
         bitmap = target->list;
-        bitmap_for_each ( i, &bitmap, sizeof(target->list) * 8 )
+
+        for_each_set_bit ( i, bitmap )
         {
             vcpuid = base + i;
             if ( vcpuid >= d->max_vcpus || d->vcpu[vcpuid] == NULL ||
                  !is_vcpu_online(d->vcpu[vcpuid]) )
             {
-                gprintk(XENLOG_WARNING, "VGIC: write r=%"PRIregister" \
-                        target->list=%hx, wrong CPUTargetList \n",
-                        sgir, target->list);
+                gprintk(XENLOG_WARNING,
+                        "vGIC: write %#"PRIregister", target->list=%#x, bad target vcpu%d\n",
+                        sgir, target->list, vcpuid);
                 continue;
             }
             vgic_inject_irq(d, d->vcpu[vcpuid], virq, true);
@@ -510,8 +510,8 @@ bool vgic_to_sgi(struct vcpu *v, register_t sgir, enum gic_sgi_mode irqmode,
         break;
     default:
         gprintk(XENLOG_WARNING,
-                "vGICD:unhandled GICD_SGIR write %"PRIregister" \
-                 with wrong mode\n", sgir);
+                "vGICD: GICD_SGIR write %#"PRIregister" with unhandled mode %d\n",
+                sgir, irqmode);
         return false;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Aug 28 10:00:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 28 Aug 2024 10:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.784633.1194029 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjFTC-0000yq-55; Wed, 28 Aug 2024 10:00:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 784633.1194029; Wed, 28 Aug 2024 10:00: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 1sjFTC-0000yk-2g; Wed, 28 Aug 2024 10:00:06 +0000
Received: by outflank-mailman (input) for mailman id 784633;
 Wed, 28 Aug 2024 10:00:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjFTA-0000gU-LS
 for xen-changelog@lists.xenproject.org; Wed, 28 Aug 2024 10:00:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjFTA-0005BF-8h
 for xen-changelog@lists.xenproject.org; Wed, 28 Aug 2024 10:00:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjFTA-00087W-5Y
 for xen-changelog@lists.xenproject.org; Wed, 28 Aug 2024 10:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PZTRL1I2vvJPPGXok16lxK+h232G6XyU2x7Tlmw+Rb8=; b=B2hn8WEGDbxp1UE4I+SAzDZ7be
	y3zXZs7U/Ko8QBzDdJxUUWN6ZlpvsF1S59VEXKTfUwM8IO1tGtF3skoz5hnqZIvcjOQKctN0DcTLr
	D09KfhaKdaO7XQGOQlLvbet2/5++MvF07n5uPj4gJ0p+0HfHAwlzNmfie8VUZivOB9tY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ARM/vgic: Fix variable shadowing in vgic_to_sgi()
Message-Id: <E1sjFTA-00087W-5Y@xenbits.xenproject.org>
Date: Wed, 28 Aug 2024 10:00:04 +0000

commit 73fa03573e7cdf9c6521e67b46bd51ff5a8e1886
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Aug 28 00:33:19 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Aug 28 10:49:26 2024 +0100

    ARM/vgic: Fix variable shadowing in vgic_to_sgi()
    
    for_each_set_bit() allocates its own variable intentionally as loop-scope
    only.  Unfortunately, this causes the inner 'i' to shadow the outer 'i', and
    violates MISRA Rule 5.3.
    
    Drop the outermost 'i' and 'vcpuid' variables, moving them into a more narrow
    scope and correcting them to be unsigned which they should have been all
    along.  Update the printk() formatting of vcpuid to match.
    
    Fixes: 9429f1a6c475 ("ARM/vgic: Use for_each_set_bit() in vgic_to_sgi()")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/vgic.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 8ffe099bcb..c563ba93af 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -468,8 +468,6 @@ bool vgic_to_sgi(struct vcpu *v, register_t sgir, enum gic_sgi_mode irqmode,
                  int virq, const struct sgi_target *target)
 {
     struct domain *d = v->domain;
-    int vcpuid;
-    int i;
     unsigned int base, bitmap;
 
     ASSERT( virq < 16 );
@@ -483,12 +481,13 @@ bool vgic_to_sgi(struct vcpu *v, register_t sgir, enum gic_sgi_mode irqmode,
 
         for_each_set_bit ( i, bitmap )
         {
-            vcpuid = base + i;
+            unsigned int vcpuid = base + i;
+
             if ( vcpuid >= d->max_vcpus || d->vcpu[vcpuid] == NULL ||
                  !is_vcpu_online(d->vcpu[vcpuid]) )
             {
                 gprintk(XENLOG_WARNING,
-                        "vGIC: write %#"PRIregister", target->list=%#x, bad target vcpu%d\n",
+                        "vGIC: write %#"PRIregister", target->list=%#x, bad target vcpu%u\n",
                         sgir, target->list, vcpuid);
                 continue;
             }
@@ -497,7 +496,7 @@ bool vgic_to_sgi(struct vcpu *v, register_t sgir, enum gic_sgi_mode irqmode,
         break;
     case SGI_TARGET_OTHERS:
         perfc_incr(vgic_sgi_others);
-        for ( i = 0; i < d->max_vcpus; i++ )
+        for ( unsigned int i = 0; i < d->max_vcpus; i++ )
         {
             if ( i != current->vcpu_id && d->vcpu[i] != NULL &&
                  is_vcpu_online(d->vcpu[i]) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 28 10:00:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 28 Aug 2024 10:00:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.784634.1194034 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjFTM-00015l-6n; Wed, 28 Aug 2024 10:00:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 784634.1194034; Wed, 28 Aug 2024 10:00: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 1sjFTM-00015d-4B; Wed, 28 Aug 2024 10:00:16 +0000
Received: by outflank-mailman (input) for mailman id 784634;
 Wed, 28 Aug 2024 10:00:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjFTK-00015V-Ck
 for xen-changelog@lists.xenproject.org; Wed, 28 Aug 2024 10:00:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjFTK-0005BJ-Bx
 for xen-changelog@lists.xenproject.org; Wed, 28 Aug 2024 10:00:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjFTK-0008A1-As
 for xen-changelog@lists.xenproject.org; Wed, 28 Aug 2024 10:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+nG2BzMujtji53a4i72BLXpbyxTZjL+Al77L8JTnZgQ=; b=EPalnp+qt+3xgBY+m0UE6zavKJ
	Tc2RR9la/RAdsmj/JsOpcJNOuTgEif80M2mY0ppPChhe4hfQnlFOYnLYAPCCJZpO8EfFzrrNYmMt/
	HjLP38dHbg47Z+6VOSnHiMsiVdXXigPZcuNQDLQdvtJwbSJLZtkwATSwDaQ/qCdefgvo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/evtchn: Use bitmap_for_each() in evtchn_check_pollers()
Message-Id: <E1sjFTK-0008A1-As@xenbits.xenproject.org>
Date: Wed, 28 Aug 2024 10:00:14 +0000

commit 75c64db3722f0245137a1e8cfd3435f4790d0fd7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jun 11 18:44:57 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Aug 28 10:49:26 2024 +0100

    xen/evtchn: Use bitmap_for_each() in evtchn_check_pollers()
    
    It is a preprocessor-identical opencoding.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/event_channel.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index 13b97c94d7..8db2ca4ba2 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -1517,9 +1517,7 @@ void evtchn_check_pollers(struct domain *d, unsigned int port)
         return;
 
     /* Wake any interested (or potentially interested) pollers. */
-    for ( vcpuid = find_first_bit(d->poll_mask, d->max_vcpus);
-          vcpuid < d->max_vcpus;
-          vcpuid = find_next_bit(d->poll_mask, d->max_vcpus, vcpuid+1) )
+    bitmap_for_each ( vcpuid, d->poll_mask, d->max_vcpus )
     {
         v = d->vcpu[vcpuid];
         if ( ((v->poll_evtchn <= 0) || (v->poll_evtchn == port)) &&
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 28 19:00:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 28 Aug 2024 19:00:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.785092.1194507 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjNtk-0006u7-1b; Wed, 28 Aug 2024 19:00:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 785092.1194507; Wed, 28 Aug 2024 19: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 1sjNtj-0006ti-VC; Wed, 28 Aug 2024 19:00:03 +0000
Received: by outflank-mailman (input) for mailman id 785092;
 Wed, 28 Aug 2024 19:00:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjNtj-0006mO-FD
 for xen-changelog@lists.xenproject.org; Wed, 28 Aug 2024 19:00:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjNtj-0007bW-AA
 for xen-changelog@lists.xenproject.org; Wed, 28 Aug 2024 19:00:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjNtj-0004WX-8c
 for xen-changelog@lists.xenproject.org; Wed, 28 Aug 2024 19:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QLSG2fTZfTTtRqgjRHKWE9SwDEG183mM9axgBgR+lik=; b=tR4VOpx/yI5KEuPv/URyedUQrU
	02aCzfpQsllLDPxEsor9APcSwEQ1OsoQF8zFuGk1MXPpZTmk/Rkr8XuIdwuDMS9jiap4CRBwLD36N
	bYo3n4+eIOm5N3lddrX2029If/0H0k7390KYx2k1GKnNLh93pgSaImDdkXXtkJ9ynDUo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] oss-fuzz: Fix coverage runtime error
Message-Id: <E1sjNtj-0004WX-8c@xenbits.xenproject.org>
Date: Wed, 28 Aug 2024 19:00:03 +0000

commit 51e1c041f594bb2d0c2aa7666ec0a3d38537a49e
Author:     Tamas K Lengyel <tamas@tklengyel.com>
AuthorDate: Wed Aug 28 09:38:23 2024 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Aug 28 19:43:32 2024 +0100

    oss-fuzz: Fix coverage runtime error
    
    The oss-fuzz infrastructure collects runtime coverage information for debugging
    and fuzzing evaluation. Currently it appears broken due to missing C files.
    This is because the fuzzer's Makefile only symlinks the C files from various
    locations in the Xen source tree into the build folder. These symlinks however
    are gone as oss-fuzz uses separate docker containers for the build and for the
    run.
    
    Update the oss-fuzz build script to copy the required C files into the
    build folder to fix this oss-fuzz specific issue.
    
    Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/fuzz/oss-fuzz/build.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/fuzz/oss-fuzz/build.sh b/tools/fuzz/oss-fuzz/build.sh
index 08eeb66e4c..002d86c44f 100644
--- a/tools/fuzz/oss-fuzz/build.sh
+++ b/tools/fuzz/oss-fuzz/build.sh
@@ -9,3 +9,7 @@ cd xen
 make clang=y -C tools/include
 make clang=y -C tools/fuzz/x86_instruction_emulator libfuzzer-harness
 cp tools/fuzz/x86_instruction_emulator/libfuzzer-harness $OUT/x86_instruction_emulator
+
+# Runtime coverage collection requires access to source files and symlinks don't work
+cp xen/lib/x86/*.c tools/fuzz/x86_instruction_emulator
+cp tools/tests/x86_emulator/*.c tools/fuzz/x86_instruction_emulator
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Aug 28 19:00:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 28 Aug 2024 19:00:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.785093.1194511 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjNtu-0007RY-2q; Wed, 28 Aug 2024 19:00:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 785093.1194511; Wed, 28 Aug 2024 19: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 1sjNtu-0007RR-0O; Wed, 28 Aug 2024 19:00:14 +0000
Received: by outflank-mailman (input) for mailman id 785093;
 Wed, 28 Aug 2024 19:00:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjNtt-0007RL-Fi
 for xen-changelog@lists.xenproject.org; Wed, 28 Aug 2024 19:00:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjNtt-0007be-EQ
 for xen-changelog@lists.xenproject.org; Wed, 28 Aug 2024 19:00:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjNtt-0004Yr-Cd
 for xen-changelog@lists.xenproject.org; Wed, 28 Aug 2024 19:00: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hrkmmUsZkvKuq+2I/qzbpHMXEJU6pSf/gbkHNq/QB0w=; b=ZADs4LS5H2hE/727Adw4i+PP47
	sp8Cq5pA7E2AzcSmYs7+ecpLfSGrEXpU7iOn9nyyVEd15AxjG4hw2ccDtpRfJD6/P74nww3H2WLy4
	1nNrmZ8tmkEsro7GK6jbK5s/c4XB9hcUTvQPmbuD0S/iLdMvFGtFlcJzY/sSim+e0jY0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/dom0: disable SMAP for PV domain building only
Message-Id: <E1sjNtt-0004Yr-Cd@xenbits.xenproject.org>
Date: Wed, 28 Aug 2024 19:00:13 +0000

commit fb1658221a31ec1db33253a80001191391e73b17
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Aug 28 13:30:44 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Aug 28 19:59:07 2024 +0100

    x86/dom0: disable SMAP for PV domain building only
    
    Move the logic that disables SMAP so it's only performed when building a PV
    dom0, PVH dom0 builder doesn't require disabling SMAP.
    
    The fixes tag is to account for the wrong usage of cpu_has_smap in
    create_dom0(), it should instead have used
    boot_cpu_has(X86_FEATURE_XEN_SMAP).  Fix while moving the logic to apply to PV
    only.
    
    While there also make cr4_pv32_mask __ro_after_init.
    
    Fixes: 493ab190e5b1 ('xen/sm{e, a}p: allow disabling sm{e, a}p for Xen itself')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/setup.h |  2 ++
 xen/arch/x86/pv/dom0_build.c     | 40 +++++++++++++++++++++++++++++++++++-----
 xen/arch/x86/setup.c             | 20 +-------------------
 3 files changed, 38 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h
index d75589178b..8f7dfefb4d 100644
--- a/xen/arch/x86/include/asm/setup.h
+++ b/xen/arch/x86/include/asm/setup.h
@@ -64,6 +64,8 @@ extern bool opt_dom0_verbose;
 extern bool opt_dom0_cpuid_faulting;
 extern bool opt_dom0_msr_relaxed;
 
+extern unsigned long cr4_pv32_mask;
+
 #define max_init_domid (0)
 
 #endif
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 57e58a02e7..57b1834b5e 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -354,11 +354,11 @@ static struct page_info * __init alloc_chunk(struct domain *d,
     return page;
 }
 
-int __init dom0_construct_pv(struct domain *d,
-                             const module_t *image,
-                             unsigned long image_headroom,
-                             module_t *initrd,
-                             const char *cmdline)
+static int __init dom0_construct(struct domain *d,
+                                 const module_t *image,
+                                 unsigned long image_headroom,
+                                 module_t *initrd,
+                                 const char *cmdline)
 {
     int i, rc, order, machine;
     bool compatible, compat;
@@ -1051,6 +1051,36 @@ out:
     return rc;
 }
 
+int __init dom0_construct_pv(struct domain *d,
+                             const module_t *image,
+                             unsigned long image_headroom,
+                             module_t *initrd,
+                             const char *cmdline)
+{
+    int rc;
+
+    /*
+     * Clear SMAP in CR4 to allow user-accesses in construct_dom0().  This
+     * prevents us needing to write rewrite construct_dom0() in terms of
+     * copy_{to,from}_user().
+     */
+    if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
+    {
+        cr4_pv32_mask &= ~X86_CR4_SMAP;
+        write_cr4(read_cr4() & ~X86_CR4_SMAP);
+    }
+
+    rc = dom0_construct(d, image, image_headroom, initrd, cmdline);
+
+    if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
+    {
+        write_cr4(read_cr4() | X86_CR4_SMAP);
+        cr4_pv32_mask |= X86_CR4_SMAP;
+    }
+
+    return rc;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index eee20bb175..f1076c7203 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -79,8 +79,7 @@ bool __read_mostly use_invpcid;
 int8_t __initdata opt_probe_port_aliases = -1;
 boolean_param("probe-port-aliases", opt_probe_port_aliases);
 
-/* Only used in asm code and within this source file */
-unsigned long asmlinkage __read_mostly cr4_pv32_mask;
+unsigned long __ro_after_init cr4_pv32_mask;
 
 /* **** Linux config option: propagated to domain0. */
 /* "acpi=off":    Sisables both ACPI table parsing and interpreter. */
@@ -955,26 +954,9 @@ static struct domain *__init create_dom0(const module_t *image,
         }
     }
 
-    /*
-     * Temporarily clear SMAP in CR4 to allow user-accesses in construct_dom0().
-     * This saves a large number of corner cases interactions with
-     * copy_from_user().
-     */
-    if ( cpu_has_smap )
-    {
-        cr4_pv32_mask &= ~X86_CR4_SMAP;
-        write_cr4(read_cr4() & ~X86_CR4_SMAP);
-    }
-
     if ( construct_dom0(d, image, headroom, initrd, cmdline) != 0 )
         panic("Could not construct domain 0\n");
 
-    if ( cpu_has_smap )
-    {
-        write_cr4(read_cr4() | X86_CR4_SMAP);
-        cr4_pv32_mask |= X86_CR4_SMAP;
-    }
-
     return d;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 29 00:44:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Aug 2024 00:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.785341.1194787 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjTGf-0005zt-Dp; Thu, 29 Aug 2024 00:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 785341.1194787; Thu, 29 Aug 2024 00:44: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 1sjTGf-0005zh-Av; Thu, 29 Aug 2024 00:44:05 +0000
Received: by outflank-mailman (input) for mailman id 785341;
 Thu, 29 Aug 2024 00:44:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjTGe-0005zZ-2s
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 00:44:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjTGd-00079i-Vs
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 00:44:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjTGd-0000aY-U7
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 00:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MLLks0yxG+55xj++v8BnWeLkQWPA9ndYHiVYT6bjK0U=; b=Cai4ACuy7G9/gn2BgCxnbV9YqR
	kvTdVju6A1+Un89BIxMJlT0KdedVqGseER4ajJVBjI9h8RuPWtrEVogMjS0DagQ2HBv/TDfER8OvQ
	+HEhZUHyREylaCbybTJ7wiKPQiW3EdmDkVeHr4IhJSkENiA6oKfzj8BvJl4bbKxtPl30=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation/eclair: monitor rules 13.2 and 18.2
Message-Id: <E1sjTGd-0000aY-U7@xenbits.xenproject.org>
Date: Thu, 29 Aug 2024 00:44:03 +0000

commit 9be5bb450c71e7b99f9f4fa256b00f8d31b6c0c4
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Tue Aug 27 10:44:46 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 28 17:27:24 2024 -0700

    automation/eclair: monitor rules 13.2 and 18.2
    
    Add MISRA C:2012 Rules 13.2 and 18.2 to the monitored set.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/monitored.ecl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/automation/eclair_analysis/ECLAIR/monitored.ecl b/automation/eclair_analysis/ECLAIR/monitored.ecl
index 7b085a329a..4d9ef1bd83 100644
--- a/automation/eclair_analysis/ECLAIR/monitored.ecl
+++ b/automation/eclair_analysis/ECLAIR/monitored.ecl
@@ -52,6 +52,7 @@
 -enable=MC3R1.R11.9
 -enable=MC3R1.R12.5
 -enable=MC3R1.R13.1
+-enable=MC3R1.R13.2
 -enable=MC3R1.R13.6
 -enable=MC3R1.R14.1
 -enable=MC3R1.R14.4
@@ -65,6 +66,7 @@
 -enable=MC3R1.R17.4
 -enable=MC3R1.R17.5
 -enable=MC3R1.R17.6
+-enable=MC3R1.R18.2
 -enable=MC3R1.R18.6
 -enable=MC3R1.R18.8
 -enable=MC3R1.R19.1
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 29 00:44:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Aug 2024 00:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.785342.1194790 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjTGp-00063J-Ez; Thu, 29 Aug 2024 00:44:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 785342.1194790; Thu, 29 Aug 2024 00:44: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 1sjTGp-00063B-CO; Thu, 29 Aug 2024 00:44:15 +0000
Received: by outflank-mailman (input) for mailman id 785342;
 Thu, 29 Aug 2024 00:44:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjTGo-00062B-4O
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 00:44:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjTGo-00079m-2p
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 00:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjTGo-0000bb-1p
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 00:44: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=x8MHdzEeYl6cp/sgMGYu0tcu0xEw8hGssV0qTXqZu1s=; b=UQF7KR3LFU9VuZ4EilAGYg9DXj
	PAR+X1TEUP8sFMKlxRSntvbukxSZwohgDRfQ4sYLOUIjXXBjNCviqIdA6fxYXW0CwLL+iyS1ew6wF
	NzlW6gPtHdKw0nhYD8qO1d+g5XaK3GuC0Yh15PN67ABAa1TcJKyXLnKU6JoRElTNG1xQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation/eclair: extend existing deviations of MISRA C Rule 16.3
Message-Id: <E1sjTGo-0000bb-1p@xenbits.xenproject.org>
Date: Thu, 29 Aug 2024 00:44:14 +0000

commit b1b1d1c07e904eb448669f25649c1df2fadf6f59
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Tue Aug 20 10:19:22 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 28 17:28:47 2024 -0700

    automation/eclair: extend existing deviations of MISRA C Rule 16.3
    
    Update ECLAIR configuration to deviate more cases where an
    unintentional fallthrough cannot happen.
    
    Tag Rule 16.3 as clean for arm.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 28 +++++++++++++++++++-----
 automation/eclair_analysis/ECLAIR/tagging.ecl    |  2 +-
 docs/misra/deviations.rst                        | 28 +++++++++++++++++++++---
 3 files changed, 48 insertions(+), 10 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index 1aa8277066..9051f41602 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -461,14 +461,30 @@ therefore it is deemed better to leave such files as is."
 -config=MC3R1.R16.2,reports+={deliberate, "any_area(any_loc(file(x86_emulate||x86_svm_emulate)))"}
 -doc_end
 
--doc_begin="Switch clauses ending with continue, goto, return statements are
-safe."
--config=MC3R1.R16.3,terminals+={safe, "node(continue_stmt||goto_stmt||return_stmt)"}
+-doc_begin="Statements that change the control flow (i.e., break, continue, goto, return) and calls to functions that do not return the control back are \"allowed terminal statements\"."
+-stmt_selector+={r16_3_allowed_terminal, "node(break_stmt||continue_stmt||goto_stmt||return_stmt)||call(property(noreturn))"}
+-config=MC3R1.R16.3,terminals+={safe, "r16_3_allowed_terminal"}
+-doc_end
+
+-doc_begin="An if-else statement having both branches ending with an allowed terminal statement is itself an allowed terminal statement."
+-stmt_selector+={r16_3_if, "node(if_stmt)&&(child(then,r16_3_allowed_terminal)||child(then,any_stmt(stmt,-1,r16_3_allowed_terminal)))"}
+-stmt_selector+={r16_3_else, "node(if_stmt)&&(child(else,r16_3_allowed_terminal)||child(else,any_stmt(stmt,-1,r16_3_allowed_terminal)))"}
+-stmt_selector+={r16_3_if_else, "r16_3_if&&r16_3_else"}
+-config=MC3R1.R16.3,terminals+={safe, "r16_3_if_else"}
+-doc_end
+
+-doc_begin="An if-else statement having an always true condition and the true branch ending with an allowed terminal statement is itself an allowed terminal statement."
+-stmt_selector+={r16_3_if_true, "r16_3_if&&child(cond,definitely_in(1..))"}
+-config=MC3R1.R16.3,terminals+={safe, "r16_3_if_true"}
+-doc_end
+
+-doc_begin="A switch clause ending with a statement expression which, in turn, ends with an allowed terminal statement is safe."
+-config=MC3R1.R16.3,terminals+={safe, "node(stmt_expr)&&child(stmt,node(compound_stmt)&&any_stmt(stmt,-1,r16_3_allowed_terminal||r16_3_if_else||r16_3_if_true))"}
 -doc_end
 
--doc_begin="Switch clauses ending with a call to a function that does not give
-the control back (i.e., a function with attribute noreturn) are safe."
--config=MC3R1.R16.3,terminals+={safe, "call(property(noreturn))"}
+-doc_begin="A switch clause ending with a do-while-false the body of which, in turn, ends with an allowed terminal statement is safe.
+An exception to that is the macro ASSERT_UNREACHABLE() which is effective in debug build only: a switch clause ending with ASSERT_UNREACHABLE() is not considered safe."
+-config=MC3R1.R16.3,terminals+={safe, "!macro(name(ASSERT_UNREACHABLE))&&node(do_stmt)&&child(cond,definitely_in(0))&&child(body,any_stmt(stmt,-1,r16_3_allowed_terminal||r16_3_if_else||r16_3_if_true))"}
 -doc_end
 
 -doc_begin="Switch clauses ending with pseudo-keyword \"fallthrough\" are
diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index 4d0ac94848..b8448938e6 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -112,7 +112,7 @@ if(string_equal(target,"x86_64"),
 )
 
 if(string_equal(target,"arm64"),
-    service_selector({"additional_clean_guidelines","MC3R1.R16.6||MC3R1.R2.1||MC3R1.R5.3||MC3R1.R7.3"})
+    service_selector({"additional_clean_guidelines","MC3R1.R2.1||MC3R1.R5.3||MC3R1.R7.3||MC3R1.R16.3||MC3R1.R16.6"})
 )
 
 -reports+={clean:added,"service(clean_guidelines_common||additional_clean_guidelines)"}
diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
index d51aa422b5..b66c271c4e 100644
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -415,12 +415,34 @@ Deviations related to MISRA C:2012 Rules:
      - Tagged as `deliberate` for ECLAIR.
 
    * - R16.3
-     - Switch clauses ending with continue, goto, return statements are safe.
+     - Statements that change the control flow (i.e., break, continue, goto,
+       return) and calls to functions that do not return the control back are
+       \"allowed terminal statements\".
      - Tagged as `safe` for ECLAIR.
 
    * - R16.3
-     - Switch clauses ending with a call to a function that does not give
-       the control back (i.e., a function with attribute noreturn) are safe.
+     - An if-else statement having both branches ending with one of the allowed
+       terminal statemets is itself an allowed terminal statements.
+     - Tagged as `safe` for ECLAIR.
+
+   * - R16.3
+     - An if-else statement having an always true condition and the true
+       branch ending with an allowed terminal statement is itself an allowed
+       terminal statement.
+     - Tagged as `safe` for ECLAIR.
+
+   * - R16.3
+     - A switch clause ending with a statement expression which, in turn, ends
+       with an allowed terminal statement (e.g., the expansion of
+       generate_exception()) is safe.
+     - Tagged as `safe` for ECLAIR.
+
+   * - R16.3
+     - A switch clause ending with a do-while-false the body of which, in turn,
+       ends with an allowed terminal statement (e.g., PARSE_ERR_RET()) is safe.
+       An exception to that is the macro ASSERT_UNREACHABLE() which is
+       effective in debug build only: a switch clause ending with
+       ASSERT_UNREACHABLE() is not considered safe.
      - Tagged as `safe` for ECLAIR.
 
    * - R16.3
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 29 00:55:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Aug 2024 00:55:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.785349.1194803 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjTRJ-00005M-E1; Thu, 29 Aug 2024 00:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 785349.1194803; Thu, 29 Aug 2024 00:55: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 1sjTRJ-00005F-BZ; Thu, 29 Aug 2024 00:55:05 +0000
Received: by outflank-mailman (input) for mailman id 785349;
 Thu, 29 Aug 2024 00:55:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjTRH-000056-Ua
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 00:55:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjTRH-0007PC-M6
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 00:55:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjTRH-0001Vu-L5
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 00:55: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WfW0gJK3Rkj2X0SgSI46gG6yiXKieOZBnl9xJW4Idqk=; b=suU4kxJTxAsG97enTVHPVvY0w7
	pNl20VsO0j822TRFrr+qdVQYwgOvgtjYu9ogPwEiX63vPtEcy12I08UW/z4mJLpEcejNWBwmEDAd/
	dzySEUDHLpG4X1dT+YsqhQdW2nizTr0iios56REGe9UL+3JZtUY75Nw2tIherYRjD/bw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: add linker symbol name script
Message-Id: <E1sjTRH-0001Vu-L5@xenbits.xenproject.org>
Date: Thu, 29 Aug 2024 00:55:03 +0000

commit 0e0426dda4bcc67826a575822538583e8f5b7cfc
Author:     Victor Lira <victorm.lira@amd.com>
AuthorDate: Thu Jul 25 12:01:53 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 28 17:47:40 2024 -0700

    automation: add linker symbol name script
    
    Requested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Victor Lira <victorm.lira@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/linker-symbols.sh | 34 ++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/automation/eclair_analysis/linker-symbols.sh b/automation/eclair_analysis/linker-symbols.sh
new file mode 100755
index 0000000000..0f49aed88c
--- /dev/null
+++ b/automation/eclair_analysis/linker-symbols.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+# Stop immediately if any executed command has exit status different from 0.
+set -e
+
+# Extract linker symbol names (except those starting with ".") from assignments.
+
+script_name=$(basename "$0")
+script_dir="$(
+  cd "$(dirname "$0")"
+  echo "${PWD}"
+)"
+src_dir="${script_dir}/../.."
+
+fatal() {
+  echo "${script_name}: $*" >&2
+  exit 1
+}
+
+usage() {
+  fatal "Usage: ${script_name} <arch>"
+}
+
+if [ $# -ne 1 ]; then
+  usage
+fi
+
+filepath="${src_dir}/xen/arch/${1}/xen.lds"
+
+if [ ! -f "$filepath" ]; then
+  fatal "Could not find ${1} linker script. Must be run after the build."
+fi
+
+sed -n "s/^\s*\([a-zA-Z_][a-zA-Z_0-9.\-]*\)\s*=.*;.*$/\1/p" "$filepath"
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 29 08:11:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Aug 2024 08:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.785538.1195007 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjaFF-0001qB-VH; Thu, 29 Aug 2024 08:11:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 785538.1195007; Thu, 29 Aug 2024 08:11: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 1sjaFF-0001q3-Sj; Thu, 29 Aug 2024 08:11:05 +0000
Received: by outflank-mailman (input) for mailman id 785538;
 Thu, 29 Aug 2024 08:11:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjaFE-0001pw-CZ
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 08:11:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjaFE-0006ts-3z
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 08:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjaFE-0000Tx-1j
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 08:11: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pibcquWNrYmoXcVXH9JSjM7HHnvSmf8yiuBaOZ7ZLPY=; b=hy+vsN9Q0s3eN54m/ZBhHT5Y8M
	vwamu1o2s0nqugRnY+zGb/6x/ByA1pil6HVhxJ4M9u6ZLIV4jUzBSQPx5Gf42mb5nEC1Je8uQPev6
	7SZXPKX/fmyj2Tbf7EItdBZyagu0xDqojau00qnn8GkmIprrsImcUsDeLNkYQds0kuJI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxl: Implement QEMU command line probe
Message-Id: <E1sjaFE-0000Tx-1j@xenbits.xenproject.org>
Date: Thu, 29 Aug 2024 08:11:04 +0000

commit 1817e4c3c5e4cf5ad21b76765bb19a23244b9019
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Thu Aug 29 10:00:46 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 29 10:00:46 2024 +0200

    libxl: Implement QEMU command line probe
    
    Starting with QEMU 9.0, the option "-chroot", that we use for the
    "dmrestrict" feature, is removed. We need to find out which to use
    between "-chroot" and "-run-with chroot=dir".
    
    This patch implement the machinery to spawn QEMU, and to run the QMP
    command "query-command-line-options" but doesn't yet look at the
    actual result. Whether or not to use "-run-with chroot=dir" will be
    implemented in a follow up patch.
    
    The command line used to spawn the qemu we want to probe is mostly
    similar to the one we already use for the device model, "-machine
    none" comes from libvirt.
    
    This patch implement the probing on qemu-xen, even if we probably not
    going to use the result. We could check the feature wanted for the
    domain being created, but this could get complicated fairly quickly.
    We already need to check the options "b_info->dm_restrict" for
    "-chroot" and "state->dm_runas" for "-runas" (which is deprecated).
    
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 tools/libs/light/libxl_dm.c       | 207 ++++++++++++++++++++++++++++++++++++--
 tools/libs/light/libxl_internal.h |   1 +
 2 files changed, 198 insertions(+), 10 deletions(-)

diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index ff8ddeec9a..46babfed0b 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -2858,6 +2858,20 @@ static void device_model_qmp_cb(libxl__egc *egc, libxl__ev_qmp *ev,
 static void device_model_spawn_outcome(libxl__egc *egc,
                                        libxl__dm_spawn_state *dmss,
                                        int rc);
+static void device_model_probe_startup_failed(libxl__egc *egc,
+    libxl__spawn_state *spawn, int rc);
+static void device_model_probe_confirm(libxl__egc *egc,
+    libxl__spawn_state *spawn, const char *xsdata);
+static void device_model_probe_detached(libxl__egc *egc,
+    libxl__spawn_state *spawn);
+static void device_model_probe_cmdline(libxl__egc *egc,
+    libxl__ev_qmp *qmp, const libxl__json_object *response, int rc);
+static void device_model_probe_quit(libxl__egc *egc,
+    libxl__ev_qmp *qmp, const libxl__json_object *response, int rc);
+static void device_model_probe_spawn_outcome(libxl__egc *egc,
+     libxl__dm_spawn_state *dmss, int rc);
+static void device_model_launch(libxl__egc *egc,
+    libxl__dm_spawn_state *dmss, int rc);
 static void device_model_postconfig_chardev(libxl__egc *egc,
     libxl__ev_qmp *qmp, const libxl__json_object *response, int rc);
 static void device_model_postconfig_vnc(libxl__egc *egc,
@@ -2873,25 +2887,18 @@ void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state *dmss)
 {
     /* convenience aliases */
     const int domid = dmss->guest_domid;
-    libxl__domain_build_state *const state = dmss->build_state;
     libxl__spawn_state *const spawn = &dmss->spawn;
 
     STATE_AO_GC(dmss->spawn.ao);
 
-    libxl_ctx *ctx = CTX;
     libxl_domain_config *guest_config = dmss->guest_config;
     const libxl_domain_create_info *c_info = &guest_config->c_info;
     const libxl_domain_build_info *b_info = &guest_config->b_info;
-    const libxl_vnc_info *vnc = libxl__dm_vnc(guest_config);
-    char *path;
-    int logfile_w, null;
     int rc;
-    char **args, **arg, **envs;
-    xs_transaction_t t;
-    char *vm_path;
-    char **pass_stuff;
     const char *dm;
-    int dm_state_fd = -1;
+    int logfile_w = -1, null = -1;
+    int qmp_probe_fd = -1;
+    bool probe_spawned = false;
 
     dmss_init(dmss);
 
@@ -2904,6 +2911,7 @@ void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state *dmss)
         rc = ERROR_FAIL;
         goto out;
     }
+    dmss->dm = dm;
     if (access(dm, X_OK) < 0) {
         LOGED(ERROR, domid, "device model %s is not executable", dm);
         rc = ERROR_FAIL;
@@ -2911,6 +2919,185 @@ void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state *dmss)
     }
 
     rc = libxl__domain_get_device_model_uid(gc, dmss);
+    if (rc)
+        goto out;
+
+    /* probe QEMU's available command line options */
+    if (b_info->device_model_version
+        == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
+
+        logfile_w = libxl__create_qemu_logfile(
+            gc, GCSPRINTF("qemu-probe-%s", c_info->name));
+        if (logfile_w < 0) {
+            rc = logfile_w;
+            goto out;
+        }
+        null = open("/dev/null", O_RDONLY);
+        if (null < 0) {
+            LOGED(ERROR, domid, "unable to open /dev/null");
+            rc = ERROR_FAIL;
+            goto out;
+        }
+
+        rc = libxl__pre_open_qmp_socket(gc, domid, &qmp_probe_fd);
+        if (rc) goto out;
+
+        flexarray_t *dm_args = flexarray_make(gc, 16, 1);
+        flexarray_vappend(dm_args, dm,
+                          "-S",
+                          "-no-user-config",
+                          "-nodefaults",
+                          "-nographic",
+                          "-machine", "none,accel=xen",
+                          NULL);
+        flexarray_vappend(dm_args,
+                          "-chardev",
+                          GCSPRINTF("socket,id=libxl-cmd,fd=%d,server=on,wait=off",
+                                    qmp_probe_fd),
+                          "-mon", "chardev=libxl-cmd,mode=control",
+                          NULL);
+        flexarray_append(dm_args, NULL);
+        char **exec_args = (char **) flexarray_contents(dm_args);
+
+        const char *dom_path = libxl__xs_get_dompath(gc, domid);
+
+        spawn->what = GCSPRINTF("domain %d qemu command line probe", domid);
+        spawn->xspath = "/dev/null"; /* No path to watch */
+        spawn->timeout_ms = LIBXL_DEVICE_MODEL_START_TIMEOUT * 1000;
+        spawn->pidpath = GCSPRINTF("%s/image/device-model-pid", dom_path);
+        spawn->midproc_cb = libxl__spawn_record_pid;
+        spawn->confirm_cb = device_model_probe_confirm;
+        spawn->failure_cb = device_model_probe_startup_failed;
+        spawn->detached_cb = device_model_probe_detached;
+
+        dmss->qmp.ao = ao;
+        dmss->qmp.callback = device_model_probe_cmdline;
+        dmss->qmp.domid = domid;
+        dmss->qmp.payload_fd = -1;
+        rc = libxl__ev_qmp_send(egc, &dmss->qmp, "query-command-line-options", NULL);
+        if (rc) goto out;
+
+        rc = libxl__spawn_spawn(egc, spawn);
+        if (rc < 0)
+            goto out;
+        if (!rc) { /* inner child */
+            setsid();
+            libxl__exec(gc, null, logfile_w, logfile_w, dm, exec_args, NULL);
+        }
+        probe_spawned = true;
+    } else {
+        /* Continue with launching DM instead of probing it */
+        probe_spawned = false;
+    }
+    rc = 0;
+out:
+    if (qmp_probe_fd >= 0)
+        close(qmp_probe_fd);
+    if (null >= 0)
+        close(null);
+    if (logfile_w >= 0)
+        close(logfile_w);
+    if (rc || !probe_spawned)
+        device_model_launch(egc, dmss, rc);
+}
+
+static void device_model_probe_startup_failed(libxl__egc *egc,
+    libxl__spawn_state *spawn, int rc)
+{
+    libxl__dm_spawn_state *dmss = CONTAINER_OF(spawn, *dmss, spawn);
+    device_model_probe_spawn_outcome(egc, dmss, rc);
+}
+
+static void device_model_probe_confirm(libxl__egc *egc,
+    libxl__spawn_state *spawn, const char *xsdata)
+{
+    /* Nothing to do, confirmation is done via QMP instead */
+}
+
+static void device_model_probe_detached(libxl__egc *egc,
+    libxl__spawn_state *spawn)
+{
+    libxl__dm_spawn_state *dmss = CONTAINER_OF(spawn, *dmss, spawn);
+    device_model_probe_spawn_outcome(egc, dmss, 0);
+}
+
+static void device_model_probe_cmdline(libxl__egc *egc,
+    libxl__ev_qmp *qmp, const libxl__json_object *response, int rc)
+{
+    libxl__dm_spawn_state *dmss = CONTAINER_OF(qmp, *dmss, qmp);
+
+    if (rc)
+        goto out;
+
+    /*
+     * query-command-line-options response:
+     * [ { 'option': 'str', 'parameters': [{ 'name': 'str', ... }] } ]
+     */
+
+    qmp->callback = device_model_probe_quit;
+    rc = libxl__ev_qmp_send(egc, qmp, "quit", NULL);
+    if (rc) goto out;
+    return;
+
+out:
+    libxl__spawn_initiate_failure(egc, &dmss->spawn, rc);
+}
+
+static void device_model_probe_quit(libxl__egc *egc,
+    libxl__ev_qmp *qmp, const libxl__json_object *response, int rc)
+{
+    EGC_GC;
+    libxl__dm_spawn_state *dmss = CONTAINER_OF(qmp, *dmss, qmp);
+
+    libxl__ev_qmp_dispose(gc, qmp);
+    libxl__spawn_initiate_detach(gc, &dmss->spawn);
+}
+
+static void device_model_probe_spawn_outcome(libxl__egc *egc,
+    libxl__dm_spawn_state *dmss, int rc)
+{
+    EGC_GC;
+    libxl__ev_qmp_dispose(gc, &dmss->qmp);
+
+    /* Ensure our QEMU command line probe is killed. */
+    rc = libxl__kill_xs_path(gc, dmss->spawn.pidpath,
+                             "qemu command-line probe");
+    if (rc) {
+        LOGD(WARN, dmss->guest_domid,
+             "Killing qemu command-line probe pid from path %s",
+             dmss->spawn.pidpath);
+    }
+
+    /*
+     * Ignore all failure from the QEMU command line probe, start the
+     * device model in any case.
+     */
+    device_model_launch(egc, dmss, 0);
+}
+
+static void device_model_launch(libxl__egc *egc,
+    libxl__dm_spawn_state *dmss, int rc)
+{
+    STATE_AO_GC(dmss->spawn.ao);
+    libxl_ctx *ctx = CTX;
+    libxl_domain_config *guest_config = dmss->guest_config;
+    const libxl_domain_create_info *c_info = &guest_config->c_info;
+    const libxl_domain_build_info *b_info = &guest_config->b_info;
+    const libxl_vnc_info *vnc = libxl__dm_vnc(guest_config);
+    char *path;
+    int logfile_w, null;
+    char **args, **arg, **envs;
+    xs_transaction_t t;
+    char *vm_path;
+    char **pass_stuff;
+    int dm_state_fd = -1;
+
+    /* convenience aliases */
+    const int domid = dmss->guest_domid;
+    libxl__domain_build_state *const state = dmss->build_state;
+    libxl__spawn_state *const spawn = &dmss->spawn;
+    const char *const dm = dmss->dm;
+
     if (rc)
         goto out;
 
diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index 3b58bb2d7f..e99adc56cb 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -4154,6 +4154,7 @@ struct libxl__dm_spawn_state {
     libxl__ev_qmp qmp;
     libxl__ev_time timeout;
     libxl__dm_resume_state dmrs;
+    const char *dm;
     /* filled in by user, must remain valid: */
     uint32_t guest_domid; /* domain being served */
     libxl_domain_config *guest_config;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 29 08:11:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Aug 2024 08:11:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.785539.1195012 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjaFQ-0001sO-2M; Thu, 29 Aug 2024 08:11:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 785539.1195012; Thu, 29 Aug 2024 08:11: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 1sjaFP-0001sG-Vu; Thu, 29 Aug 2024 08:11:15 +0000
Received: by outflank-mailman (input) for mailman id 785539;
 Thu, 29 Aug 2024 08:11:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjaFO-0001s4-9H
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 08:11:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjaFO-0006ty-8U
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 08:11:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjaFO-0000VK-6L
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 08:11: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=iepviHiN3rPOlAZ5YpAodF2yUYWl0bqGSU+N4idLhzI=; b=0isGmuptmJxie/9tQoSC0lfqxX
	3UVSS4wSI+4bEAFyAA08Nywno0wIV4J/aRuAGjPU7tSoGOZzMSJjkA4wCfkmrh7vLAIOBuq2PnDFm
	d7Bkv0nH2isZp+i1kzIOspq8obyoY/6TzNhQUUu1YCTCi3XgmI80zn6cyAv9S9hGQduo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul: drop further Xeon Phi decode leftovers
Message-Id: <E1sjaFO-0000VK-6L@xenbits.xenproject.org>
Date: Thu, 29 Aug 2024 08:11:14 +0000

commit a4cf904bea9c535e1cac66bf0aee7a4275b4e1e2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 29 10:01:19 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 29 10:01:19 2024 +0200

    x86emul: drop further Xeon Phi decode leftovers
    
    Special casing in x86emul_decode() can be dropped, while overrides done
    in decode_0f38() can move into ext0f38_table[]. That table's S/G
    prefetch entries aren't needed anymore either.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/decode.c | 28 ++--------------------------
 1 file changed, 2 insertions(+), 26 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/decode.c b/xen/arch/x86/x86_emulate/decode.c
index 5a880578c7..faaeb2547d 100644
--- a/xen/arch/x86/x86_emulate/decode.c
+++ b/xen/arch/x86/x86_emulate/decode.c
@@ -427,13 +427,11 @@ static const struct ext0f38_table {
     [0xbe] = { .simd_size = simd_packed_fp, .d8s = d8s_vl },
     [0xbf] = { .simd_size = simd_scalar_vexw, .d8s = d8s_dq },
     [0xc4] = { .simd_size = simd_packed_int, .two_op = 1, .d8s = d8s_vl },
-    [0xc6 ... 0xc7] = { .simd_size = simd_other, .vsib = 1, .d8s = d8s_dq },
     [0xc8] = { .simd_size = simd_packed_fp, .two_op = 1, .d8s = d8s_vl },
     [0xc9] = { .simd_size = simd_other },
     [0xca] = { .simd_size = simd_packed_fp, .two_op = 1, .d8s = d8s_vl },
-    [0xcb] = { .simd_size = simd_scalar_vexw, .d8s = d8s_dq },
-    [0xcc] = { .simd_size = simd_packed_fp, .two_op = 1, .d8s = d8s_vl },
-    [0xcd] = { .simd_size = simd_scalar_vexw, .d8s = d8s_dq },
+    [0xcb] = { .simd_size = simd_other, .d8s = d8s_vl },
+    [0xcc ... 0xcd] = { .simd_size = simd_other, .two_op = 1, .d8s = d8s_vl },
     [0xcf] = { .simd_size = simd_packed_int, .d8s = d8s_vl },
     [0xd2] = { .simd_size = simd_other },
     [0xd3] = { .simd_size = simd_other },
@@ -918,14 +916,6 @@ decode_0f38(struct x86_emulate_state *s,
     case X86EMUL_OPC_EVEX_66(0, 0x7c): /* vpbroadcast{d,q} */
         break;
 
-    case X86EMUL_OPC_VEX_F2(0, 0xcc): /* vsha512msg1 */
-    case X86EMUL_OPC_VEX_F2(0, 0xcd): /* vsha512msg2 */
-        s->desc |= TwoOp;
-        /* fallthrough */
-    case X86EMUL_OPC_VEX_F2(0, 0xcb): /* vsha512rnds2 */
-        s->simd_size = simd_other;
-        break;
-
     case 0xf0: /* movbe / crc32 */
         s->desc |= s->vex.pfx == vex_f2 ? ByteOp : Mov;
         if ( s->vex.pfx >= vex_f3 )
@@ -1421,20 +1411,6 @@ int x86emul_decode(struct x86_emulate_state *s,
                                                    s);
                     s->simd_size = simd_other;
                 }
-
-                switch ( b )
-                {
-                /* vp4dpwssd{,s} need special casing */
-                case 0x52: case 0x53:
-                /* v4f{,n}madd{p,s}s need special casing */
-                case 0x9a: case 0x9b: case 0xaa: case 0xab:
-                    if ( s->evex.pfx == vex_f2 )
-                    {
-                        disp8scale = 4;
-                        s->simd_size = simd_128;
-                    }
-                    break;
-                }
             }
             break;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 29 08:11:26 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Aug 2024 08:11:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.785540.1195016 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjaFa-0001uZ-3i; Thu, 29 Aug 2024 08:11:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 785540.1195016; Thu, 29 Aug 2024 08:11: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 1sjaFa-0001uR-13; Thu, 29 Aug 2024 08:11:26 +0000
Received: by outflank-mailman (input) for mailman id 785540;
 Thu, 29 Aug 2024 08:11:24 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjaFY-0001uJ-Ca
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 08:11:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjaFY-0006uA-Bn
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 08:11:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjaFY-0000Wg-Ab
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 08:11: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=h5LpAjiDRZeEFR2OEG13vRJFoXkkFTi7+ZjN1fjxpZo=; b=B7rE2LK7m8ml7w4u449vtiGlFT
	IddLJQPCf/R+w0hzYsUUvySAOQJoF3yPRv7IpYJUy854jCfttEn3ykR3v2GjDV5KcY78915856fAT
	7K8dN2CnS8cnfPQ9GmzzYAeMSJ/JRhU25KUvPmUcC6MmJFeGDeCp8bpUzTXjuWvBUyrU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/HVM: correct partial HPET_STATUS write emulation
Message-Id: <E1sjaFY-0000Wg-Ab@xenbits.xenproject.org>
Date: Thu, 29 Aug 2024 08:11:24 +0000

commit 41d358d2f9607ba37c216effa39b9f1bc58de69d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 29 10:02:20 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 29 10:02:20 2024 +0200

    x86/HVM: correct partial HPET_STATUS write emulation
    
    For partial writes the non-written parts of registers are folded into
    the full 64-bit value from what they're presently set to. That's wrong
    to do though when the behavior is write-1-to-clear: Writes not
    including to low 3 bits would unconditionally clear all ISR bits which
    are presently set. Re-calculate the value to use.
    
    Fixes: be07023be115 ("x86/vhpet: add support for level triggered interrupts")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/hpet.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hpet.c b/xen/arch/x86/hvm/hpet.c
index 87642575f9..f0e5f877f4 100644
--- a/xen/arch/x86/hvm/hpet.c
+++ b/xen/arch/x86/hvm/hpet.c
@@ -404,7 +404,8 @@ static int cf_check hpet_write(
         break;
 
     case HPET_STATUS:
-        /* write 1 to clear. */
+        /* Write 1 to clear. Therefore don't use new_val directly here. */
+        new_val = val << ((addr & 7) * 8);
         while ( new_val )
         {
             bool active;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 29 08:11:36 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Aug 2024 08:11:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.785541.1195020 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjaFk-0001xJ-58; Thu, 29 Aug 2024 08:11:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 785541.1195020; Thu, 29 Aug 2024 08:11:36 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjaFk-0001xB-2T; Thu, 29 Aug 2024 08:11:36 +0000
Received: by outflank-mailman (input) for mailman id 785541;
 Thu, 29 Aug 2024 08:11:34 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjaFi-0001x3-GQ
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 08:11:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjaFi-0006uN-Fe
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 08:11:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjaFi-0000Xo-E2
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 08:11: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6gLq32Hn9IbBeoyeesarquWlfICQKsvTVKuif2T7e6E=; b=Clahq/9N2I60f5gDAnKLDPcijn
	ABDL9SwxxtYY81GFMYOzxIt5iISE0waN/JQQYMrbHaI3o2PtJnq2ew6DBVrlRoD/t0KwKvLJfHHi+
	xvj+bJyy1HvQBpJNxw3KaQij/ox4dp0DCul2940huBVKjB8zKt/DAFD9h9MBbG7a6vqs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ioreq: do not build arch_vcpu_ioreq_completion() for non-VMX configurations
Message-Id: <E1sjaFi-0000Xo-E2@xenbits.xenproject.org>
Date: Thu, 29 Aug 2024 08:11:34 +0000

commit 979cfdd3e58c97ca1bc1202162e3a2eb9e059a98
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Thu Aug 29 10:02:46 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 29 10:02:46 2024 +0200

    ioreq: do not build arch_vcpu_ioreq_completion() for non-VMX configurations
    
    VIO_realmode_completion is specific to vmx realmode and thus the function
    arch_vcpu_ioreq_completion() has actual handling work only in VMX-enabled build,
    as for the rest x86 and ARM build configurations it is basically a stub.
    
    Here a separate configuration option ARCH_VCPU_IOREQ_COMPLETION introduced that
    tells whether the platform we're building for requires any specific ioreq
    completion handling. As of now only VMX has such requirement, so the option is
    selected by INTEL_VMX, for other configurations a generic default stub is
    provided (it is ARM's version of arch_vcpu_ioreq_completion() moved to common
    header).
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/Kconfig              |  7 +++++++
 xen/arch/arm/ioreq.c     |  6 ------
 xen/arch/x86/Kconfig     |  1 +
 xen/arch/x86/hvm/ioreq.c |  2 ++
 xen/include/xen/ioreq.h  | 10 ++++++++++
 5 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/xen/Kconfig b/xen/Kconfig
index e459cdac0c..72fdb83760 100644
--- a/xen/Kconfig
+++ b/xen/Kconfig
@@ -95,4 +95,11 @@ config LTO
 config ARCH_SUPPORTS_INT128
 	bool
 
+#
+# For platforms that require specific handling of per-vCPU ioreq completion
+# events
+#
+config ARCH_VCPU_IOREQ_COMPLETION
+	bool
+
 source "Kconfig.debug"
diff --git a/xen/arch/arm/ioreq.c b/xen/arch/arm/ioreq.c
index 5df755b48b..2e829d2e7f 100644
--- a/xen/arch/arm/ioreq.c
+++ b/xen/arch/arm/ioreq.c
@@ -135,12 +135,6 @@ bool arch_ioreq_complete_mmio(void)
     return false;
 }
 
-bool arch_vcpu_ioreq_completion(enum vio_completion completion)
-{
-    ASSERT_UNREACHABLE();
-    return true;
-}
-
 /*
  * The "legacy" mechanism of mapping magic pages for the IOREQ servers
  * is x86 specific, so the following hooks don't need to be implemented on Arm:
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 7ef5c8bc48..74e081c7bd 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -127,6 +127,7 @@ config AMD_SVM
 
 config INTEL_VMX
 	def_bool HVM
+	select ARCH_VCPU_IOREQ_COMPLETION
 
 config XEN_SHSTK
 	bool "Supervisor Shadow Stacks"
diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index 4eb7a70182..5c3d0c69aa 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -29,6 +29,7 @@ bool arch_ioreq_complete_mmio(void)
     return handle_mmio();
 }
 
+#ifdef CONFIG_VCPU_ARCH_IOREQ_COMPLETION
 bool arch_vcpu_ioreq_completion(enum vio_completion completion)
 {
     switch ( completion )
@@ -51,6 +52,7 @@ bool arch_vcpu_ioreq_completion(enum vio_completion completion)
 
     return true;
 }
+#endif
 
 static gfn_t hvm_alloc_legacy_ioreq_gfn(struct ioreq_server *s)
 {
diff --git a/xen/include/xen/ioreq.h b/xen/include/xen/ioreq.h
index cd399adf17..29a17e8ff5 100644
--- a/xen/include/xen/ioreq.h
+++ b/xen/include/xen/ioreq.h
@@ -111,7 +111,17 @@ void ioreq_domain_init(struct domain *d);
 int ioreq_server_dm_op(struct xen_dm_op *op, struct domain *d, bool *const_op);
 
 bool arch_ioreq_complete_mmio(void);
+
+#ifdef CONFIG_VCPU_ARCH_IOREQ_COMPLETION
 bool arch_vcpu_ioreq_completion(enum vio_completion completion);
+#else
+static inline bool arch_vcpu_ioreq_completion(enum vio_completion completion)
+{
+    ASSERT_UNREACHABLE();
+    return true;
+}
+#endif
+
 int arch_ioreq_server_map_pages(struct ioreq_server *s);
 void arch_ioreq_server_unmap_pages(struct ioreq_server *s);
 void arch_ioreq_server_enable(struct ioreq_server *s);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 29 08:11:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Aug 2024 08:11:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.785542.1195025 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjaFu-00020B-6d; Thu, 29 Aug 2024 08:11:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 785542.1195025; Thu, 29 Aug 2024 08:11:46 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjaFu-000203-3p; Thu, 29 Aug 2024 08:11:46 +0000
Received: by outflank-mailman (input) for mailman id 785542;
 Thu, 29 Aug 2024 08:11:44 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjaFs-0001zs-JZ
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 08:11:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjaFs-0006un-Iu
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 08:11:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjaFs-0000Yz-He
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 08:11: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=A1qvfmMkhuK4hc4ILOFAaVlF6QyiKasxV8m1Nptj5M8=; b=RapRrerNVAH7AEdadP9qa7/dMM
	YVZW2VCUYmyIwLrabRm7dHxN9+SZjJ3i3hALTx1HFhkRhT/FxmPk8wj88ENr93VhVHXkdisSTlW8P
	fruIK79sXqN9NsxTVA5pAWAwLa81pLIWb+pIKAK/d6LDfKrCz9W/H9teCjRQmOaGRbyg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/hvm: make AMD-V and Intel VT-x support configurable
Message-Id: <E1sjaFs-0000Yz-He@xenbits.xenproject.org>
Date: Thu, 29 Aug 2024 08:11:44 +0000

commit f1bcfaf1211ff14cc2975fbfc126c0ad296faa1f
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Thu Aug 29 10:03:22 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 29 10:03:22 2024 +0200

    x86/hvm: make AMD-V and Intel VT-x support configurable
    
    Provide the user with configuration control over the cpu virtualization support
    in Xen by making AMD_SVM and INTEL_VMX options user selectable.
    
    To preserve the current default behavior, both options depend on HVM and
    default to value of HVM.
    
    To prevent users from unknowingly disabling virtualization support, make the
    controls user selectable only if EXPERT is enabled.
    
    No functional change intended.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/Kconfig | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 74e081c7bd..d0aaf359eb 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -123,11 +123,25 @@ config HVM
 	  If unsure, say Y.
 
 config AMD_SVM
-	def_bool HVM
+	bool "AMD-V" if EXPERT
+	depends on HVM
+	default y
+	help
+	  Enables virtual machine extensions on platforms that implement the
+	  AMD Virtualization Technology (AMD-V).
+	  If your system includes a processor with AMD-V support, say Y.
+	  If in doubt, say Y.
 
 config INTEL_VMX
-	def_bool HVM
+	bool "Intel VT-x" if EXPERT
+	depends on HVM
+	default y
 	select ARCH_VCPU_IOREQ_COMPLETION
+	help
+	  Enables virtual machine extensions on platforms that implement the
+	  Intel Virtualization Technology (Intel VT-x).
+	  If your system includes a processor with Intel VT-x support, say Y.
+	  If in doubt, say Y.
 
 config XEN_SHSTK
 	bool "Supervisor Shadow Stacks"
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 29 08:11:56 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Aug 2024 08:11:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.785543.1195028 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjaG4-00023S-7o; Thu, 29 Aug 2024 08:11:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 785543.1195028; Thu, 29 Aug 2024 08:11:56 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjaG4-00023L-5A; Thu, 29 Aug 2024 08:11:56 +0000
Received: by outflank-mailman (input) for mailman id 785543;
 Thu, 29 Aug 2024 08:11:54 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjaG2-000233-Mf
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 08:11:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjaG2-0006uz-Ls
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 08:11:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjaG2-0000bF-Kv
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 08:11: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CWp+YLn6w4fhIYcYeJfuSoC4PwvCvg+++h5yeGhw4iU=; b=qozMik7Xli4DSAOzzpDRUlskMG
	FNzRFRKYn9OuH7L8943lO7nZerms4AQ/NCJYlyhWr617hyAdG1a3cUhsO/oiVA4gPuk5r1VL69k9m
	a439JqnmnaxSwVkOOg1bVkEEF2B8W8bMAbKnWr7VaxxgR48mW4fVEox7JMCxeTWYZ3to=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Arm64: adjust __irq_to_desc() to fix build with gcc14
Message-Id: <E1sjaG2-0000bF-Kv@xenbits.xenproject.org>
Date: Thu, 29 Aug 2024 08:11:54 +0000

commit 99f942f3d410059dc223ee0a908827e928ef3592
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 29 10:03:53 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 29 10:03:53 2024 +0200

    Arm64: adjust __irq_to_desc() to fix build with gcc14
    
    With the original code I observe
    
    In function ‘__irq_to_desc’,
        inlined from ‘route_irq_to_guest’ at arch/arm/irq.c:465:12:
    arch/arm/irq.c:54:16: error: array subscript -2 is below array bounds of ‘irq_desc_t[32]’ {aka ‘struct irq_desc[32]’} [-Werror=array-bounds=]
       54 |         return &this_cpu(local_irq_desc)[irq];
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    which looks pretty bogus: How in the world does the compiler arrive at
    -2 when compiling route_irq_to_guest()? Yet independent of that the
    function's parameter wants to be of unsigned type anyway, as shown by
    a vast majority of callers (others use plain int when they really mean
    non-negative quantities). With that adjustment the code compiles fine
    again.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/include/asm/irq.h | 2 +-
 xen/arch/arm/irq.c             | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/include/asm/irq.h b/xen/arch/arm/include/asm/irq.h
index ec437add09..88e060bf29 100644
--- a/xen/arch/arm/include/asm/irq.h
+++ b/xen/arch/arm/include/asm/irq.h
@@ -56,7 +56,7 @@ extern const unsigned int nr_irqs;
 struct irq_desc;
 struct irqaction;
 
-struct irq_desc *__irq_to_desc(int irq);
+struct irq_desc *__irq_to_desc(unsigned int irq);
 
 #define irq_to_desc(irq)    __irq_to_desc(irq)
 
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 6b89f64fd1..b9757d7ad3 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -48,7 +48,7 @@ void irq_end_none(struct irq_desc *irq)
 static irq_desc_t irq_desc[NR_IRQS];
 static DEFINE_PER_CPU(irq_desc_t[NR_LOCAL_IRQS], local_irq_desc);
 
-struct irq_desc *__irq_to_desc(int irq)
+struct irq_desc *__irq_to_desc(unsigned int irq)
 {
     if ( irq < NR_LOCAL_IRQS )
         return &this_cpu(local_irq_desc)[irq];
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Aug 29 15:22:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Aug 2024 15:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.785982.1195532 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjgyJ-0000A0-9N; Thu, 29 Aug 2024 15:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 785982.1195532; Thu, 29 Aug 2024 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 1sjgyJ-00009q-6T; Thu, 29 Aug 2024 15:22:03 +0000
Received: by outflank-mailman (input) for mailman id 785982;
 Thu, 29 Aug 2024 15:22:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjgyI-00009h-0K
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 15:22:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjgyH-0005z7-Vg
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 15:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjgyH-0007fi-Ts
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mFRXGvXLn2ZH8E18yflcRQBb4yVyIWFQn4cK2lfqQ8M=; b=uOjSvEtE5z8JzlLX56+8xNruqK
	n4nAYbR1jTu+Y8anmcNeV1Ydia5/Ypw3nv4H0FN7M9VYTlivY+wnimOtVQxFtNKL2PcaBNOfgd6NF
	BCzGsmkvJKG5ySrtCHeuBbZeelTqR/rrQSP16LzWxE7ILow8+8DuRTn1RtHWal52dtaQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ARM/vgic: Fix variable shadowing in vgic_to_sgi()
Message-Id: <E1sjgyH-0007fi-Ts@xenbits.xenproject.org>
Date: Thu, 29 Aug 2024 15:22:01 +0000

commit 73fa03573e7cdf9c6521e67b46bd51ff5a8e1886
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Aug 28 00:33:19 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Aug 28 10:49:26 2024 +0100

    ARM/vgic: Fix variable shadowing in vgic_to_sgi()
    
    for_each_set_bit() allocates its own variable intentionally as loop-scope
    only.  Unfortunately, this causes the inner 'i' to shadow the outer 'i', and
    violates MISRA Rule 5.3.
    
    Drop the outermost 'i' and 'vcpuid' variables, moving them into a more narrow
    scope and correcting them to be unsigned which they should have been all
    along.  Update the printk() formatting of vcpuid to match.
    
    Fixes: 9429f1a6c475 ("ARM/vgic: Use for_each_set_bit() in vgic_to_sgi()")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/vgic.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 8ffe099bcb..c563ba93af 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -468,8 +468,6 @@ bool vgic_to_sgi(struct vcpu *v, register_t sgir, enum gic_sgi_mode irqmode,
                  int virq, const struct sgi_target *target)
 {
     struct domain *d = v->domain;
-    int vcpuid;
-    int i;
     unsigned int base, bitmap;
 
     ASSERT( virq < 16 );
@@ -483,12 +481,13 @@ bool vgic_to_sgi(struct vcpu *v, register_t sgir, enum gic_sgi_mode irqmode,
 
         for_each_set_bit ( i, bitmap )
         {
-            vcpuid = base + i;
+            unsigned int vcpuid = base + i;
+
             if ( vcpuid >= d->max_vcpus || d->vcpu[vcpuid] == NULL ||
                  !is_vcpu_online(d->vcpu[vcpuid]) )
             {
                 gprintk(XENLOG_WARNING,
-                        "vGIC: write %#"PRIregister", target->list=%#x, bad target vcpu%d\n",
+                        "vGIC: write %#"PRIregister", target->list=%#x, bad target vcpu%u\n",
                         sgir, target->list, vcpuid);
                 continue;
             }
@@ -497,7 +496,7 @@ bool vgic_to_sgi(struct vcpu *v, register_t sgir, enum gic_sgi_mode irqmode,
         break;
     case SGI_TARGET_OTHERS:
         perfc_incr(vgic_sgi_others);
-        for ( i = 0; i < d->max_vcpus; i++ )
+        for ( unsigned int i = 0; i < d->max_vcpus; i++ )
         {
             if ( i != current->vcpu_id && d->vcpu[i] != NULL &&
                  is_vcpu_online(d->vcpu[i]) )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 29 15:22:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Aug 2024 15:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.785983.1195537 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjgyT-0000C3-BL; Thu, 29 Aug 2024 15:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 785983.1195537; Thu, 29 Aug 2024 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 1sjgyT-0000Bu-7y; Thu, 29 Aug 2024 15:22:13 +0000
Received: by outflank-mailman (input) for mailman id 785983;
 Thu, 29 Aug 2024 15:22:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjgyS-0000Bc-4E
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 15:22:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjgyS-0005zH-2z
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 15:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjgyS-0007gV-1i
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 15:22:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uZfjND4QnzG+CLJxWrKelUYplSf60nSmp23cTPDtwgw=; b=NiZQYSP30Fip8dOw6Ysenyl7KV
	n95rkENOTbgkEgYYDxKyzgj3URD0cfN3yHsfty7T6YPsCw78IH+LtpECQgsMAQTQ2vtfkHVBhrd3a
	w0zid93nk8uAOUEToEPB0M309gfMRJud1EEOeSr++HUs10Y/xhdKxJ3MSd2AEfmLcPGI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/evtchn: Use bitmap_for_each() in evtchn_check_pollers()
Message-Id: <E1sjgyS-0007gV-1i@xenbits.xenproject.org>
Date: Thu, 29 Aug 2024 15:22:12 +0000

commit 75c64db3722f0245137a1e8cfd3435f4790d0fd7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jun 11 18:44:57 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Aug 28 10:49:26 2024 +0100

    xen/evtchn: Use bitmap_for_each() in evtchn_check_pollers()
    
    It is a preprocessor-identical opencoding.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/common/event_channel.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c
index 13b97c94d7..8db2ca4ba2 100644
--- a/xen/common/event_channel.c
+++ b/xen/common/event_channel.c
@@ -1517,9 +1517,7 @@ void evtchn_check_pollers(struct domain *d, unsigned int port)
         return;
 
     /* Wake any interested (or potentially interested) pollers. */
-    for ( vcpuid = find_first_bit(d->poll_mask, d->max_vcpus);
-          vcpuid < d->max_vcpus;
-          vcpuid = find_next_bit(d->poll_mask, d->max_vcpus, vcpuid+1) )
+    bitmap_for_each ( vcpuid, d->poll_mask, d->max_vcpus )
     {
         v = d->vcpu[vcpuid];
         if ( ((v->poll_evtchn <= 0) || (v->poll_evtchn == port)) &&
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 29 15:22:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Aug 2024 15:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.785984.1195540 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjgyd-0000Ea-C1; Thu, 29 Aug 2024 15:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 785984.1195540; Thu, 29 Aug 2024 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 1sjgyd-0000ES-9P; Thu, 29 Aug 2024 15:22:23 +0000
Received: by outflank-mailman (input) for mailman id 785984;
 Thu, 29 Aug 2024 15:22:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjgyc-0000EF-6r
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 15:22:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjgyc-0005zZ-60
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 15:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjgyc-0007hB-5A
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xCIUv862hLm2ZjqxNnWE650ZIBgWG9MnL3SQRbP4ow0=; b=mrfBHMQnsstaJ45VqVs8kM1JPt
	oL3VwJCoYuBBl8EIPNUmr7L26N7w25E+sU+1I11D3fR1Y71g78MY9ozAixlliiOIlVuEqEXAG195t
	sx2TK2hhI5Kv1xABENfZCNL6qsF7x2dnuRvUwFpjrot7ZnXIztDMyHkXBEnZYPFEMxPw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] oss-fuzz: Fix coverage runtime error
Message-Id: <E1sjgyc-0007hB-5A@xenbits.xenproject.org>
Date: Thu, 29 Aug 2024 15:22:22 +0000

commit 51e1c041f594bb2d0c2aa7666ec0a3d38537a49e
Author:     Tamas K Lengyel <tamas@tklengyel.com>
AuthorDate: Wed Aug 28 09:38:23 2024 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Aug 28 19:43:32 2024 +0100

    oss-fuzz: Fix coverage runtime error
    
    The oss-fuzz infrastructure collects runtime coverage information for debugging
    and fuzzing evaluation. Currently it appears broken due to missing C files.
    This is because the fuzzer's Makefile only symlinks the C files from various
    locations in the Xen source tree into the build folder. These symlinks however
    are gone as oss-fuzz uses separate docker containers for the build and for the
    run.
    
    Update the oss-fuzz build script to copy the required C files into the
    build folder to fix this oss-fuzz specific issue.
    
    Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/fuzz/oss-fuzz/build.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/fuzz/oss-fuzz/build.sh b/tools/fuzz/oss-fuzz/build.sh
index 08eeb66e4c..002d86c44f 100644
--- a/tools/fuzz/oss-fuzz/build.sh
+++ b/tools/fuzz/oss-fuzz/build.sh
@@ -9,3 +9,7 @@ cd xen
 make clang=y -C tools/include
 make clang=y -C tools/fuzz/x86_instruction_emulator libfuzzer-harness
 cp tools/fuzz/x86_instruction_emulator/libfuzzer-harness $OUT/x86_instruction_emulator
+
+# Runtime coverage collection requires access to source files and symlinks don't work
+cp xen/lib/x86/*.c tools/fuzz/x86_instruction_emulator
+cp tools/tests/x86_emulator/*.c tools/fuzz/x86_instruction_emulator
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Aug 29 15:22:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 29 Aug 2024 15:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.785985.1195544 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjgyn-0000Hb-DR; Thu, 29 Aug 2024 15:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 785985.1195544; Thu, 29 Aug 2024 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 1sjgyn-0000HT-At; Thu, 29 Aug 2024 15:22:33 +0000
Received: by outflank-mailman (input) for mailman id 785985;
 Thu, 29 Aug 2024 15:22:32 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjgym-0000HJ-AK
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 15:22:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjgym-0005zg-9W
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 15:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjgym-0007hm-8G
 for xen-changelog@lists.xenproject.org; Thu, 29 Aug 2024 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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BwDYX8Y0roXB5KVHrfffqReSgTr1KdK2VLzEiFDHgZk=; b=oaaiy3M1Rj5SchfU/lCHrZxRsB
	ihNIjvq4VriymIh1SjljoHW9pavmQrcMQpITT4VUeKbHEV7x4td74DcTtg4qkMdNukrUICjy8f4RW
	YU/ZfUfvee0wU0Mh1kn4uA4Xf/Itt2lQDnCX5jB2oOAnUCqLr/KooXdk/NlfsopzB2UI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/dom0: disable SMAP for PV domain building only
Message-Id: <E1sjgym-0007hm-8G@xenbits.xenproject.org>
Date: Thu, 29 Aug 2024 15:22:32 +0000

commit fb1658221a31ec1db33253a80001191391e73b17
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Wed Aug 28 13:30:44 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Aug 28 19:59:07 2024 +0100

    x86/dom0: disable SMAP for PV domain building only
    
    Move the logic that disables SMAP so it's only performed when building a PV
    dom0, PVH dom0 builder doesn't require disabling SMAP.
    
    The fixes tag is to account for the wrong usage of cpu_has_smap in
    create_dom0(), it should instead have used
    boot_cpu_has(X86_FEATURE_XEN_SMAP).  Fix while moving the logic to apply to PV
    only.
    
    While there also make cr4_pv32_mask __ro_after_init.
    
    Fixes: 493ab190e5b1 ('xen/sm{e, a}p: allow disabling sm{e, a}p for Xen itself')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/setup.h |  2 ++
 xen/arch/x86/pv/dom0_build.c     | 40 +++++++++++++++++++++++++++++++++++-----
 xen/arch/x86/setup.c             | 20 +-------------------
 3 files changed, 38 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h
index d75589178b..8f7dfefb4d 100644
--- a/xen/arch/x86/include/asm/setup.h
+++ b/xen/arch/x86/include/asm/setup.h
@@ -64,6 +64,8 @@ extern bool opt_dom0_verbose;
 extern bool opt_dom0_cpuid_faulting;
 extern bool opt_dom0_msr_relaxed;
 
+extern unsigned long cr4_pv32_mask;
+
 #define max_init_domid (0)
 
 #endif
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 57e58a02e7..57b1834b5e 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -354,11 +354,11 @@ static struct page_info * __init alloc_chunk(struct domain *d,
     return page;
 }
 
-int __init dom0_construct_pv(struct domain *d,
-                             const module_t *image,
-                             unsigned long image_headroom,
-                             module_t *initrd,
-                             const char *cmdline)
+static int __init dom0_construct(struct domain *d,
+                                 const module_t *image,
+                                 unsigned long image_headroom,
+                                 module_t *initrd,
+                                 const char *cmdline)
 {
     int i, rc, order, machine;
     bool compatible, compat;
@@ -1051,6 +1051,36 @@ out:
     return rc;
 }
 
+int __init dom0_construct_pv(struct domain *d,
+                             const module_t *image,
+                             unsigned long image_headroom,
+                             module_t *initrd,
+                             const char *cmdline)
+{
+    int rc;
+
+    /*
+     * Clear SMAP in CR4 to allow user-accesses in construct_dom0().  This
+     * prevents us needing to write rewrite construct_dom0() in terms of
+     * copy_{to,from}_user().
+     */
+    if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
+    {
+        cr4_pv32_mask &= ~X86_CR4_SMAP;
+        write_cr4(read_cr4() & ~X86_CR4_SMAP);
+    }
+
+    rc = dom0_construct(d, image, image_headroom, initrd, cmdline);
+
+    if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
+    {
+        write_cr4(read_cr4() | X86_CR4_SMAP);
+        cr4_pv32_mask |= X86_CR4_SMAP;
+    }
+
+    return rc;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index eee20bb175..f1076c7203 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -79,8 +79,7 @@ bool __read_mostly use_invpcid;
 int8_t __initdata opt_probe_port_aliases = -1;
 boolean_param("probe-port-aliases", opt_probe_port_aliases);
 
-/* Only used in asm code and within this source file */
-unsigned long asmlinkage __read_mostly cr4_pv32_mask;
+unsigned long __ro_after_init cr4_pv32_mask;
 
 /* **** Linux config option: propagated to domain0. */
 /* "acpi=off":    Sisables both ACPI table parsing and interpreter. */
@@ -955,26 +954,9 @@ static struct domain *__init create_dom0(const module_t *image,
         }
     }
 
-    /*
-     * Temporarily clear SMAP in CR4 to allow user-accesses in construct_dom0().
-     * This saves a large number of corner cases interactions with
-     * copy_from_user().
-     */
-    if ( cpu_has_smap )
-    {
-        cr4_pv32_mask &= ~X86_CR4_SMAP;
-        write_cr4(read_cr4() & ~X86_CR4_SMAP);
-    }
-
     if ( construct_dom0(d, image, headroom, initrd, cmdline) != 0 )
         panic("Could not construct domain 0\n");
 
-    if ( cpu_has_smap )
-    {
-        write_cr4(read_cr4() | X86_CR4_SMAP);
-        cr4_pv32_mask |= X86_CR4_SMAP;
-    }
-
     return d;
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 30 05:22:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 30 Aug 2024 05:22:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.786215.1195747 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sju5C-0007T0-CG; Fri, 30 Aug 2024 05:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 786215.1195747; Fri, 30 Aug 2024 05: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 1sju5C-0007St-9p; Fri, 30 Aug 2024 05:22:02 +0000
Received: by outflank-mailman (input) for mailman id 786215;
 Fri, 30 Aug 2024 05:22:01 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju5B-0007Sn-LV
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju5B-00051w-Jv
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju5B-0006tt-Hb
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=c1JxN4sS0yXPpnk5Yo8O+egxaAv9zzCS5K8J6zD/7xQ=; b=Nrvisd5WYqFgtlV9wlclApsiTQ
	NL07z0vUVIctXbhHEhvACa6vw2nRH/+a73HAltNfnjqpkwQtSWm+skSRmb5hM+9GgJnHwHeiQkXjz
	5X/xDBzs4vvv/VvuTKG31jyP07+a5mq7zi/SoMuNmOckjlHr/+SpX8IDxmGGOPp3utrI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation/eclair: monitor rules 13.2 and 18.2
Message-Id: <E1sju5B-0006tt-Hb@xenbits.xenproject.org>
Date: Fri, 30 Aug 2024 05:22:01 +0000

commit 9be5bb450c71e7b99f9f4fa256b00f8d31b6c0c4
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Tue Aug 27 10:44:46 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 28 17:27:24 2024 -0700

    automation/eclair: monitor rules 13.2 and 18.2
    
    Add MISRA C:2012 Rules 13.2 and 18.2 to the monitored set.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/monitored.ecl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/automation/eclair_analysis/ECLAIR/monitored.ecl b/automation/eclair_analysis/ECLAIR/monitored.ecl
index 7b085a329a..4d9ef1bd83 100644
--- a/automation/eclair_analysis/ECLAIR/monitored.ecl
+++ b/automation/eclair_analysis/ECLAIR/monitored.ecl
@@ -52,6 +52,7 @@
 -enable=MC3R1.R11.9
 -enable=MC3R1.R12.5
 -enable=MC3R1.R13.1
+-enable=MC3R1.R13.2
 -enable=MC3R1.R13.6
 -enable=MC3R1.R14.1
 -enable=MC3R1.R14.4
@@ -65,6 +66,7 @@
 -enable=MC3R1.R17.4
 -enable=MC3R1.R17.5
 -enable=MC3R1.R17.6
+-enable=MC3R1.R18.2
 -enable=MC3R1.R18.6
 -enable=MC3R1.R18.8
 -enable=MC3R1.R19.1
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 30 05:22:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 30 Aug 2024 05:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.786216.1195752 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sju5M-0007Uk-EX; Fri, 30 Aug 2024 05:22:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 786216.1195752; Fri, 30 Aug 2024 05: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 1sju5M-0007Ud-BO; Fri, 30 Aug 2024 05:22:12 +0000
Received: by outflank-mailman (input) for mailman id 786216;
 Fri, 30 Aug 2024 05:22:11 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju5L-0007UT-O4
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05:22:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju5L-000526-NF
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju5L-0006wV-MA
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qlFA8lxx3+bLZlL/ifx63PUrHtAj2NbtrkfscGsXivk=; b=xDebN7hXOgsCynCesm2UnpWDi/
	KfgnzifN4oTAdemAi22oM6M8g+heCofdCPAfHg9V29H9CPgY9IU2m8oVLux3RXSN2AwwnajrvR/UV
	iDfyhtEUQN45poRqDEfppBct9r6rdXin8RUFhrwiSMwdU/E174+zQY1b8E6Q9V+EzAa8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation/eclair: extend existing deviations of MISRA C Rule 16.3
Message-Id: <E1sju5L-0006wV-MA@xenbits.xenproject.org>
Date: Fri, 30 Aug 2024 05:22:11 +0000

commit b1b1d1c07e904eb448669f25649c1df2fadf6f59
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Tue Aug 20 10:19:22 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 28 17:28:47 2024 -0700

    automation/eclair: extend existing deviations of MISRA C Rule 16.3
    
    Update ECLAIR configuration to deviate more cases where an
    unintentional fallthrough cannot happen.
    
    Tag Rule 16.3 as clean for arm.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/deviations.ecl | 28 +++++++++++++++++++-----
 automation/eclair_analysis/ECLAIR/tagging.ecl    |  2 +-
 docs/misra/deviations.rst                        | 28 +++++++++++++++++++++---
 3 files changed, 48 insertions(+), 10 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/deviations.ecl b/automation/eclair_analysis/ECLAIR/deviations.ecl
index 1aa8277066..9051f41602 100644
--- a/automation/eclair_analysis/ECLAIR/deviations.ecl
+++ b/automation/eclair_analysis/ECLAIR/deviations.ecl
@@ -461,14 +461,30 @@ therefore it is deemed better to leave such files as is."
 -config=MC3R1.R16.2,reports+={deliberate, "any_area(any_loc(file(x86_emulate||x86_svm_emulate)))"}
 -doc_end
 
--doc_begin="Switch clauses ending with continue, goto, return statements are
-safe."
--config=MC3R1.R16.3,terminals+={safe, "node(continue_stmt||goto_stmt||return_stmt)"}
+-doc_begin="Statements that change the control flow (i.e., break, continue, goto, return) and calls to functions that do not return the control back are \"allowed terminal statements\"."
+-stmt_selector+={r16_3_allowed_terminal, "node(break_stmt||continue_stmt||goto_stmt||return_stmt)||call(property(noreturn))"}
+-config=MC3R1.R16.3,terminals+={safe, "r16_3_allowed_terminal"}
+-doc_end
+
+-doc_begin="An if-else statement having both branches ending with an allowed terminal statement is itself an allowed terminal statement."
+-stmt_selector+={r16_3_if, "node(if_stmt)&&(child(then,r16_3_allowed_terminal)||child(then,any_stmt(stmt,-1,r16_3_allowed_terminal)))"}
+-stmt_selector+={r16_3_else, "node(if_stmt)&&(child(else,r16_3_allowed_terminal)||child(else,any_stmt(stmt,-1,r16_3_allowed_terminal)))"}
+-stmt_selector+={r16_3_if_else, "r16_3_if&&r16_3_else"}
+-config=MC3R1.R16.3,terminals+={safe, "r16_3_if_else"}
+-doc_end
+
+-doc_begin="An if-else statement having an always true condition and the true branch ending with an allowed terminal statement is itself an allowed terminal statement."
+-stmt_selector+={r16_3_if_true, "r16_3_if&&child(cond,definitely_in(1..))"}
+-config=MC3R1.R16.3,terminals+={safe, "r16_3_if_true"}
+-doc_end
+
+-doc_begin="A switch clause ending with a statement expression which, in turn, ends with an allowed terminal statement is safe."
+-config=MC3R1.R16.3,terminals+={safe, "node(stmt_expr)&&child(stmt,node(compound_stmt)&&any_stmt(stmt,-1,r16_3_allowed_terminal||r16_3_if_else||r16_3_if_true))"}
 -doc_end
 
--doc_begin="Switch clauses ending with a call to a function that does not give
-the control back (i.e., a function with attribute noreturn) are safe."
--config=MC3R1.R16.3,terminals+={safe, "call(property(noreturn))"}
+-doc_begin="A switch clause ending with a do-while-false the body of which, in turn, ends with an allowed terminal statement is safe.
+An exception to that is the macro ASSERT_UNREACHABLE() which is effective in debug build only: a switch clause ending with ASSERT_UNREACHABLE() is not considered safe."
+-config=MC3R1.R16.3,terminals+={safe, "!macro(name(ASSERT_UNREACHABLE))&&node(do_stmt)&&child(cond,definitely_in(0))&&child(body,any_stmt(stmt,-1,r16_3_allowed_terminal||r16_3_if_else||r16_3_if_true))"}
 -doc_end
 
 -doc_begin="Switch clauses ending with pseudo-keyword \"fallthrough\" are
diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index 4d0ac94848..b8448938e6 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -112,7 +112,7 @@ if(string_equal(target,"x86_64"),
 )
 
 if(string_equal(target,"arm64"),
-    service_selector({"additional_clean_guidelines","MC3R1.R16.6||MC3R1.R2.1||MC3R1.R5.3||MC3R1.R7.3"})
+    service_selector({"additional_clean_guidelines","MC3R1.R2.1||MC3R1.R5.3||MC3R1.R7.3||MC3R1.R16.3||MC3R1.R16.6"})
 )
 
 -reports+={clean:added,"service(clean_guidelines_common||additional_clean_guidelines)"}
diff --git a/docs/misra/deviations.rst b/docs/misra/deviations.rst
index d51aa422b5..b66c271c4e 100644
--- a/docs/misra/deviations.rst
+++ b/docs/misra/deviations.rst
@@ -415,12 +415,34 @@ Deviations related to MISRA C:2012 Rules:
      - Tagged as `deliberate` for ECLAIR.
 
    * - R16.3
-     - Switch clauses ending with continue, goto, return statements are safe.
+     - Statements that change the control flow (i.e., break, continue, goto,
+       return) and calls to functions that do not return the control back are
+       \"allowed terminal statements\".
      - Tagged as `safe` for ECLAIR.
 
    * - R16.3
-     - Switch clauses ending with a call to a function that does not give
-       the control back (i.e., a function with attribute noreturn) are safe.
+     - An if-else statement having both branches ending with one of the allowed
+       terminal statemets is itself an allowed terminal statements.
+     - Tagged as `safe` for ECLAIR.
+
+   * - R16.3
+     - An if-else statement having an always true condition and the true
+       branch ending with an allowed terminal statement is itself an allowed
+       terminal statement.
+     - Tagged as `safe` for ECLAIR.
+
+   * - R16.3
+     - A switch clause ending with a statement expression which, in turn, ends
+       with an allowed terminal statement (e.g., the expansion of
+       generate_exception()) is safe.
+     - Tagged as `safe` for ECLAIR.
+
+   * - R16.3
+     - A switch clause ending with a do-while-false the body of which, in turn,
+       ends with an allowed terminal statement (e.g., PARSE_ERR_RET()) is safe.
+       An exception to that is the macro ASSERT_UNREACHABLE() which is
+       effective in debug build only: a switch clause ending with
+       ASSERT_UNREACHABLE() is not considered safe.
      - Tagged as `safe` for ECLAIR.
 
    * - R16.3
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 30 05:22:22 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 30 Aug 2024 05:22:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.786217.1195756 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sju5W-0007YE-H0; Fri, 30 Aug 2024 05:22:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 786217.1195756; Fri, 30 Aug 2024 05:22:22 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sju5W-0007Y6-EP; Fri, 30 Aug 2024 05:22:22 +0000
Received: by outflank-mailman (input) for mailman id 786217;
 Fri, 30 Aug 2024 05:22:21 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju5V-0007Xv-R5
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05:22:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju5V-00052S-QI
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05:22:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju5V-0006xO-PH
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dB1Fz4hGzWLIqbX/c/c/o6gTBPuw6KMq2e3iU6BPqdg=; b=0jVmYDfCPeEXtwiwEMTr0Kr7pq
	2cwesgNuN0IOGWFgbGoEpQ3pcXZ7y+sUk9XsiW93zzRZ0O3IBxypjMmhvxcYU4AOuUM7GgUKAHvGW
	LjAHFzTURxPNN/aP6KLwjOieZGupZAJxifXUST+XcxkAK9jf+XrFZPotmJkmtIjD+vSQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: add linker symbol name script
Message-Id: <E1sju5V-0006xO-PH@xenbits.xenproject.org>
Date: Fri, 30 Aug 2024 05:22:21 +0000

commit 0e0426dda4bcc67826a575822538583e8f5b7cfc
Author:     Victor Lira <victorm.lira@amd.com>
AuthorDate: Thu Jul 25 12:01:53 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Wed Aug 28 17:47:40 2024 -0700

    automation: add linker symbol name script
    
    Requested-by: Jan Beulich <jbeulich@suse.com>
    Signed-off-by: Victor Lira <victorm.lira@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/linker-symbols.sh | 34 ++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/automation/eclair_analysis/linker-symbols.sh b/automation/eclair_analysis/linker-symbols.sh
new file mode 100755
index 0000000000..0f49aed88c
--- /dev/null
+++ b/automation/eclair_analysis/linker-symbols.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+# Stop immediately if any executed command has exit status different from 0.
+set -e
+
+# Extract linker symbol names (except those starting with ".") from assignments.
+
+script_name=$(basename "$0")
+script_dir="$(
+  cd "$(dirname "$0")"
+  echo "${PWD}"
+)"
+src_dir="${script_dir}/../.."
+
+fatal() {
+  echo "${script_name}: $*" >&2
+  exit 1
+}
+
+usage() {
+  fatal "Usage: ${script_name} <arch>"
+}
+
+if [ $# -ne 1 ]; then
+  usage
+fi
+
+filepath="${src_dir}/xen/arch/${1}/xen.lds"
+
+if [ ! -f "$filepath" ]; then
+  fatal "Could not find ${1} linker script. Must be run after the build."
+fi
+
+sed -n "s/^\s*\([a-zA-Z_][a-zA-Z_0-9.\-]*\)\s*=.*;.*$/\1/p" "$filepath"
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 30 05:22:32 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 30 Aug 2024 05:22:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.786218.1195760 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sju5g-0007av-Ih; Fri, 30 Aug 2024 05:22:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 786218.1195760; Fri, 30 Aug 2024 05:22:32 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sju5g-0007an-Fp; Fri, 30 Aug 2024 05:22:32 +0000
Received: by outflank-mailman (input) for mailman id 786218;
 Fri, 30 Aug 2024 05:22:31 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju5f-0007ac-UX
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05:22:31 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju5f-00052d-Ti
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05:22:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju5f-0006y4-So
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05:22:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fwy3khv68fHoavPf5NUJdMOuK+wQG5LqtrbOHKaUASo=; b=T+1pigNNaseoOGQyl7GkJvaTkQ
	pIuP/sJ6PM3/JXz9RqrjPfx3I4RZVZpuKtNv6dhWafEsE9XQlJnbldqrKuLts2uTSR9aufYf9Cx3N
	HRZPWsVUTPSWZU1bGmRQJYWxfJm8yVNy+CsgEb0U4XScQwgQvH3dCJxO3QuIntr2JCGA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] libxl: Implement QEMU command line probe
Message-Id: <E1sju5f-0006y4-So@xenbits.xenproject.org>
Date: Fri, 30 Aug 2024 05:22:31 +0000

commit 1817e4c3c5e4cf5ad21b76765bb19a23244b9019
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Thu Aug 29 10:00:46 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 29 10:00:46 2024 +0200

    libxl: Implement QEMU command line probe
    
    Starting with QEMU 9.0, the option "-chroot", that we use for the
    "dmrestrict" feature, is removed. We need to find out which to use
    between "-chroot" and "-run-with chroot=dir".
    
    This patch implement the machinery to spawn QEMU, and to run the QMP
    command "query-command-line-options" but doesn't yet look at the
    actual result. Whether or not to use "-run-with chroot=dir" will be
    implemented in a follow up patch.
    
    The command line used to spawn the qemu we want to probe is mostly
    similar to the one we already use for the device model, "-machine
    none" comes from libvirt.
    
    This patch implement the probing on qemu-xen, even if we probably not
    going to use the result. We could check the feature wanted for the
    domain being created, but this could get complicated fairly quickly.
    We already need to check the options "b_info->dm_restrict" for
    "-chroot" and "state->dm_runas" for "-runas" (which is deprecated).
    
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 tools/libs/light/libxl_dm.c       | 207 ++++++++++++++++++++++++++++++++++++--
 tools/libs/light/libxl_internal.h |   1 +
 2 files changed, 198 insertions(+), 10 deletions(-)

diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index ff8ddeec9a..46babfed0b 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -2858,6 +2858,20 @@ static void device_model_qmp_cb(libxl__egc *egc, libxl__ev_qmp *ev,
 static void device_model_spawn_outcome(libxl__egc *egc,
                                        libxl__dm_spawn_state *dmss,
                                        int rc);
+static void device_model_probe_startup_failed(libxl__egc *egc,
+    libxl__spawn_state *spawn, int rc);
+static void device_model_probe_confirm(libxl__egc *egc,
+    libxl__spawn_state *spawn, const char *xsdata);
+static void device_model_probe_detached(libxl__egc *egc,
+    libxl__spawn_state *spawn);
+static void device_model_probe_cmdline(libxl__egc *egc,
+    libxl__ev_qmp *qmp, const libxl__json_object *response, int rc);
+static void device_model_probe_quit(libxl__egc *egc,
+    libxl__ev_qmp *qmp, const libxl__json_object *response, int rc);
+static void device_model_probe_spawn_outcome(libxl__egc *egc,
+     libxl__dm_spawn_state *dmss, int rc);
+static void device_model_launch(libxl__egc *egc,
+    libxl__dm_spawn_state *dmss, int rc);
 static void device_model_postconfig_chardev(libxl__egc *egc,
     libxl__ev_qmp *qmp, const libxl__json_object *response, int rc);
 static void device_model_postconfig_vnc(libxl__egc *egc,
@@ -2873,25 +2887,18 @@ void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state *dmss)
 {
     /* convenience aliases */
     const int domid = dmss->guest_domid;
-    libxl__domain_build_state *const state = dmss->build_state;
     libxl__spawn_state *const spawn = &dmss->spawn;
 
     STATE_AO_GC(dmss->spawn.ao);
 
-    libxl_ctx *ctx = CTX;
     libxl_domain_config *guest_config = dmss->guest_config;
     const libxl_domain_create_info *c_info = &guest_config->c_info;
     const libxl_domain_build_info *b_info = &guest_config->b_info;
-    const libxl_vnc_info *vnc = libxl__dm_vnc(guest_config);
-    char *path;
-    int logfile_w, null;
     int rc;
-    char **args, **arg, **envs;
-    xs_transaction_t t;
-    char *vm_path;
-    char **pass_stuff;
     const char *dm;
-    int dm_state_fd = -1;
+    int logfile_w = -1, null = -1;
+    int qmp_probe_fd = -1;
+    bool probe_spawned = false;
 
     dmss_init(dmss);
 
@@ -2904,6 +2911,7 @@ void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state *dmss)
         rc = ERROR_FAIL;
         goto out;
     }
+    dmss->dm = dm;
     if (access(dm, X_OK) < 0) {
         LOGED(ERROR, domid, "device model %s is not executable", dm);
         rc = ERROR_FAIL;
@@ -2911,6 +2919,185 @@ void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state *dmss)
     }
 
     rc = libxl__domain_get_device_model_uid(gc, dmss);
+    if (rc)
+        goto out;
+
+    /* probe QEMU's available command line options */
+    if (b_info->device_model_version
+        == LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN) {
+
+        logfile_w = libxl__create_qemu_logfile(
+            gc, GCSPRINTF("qemu-probe-%s", c_info->name));
+        if (logfile_w < 0) {
+            rc = logfile_w;
+            goto out;
+        }
+        null = open("/dev/null", O_RDONLY);
+        if (null < 0) {
+            LOGED(ERROR, domid, "unable to open /dev/null");
+            rc = ERROR_FAIL;
+            goto out;
+        }
+
+        rc = libxl__pre_open_qmp_socket(gc, domid, &qmp_probe_fd);
+        if (rc) goto out;
+
+        flexarray_t *dm_args = flexarray_make(gc, 16, 1);
+        flexarray_vappend(dm_args, dm,
+                          "-S",
+                          "-no-user-config",
+                          "-nodefaults",
+                          "-nographic",
+                          "-machine", "none,accel=xen",
+                          NULL);
+        flexarray_vappend(dm_args,
+                          "-chardev",
+                          GCSPRINTF("socket,id=libxl-cmd,fd=%d,server=on,wait=off",
+                                    qmp_probe_fd),
+                          "-mon", "chardev=libxl-cmd,mode=control",
+                          NULL);
+        flexarray_append(dm_args, NULL);
+        char **exec_args = (char **) flexarray_contents(dm_args);
+
+        const char *dom_path = libxl__xs_get_dompath(gc, domid);
+
+        spawn->what = GCSPRINTF("domain %d qemu command line probe", domid);
+        spawn->xspath = "/dev/null"; /* No path to watch */
+        spawn->timeout_ms = LIBXL_DEVICE_MODEL_START_TIMEOUT * 1000;
+        spawn->pidpath = GCSPRINTF("%s/image/device-model-pid", dom_path);
+        spawn->midproc_cb = libxl__spawn_record_pid;
+        spawn->confirm_cb = device_model_probe_confirm;
+        spawn->failure_cb = device_model_probe_startup_failed;
+        spawn->detached_cb = device_model_probe_detached;
+
+        dmss->qmp.ao = ao;
+        dmss->qmp.callback = device_model_probe_cmdline;
+        dmss->qmp.domid = domid;
+        dmss->qmp.payload_fd = -1;
+        rc = libxl__ev_qmp_send(egc, &dmss->qmp, "query-command-line-options", NULL);
+        if (rc) goto out;
+
+        rc = libxl__spawn_spawn(egc, spawn);
+        if (rc < 0)
+            goto out;
+        if (!rc) { /* inner child */
+            setsid();
+            libxl__exec(gc, null, logfile_w, logfile_w, dm, exec_args, NULL);
+        }
+        probe_spawned = true;
+    } else {
+        /* Continue with launching DM instead of probing it */
+        probe_spawned = false;
+    }
+    rc = 0;
+out:
+    if (qmp_probe_fd >= 0)
+        close(qmp_probe_fd);
+    if (null >= 0)
+        close(null);
+    if (logfile_w >= 0)
+        close(logfile_w);
+    if (rc || !probe_spawned)
+        device_model_launch(egc, dmss, rc);
+}
+
+static void device_model_probe_startup_failed(libxl__egc *egc,
+    libxl__spawn_state *spawn, int rc)
+{
+    libxl__dm_spawn_state *dmss = CONTAINER_OF(spawn, *dmss, spawn);
+    device_model_probe_spawn_outcome(egc, dmss, rc);
+}
+
+static void device_model_probe_confirm(libxl__egc *egc,
+    libxl__spawn_state *spawn, const char *xsdata)
+{
+    /* Nothing to do, confirmation is done via QMP instead */
+}
+
+static void device_model_probe_detached(libxl__egc *egc,
+    libxl__spawn_state *spawn)
+{
+    libxl__dm_spawn_state *dmss = CONTAINER_OF(spawn, *dmss, spawn);
+    device_model_probe_spawn_outcome(egc, dmss, 0);
+}
+
+static void device_model_probe_cmdline(libxl__egc *egc,
+    libxl__ev_qmp *qmp, const libxl__json_object *response, int rc)
+{
+    libxl__dm_spawn_state *dmss = CONTAINER_OF(qmp, *dmss, qmp);
+
+    if (rc)
+        goto out;
+
+    /*
+     * query-command-line-options response:
+     * [ { 'option': 'str', 'parameters': [{ 'name': 'str', ... }] } ]
+     */
+
+    qmp->callback = device_model_probe_quit;
+    rc = libxl__ev_qmp_send(egc, qmp, "quit", NULL);
+    if (rc) goto out;
+    return;
+
+out:
+    libxl__spawn_initiate_failure(egc, &dmss->spawn, rc);
+}
+
+static void device_model_probe_quit(libxl__egc *egc,
+    libxl__ev_qmp *qmp, const libxl__json_object *response, int rc)
+{
+    EGC_GC;
+    libxl__dm_spawn_state *dmss = CONTAINER_OF(qmp, *dmss, qmp);
+
+    libxl__ev_qmp_dispose(gc, qmp);
+    libxl__spawn_initiate_detach(gc, &dmss->spawn);
+}
+
+static void device_model_probe_spawn_outcome(libxl__egc *egc,
+    libxl__dm_spawn_state *dmss, int rc)
+{
+    EGC_GC;
+    libxl__ev_qmp_dispose(gc, &dmss->qmp);
+
+    /* Ensure our QEMU command line probe is killed. */
+    rc = libxl__kill_xs_path(gc, dmss->spawn.pidpath,
+                             "qemu command-line probe");
+    if (rc) {
+        LOGD(WARN, dmss->guest_domid,
+             "Killing qemu command-line probe pid from path %s",
+             dmss->spawn.pidpath);
+    }
+
+    /*
+     * Ignore all failure from the QEMU command line probe, start the
+     * device model in any case.
+     */
+    device_model_launch(egc, dmss, 0);
+}
+
+static void device_model_launch(libxl__egc *egc,
+    libxl__dm_spawn_state *dmss, int rc)
+{
+    STATE_AO_GC(dmss->spawn.ao);
+    libxl_ctx *ctx = CTX;
+    libxl_domain_config *guest_config = dmss->guest_config;
+    const libxl_domain_create_info *c_info = &guest_config->c_info;
+    const libxl_domain_build_info *b_info = &guest_config->b_info;
+    const libxl_vnc_info *vnc = libxl__dm_vnc(guest_config);
+    char *path;
+    int logfile_w, null;
+    char **args, **arg, **envs;
+    xs_transaction_t t;
+    char *vm_path;
+    char **pass_stuff;
+    int dm_state_fd = -1;
+
+    /* convenience aliases */
+    const int domid = dmss->guest_domid;
+    libxl__domain_build_state *const state = dmss->build_state;
+    libxl__spawn_state *const spawn = &dmss->spawn;
+    const char *const dm = dmss->dm;
+
     if (rc)
         goto out;
 
diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index 3b58bb2d7f..e99adc56cb 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -4154,6 +4154,7 @@ struct libxl__dm_spawn_state {
     libxl__ev_qmp qmp;
     libxl__ev_time timeout;
     libxl__dm_resume_state dmrs;
+    const char *dm;
     /* filled in by user, must remain valid: */
     uint32_t guest_domid; /* domain being served */
     libxl_domain_config *guest_config;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 30 05:22:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 30 Aug 2024 05:22:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.786219.1195763 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sju5r-0007da-K5; Fri, 30 Aug 2024 05:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 786219.1195763; Fri, 30 Aug 2024 05: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 1sju5r-0007dT-HT; Fri, 30 Aug 2024 05:22:43 +0000
Received: by outflank-mailman (input) for mailman id 786219;
 Fri, 30 Aug 2024 05:22:42 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju5q-0007dH-C9
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05:22:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju5q-00052q-0U
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju5p-0006yo-Vv
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05:22:41 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FC7LNJCp+b8s06lPwwHEzzqgF6xv3i2k3bDPeq+4VUw=; b=I9QhBlzpZYZ+YX4Fgcy+16w24S
	Uw2Fyeq+gfPsR56QhyxloOdMUw0zNqLggLVi9KMT+Tf1f8CCessdeeHqsdaun5jJ2GuEDwTiKKea1
	fZ0l7WQj4yPoUpH/UiF3jVMNMOyD1htYfg2fKjweA+ow6GvyYT93Nt6RVGZkBSuRMtXU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul: drop further Xeon Phi decode leftovers
Message-Id: <E1sju5p-0006yo-Vv@xenbits.xenproject.org>
Date: Fri, 30 Aug 2024 05:22:41 +0000

commit a4cf904bea9c535e1cac66bf0aee7a4275b4e1e2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 29 10:01:19 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 29 10:01:19 2024 +0200

    x86emul: drop further Xeon Phi decode leftovers
    
    Special casing in x86emul_decode() can be dropped, while overrides done
    in decode_0f38() can move into ext0f38_table[]. That table's S/G
    prefetch entries aren't needed anymore either.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/decode.c | 28 ++--------------------------
 1 file changed, 2 insertions(+), 26 deletions(-)

diff --git a/xen/arch/x86/x86_emulate/decode.c b/xen/arch/x86/x86_emulate/decode.c
index 5a880578c7..faaeb2547d 100644
--- a/xen/arch/x86/x86_emulate/decode.c
+++ b/xen/arch/x86/x86_emulate/decode.c
@@ -427,13 +427,11 @@ static const struct ext0f38_table {
     [0xbe] = { .simd_size = simd_packed_fp, .d8s = d8s_vl },
     [0xbf] = { .simd_size = simd_scalar_vexw, .d8s = d8s_dq },
     [0xc4] = { .simd_size = simd_packed_int, .two_op = 1, .d8s = d8s_vl },
-    [0xc6 ... 0xc7] = { .simd_size = simd_other, .vsib = 1, .d8s = d8s_dq },
     [0xc8] = { .simd_size = simd_packed_fp, .two_op = 1, .d8s = d8s_vl },
     [0xc9] = { .simd_size = simd_other },
     [0xca] = { .simd_size = simd_packed_fp, .two_op = 1, .d8s = d8s_vl },
-    [0xcb] = { .simd_size = simd_scalar_vexw, .d8s = d8s_dq },
-    [0xcc] = { .simd_size = simd_packed_fp, .two_op = 1, .d8s = d8s_vl },
-    [0xcd] = { .simd_size = simd_scalar_vexw, .d8s = d8s_dq },
+    [0xcb] = { .simd_size = simd_other, .d8s = d8s_vl },
+    [0xcc ... 0xcd] = { .simd_size = simd_other, .two_op = 1, .d8s = d8s_vl },
     [0xcf] = { .simd_size = simd_packed_int, .d8s = d8s_vl },
     [0xd2] = { .simd_size = simd_other },
     [0xd3] = { .simd_size = simd_other },
@@ -918,14 +916,6 @@ decode_0f38(struct x86_emulate_state *s,
     case X86EMUL_OPC_EVEX_66(0, 0x7c): /* vpbroadcast{d,q} */
         break;
 
-    case X86EMUL_OPC_VEX_F2(0, 0xcc): /* vsha512msg1 */
-    case X86EMUL_OPC_VEX_F2(0, 0xcd): /* vsha512msg2 */
-        s->desc |= TwoOp;
-        /* fallthrough */
-    case X86EMUL_OPC_VEX_F2(0, 0xcb): /* vsha512rnds2 */
-        s->simd_size = simd_other;
-        break;
-
     case 0xf0: /* movbe / crc32 */
         s->desc |= s->vex.pfx == vex_f2 ? ByteOp : Mov;
         if ( s->vex.pfx >= vex_f3 )
@@ -1421,20 +1411,6 @@ int x86emul_decode(struct x86_emulate_state *s,
                                                    s);
                     s->simd_size = simd_other;
                 }
-
-                switch ( b )
-                {
-                /* vp4dpwssd{,s} need special casing */
-                case 0x52: case 0x53:
-                /* v4f{,n}madd{p,s}s need special casing */
-                case 0x9a: case 0x9b: case 0xaa: case 0xab:
-                    if ( s->evex.pfx == vex_f2 )
-                    {
-                        disp8scale = 4;
-                        s->simd_size = simd_128;
-                    }
-                    break;
-                }
             }
             break;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 30 05:22:53 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 30 Aug 2024 05:22:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.786220.1195768 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sju60-0007gY-LQ; Fri, 30 Aug 2024 05:22:52 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 786220.1195768; Fri, 30 Aug 2024 05:22:52 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sju60-0007gQ-Iv; Fri, 30 Aug 2024 05:22:52 +0000
Received: by outflank-mailman (input) for mailman id 786220;
 Fri, 30 Aug 2024 05:22:52 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju60-0007gE-5V
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05:22:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju60-00053L-4I
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju60-0006zU-2c
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FuCDJHsQWtxkjUMkhK30wYFA4+MlqLX8ob5qB5Xc7aM=; b=TEVmQSH92kVncpKsqvzC1HVgW/
	bH9SVAqJ0YvxxR4V7ffJzWVEb86TJCdoMUHE53r6mDJP+MQwxjS4MoMf8V3dqIZifOv0clrRvCgFA
	hr4p1wBT3sx9UIxMO9+6KimxkFIFV+++xzgv1xWBISSSRk5rbYmigea+VAhRvAehnCn0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/HVM: correct partial HPET_STATUS write emulation
Message-Id: <E1sju60-0006zU-2c@xenbits.xenproject.org>
Date: Fri, 30 Aug 2024 05:22:52 +0000

commit 41d358d2f9607ba37c216effa39b9f1bc58de69d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 29 10:02:20 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 29 10:02:20 2024 +0200

    x86/HVM: correct partial HPET_STATUS write emulation
    
    For partial writes the non-written parts of registers are folded into
    the full 64-bit value from what they're presently set to. That's wrong
    to do though when the behavior is write-1-to-clear: Writes not
    including to low 3 bits would unconditionally clear all ISR bits which
    are presently set. Re-calculate the value to use.
    
    Fixes: be07023be115 ("x86/vhpet: add support for level triggered interrupts")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/hpet.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/hpet.c b/xen/arch/x86/hvm/hpet.c
index 87642575f9..f0e5f877f4 100644
--- a/xen/arch/x86/hvm/hpet.c
+++ b/xen/arch/x86/hvm/hpet.c
@@ -404,7 +404,8 @@ static int cf_check hpet_write(
         break;
 
     case HPET_STATUS:
-        /* write 1 to clear. */
+        /* Write 1 to clear. Therefore don't use new_val directly here. */
+        new_val = val << ((addr & 7) * 8);
         while ( new_val )
         {
             bool active;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 30 05:23:03 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 30 Aug 2024 05:23:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.786221.1195772 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sju6B-0007jM-NE; Fri, 30 Aug 2024 05:23:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 786221.1195772; Fri, 30 Aug 2024 05:23:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sju6B-0007jF-KN; Fri, 30 Aug 2024 05:23:03 +0000
Received: by outflank-mailman (input) for mailman id 786221;
 Fri, 30 Aug 2024 05:23:02 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju6A-0007j6-89
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05:23:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju6A-00053n-7L
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05:23:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju6A-00070J-6V
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Rd1ynE+0rFSE/+ioeVywNc/bULfvrE6VGlVC8g088lw=; b=uSqW3cPE+Kxc0wHnoKeJprh/iw
	wiaSH6N3DISBeslbG9d3/gg/2IbrkyJQsi5upM/DqgWtQb1N4HlWN7WqJV6jgczkh26uum23KUZA1
	hYz4j3iRTPKZm7sQ3ywP8wVKPT9ruGszSQVI49MMyahVCyaKcuqXcC+/3yrLLp4YCJtY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ioreq: do not build arch_vcpu_ioreq_completion() for non-VMX configurations
Message-Id: <E1sju6A-00070J-6V@xenbits.xenproject.org>
Date: Fri, 30 Aug 2024 05:23:02 +0000

commit 979cfdd3e58c97ca1bc1202162e3a2eb9e059a98
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Thu Aug 29 10:02:46 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 29 10:02:46 2024 +0200

    ioreq: do not build arch_vcpu_ioreq_completion() for non-VMX configurations
    
    VIO_realmode_completion is specific to vmx realmode and thus the function
    arch_vcpu_ioreq_completion() has actual handling work only in VMX-enabled build,
    as for the rest x86 and ARM build configurations it is basically a stub.
    
    Here a separate configuration option ARCH_VCPU_IOREQ_COMPLETION introduced that
    tells whether the platform we're building for requires any specific ioreq
    completion handling. As of now only VMX has such requirement, so the option is
    selected by INTEL_VMX, for other configurations a generic default stub is
    provided (it is ARM's version of arch_vcpu_ioreq_completion() moved to common
    header).
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/Kconfig              |  7 +++++++
 xen/arch/arm/ioreq.c     |  6 ------
 xen/arch/x86/Kconfig     |  1 +
 xen/arch/x86/hvm/ioreq.c |  2 ++
 xen/include/xen/ioreq.h  | 10 ++++++++++
 5 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/xen/Kconfig b/xen/Kconfig
index e459cdac0c..72fdb83760 100644
--- a/xen/Kconfig
+++ b/xen/Kconfig
@@ -95,4 +95,11 @@ config LTO
 config ARCH_SUPPORTS_INT128
 	bool
 
+#
+# For platforms that require specific handling of per-vCPU ioreq completion
+# events
+#
+config ARCH_VCPU_IOREQ_COMPLETION
+	bool
+
 source "Kconfig.debug"
diff --git a/xen/arch/arm/ioreq.c b/xen/arch/arm/ioreq.c
index 5df755b48b..2e829d2e7f 100644
--- a/xen/arch/arm/ioreq.c
+++ b/xen/arch/arm/ioreq.c
@@ -135,12 +135,6 @@ bool arch_ioreq_complete_mmio(void)
     return false;
 }
 
-bool arch_vcpu_ioreq_completion(enum vio_completion completion)
-{
-    ASSERT_UNREACHABLE();
-    return true;
-}
-
 /*
  * The "legacy" mechanism of mapping magic pages for the IOREQ servers
  * is x86 specific, so the following hooks don't need to be implemented on Arm:
diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 7ef5c8bc48..74e081c7bd 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -127,6 +127,7 @@ config AMD_SVM
 
 config INTEL_VMX
 	def_bool HVM
+	select ARCH_VCPU_IOREQ_COMPLETION
 
 config XEN_SHSTK
 	bool "Supervisor Shadow Stacks"
diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index 4eb7a70182..5c3d0c69aa 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -29,6 +29,7 @@ bool arch_ioreq_complete_mmio(void)
     return handle_mmio();
 }
 
+#ifdef CONFIG_VCPU_ARCH_IOREQ_COMPLETION
 bool arch_vcpu_ioreq_completion(enum vio_completion completion)
 {
     switch ( completion )
@@ -51,6 +52,7 @@ bool arch_vcpu_ioreq_completion(enum vio_completion completion)
 
     return true;
 }
+#endif
 
 static gfn_t hvm_alloc_legacy_ioreq_gfn(struct ioreq_server *s)
 {
diff --git a/xen/include/xen/ioreq.h b/xen/include/xen/ioreq.h
index cd399adf17..29a17e8ff5 100644
--- a/xen/include/xen/ioreq.h
+++ b/xen/include/xen/ioreq.h
@@ -111,7 +111,17 @@ void ioreq_domain_init(struct domain *d);
 int ioreq_server_dm_op(struct xen_dm_op *op, struct domain *d, bool *const_op);
 
 bool arch_ioreq_complete_mmio(void);
+
+#ifdef CONFIG_VCPU_ARCH_IOREQ_COMPLETION
 bool arch_vcpu_ioreq_completion(enum vio_completion completion);
+#else
+static inline bool arch_vcpu_ioreq_completion(enum vio_completion completion)
+{
+    ASSERT_UNREACHABLE();
+    return true;
+}
+#endif
+
 int arch_ioreq_server_map_pages(struct ioreq_server *s);
 void arch_ioreq_server_unmap_pages(struct ioreq_server *s);
 void arch_ioreq_server_enable(struct ioreq_server *s);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 30 05:23:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 30 Aug 2024 05:23:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.786222.1195776 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sju6L-0007mX-QI; Fri, 30 Aug 2024 05:23:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 786222.1195776; Fri, 30 Aug 2024 05:23: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 1sju6L-0007mQ-Nf; Fri, 30 Aug 2024 05:23:13 +0000
Received: by outflank-mailman (input) for mailman id 786222;
 Fri, 30 Aug 2024 05:23:12 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju6K-0007mH-Bj
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05:23:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju6K-000544-Aw
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05:23:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju6K-00071N-9N
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RWRutzzhimu8/PWPDO08xTGuyV7gzXYeY+79RGFtG4E=; b=THa332Jumd+voGA1MaCAO9KCzF
	pKHfWL5vQLG4pFG0PHGEdJ2jBtU9rjSAx4Yt8vrGQbgaJgv/naN6BBQ8Uk5yfRbdvkb4TfhmHOtQ+
	/Ke+ZNPWe4kLK4xumtsmjVrVMZhmSEgyL3K6atu04L4Nkw91/1IEOrDiCJS3zBYt15l8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/hvm: make AMD-V and Intel VT-x support configurable
Message-Id: <E1sju6K-00071N-9N@xenbits.xenproject.org>
Date: Fri, 30 Aug 2024 05:23:12 +0000

commit f1bcfaf1211ff14cc2975fbfc126c0ad296faa1f
Author:     Xenia Ragiadakou <burzalodowa@gmail.com>
AuthorDate: Thu Aug 29 10:03:22 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 29 10:03:22 2024 +0200

    x86/hvm: make AMD-V and Intel VT-x support configurable
    
    Provide the user with configuration control over the cpu virtualization support
    in Xen by making AMD_SVM and INTEL_VMX options user selectable.
    
    To preserve the current default behavior, both options depend on HVM and
    default to value of HVM.
    
    To prevent users from unknowingly disabling virtualization support, make the
    controls user selectable only if EXPERT is enabled.
    
    No functional change intended.
    
    Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/Kconfig | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index 74e081c7bd..d0aaf359eb 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -123,11 +123,25 @@ config HVM
 	  If unsure, say Y.
 
 config AMD_SVM
-	def_bool HVM
+	bool "AMD-V" if EXPERT
+	depends on HVM
+	default y
+	help
+	  Enables virtual machine extensions on platforms that implement the
+	  AMD Virtualization Technology (AMD-V).
+	  If your system includes a processor with AMD-V support, say Y.
+	  If in doubt, say Y.
 
 config INTEL_VMX
-	def_bool HVM
+	bool "Intel VT-x" if EXPERT
+	depends on HVM
+	default y
 	select ARCH_VCPU_IOREQ_COMPLETION
+	help
+	  Enables virtual machine extensions on platforms that implement the
+	  Intel Virtualization Technology (Intel VT-x).
+	  If your system includes a processor with Intel VT-x support, say Y.
+	  If in doubt, say Y.
 
 config XEN_SHSTK
 	bool "Supervisor Shadow Stacks"
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 30 05:23:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 30 Aug 2024 05:23:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.786223.1195781 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sju6V-0007pA-S2; Fri, 30 Aug 2024 05:23:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 786223.1195781; Fri, 30 Aug 2024 05:23: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 1sju6V-0007p2-P9; Fri, 30 Aug 2024 05:23:23 +0000
Received: by outflank-mailman (input) for mailman id 786223;
 Fri, 30 Aug 2024 05:23:22 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju6U-0007ou-Ea
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05:23:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju6U-00054H-Dk
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05:23:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sju6U-00072F-D3
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 05: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TW3U/+JOtkYN+1iAidaeePlpZCJ0SqLYCWf/TJLX1HM=; b=vjhLzKiRNZbBoskXxaeOfXDM4U
	jbBQCx/6DMWYbRKopuX5z5OTMD1PaJ98hvnyU01a0Vx0UXMjPoHIzJyHrklOZ+arVNFGCbpRg4OIw
	6224gfBf/KEQlv40heendlBRyN5t95SDzBNMh0KZxk5aUDwO7XSEMAO/X46pEtnEhDM0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Arm64: adjust __irq_to_desc() to fix build with gcc14
Message-Id: <E1sju6U-00072F-D3@xenbits.xenproject.org>
Date: Fri, 30 Aug 2024 05:23:22 +0000

commit 99f942f3d410059dc223ee0a908827e928ef3592
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Aug 29 10:03:53 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Aug 29 10:03:53 2024 +0200

    Arm64: adjust __irq_to_desc() to fix build with gcc14
    
    With the original code I observe
    
    In function ‘__irq_to_desc’,
        inlined from ‘route_irq_to_guest’ at arch/arm/irq.c:465:12:
    arch/arm/irq.c:54:16: error: array subscript -2 is below array bounds of ‘irq_desc_t[32]’ {aka ‘struct irq_desc[32]’} [-Werror=array-bounds=]
       54 |         return &this_cpu(local_irq_desc)[irq];
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    which looks pretty bogus: How in the world does the compiler arrive at
    -2 when compiling route_irq_to_guest()? Yet independent of that the
    function's parameter wants to be of unsigned type anyway, as shown by
    a vast majority of callers (others use plain int when they really mean
    non-negative quantities). With that adjustment the code compiles fine
    again.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/include/asm/irq.h | 2 +-
 xen/arch/arm/irq.c             | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/include/asm/irq.h b/xen/arch/arm/include/asm/irq.h
index ec437add09..88e060bf29 100644
--- a/xen/arch/arm/include/asm/irq.h
+++ b/xen/arch/arm/include/asm/irq.h
@@ -56,7 +56,7 @@ extern const unsigned int nr_irqs;
 struct irq_desc;
 struct irqaction;
 
-struct irq_desc *__irq_to_desc(int irq);
+struct irq_desc *__irq_to_desc(unsigned int irq);
 
 #define irq_to_desc(irq)    __irq_to_desc(irq)
 
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 6b89f64fd1..b9757d7ad3 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -48,7 +48,7 @@ void irq_end_none(struct irq_desc *irq)
 static irq_desc_t irq_desc[NR_IRQS];
 static DEFINE_PER_CPU(irq_desc_t[NR_LOCAL_IRQS], local_irq_desc);
 
-struct irq_desc *__irq_to_desc(int irq)
+struct irq_desc *__irq_to_desc(unsigned int irq)
 {
     if ( irq < NR_LOCAL_IRQS )
         return &this_cpu(local_irq_desc)[irq];
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Aug 30 07:33:17 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 30 Aug 2024 07:33:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.786233.1195787 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjw8B-0003HT-KJ; Fri, 30 Aug 2024 07:33:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 786233.1195787; Fri, 30 Aug 2024 07:33: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 1sjw8B-0003HL-HQ; Fri, 30 Aug 2024 07:33:15 +0000
Received: by outflank-mailman (input) for mailman id 786233;
 Fri, 30 Aug 2024 07:33:14 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjw8A-0003HB-6o
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 07:33:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjw8A-0007Lh-4l
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 07:33:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjw8A-00049p-35
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 07:33: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kzC5uFPVhMZOc4YL4QQEVDrq8tHX7Q9LNg2osMIu2+c=; b=sW9Okgeay/3AeVCU8gz+11eaBY
	4IlS3NP8OGfSbPiTU3GRnmBsC84/qIN5gkBqA27nW5q+aApoCwZfMcESIm5xYGTlVbSsOuVlxG0JO
	xhtcdSpgqmgoiF5OG/iak/KNlEuKsHoFoFeTG9jVqvSotbwATQl4F1XLnPi0ha4nco6s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: use expect utility in xilinx tests
Message-Id: <E1sjw8A-00049p-35@xenbits.xenproject.org>
Date: Fri, 30 Aug 2024 07:33:14 +0000

commit 5e99a40ea54a6bf0bdc18241992866a642d7782b
Author:     Victor Lira <victorm.lira@amd.com>
AuthorDate: Thu Aug 29 15:34:23 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Aug 29 18:43:47 2024 -0700

    automation: use expect utility in xilinx tests
    
    Fixes: 95764a0817a5 (automation: update xilinx test scripts (tty))
    This patch introduced a CI failure due to a timeout in xilinx-x86_64 test.
    
    Change xilinx-x86_64 and xilinx-arm64 scripts to use "expect" utility
    to determine test result and allow early exit from tests.
    Add "expect" to xilinx container environment (dockerfile).
    Rename references to "QEMU" in "qemu-key.exp" expect script to "TEST" to be
    used by both QEMU and hardware tests.
    
    Signed-off-by: Victor Lira <victorm.lira@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/ubuntu/xenial-xilinx.dockerfile  |  1 +
 automation/gitlab-ci/test.yaml                    |  2 +
 automation/scripts/console.exp                    | 49 +++++++++++++++++++++++
 automation/scripts/qemu-alpine-x86_64.sh          |  6 +--
 automation/scripts/qemu-key.exp                   | 49 -----------------------
 automation/scripts/qemu-smoke-dom0-arm32.sh       |  6 +--
 automation/scripts/qemu-smoke-dom0-arm64.sh       |  6 +--
 automation/scripts/qemu-smoke-dom0less-arm32.sh   |  6 +--
 automation/scripts/qemu-smoke-dom0less-arm64.sh   |  6 +--
 automation/scripts/qemu-smoke-ppc64le.sh          |  6 +--
 automation/scripts/qemu-smoke-riscv64.sh          |  6 +--
 automation/scripts/qemu-smoke-x86-64.sh           |  6 +--
 automation/scripts/qemu-xtf-dom0less-arm64.sh     |  6 +--
 automation/scripts/xilinx-smoke-dom0-x86_64.sh    | 22 +++++-----
 automation/scripts/xilinx-smoke-dom0less-arm64.sh | 19 ++++-----
 15 files changed, 99 insertions(+), 97 deletions(-)

diff --git a/automation/build/ubuntu/xenial-xilinx.dockerfile b/automation/build/ubuntu/xenial-xilinx.dockerfile
index f03d62e8bd..6107d8b771 100644
--- a/automation/build/ubuntu/xenial-xilinx.dockerfile
+++ b/automation/build/ubuntu/xenial-xilinx.dockerfile
@@ -20,6 +20,7 @@ RUN apt-get update && \
         git \
         gzip \
         file \
+        expect \
         && \
         apt-get autoremove -y && \
         apt-get clean && \
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 3b339f387f..cecc18a019 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -84,6 +84,7 @@
   variables:
     CONTAINER: ubuntu:xenial-xilinx
     LOGFILE: qemu-smoke-xilinx.log
+    TEST_TIMEOUT: 120
   artifacts:
     paths:
       - smoke.serial
@@ -103,6 +104,7 @@
     LOGFILE: xilinx-smoke-x86_64.log
     XEN_CMD_CONSOLE: "console=com2 com2=115200,8n1,0x2F8,4"
     TEST_BOARD: "crater"
+    TEST_TIMEOUT: 1000
   artifacts:
     paths:
       - smoke.serial
diff --git a/automation/scripts/console.exp b/automation/scripts/console.exp
new file mode 100755
index 0000000000..f538aa6bd0
--- /dev/null
+++ b/automation/scripts/console.exp
@@ -0,0 +1,49 @@
+#!/usr/bin/expect -f
+
+if {[info exists env(TEST_TIMEOUT)]} {
+    set timeout $env(TEST_TIMEOUT)
+} else {
+    set timeout 1500
+}
+
+log_file -a $env(TEST_LOG)
+
+match_max 10000
+
+eval spawn $env(TEST_CMD)
+
+expect_after {
+    -re "(.*)\r" {
+        exp_continue -continue_timer
+    }
+    timeout {send_error "ERROR-Timeout!\n"; exit 1}
+    eof {send_error "ERROR-EOF!\n"; exit 1}
+}
+
+if {[info exists env(UBOOT_CMD)]} {
+    expect "=>"
+
+    send "$env(UBOOT_CMD)\r"
+}
+
+if {[info exists env(LOG_MSG)]} {
+    expect {
+        "$env(PASSED)" {
+            expect "$env(LOG_MSG)"
+            exit 0
+        }
+        "$env(LOG_MSG)" {
+            expect "$env(PASSED)"
+            exit 0
+        }
+    }
+}
+
+expect {
+    "$env(PASSED)" {
+        exit 0
+    }
+}
+
+expect eof
+
diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index 93914c41bc..1ff689b577 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -76,7 +76,7 @@ EOF
 
 # Run the test
 rm -f smoke.serial
-export QEMU_CMD="qemu-system-x86_64 \
+export TEST_CMD="qemu-system-x86_64 \
     -cpu qemu64,+svm \
     -m 2G -smp 2 \
     -monitor none -serial stdio \
@@ -84,8 +84,8 @@ export QEMU_CMD="qemu-system-x86_64 \
     -device virtio-net-pci,netdev=n0 \
     -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0"
 
-export QEMU_LOG="smoke.serial"
+export TEST_LOG="smoke.serial"
 export LOG_MSG="Domain-0"
 export PASSED="BusyBox"
 
-./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-key.exp b/automation/scripts/qemu-key.exp
deleted file mode 100755
index 66c4164831..0000000000
--- a/automation/scripts/qemu-key.exp
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/expect -f
-
-if {[info exists env(QEMU_TIMEOUT)]} {
-    set timeout $env(QEMU_TIMEOUT)
-} else {
-    set timeout 1500
-}
-
-log_file -a $env(QEMU_LOG)
-
-match_max 10000
-
-eval spawn $env(QEMU_CMD)
-
-expect_after {
-    -re "(.*)\r" {
-        exp_continue -continue_timer
-    }
-    timeout {send_error "ERROR-Timeout!\n"; exit 1}
-    eof {send_error "ERROR-EOF!\n"; exit 1}
-}
-
-if {[info exists env(UBOOT_CMD)]} {
-    expect "=>"
-
-    send "$env(UBOOT_CMD)\r"
-}
-
-if {[info exists env(LOG_MSG)]} {
-    expect {
-        "$env(PASSED)" {
-            expect "$env(LOG_MSG)"
-            exit 0
-        }
-        "$env(LOG_MSG)" {
-            expect "$env(PASSED)"
-            exit 0
-        }
-    }
-}
-
-expect {
-    "$env(PASSED)" {
-        exit 0
-    }
-}
-
-expect eof
-
diff --git a/automation/scripts/qemu-smoke-dom0-arm32.sh b/automation/scripts/qemu-smoke-dom0-arm32.sh
index 7c282eff3a..e1cd838809 100755
--- a/automation/scripts/qemu-smoke-dom0-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm32.sh
@@ -77,7 +77,7 @@ git clone --depth 1 https://gitlab.com/xen-project/imagebuilder.git
 bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 
 rm -f ${serial_log}
-export QEMU_CMD="./qemu-system-arm \
+export TEST_CMD="./qemu-system-arm \
    -machine virt \
    -machine virtualization=true \
    -smp 4 \
@@ -91,8 +91,8 @@ export QEMU_CMD="./qemu-system-arm \
    -bios /usr/lib/u-boot/qemu_arm/u-boot.bin"
 
 export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
-export QEMU_LOG="${serial_log}"
+export TEST_LOG="${serial_log}"
 export LOG_MSG="Domain-0"
 export PASSED="/ #"
 
-../automation/scripts/qemu-key.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 81f210f7f5..4d22a124df 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -93,7 +93,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 
 # Run the test
 rm -f smoke.serial
-export QEMU_CMD="./binaries/qemu-system-aarch64 \
+export TEST_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
     -m 2048 -monitor none -serial stdio \
@@ -104,8 +104,8 @@ export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
 
 export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
-export QEMU_LOG="smoke.serial"
+export TEST_LOG="smoke.serial"
 export LOG_MSG="Domain-0"
 export PASSED="BusyBox"
 
-./automation/scripts/qemu-key.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 38e8a0b0bd..41f6e5d8e6 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -130,7 +130,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 
 # Run the test
 rm -f ${serial_log}
-export QEMU_CMD="./qemu-system-arm \
+export TEST_CMD="./qemu-system-arm \
     -machine virt \
     -machine virtualization=true \
     -smp 4 \
@@ -144,8 +144,8 @@ export QEMU_CMD="./qemu-system-arm \
     -bios /usr/lib/u-boot/qemu_arm/u-boot.bin"
 
 export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
-export QEMU_LOG="${serial_log}"
+export TEST_LOG="${serial_log}"
 export LOG_MSG="${dom0_prompt}"
 export PASSED="${passed}"
 
-../automation/scripts/qemu-key.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 ea67650e17..83e1866ca6 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -204,7 +204,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 
 # Run the test
 rm -f smoke.serial
-export QEMU_CMD="./binaries/qemu-system-aarch64 \
+export TEST_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt,gic-version=$gic_version \
     -m 2048 -monitor none -serial stdio \
@@ -215,8 +215,8 @@ export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
 
 export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
-export QEMU_LOG="smoke.serial"
+export TEST_LOG="smoke.serial"
 export LOG_MSG="Welcome to Alpine Linux"
 export PASSED="${passed}"
 
-./automation/scripts/qemu-key.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 49e189c370..617096ad1f 100755
--- a/automation/scripts/qemu-smoke-ppc64le.sh
+++ b/automation/scripts/qemu-smoke-ppc64le.sh
@@ -10,7 +10,7 @@ machine=$1
 # Run the test
 rm -f ${serial_log}
 
-export QEMU_CMD="qemu-system-ppc64 \
+export TEST_CMD="qemu-system-ppc64 \
     -bios skiboot.lid \
     -M $machine \
     -m 2g \
@@ -21,7 +21,7 @@ export QEMU_CMD="qemu-system-ppc64 \
     -serial stdio \
     -kernel binaries/xen"
 
-export QEMU_LOG="${serial_log}"
+export TEST_LOG="${serial_log}"
 export PASSED="Hello, ppc64le!"
 
-./automation/scripts/qemu-key.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 422ee03e0d..8f755d0a6a 100755
--- a/automation/scripts/qemu-smoke-riscv64.sh
+++ b/automation/scripts/qemu-smoke-riscv64.sh
@@ -5,14 +5,14 @@ set -ex -o pipefail
 # Run the test
 rm -f smoke.serial
 
-export QEMU_CMD="qemu-system-riscv64 \
+export TEST_CMD="qemu-system-riscv64 \
     -M virt \
     -smp 1 \
     -nographic \
     -m 2g \
     -kernel binaries/xen"
 
-export QEMU_LOG="smoke.serial"
+export TEST_LOG="smoke.serial"
 export PASSED="All set up"
 
-./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-smoke-x86-64.sh b/automation/scripts/qemu-smoke-x86-64.sh
index 7495185d9f..da0c26cc2f 100755
--- a/automation/scripts/qemu-smoke-x86-64.sh
+++ b/automation/scripts/qemu-smoke-x86-64.sh
@@ -15,12 +15,12 @@ case $variant in
 esac
 
 rm -f smoke.serial
-export QEMU_CMD="qemu-system-x86_64 -nographic -kernel binaries/xen \
+export TEST_CMD="qemu-system-x86_64 -nographic -kernel binaries/xen \
         -initrd xtf/tests/example/$k \
         -append \"loglvl=all console=com1 noreboot console_timestamps=boot $extra\" \
         -m 512 -monitor none -serial stdio"
 
-export QEMU_LOG="smoke.serial"
+export TEST_LOG="smoke.serial"
 export PASSED="Test result: SUCCESS"
 
-./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/qemu-xtf-dom0less-arm64.sh b/automation/scripts/qemu-xtf-dom0less-arm64.sh
index acef1637e2..9608de6ec0 100755
--- a/automation/scripts/qemu-xtf-dom0less-arm64.sh
+++ b/automation/scripts/qemu-xtf-dom0less-arm64.sh
@@ -50,7 +50,7 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 
 # Run the test
 rm -f smoke.serial
-export QEMU_CMD="./binaries/qemu-system-aarch64 \
+export TEST_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
     -m 2048 -monitor none -serial stdio \
@@ -61,7 +61,7 @@ export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -bios /usr/lib/u-boot/qemu_arm64/u-boot.bin"
 
 export UBOOT_CMD="virtio scan; dhcp; tftpb 0x40000000 boot.scr; source 0x40000000"
-export QEMU_LOG="smoke.serial"
+export TEST_LOG="smoke.serial"
 export PASSED="${passed}"
 
-./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
+./automation/scripts/console.exp | sed 's/\r\+$//'
diff --git a/automation/scripts/xilinx-smoke-dom0-x86_64.sh b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
index 4559e2b9ee..ef6e1361a9 100755
--- a/automation/scripts/xilinx-smoke-dom0-x86_64.sh
+++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
@@ -1,8 +1,8 @@
-#!/bin/sh
+#!/usr/bin/env bash
 
 # Run x86_64 dom0 tests on hardware.
 
-set -ex
+set -ex -o pipefail
 
 fatal() {
     echo "$(basename "$0") $*" >&2
@@ -27,7 +27,6 @@ memory = 512
 vif = [ "bridge=xenbr0", ]
 disk = [ ]
 '
-TIMEOUT_SECONDS=200
 
 # Select test variant.
 if [ "${TEST}" = "ping" ]; then
@@ -125,20 +124,19 @@ boot
 
 # Power cycle board and collect serial port output.
 SERIAL_DEV="/dev/serial/${TEST_BOARD}"
-SERIAL_CMD="cat ${SERIAL_DEV} | tee smoke.serial | sed 's/\r//'"
 sh /scratch/gitlab-runner/${TEST_BOARD}.sh 2
 sleep 5
 sh /scratch/gitlab-runner/${TEST_BOARD}.sh 1
 sleep 5
 set +e
 stty -F ${SERIAL_DEV} 115200
-timeout -k 1 ${TIMEOUT_SECONDS} nohup sh -c "${SERIAL_CMD}"
-sh /scratch/gitlab-runner/${TEST_BOARD}.sh 2
-
-set -e
 
-if grep -q "${PASS_MSG}" smoke.serial; then
-    exit 0
-fi
+# Capture test result and power off board before exiting.
+export PASSED="${PASS_MSG}"
+export TEST_CMD="cat ${SERIAL_DEV}"
+export TEST_LOG="smoke.serial"
 
-fatal "Test failed"
+./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 18aa07f0a2..b24ad11b8c 100755
--- a/automation/scripts/xilinx-smoke-dom0less-arm64.sh
+++ b/automation/scripts/xilinx-smoke-dom0less-arm64.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 test_variant=$1
 
@@ -137,13 +137,14 @@ cd $START
 SERIAL_DEV="/dev/serial/zynq"
 set +e
 stty -F ${SERIAL_DEV} 115200
-timeout -k 1 120 nohup sh -c "cat ${SERIAL_DEV} | tee smoke.serial | sed 's/\r//'"
 
-# stop the board
-cd /scratch/gitlab-runner
-bash zcu102.sh 2
-cd $START
+# Capture test result and power off board before exiting.
+export PASSED="${passed}"
+export LOG_MSG="Welcome to Alpine Linux"
+export TEST_CMD="cat ${SERIAL_DEV}"
+export TEST_LOG="smoke.serial"
 
-set -e
-(grep -q "^Welcome to Alpine Linux" smoke.serial && grep -q "${passed}" smoke.serial) || exit 1
-exit 0
+./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 Fri Aug 30 07:33:17 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 30 Aug 2024 07:33:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.786232.1195783 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sjw81-0003G1-IZ; Fri, 30 Aug 2024 07:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 786232.1195783; Fri, 30 Aug 2024 07:33: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 1sjw81-0003Ft-Fp; Fri, 30 Aug 2024 07:33:05 +0000
Received: by outflank-mailman (input) for mailman id 786232;
 Fri, 30 Aug 2024 07:33:04 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjw80-0003Fn-4W
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 07:33:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjw80-0007LX-0t
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 07:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sjw7z-00048m-UC
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 07:33: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=A0pBOchUuPrUjhGjzFhVjghLYI9GQ8HTeLJwIPcQITo=; b=jwu+3c9DxkICGyOLDSbzSaTC+6
	TBgXZfftz5zvEbG5cdgkrgKUfESCoK2oeEgmFYss8b8BqS5IrZMAex0gnaTVn3awZckFmhnlzdrhc
	JkJi56LH4WQ6GoTqG2rNDlaz3p2IV6Gya+aq0zlNOyVOukcDuz1/NU57uPkykqz4SVKE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: fix false success in qemu tests
Message-Id: <E1sjw7z-00048m-UC@xenbits.xenproject.org>
Date: Fri, 30 Aug 2024 07:33:03 +0000

commit 740c41ca05a83a2c3629eb2ff323877c37d95c1e
Author:     Victor Lira <victorm.lira@amd.com>
AuthorDate: Thu Aug 29 15:34:22 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Aug 29 17:44:42 2024 -0700

    automation: fix false success in qemu tests
    
    Fix flaw in qemu-*.sh tests that producess a false success. The following
    lines produces success despite the "expect" script producing nonzero exit
    status:
    
        set +e
    ...
        ./automation/scripts/qemu-key.exp | sed 's/\r\+$//'
        (end of file)
    
    The default exit status for a pipeline using "|" operator is that of the
    rightmost command. Fix this by setting the "pipefail" option in the shell,
    and removing "set +e" allowing the expect script to determine the result.
    
    Signed-off-by: Victor Lira <victorm.lira@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/scripts/qemu-alpine-x86_64.sh        | 3 +--
 automation/scripts/qemu-key.exp                 | 2 +-
 automation/scripts/qemu-smoke-dom0-arm32.sh     | 3 +--
 automation/scripts/qemu-smoke-dom0-arm64.sh     | 3 +--
 automation/scripts/qemu-smoke-dom0less-arm32.sh | 3 +--
 automation/scripts/qemu-smoke-dom0less-arm64.sh | 3 +--
 automation/scripts/qemu-smoke-ppc64le.sh        | 3 +--
 automation/scripts/qemu-smoke-riscv64.sh        | 3 +--
 automation/scripts/qemu-smoke-x86-64.sh         | 3 +--
 automation/scripts/qemu-xtf-dom0less-arm64.sh   | 3 +--
 10 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/automation/scripts/qemu-alpine-x86_64.sh b/automation/scripts/qemu-alpine-x86_64.sh
index 42a89e86b0..93914c41bc 100755
--- a/automation/scripts/qemu-alpine-x86_64.sh
+++ b/automation/scripts/qemu-alpine-x86_64.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 # DomU Busybox
 cd binaries
@@ -76,7 +76,6 @@ EOF
 
 # Run the test
 rm -f smoke.serial
-set +e
 export QEMU_CMD="qemu-system-x86_64 \
     -cpu qemu64,+svm \
     -m 2G -smp 2 \
diff --git a/automation/scripts/qemu-key.exp b/automation/scripts/qemu-key.exp
index 787f1f08cb..66c4164831 100755
--- a/automation/scripts/qemu-key.exp
+++ b/automation/scripts/qemu-key.exp
@@ -14,7 +14,7 @@ eval spawn $env(QEMU_CMD)
 
 expect_after {
     -re "(.*)\r" {
-        exp_continue
+        exp_continue -continue_timer
     }
     timeout {send_error "ERROR-Timeout!\n"; exit 1}
     eof {send_error "ERROR-EOF!\n"; exit 1}
diff --git a/automation/scripts/qemu-smoke-dom0-arm32.sh b/automation/scripts/qemu-smoke-dom0-arm32.sh
index fd64b19358..7c282eff3a 100755
--- a/automation/scripts/qemu-smoke-dom0-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm32.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 serial_log="$(pwd)/smoke.serial"
 
@@ -77,7 +77,6 @@ git clone --depth 1 https://gitlab.com/xen-project/imagebuilder.git
 bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 
 rm -f ${serial_log}
-set +e
 export QEMU_CMD="./qemu-system-arm \
    -machine virt \
    -machine virtualization=true \
diff --git a/automation/scripts/qemu-smoke-dom0-arm64.sh b/automation/scripts/qemu-smoke-dom0-arm64.sh
index e0cea742b0..81f210f7f5 100755
--- a/automation/scripts/qemu-smoke-dom0-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0-arm64.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 # DomU Busybox
 cd binaries
@@ -93,7 +93,6 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 
 # Run the test
 rm -f smoke.serial
-set +e
 export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
diff --git a/automation/scripts/qemu-smoke-dom0less-arm32.sh b/automation/scripts/qemu-smoke-dom0less-arm32.sh
index e824cb7c2a..38e8a0b0bd 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm32.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm32.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 test_variant=$1
 
@@ -130,7 +130,6 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d . -c config
 
 # Run the test
 rm -f ${serial_log}
-set +e
 export QEMU_CMD="./qemu-system-arm \
     -machine virt \
     -machine virtualization=true \
diff --git a/automation/scripts/qemu-smoke-dom0less-arm64.sh b/automation/scripts/qemu-smoke-dom0less-arm64.sh
index f42ba5d196..ea67650e17 100755
--- a/automation/scripts/qemu-smoke-dom0less-arm64.sh
+++ b/automation/scripts/qemu-smoke-dom0less-arm64.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 test_variant=$1
 
@@ -204,7 +204,6 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 
 # Run the test
 rm -f smoke.serial
-set +e
 export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt,gic-version=$gic_version \
diff --git a/automation/scripts/qemu-smoke-ppc64le.sh b/automation/scripts/qemu-smoke-ppc64le.sh
index 594f92c19c..49e189c370 100755
--- a/automation/scripts/qemu-smoke-ppc64le.sh
+++ b/automation/scripts/qemu-smoke-ppc64le.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 serial_log="$(pwd)/smoke.serial"
 
@@ -9,7 +9,6 @@ machine=$1
 
 # Run the test
 rm -f ${serial_log}
-set +e
 
 export QEMU_CMD="qemu-system-ppc64 \
     -bios skiboot.lid \
diff --git a/automation/scripts/qemu-smoke-riscv64.sh b/automation/scripts/qemu-smoke-riscv64.sh
index c2595f657f..422ee03e0d 100755
--- a/automation/scripts/qemu-smoke-riscv64.sh
+++ b/automation/scripts/qemu-smoke-riscv64.sh
@@ -1,10 +1,9 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 # Run the test
 rm -f smoke.serial
-set +e
 
 export QEMU_CMD="qemu-system-riscv64 \
     -M virt \
diff --git a/automation/scripts/qemu-smoke-x86-64.sh b/automation/scripts/qemu-smoke-x86-64.sh
index 3440b1761d..7495185d9f 100755
--- a/automation/scripts/qemu-smoke-x86-64.sh
+++ b/automation/scripts/qemu-smoke-x86-64.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 # variant should be either pv or pvh
 variant=$1
@@ -15,7 +15,6 @@ case $variant in
 esac
 
 rm -f smoke.serial
-set +e
 export QEMU_CMD="qemu-system-x86_64 -nographic -kernel binaries/xen \
         -initrd xtf/tests/example/$k \
         -append \"loglvl=all console=com1 noreboot console_timestamps=boot $extra\" \
diff --git a/automation/scripts/qemu-xtf-dom0less-arm64.sh b/automation/scripts/qemu-xtf-dom0less-arm64.sh
index 4042fe5060..acef1637e2 100755
--- a/automation/scripts/qemu-xtf-dom0less-arm64.sh
+++ b/automation/scripts/qemu-xtf-dom0less-arm64.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-set -ex
+set -ex -o pipefail
 
 # Name of the XTF test
 xtf_test=$1
@@ -50,7 +50,6 @@ bash imagebuilder/scripts/uboot-script-gen -t tftp -d binaries/ -c binaries/conf
 
 # Run the test
 rm -f smoke.serial
-set +e
 export QEMU_CMD="./binaries/qemu-system-aarch64 \
     -machine virtualization=true \
     -cpu cortex-a57 -machine type=virt \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 30 17:22:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 30 Aug 2024 17:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.786553.1196127 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sk5K0-0004Jv-PU; Fri, 30 Aug 2024 17:22:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 786553.1196127; Fri, 30 Aug 2024 17:22:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sk5K0-0004Jn-Ml; Fri, 30 Aug 2024 17:22:04 +0000
Received: by outflank-mailman (input) for mailman id 786553;
 Fri, 30 Aug 2024 17:22:03 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sk5Jz-0004Jh-M8
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 17:22:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sk5Jz-0002bb-Ep
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 17:22:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sk5Jz-0005We-Dj
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 17:22: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LLNnr6wlZTOi5FB25Dh+X4i5fEymeCQZZ+kTw+S4mAg=; b=DFt/q9WJxXpWJd+TdBzhTZeGse
	eQJMfK2IO8BMm8tapXqJkMEwk+5F4XiiIFpiq+P1fbIuuHgp6D43JGVXisk3hw41t9eS/YhGh7rx4
	sAQr1yekHjJU9JMkA3uIwJAL/rEgvQR8xCIwBTBdXDbP7UF0Gc/i75pvLmDZ/ujyvh2k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/ocaml: Factor out compatiblity handling
Message-Id: <E1sk5Jz-0005We-Dj@xenbits.xenproject.org>
Date: Fri, 30 Aug 2024 17:22:03 +0000

commit 8d336fcb6ea6b486ceccef2e36d003db032131fe
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Jan 30 22:14:20 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 30 18:08:48 2024 +0100

    tools/ocaml: Factor out compatiblity handling
    
    ... rather than having each library implement its own subset.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
---
 tools/ocaml/libs/xc/Makefile        |  2 +-
 tools/ocaml/libs/xc/xenctrl_stubs.c | 13 +++----------
 tools/ocaml/libs/xen-caml-compat.h  | 23 +++++++++++++++++++++++
 3 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/tools/ocaml/libs/xc/Makefile b/tools/ocaml/libs/xc/Makefile
index 1d9fecb06e..cdf4d01dac 100644
--- a/tools/ocaml/libs/xc/Makefile
+++ b/tools/ocaml/libs/xc/Makefile
@@ -2,7 +2,7 @@ OCAML_TOPLEVEL=$(CURDIR)/../..
 XEN_ROOT=$(OCAML_TOPLEVEL)/../..
 include $(OCAML_TOPLEVEL)/common.make
 
-CFLAGS += -I../mmap $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest)
+CFLAGS += -I../ -I../mmap $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest)
 CFLAGS += $(APPEND_CFLAGS)
 OCAMLINCLUDE += -I ../mmap -I ../eventchn
 
diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenctrl_stubs.c
index a529080129..c78191f95a 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -25,6 +25,8 @@
 #include <caml/fail.h>
 #include <caml/callback.h>
 
+#include "xen-caml-compat.h"
+
 #include <sys/mman.h>
 #include <stdint.h>
 #include <string.h>
@@ -37,14 +39,6 @@
 
 #include "mmap_stubs.h"
 
-#ifndef Val_none
-#define Val_none (Val_int(0))
-#endif
-
-#ifndef Tag_some
-#define Tag_some 0
-#endif
-
 static inline xc_interface *xch_of_val(value v)
 {
 	xc_interface *xch = *(xc_interface **)Data_custom_val(v);
@@ -744,8 +738,7 @@ CAMLprim value stub_xc_evtchn_status(value xch_val, value domid, value port)
 	Store_field(result_status, 0, Val_int(status.vcpu));
 	Store_field(result_status, 1, stat);
 
-	result = caml_alloc_small(1, Tag_some);
-	Store_field(result, 0, result_status);
+	result = caml_alloc_some(result_status);
 
 	CAMLreturn(result);
 }
diff --git a/tools/ocaml/libs/xen-caml-compat.h b/tools/ocaml/libs/xen-caml-compat.h
new file mode 100644
index 0000000000..14aede2128
--- /dev/null
+++ b/tools/ocaml/libs/xen-caml-compat.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: LGPL-2.1-only WITH OCaml-LGPL-linking-exception */
+#ifndef XEN_CAML_COMPAT_H
+#define XEN_CAML_COMPAT_H
+
+#ifndef Val_none /* Option handling.  Compat for Ocaml < 4.12 */
+
+#define Val_none Val_int(0)
+#define Tag_some 0
+#define Some_val(v) Field(v, 0)
+
+static inline value caml_alloc_some(value v)
+{
+    CAMLparam1(v);
+
+    value some = caml_alloc_small(1, Tag_some);
+    Field(some, 0) = v;
+
+    CAMLreturn(some);
+}
+
+#endif /* !Val_none */
+
+#endif /* XEN_CAML_COMPAT_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 30 17:22:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 30 Aug 2024 17:22:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.786554.1196132 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sk5KA-0004Le-R6; Fri, 30 Aug 2024 17:22:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 786554.1196132; Fri, 30 Aug 2024 17:22:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sk5KA-0004LV-OG; Fri, 30 Aug 2024 17:22:14 +0000
Received: by outflank-mailman (input) for mailman id 786554;
 Fri, 30 Aug 2024 17:22:13 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sk5K9-0004LM-Jj
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 17:22:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sk5K9-0002bl-Iv
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 17:22:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sk5K9-0005Xc-H5
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 17:22: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ShgAx/SinzSKMUWE6so87leddGOtNg53Hm5MMHo8FEE=; b=hhUxvkh2ATVZam4XcH8Npw5oGg
	6t6f9n4l08qkek+Irlfa8C45ajuGEc+V08bj7hfrCh+SJM+MoD81lb7Ait4nQEeucW5FTQQVO8M4Q
	ThLEQiz1GEKxbRT4/UggpGtA7wKjixXBNst4tY+PjSYkMc2BAqAtF+jjS3kBiLeSlJbQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/pv: Make cr4_pv32_mask be PV32-only
Message-Id: <E1sk5K9-0005Xc-H5@xenbits.xenproject.org>
Date: Fri, 30 Aug 2024 17:22:13 +0000

commit 7ab0f83e604d44c92daa218423bf7644502fcefe
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Aug 28 20:20:34 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 30 18:08:48 2024 +0100

    x86/pv: Make cr4_pv32_mask be PV32-only
    
    The user of cr4_pv32_mask (the cr4_pv32_restore() function) only exists in a
    CONFIG_PV32 build, but right now the variable is unconditionally set up.
    
    To start with, move the setup into set_in_cr4() and remove it from it's
    somewhat ad-hoc position in __start_xen().  This means the variable will be
    set up in two steps for a CONFIG_PV32=y build, but it's cleaner and more
    robust logic overall.
    
    With that, there's no good reason for the variable to stay in setup.c.  Move
    it to x86/pv/domain.c (beside opt_pv32, for want of any better place to live),
    and move the declaration to beside set_in_cr4() and mmu_cr4_features which is
    a better position than setup.h.
    
    Guard the reference with CONFIG_PV32, and fix up a recent typo in an adjacent
    comment while at it.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/include/asm/processor.h |  4 ++++
 xen/arch/x86/include/asm/setup.h     |  2 --
 xen/arch/x86/pv/dom0_build.c         | 10 +++++++---
 xen/arch/x86/pv/domain.c             |  1 +
 xen/arch/x86/setup.c                 |  4 ----
 5 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/include/asm/processor.h b/xen/arch/x86/include/asm/processor.h
index 66463f6a6d..e71dbb8d3f 100644
--- a/xen/arch/x86/include/asm/processor.h
+++ b/xen/arch/x86/include/asm/processor.h
@@ -312,11 +312,15 @@ static inline void stts(void)
  * after us can get the correct flags.
  */
 extern unsigned long mmu_cr4_features;
+extern unsigned long cr4_pv32_mask;
 
 static always_inline void set_in_cr4 (unsigned long mask)
 {
     mmu_cr4_features |= mask;
     write_cr4(read_cr4() | mask);
+
+    if ( IS_ENABLED(CONFIG_PV32) && (mask & XEN_CR4_PV32_BITS) )
+        cr4_pv32_mask |= (mask & XEN_CR4_PV32_BITS);
 }
 
 static always_inline void __monitor(const void *eax, unsigned long ecx,
diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h
index 8f7dfefb4d..d75589178b 100644
--- a/xen/arch/x86/include/asm/setup.h
+++ b/xen/arch/x86/include/asm/setup.h
@@ -64,8 +64,6 @@ extern bool opt_dom0_verbose;
 extern bool opt_dom0_cpuid_faulting;
 extern bool opt_dom0_msr_relaxed;
 
-extern unsigned long cr4_pv32_mask;
-
 #define max_init_domid (0)
 
 #endif
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 57b1834b5e..262edb6bf2 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -1061,12 +1061,14 @@ int __init dom0_construct_pv(struct domain *d,
 
     /*
      * Clear SMAP in CR4 to allow user-accesses in construct_dom0().  This
-     * prevents us needing to write rewrite construct_dom0() in terms of
+     * prevents us needing to write construct_dom0() in terms of
      * copy_{to,from}_user().
      */
     if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
     {
-        cr4_pv32_mask &= ~X86_CR4_SMAP;
+        if ( IS_ENABLED(CONFIG_PV32) )
+            cr4_pv32_mask &= ~X86_CR4_SMAP;
+
         write_cr4(read_cr4() & ~X86_CR4_SMAP);
     }
 
@@ -1075,7 +1077,9 @@ int __init dom0_construct_pv(struct domain *d,
     if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
     {
         write_cr4(read_cr4() | X86_CR4_SMAP);
-        cr4_pv32_mask |= X86_CR4_SMAP;
+
+        if ( IS_ENABLED(CONFIG_PV32) )
+            cr4_pv32_mask |= X86_CR4_SMAP;
     }
 
     return rc;
diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c
index 86b74fb372..d5a8564c1c 100644
--- a/xen/arch/x86/pv/domain.c
+++ b/xen/arch/x86/pv/domain.c
@@ -19,6 +19,7 @@
 
 #ifdef CONFIG_PV32
 int8_t __read_mostly opt_pv32 = -1;
+unsigned long __ro_after_init cr4_pv32_mask;
 #endif
 
 static int __init cf_check parse_pv(const char *s)
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index f1076c7203..c2e0082a30 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -79,8 +79,6 @@ bool __read_mostly use_invpcid;
 int8_t __initdata opt_probe_port_aliases = -1;
 boolean_param("probe-port-aliases", opt_probe_port_aliases);
 
-unsigned long __ro_after_init cr4_pv32_mask;
-
 /* **** Linux config option: propagated to domain0. */
 /* "acpi=off":    Sisables both ACPI table parsing and interpreter. */
 /* "acpi=force":  Override the disable blacklist.                   */
@@ -1898,8 +1896,6 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
         set_in_cr4(X86_CR4_SMAP);
 
-    cr4_pv32_mask = mmu_cr4_features & XEN_CR4_PV32_BITS;
-
     if ( boot_cpu_has(X86_FEATURE_FSGSBASE) )
         set_in_cr4(X86_CR4_FSGSBASE);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 30 17:22:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 30 Aug 2024 17:22:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.786555.1196135 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sk5KK-0004OQ-Sa; Fri, 30 Aug 2024 17:22:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 786555.1196135; Fri, 30 Aug 2024 17:22:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sk5KK-0004OJ-Pk; Fri, 30 Aug 2024 17:22:24 +0000
Received: by outflank-mailman (input) for mailman id 786555;
 Fri, 30 Aug 2024 17:22:23 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sk5KJ-0004O1-Nt
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 17:22:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sk5KJ-0002c3-N9
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 17:22:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sk5KJ-0005YN-LP
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 17:22: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=p8F/5N4KpGkHjlsuBkd44eCMIvlmyyW4yIEpEqugNHk=; b=Q6hNjae2Inhr/QL9eOiXMOSiln
	yu4m0kXLxBY6X4BQfI+0Yt+2M+B3TCYBgvsemh+mXpWsGAItDKZOtxX3/HwuOn7vGt2Q61zRotuHc
	bq9o0tSQS74/cleAKapcapSfiVRkfivFmDPJ3PDvpAUY5TKSERY9WPL2GCiz4PjuuK74=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxl: Probe QEMU for -run-with chroot=dir and use it
Message-Id: <E1sk5KJ-0005YN-LP@xenbits.xenproject.org>
Date: Fri, 30 Aug 2024 17:22:23 +0000

commit 82335a8cc54c009792d44f0be51213da48303a68
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Fri Aug 30 09:49:40 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 30 18:14:11 2024 +0100

    libxl: Probe QEMU for -run-with chroot=dir and use it
    
    QEMU 9.0 have removed "-chroot" command line option, which have been
    deprecated since QEMU 8.1 in favor of "-run-with chroot=dir".
    
    Look into the result of the QMP command "query-command-line-options"
    to find out if "-run-with chroot=dir" is available. Then use it in
    place of "-chroot".
    
    Resolves: xen-project/xen#187
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 tools/libs/light/libxl_dm.c       | 78 ++++++++++++++++++++++++++++++++-------
 tools/libs/light/libxl_internal.h |  5 +++
 2 files changed, 69 insertions(+), 14 deletions(-)

diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index 46babfed0b..15b157060f 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -1183,11 +1183,12 @@ out:
 }
 
 static int libxl__build_device_model_args_new(libxl__gc *gc,
-                                        const char *dm, int guest_domid,
-                                        const libxl_domain_config *guest_config,
-                                        char ***args, char ***envs,
-                                        const libxl__domain_build_state *state,
-                                        int *dm_state_fd)
+    const char *dm, int guest_domid,
+    const libxl_domain_config *guest_config,
+    char ***args, char ***envs,
+    const libxl__domain_build_state *state,
+    const libxl__qemu_available_opts *qemu_opts,
+    int *dm_state_fd)
 {
     const libxl_domain_create_info *c_info = &guest_config->c_info;
     const libxl_domain_build_info *b_info = &guest_config->b_info;
@@ -1778,8 +1779,13 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
         }
 
         /* Add "-chroot [dir]" to command-line */
-        flexarray_append(dm_args, "-chroot");
-        flexarray_append(dm_args, chroot_dir);
+        if (qemu_opts->have_runwith_chroot) {
+            flexarray_append_pair(dm_args, "-run-with",
+                                  GCSPRINTF("chroot=%s", chroot_dir));
+        } else {
+            flexarray_append(dm_args, "-chroot");
+            flexarray_append(dm_args, chroot_dir);
+        }
     }
 
     if (state->saved_state) {
@@ -2059,11 +2065,12 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
 }
 
 static int libxl__build_device_model_args(libxl__gc *gc,
-                                        const char *dm, int guest_domid,
-                                        const libxl_domain_config *guest_config,
-                                        char ***args, char ***envs,
-                                        const libxl__domain_build_state *state,
-                                        int *dm_state_fd)
+    const char *dm, int guest_domid,
+    const libxl_domain_config *guest_config,
+    char ***args, char ***envs,
+    const libxl__domain_build_state *state,
+    const libxl__qemu_available_opts *qemu_opts,
+    int *dm_state_fd)
 /* dm_state_fd may be NULL iff caller knows we are using stubdom
  * and therefore will be passing a filename rather than a fd. */
 {
@@ -2081,7 +2088,9 @@ static int libxl__build_device_model_args(libxl__gc *gc,
         return libxl__build_device_model_args_new(gc, dm,
                                                   guest_domid, guest_config,
                                                   args, envs,
-                                                  state, dm_state_fd);
+                                                  state,
+                                                  qemu_opts,
+                                                  dm_state_fd);
     default:
         LOGED(ERROR, guest_domid, "unknown device model version %d",
               guest_config->b_info.device_model_version);
@@ -2403,7 +2412,9 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss)
 
     ret = libxl__build_device_model_args(gc, "stubdom-dm", guest_domid,
                                          guest_config, &args, NULL,
-                                         d_state, NULL);
+                                         d_state,
+                                         &sdss->dm.qemu_opts,
+                                         NULL);
     if (ret) {
         ret = ERROR_FAIL;
         goto out;
@@ -3024,6 +3035,7 @@ static void device_model_probe_detached(libxl__egc *egc,
 static void device_model_probe_cmdline(libxl__egc *egc,
     libxl__ev_qmp *qmp, const libxl__json_object *response, int rc)
 {
+    EGC_GC;
     libxl__dm_spawn_state *dmss = CONTAINER_OF(qmp, *dmss, qmp);
 
     if (rc)
@@ -3033,6 +3045,43 @@ static void device_model_probe_cmdline(libxl__egc *egc,
      * query-command-line-options response:
      * [ { 'option': 'str', 'parameters': [{ 'name': 'str', ... }] } ]
      */
+    const libxl__json_object *option;
+    for (int i_option = 0;
+         (option = libxl__json_array_get(response, i_option));
+         i_option++) {
+        const libxl__json_object *o;
+        const char *opt_str;
+
+        o = libxl__json_map_get("option", option, JSON_STRING);
+        if (!o) {
+            rc = ERROR_QEMU_API;
+            goto out;
+        }
+        opt_str = libxl__json_object_get_string(o);
+
+        if (!strcmp("run-with", opt_str)) {
+            const libxl__json_object *params;
+            const libxl__json_object *item;
+
+            params = libxl__json_map_get("parameters", option, JSON_ARRAY);
+            for (int i = 0; (item = libxl__json_array_get(params, i)); i++) {
+                o = libxl__json_map_get("name", item, JSON_STRING);
+                if (!o) {
+                    rc = ERROR_QEMU_API;
+                    goto out;
+                }
+                if (!strcmp("chroot", libxl__json_object_get_string(o))) {
+                    dmss->qemu_opts.have_runwith_chroot = true;
+                }
+            }
+
+            /*
+             * No need to parse more options, we are only interested with
+             * -run-with at the moment.
+             */
+            break;
+        }
+    }
 
     qmp->callback = device_model_probe_quit;
     rc = libxl__ev_qmp_send(egc, qmp, "quit", NULL);
@@ -3113,6 +3162,7 @@ static void device_model_launch(libxl__egc *egc,
 
     rc = libxl__build_device_model_args(gc, dm, domid, guest_config,
                                           &args, &envs, state,
+                                          &dmss->qemu_opts,
                                           &dm_state_fd);
     if (rc)
         goto out;
diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index e99adc56cb..0133c57e01 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -4142,6 +4142,10 @@ _hidden void libxl__add_nics(libxl__egc *egc, libxl__ao *ao, uint32_t domid,
 /* First layer; wraps libxl__spawn_spawn. */
 
 typedef struct libxl__dm_spawn_state libxl__dm_spawn_state;
+typedef struct libxl__qemu_available_opts libxl__qemu_available_opts;
+struct libxl__qemu_available_opts {
+    bool have_runwith_chroot;
+};
 
 typedef void libxl__dm_spawn_cb(libxl__egc *egc, libxl__dm_spawn_state*,
                                 int rc /* if !0, error was logged */);
@@ -4154,6 +4158,7 @@ struct libxl__dm_spawn_state {
     libxl__ev_qmp qmp;
     libxl__ev_time timeout;
     libxl__dm_resume_state dmrs;
+    libxl__qemu_available_opts qemu_opts;
     const char *dm;
     /* filled in by user, must remain valid: */
     uint32_t guest_domid; /* domain being served */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Aug 30 17:22:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 30 Aug 2024 17:22:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.786556.1196140 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sk5KU-0004RC-U3; Fri, 30 Aug 2024 17:22:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 786556.1196140; Fri, 30 Aug 2024 17:22:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sk5KU-0004R4-RF; Fri, 30 Aug 2024 17:22:34 +0000
Received: by outflank-mailman (input) for mailman id 786556;
 Fri, 30 Aug 2024 17:22:33 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sk5KT-0004Qv-S6
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 17:22:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sk5KT-0002cG-QW
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 17:22:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sk5KT-0005ZF-Pa
 for xen-changelog@lists.xenproject.org; Fri, 30 Aug 2024 17:22: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=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=y1Hqu8V04+2qtqCqqMAq98oqSUWDF7f8GRHXW4mjUfE=; b=wLo3DuCOMH4co4Da92lK8JbtDn
	fXN3sCSWvA87QfxVzsTeXB2kUsTS/JOgw2mFeNufLDFqAazfSfYfEWMbL9vNtcmtK1Jrn/WcqwjBF
	qAUfQn3iVijNl7ogflGpGNs+3pVq2xrBo2hHKwY2vrF6sbNiEKrDAxFEuB2hyLMB/C1I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] libxl: Probe QEMU for -run-with user=user and use it
Message-Id: <E1sk5KT-0005ZF-Pa@xenbits.xenproject.org>
Date: Fri, 30 Aug 2024 17:22:33 +0000

commit 1436593d5f8f7f700478e307d5198535ba69f88d
Author:     Anthony PERARD <anthony.perard@vates.tech>
AuthorDate: Fri Aug 30 09:49:40 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Aug 30 18:14:11 2024 +0100

    libxl: Probe QEMU for -run-with user=user and use it
    
    "-runas" is deprecated since QEMU 9.1 and will be remove in a future
    release.
    
    Signed-off-by: Anthony PERARD <anthony.perard@vates.tech>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 tools/libs/light/libxl_dm.c       | 12 ++++++++++--
 tools/libs/light/libxl_internal.h |  1 +
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/tools/libs/light/libxl_dm.c b/tools/libs/light/libxl_dm.c
index 15b157060f..1f2f5bd97a 100644
--- a/tools/libs/light/libxl_dm.c
+++ b/tools/libs/light/libxl_dm.c
@@ -2052,8 +2052,13 @@ static int libxl__build_device_model_args_new(libxl__gc *gc,
         }
 
         if (state->dm_runas) {
-            flexarray_append(dm_args, "-runas");
-            flexarray_append(dm_args, state->dm_runas);
+            if (qemu_opts->have_runwith_user) {
+                flexarray_append_pair(dm_args, "-run-with",
+                                      GCSPRINTF("user=%s", state->dm_runas));
+            } else {
+                flexarray_append(dm_args, "-runas");
+                flexarray_append(dm_args, state->dm_runas);
+            }
         }
     }
     flexarray_append(dm_args, NULL);
@@ -3073,6 +3078,9 @@ static void device_model_probe_cmdline(libxl__egc *egc,
                 if (!strcmp("chroot", libxl__json_object_get_string(o))) {
                     dmss->qemu_opts.have_runwith_chroot = true;
                 }
+                else if (!strcmp("user", libxl__json_object_get_string(o))) {
+                    dmss->qemu_opts.have_runwith_user = true;
+                }
             }
 
             /*
diff --git a/tools/libs/light/libxl_internal.h b/tools/libs/light/libxl_internal.h
index 0133c57e01..089a2f949c 100644
--- a/tools/libs/light/libxl_internal.h
+++ b/tools/libs/light/libxl_internal.h
@@ -4145,6 +4145,7 @@ typedef struct libxl__dm_spawn_state libxl__dm_spawn_state;
 typedef struct libxl__qemu_available_opts libxl__qemu_available_opts;
 struct libxl__qemu_available_opts {
     bool have_runwith_chroot;
+    bool have_runwith_user;
 };
 
 typedef void libxl__dm_spawn_cb(libxl__egc *egc, libxl__dm_spawn_state*,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


