From xen-changelog-bounces@lists.xenproject.org Tue Oct 01 03:11:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 01 Oct 2024 03:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807678.1219261 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svTI9-0004jV-2U; Tue, 01 Oct 2024 03:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807678.1219261; Tue, 01 Oct 2024 03: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 1svTI8-0004jN-W5; Tue, 01 Oct 2024 03:11:12 +0000
Received: by outflank-mailman (input) for mailman id 807678;
 Tue, 01 Oct 2024 03: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 1svTI8-0004jH-2x
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03: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 1svTI8-0007Vc-27
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svTI8-0007sW-03
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03: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=I+Y/RAQJdhzdkCLhuCka77F1wF1V4cJb9IXXsubf3ks=; b=mK69NiHN0vyFtRFep/wKDHbO7t
	BfppOa452I+71lDOSamAUz8Z2Z9cSuiSz28IeO8kBTiW9th1NGu4lQMftJcIQE//5CBVNLvySlH3p
	IxRnZWn786Ox80C0T7nKzfgphRRA97rfE/k8nY4o60gC8IgCwXWZpyBY5wcF0YjxcAcY=;
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 PSR support
Message-Id: <E1svTI8-0007sW-03@xenbits.xenproject.org>
Date: Tue, 01 Oct 2024 03:11:12 +0000

commit dee9e4b1cc35568853606ad1cf0fedd45ae6c7d4
Author:     Sergiy Kibrik <Sergiy_Kibrik@epam.com>
AuthorDate: Mon Sep 30 10:06:13 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 30 10:06:13 2024 +0200

    x86/intel: optional build of PSR support
    
    Xen's implementation of PSR only supports Intel CPUs right now, hence it can be
    made dependant on CONFIG_INTEL build option.
    Since platform implementation is not limited to single vendor, intermediate
    option CONFIG_X86_PSR introduced, which selected by CONFIG_INTEL.
    
    When !X86_PSR then PSR-related sysctls XEN_SYSCTL_psr_cmt_op &
    XEN_SYSCTL_psr_alloc are off as well.
    
    Signed-off-by: Sergiy Kibrik <Sergiy_Kibrik@epam.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/Kconfig           | 10 ++++++++++
 xen/arch/x86/Makefile          |  2 +-
 xen/arch/x86/domctl.c          |  3 +++
 xen/arch/x86/include/asm/psr.h | 10 ++++++++--
 xen/arch/x86/sysctl.c          |  4 +++-
 5 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig
index ab862b083f..9cdd04721a 100644
--- a/xen/arch/x86/Kconfig
+++ b/xen/arch/x86/Kconfig
@@ -231,6 +231,16 @@ config TBOOT
 
 	  If unsure, stay with the default.
 
+config X86_PSR
+	bool "Platform Shared Resource support" if EXPERT
+	default INTEL
+	help
+	  Support of Platform Shared Resource technology, which is basis for
+	  monitoring and control of resources like cache and memory bandwidth.
+	  See xl-psr documentation for details.
+
+	  If unsure, stay with the default.
+
 choice
 	prompt "Alignment of Xen image"
 	default XEN_ALIGN_2M if PV_SHIM_EXCLUSIVE
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 00ab091634..1fa12ed4aa 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -57,7 +57,7 @@ obj-y += pci.o
 obj-y += percpu.o
 obj-y += physdev.o
 obj-$(CONFIG_COMPAT) += x86_64/physdev.o
-obj-y += psr.o
+obj-$(CONFIG_X86_PSR) += psr.o
 obj-y += setup.o
 obj-y += shutdown.o
 obj-y += smp.o
diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 68b5b46d1a..6c1355e378 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1195,6 +1195,7 @@ long arch_do_domctl(
     case XEN_DOMCTL_psr_alloc:
         switch ( domctl->u.psr_alloc.cmd )
         {
+#ifdef CONFIG_X86_PSR
         case XEN_DOMCTL_PSR_SET_L3_CBM:
             ret = psr_set_val(d, domctl->u.psr_alloc.target,
                               domctl->u.psr_alloc.data,
@@ -1257,6 +1258,8 @@ long arch_do_domctl(
 
 #undef domctl_psr_get_val
 
+#endif /* CONFIG_X86_PSR */
+
         default:
             ret = -EOPNOTSUPP;
             break;
diff --git a/xen/arch/x86/include/asm/psr.h b/xen/arch/x86/include/asm/psr.h
index 51df78794c..d21a59d98f 100644
--- a/xen/arch/x86/include/asm/psr.h
+++ b/xen/arch/x86/include/asm/psr.h
@@ -69,12 +69,11 @@ extern struct psr_cmt *psr_cmt;
 
 static inline bool psr_cmt_enabled(void)
 {
-    return !!psr_cmt;
+    return IS_ENABLED(CONFIG_X86_PSR) && psr_cmt;
 }
 
 int psr_alloc_rmid(struct domain *d);
 void psr_free_rmid(struct domain *d);
-void psr_ctxt_switch_to(struct domain *d);
 
 int psr_get_info(unsigned int socket, enum psr_type type,
                  uint32_t data[], unsigned int array_len);
@@ -83,8 +82,15 @@ int psr_get_val(struct domain *d, unsigned int socket,
 int psr_set_val(struct domain *d, unsigned int socket,
                 uint64_t new_val, enum psr_type type);
 
+#ifdef CONFIG_X86_PSR
+void psr_ctxt_switch_to(struct domain *d);
 void psr_domain_init(struct domain *d);
 void psr_domain_free(struct domain *d);
+#else
+static inline void psr_ctxt_switch_to(struct domain *d) {}
+static inline void psr_domain_init(struct domain *d) {}
+static inline void psr_domain_free(struct domain *d) {}
+#endif
 
 #endif /* __ASM_PSR_H__ */
 
diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c
index 1d40d82c5a..1b04947516 100644
--- a/xen/arch/x86/sysctl.c
+++ b/xen/arch/x86/sysctl.c
@@ -225,10 +225,11 @@ long arch_do_sysctl(
 
     case XEN_SYSCTL_psr_alloc:
     {
-        uint32_t data[PSR_INFO_ARRAY_SIZE] = { };
+        uint32_t __maybe_unused data[PSR_INFO_ARRAY_SIZE] = { };
 
         switch ( sysctl->u.psr_alloc.cmd )
         {
+#ifdef CONFIG_X86_PSR
         case XEN_SYSCTL_PSR_get_l3_info:
             ret = psr_get_info(sysctl->u.psr_alloc.target,
                                PSR_TYPE_L3_CBM, data, ARRAY_SIZE(data));
@@ -279,6 +280,7 @@ long arch_do_sysctl(
             if ( __copy_field_to_guest(u_sysctl, sysctl, u.psr_alloc) )
                 ret = -EFAULT;
             break;
+#endif /* CONFIG_X86_PSR */
 
         default:
             ret = -EOPNOTSUPP;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Oct 01 03:11:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 01 Oct 2024 03:11:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807677.1219257 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svTI0-0004iB-13; Tue, 01 Oct 2024 03:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807677.1219257; Tue, 01 Oct 2024 03: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 1svTHz-0004i3-Uh; Tue, 01 Oct 2024 03:11:03 +0000
Received: by outflank-mailman (input) for mailman id 807677;
 Tue, 01 Oct 2024 03: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 1svTHy-0004hx-AS
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03: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 1svTHx-0007VQ-Tw
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svTHx-0007rT-S8
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03: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=ZUnd85yKKT3pZhcJXGVCKwwOiUDhiELQgt6bVneZoco=; b=E9sKQLGBQUkQyUQ30r5CeShK9N
	3lbEo4DlFYrEZUwERXbmRdXRU8XOsdFDTjcSmaou4o/C15FmSrfM13ud83cdVxHNjLSrt1Lou2ooy
	uPzx7b1qysN9A7ZhcuZuDdaOtyRX+vAEUzL6Et1NAc6FXTlOJHsnBVQ+DuSiAN5XpQ30=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: introduce x86_seg_sys
Message-Id: <E1svTHx-0007rT-S8@xenbits.xenproject.org>
Date: Tue, 01 Oct 2024 03:11:01 +0000

commit 34d4227e6a018aa19cc2996564ea6bd34f18ae9a
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Sep 30 10:05:25 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 30 10:05:25 2024 +0200

    x86: introduce x86_seg_sys
    
    To represent the USER-MSR bitmap access, a new segment type needs
    introducing, behaving like x86_seg_none in terms of address treatment,
    but behaving like a system segment for page walk purposes (implicit
    supervisor-mode access).
    
    While there also add x86_seg_none handling to the test harness'es
    read() hook, as will be needed for MSR-LIST support.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/x86_emulator/test_x86_emulator.c | 2 ++
 xen/arch/x86/hvm/emulate.c                   | 2 +-
 xen/arch/x86/hvm/hvm.c                       | 2 +-
 xen/arch/x86/hvm/svm/svm.c                   | 1 +
 xen/arch/x86/x86_emulate/x86_emulate.h       | 3 ++-
 5 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/tools/tests/x86_emulator/test_x86_emulator.c b/tools/tests/x86_emulator/test_x86_emulator.c
index 24343c5d7f..d52c1c53cb 100644
--- a/tools/tests/x86_emulator/test_x86_emulator.c
+++ b/tools/tests/x86_emulator/test_x86_emulator.c
@@ -593,6 +593,8 @@ static int read(
     default:
         if ( !is_x86_user_segment(seg) )
             return X86EMUL_UNHANDLEABLE;
+    case x86_seg_sys:
+    case x86_seg_none:
         bytes_read += bytes;
         break;
     }
diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index ecf83795fa..aa97ca1cbf 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -840,7 +840,7 @@ static int hvmemul_virtual_to_linear(
     int okay;
     unsigned long reps = 1;
 
-    if ( seg == x86_seg_none )
+    if ( seg == x86_seg_none || seg == x86_seg_sys )
     {
         *linear = offset;
         return X86EMUL_OKAY;
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index a64eead368..b2e782d596 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -2599,7 +2599,7 @@ bool hvm_vcpu_virtual_to_linear(
      * It is expected that the access rights of reg are suitable for seg (and
      * that this is enforced at the point that seg is loaded).
      */
-    ASSERT(seg < x86_seg_none);
+    ASSERT(seg < x86_seg_sys);
 
     /* However, check that insn fetches only ever specify CS. */
     ASSERT(access_type != hvm_access_insn_fetch || seg == x86_seg_cs);
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index 92bb10c504..e0793b26db 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -749,6 +749,7 @@ static void cf_check svm_set_segment_register(
         vmcb->ldtr = *reg;
         break;
 
+    case x86_seg_sys:
     case x86_seg_none:
         ASSERT_UNREACHABLE();
         break;
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.h b/xen/arch/x86/x86_emulate/x86_emulate.h
index e8a0e57228..3e819d4174 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.h
+++ b/xen/arch/x86/x86_emulate/x86_emulate.h
@@ -43,7 +43,8 @@ enum x86_segment {
     x86_seg_ldtr,
     x86_seg_gdtr,
     x86_seg_idtr,
-    /* No Segment: For accesses which are already linear. */
+    /* No Segment: For (system/normal) accesses which are already linear. */
+    x86_seg_sys,
     x86_seg_none
 };
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Oct 01 03:11:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 01 Oct 2024 03:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807679.1219264 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svTIK-0004lw-3g; Tue, 01 Oct 2024 03:11:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807679.1219264; Tue, 01 Oct 2024 03: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 1svTIK-0004lp-1I; Tue, 01 Oct 2024 03:11:24 +0000
Received: by outflank-mailman (input) for mailman id 807679;
 Tue, 01 Oct 2024 03: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 1svTII-0004lb-6m
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03: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 1svTII-0007WH-62
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svTII-0007ta-4M
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03: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=X+seQZV2hnPUVjsmF6pjycW6ALQ66vJccGCsmIz1Pn4=; b=kV5nB05emzG7vonnFRu0Cnlgv0
	glkEOb7xLhPQJjbdNkwQKsb75TKELKVv2WVfOlZYPabLZOYC4Fn04UveiVaNdUyLH8CWBpmQ0rARl
	7YkFOd6xewOaFpLbr7zRyX0S/y7f8VdOQB0Ss7Nm+2szSiDgplTbYT/uEQkkV0v/mDBk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: allow write_atomic() to work with non-scalar types
Message-Id: <E1svTII-0007ta-4M@xenbits.xenproject.org>
Date: Tue, 01 Oct 2024 03:11:22 +0000

commit f9e69c266ee0b5d386126d3625b79326c8cab3b3
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Sep 30 10:06:44 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 30 10:06:44 2024 +0200

    xen/riscv: allow write_atomic() to work with non-scalar types
    
    Update the defintion of write_atomic() to support non-scalar types,
    bringing it closer to the behavior of read_atomic().
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/atomic.h | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/xen/arch/riscv/include/asm/atomic.h b/xen/arch/riscv/include/asm/atomic.h
index 95910ebfeb..9669a3286d 100644
--- a/xen/arch/riscv/include/asm/atomic.h
+++ b/xen/arch/riscv/include/asm/atomic.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
+ /* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Taken and modified from Linux.
  *
@@ -69,10 +69,11 @@ static always_inline void _write_atomic(volatile void *p,
     }
 }
 
-#define write_atomic(p, x)                              \
-({                                                      \
-    typeof(*(p)) x_ = (x);                              \
-    _write_atomic(p, x_, sizeof(*(p)));                 \
+#define write_atomic(p, x)                                          \
+({                                                                  \
+    union { typeof(*(p)) v; unsigned long ul; } x_ = { .ul = 0UL }; \
+    x_.v = (x);                                                     \
+    _write_atomic(p, x_.ul, sizeof(*(p)));                          \
 })
 
 static always_inline void _add_sized(volatile void *p,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Oct 01 03:11:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 01 Oct 2024 03:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807680.1219269 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svTIU-0004oo-5Y; Tue, 01 Oct 2024 03:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807680.1219269; Tue, 01 Oct 2024 03: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 1svTIU-0004oe-2i; Tue, 01 Oct 2024 03:11:34 +0000
Received: by outflank-mailman (input) for mailman id 807680;
 Tue, 01 Oct 2024 03: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 1svTIS-0004oP-AU
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03: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 1svTIS-0007WR-9b
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svTIS-0007uN-8L
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03: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=fkYW7dn2n3E3XYqtNxVimn7I/Q+Kh7gaHG7SJ/BaRwk=; b=2uiD/GMdEWY6ctCfD2/5C7SYJ1
	4CBXVZdjrKsSrFuK6rLHHfWvcEDcpGDasgse77jHBjtGp1dyiEWKo8miJsZThLmWDD6hk/aBM0q17
	nvp4nT8DkLb24ZcFowVPsH4sUPFEanKqYxtliAevf8TuosSrzBjIu5L0YZobo1tfWsVE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: set up fixmap mappings
Message-Id: <E1svTIS-0007uN-8L@xenbits.xenproject.org>
Date: Tue, 01 Oct 2024 03:11:32 +0000

commit 13684f539e2dce9255670cf5f233189be989aa40
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Sep 30 10:08:51 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 30 10:08:51 2024 +0200

    xen/riscv: set up fixmap mappings
    
    Set up fixmap mappings and the L0 page table for fixmap support.
    
    Modify the PTEs (xen_fixmap[]) directly in arch_pmap_map() instead
    of using set_fixmap() which is expected to be implemented using
    map_pages_to_xen(), which, in turn, is expected to use
    arch_pmap_map() during early boot, resulting in a loop.
    
    Define new macros in riscv/config.h for calculating
    the FIXMAP_BASE address, including BOOT_FDT_VIRT_{START, SIZE},
    XEN_VIRT_SIZE, and XEN_VIRT_END.
    
    Update the check for Xen size in riscv/xen.lds.S to use
    XEN_VIRT_SIZE instead of a hardcoded constant.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/config.h | 16 +++++++++++--
 xen/arch/riscv/include/asm/fixmap.h | 46 +++++++++++++++++++++++++++++++++++++
 xen/arch/riscv/include/asm/mm.h     |  2 ++
 xen/arch/riscv/include/asm/page.h   | 13 +++++++++++
 xen/arch/riscv/mm.c                 | 43 ++++++++++++++++++++++++++++++++++
 xen/arch/riscv/setup.c              |  2 ++
 xen/arch/riscv/xen.lds.S            |  2 +-
 7 files changed, 121 insertions(+), 3 deletions(-)

diff --git a/xen/arch/riscv/include/asm/config.h b/xen/arch/riscv/include/asm/config.h
index 50583aafdc..7dbb235685 100644
--- a/xen/arch/riscv/include/asm/config.h
+++ b/xen/arch/riscv/include/asm/config.h
@@ -41,8 +41,10 @@
  * Start addr          | End addr         | Slot       | area description
  * ============================================================================
  *                   .....                 L2 511          Unused
- *  0xffffffffc0600000  0xffffffffc0800000 L2 511          Fixmap
- *  0xffffffffc0200000  0xffffffffc0600000 L2 511          FDT
+ *  0xffffffffc0a00000  0xffffffffc0c00000 L2 511          Fixmap
+ *                   ..... ( 2 MB gap )
+ *  0xffffffffc0400000  0xffffffffc0800000 L2 511          FDT
+ *                   ..... ( 2 MB gap )
  *  0xffffffffc0000000  0xffffffffc0200000 L2 511          Xen
  *                   .....                 L2 510          Unused
  *  0x3200000000        0x7f40000000       L2 200-509      Direct map
@@ -74,6 +76,16 @@
 #error "unsupported RV_STAGE1_MODE"
 #endif
 
+#define GAP_SIZE                MB(2)
+
+#define XEN_VIRT_SIZE           MB(2)
+
+#define BOOT_FDT_VIRT_START     (XEN_VIRT_START + XEN_VIRT_SIZE + GAP_SIZE)
+#define BOOT_FDT_VIRT_SIZE      MB(4)
+
+#define FIXMAP_BASE \
+    (BOOT_FDT_VIRT_START + BOOT_FDT_VIRT_SIZE + GAP_SIZE)
+
 #define DIRECTMAP_SLOT_END      509
 #define DIRECTMAP_SLOT_START    200
 #define DIRECTMAP_VIRT_START    SLOTN(DIRECTMAP_SLOT_START)
diff --git a/xen/arch/riscv/include/asm/fixmap.h b/xen/arch/riscv/include/asm/fixmap.h
new file mode 100644
index 0000000000..63732df36c
--- /dev/null
+++ b/xen/arch/riscv/include/asm/fixmap.h
@@ -0,0 +1,46 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * fixmap.h: compile-time virtual memory allocation
+ */
+#ifndef ASM_FIXMAP_H
+#define ASM_FIXMAP_H
+
+#include <xen/bug.h>
+#include <xen/page-size.h>
+#include <xen/pmap.h>
+
+#include <asm/page.h>
+
+#define FIXMAP_ADDR(n) (FIXMAP_BASE + (n) * PAGE_SIZE)
+
+/* Fixmap slots */
+#define FIX_PMAP_BEGIN (0) /* Start of PMAP */
+#define FIX_PMAP_END (FIX_PMAP_BEGIN + NUM_FIX_PMAP - 1) /* End of PMAP */
+#define FIX_MISC (FIX_PMAP_END + 1)  /* Ephemeral mappings of hardware */
+
+#define FIX_LAST FIX_MISC
+
+#define FIXADDR_START FIXMAP_ADDR(0)
+#define FIXADDR_TOP FIXMAP_ADDR(FIX_LAST + 1)
+
+#ifndef __ASSEMBLY__
+
+/*
+ * Direct access to xen_fixmap[] should only happen when {set,
+ * clear}_fixmap() is unusable (e.g. where we would end up to
+ * recursively call the helpers).
+ */
+extern pte_t xen_fixmap[];
+
+#define fix_to_virt(slot) ((void *)FIXMAP_ADDR(slot))
+
+static inline unsigned int virt_to_fix(vaddr_t vaddr)
+{
+    BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
+
+    return ((vaddr - FIXADDR_START) >> PAGE_SHIFT);
+}
+
+#endif /* __ASSEMBLY__ */
+
+#endif /* ASM_FIXMAP_H */
diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/mm.h
index 25af9e1aaa..a0bdc2bc3a 100644
--- a/xen/arch/riscv/include/asm/mm.h
+++ b/xen/arch/riscv/include/asm/mm.h
@@ -255,4 +255,6 @@ static inline unsigned int arch_get_dma_bitsize(void)
     return 32; /* TODO */
 }
 
+void setup_fixmap_mappings(void);
+
 #endif /* _ASM_RISCV_MM_H */
diff --git a/xen/arch/riscv/include/asm/page.h b/xen/arch/riscv/include/asm/page.h
index c831e16417..d4a5009823 100644
--- a/xen/arch/riscv/include/asm/page.h
+++ b/xen/arch/riscv/include/asm/page.h
@@ -9,6 +9,7 @@
 #include <xen/bug.h>
 #include <xen/types.h>
 
+#include <asm/atomic.h>
 #include <asm/mm.h>
 #include <asm/page-bits.h>
 
@@ -81,6 +82,18 @@ static inline void flush_page_to_ram(unsigned long mfn, bool sync_icache)
     BUG_ON("unimplemented");
 }
 
+/* Write a pagetable entry. */
+static inline void write_pte(pte_t *p, pte_t pte)
+{
+    write_atomic(p, pte);
+}
+
+/* Read a pagetable entry. */
+static inline pte_t read_pte(const pte_t *p)
+{
+    return read_atomic(p);
+}
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* _ASM_RISCV_PAGE_H */
diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c
index 7d09e781bf..b8ff91cf4e 100644
--- a/xen/arch/riscv/mm.c
+++ b/xen/arch/riscv/mm.c
@@ -12,6 +12,7 @@
 #include <asm/early_printk.h>
 #include <asm/csr.h>
 #include <asm/current.h>
+#include <asm/fixmap.h>
 #include <asm/page.h>
 #include <asm/processor.h>
 
@@ -49,6 +50,9 @@ stage1_pgtbl_root[PAGETABLE_ENTRIES];
 pte_t __section(".bss.page_aligned") __aligned(PAGE_SIZE)
 stage1_pgtbl_nonroot[PGTBL_INITIAL_COUNT * PAGETABLE_ENTRIES];
 
+pte_t __section(".bss.page_aligned") __aligned(PAGE_SIZE)
+xen_fixmap[PAGETABLE_ENTRIES];
+
 #define HANDLE_PGTBL(curr_lvl_num)                                          \
     index = pt_index(curr_lvl_num, page_addr);                              \
     if ( pte_is_valid(pgtbl[index]) )                                       \
@@ -191,6 +195,45 @@ static bool __init check_pgtbl_mode_support(struct mmu_desc *mmu_desc,
     return is_mode_supported;
 }
 
+void __init setup_fixmap_mappings(void)
+{
+    pte_t *pte, tmp;
+    unsigned int i;
+
+    BUILD_BUG_ON(FIX_LAST >= PAGETABLE_ENTRIES);
+
+    pte = &stage1_pgtbl_root[pt_index(HYP_PT_ROOT_LEVEL, FIXMAP_ADDR(0))];
+
+    /*
+     * In RISC-V page table levels are numbered from Lx to L0 where
+     * x is the highest page table level for currect  MMU mode ( for example,
+     * for Sv39 has 3 page tables so the x = 2 (L2 -> L1 -> L0) ).
+     *
+     * In this cycle we want to find L1 page table because as L0 page table
+     * xen_fixmap[] will be used.
+     */
+    for ( i = HYP_PT_ROOT_LEVEL; i-- > 1; )
+    {
+        BUG_ON(!pte_is_valid(*pte));
+
+        pte = (pte_t *)LOAD_TO_LINK(pte_to_paddr(*pte));
+        pte = &pte[pt_index(i, FIXMAP_ADDR(0))];
+    }
+
+    BUG_ON(pte_is_valid(*pte));
+
+    tmp = paddr_to_pte(LINK_TO_LOAD((unsigned long)&xen_fixmap), PTE_TABLE);
+    write_pte(pte, tmp);
+
+    RISCV_FENCE(rw, rw);
+    sfence_vma();
+
+    /*
+     * We only need the zeroeth table allocated, but not the PTEs set, because
+     * set_fixmap() will set them on the fly.
+     */
+}
+
 /*
  * setup_initial_pagetables:
  *
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index bf9078f36a..ace5ab91e3 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -27,6 +27,8 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
 
     trap_init();
 
+    setup_fixmap_mappings();
+
     printk("All set up\n");
 
     machine_halt();
diff --git a/xen/arch/riscv/xen.lds.S b/xen/arch/riscv/xen.lds.S
index 871b47a235..558a5a992a 100644
--- a/xen/arch/riscv/xen.lds.S
+++ b/xen/arch/riscv/xen.lds.S
@@ -174,6 +174,6 @@ ASSERT(!SIZEOF(.got.plt),  ".got.plt non-empty")
  * Changing the size of Xen binary can require an update of
  * PGTBL_INITIAL_COUNT.
  */
-ASSERT(_end - _start <= MB(2), "Xen too large for early-boot assumptions")
+ASSERT(_end - _start <= XEN_VIRT_SIZE, "Xen too large for early-boot assumptions")
 
 ASSERT(_ident_end - _ident_start <= IDENT_AREA_SIZE, "identity region is too big");
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Oct 01 03:11:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 01 Oct 2024 03:11:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807681.1219273 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svTIe-0004rh-7n; Tue, 01 Oct 2024 03:11:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807681.1219273; Tue, 01 Oct 2024 03:11: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 1svTIe-0004ra-4V; Tue, 01 Oct 2024 03:11:44 +0000
Received: by outflank-mailman (input) for mailman id 807681;
 Tue, 01 Oct 2024 03: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 1svTIc-0004rJ-EP
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03: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 1svTIc-0007Wf-Co
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svTIc-0007v7-Bp
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03: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=6LGEIIya4wYhOwwPgRZoFKUaUBp1yswN6iApiT+ByaA=; b=pUos1LexZ0Dxt/asT5fQigAUX1
	zs7nhDwK3FkzMUymJpw3Whhz1rfx02h2/1KWEAlldmTVwdRu0daQoFGLk1RPfvN/BuyqXSiibu4O2
	pdHHHl+qxZ20bwBMQUVc5YQWKobLtC5QpDIRUFwDdrz/mklvkyh3/A9qVvjyKoR3xm9Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: introduce asm/pmap.h header
Message-Id: <E1svTIc-0007v7-Bp@xenbits.xenproject.org>
Date: Tue, 01 Oct 2024 03:11:42 +0000

commit f89e1a170299637138d3a0f90598e47884ef3c66
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Sep 30 10:09:37 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 30 10:09:37 2024 +0200

    xen/riscv: introduce asm/pmap.h header
    
    Introduce arch_pmap_{un}map functions and select HAS_PMAP for CONFIG_RISCV.
    
    Add pte_from_mfn() for use in arch_pmap_map().
    
    Introduce flush_xen_tlb_one_local() and use it in arch_pmap_{un}map().
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/Kconfig                |  1 +
 xen/arch/riscv/include/asm/flushtlb.h |  6 ++++++
 xen/arch/riscv/include/asm/page.h     |  6 ++++++
 xen/arch/riscv/include/asm/pmap.h     | 36 +++++++++++++++++++++++++++++++++++
 4 files changed, 49 insertions(+)

diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig
index 7a113c7774..1858004676 100644
--- a/xen/arch/riscv/Kconfig
+++ b/xen/arch/riscv/Kconfig
@@ -3,6 +3,7 @@ config RISCV
 	select FUNCTION_ALIGNMENT_16B
 	select GENERIC_BUG_FRAME
 	select HAS_DEVICE_TREE
+	select HAS_PMAP
 	select HAS_VMAP
 
 config RISCV_64
diff --git a/xen/arch/riscv/include/asm/flushtlb.h b/xen/arch/riscv/include/asm/flushtlb.h
index 7ce32bea0b..f4a735fd6c 100644
--- a/xen/arch/riscv/include/asm/flushtlb.h
+++ b/xen/arch/riscv/include/asm/flushtlb.h
@@ -5,6 +5,12 @@
 #include <xen/bug.h>
 #include <xen/cpumask.h>
 
+/* Flush TLB of local processor for address va. */
+static inline void flush_tlb_one_local(vaddr_t va)
+{
+    asm volatile ( "sfence.vma %0" :: "r" (va) : "memory" );
+}
+
 /*
  * Filter the given set of CPUs, removing those that definitely flushed their
  * TLB since @page_timestamp.
diff --git a/xen/arch/riscv/include/asm/page.h b/xen/arch/riscv/include/asm/page.h
index d4a5009823..eb79cb9409 100644
--- a/xen/arch/riscv/include/asm/page.h
+++ b/xen/arch/riscv/include/asm/page.h
@@ -94,6 +94,12 @@ static inline pte_t read_pte(const pte_t *p)
     return read_atomic(p);
 }
 
+static inline pte_t pte_from_mfn(mfn_t mfn, unsigned int flags)
+{
+    unsigned long pte = (mfn_x(mfn) << PTE_PPN_SHIFT) | flags;
+    return (pte_t){ .pte = pte };
+}
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* _ASM_RISCV_PAGE_H */
diff --git a/xen/arch/riscv/include/asm/pmap.h b/xen/arch/riscv/include/asm/pmap.h
new file mode 100644
index 0000000000..60065c996f
--- /dev/null
+++ b/xen/arch/riscv/include/asm/pmap.h
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef ASM_PMAP_H
+#define ASM_PMAP_H
+
+#include <xen/bug.h>
+#include <xen/init.h>
+#include <xen/mm.h>
+#include <xen/page-size.h>
+
+#include <asm/fixmap.h>
+#include <asm/flushtlb.h>
+#include <asm/system.h>
+
+static inline void __init arch_pmap_map(unsigned int slot, mfn_t mfn)
+{
+    pte_t *entry = &xen_fixmap[slot];
+    pte_t pte;
+
+    ASSERT(!pte_is_valid(*entry));
+
+    pte = pte_from_mfn(mfn, PAGE_HYPERVISOR_RW);
+    write_pte(entry, pte);
+
+    flush_tlb_one_local(FIXMAP_ADDR(slot));
+}
+
+static inline void __init arch_pmap_unmap(unsigned int slot)
+{
+    pte_t pte = {};
+
+    write_pte(&xen_fixmap[slot], pte);
+
+    flush_tlb_one_local(FIXMAP_ADDR(slot));
+}
+
+#endif /* ASM_PMAP_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Oct 01 03:11:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 01 Oct 2024 03:11:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807682.1219277 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svTIo-0004v2-AW; Tue, 01 Oct 2024 03:11:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807682.1219277; Tue, 01 Oct 2024 03:11:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svTIo-0004us-7p; Tue, 01 Oct 2024 03:11:54 +0000
Received: by outflank-mailman (input) for mailman id 807682;
 Tue, 01 Oct 2024 03:11: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 1svTIm-0004ua-GS
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03:11: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 1svTIm-0007Ws-Fl
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svTIm-0007vr-F2
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03:11:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TRwBcFsfEl05M/3gUdzNTeaTaDb04T2R9++IXT23fYQ=; b=XZXDWPd8I2Q3/tJBLtAcUYoCbF
	NR/JTQdH5ji4mjhyX/7Ri0EgaXT6kFpx1C3X6ftCEjrmlEKfHQQ/IHB55epBfbnDlu5SQe0F1Mdzz
	BCgBHyxgzhd3At/Op+aYwRAly+hfhOZE6n6QhqmbBMqOhdGu7f8gOmliw4BZcf0Wj5lA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: introduce functionality to work with CPU info
Message-Id: <E1svTIm-0007vr-F2@xenbits.xenproject.org>
Date: Tue, 01 Oct 2024 03:11:52 +0000

commit b6c8f34a902955ed69670b48bc1d799fc83caba8
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Sep 30 10:11:18 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 30 10:11:18 2024 +0200

    xen/riscv: introduce functionality to work with CPU info
    
    Introduce struct pcpu_info to store pCPU-related information.
    Initially, it includes only processor_id and hart id, but it
    will be extended to include guest CPU information and
    temporary variables for saving/restoring vCPU registers.
    
    Add set_processor_id() function to set processor_id stored in
    pcpu_info.
    
    Define smp_processor_id() to provide accurate information,
    replacing the previous "dummy" value of 0.
    
    Initialize tp registers to point to pcpu_info[0].
    Set processor_id to 0 for logical CPU 0 and store the physical
    CPU ID in pcpu_info[0].
    
    Introduce helpers for getting/setting hart_id ( physical CPU id
    in RISC-V terms ) from Xen CPU id.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/Makefile                |  1 +
 xen/arch/riscv/include/asm/current.h   | 27 ++++++++++++++++++++++++++-
 xen/arch/riscv/include/asm/processor.h |  3 ---
 xen/arch/riscv/include/asm/smp.h       | 18 ++++++++++++++++++
 xen/arch/riscv/riscv64/asm-offsets.c   |  3 +++
 xen/arch/riscv/riscv64/head.S          | 14 ++++++++++++++
 xen/arch/riscv/setup.c                 |  5 +++++
 xen/arch/riscv/smp.c                   | 15 +++++++++++++++
 8 files changed, 82 insertions(+), 4 deletions(-)

diff --git a/xen/arch/riscv/Makefile b/xen/arch/riscv/Makefile
index d192be7b55..6832549133 100644
--- a/xen/arch/riscv/Makefile
+++ b/xen/arch/riscv/Makefile
@@ -5,6 +5,7 @@ obj-$(CONFIG_RISCV_64) += riscv64/
 obj-y += sbi.o
 obj-y += setup.o
 obj-y += shutdown.o
+obj-y += smp.o
 obj-y += stubs.o
 obj-y += traps.o
 obj-y += vm_event.o
diff --git a/xen/arch/riscv/include/asm/current.h b/xen/arch/riscv/include/asm/current.h
index aedb6dc732..6f1ec4e190 100644
--- a/xen/arch/riscv/include/asm/current.h
+++ b/xen/arch/riscv/include/asm/current.h
@@ -3,12 +3,37 @@
 #ifndef __ASM_CURRENT_H
 #define __ASM_CURRENT_H
 
-#include <xen/lib.h>
+#include <xen/bug.h>
+#include <xen/cache.h>
 #include <xen/percpu.h>
+
 #include <asm/processor.h>
 
 #ifndef __ASSEMBLY__
 
+register struct pcpu_info *tp asm ( "tp" );
+
+struct pcpu_info {
+    unsigned int processor_id; /* Xen CPU id */
+    unsigned long hart_id; /* physical CPU id */
+} __cacheline_aligned;
+
+/* tp points to one of these */
+extern struct pcpu_info pcpu_info[NR_CPUS];
+
+#define set_processor_id(id)    do { \
+    tp->processor_id = (id);         \
+} while (0)
+
+static inline unsigned int smp_processor_id(void)
+{
+    unsigned int id = tp->processor_id;
+
+    BUG_ON(id >= NR_CPUS);
+
+    return id;
+}
+
 /* Which VCPU is "current" on this PCPU. */
 DECLARE_PER_CPU(struct vcpu *, curr_vcpu);
 
diff --git a/xen/arch/riscv/include/asm/processor.h b/xen/arch/riscv/include/asm/processor.h
index 3ae164c265..e42b353b4c 100644
--- a/xen/arch/riscv/include/asm/processor.h
+++ b/xen/arch/riscv/include/asm/processor.h
@@ -12,9 +12,6 @@
 
 #ifndef __ASSEMBLY__
 
-/* TODO: need to be implemeted */
-#define smp_processor_id() 0
-
 /* On stack VCPU state */
 struct cpu_user_regs
 {
diff --git a/xen/arch/riscv/include/asm/smp.h b/xen/arch/riscv/include/asm/smp.h
index b1ea91b1eb..a824be8e78 100644
--- a/xen/arch/riscv/include/asm/smp.h
+++ b/xen/arch/riscv/include/asm/smp.h
@@ -5,6 +5,8 @@
 #include <xen/cpumask.h>
 #include <xen/percpu.h>
 
+#include <asm/current.h>
+
 DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_mask);
 DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
 
@@ -14,6 +16,22 @@ DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
  */
 #define park_offline_cpus false
 
+/*
+ * Mapping between Xen logical cpu index and hartid.
+ */
+static inline unsigned long cpuid_to_hartid(unsigned long cpuid)
+{
+    return pcpu_info[cpuid].hart_id;
+}
+
+static inline void set_cpuid_to_hartid(unsigned long cpuid,
+                                       unsigned long hartid)
+{
+    pcpu_info[cpuid].hart_id = hartid;
+}
+
+void setup_tp(unsigned int cpuid);
+
 #endif
 
 /*
diff --git a/xen/arch/riscv/riscv64/asm-offsets.c b/xen/arch/riscv/riscv64/asm-offsets.c
index 9f663b9510..3b5daf3b36 100644
--- a/xen/arch/riscv/riscv64/asm-offsets.c
+++ b/xen/arch/riscv/riscv64/asm-offsets.c
@@ -1,5 +1,6 @@
 #define COMPILE_OFFSETS
 
+#include <asm/current.h>
 #include <asm/processor.h>
 #include <xen/types.h>
 
@@ -50,4 +51,6 @@ void asm_offsets(void)
     OFFSET(CPU_USER_REGS_SSTATUS, struct cpu_user_regs, sstatus);
     OFFSET(CPU_USER_REGS_PREGS, struct cpu_user_regs, pregs);
     BLANK();
+    DEFINE(PCPU_INFO_SIZE, sizeof(struct pcpu_info));
+    BLANK();
 }
diff --git a/xen/arch/riscv/riscv64/head.S b/xen/arch/riscv/riscv64/head.S
index 3261e9fce8..2a1b3dad91 100644
--- a/xen/arch/riscv/riscv64/head.S
+++ b/xen/arch/riscv/riscv64/head.S
@@ -1,4 +1,5 @@
 #include <asm/asm.h>
+#include <asm/asm-offsets.h>
 #include <asm/riscv_encoding.h>
 
         .section .text.header, "ax", %progbits
@@ -55,6 +56,10 @@ FUNC(start)
          */
         jal     reset_stack
 
+        /* Xen's boot cpu id is equal to 0 so setup TP register for it */
+        li      a0, 0
+        jal     setup_tp
+
         /* restore hart_id ( bootcpu_id ) and dtb address */
         mv      a0, s0
         mv      a1, s1
@@ -72,6 +77,15 @@ FUNC(reset_stack)
         ret
 END(reset_stack)
 
+/* void setup_tp(unsigned int xen_cpuid); */
+FUNC(setup_tp)
+        la      t0, pcpu_info
+        li      t1, PCPU_INFO_SIZE
+        mul     t1, a0, t1
+        add     tp, t0, t1
+        ret
+END(setup_tp)
+
         .section .text.ident, "ax", %progbits
 
 FUNC(turn_on_mmu)
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index ace5ab91e3..b9850a9801 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -9,6 +9,7 @@
 #include <public/version.h>
 
 #include <asm/early_printk.h>
+#include <asm/smp.h>
 #include <asm/traps.h>
 
 void arch_get_xen_caps(xen_capabilities_info_t *info)
@@ -25,6 +26,10 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
 {
     remove_identity_mapping();
 
+    set_processor_id(0);
+
+    set_cpuid_to_hartid(0, bootcpu_id);
+
     trap_init();
 
     setup_fixmap_mappings();
diff --git a/xen/arch/riscv/smp.c b/xen/arch/riscv/smp.c
new file mode 100644
index 0000000000..4ca6a4e892
--- /dev/null
+++ b/xen/arch/riscv/smp.c
@@ -0,0 +1,15 @@
+#include <xen/smp.h>
+
+/*
+ * FIXME: make pcpu_info[] dynamically allocated when necessary
+ *        functionality will be ready
+ */
+/*
+ * tp points to one of these per cpu.
+ *
+ * hart_id would be valid (no matter which value) if its
+ * processor_id field is valid (less than NR_CPUS).
+ */
+struct pcpu_info pcpu_info[NR_CPUS] = { [0 ... NR_CPUS - 1] = {
+    .processor_id = NR_CPUS,
+}};
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Oct 01 03:12:03 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 01 Oct 2024 03:12:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807686.1219291 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svTIx-0005CZ-Jh; Tue, 01 Oct 2024 03:12:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807686.1219291; Tue, 01 Oct 2024 03:12:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svTIx-0005CR-Gw; Tue, 01 Oct 2024 03:12:03 +0000
Received: by outflank-mailman (input) for mailman id 807686;
 Tue, 01 Oct 2024 03:12: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 1svTIw-0005CD-JI
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03:12: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 1svTIw-0007XN-Ib
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03:12:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svTIw-0007x9-Ht
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03:12:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ro0xGOuihAk3Bsg3pYlWIoIE2Op/Yul/FEC/t0oipv8=; b=PXZmO4xK3STaYv78eqAm4ya/Ab
	caoMKBS24MtB8Dp33dV6+kXlSiNYxdLHLCEJOMFcP9t3CGCBakKdn0J5Y9V4mXPWaHH0uWtDW5GDM
	HBKkTq5D/73vJZFVDSvM+SfeJzsNFrNYLSc/Dm36ALmz6mBS2ax8QYkNquahqWHyHFA8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: introduce and initialize SBI RFENCE extension
Message-Id: <E1svTIw-0007x9-Ht@xenbits.xenproject.org>
Date: Tue, 01 Oct 2024 03:12:02 +0000

commit c353c4775712394fab2ba413f6676fd0855bd5c5
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Mon Sep 30 10:12:40 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 30 10:12:40 2024 +0200

    xen/riscv: introduce and initialize SBI RFENCE extension
    
    Introduce functions to work with the SBI RFENCE extension for issuing
    various fence operations to remote CPUs.
    
    Add the sbi_init() function along with auxiliary functions and macro
    definitions for proper initialization and checking the availability of
    SBI extensions. Currently, this is implemented only for RFENCE.
    
    Introduce sbi_remote_sfence_vma() to send SFENCE_VMA instructions to
    a set of target HARTs. This will support the implementation of
    flush_xen_tlb_range_va().
    
    Integrate __sbi_rfence_v02 from Linux kernel 6.6.0-rc4 with minimal
    modifications:
     - Adapt to Xen code style.
     - Use cpuid_to_hartid() instead of cpuid_to_hartid_map[].
     - Update BIT(...) to BIT(..., UL).
     - Rename __sbi_rfence_v02_call to sbi_rfence_v02_real and
       remove the unused arg5.
     - Handle NULL cpu_mask to execute rfence on all CPUs by calling
       sbi_rfence_v02_real(..., 0UL, -1UL,...) instead of creating hmask.
     - change type for start_addr and size to vaddr_t and size_t.
     - Add an explanatory comment about when batching can and cannot occur,
       and why batching happens in the first place.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/sbi.h |  62 +++++++++
 xen/arch/riscv/sbi.c             | 273 ++++++++++++++++++++++++++++++++++++++-
 xen/arch/riscv/setup.c           |   3 +
 3 files changed, 337 insertions(+), 1 deletion(-)

diff --git a/xen/arch/riscv/include/asm/sbi.h b/xen/arch/riscv/include/asm/sbi.h
index 4d72a2295e..5947fed779 100644
--- a/xen/arch/riscv/include/asm/sbi.h
+++ b/xen/arch/riscv/include/asm/sbi.h
@@ -12,9 +12,42 @@
 #ifndef __ASM_RISCV_SBI_H__
 #define __ASM_RISCV_SBI_H__
 
+#include <xen/cpumask.h>
+
 #define SBI_EXT_0_1_CONSOLE_PUTCHAR		0x1
 #define SBI_EXT_0_1_SHUTDOWN			0x8
 
+#define SBI_EXT_BASE                    0x10
+#define SBI_EXT_RFENCE                  0x52464E43
+
+/* SBI function IDs for BASE extension */
+#define SBI_EXT_BASE_GET_SPEC_VERSION   0x0
+#define SBI_EXT_BASE_GET_IMP_ID         0x1
+#define SBI_EXT_BASE_GET_IMP_VERSION    0x2
+#define SBI_EXT_BASE_PROBE_EXT          0x3
+
+/* SBI function IDs for RFENCE extension */
+#define SBI_EXT_RFENCE_REMOTE_FENCE_I           0x0
+#define SBI_EXT_RFENCE_REMOTE_SFENCE_VMA        0x1
+#define SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID   0x2
+#define SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA       0x3
+#define SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID  0x4
+#define SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA       0x5
+#define SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID  0x6
+
+#define SBI_SPEC_VERSION_MAJOR_MASK     0x7f000000
+#define SBI_SPEC_VERSION_MINOR_MASK     0x00ffffff
+
+/* SBI return error codes */
+#define SBI_SUCCESS             0
+#define SBI_ERR_FAILURE         (-1)
+#define SBI_ERR_NOT_SUPPORTED   (-2)
+#define SBI_ERR_INVALID_PARAM   (-3)
+#define SBI_ERR_DENIED          (-4)
+#define SBI_ERR_INVALID_ADDRESS (-5)
+
+#define SBI_SPEC_VERSION_DEFAULT 0x1
+
 struct sbiret {
     long error;
     long value;
@@ -34,4 +67,33 @@ void sbi_console_putchar(int ch);
 
 void sbi_shutdown(void);
 
+/*
+ * Check underlying SBI implementation has RFENCE
+ *
+ * @return true for supported AND false for not-supported
+ */
+bool sbi_has_rfence(void);
+
+/*
+ * Instructs the remote harts to execute one or more SFENCE.VMA
+ * instructions, covering the range of virtual addresses between
+ * [start_addr, start_addr + size).
+ *
+ * Returns 0 if IPI was sent to all the targeted harts successfully
+ * or negative value if start_addr or size is not valid.
+ *
+ * @hart_mask a cpu mask containing all the target harts.
+ * @param start virtual address start
+ * @param size virtual address range size
+ */
+int sbi_remote_sfence_vma(const cpumask_t *cpu_mask, vaddr_t start,
+                          size_t size);
+
+/*
+ * Initialize SBI library
+ *
+ * @return 0 on success, otherwise negative errno on failure
+ */
+int sbi_init(void);
+
 #endif /* __ASM_RISCV_SBI_H__ */
diff --git a/xen/arch/riscv/sbi.c b/xen/arch/riscv/sbi.c
index c7984344bc..4209520389 100644
--- a/xen/arch/riscv/sbi.c
+++ b/xen/arch/riscv/sbi.c
@@ -5,13 +5,26 @@
  * (anup.patel@wdc.com).
  *
  * Modified by Bobby Eshleman (bobby.eshleman@gmail.com).
+ * Modified by Oleksii Kurochko (oleksii.kurochko@gmail.com).
  *
  * Copyright (c) 2019 Western Digital Corporation or its affiliates.
- * Copyright (c) 2021-2023 Vates SAS.
+ * Copyright (c) 2021-2024 Vates SAS.
  */
 
+#include <xen/compiler.h>
+#include <xen/const.h>
+#include <xen/cpumask.h>
+#include <xen/errno.h>
+#include <xen/init.h>
+#include <xen/lib.h>
+#include <xen/sections.h>
+#include <xen/smp.h>
+
+#include <asm/processor.h>
 #include <asm/sbi.h>
 
+static unsigned long __ro_after_init sbi_spec_version = SBI_SPEC_VERSION_DEFAULT;
+
 struct sbiret sbi_ecall(unsigned long ext, unsigned long fid,
                         unsigned long arg0, unsigned long arg1,
                         unsigned long arg2, unsigned long arg3,
@@ -38,6 +51,26 @@ struct sbiret sbi_ecall(unsigned long ext, unsigned long fid,
     return ret;
 }
 
+static int sbi_err_map_xen_errno(int err)
+{
+    switch ( err )
+    {
+    case SBI_SUCCESS:
+        return 0;
+    case SBI_ERR_DENIED:
+        return -EACCES;
+    case SBI_ERR_INVALID_PARAM:
+        return -EINVAL;
+    case SBI_ERR_INVALID_ADDRESS:
+        return -EFAULT;
+    case SBI_ERR_NOT_SUPPORTED:
+        return -EOPNOTSUPP;
+    case SBI_ERR_FAILURE:
+    default:
+        return -ENOSYS;
+    };
+}
+
 void sbi_console_putchar(int ch)
 {
     sbi_ecall(SBI_EXT_0_1_CONSOLE_PUTCHAR, 0, ch, 0, 0, 0, 0, 0);
@@ -47,3 +80,241 @@ void sbi_shutdown(void)
 {
     sbi_ecall(SBI_EXT_0_1_SHUTDOWN, 0, 0, 0, 0, 0, 0, 0);
 }
+
+static unsigned int sbi_major_version(void)
+{
+    return MASK_EXTR(sbi_spec_version, SBI_SPEC_VERSION_MAJOR_MASK);
+}
+
+static unsigned int sbi_minor_version(void)
+{
+    return MASK_EXTR(sbi_spec_version, SBI_SPEC_VERSION_MINOR_MASK);
+}
+
+static long sbi_ext_base_func(long fid)
+{
+    struct sbiret ret;
+
+    ret = sbi_ecall(SBI_EXT_BASE, fid, 0, 0, 0, 0, 0, 0);
+
+    if ( !ret.error )
+    {
+        /*
+         * I wasn't able to find a case in the SBI spec where sbiret.value
+         * could be negative.
+         *
+         * Unfortunately, the spec does not specify the possible values of
+         * sbiret.value, but based on the description of the SBI function,
+         * ret.value >= 0 when sbiret.error = 0. SPI spec specify only
+         * possible value for sbiret.error (<= 0 whwere 0 is SBI_SUCCESS ).
+         *
+         * Just to be sure that SBI base extension functions one day won't
+         * start to return a negative value for sbiret.value when
+         * sbiret.error < 0 BUG_ON() is added.
+         */
+        BUG_ON(ret.value < 0);
+
+        return ret.value;
+    }
+    else
+        return ret.error;
+}
+
+static int sbi_rfence_v02_real(unsigned long fid,
+                               unsigned long hmask, unsigned long hbase,
+                               vaddr_t start, size_t size,
+                               unsigned long arg4)
+{
+    struct sbiret ret = {0};
+    int result = 0;
+
+    switch ( fid )
+    {
+    case SBI_EXT_RFENCE_REMOTE_FENCE_I:
+        ret = sbi_ecall(SBI_EXT_RFENCE, fid, hmask, hbase,
+                        0, 0, 0, 0);
+        break;
+
+    case SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA:
+    case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA:
+    case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA:
+        ret = sbi_ecall(SBI_EXT_RFENCE, fid, hmask, hbase,
+                        start, size, 0, 0);
+        break;
+
+    case SBI_EXT_RFENCE_REMOTE_SFENCE_VMA_ASID:
+    case SBI_EXT_RFENCE_REMOTE_HFENCE_GVMA_VMID:
+    case SBI_EXT_RFENCE_REMOTE_HFENCE_VVMA_ASID:
+        ret = sbi_ecall(SBI_EXT_RFENCE, fid, hmask, hbase,
+                        start, size, arg4, 0);
+        break;
+
+    default:
+        printk("%s: unknown function ID [%#lx]\n",
+               __func__, fid);
+        result = -EINVAL;
+        break;
+    };
+
+    if ( ret.error )
+    {
+        result = sbi_err_map_xen_errno(ret.error);
+        printk("%s: hbase=%lu hmask=%#lx failed (error %ld)\n",
+               __func__, hbase, hmask, ret.error);
+    }
+
+    return result;
+}
+
+static int cf_check sbi_rfence_v02(unsigned long fid,
+                                   const cpumask_t *cpu_mask,
+                                   vaddr_t start, size_t size,
+                                   unsigned long arg4, unsigned long arg5)
+{
+    unsigned long hartid, cpuid, hmask = 0, hbase = 0, htop = 0;
+    int result = -EINVAL;
+
+    /*
+     * hart_mask_base can be set to -1 to indicate that hart_mask can be
+     * ignored and all available harts must be considered.
+     */
+    if ( !cpu_mask )
+        return sbi_rfence_v02_real(fid, 0UL, -1UL, start, size, arg4);
+
+    for_each_cpu ( cpuid, cpu_mask )
+    {
+        /*
+         * Hart IDs might not necessarily be numbered contiguously in
+         * a multiprocessor system.
+         *
+         * This means that it is possible for the hart ID mapping to look like:
+         *  0, 1, 3, 65, 66, 69
+         * In such cases, more than one call to sbi_rfence_v02_real() will be
+         * needed, as a single hmask can only cover sizeof(unsigned long) CPUs:
+         *  1. sbi_rfence_v02_real(hmask=0b1011, hbase=0)
+         *  2. sbi_rfence_v02_real(hmask=0b1011, hbase=65)
+         *
+         * The algorithm below tries to batch as many harts as possible before
+         * making an SBI call. However, batching may not always be possible.
+         * For example, consider the hart ID mapping:
+         *   0, 64, 1, 65, 2, 66 (1)
+         *
+         * Generally, batching is also possible for (1):
+         *    First (0,1,2), then (64,65,66).
+         * It just requires a different approach and updates to the current
+         * algorithm.
+         */
+        hartid = cpuid_to_hartid(cpuid);
+        if ( hmask )
+        {
+            if ( hartid + BITS_PER_LONG <= htop ||
+                 hbase + BITS_PER_LONG <= hartid )
+            {
+                result = sbi_rfence_v02_real(fid, hmask, hbase,
+                                             start, size, arg4);
+                hmask = 0;
+                if ( result )
+                    break;
+            }
+            else if ( hartid < hbase )
+            {
+                /* shift the mask to fit lower hartid */
+                hmask <<= hbase - hartid;
+                hbase = hartid;
+            }
+        }
+
+        if ( !hmask )
+        {
+            hbase = hartid;
+            htop = hartid;
+        }
+        else if ( hartid > htop )
+            htop = hartid;
+
+        hmask |= BIT(hartid - hbase, UL);
+    }
+
+    if ( hmask )
+        result = sbi_rfence_v02_real(fid, hmask, hbase,
+                                     start, size, arg4);
+
+    return result;
+}
+
+static int (* __ro_after_init sbi_rfence)(unsigned long fid,
+                                          const cpumask_t *cpu_mask,
+                                          vaddr_t start,
+                                          size_t size,
+                                          unsigned long arg4,
+                                          unsigned long arg5);
+
+int sbi_remote_sfence_vma(const cpumask_t *cpu_mask, vaddr_t start,
+                          size_t size)
+{
+    ASSERT(sbi_rfence);
+
+    return sbi_rfence(SBI_EXT_RFENCE_REMOTE_SFENCE_VMA,
+                      cpu_mask, start, size, 0, 0);
+}
+
+/* This function must always succeed. */
+#define sbi_get_spec_version()  \
+    sbi_ext_base_func(SBI_EXT_BASE_GET_SPEC_VERSION)
+
+#define sbi_get_firmware_id()   \
+    sbi_ext_base_func(SBI_EXT_BASE_GET_IMP_ID)
+
+#define sbi_get_firmware_version()  \
+    sbi_ext_base_func(SBI_EXT_BASE_GET_IMP_VERSION)
+
+int sbi_probe_extension(long extid)
+{
+    struct sbiret ret;
+
+    ret = sbi_ecall(SBI_EXT_BASE, SBI_EXT_BASE_PROBE_EXT, extid,
+                    0, 0, 0, 0, 0);
+    if ( !ret.error && ret.value )
+        return ret.value;
+
+    return sbi_err_map_xen_errno(ret.error);
+}
+
+static bool sbi_spec_is_0_1(void)
+{
+    return (sbi_spec_version == SBI_SPEC_VERSION_DEFAULT);
+}
+
+bool sbi_has_rfence(void)
+{
+    return (sbi_rfence != NULL);
+}
+
+int __init sbi_init(void)
+{
+    sbi_spec_version = sbi_get_spec_version();
+
+    printk("SBI specification v%u.%u detected\n",
+            sbi_major_version(), sbi_minor_version());
+
+    if ( !sbi_spec_is_0_1() )
+    {
+        long sbi_fw_id = sbi_get_firmware_id();
+        long sbi_fw_version = sbi_get_firmware_version();
+
+        BUG_ON((sbi_fw_id < 0) || (sbi_fw_version < 0));
+
+        printk("SBI implementation ID=%#lx Version=%#lx\n",
+            sbi_fw_id, sbi_fw_version);
+
+        if ( sbi_probe_extension(SBI_EXT_RFENCE) > 0 )
+        {
+            sbi_rfence = sbi_rfence_v02;
+            printk("SBI v0.2 RFENCE extension detected\n");
+        }
+    }
+    else
+        panic("Ooops. SBI spec version 0.1 detected. Need to add support");
+
+    return 0;
+}
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index b9850a9801..1d81e0b64f 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -9,6 +9,7 @@
 #include <public/version.h>
 
 #include <asm/early_printk.h>
+#include <asm/sbi.h>
 #include <asm/smp.h>
 #include <asm/traps.h>
 
@@ -32,6 +33,8 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
 
     trap_init();
 
+    sbi_init();
+
     setup_fixmap_mappings();
 
     printk("All set up\n");
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Oct 01 03:12:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 01 Oct 2024 03:12:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807687.1219295 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svTJ7-0005He-LB; Tue, 01 Oct 2024 03:12:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807687.1219295; Tue, 01 Oct 2024 03:12:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svTJ7-0005HX-IQ; Tue, 01 Oct 2024 03:12:13 +0000
Received: by outflank-mailman (input) for mailman id 807687;
 Tue, 01 Oct 2024 03:12: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 1svTJ6-0005H4-Ma
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03:12: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 1svTJ6-0007Xf-Ls
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03:12:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svTJ6-0007yO-L6
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03:12:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yoqImYSEMMh3xCAzUaRbDFOlYfFCRnVGKCJGIK1qguU=; b=WSAeMgqDu47VMqX6dHlgosx/Gp
	pvjHSsXYlgNLc5FIlyr6j1OPPSMI91lr2eiVkvbuYMtklLLfAMtcuCNFtbcfYFPekjeb6GqURbBWI
	HHq7VKOvtdroftVRy2SFqJwVY3kAh/OBIAvJPgUbOV2pcvDvgad+t3xBQaioxA86Z5XI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/irq: allow setting IRQ permissions from GSI instead of pIRQ
Message-Id: <E1svTJ6-0007yO-L6@xenbits.xenproject.org>
Date: Tue, 01 Oct 2024 03:12:12 +0000

commit d6e9a2aab39e810a5ca5bd5f80de7e4591fbd765
Author:     Jiqian Chen <Jiqian.Chen@amd.com>
AuthorDate: Mon Sep 30 10:13:15 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 30 10:13:15 2024 +0200

    x86/irq: allow setting IRQ permissions from GSI instead of pIRQ
    
    Some domains are not aware of the pIRQ abstraction layer that maps
    interrupt sources into Xen space interrupt numbers.  pIRQs values are
    only exposed to domains that have the option to route physical
    interrupts over event channels.
    
    This creates issues for PCI-passthrough from a PVH domain, as some of
    the passthrough related hypercalls use pIRQ as references to physical
    interrupts on the system.  One of such interfaces is
    XEN_DOMCTL_irq_permission, used to grant or revoke access to
    interrupts, takes a pIRQ as the reference to the interrupt to be
    adjusted.
    
    Since PVH doesn't manage interrupts in terms of pIRQs, introduce a new
    hypercall that allows setting interrupt permissions based on GSI value
    rather than pIRQ.
    
    Note the GSI hypercall parameters is translated to an IRQ value (in
    case there are ACPI overrides) before doing the checks.
    
    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>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domctl.c              | 32 ++++++++++++++++++++++++++++++++
 xen/arch/x86/include/asm/io_apic.h |  2 ++
 xen/arch/x86/io_apic.c             | 19 +++++++++++++++++++
 xen/arch/x86/mpparse.c             |  7 +++----
 xen/include/public/domctl.h        | 10 ++++++++++
 xen/xsm/flask/hooks.c              |  1 +
 6 files changed, 67 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 6c1355e378..96d816cf1a 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -36,6 +36,7 @@
 #include <asm/xstate.h>
 #include <asm/psr.h>
 #include <asm/cpu-policy.h>
+#include <asm/io_apic.h>
 
 static int update_domain_cpu_policy(struct domain *d,
                                     xen_domctl_cpu_policy_t *xdpc)
@@ -237,6 +238,37 @@ long arch_do_domctl(
         break;
     }
 
+    case XEN_DOMCTL_gsi_permission:
+    {
+        int irq;
+        unsigned int gsi = domctl->u.gsi_permission.gsi;
+        uint32_t flags = domctl->u.gsi_permission.flags;
+
+        /* Check only valid bits are set */
+        ret = -EINVAL;
+        if ( flags & ~XEN_DOMCTL_GSI_ACTION_MASK )
+            break;
+
+        irq = gsi_2_irq(gsi);
+        if ( irq <= 0 )
+        {
+            ret = irq ?: -EACCES;
+            break;
+        }
+
+        ret = -EPERM;
+        if ( !irq_access_permitted(currd, irq) ||
+             xsm_irq_permission(XSM_HOOK, d, irq, flags) )
+            break;
+
+        if ( flags )
+            ret = irq_permit_access(d, irq);
+        else
+            ret = irq_deny_access(d, irq);
+
+        break;
+    }
+
     case XEN_DOMCTL_getpageframeinfo3:
     {
         unsigned int num = domctl->u.getpageframeinfo3.num;
diff --git a/xen/arch/x86/include/asm/io_apic.h b/xen/arch/x86/include/asm/io_apic.h
index 78268ea8f6..62456806c7 100644
--- a/xen/arch/x86/include/asm/io_apic.h
+++ b/xen/arch/x86/include/asm/io_apic.h
@@ -213,5 +213,7 @@ unsigned highest_gsi(void);
 
 int ioapic_guest_read( unsigned long physbase, unsigned int reg, u32 *pval);
 int ioapic_guest_write(unsigned long physbase, unsigned int reg, u32 val);
+int mp_find_ioapic(unsigned int gsi);
+int gsi_2_irq(unsigned int gsi);
 
 #endif
diff --git a/xen/arch/x86/io_apic.c b/xen/arch/x86/io_apic.c
index 7727005846..e40d2f7dbd 100644
--- a/xen/arch/x86/io_apic.c
+++ b/xen/arch/x86/io_apic.c
@@ -955,6 +955,25 @@ static int pin_2_irq(int idx, int apic, int pin)
     return irq;
 }
 
+int gsi_2_irq(unsigned int gsi)
+{
+    int ioapic, irq;
+    unsigned int pin;
+
+    if ( gsi > highest_gsi() )
+        return -ERANGE;
+
+    ioapic = mp_find_ioapic(gsi);
+    if ( ioapic < 0 )
+        return -EINVAL;
+
+    pin = gsi - io_apic_gsi_base(ioapic);
+
+    irq = apic_pin_2_gsi_irq(ioapic, pin);
+
+    return irq ?: -EINVAL;
+}
+
 static inline int IO_APIC_irq_trigger(int irq)
 {
     int apic, idx, pin;
diff --git a/xen/arch/x86/mpparse.c b/xen/arch/x86/mpparse.c
index 306d8ed97a..e13b83bbe9 100644
--- a/xen/arch/x86/mpparse.c
+++ b/xen/arch/x86/mpparse.c
@@ -842,8 +842,7 @@ static struct mp_ioapic_routing {
 } mp_ioapic_routing[MAX_IO_APICS];
 
 
-static int mp_find_ioapic (
-	int			gsi)
+int mp_find_ioapic(unsigned int gsi)
 {
 	unsigned int		i;
 
@@ -854,7 +853,7 @@ static int mp_find_ioapic (
 			return i;
 	}
 
-	printk(KERN_ERR "ERROR: Unable to locate IOAPIC for GSI %d\n", gsi);
+	printk(KERN_ERR "ERROR: Unable to locate IOAPIC for GSI %u\n", gsi);
 
 	return -1;
 }
@@ -915,7 +914,7 @@ void __init mp_register_ioapic (
 	return;
 }
 
-unsigned __init highest_gsi(void)
+unsigned highest_gsi(void)
 {
 	unsigned x, res = 0;
 	for (x = 0; x < nr_ioapics; x++)
diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index 2a49fe46ce..e1028fc524 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -464,6 +464,14 @@ struct xen_domctl_irq_permission {
     uint8_t pad[3];
 };
 
+/* XEN_DOMCTL_gsi_permission */
+struct xen_domctl_gsi_permission {
+    uint32_t gsi;
+#define XEN_DOMCTL_GSI_REVOKE      0
+#define XEN_DOMCTL_GSI_GRANT       1
+#define XEN_DOMCTL_GSI_ACTION_MASK 1
+    uint32_t flags;
+};
 
 /* XEN_DOMCTL_iomem_permission */
 struct xen_domctl_iomem_permission {
@@ -1306,6 +1314,7 @@ struct xen_domctl {
 #define XEN_DOMCTL_get_paging_mempool_size       85
 #define XEN_DOMCTL_set_paging_mempool_size       86
 #define XEN_DOMCTL_dt_overlay                    87
+#define XEN_DOMCTL_gsi_permission                88
 #define XEN_DOMCTL_gdbsx_guestmemio            1000
 #define XEN_DOMCTL_gdbsx_pausevcpu             1001
 #define XEN_DOMCTL_gdbsx_unpausevcpu           1002
@@ -1328,6 +1337,7 @@ struct xen_domctl {
         struct xen_domctl_setdomainhandle   setdomainhandle;
         struct xen_domctl_setdebugging      setdebugging;
         struct xen_domctl_irq_permission    irq_permission;
+        struct xen_domctl_gsi_permission    gsi_permission;
         struct xen_domctl_iomem_permission  iomem_permission;
         struct xen_domctl_ioport_permission ioport_permission;
         struct xen_domctl_hypercall_init    hypercall_init;
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 278ad38c2a..dfa23738cd 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -695,6 +695,7 @@ static int cf_check flask_domctl(struct domain *d, unsigned int cmd,
     case XEN_DOMCTL_shadow_op:
     case XEN_DOMCTL_ioport_permission:
     case XEN_DOMCTL_ioport_mapping:
+    case XEN_DOMCTL_gsi_permission:
 #endif
 #ifdef CONFIG_HAS_PASSTHROUGH
     /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Oct 01 03:12:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 01 Oct 2024 03:12:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807689.1219299 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svTJH-0005Qn-OS; Tue, 01 Oct 2024 03:12:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807689.1219299; Tue, 01 Oct 2024 03:12:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svTJH-0005Qf-Lj; Tue, 01 Oct 2024 03:12:23 +0000
Received: by outflank-mailman (input) for mailman id 807689;
 Tue, 01 Oct 2024 03:12: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 1svTJG-0005QN-PT
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03:12: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 1svTJG-0007Yu-Om
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03:12:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svTJG-0007zD-O9
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03:12:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8tzGqG41MT7rCqQ4w/9jbAPDxG/Z697NGlzX8u+w04E=; b=Psl6NpeYUoBzskz72UXi7UvZOA
	5rC5lnGNVGGMGTiLoEzx1CycQszXKzwl/XEXGL0bC8maowifNwF7MsvQWbccz0n3ZhnViY0HYsv5v
	mWXOHmmBpgo8P2WZUXleAxVbNlkBKoXKZDpTrVvDnhYMIitlnSpVxhTj62lBadLRkZgM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: Add new function to get gsi from dev
Message-Id: <E1svTJG-0007zD-O9@xenbits.xenproject.org>
Date: Tue, 01 Oct 2024 03:12:22 +0000

commit b93e5981d25896d9522ba39488b4d5bbe8b02457
Author:     Jiqian Chen <Jiqian.Chen@amd.com>
AuthorDate: Mon Sep 30 10:13:46 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 30 10:13:46 2024 +0200

    tools: Add new function to get gsi from dev
    
    On PVH dom0, when passthrough a device to domU, QEMU and xl tools
    want to use gsi number to do pirq mapping, see QEMU code
    xen_pt_realize->xc_physdev_map_pirq, and xl code
    pci_add_dm_done->xc_physdev_map_pirq, but in current codes, the gsi
    number is got from file /sys/bus/pci/devices/<sbdf>/irq, that is
    wrong, because irq is not equal with gsi, they are in different
    spaces, so pirq mapping fails.
    
    And in current codes, there is no method to get gsi for userspace.
    For above purpose, add new function to get gsi, and the
    corresponding ioctl is implemented on linux kernel side.
    
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Signed-off-by: Huang Rui <ray.huang@amd.com>
    Signed-off-by: Chen Jiqian <Jiqian.Chen@amd.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/include/xen-sys/Linux/privcmd.h |  7 +++++++
 tools/include/xenctrl.h               |  2 ++
 tools/libs/ctrl/xc_freebsd.c          |  6 ++++++
 tools/libs/ctrl/xc_linux.c            | 20 ++++++++++++++++++++
 tools/libs/ctrl/xc_minios.c           |  6 ++++++
 tools/libs/ctrl/xc_netbsd.c           |  6 ++++++
 tools/libs/ctrl/xc_solaris.c          |  6 ++++++
 7 files changed, 53 insertions(+)

diff --git a/tools/include/xen-sys/Linux/privcmd.h b/tools/include/xen-sys/Linux/privcmd.h
index bc60e8fd55..607dfa2287 100644
--- a/tools/include/xen-sys/Linux/privcmd.h
+++ b/tools/include/xen-sys/Linux/privcmd.h
@@ -95,6 +95,11 @@ typedef struct privcmd_mmap_resource {
 	__u64 addr;
 } privcmd_mmap_resource_t;
 
+typedef struct privcmd_pcidev_get_gsi {
+	__u32 sbdf;
+	__u32 gsi;
+} privcmd_pcidev_get_gsi_t;
+
 /*
  * @cmd: IOCTL_PRIVCMD_HYPERCALL
  * @arg: &privcmd_hypercall_t
@@ -114,6 +119,8 @@ typedef struct privcmd_mmap_resource {
 	_IOC(_IOC_NONE, 'P', 6, sizeof(domid_t))
 #define IOCTL_PRIVCMD_MMAP_RESOURCE				\
 	_IOC(_IOC_NONE, 'P', 7, sizeof(privcmd_mmap_resource_t))
+#define IOCTL_PRIVCMD_PCIDEV_GET_GSI			\
+	_IOC(_IOC_NONE, 'P', 10, sizeof(privcmd_pcidev_get_gsi_t))
 #define IOCTL_PRIVCMD_UNIMPLEMENTED				\
 	_IOC(_IOC_NONE, 'P', 0xFF, 0)
 
diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 2c4608c09a..924f9a35f7 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -1642,6 +1642,8 @@ int xc_physdev_unmap_pirq(xc_interface *xch,
                           uint32_t domid,
                           int pirq);
 
+int xc_pcidev_get_gsi(xc_interface *xch, uint32_t sbdf);
+
 /*
  *  LOGGING AND ERROR REPORTING
  */
diff --git a/tools/libs/ctrl/xc_freebsd.c b/tools/libs/ctrl/xc_freebsd.c
index 9dd48a3a08..9019fc6633 100644
--- a/tools/libs/ctrl/xc_freebsd.c
+++ b/tools/libs/ctrl/xc_freebsd.c
@@ -60,6 +60,12 @@ void *xc_memalign(xc_interface *xch, size_t alignment, size_t size)
     return ptr;
 }
 
+int xc_pcidev_get_gsi(xc_interface *xch, uint32_t sbdf)
+{
+    errno = ENOSYS;
+    return -1;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/tools/libs/ctrl/xc_linux.c b/tools/libs/ctrl/xc_linux.c
index c67c71c08b..92591e49a1 100644
--- a/tools/libs/ctrl/xc_linux.c
+++ b/tools/libs/ctrl/xc_linux.c
@@ -66,6 +66,26 @@ void *xc_memalign(xc_interface *xch, size_t alignment, size_t size)
     return ptr;
 }
 
+int xc_pcidev_get_gsi(xc_interface *xch, uint32_t sbdf)
+{
+    int ret;
+    privcmd_pcidev_get_gsi_t dev_gsi = {
+        .sbdf = sbdf,
+        .gsi = 0,
+    };
+
+    ret = ioctl(xencall_fd(xch->xcall),
+                IOCTL_PRIVCMD_PCIDEV_GET_GSI, &dev_gsi);
+
+    if (ret < 0) {
+        PERROR("Failed to get gsi from dev");
+    } else {
+        ret = dev_gsi.gsi;
+    }
+
+    return ret;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/tools/libs/ctrl/xc_minios.c b/tools/libs/ctrl/xc_minios.c
index 3dea7a78a5..462af827b3 100644
--- a/tools/libs/ctrl/xc_minios.c
+++ b/tools/libs/ctrl/xc_minios.c
@@ -47,6 +47,12 @@ void *xc_memalign(xc_interface *xch, size_t alignment, size_t size)
     return memalign(alignment, size);
 }
 
+int xc_pcidev_get_gsi(xc_interface *xch, uint32_t sbdf)
+{
+    errno = ENOSYS;
+    return -1;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/tools/libs/ctrl/xc_netbsd.c b/tools/libs/ctrl/xc_netbsd.c
index 3197993762..1318d4d906 100644
--- a/tools/libs/ctrl/xc_netbsd.c
+++ b/tools/libs/ctrl/xc_netbsd.c
@@ -63,6 +63,12 @@ void *xc_memalign(xc_interface *xch, size_t alignment, size_t size)
     return valloc(size);
 }
 
+int xc_pcidev_get_gsi(xc_interface *xch, uint32_t sbdf)
+{
+    errno = ENOSYS;
+    return -1;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/tools/libs/ctrl/xc_solaris.c b/tools/libs/ctrl/xc_solaris.c
index 5128f3f0f4..049e28d55c 100644
--- a/tools/libs/ctrl/xc_solaris.c
+++ b/tools/libs/ctrl/xc_solaris.c
@@ -32,6 +32,12 @@ void *xc_memalign(xc_interface *xch, size_t alignment, size_t size)
     return memalign(alignment, size);
 }
 
+int xc_pcidev_get_gsi(xc_interface *xch, uint32_t sbdf)
+{
+    errno = ENOSYS;
+    return -1;
+}
+
 /*
  * Local variables:
  * mode: C
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Oct 01 03:12:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 01 Oct 2024 03:12:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807691.1219305 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svTJR-0005Ux-RR; Tue, 01 Oct 2024 03:12:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807691.1219305; Tue, 01 Oct 2024 03:12:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svTJR-0005Up-Na; Tue, 01 Oct 2024 03:12:33 +0000
Received: by outflank-mailman (input) for mailman id 807691;
 Tue, 01 Oct 2024 03:12: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 1svTJQ-0005Ud-Ss
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03:12: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 1svTJQ-0007Zs-S4
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03:12:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svTJQ-0007zv-RL
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 03:12:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=T2/hvkzcgty8KJrnkzA1sath/ZKy91jgEfxhfYyPw+A=; b=25Xjhv+Z2Kws5VxccM+w60avzy
	qXkML+X+eie6oDocuKADKMBAiIMai5XuSl98XCERA/A03H6H+5lLXsBCKfdHve4J3VadMXK8txav6
	P6VjV1jNrMY0tyaexNjsFfG+KIg2DOpUKqawqgmHQQb9Nao6Kdb79yhgCU01Vhm6WW8I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools: Add new function to do PIRQ (un)map on PVH dom0
Message-Id: <E1svTJQ-0007zv-RL@xenbits.xenproject.org>
Date: Tue, 01 Oct 2024 03:12:32 +0000

commit f97f885c719849f55bade3b6303206e7717ecff8
Author:     Jiqian Chen <Jiqian.Chen@amd.com>
AuthorDate: Mon Sep 30 10:14:01 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Sep 30 10:14:01 2024 +0200

    tools: Add new function to do PIRQ (un)map on PVH dom0
    
    When dom0 is PVH, and passthrough a device to dumU, xl will
    use the gsi number of device to do a pirq mapping, see
    pci_add_dm_done->xc_physdev_map_pirq, but the gsi number is
    got from file /sys/bus/pci/devices/<sbdf>/irq, that confuses
    irq and gsi, they are in different space and are not equal,
    so it will fail when mapping.
    To solve this issue, to get the real gsi and add a new function
    xc_physdev_map_pirq_gsi to get a free pirq for gsi.
    Note: why not use current function xc_physdev_map_pirq, because
    it doesn't support to allocate a free pirq, what's more, to
    prevent changing it and affecting its callers, so add
    xc_physdev_map_pirq_gsi.
    
    Besides, PVH dom0 doesn't have PIRQs flag, it doesn't do
    PHYSDEVOP_map_pirq for each gsi. So grant function callstack
    pci_add_dm_done->XEN_DOMCTL_irq_permission will fail at function
    domain_pirq_to_irq. And old hypercall XEN_DOMCTL_irq_permission
    requires passing in pirq, it is not suitable for PVH dom0 that
    doesn't have PIRQs to grant irq permission.
    To solve this issue, use the another hypercall
    XEN_DOMCTL_gsi_permission to grant the permission of irq(
    translate from gsi) to dumU when dom0 has no PIRQs.
    
    Signed-off-by: Jiqian Chen <Jiqian.Chen@amd.com>
    Signed-off-by: Huang Rui <ray.huang@amd.com>
    Signed-off-by: Chen Jiqian <Jiqian.Chen@amd.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/include/xenctrl.h       |  10 ++++
 tools/libs/ctrl/xc_domain.c   |  15 ++++++
 tools/libs/ctrl/xc_physdev.c  |  27 +++++++++++
 tools/libs/light/libxl_arch.h |   6 +++
 tools/libs/light/libxl_arm.c  |  15 ++++++
 tools/libs/light/libxl_pci.c  | 110 +++++++++++++++++++++++++-----------------
 tools/libs/light/libxl_x86.c  |  72 +++++++++++++++++++++++++++
 7 files changed, 210 insertions(+), 45 deletions(-)

diff --git a/tools/include/xenctrl.h b/tools/include/xenctrl.h
index 924f9a35f7..29617585c5 100644
--- a/tools/include/xenctrl.h
+++ b/tools/include/xenctrl.h
@@ -1383,6 +1383,11 @@ int xc_domain_irq_permission(xc_interface *xch,
                              uint32_t pirq,
                              bool allow_access);
 
+int xc_domain_gsi_permission(xc_interface *xch,
+                             uint32_t domid,
+                             uint32_t gsi,
+                             uint32_t flags);
+
 int xc_domain_iomem_permission(xc_interface *xch,
                                uint32_t domid,
                                unsigned long first_mfn,
@@ -1638,6 +1643,11 @@ int xc_physdev_map_pirq_msi(xc_interface *xch,
                             int entry_nr,
                             uint64_t table_base);
 
+int xc_physdev_map_pirq_gsi(xc_interface *xch,
+                            uint32_t domid,
+                            int gsi,
+                            int *pirq);
+
 int xc_physdev_unmap_pirq(xc_interface *xch,
                           uint32_t domid,
                           int pirq);
diff --git a/tools/libs/ctrl/xc_domain.c b/tools/libs/ctrl/xc_domain.c
index f2d9d14b4d..e3538ec0ba 100644
--- a/tools/libs/ctrl/xc_domain.c
+++ b/tools/libs/ctrl/xc_domain.c
@@ -1394,6 +1394,21 @@ int xc_domain_irq_permission(xc_interface *xch,
     return do_domctl(xch, &domctl);
 }
 
+int xc_domain_gsi_permission(xc_interface *xch,
+                             uint32_t domid,
+                             uint32_t gsi,
+                             uint32_t flags)
+{
+    struct xen_domctl domctl = {
+        .cmd = XEN_DOMCTL_gsi_permission,
+        .domain = domid,
+        .u.gsi_permission.gsi = gsi,
+        .u.gsi_permission.flags = flags,
+    };
+
+    return do_domctl(xch, &domctl);
+}
+
 int xc_domain_iomem_permission(xc_interface *xch,
                                uint32_t domid,
                                unsigned long first_mfn,
diff --git a/tools/libs/ctrl/xc_physdev.c b/tools/libs/ctrl/xc_physdev.c
index 460a8e779c..25e686d7b3 100644
--- a/tools/libs/ctrl/xc_physdev.c
+++ b/tools/libs/ctrl/xc_physdev.c
@@ -95,6 +95,33 @@ int xc_physdev_map_pirq_msi(xc_interface *xch,
     return rc;
 }
 
+int xc_physdev_map_pirq_gsi(xc_interface *xch,
+                            uint32_t domid,
+                            int gsi,
+                            int *pirq)
+{
+    int rc;
+    struct physdev_map_pirq map = {
+        .domid = domid,
+        .type = MAP_PIRQ_TYPE_GSI,
+        .index = gsi,
+    };
+
+    if ( !pirq )
+    {
+        errno = EINVAL;
+        return -1;
+    }
+    map.pirq = *pirq;
+
+    rc = do_physdev_op(xch, PHYSDEVOP_map_pirq, &map, sizeof(map));
+
+    if ( !rc )
+        *pirq = map.pirq;
+
+    return rc;
+}
+
 int xc_physdev_unmap_pirq(xc_interface *xch,
                           uint32_t domid,
                           int pirq)
diff --git a/tools/libs/light/libxl_arch.h b/tools/libs/light/libxl_arch.h
index f88f11d6de..c8ef52ddbe 100644
--- a/tools/libs/light/libxl_arch.h
+++ b/tools/libs/light/libxl_arch.h
@@ -91,6 +91,12 @@ void libxl__arch_update_domain_config(libxl__gc *gc,
                                       libxl_domain_config *dst,
                                       const libxl_domain_config *src);
 
+_hidden
+int libxl__arch_hvm_map_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid);
+_hidden
+int libxl__arch_hvm_unmap_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid);
+_hidden
+bool libxl__arch_local_domain_has_pirq_notion(libxl__gc *gc);
 #if defined(__i386__) || defined(__x86_64__)
 
 #define LAPIC_BASE_ADDRESS  0xfee00000
diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
index a4029e3ac8..5a9db5e85f 100644
--- a/tools/libs/light/libxl_arm.c
+++ b/tools/libs/light/libxl_arm.c
@@ -1774,6 +1774,21 @@ void libxl__arch_update_domain_config(libxl__gc *gc,
 {
 }
 
+int libxl__arch_hvm_map_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid)
+{
+    return ERROR_INVAL;
+}
+
+int libxl__arch_hvm_unmap_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid)
+{
+    return ERROR_INVAL;
+}
+
+bool libxl__arch_local_domain_has_pirq_notion(libxl__gc *gc)
+{
+    return true;
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/tools/libs/light/libxl_pci.c b/tools/libs/light/libxl_pci.c
index 96cb4da079..8ef6a7b5fe 100644
--- a/tools/libs/light/libxl_pci.c
+++ b/tools/libs/light/libxl_pci.c
@@ -17,6 +17,7 @@
 #include "libxl_osdeps.h" /* must come before any other headers */
 
 #include "libxl_internal.h"
+#include "libxl_arch.h"
 
 #define PCI_BDF                "%04x:%02x:%02x.%01x"
 #define PCI_BDF_SHORT          "%02x:%02x.%01x"
@@ -1478,32 +1479,42 @@ static void pci_add_dm_done(libxl__egc *egc,
     fclose(f);
     if (!pci_supp_legacy_irq())
         goto out_no_irq;
-    sysfs_path = GCSPRINTF(SYSFS_PCI_DEV"/"PCI_BDF"/irq", pci->domain,
-                                pci->bus, pci->dev, pci->func);
-    f = fopen(sysfs_path, "r");
-    if (f == NULL) {
-        LOGED(ERROR, domainid, "Couldn't open %s", sysfs_path);
-        goto out_no_irq;
-    }
-    if ((fscanf(f, "%u", &irq) == 1) && irq) {
-        r = xc_physdev_map_pirq(ctx->xch, domid, irq, &irq);
-        if (r < 0) {
-            LOGED(ERROR, domainid, "xc_physdev_map_pirq irq=%d (error=%d)",
-                  irq, r);
-            fclose(f);
-            rc = ERROR_FAIL;
+
+    /* When dom0 is PVH, should use gsi to map pirq and grant permission */
+    if (libxl__arch_local_domain_has_pirq_notion(gc) == false) {
+        rc = libxl__arch_hvm_map_gsi(gc, pci_encode_bdf(pci), domid);
+        if (rc) {
+            LOGD(ERROR, domainid, "libxl__arch_hvm_map_gsi failed");
             goto out;
         }
-        r = xc_domain_irq_permission(ctx->xch, domid, irq, 1);
-        if (r < 0) {
-            LOGED(ERROR, domainid,
-                  "xc_domain_irq_permission irq=%d (error=%d)", irq, r);
-            fclose(f);
-            rc = ERROR_FAIL;
-            goto out;
+    } else {
+        sysfs_path = GCSPRINTF(SYSFS_PCI_DEV"/"PCI_BDF"/irq", pci->domain,
+                                    pci->bus, pci->dev, pci->func);
+        f = fopen(sysfs_path, "r");
+        if (f == NULL) {
+            LOGED(ERROR, domainid, "Couldn't open %s", sysfs_path);
+            goto out_no_irq;
+        }
+        if ((fscanf(f, "%u", &irq) == 1) && irq) {
+            r = xc_physdev_map_pirq(ctx->xch, domid, irq, &irq);
+            if (r < 0) {
+                LOGED(ERROR, domainid, "xc_physdev_map_pirq irq=%d (error=%d)",
+                    irq, r);
+                fclose(f);
+                rc = ERROR_FAIL;
+                goto out;
+            }
+            r = xc_domain_irq_permission(ctx->xch, domid, irq, 1);
+            if (r < 0) {
+                LOGED(ERROR, domainid,
+                    "xc_domain_irq_permission irq=%d (error=%d)", irq, r);
+                fclose(f);
+                rc = ERROR_FAIL;
+                goto out;
+            }
         }
+        fclose(f);
     }
-    fclose(f);
 
     /* Don't restrict writes to the PCI config space from this VM */
     if (pci->permissive) {
@@ -2229,33 +2240,42 @@ skip_bar:
     if (!pci_supp_legacy_irq())
         goto skip_legacy_irq;
 
-    sysfs_path = GCSPRINTF(SYSFS_PCI_DEV"/"PCI_BDF"/irq", pci->domain,
-                           pci->bus, pci->dev, pci->func);
-
-    f = fopen(sysfs_path, "r");
-    if (f == NULL) {
-        LOGED(ERROR, domid, "Couldn't open %s", sysfs_path);
-        goto skip_legacy_irq;
-    }
+    /* When dom0 is PVH, should use gsi to unmap pirq and deny permission */
+    if (libxl__arch_local_domain_has_pirq_notion(gc) == false) {
+        rc = libxl__arch_hvm_unmap_gsi(gc, pci_encode_bdf(pci), domid);
+        if (rc) {
+            LOGD(ERROR, domid, "libxl__arch_hvm_unmap_gsi failed");
+            goto out;
+        }
+    } else {
+        sysfs_path = GCSPRINTF(SYSFS_PCI_DEV"/"PCI_BDF"/irq", pci->domain,
+                            pci->bus, pci->dev, pci->func);
 
-    if ((fscanf(f, "%u", &irq) == 1) && irq) {
-        rc = xc_physdev_unmap_pirq(ctx->xch, domid, irq);
-        if (rc < 0) {
-            /*
-             * QEMU may have already unmapped the IRQ. So the error
-             * may be spurious. For now, still print an error message as
-             * it is not easy to distinguished between valid and
-             * spurious error.
-             */
-            LOGED(ERROR, domid, "xc_physdev_unmap_pirq irq=%d", irq);
+        f = fopen(sysfs_path, "r");
+        if (f == NULL) {
+            LOGED(ERROR, domid, "Couldn't open %s", sysfs_path);
+            goto skip_legacy_irq;
         }
-        rc = xc_domain_irq_permission(ctx->xch, domid, irq, 0);
-        if (rc < 0) {
-            LOGED(ERROR, domid, "xc_domain_irq_permission irq=%d", irq);
+
+        if ((fscanf(f, "%u", &irq) == 1) && irq) {
+            rc = xc_physdev_unmap_pirq(ctx->xch, domid, irq);
+            if (rc < 0) {
+                /*
+                 * QEMU may have already unmapped the IRQ. So the error
+                 * may be spurious. For now, still print an error message as
+                 * it is not easy to distinguished between valid and
+                 * spurious error.
+                 */
+                LOGED(ERROR, domid, "xc_physdev_unmap_pirq irq=%d", irq);
+            }
+            rc = xc_domain_irq_permission(ctx->xch, domid, irq, 0);
+            if (rc < 0) {
+                LOGED(ERROR, domid, "xc_domain_irq_permission irq=%d", irq);
+            }
         }
-    }
 
-    fclose(f);
+        fclose(f);
+    }
 
 skip_legacy_irq:
 
diff --git a/tools/libs/light/libxl_x86.c b/tools/libs/light/libxl_x86.c
index 60643d6f53..a3164a3077 100644
--- a/tools/libs/light/libxl_x86.c
+++ b/tools/libs/light/libxl_x86.c
@@ -879,6 +879,78 @@ void libxl__arch_update_domain_config(libxl__gc *gc,
                                  libxl_defbool_val(src->b_info.u.hvm.pirq));
 }
 
+bool libxl__arch_local_domain_has_pirq_notion(libxl__gc *gc)
+{
+    int r;
+    xc_domaininfo_t info;
+
+    r = xc_domain_getinfo_single(CTX->xch, LIBXL_TOOLSTACK_DOMID, &info);
+    if (r == 0) {
+        if (!(info.flags & XEN_DOMINF_hvm_guest) ||
+            (info.arch_config.emulation_flags & XEN_X86_EMU_USE_PIRQ))
+            return true;
+    } else {
+        LOGE(ERROR, "getdomaininfo failed ret=%d", r);
+    }
+
+    return false;
+}
+
+int libxl__arch_hvm_map_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid)
+{
+    int pirq = -1, gsi, r;
+
+    gsi = xc_pcidev_get_gsi(CTX->xch, sbdf);
+    if (gsi < 0) {
+        return ERROR_FAIL;
+    }
+
+    r = xc_physdev_map_pirq_gsi(CTX->xch, domid, gsi, &pirq);
+    if (r < 0) {
+        LOGED(ERROR, domid, "xc_physdev_map_pirq_gsi gsi=%d", gsi);
+        return ERROR_FAIL;
+    }
+
+    r = xc_domain_gsi_permission(CTX->xch, domid, gsi, XEN_DOMCTL_GSI_GRANT);
+    if (r < 0) {
+        LOGED(ERROR, domid, "xc_domain_gsi_permission gsi=%d", gsi);
+        return ERROR_FAIL;
+    }
+
+    return 0;
+}
+
+int libxl__arch_hvm_unmap_gsi(libxl__gc *gc, uint32_t sbdf, uint32_t domid)
+{
+    int pirq = -1, gsi, r;
+
+    gsi = xc_pcidev_get_gsi(CTX->xch, sbdf);
+    if (gsi < 0) {
+        return ERROR_FAIL;
+    }
+
+    /* Before unmapping, use mapping to get the already mapped pirq first */
+    r = xc_physdev_map_pirq_gsi(CTX->xch, domid, gsi, &pirq);
+    if (r < 0) {
+        LOGED(ERROR, domid, "xc_physdev_map_pirq_gsi gsi=%d", gsi);
+        return ERROR_FAIL;
+    }
+
+    r = xc_physdev_unmap_pirq(CTX->xch, domid, pirq);
+    if (r < 0) {
+        LOGED(ERROR, domid, "xc_physdev_unmap_pirq gsi=%d", gsi);
+        return ERROR_FAIL;
+    }
+
+    r = xc_domain_gsi_permission(CTX->xch, domid, gsi, XEN_DOMCTL_GSI_REVOKE);
+    if (r < 0) {
+        LOGED(ERROR, domid, "xc_domain_gsi_permission gsi=%d", gsi);
+        return ERROR_FAIL;
+    }
+
+    return 0;
+}
+
 /*
  * Local variables:
  * mode: C
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Oct 01 07:55:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 01 Oct 2024 07:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807784.1219426 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svXir-0003mk-M7; Tue, 01 Oct 2024 07:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807784.1219426; Tue, 01 Oct 2024 07: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 1svXir-0003md-JM; Tue, 01 Oct 2024 07:55:05 +0000
Received: by outflank-mailman (input) for mailman id 807784;
 Tue, 01 Oct 2024 07: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 1svXiq-0003mX-Hy
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 07: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 1svXiq-00053c-85
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 07:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svXiq-0004Fw-5q
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 07: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=4+qxDDeHp1TaoZlGha4W/Wb2tCcgDtfe5hbIuPyn9p0=; b=Jd0bka47lJnwHhzqKdbzsqwyZK
	E2F5OOBVtGFyyFhU0OeLZlvHOpk9oJH6pYl8Pt/qNHcolkwzSp2xnyxy9dUFJnU7gtLcipVIkal9t
	ooRxPcZ1fSDbhejBSo1ixyyfy3fDiJv7IVMKjPsq9QThQhw5ZzkyDPhe1pTBX/3G6CyA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/PV: simplify (and thus correct) guest accessor functions
Message-Id: <E1svXiq-0004Fw-5q@xenbits.xenproject.org>
Date: Tue, 01 Oct 2024 07:55:04 +0000

commit 67a8e5721e1ea9c28526883036bf08fb2e8a8c9c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Oct 1 09:44:55 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 1 09:44:55 2024 +0200

    x86/PV: simplify (and thus correct) guest accessor functions
    
    Taking a fault on a non-byte-granular insn means that the "number of
    bytes not handled" return value would need extra care in calculating, if
    we want callers to be able to derive e.g. exception context (to be
    injected to the guest) - CR2 for #PF in particular - from the value. To
    simplify things rather than complicating them, reduce inline assembly to
    just byte-granular string insns. On recent CPUs that's also supposed to
    be more efficient anyway.
    
    For singular element accessors, however, alignment checks are added,
    hence slightly complicating the code. Misaligned (user) buffer accesses
    will now be forwarded to copy_{from,to}_guest_ll().
    
    Naturally copy_{from,to}_unsafe_ll() accessors end up being adjusted the
    same way, as they're produced by mere re-processing of the same code.
    Otoh copy_{from,to}_unsafe() aren't similarly adjusted, but have their
    comments made match reality; down the road we may want to change their
    return types, e.g. to bool.
    
    Fixes: 76974398a63c ("Added user-memory accessing functionality for x86_64")
    Fixes: 7b8c36701d26 ("Introduce clear_user and clear_guest")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/uaccess.h | 12 +++----
 xen/arch/x86/usercopy.c            | 66 +++++---------------------------------
 2 files changed, 14 insertions(+), 64 deletions(-)

diff --git a/xen/arch/x86/include/asm/uaccess.h b/xen/arch/x86/include/asm/uaccess.h
index 395dc42795..2d01669b96 100644
--- a/xen/arch/x86/include/asm/uaccess.h
+++ b/xen/arch/x86/include/asm/uaccess.h
@@ -251,7 +251,8 @@ do {                                                                       \
 static always_inline unsigned long
 __copy_to_guest_pv(void __user *to, const void *from, unsigned long n)
 {
-    if (__builtin_constant_p(n)) {
+    if ( __builtin_constant_p(n) && !((unsigned long)to & (n - 1)) )
+    {
         unsigned long ret;
 
         switch (n) {
@@ -291,7 +292,8 @@ __copy_to_guest_pv(void __user *to, const void *from, unsigned long n)
 static always_inline unsigned long
 __copy_from_guest_pv(void *to, const void __user *from, unsigned long n)
 {
-    if (__builtin_constant_p(n)) {
+    if ( __builtin_constant_p(n) && !((unsigned long)from & (n - 1)) )
+    {
         unsigned long ret;
 
         switch (n) {
@@ -321,8 +323,7 @@ __copy_from_guest_pv(void *to, const void __user *from, unsigned long n)
  *
  * Copy data from hypervisor space to a potentially unmapped area.
  *
- * Returns number of bytes that could not be copied.
- * On success, this will be zero.
+ * Returns zero on success and non-zero if some bytes could not be copied.
  */
 static always_inline unsigned int
 copy_to_unsafe(void __user *to, const void *from, unsigned int n)
@@ -358,8 +359,7 @@ copy_to_unsafe(void __user *to, const void *from, unsigned int n)
  *
  * Copy data from a potentially unmapped area space to hypervisor space.
  *
- * Returns number of bytes that could not be copied.
- * On success, this will be zero.
+ * Returns zero on success and non-zero if some bytes could not be copied.
  *
  * If some data could not be copied, this function will pad the copied
  * data to the requested size using zero bytes.
diff --git a/xen/arch/x86/usercopy.c b/xen/arch/x86/usercopy.c
index b8c2d1cc0b..7ab2009efe 100644
--- a/xen/arch/x86/usercopy.c
+++ b/xen/arch/x86/usercopy.c
@@ -16,42 +16,19 @@
 
 unsigned int copy_to_guest_ll(void __user *to, const void *from, unsigned int n)
 {
-    unsigned dummy;
+    GUARD(unsigned dummy);
 
     stac();
     asm volatile (
         GUARD(
         "    guest_access_mask_ptr %[to], %q[scratch1], %q[scratch2]\n"
         )
-        "    cmp  $"STR(2*BYTES_PER_LONG-1)", %[cnt]\n"
-        "    jbe  1f\n"
-        "    mov  %k[to], %[cnt]\n"
-        "    neg  %[cnt]\n"
-        "    and  $"STR(BYTES_PER_LONG-1)", %[cnt]\n"
-        "    sub  %[cnt], %[aux]\n"
-        "4:  rep movsb\n" /* make 'to' address aligned */
-        "    mov  %[aux], %[cnt]\n"
-        "    shr  $"STR(LONG_BYTEORDER)", %[cnt]\n"
-        "    and  $"STR(BYTES_PER_LONG-1)", %[aux]\n"
-        "    .align 2,0x90\n"
-        "0:  rep movs"__OS"\n" /* as many words as possible... */
-        "    mov  %[aux],%[cnt]\n"
-        "1:  rep movsb\n" /* ...remainder copied as bytes */
+        "1:  rep movsb\n"
         "2:\n"
-        ".section .fixup,\"ax\"\n"
-        "5:  add %[aux], %[cnt]\n"
-        "    jmp 2b\n"
-        "3:  lea (%q[aux], %q[cnt], "STR(BYTES_PER_LONG)"), %[cnt]\n"
-        "    jmp 2b\n"
-        ".previous\n"
-        _ASM_EXTABLE(4b, 5b)
-        _ASM_EXTABLE(0b, 3b)
         _ASM_EXTABLE(1b, 2b)
-        : [cnt] "+c" (n), [to] "+D" (to), [from] "+S" (from),
-          [aux] "=&r" (dummy)
+        : [cnt] "+c" (n), [to] "+D" (to), [from] "+S" (from)
           GUARD(, [scratch1] "=&r" (dummy), [scratch2] "=&r" (dummy))
-        : "[aux]" (n)
-        : "memory" );
+        :: "memory" );
     clac();
 
     return n;
@@ -66,25 +43,9 @@ unsigned int copy_from_guest_ll(void *to, const void __user *from, unsigned int
         GUARD(
         "    guest_access_mask_ptr %[from], %q[scratch1], %q[scratch2]\n"
         )
-        "    cmp  $"STR(2*BYTES_PER_LONG-1)", %[cnt]\n"
-        "    jbe  1f\n"
-        "    mov  %k[to], %[cnt]\n"
-        "    neg  %[cnt]\n"
-        "    and  $"STR(BYTES_PER_LONG-1)", %[cnt]\n"
-        "    sub  %[cnt], %[aux]\n"
-        "4:  rep movsb\n" /* make 'to' address aligned */
-        "    mov  %[aux],%[cnt]\n"
-        "    shr  $"STR(LONG_BYTEORDER)", %[cnt]\n"
-        "    and  $"STR(BYTES_PER_LONG-1)", %[aux]\n"
-        "    .align 2,0x90\n"
-        "0:  rep movs"__OS"\n" /* as many words as possible... */
-        "    mov  %[aux], %[cnt]\n"
-        "1:  rep movsb\n" /* ...remainder copied as bytes */
+        "1:  rep movsb\n"
         "2:\n"
         ".section .fixup,\"ax\"\n"
-        "5:  add  %[aux], %[cnt]\n"
-        "    jmp 6f\n"
-        "3:  lea  (%q[aux], %q[cnt], "STR(BYTES_PER_LONG)"), %[cnt]\n"
         "6:  mov  %[cnt], %k[from]\n"
         "    xchg %%eax, %[aux]\n"
         "    xor  %%eax, %%eax\n"
@@ -93,14 +54,11 @@ unsigned int copy_from_guest_ll(void *to, const void __user *from, unsigned int
         "    mov  %k[from], %[cnt]\n"
         "    jmp 2b\n"
         ".previous\n"
-        _ASM_EXTABLE(4b, 5b)
-        _ASM_EXTABLE(0b, 3b)
         _ASM_EXTABLE(1b, 6b)
         : [cnt] "+c" (n), [to] "+D" (to), [from] "+S" (from),
           [aux] "=&r" (dummy)
           GUARD(, [scratch1] "=&r" (dummy), [scratch2] "=&r" (dummy))
-        : "[aux]" (n)
-        : "memory" );
+        :: "memory" );
     clac();
 
     return n;
@@ -145,20 +103,12 @@ unsigned int clear_guest_pv(void __user *to, unsigned int n)
         stac();
         asm volatile (
             "    guest_access_mask_ptr %[to], %[scratch1], %[scratch2]\n"
-            "0:  rep stos"__OS"\n"
-            "    mov  %[bytes], %[cnt]\n"
             "1:  rep stosb\n"
             "2:\n"
-            ".section .fixup,\"ax\"\n"
-            "3:  lea  (%q[bytes], %q[longs], "STR(BYTES_PER_LONG)"), %[cnt]\n"
-            "    jmp  2b\n"
-            ".previous\n"
-            _ASM_EXTABLE(0b,3b)
             _ASM_EXTABLE(1b,2b)
-            : [cnt] "=&c" (n), [to] "+D" (to), [scratch1] "=&r" (dummy),
+            : [cnt] "+c" (n), [to] "+D" (to), [scratch1] "=&r" (dummy),
               [scratch2] "=&r" (dummy)
-            : [bytes] "r" (n & (BYTES_PER_LONG - 1)),
-              [longs] "0" (n / BYTES_PER_LONG), "a" (0) );
+            : "a" (0) );
         clac();
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 01 07:55:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 01 Oct 2024 07:55:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807785.1219431 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svXj1-0003p3-Pi; Tue, 01 Oct 2024 07:55:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807785.1219431; Tue, 01 Oct 2024 07: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 1svXj1-0003ov-N6; Tue, 01 Oct 2024 07:55:15 +0000
Received: by outflank-mailman (input) for mailman id 807785;
 Tue, 01 Oct 2024 07: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 1svXj0-0003ol-Cb
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 07: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 1svXj0-00053i-Bq
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 07:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svXj0-0004Gr-AS
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 07: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=sn1aI7eHkawJP5cnmOUgT1zw3bSWcL/DE2DliXVh/2Q=; b=uuSQKInA1mXvTPmdFZpXhj7iEi
	4emcfQIfcRSa5q33+7Nkxh9i71I1gu7R35Ge2y3Os2iSEJH7+RsgsB/SMp/+iKut8hRaeM+xRQLx8
	6cJVbv7jfwN6cN4/wtAvZdHuhH4E1ZPvPyQyhtkGLrKbVV/k0P7sRnyPuNzhv7S5i7ds=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/traps: Re-enable interrupts after reading cr2 in the #PF handler
Message-Id: <E1svXj0-0004Gr-AS@xenbits.xenproject.org>
Date: Tue, 01 Oct 2024 07:55:14 +0000

commit b06e76db7c35974f1b127762683e7852ca0c8e76
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Tue Oct 1 09:45:49 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 1 09:45:49 2024 +0200

    x86/traps: Re-enable interrupts after reading cr2 in the #PF handler
    
    Hitting a page fault clobbers %cr2, so if a page fault is handled while
    handling a previous page fault then %cr2 will hold the address of the
    latter fault rather than the former. In particular, if a debug key
    handler happens to trigger during #PF and before %cr2 is read, and that
    handler itself encounters a #PF, then %cr2 will be corrupt for the outer #PF
    handler.
    
    This patch makes the page fault path delay re-enabling IRQs until %cr2
    has been read in order to ensure it stays consistent.
    
    A similar argument holds in additional cases, but they happen to be safe:
        * %dr6 inside #DB: Safe because IST exceptions don't re-enable IRQs.
        * MSR_XFD_ERR inside #NM: Safe because AMX isn't used in #NM handler.
    
    While in the area, remove redundant q suffix to a movq in entry.S and
    the space after the comma.
    
    Fixes: a4cd20a19073 ("[XEN] 'd' key dumps both host and guest state.")
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/traps.c        |  8 ++++++++
 xen/arch/x86/x86_64/entry.S | 20 ++++++++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 708136f625..a9c2c607eb 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1600,6 +1600,14 @@ void asmlinkage do_page_fault(struct cpu_user_regs *regs)
 
     addr = read_cr2();
 
+    /*
+     * Don't re-enable interrupts if we were running an IRQ-off region when
+     * we hit the page fault, or we'll break that code.
+     */
+    ASSERT(!local_irq_is_enabled());
+    if ( regs->flags & X86_EFLAGS_IF )
+        local_irq_enable();
+
     /* fixup_page_fault() might change regs->error_code, so cache it here. */
     error_code = regs->error_code;
 
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index b8482de8ee..9b0cdb7640 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -844,9 +844,9 @@ handle_exception_saved:
 #elif !defined(CONFIG_PV)
         ASSERT_CONTEXT_IS_XEN
 #endif /* CONFIG_PV */
-        sti
-1:      movq  %rsp,%rdi
-        movzbl UREGS_entry_vector(%rsp),%eax
+.Ldispatch_exceptions:
+        mov   %rsp, %rdi
+        movzbl UREGS_entry_vector(%rsp), %eax
 #ifdef CONFIG_PERF_COUNTERS
         lea   per_cpu__perfcounters(%rip), %rcx
         add   STACK_CPUINFO_FIELD(per_cpu_offset)(%r14), %rcx
@@ -866,7 +866,19 @@ handle_exception_saved:
         jmp   .L_exn_dispatch_done;    \
 .L_ ## vec ## _done:
 
+        /*
+         * IRQs kept off to derisk being hit by a nested interrupt before
+         * reading %cr2. Otherwise a page fault in the nested interrupt handler
+         * would corrupt %cr2.
+         */
         DISPATCH(X86_EXC_PF, do_page_fault)
+
+        /* Only re-enable IRQs if they were active before taking the fault */
+        testb $X86_EFLAGS_IF >> 8, UREGS_eflags + 1(%rsp)
+        jz    1f
+        sti
+1:
+
         DISPATCH(X86_EXC_GP, do_general_protection)
         DISPATCH(X86_EXC_UD, do_invalid_op)
         DISPATCH(X86_EXC_NM, do_device_not_available)
@@ -911,7 +923,7 @@ exception_with_ints_disabled:
         movq  %rsp,%rdi
         call  search_pre_exception_table
         testq %rax,%rax                 # no fixup code for faulting EIP?
-        jz    1b
+        jz    .Ldispatch_exceptions
         movq  %rax,UREGS_rip(%rsp)      # fixup regular stack
 
 #ifdef CONFIG_XEN_SHSTK
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 01 07:55:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 01 Oct 2024 07:55:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807786.1219435 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svXjB-0003rT-RQ; Tue, 01 Oct 2024 07:55:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807786.1219435; Tue, 01 Oct 2024 07: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 1svXjB-0003rM-Os; Tue, 01 Oct 2024 07:55:25 +0000
Received: by outflank-mailman (input) for mailman id 807786;
 Tue, 01 Oct 2024 07: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 1svXjA-0003rD-GN
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 07: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 1svXjA-00054C-Fc
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 07:55:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svXjA-0004HQ-Dt
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 07: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=/Gd+jsZXJLzIH7E6aCTPje9JpEC0VjgDE4N/Xrzosuo=; b=4mE26q6F7hsHzxj8Sp9U+YRoP0
	SP2EYUfr1x85inMxwyH2J0GWtsECPSylUaXkq9uQmJWRbObck6RR65UpFzHgJ1JqTKt+NcO1YlZkz
	PISWvqvokE+injWFQkQpybcbMWGtEQmO1gIheAn/AIM6vnhvPDJ9kvytJqoiLfXD6wtQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] iommu/amd-vi: make IOMMU list ro after init
Message-Id: <E1svXjA-0004HQ-Dt@xenbits.xenproject.org>
Date: Tue, 01 Oct 2024 07:55:24 +0000

commit db70a52f751626e3fc7d803dcc18fba2511cf073
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Oct 1 09:46:09 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 1 09:46:09 2024 +0200

    iommu/amd-vi: make IOMMU list ro after init
    
    The only functions to modify the list, amd_iommu_detect_one_acpi() and
    amd_iommu_init_cleanup(), are already init.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/amd/iommu_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index 6c0dc2d5cb..3023625020 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -32,7 +32,7 @@ unsigned int __read_mostly amd_iommu_acpi_info;
 unsigned int __read_mostly ivrs_bdf_entries;
 u8 __read_mostly ivhd_type;
 static struct radix_tree_root ivrs_maps;
-LIST_HEAD_READ_MOSTLY(amd_iommu_head);
+LIST_HEAD_RO_AFTER_INIT(amd_iommu_head);
 bool iommuv2_enabled;
 
 bool __ro_after_init amd_iommu_perdev_intremap = true;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 01 07:55:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 01 Oct 2024 07:55:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807787.1219438 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svXjL-0003u0-Sx; Tue, 01 Oct 2024 07:55:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807787.1219438; Tue, 01 Oct 2024 07: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 1svXjL-0003ts-QJ; Tue, 01 Oct 2024 07:55:35 +0000
Received: by outflank-mailman (input) for mailman id 807787;
 Tue, 01 Oct 2024 07: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 1svXjK-0003td-KH
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 07: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 1svXjK-00054J-JY
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 07:55:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svXjK-0004IM-Hl
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 07: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=+acfLJ5neczOZ584go17vw9XpH+pzJ3GNXXUJ2abN1M=; b=XbFsgA8TZ1yb3Ub8OqE4bdl78c
	8wV8ol92vJpwlptWaIhHtMYSzJz+HzRAXRMbyrUavAP+l1mMv/AsqsLlqcskDAXOgQOHCEDvMaP7B
	SsKmuiWF+X52j3J4T7y2FeqhFx4vgjxOcut2bMsNLaNcfsUf0hM1XwxNG06BqPwOg884=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: use alternative_input() in cache_flush()
Message-Id: <E1svXjK-0004IM-Hl@xenbits.xenproject.org>
Date: Tue, 01 Oct 2024 07:55:34 +0000

commit b42cf31d1165f06032f205a2bd71f5d099ea2218
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Oct 1 09:47:05 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 1 09:47:05 2024 +0200

    x86: use alternative_input() in cache_flush()
    
    There's no point using alternative_io() when there are no outputs. While
    there drop the unnecessary semicolon after "ds".
    
    No functional change.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/flushtlb.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/flushtlb.c b/xen/arch/x86/flushtlb.c
index 18748b2bc8..2a70c5151b 100644
--- a/xen/arch/x86/flushtlb.c
+++ b/xen/arch/x86/flushtlb.c
@@ -286,11 +286,10 @@ void cache_flush(const void *addr, unsigned int size)
          * + prefix than a clflush + nop, and hence the prefix is added instead
          * of letting the alternative framework fill the gap by appending nops.
          */
-        alternative_io("ds; clflush %[p]",
-                       "data16 clflush %[p]", /* clflushopt */
-                       X86_FEATURE_CLFLUSHOPT,
-                       /* no outputs */,
-                       [p] "m" (*(const char *)(addr)));
+        alternative_input("ds clflush %[p]",
+                          "data16 clflush %[p]", /* clflushopt */
+                           X86_FEATURE_CLFLUSHOPT,
+                           [p] "m" (*(const char *)(addr)));
     }
 
     alternative_2("",
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 01 07:55:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 01 Oct 2024 07:55:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.807788.1219443 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svXjV-0003x9-UW; Tue, 01 Oct 2024 07:55:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 807788.1219443; Tue, 01 Oct 2024 07: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 1svXjV-0003x1-Rm; Tue, 01 Oct 2024 07:55:45 +0000
Received: by outflank-mailman (input) for mailman id 807788;
 Tue, 01 Oct 2024 07: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 1svXjU-0003we-NP
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 07: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 1svXjU-00054Q-Mc
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 07:55:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svXjU-0004JB-Lf
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 07: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=ZqpTexrxvoxhYe9lWBpb18TiFlCwLg0Gig3+e9tKvtQ=; b=GRijGJvptJkmuAegWpK5u6Y2lw
	fExXEvf4ipfHc/u9wX7Xp2M4SV/CHySky+ZcRYgxPSc3NaWA6xygP9XP1Z9VmUupn0iIfoAkJ6SIB
	9XGg/YuTjFhH7JbRdnOP1tuqW54szAIlIqC8ZICh2J3SCMmpbwsig7ZQ6Ml5ZmFYcWck=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/MSR: improve code gen for rdmsr_safe() and rdtsc()
Message-Id: <E1svXjU-0004JB-Lf@xenbits.xenproject.org>
Date: Tue, 01 Oct 2024 07:55:44 +0000

commit 66878a8b7566e9a98d20b69ab95ddaffe1130683
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Oct 1 09:47:32 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 1 09:47:32 2024 +0200

    x86/MSR: improve code gen for rdmsr_safe() and rdtsc()
    
    To fold two 32-bit outputs from the asm()-s into a single 64-bit value
    the compiler needs to emit a zero-extension insn for the low half. Both
    RDMSR and RDTSC clear the upper halves of their output registers anyway,
    though. So despite that zero-extending insn (a simple MOV) being cheap,
    we can do better: Without one, by declaring the local variables as 64-
    bit ones.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/msr.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index c95330a5a1..e1e7439d6c 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -54,17 +54,17 @@ static inline void wrmsr_ns(uint32_t msr, uint32_t lo, uint32_t hi)
 /* rdmsr with exception handling */
 #define rdmsr_safe(msr,val) ({\
     int rc_; \
-    uint32_t lo_, hi_; \
+    uint64_t lo_, hi_; \
     __asm__ __volatile__( \
         "1: rdmsr\n2:\n" \
         ".section .fixup,\"ax\"\n" \
-        "3: xorl %0,%0\n; xorl %1,%1\n" \
+        "3: xorl %k0,%k0\n; xorl %k1,%k1\n" \
         "   movl %5,%2\n; jmp 2b\n" \
         ".previous\n" \
         _ASM_EXTABLE(1b, 3b) \
         : "=a" (lo_), "=d" (hi_), "=&r" (rc_) \
         : "c" (msr), "2" (0), "i" (-EFAULT)); \
-    val = lo_ | ((uint64_t)hi_ << 32); \
+    val = lo_ | (hi_ << 32); \
     rc_; })
 
 /* wrmsr with exception handling */
@@ -99,11 +99,11 @@ static inline void msr_split(struct cpu_user_regs *regs, uint64_t val)
 
 static inline uint64_t rdtsc(void)
 {
-    uint32_t low, high;
+    uint64_t low, high;
 
     __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high));
 
-    return ((uint64_t)high << 32) | low;
+    return (high << 32) | low;
 }
 
 static inline uint64_t rdtsc_ordered(void)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 01 17:11:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 01 Oct 2024 17:11:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.808414.1220325 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svgOw-0008Ga-CP; Tue, 01 Oct 2024 17:11:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 808414.1220325; Tue, 01 Oct 2024 17: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 1svgOw-0008GS-9L; Tue, 01 Oct 2024 17:11:06 +0000
Received: by outflank-mailman (input) for mailman id 808414;
 Tue, 01 Oct 2024 17: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 1svgOu-0008GM-Ga
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 17: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 1svgOu-0007sg-5W
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 17:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svgOu-0006YD-3v
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 17: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=aM2hRBXFXokAGKU0EkjPXh9Aqp1in2ii3YL5o45EFLQ=; b=PDc8KInD+CH+gM0X//INsKXIig
	+NBeGlm2Kn+TrDWrPmEoWkiXvgl0PHdgeO47O9rHclNvabXrXC13TNT55TTtlher0nP2a2MwJFMIC
	sxkjje9FkPe7cqwwAkhmtzxVDi6FT3tMoT47XrY/0haFZfQM+OnLJv26/1FKSTxehoK8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/pv: Rework guest_io_okay() to return X86EMUL_*
Message-Id: <E1svgOu-0006YD-3v@xenbits.xenproject.org>
Date: Tue, 01 Oct 2024 17:11:04 +0000

commit 7429e1cc071b0e20ea9581da4893fb9b2f6d21d4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Sep 30 16:09:51 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 1 14:58:18 2024 +0100

    x86/pv: Rework guest_io_okay() to return X86EMUL_*
    
    In order to fix a bug with guest_io_okay() (subsequent patch), rework
    guest_io_okay() to take in an emulation context, and return X86EMUL_* rather
    than a boolean.
    
    For the failing case, take the opportunity to inject #GP explicitly, rather
    than returning X86EMUL_UNHANDLEABLE.  There is a logical difference between
    "we know what this is, and it's #GP", vs "we don't know what this is".
    
    There is no change in practice as emulation is the final step on general #GP
    resolution, but returning X86EMUL_UNHANDLEABLE would be a latent bug if a
    subsequent action were to appear.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/pv/emul-priv-op.c | 36 +++++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index b90f745c75..cc66ffbf8e 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -156,14 +156,16 @@ static bool iopl_ok(const struct vcpu *v, const struct cpu_user_regs *regs)
 }
 
 /* Has the guest requested sufficient permission for this I/O access? */
-static bool guest_io_okay(unsigned int port, unsigned int bytes,
-                          struct vcpu *v, struct cpu_user_regs *regs)
+static int guest_io_okay(unsigned int port, unsigned int bytes,
+                         struct x86_emulate_ctxt *ctxt)
 {
+    const struct cpu_user_regs *regs = ctxt->regs;
+    struct vcpu *v = current;
     /* If in user mode, switch to kernel mode just to read I/O bitmap. */
     const bool user_mode = !(v->arch.flags & TF_kernel_mode);
 
     if ( iopl_ok(v, regs) )
-        return true;
+        return X86EMUL_OKAY;
 
     if ( (port + bytes) <= v->arch.pv.iobmp_limit )
     {
@@ -190,10 +192,12 @@ static bool guest_io_okay(unsigned int port, unsigned int bytes,
             toggle_guest_pt(v);
 
         if ( (x.mask & (((1 << bytes) - 1) << (port & 7))) == 0 )
-            return true;
+            return X86EMUL_OKAY;
     }
 
-    return false;
+    x86_emul_hw_exception(X86_EXC_GP, 0, ctxt);
+
+    return X86EMUL_EXCEPTION;
 }
 
 /* Has the administrator granted sufficient permission for this I/O access? */
@@ -353,12 +357,14 @@ static int cf_check read_io(
     struct priv_op_ctxt *poc = container_of(ctxt, struct priv_op_ctxt, ctxt);
     struct vcpu *curr = current;
     struct domain *currd = current->domain;
+    int rc;
 
     /* INS must not come here. */
     ASSERT((ctxt->opcode & ~9) == 0xe4);
 
-    if ( !guest_io_okay(port, bytes, curr, ctxt->regs) )
-        return X86EMUL_UNHANDLEABLE;
+    rc = guest_io_okay(port, bytes, ctxt);
+    if ( rc != X86EMUL_OKAY )
+        return rc;
 
     poc->bpmatch = check_guest_io_breakpoint(curr, port, bytes);
 
@@ -458,12 +464,14 @@ static int cf_check write_io(
     struct priv_op_ctxt *poc = container_of(ctxt, struct priv_op_ctxt, ctxt);
     struct vcpu *curr = current;
     struct domain *currd = current->domain;
+    int rc;
 
     /* OUTS must not come here. */
     ASSERT((ctxt->opcode & ~9) == 0xe6);
 
-    if ( !guest_io_okay(port, bytes, curr, ctxt->regs) )
-        return X86EMUL_UNHANDLEABLE;
+    rc = guest_io_okay(port, bytes, ctxt);
+    if ( rc != X86EMUL_OKAY )
+        return rc;
 
     poc->bpmatch = check_guest_io_breakpoint(curr, port, bytes);
 
@@ -612,8 +620,9 @@ static int cf_check rep_ins(
 
     *reps = 0;
 
-    if ( !guest_io_okay(port, bytes_per_rep, curr, ctxt->regs) )
-        return X86EMUL_UNHANDLEABLE;
+    rc = guest_io_okay(port, bytes_per_rep, ctxt);
+    if ( rc != X86EMUL_OKAY )
+        return rc;
 
     rc = read_segment(x86_seg_es, &sreg, ctxt);
     if ( rc != X86EMUL_OKAY )
@@ -678,8 +687,9 @@ static int cf_check rep_outs(
 
     *reps = 0;
 
-    if ( !guest_io_okay(port, bytes_per_rep, curr, ctxt->regs) )
-        return X86EMUL_UNHANDLEABLE;
+    rc = guest_io_okay(port, bytes_per_rep, ctxt);
+    if ( rc != X86EMUL_OKAY )
+        return rc;
 
     rc = read_segment(seg, &sreg, ctxt);
     if ( rc != X86EMUL_OKAY )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 01 17:11:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 01 Oct 2024 17:11:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.808415.1220328 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svgP5-0008Id-DM; Tue, 01 Oct 2024 17:11:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 808415.1220328; Tue, 01 Oct 2024 17: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 1svgP5-0008IV-Ar; Tue, 01 Oct 2024 17:11:15 +0000
Received: by outflank-mailman (input) for mailman id 808415;
 Tue, 01 Oct 2024 17: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 1svgP4-0008IM-A9
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 17: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 1svgP4-0007sr-9R
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 17:11:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svgP4-0006ZN-7h
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 17: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=GqKLSZ0P6EeWDJ88Uy97ok7RFJc914O5NfLyGvXLnRw=; b=jYXvFxjhXXQOJRZfbYWxxWtxIH
	vvQlN2LKGwzaf2bFGA4RWsx4PdUbjNx5tGb4j/i8jOWOT3KAFYRE2eiyfYB9VhdJE6rLOgyIGriwI
	jexSNwSyHFYayEI3Hp0oG4B7a04RdJzChbNQWpJHzvsuhDHlSTugxsFah41eVI2bSW/o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/pv: Handle #PF correctly when reading the IO permission bitmap
Message-Id: <E1svgP4-0006ZN-7h@xenbits.xenproject.org>
Date: Tue, 01 Oct 2024 17:11:14 +0000

commit 8a6c495d725408d333c1b47bb8af44615a5bfb18
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Sep 30 16:20:29 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 1 14:58:18 2024 +0100

    x86/pv: Handle #PF correctly when reading the IO permission bitmap
    
    The switch statement in guest_io_okay() is a very expensive way of
    pre-initialising x with ~0, and performing a partial read into it.
    
    However, the logic isn't correct either.
    
    In a real TSS, the CPU always reads two bytes (like here), and any TSS limit
    violation turns silently into no-access.  But, in-limit accesses trigger #PF
    as usual.  AMD document this property explicitly, and while Intel don't (so
    far as I can tell), they do behave consistently with AMD.
    
    Switch from __copy_from_guest_offset() to __copy_from_guest_pv(), like
    everything else in this file.  This removes code generation setting up
    copy_from_user_hvm() (in the likely path even), and safety LFENCEs from
    evaluate_nospec().
    
    Change the logic to raise #PF if __copy_from_guest_pv() fails, rather than
    disallowing the IO port access.  This brings the behaviour better in line with
    normal x86.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/pv/emul-priv-op.c | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index cc66ffbf8e..e35285d4ab 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -169,29 +169,26 @@ static int guest_io_okay(unsigned int port, unsigned int bytes,
 
     if ( (port + bytes) <= v->arch.pv.iobmp_limit )
     {
-        union { uint8_t bytes[2]; uint16_t mask; } x;
+        const void *__user addr = v->arch.pv.iobmp.p + (port >> 3);
+        uint16_t mask;
+        int rc;
 
-        /*
-         * Grab permission bytes from guest space. Inaccessible bytes are
-         * read as 0xff (no access allowed).
-         */
+        /* Grab permission bytes from guest space. */
         if ( user_mode )
             toggle_guest_pt(v);
 
-        switch ( __copy_from_guest_offset(x.bytes, v->arch.pv.iobmp,
-                                          port>>3, 2) )
-        {
-        default: x.bytes[0] = ~0;
-            /* fallthrough */
-        case 1:  x.bytes[1] = ~0;
-            /* fallthrough */
-        case 0:  break;
-        }
+        rc = __copy_from_guest_pv(&mask, addr, 2);
 
         if ( user_mode )
             toggle_guest_pt(v);
 
-        if ( (x.mask & (((1 << bytes) - 1) << (port & 7))) == 0 )
+        if ( rc )
+        {
+            x86_emul_pagefault(0, (unsigned long)addr + bytes - rc, ctxt);
+            return X86EMUL_EXCEPTION;
+        }
+
+        if ( (mask & (((1 << bytes) - 1) << (port & 7))) == 0 )
             return X86EMUL_OKAY;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 01 17:11:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 01 Oct 2024 17:11:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.808416.1220332 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svgPF-0008LE-Ek; Tue, 01 Oct 2024 17:11:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 808416.1220332; Tue, 01 Oct 2024 17:11: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 1svgPF-0008L7-CK; Tue, 01 Oct 2024 17:11:25 +0000
Received: by outflank-mailman (input) for mailman id 808416;
 Tue, 01 Oct 2024 17: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 1svgPE-0008Kq-DX
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 17: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 1svgPE-0007sz-Ci
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 17:11:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svgPE-0006aV-Bh
 for xen-changelog@lists.xenproject.org; Tue, 01 Oct 2024 17: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=GpDfMK8RHp2KOiLrN7S9sWm+x6YnuLHThUr3ttgJ63o=; b=2k15YhSBk/a9cOpCvY/czl+Ynu
	8b8W3u+LS9n8DGdiMAG2dfxh6vbWmgx/+XKIUrxEUQgir12GBsSq8ECml7CI5jkK4Vs6ROtrJbyjj
	l+M4iZhvk3OW4PiVKUAp2DzVYKXHURIn+LZUBBfxzu/HRl5/cVMuPMa1GRaOwIYlVpdQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/pv: Rename pv.iobmp_limit to iobmp_nr and clarify behaviour
Message-Id: <E1svgPE-0006aV-Bh@xenbits.xenproject.org>
Date: Tue, 01 Oct 2024 17:11:24 +0000

commit 633ee8b2df963f7e5cb8de1219c1a48bfb4447f6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Oct 1 13:00:13 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 1 14:58:18 2024 +0100

    x86/pv: Rename pv.iobmp_limit to iobmp_nr and clarify behaviour
    
    Ever since it's introduction in commit 013351bd7ab3 ("Define new event-channel
    and physdev hypercalls") in 2006, the public interface was named nr_ports
    while the internal field was called iobmp_limit.
    
    Rename the internal field to iobmp_nr to match the public interface, and
    clarify that, when nonzero, Xen will read 2 bytes.
    
    There isn't a perfect parallel with a real TSS, but iobmp_nr being 0 is the
    paravirt "no IOPB" case, and it is important that no read occurs in this case.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/domain.h | 2 +-
 xen/arch/x86/physdev.c            | 2 +-
 xen/arch/x86/pv/emul-priv-op.c    | 6 +++++-
 xen/include/public/physdev.h      | 3 +++
 4 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index 811251852f..bdcdb8de09 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -573,7 +573,7 @@ struct pv_vcpu
 
     /* I/O-port access bitmap. */
     XEN_GUEST_HANDLE(uint8) iobmp; /* Guest kernel vaddr of the bitmap. */
-    unsigned int iobmp_limit; /* Number of ports represented in the bitmap. */
+    unsigned int iobmp_nr;    /* Number of ports represented in the bitmap. */
 #define IOPL(val) MASK_INSR(val, X86_EFLAGS_IOPL)
     unsigned int iopl;        /* Current IOPL for this VCPU, shifted left by
                                * 12 to match the eflags register. */
diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c
index d6dd622952..69fd42667c 100644
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
@@ -436,7 +436,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 #else
         guest_from_compat_handle(curr->arch.pv.iobmp, set_iobitmap.bitmap);
 #endif
-        curr->arch.pv.iobmp_limit = set_iobitmap.nr_ports;
+        curr->arch.pv.iobmp_nr = set_iobitmap.nr_ports;
         break;
     }
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index e35285d4ab..70150c2722 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -167,7 +167,11 @@ static int guest_io_okay(unsigned int port, unsigned int bytes,
     if ( iopl_ok(v, regs) )
         return X86EMUL_OKAY;
 
-    if ( (port + bytes) <= v->arch.pv.iobmp_limit )
+    /*
+     * When @iobmp_nr is non-zero, Xen, like real CPUs and the TSS IOPB,
+     * always reads 2 bytes from @iobmp, which might be one byte @iobmp_nr.
+     */
+    if ( (port + bytes) <= v->arch.pv.iobmp_nr )
     {
         const void *__user addr = v->arch.pv.iobmp.p + (port >> 3);
         uint16_t mask;
diff --git a/xen/include/public/physdev.h b/xen/include/public/physdev.h
index 45e1c18541..3149049a9a 100644
--- a/xen/include/public/physdev.h
+++ b/xen/include/public/physdev.h
@@ -87,6 +87,9 @@ DEFINE_XEN_GUEST_HANDLE(physdev_set_iopl_t);
 /*
  * Set the current VCPU's I/O-port permissions bitmap.
  * @arg == pointer to physdev_set_iobitmap structure.
+ *
+ * When @nr_ports is non-zero, Xen, like real CPUs and the TSS IOPB, always
+ * reads 2 bytes from @bitmap, which might be one byte beyond @nr_ports.
  */
 #define PHYSDEVOP_set_iobitmap           7
 struct physdev_set_iobitmap {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 02 00:44:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 02 Oct 2024 00:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.808539.1220459 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svnTJ-0001ZV-Vh; Wed, 02 Oct 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 808539.1220459; Wed, 02 Oct 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 1svnTJ-0001ZN-Sw; Wed, 02 Oct 2024 00:44:05 +0000
Received: by outflank-mailman (input) for mailman id 808539;
 Wed, 02 Oct 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 1svnTI-0001ZH-75
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 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 1svnTI-0007ov-24
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 00:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svnTI-0008F3-0Y
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 00: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=QNfKaWiWbiOXR1dKcTiYwL0cHZPvrOK9xe7uvbJ3tr4=; b=DY1U24aKxmXD4ymYQ2Nu1SWJ41
	dj4KUalR3zTnZBzXvRB+87AaAicsFIY5ADRrTx2afzYxtidiOfqY+3pixeLEqVO8ROKEcQsg/TI+d
	u0UK65Q9mu0INbuZaw9Y2YnYCPP8l0wy25SCgj37gxSUIGvOwH9btD4nVTFlEISEgQco=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: fusa: Add Assumption of Use (AOU)
Message-Id: <E1svnTI-0008F3-0Y@xenbits.xenproject.org>
Date: Wed, 02 Oct 2024 00:44:04 +0000

commit f9ce66ea9d24aa8b26fcb2c18828caf314328ca3
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Sep 24 09:29:23 2024 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Oct 1 17:32:15 2024 -0700

    docs: fusa: Add Assumption of Use (AOU)
    
    AoU are the assumptions that Xen relies on other components (eg platform
    platform, domains) to fulfill its requirements. In our case, platform means
    a combination of hardware, firmware and bootloader.
    
    We have defined AoU in the intro.rst and added AoU for the generic
    timer.
    
    Also, fixed a requirement to denote that Xen shall **not** expose the
    system counter frequency via the "clock-frequency" device tree property.
    The reason being the device tree documentation strongly discourages the
    use of this peoperty. Further if the "clock-frequency" is exposed, then
    it overrides the value programmed in the CNTFRQ_EL0 register.
    
    So, the frequency shall be exposed via the CNTFRQ_EL0 register only and
    consequently there is an assumption on the platform to program the
    register correctly.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/fusa/reqs/design-reqs/arm64/generic-timer.rst | 24 +++++++++++++++++++++-
 docs/fusa/reqs/intro.rst                           | 10 +++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/docs/fusa/reqs/design-reqs/arm64/generic-timer.rst b/docs/fusa/reqs/design-reqs/arm64/generic-timer.rst
index f2a0cd7fb8..9d2a5a8085 100644
--- a/docs/fusa/reqs/design-reqs/arm64/generic-timer.rst
+++ b/docs/fusa/reqs/design-reqs/arm64/generic-timer.rst
@@ -30,7 +30,7 @@ Read system counter frequency
 
 Description:
 Xen shall expose the frequency of the system counter to the domains in
-CNTFRQ_EL0 register and/or domain device tree's "clock-frequency" property.
+CNTFRQ_EL0 register.
 
 Rationale:
 
@@ -116,6 +116,28 @@ Rationale:
 
 Comments:
 
+Covers:
+ - `XenProd~emulated_timer~1`
+
+Assumption of Use on the Platform
+=================================
+
+Expose system timer frequency via register
+------------------------------------------
+
+`XenSwdgn~arm64_generic_timer_plat_program_cntfrq_el0~1`
+
+Description:
+CNTFRQ_EL0 register shall be programmed with the value of the system timer
+frequency.
+
+Rationale:
+Xen reads the CNTFRQ_EL0 register to get the value of system timer frequency.
+
+Comments:
+While there is a provision to get this value by reading the "clock-frequency"
+dt property [2], the use of this property is strongly discouraged.
+
 Covers:
  - `XenProd~emulated_timer~1`
 
diff --git a/docs/fusa/reqs/intro.rst b/docs/fusa/reqs/intro.rst
index 245a219ff2..d8b43f5785 100644
--- a/docs/fusa/reqs/intro.rst
+++ b/docs/fusa/reqs/intro.rst
@@ -38,6 +38,16 @@ The requirements are linked using OpenFastTrace
 OpenFastTrace parses through the requirements and generates a traceability
 report.
 
+Assumption of Use
+=================
+
+Xen is making several assumptions on the status of the platform or on some
+functions being present and operational. For example, Xen might assume that
+some registers are set.
+Anybody who wants to use Xen must validate that the platform it is used on
+(meaning the hardware and any software running before Xen like the firmware)
+fulfils all the AoU described by Xen.
+
 The following is the skeleton for a requirement.
 
 Title of the requirement
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 02 01:11:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 02 Oct 2024 01:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.808540.1220462 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svntP-0006cZ-Q0; Wed, 02 Oct 2024 01:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 808540.1220462; Wed, 02 Oct 2024 01:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svntP-0006cS-NB; Wed, 02 Oct 2024 01:11:03 +0000
Received: by outflank-mailman (input) for mailman id 808540;
 Wed, 02 Oct 2024 01: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 1svntO-0006cM-CC
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 01: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 1svntN-00012p-UC
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 01:11:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svntN-0002lc-RP
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 01: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=oQniMB28u2sPZek7ri1CIjHXa2SSp6FOxeZuvLD0Ecg=; b=bVlTlImrhZ48NeynxfoIzdaq63
	HLx/o8W3wECE2yJPAiPHWMP9MiSFsDxg8sepEBsFBLAVB+8nP2KB+Z5c5NhsHALiTmUveN0Ygz8Q8
	calMwFVK+2ZCnwC2ky/WtQ/3TQ/ssG48rNBYaIMxsDJ2yMxYPIuAy1HaS8YKhQJpnS/8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] drivers/video: Convert source files to UTF-8
Message-Id: <E1svntN-0002lc-RP@xenbits.xenproject.org>
Date: Wed, 02 Oct 2024 01:11:01 +0000

commit 94423b8f75bd786043f8e9bb2809675007225329
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Thu Sep 26 16:46:06 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Sep 30 17:52:24 2024 +0100

    drivers/video: Convert source files to UTF-8
    
    Most of the tools nowadays assume this encoding.
    These files do not specify any encoding so convert them to the default.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/drivers/video/font_8x14.c | 256 +++++++++++++++++++++---------------------
 xen/drivers/video/font_8x16.c | 256 +++++++++++++++++++++---------------------
 xen/drivers/video/font_8x8.c  | 256 +++++++++++++++++++++---------------------
 3 files changed, 384 insertions(+), 384 deletions(-)

diff --git a/xen/drivers/video/font_8x14.c b/xen/drivers/video/font_8x14.c
index e80d178c38..b0210de3e1 100644
--- a/xen/drivers/video/font_8x14.c
+++ b/xen/drivers/video/font_8x14.c
@@ -2059,7 +2059,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 128 0x80 ' */
+    /* 128 0x80 'Ç' */
     0x00, /* 00000000 */
     0x3c, /* 00111100 */
     0x66, /* 01100110 */
@@ -2075,7 +2075,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x70, /* 01110000 */
     0x00, /* 00000000 */
 
-    /* 129 0x81 ' */
+    /* 129 0x81 'ü' */
     0x00, /* 00000000 */
     0xcc, /* 11001100 */
     0x00, /* 00000000 */
@@ -2091,7 +2091,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 130 0x82 ' */
+    /* 130 0x82 'é' */
     0x0c, /* 00001100 */
     0x18, /* 00011000 */
     0x30, /* 00110000 */
@@ -2107,7 +2107,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 131 0x83 ' */
+    /* 131 0x83 'â' */
     0x10, /* 00010000 */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
@@ -2123,7 +2123,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 132 0x84 ' */
+    /* 132 0x84 'ä' */
     0x00, /* 00000000 */
     0xcc, /* 11001100 */
     0x00, /* 00000000 */
@@ -2139,7 +2139,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 133 0x85 ' */
+    /* 133 0x85 'à' */
     0x60, /* 01100000 */
     0x30, /* 00110000 */
     0x18, /* 00011000 */
@@ -2155,7 +2155,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 134 0x86 ' */
+    /* 134 0x86 'å' */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
     0x38, /* 00111000 */
@@ -2171,7 +2171,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 135 0x87 ' */
+    /* 135 0x87 'ç' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -2187,7 +2187,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x70, /* 01110000 */
     0x00, /* 00000000 */
 
-    /* 136 0x88 ' */
+    /* 136 0x88 'ê' */
     0x10, /* 00010000 */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
@@ -2203,7 +2203,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 137 0x89 ' */
+    /* 137 0x89 'ë' */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
@@ -2219,7 +2219,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 138 0x8a ' */
+    /* 138 0x8a 'è' */
     0x60, /* 01100000 */
     0x30, /* 00110000 */
     0x18, /* 00011000 */
@@ -2235,7 +2235,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 139 0x8b ' */
+    /* 139 0x8b 'ï' */
     0x00, /* 00000000 */
     0x66, /* 01100110 */
     0x00, /* 00000000 */
@@ -2251,7 +2251,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 140 0x8c ' */
+    /* 140 0x8c 'î' */
     0x18, /* 00011000 */
     0x3c, /* 00111100 */
     0x66, /* 01100110 */
@@ -2267,7 +2267,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 141 0x8d ' */
+    /* 141 0x8d 'ì' */
     0x60, /* 01100000 */
     0x30, /* 00110000 */
     0x18, /* 00011000 */
@@ -2283,7 +2283,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 142 0x8e ' */
+    /* 142 0x8e 'Ä' */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
     0x10, /* 00010000 */
@@ -2299,7 +2299,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 143 0x8f ' */
+    /* 143 0x8f 'Å' */
     0x6c, /* 01101100 */
     0x38, /* 00111000 */
     0x10, /* 00010000 */
@@ -2315,7 +2315,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 144 0x90 ' */
+    /* 144 0x90 'É' */
     0x18, /* 00011000 */
     0x00, /* 00000000 */
     0xfe, /* 11111110 */
@@ -2331,7 +2331,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 145 0x91 ' */
+    /* 145 0x91 'æ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -2347,7 +2347,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 146 0x92 'È */
+    /* 146 0x92 'Æ' */
     0x00, /* 00000000 */
     0x3e, /* 00111110 */
     0x6c, /* 01101100 */
@@ -2363,7 +2363,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 147 0x93 'ň */
+    /* 147 0x93 'ô' */
     0x10, /* 00010000 */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
@@ -2379,7 +2379,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 148 0x94 'ǈ */
+    /* 148 0x94 'ö' */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
@@ -2395,7 +2395,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 149 0x95 'Ɉ */
+    /* 149 0x95 'ò' */
     0x60, /* 01100000 */
     0x30, /* 00110000 */
     0x18, /* 00011000 */
@@ -2411,7 +2411,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 150 0x96 'ˈ */
+    /* 150 0x96 'û' */
     0x30, /* 00110000 */
     0x78, /* 01111000 */
     0xcc, /* 11001100 */
@@ -2427,7 +2427,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 151 0x97 '͈ */
+    /* 151 0x97 'ù' */
     0x60, /* 01100000 */
     0x30, /* 00110000 */
     0x18, /* 00011000 */
@@ -2443,7 +2443,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 152 0x98 'ψ */
+    /* 152 0x98 'ÿ' */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
@@ -2459,7 +2459,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x0c, /* 00001100 */
     0x78, /* 01111000 */
 
-    /* 153 0x99 'ш */
+    /* 153 0x99 'Ö' */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
     0x7c, /* 01111100 */
@@ -2475,7 +2475,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 154 0x9a 'ӈ */
+    /* 154 0x9a 'Ü' */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
@@ -2491,7 +2491,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 155 0x9b 'Ո */
+    /* 155 0x9b '¢' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x7c, /* 01111100 */
@@ -2507,7 +2507,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 156 0x9c '׈ */
+    /* 156 0x9c '£' */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
     0x64, /* 01100100 */
@@ -2523,7 +2523,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 157 0x9d 'و */
+    /* 157 0x9d '¥' */
     0x00, /* 00000000 */
     0x66, /* 01100110 */
     0x66, /* 01100110 */
@@ -2539,7 +2539,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 158 0x9e 'ۈ */
+    /* 158 0x9e '₧' */
     0xf8, /* 11111000 */
     0xcc, /* 11001100 */
     0xcc, /* 11001100 */
@@ -2555,7 +2555,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 159 0x9f '݈ */
+    /* 159 0x9f 'ƒ' */
     0x0e, /* 00001110 */
     0x1b, /* 00011011 */
     0x18, /* 00011000 */
@@ -2571,7 +2571,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 160 0xa0 '' */
+    /* 160 0xa0 'á' */
     0x18, /* 00011000 */
     0x30, /* 00110000 */
     0x60, /* 01100000 */
@@ -2587,7 +2587,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 161 0xa1 '' */
+    /* 161 0xa1 'í' */
     0x0c, /* 00001100 */
     0x18, /* 00011000 */
     0x30, /* 00110000 */
@@ -2603,7 +2603,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 162 0xa2 '' */
+    /* 162 0xa2 'ó' */
     0x18, /* 00011000 */
     0x30, /* 00110000 */
     0x60, /* 01100000 */
@@ -2619,7 +2619,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 163 0xa3 '' */
+    /* 163 0xa3 'ú' */
     0x18, /* 00011000 */
     0x30, /* 00110000 */
     0x60, /* 01100000 */
@@ -2635,7 +2635,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 164 0xa4 '' */
+    /* 164 0xa4 'ñ' */
     0x00, /* 00000000 */
     0x76, /* 01110110 */
     0xdc, /* 11011100 */
@@ -2651,7 +2651,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 165 0xa5 '' */
+    /* 165 0xa5 'Ñ' */
     0xdc, /* 11011100 */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
@@ -2667,7 +2667,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 166 0xa6 '' */
+    /* 166 0xa6 'ª' */
     0x00, /* 00000000 */
     0x3c, /* 00111100 */
     0x6c, /* 01101100 */
@@ -2683,7 +2683,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 167 0xa7 '' */
+    /* 167 0xa7 'º' */
     0x00, /* 00000000 */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
@@ -2699,7 +2699,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 168 0xa8 '' */
+    /* 168 0xa8 '¿' */
     0x00, /* 00000000 */
     0x30, /* 00110000 */
     0x30, /* 00110000 */
@@ -2715,7 +2715,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 169 0xa9 '' */
+    /* 169 0xa9 '⌐' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -2731,7 +2731,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 170 0xaa '' */
+    /* 170 0xaa '¬' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -2747,7 +2747,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 171 0xab '' */
+    /* 171 0xab '½' */
     0x60, /* 01100000 */
     0xe0, /* 11100000 */
     0x62, /* 01100010 */
@@ -2763,7 +2763,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x3e, /* 00111110 */
     0x00, /* 00000000 */
 
-    /* 172 0xac '' */
+    /* 172 0xac '¼' */
     0x60, /* 01100000 */
     0xe0, /* 11100000 */
     0x62, /* 01100010 */
@@ -2779,7 +2779,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x06, /* 00000110 */
     0x00, /* 00000000 */
 
-    /* 173 0xad '' */
+    /* 173 0xad '¡' */
     0x00, /* 00000000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -2795,7 +2795,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 174 0xae '' */
+    /* 174 0xae '«' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -2811,7 +2811,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 175 0xaf '' */
+    /* 175 0xaf '»' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -2827,7 +2827,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 176 0xb0 '' */
+    /* 176 0xb0 '░' */
     0x44, /* 01000100 */
     0x11, /* 00010001 */
     0x44, /* 01000100 */
@@ -2843,7 +2843,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x44, /* 01000100 */
     0x11, /* 00010001 */
 
-    /* 177 0xb1 '' */
+    /* 177 0xb1 '▒' */
     0xaa, /* 10101010 */
     0x55, /* 01010101 */
     0xaa, /* 10101010 */
@@ -2859,7 +2859,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0xaa, /* 10101010 */
     0x55, /* 01010101 */
 
-    /* 178 0xb2 '' */
+    /* 178 0xb2 '▓' */
     0x77, /* 01110111 */
     0xdd, /* 11011101 */
     0x77, /* 01110111 */
@@ -2875,7 +2875,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x77, /* 01110111 */
     0xdd, /* 11011101 */
 
-    /* 179 0xb3 '' */
+    /* 179 0xb3 '│' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -2891,7 +2891,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 180 0xb4 '' */
+    /* 180 0xb4 '┤' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -2907,7 +2907,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 181 0xb5 '' */
+    /* 181 0xb5 '╡' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -2923,7 +2923,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 182 0xb6 '' */
+    /* 182 0xb6 '╢' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -2939,7 +2939,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 183 0xb7 '' */
+    /* 183 0xb7 '╖' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -2955,7 +2955,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 184 0xb8 '' */
+    /* 184 0xb8 '╕' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -2971,7 +2971,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 185 0xb9 '' */
+    /* 185 0xb9 '╣' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -2987,7 +2987,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 186 0xba '' */
+    /* 186 0xba '║' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3003,7 +3003,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 187 0xbb '' */
+    /* 187 0xbb '╗' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3019,7 +3019,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 188 0xbc '' */
+    /* 188 0xbc '╝' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3035,7 +3035,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 189 0xbd '' */
+    /* 189 0xbd '╜' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3051,7 +3051,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 190 0xbe '' */
+    /* 190 0xbe '╛' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3067,7 +3067,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 191 0xbf '' */
+    /* 191 0xbf '┐' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3083,7 +3083,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 192 0xc0 '' */
+    /* 192 0xc0 '└' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3099,7 +3099,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 193 0xc1 '' */
+    /* 193 0xc1 '┴' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3115,7 +3115,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 194 0xc2 '' */
+    /* 194 0xc2 '┬' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3131,7 +3131,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 195 0xc3 '' */
+    /* 195 0xc3 '├' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3147,7 +3147,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 196 0xc4 '' */
+    /* 196 0xc4 '─' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3163,7 +3163,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 197 0xc5 '' */
+    /* 197 0xc5 '┼' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3179,7 +3179,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 198 0xc6 '' */
+    /* 198 0xc6 '╞' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3195,7 +3195,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 199 0xc7 '' */
+    /* 199 0xc7 '╟' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3211,7 +3211,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 200 0xc8 '' */
+    /* 200 0xc8 '╚' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3227,7 +3227,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 201 0xc9 '' */
+    /* 201 0xc9 '╔' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3243,7 +3243,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 202 0xca '' */
+    /* 202 0xca '╩' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3259,7 +3259,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 203 0xcb '' */
+    /* 203 0xcb '╦' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3275,7 +3275,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 204 0xcc '' */
+    /* 204 0xcc '╠' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3291,7 +3291,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 205 0xcd '' */
+    /* 205 0xcd '═' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3307,7 +3307,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 206 0xce '' */
+    /* 206 0xce '╬' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3323,7 +3323,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 207 0xcf '' */
+    /* 207 0xcf '╧' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3339,7 +3339,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 208 0xd0 '' */
+    /* 208 0xd0 '╨' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3355,7 +3355,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 209 0xd1 '' */
+    /* 209 0xd1 '╤' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3371,7 +3371,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 210 0xd2 '' */
+    /* 210 0xd2 '╥' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3387,7 +3387,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 211 0xd3 '' */
+    /* 211 0xd3 '╙' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3403,7 +3403,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 212 0xd4 '' */
+    /* 212 0xd4 '╘' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3419,7 +3419,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 213 0xd5 '' */
+    /* 213 0xd5 '╒' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3435,7 +3435,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 214 0xd6 '' */
+    /* 214 0xd6 '╓' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3451,7 +3451,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 215 0xd7 '' */
+    /* 215 0xd7 '╫' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3467,7 +3467,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 216 0xd8 '' */
+    /* 216 0xd8 '╪' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3483,7 +3483,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 217 0xd9 '' */
+    /* 217 0xd9 '┘' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3499,7 +3499,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 218 0xda '' */
+    /* 218 0xda '┌' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3515,7 +3515,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 219 0xdb '' */
+    /* 219 0xdb '█' */
     0xff, /* 11111111 */
     0xff, /* 11111111 */
     0xff, /* 11111111 */
@@ -3531,7 +3531,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0xff, /* 11111111 */
     0xff, /* 11111111 */
 
-    /* 220 0xdc '' */
+    /* 220 0xdc '▄' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3547,7 +3547,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0xff, /* 11111111 */
     0xff, /* 11111111 */
 
-    /* 221 0xdd '' */
+    /* 221 0xdd '▌' */
     0xf0, /* 11110000 */
     0xf0, /* 11110000 */
     0xf0, /* 11110000 */
@@ -3563,7 +3563,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0xf0, /* 11110000 */
     0xf0, /* 11110000 */
 
-    /* 222 0xde '' */
+    /* 222 0xde '▐' */
     0x0f, /* 00001111 */
     0x0f, /* 00001111 */
     0x0f, /* 00001111 */
@@ -3579,7 +3579,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x0f, /* 00001111 */
     0x0f, /* 00001111 */
 
-    /* 223 0xdf '' */
+    /* 223 0xdf '▀' */
     0xff, /* 11111111 */
     0xff, /* 11111111 */
     0xff, /* 11111111 */
@@ -3595,7 +3595,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 224 0xe0 '߈ */
+    /* 224 0xe0 'α' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3611,7 +3611,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 225 0xe1 ' */
+    /* 225 0xe1 'ß' */
     0x00, /* 00000000 */
     0x78, /* 01111000 */
     0xcc, /* 11001100 */
@@ -3627,7 +3627,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 226 0xe2 ' */
+    /* 226 0xe2 'Γ' */
     0x00, /* 00000000 */
     0xfe, /* 11111110 */
     0xc6, /* 11000110 */
@@ -3643,7 +3643,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 227 0xe3 ' */
+    /* 227 0xe3 'π' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3659,7 +3659,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 228 0xe4 ' */
+    /* 228 0xe4 'Σ' */
     0x00, /* 00000000 */
     0xfe, /* 11111110 */
     0xc6, /* 11000110 */
@@ -3675,7 +3675,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 229 0xe5 ' */
+    /* 229 0xe5 'σ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3691,7 +3691,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 230 0xe6 ' */
+    /* 230 0xe6 'µ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3707,7 +3707,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x60, /* 01100000 */
     0xc0, /* 11000000 */
 
-    /* 231 0xe7 ' */
+    /* 231 0xe7 'τ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3723,7 +3723,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 232 0xe8 ' */
+    /* 232 0xe8 'Φ' */
     0x00, /* 00000000 */
     0x7e, /* 01111110 */
     0x18, /* 00011000 */
@@ -3739,7 +3739,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 233 0xe9 ' */
+    /* 233 0xe9 'Θ' */
     0x00, /* 00000000 */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
@@ -3755,7 +3755,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 234 0xea ' */
+    /* 234 0xea 'Ω' */
     0x00, /* 00000000 */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
@@ -3771,7 +3771,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 235 0xeb ' */
+    /* 235 0xeb 'δ' */
     0x00, /* 00000000 */
     0x1e, /* 00011110 */
     0x30, /* 00110000 */
@@ -3787,7 +3787,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 236 0xec ' */
+    /* 236 0xec '∞' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3803,7 +3803,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 237 0xed ' */
+    /* 237 0xed 'φ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x03, /* 00000011 */
@@ -3819,7 +3819,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 238 0xee ' */
+    /* 238 0xee 'ε' */
     0x00, /* 00000000 */
     0x1c, /* 00011100 */
     0x30, /* 00110000 */
@@ -3835,7 +3835,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 239 0xef ' */
+    /* 239 0xef '∩' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x7c, /* 01111100 */
@@ -3851,7 +3851,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 240 0xf0 '' */
+    /* 240 0xf0 '≡' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3867,7 +3867,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 241 0xf1 '' */
+    /* 241 0xf1 '±' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3883,7 +3883,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 242 0xf2 '' */
+    /* 242 0xf2 '≥' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x30, /* 00110000 */
@@ -3899,7 +3899,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 243 0xf3 '' */
+    /* 243 0xf3 '≤' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x0c, /* 00001100 */
@@ -3915,7 +3915,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 244 0xf4 '' */
+    /* 244 0xf4 '⌠' */
     0x00, /* 00000000 */
     0x0e, /* 00001110 */
     0x1b, /* 00011011 */
@@ -3931,7 +3931,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 245 0xf5 '' */
+    /* 245 0xf5 '⌡' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3947,7 +3947,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 246 0xf6 '' */
+    /* 246 0xf6 '÷' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3963,7 +3963,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 247 0xf7 '' */
+    /* 247 0xf7 '≈' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3979,7 +3979,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 248 0xf8 '' */
+    /* 248 0xf8 '°' */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
     0x6c, /* 01101100 */
@@ -3995,7 +3995,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 249 0xf9 '' */
+    /* 249 0xf9 '∙' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4011,7 +4011,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 250 0xfa '' */
+    /* 250 0xfa '·' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4027,7 +4027,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 251 0xfb '' */
+    /* 251 0xfb '√' */
     0x0f, /* 00001111 */
     0x0c, /* 00001100 */
     0x0c, /* 00001100 */
@@ -4043,7 +4043,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 252 0xfc '' */
+    /* 252 0xfc 'ⁿ' */
     0x6c, /* 01101100 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -4059,7 +4059,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 253 0xfd '' */
+    /* 253 0xfd '²' */
     0x3c, /* 00111100 */
     0x66, /* 01100110 */
     0x0c, /* 00001100 */
@@ -4075,7 +4075,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 254 0xfe '' */
+    /* 254 0xfe '■' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4091,7 +4091,7 @@ static const unsigned char fontdata_8x14[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 255 0xff '' */
+    /* 255 0xff ' ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
diff --git a/xen/drivers/video/font_8x16.c b/xen/drivers/video/font_8x16.c
index c65f98dcbb..f96c13ceea 100644
--- a/xen/drivers/video/font_8x16.c
+++ b/xen/drivers/video/font_8x16.c
@@ -2315,7 +2315,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 128 0x80 '' */
+    /* 128 0x80 'Ç' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x3c, /* 00111100 */
@@ -2333,7 +2333,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 129 0x81 '' */
+    /* 129 0x81 'ü' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0xcc, /* 11001100 */
@@ -2351,7 +2351,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 130 0x82 '' */
+    /* 130 0x82 'é' */
     0x00, /* 00000000 */
     0x0c, /* 00001100 */
     0x18, /* 00011000 */
@@ -2369,7 +2369,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 131 0x83 '' */
+    /* 131 0x83 'â' */
     0x00, /* 00000000 */
     0x10, /* 00010000 */
     0x38, /* 00111000 */
@@ -2387,7 +2387,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 132 0x84 '' */
+    /* 132 0x84 'ä' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0xcc, /* 11001100 */
@@ -2405,7 +2405,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 133 0x85 '' */
+    /* 133 0x85 'à' */
     0x00, /* 00000000 */
     0x60, /* 01100000 */
     0x30, /* 00110000 */
@@ -2423,7 +2423,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 134 0x86 '' */
+    /* 134 0x86 'å' */
     0x00, /* 00000000 */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
@@ -2441,7 +2441,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 135 0x87 '' */
+    /* 135 0x87 'ç' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -2459,7 +2459,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 136 0x88 '' */
+    /* 136 0x88 'ê' */
     0x00, /* 00000000 */
     0x10, /* 00010000 */
     0x38, /* 00111000 */
@@ -2477,7 +2477,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 137 0x89 '' */
+    /* 137 0x89 'ë' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
@@ -2495,7 +2495,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 138 0x8a '' */
+    /* 138 0x8a 'è' */
     0x00, /* 00000000 */
     0x60, /* 01100000 */
     0x30, /* 00110000 */
@@ -2513,7 +2513,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 139 0x8b '' */
+    /* 139 0x8b 'ï' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x66, /* 01100110 */
@@ -2531,7 +2531,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 140 0x8c '' */
+    /* 140 0x8c 'î' */
     0x00, /* 00000000 */
     0x18, /* 00011000 */
     0x3c, /* 00111100 */
@@ -2549,7 +2549,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 141 0x8d '' */
+    /* 141 0x8d 'ì' */
     0x00, /* 00000000 */
     0x60, /* 01100000 */
     0x30, /* 00110000 */
@@ -2567,7 +2567,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 142 0x8e '' */
+    /* 142 0x8e 'Ä' */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
@@ -2585,7 +2585,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 143 0x8f '' */
+    /* 143 0x8f 'Å' */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
     0x38, /* 00111000 */
@@ -2603,7 +2603,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 144 0x90 '' */
+    /* 144 0x90 'É' */
     0x0c, /* 00001100 */
     0x18, /* 00011000 */
     0x00, /* 00000000 */
@@ -2621,7 +2621,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 145 0x91 '' */
+    /* 145 0x91 'æ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -2639,7 +2639,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 146 0x92 '' */
+    /* 146 0x92 'Æ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x3e, /* 00111110 */
@@ -2657,7 +2657,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 147 0x93 '' */
+    /* 147 0x93 'ô' */
     0x00, /* 00000000 */
     0x10, /* 00010000 */
     0x38, /* 00111000 */
@@ -2675,7 +2675,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 148 0x94 '' */
+    /* 148 0x94 'ö' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
@@ -2693,7 +2693,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 149 0x95 '' */
+    /* 149 0x95 'ò' */
     0x00, /* 00000000 */
     0x60, /* 01100000 */
     0x30, /* 00110000 */
@@ -2711,7 +2711,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 150 0x96 '' */
+    /* 150 0x96 'û' */
     0x00, /* 00000000 */
     0x30, /* 00110000 */
     0x78, /* 01111000 */
@@ -2729,7 +2729,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 151 0x97 '' */
+    /* 151 0x97 'ù' */
     0x00, /* 00000000 */
     0x60, /* 01100000 */
     0x30, /* 00110000 */
@@ -2747,7 +2747,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 152 0x98 '' */
+    /* 152 0x98 'ÿ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
@@ -2765,7 +2765,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x78, /* 01111000 */
     0x00, /* 00000000 */
 
-    /* 153 0x99 '' */
+    /* 153 0x99 'Ö' */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
@@ -2783,7 +2783,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 154 0x9a '' */
+    /* 154 0x9a 'Ü' */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
@@ -2801,7 +2801,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 155 0x9b '' */
+    /* 155 0x9b '¢' */
     0x00, /* 00000000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -2819,7 +2819,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 156 0x9c '' */
+    /* 156 0x9c '£' */
     0x00, /* 00000000 */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
@@ -2837,7 +2837,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 157 0x9d '' */
+    /* 157 0x9d '¥' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x66, /* 01100110 */
@@ -2855,7 +2855,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 158 0x9e '' */
+    /* 158 0x9e '₧' */
     0x00, /* 00000000 */
     0xf8, /* 11111000 */
     0xcc, /* 11001100 */
@@ -2873,7 +2873,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 159 0x9f '' */
+    /* 159 0x9f 'ƒ' */
     0x00, /* 00000000 */
     0x0e, /* 00001110 */
     0x1b, /* 00011011 */
@@ -2891,7 +2891,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 160 0xa0 '' */
+    /* 160 0xa0 'á' */
     0x00, /* 00000000 */
     0x18, /* 00011000 */
     0x30, /* 00110000 */
@@ -2909,7 +2909,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 161 0xa1 '' */
+    /* 161 0xa1 'í' */
     0x00, /* 00000000 */
     0x0c, /* 00001100 */
     0x18, /* 00011000 */
@@ -2927,7 +2927,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 162 0xa2 '' */
+    /* 162 0xa2 'ó' */
     0x00, /* 00000000 */
     0x18, /* 00011000 */
     0x30, /* 00110000 */
@@ -2945,7 +2945,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 163 0xa3 '' */
+    /* 163 0xa3 'ú' */
     0x00, /* 00000000 */
     0x18, /* 00011000 */
     0x30, /* 00110000 */
@@ -2963,7 +2963,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 164 0xa4 '' */
+    /* 164 0xa4 'ñ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x76, /* 01110110 */
@@ -2981,7 +2981,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 165 0xa5 '' */
+    /* 165 0xa5 'Ñ' */
     0x76, /* 01110110 */
     0xdc, /* 11011100 */
     0x00, /* 00000000 */
@@ -2999,7 +2999,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 166 0xa6 '' */
+    /* 166 0xa6 'ª' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x3c, /* 00111100 */
@@ -3017,7 +3017,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 167 0xa7 '' */
+    /* 167 0xa7 'º' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x38, /* 00111000 */
@@ -3035,7 +3035,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 168 0xa8 '' */
+    /* 168 0xa8 '¿' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x30, /* 00110000 */
@@ -3053,7 +3053,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 169 0xa9 '' */
+    /* 169 0xa9 '⌐' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3071,7 +3071,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 170 0xaa '' */
+    /* 170 0xaa '¬' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3089,7 +3089,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 171 0xab '' */
+    /* 171 0xab '½' */
     0x00, /* 00000000 */
     0x60, /* 01100000 */
     0xe0, /* 11100000 */
@@ -3107,7 +3107,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 172 0xac '' */
+    /* 172 0xac '¼' */
     0x00, /* 00000000 */
     0x60, /* 01100000 */
     0xe0, /* 11100000 */
@@ -3125,7 +3125,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 173 0xad '' */
+    /* 173 0xad '¡' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x18, /* 00011000 */
@@ -3143,7 +3143,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 174 0xae '' */
+    /* 174 0xae '«' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3161,7 +3161,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 175 0xaf '' */
+    /* 175 0xaf '»' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3179,7 +3179,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 176 0xb0 '' */
+    /* 176 0xb0 '░' */
     0x11, /* 00010001 */
     0x44, /* 01000100 */
     0x11, /* 00010001 */
@@ -3197,7 +3197,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x11, /* 00010001 */
     0x44, /* 01000100 */
 
-    /* 177 0xb1 '' */
+    /* 177 0xb1 '▒' */
     0x55, /* 01010101 */
     0xaa, /* 10101010 */
     0x55, /* 01010101 */
@@ -3215,7 +3215,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x55, /* 01010101 */
     0xaa, /* 10101010 */
 
-    /* 178 0xb2 '' */
+    /* 178 0xb2 '▓' */
     0xdd, /* 11011101 */
     0x77, /* 01110111 */
     0xdd, /* 11011101 */
@@ -3233,7 +3233,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0xdd, /* 11011101 */
     0x77, /* 01110111 */
 
-    /* 179 0xb3 '' */
+    /* 179 0xb3 '│' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3251,7 +3251,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 180 0xb4 '' */
+    /* 180 0xb4 '┤' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3269,7 +3269,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 181 0xb5 '' */
+    /* 181 0xb5 '╡' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3287,7 +3287,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 182 0xb6 '' */
+    /* 182 0xb6 '╢' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3305,7 +3305,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 183 0xb7 '' */
+    /* 183 0xb7 '╖' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3323,7 +3323,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 184 0xb8 '' */
+    /* 184 0xb8 '╕' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3341,7 +3341,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 185 0xb9 '' */
+    /* 185 0xb9 '╣' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3359,7 +3359,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 186 0xba '' */
+    /* 186 0xba '║' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3377,7 +3377,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 187 0xbb '' */
+    /* 187 0xbb '╗' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3395,7 +3395,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 188 0xbc '' */
+    /* 188 0xbc '╝' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3413,7 +3413,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 189 0xbd '' */
+    /* 189 0xbd '╜' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3431,7 +3431,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 190 0xbe '' */
+    /* 190 0xbe '╛' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3449,7 +3449,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 191 0xbf '' */
+    /* 191 0xbf '┐' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3467,7 +3467,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 192 0xc0 '' */
+    /* 192 0xc0 '└' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3485,7 +3485,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 193 0xc1 '' */
+    /* 193 0xc1 '┴' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3503,7 +3503,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 194 0xc2 '' */
+    /* 194 0xc2 '┬' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3521,7 +3521,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 195 0xc3 '' */
+    /* 195 0xc3 '├' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3539,7 +3539,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 196 0xc4 '' */
+    /* 196 0xc4 '─' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3557,7 +3557,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 197 0xc5 '' */
+    /* 197 0xc5 '┼' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3575,7 +3575,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 198 0xc6 '' */
+    /* 198 0xc6 '╞' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3593,7 +3593,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 199 0xc7 '' */
+    /* 199 0xc7 '╟' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3611,7 +3611,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 200 0xc8 '' */
+    /* 200 0xc8 '╚' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3629,7 +3629,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 201 0xc9 '' */
+    /* 201 0xc9 '╔' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3647,7 +3647,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 202 0xca '' */
+    /* 202 0xca '╩' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3665,7 +3665,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 203 0xcb '' */
+    /* 203 0xcb '╦' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3683,7 +3683,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 204 0xcc '' */
+    /* 204 0xcc '╠' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3701,7 +3701,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 205 0xcd '' */
+    /* 205 0xcd '═' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3719,7 +3719,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 206 0xce '' */
+    /* 206 0xce '╬' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3737,7 +3737,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 207 0xcf '' */
+    /* 207 0xcf '╧' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3755,7 +3755,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 208 0xd0 '' */
+    /* 208 0xd0 '╨' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3773,7 +3773,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 209 0xd1 '' */
+    /* 209 0xd1 '╤' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3791,7 +3791,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 210 0xd2 '' */
+    /* 210 0xd2 '╥' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3809,7 +3809,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 211 0xd3 '' */
+    /* 211 0xd3 '╙' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3827,7 +3827,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 212 0xd4 '' */
+    /* 212 0xd4 '╘' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3845,7 +3845,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 213 0xd5 '' */
+    /* 213 0xd5 '╒' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3863,7 +3863,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 214 0xd6 '' */
+    /* 214 0xd6 '╓' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3881,7 +3881,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 215 0xd7 '' */
+    /* 215 0xd7 '╫' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -3899,7 +3899,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 216 0xd8 '' */
+    /* 216 0xd8 '╪' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3917,7 +3917,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 217 0xd9 '' */
+    /* 217 0xd9 '┘' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -3935,7 +3935,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 218 0xda '' */
+    /* 218 0xda '┌' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3953,7 +3953,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 219 0xdb '' */
+    /* 219 0xdb '█' */
     0xff, /* 11111111 */
     0xff, /* 11111111 */
     0xff, /* 11111111 */
@@ -3971,7 +3971,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0xff, /* 11111111 */
     0xff, /* 11111111 */
 
-    /* 220 0xdc '' */
+    /* 220 0xdc '▄' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -3989,7 +3989,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0xff, /* 11111111 */
     0xff, /* 11111111 */
 
-    /* 221 0xdd '' */
+    /* 221 0xdd '▌' */
     0xf0, /* 11110000 */
     0xf0, /* 11110000 */
     0xf0, /* 11110000 */
@@ -4007,7 +4007,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0xf0, /* 11110000 */
     0xf0, /* 11110000 */
 
-    /* 222 0xde '' */
+    /* 222 0xde '▐' */
     0x0f, /* 00001111 */
     0x0f, /* 00001111 */
     0x0f, /* 00001111 */
@@ -4025,7 +4025,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x0f, /* 00001111 */
     0x0f, /* 00001111 */
 
-    /* 223 0xdf '' */
+    /* 223 0xdf '▀' */
     0xff, /* 11111111 */
     0xff, /* 11111111 */
     0xff, /* 11111111 */
@@ -4043,7 +4043,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 224 0xe0 '' */
+    /* 224 0xe0 'α' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4061,7 +4061,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 225 0xe1 '' */
+    /* 225 0xe1 'ß' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x78, /* 01111000 */
@@ -4079,7 +4079,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 226 0xe2 '' */
+    /* 226 0xe2 'Γ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0xfe, /* 11111110 */
@@ -4097,7 +4097,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 227 0xe3 '' */
+    /* 227 0xe3 'π' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4115,7 +4115,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 228 0xe4 '' */
+    /* 228 0xe4 'Σ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0xfe, /* 11111110 */
@@ -4133,7 +4133,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 229 0xe5 '' */
+    /* 229 0xe5 'σ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4151,7 +4151,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 230 0xe6 '' */
+    /* 230 0xe6 'µ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4169,7 +4169,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0xc0, /* 11000000 */
     0x00, /* 00000000 */
 
-    /* 231 0xe7 '' */
+    /* 231 0xe7 'τ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4187,7 +4187,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 232 0xe8 '' */
+    /* 232 0xe8 'Φ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x7e, /* 01111110 */
@@ -4205,7 +4205,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 233 0xe9 '' */
+    /* 233 0xe9 'Θ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x38, /* 00111000 */
@@ -4223,7 +4223,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 234 0xea '' */
+    /* 234 0xea 'Ω' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x38, /* 00111000 */
@@ -4241,7 +4241,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 235 0xeb '' */
+    /* 235 0xeb 'δ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x1e, /* 00011110 */
@@ -4259,7 +4259,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 236 0xec '' */
+    /* 236 0xec '∞' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4277,7 +4277,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 237 0xed '' */
+    /* 237 0xed 'φ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4295,7 +4295,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 238 0xee '' */
+    /* 238 0xee 'ε' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x1c, /* 00011100 */
@@ -4313,7 +4313,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 239 0xef '' */
+    /* 239 0xef '∩' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4331,7 +4331,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 240 0xf0 '' */
+    /* 240 0xf0 '≡' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4349,7 +4349,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 241 0xf1 '' */
+    /* 241 0xf1 '±' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4367,7 +4367,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 242 0xf2 '' */
+    /* 242 0xf2 '≥' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4385,7 +4385,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 243 0xf3 '' */
+    /* 243 0xf3 '≤' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4403,7 +4403,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 244 0xf4 '' */
+    /* 244 0xf4 '⌠' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x0e, /* 00001110 */
@@ -4421,7 +4421,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 245 0xf5 '' */
+    /* 245 0xf5 '⌡' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -4439,7 +4439,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 246 0xf6 '' */
+    /* 246 0xf6 '÷' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4457,7 +4457,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 247 0xf7 '' */
+    /* 247 0xf7 '≈' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4475,7 +4475,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 248 0xf8 '' */
+    /* 248 0xf8 '°' */
     0x00, /* 00000000 */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
@@ -4493,7 +4493,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 249 0xf9 '' */
+    /* 249 0xf9 '∙' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4511,7 +4511,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 250 0xfa '' */
+    /* 250 0xfa '·' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4529,7 +4529,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 251 0xfb '' */
+    /* 251 0xfb '√' */
     0x00, /* 00000000 */
     0x0f, /* 00001111 */
     0x0c, /* 00001100 */
@@ -4547,7 +4547,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 252 0xfc '' */
+    /* 252 0xfc 'ⁿ' */
     0x00, /* 00000000 */
     0x6c, /* 01101100 */
     0x36, /* 00110110 */
@@ -4565,7 +4565,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 253 0xfd '' */
+    /* 253 0xfd '²' */
     0x00, /* 00000000 */
     0x3c, /* 00111100 */
     0x66, /* 01100110 */
@@ -4583,7 +4583,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 254 0xfe '' */
+    /* 254 0xfe '■' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -4601,7 +4601,7 @@ static const unsigned char fontdata_8x16[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 255 0xff '' */
+    /* 255 0xff ' ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
diff --git a/xen/drivers/video/font_8x8.c b/xen/drivers/video/font_8x8.c
index 9441429b42..e6c693a977 100644
--- a/xen/drivers/video/font_8x8.c
+++ b/xen/drivers/video/font_8x8.c
@@ -1291,7 +1291,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0xfe, /* 11111110 */
     0x00, /* 00000000 */
 
-    /* 128 0x80 '' */
+    /* 128 0x80 'Ç' */
     0x7c, /* 01111100 */
     0xc6, /* 11000110 */
     0xc0, /* 11000000 */
@@ -1301,7 +1301,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x0c, /* 00001100 */
     0x78, /* 01111000 */
 
-    /* 129 0x81 '' */
+    /* 129 0x81 'ü' */
     0xcc, /* 11001100 */
     0x00, /* 00000000 */
     0xcc, /* 11001100 */
@@ -1311,7 +1311,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x76, /* 01110110 */
     0x00, /* 00000000 */
 
-    /* 130 0x82 '' */
+    /* 130 0x82 'é' */
     0x0c, /* 00001100 */
     0x18, /* 00011000 */
     0x7c, /* 01111100 */
@@ -1321,7 +1321,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x7c, /* 01111100 */
     0x00, /* 00000000 */
 
-    /* 131 0x83 '' */
+    /* 131 0x83 'â' */
     0x7c, /* 01111100 */
     0x82, /* 10000010 */
     0x78, /* 01111000 */
@@ -1331,7 +1331,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x76, /* 01110110 */
     0x00, /* 00000000 */
 
-    /* 132 0x84 '' */
+    /* 132 0x84 'ä' */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
     0x78, /* 01111000 */
@@ -1341,7 +1341,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x76, /* 01110110 */
     0x00, /* 00000000 */
 
-    /* 133 0x85 '' */
+    /* 133 0x85 'à' */
     0x30, /* 00110000 */
     0x18, /* 00011000 */
     0x78, /* 01111000 */
@@ -1351,7 +1351,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x76, /* 01110110 */
     0x00, /* 00000000 */
 
-    /* 134 0x86 '' */
+    /* 134 0x86 'å' */
     0x30, /* 00110000 */
     0x30, /* 00110000 */
     0x78, /* 01111000 */
@@ -1361,7 +1361,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x76, /* 01110110 */
     0x00, /* 00000000 */
 
-    /* 135 0x87 '' */
+    /* 135 0x87 'ç' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x7e, /* 01111110 */
@@ -1371,7 +1371,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x0c, /* 00001100 */
     0x38, /* 00111000 */
 
-    /* 136 0x88 '' */
+    /* 136 0x88 'ê' */
     0x7c, /* 01111100 */
     0x82, /* 10000010 */
     0x7c, /* 01111100 */
@@ -1381,7 +1381,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x7c, /* 01111100 */
     0x00, /* 00000000 */
 
-    /* 137 0x89 '' */
+    /* 137 0x89 'ë' */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
     0x7c, /* 01111100 */
@@ -1391,7 +1391,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x7c, /* 01111100 */
     0x00, /* 00000000 */
 
-    /* 138 0x8a '' */
+    /* 138 0x8a 'è' */
     0x30, /* 00110000 */
     0x18, /* 00011000 */
     0x7c, /* 01111100 */
@@ -1401,7 +1401,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x7c, /* 01111100 */
     0x00, /* 00000000 */
 
-    /* 139 0x8b '' */
+    /* 139 0x8b 'ï' */
     0x66, /* 01100110 */
     0x00, /* 00000000 */
     0x38, /* 00111000 */
@@ -1411,7 +1411,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x3c, /* 00111100 */
     0x00, /* 00000000 */
 
-    /* 140 0x8c '' */
+    /* 140 0x8c 'î' */
     0x7c, /* 01111100 */
     0x82, /* 10000010 */
     0x38, /* 00111000 */
@@ -1421,7 +1421,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x3c, /* 00111100 */
     0x00, /* 00000000 */
 
-    /* 141 0x8d '' */
+    /* 141 0x8d 'ì' */
     0x30, /* 00110000 */
     0x18, /* 00011000 */
     0x00, /* 00000000 */
@@ -1431,7 +1431,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x3c, /* 00111100 */
     0x00, /* 00000000 */
 
-    /* 142 0x8e '' */
+    /* 142 0x8e 'Ä' */
     0xc6, /* 11000110 */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
@@ -1441,7 +1441,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
 
-    /* 143 0x8f '' */
+    /* 143 0x8f 'Å' */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
     0x7c, /* 01111100 */
@@ -1451,7 +1451,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
 
-    /* 144 0x90 '' */
+    /* 144 0x90 'É' */
     0x18, /* 00011000 */
     0x30, /* 00110000 */
     0xfe, /* 11111110 */
@@ -1461,7 +1461,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0xfe, /* 11111110 */
     0x00, /* 00000000 */
 
-    /* 145 0x91 '' */
+    /* 145 0x91 'æ' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x7e, /* 01111110 */
@@ -1471,7 +1471,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x7e, /* 01111110 */
     0x00, /* 00000000 */
 
-    /* 146 0x92 '' */
+    /* 146 0x92 'Æ' */
     0x3e, /* 00111110 */
     0x6c, /* 01101100 */
     0xcc, /* 11001100 */
@@ -1481,7 +1481,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0xce, /* 11001110 */
     0x00, /* 00000000 */
 
-    /* 147 0x93 '' */
+    /* 147 0x93 'ô' */
     0x7c, /* 01111100 */
     0x82, /* 10000010 */
     0x7c, /* 01111100 */
@@ -1491,7 +1491,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x7c, /* 01111100 */
     0x00, /* 00000000 */
 
-    /* 148 0x94 '' */
+    /* 148 0x94 'ö' */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
     0x7c, /* 01111100 */
@@ -1501,7 +1501,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x7c, /* 01111100 */
     0x00, /* 00000000 */
 
-    /* 149 0x95 '' */
+    /* 149 0x95 'ò' */
     0x30, /* 00110000 */
     0x18, /* 00011000 */
     0x7c, /* 01111100 */
@@ -1511,7 +1511,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x7c, /* 01111100 */
     0x00, /* 00000000 */
 
-    /* 150 0x96 '' */
+    /* 150 0x96 'û' */
     0x78, /* 01111000 */
     0x84, /* 10000100 */
     0x00, /* 00000000 */
@@ -1521,7 +1521,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x76, /* 01110110 */
     0x00, /* 00000000 */
 
-    /* 151 0x97 '' */
+    /* 151 0x97 'ù' */
     0x60, /* 01100000 */
     0x30, /* 00110000 */
     0xcc, /* 11001100 */
@@ -1531,7 +1531,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x76, /* 01110110 */
     0x00, /* 00000000 */
 
-    /* 152 0x98 '' */
+    /* 152 0x98 'ÿ' */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
@@ -1541,7 +1541,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x06, /* 00000110 */
     0xfc, /* 11111100 */
 
-    /* 153 0x99 '' */
+    /* 153 0x99 'Ö' */
     0xc6, /* 11000110 */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
@@ -1551,7 +1551,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x38, /* 00111000 */
     0x00, /* 00000000 */
 
-    /* 154 0x9a '' */
+    /* 154 0x9a 'Ü' */
     0xc6, /* 11000110 */
     0x00, /* 00000000 */
     0xc6, /* 11000110 */
@@ -1561,7 +1561,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x7c, /* 01111100 */
     0x00, /* 00000000 */
 
-    /* 155 0x9b '' */
+    /* 155 0x9b '¢' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x7e, /* 01111110 */
@@ -1571,7 +1571,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 156 0x9c '' */
+    /* 156 0x9c '£' */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
     0x64, /* 01100100 */
@@ -1581,7 +1581,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0xfc, /* 11111100 */
     0x00, /* 00000000 */
 
-    /* 157 0x9d '' */
+    /* 157 0x9d '¥' */
     0x66, /* 01100110 */
     0x66, /* 01100110 */
     0x3c, /* 00111100 */
@@ -1591,7 +1591,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 158 0x9e '' */
+    /* 158 0x9e '₧' */
     0xf8, /* 11111000 */
     0xcc, /* 11001100 */
     0xcc, /* 11001100 */
@@ -1601,7 +1601,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0xc6, /* 11000110 */
     0xc7, /* 11000111 */
 
-    /* 159 0x9f '' */
+    /* 159 0x9f 'ƒ' */
     0x0e, /* 00001110 */
     0x1b, /* 00011011 */
     0x18, /* 00011000 */
@@ -1611,7 +1611,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x70, /* 01110000 */
     0x00, /* 00000000 */
 
-    /* 160 0xa0 '' */
+    /* 160 0xa0 'á' */
     0x18, /* 00011000 */
     0x30, /* 00110000 */
     0x78, /* 01111000 */
@@ -1621,7 +1621,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x76, /* 01110110 */
     0x00, /* 00000000 */
 
-    /* 161 0xa1 '' */
+    /* 161 0xa1 'í' */
     0x0c, /* 00001100 */
     0x18, /* 00011000 */
     0x00, /* 00000000 */
@@ -1631,7 +1631,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x3c, /* 00111100 */
     0x00, /* 00000000 */
 
-    /* 162 0xa2 '' */
+    /* 162 0xa2 'ó' */
     0x0c, /* 00001100 */
     0x18, /* 00011000 */
     0x7c, /* 01111100 */
@@ -1641,7 +1641,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x7c, /* 01111100 */
     0x00, /* 00000000 */
 
-    /* 163 0xa3 '' */
+    /* 163 0xa3 'ú' */
     0x18, /* 00011000 */
     0x30, /* 00110000 */
     0xcc, /* 11001100 */
@@ -1651,7 +1651,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x76, /* 01110110 */
     0x00, /* 00000000 */
 
-    /* 164 0xa4 '' */
+    /* 164 0xa4 'ñ' */
     0x76, /* 01110110 */
     0xdc, /* 11011100 */
     0x00, /* 00000000 */
@@ -1661,7 +1661,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x66, /* 01100110 */
     0x00, /* 00000000 */
 
-    /* 165 0xa5 '' */
+    /* 165 0xa5 'Ñ' */
     0x76, /* 01110110 */
     0xdc, /* 11011100 */
     0x00, /* 00000000 */
@@ -1671,7 +1671,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0xce, /* 11001110 */
     0x00, /* 00000000 */
 
-    /* 166 0xa6 '' */
+    /* 166 0xa6 'ª' */
     0x3c, /* 00111100 */
     0x6c, /* 01101100 */
     0x6c, /* 01101100 */
@@ -1681,7 +1681,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 167 0xa7 '' */
+    /* 167 0xa7 'º' */
     0x38, /* 00111000 */
     0x6c, /* 01101100 */
     0x6c, /* 01101100 */
@@ -1691,7 +1691,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 168 0xa8 '' */
+    /* 168 0xa8 '¿' */
     0x18, /* 00011000 */
     0x00, /* 00000000 */
     0x18, /* 00011000 */
@@ -1701,7 +1701,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x3e, /* 00111110 */
     0x00, /* 00000000 */
 
-    /* 169 0xa9 '' */
+    /* 169 0xa9 '⌐' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -1711,7 +1711,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 170 0xaa '' */
+    /* 170 0xaa '¬' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -1721,7 +1721,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 171 0xab '' */
+    /* 171 0xab '½' */
     0x63, /* 01100011 */
     0xe6, /* 11100110 */
     0x6c, /* 01101100 */
@@ -1731,7 +1731,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0xcc, /* 11001100 */
     0x0f, /* 00001111 */
 
-    /* 172 0xac '' */
+    /* 172 0xac '¼' */
     0x63, /* 01100011 */
     0xe6, /* 11100110 */
     0x6c, /* 01101100 */
@@ -1741,7 +1741,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0xdf, /* 11011111 */
     0x06, /* 00000110 */
 
-    /* 173 0xad '' */
+    /* 173 0xad '¡' */
     0x18, /* 00011000 */
     0x00, /* 00000000 */
     0x18, /* 00011000 */
@@ -1751,7 +1751,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x00, /* 00000000 */
 
-    /* 174 0xae '' */
+    /* 174 0xae '«' */
     0x00, /* 00000000 */
     0x33, /* 00110011 */
     0x66, /* 01100110 */
@@ -1761,7 +1761,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 175 0xaf '' */
+    /* 175 0xaf '»' */
     0x00, /* 00000000 */
     0xcc, /* 11001100 */
     0x66, /* 01100110 */
@@ -1771,7 +1771,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 176 0xb0 '' */
+    /* 176 0xb0 '░' */
     0x22, /* 00100010 */
     0x88, /* 10001000 */
     0x22, /* 00100010 */
@@ -1781,7 +1781,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x22, /* 00100010 */
     0x88, /* 10001000 */
 
-    /* 177 0xb1 '' */
+    /* 177 0xb1 '▒' */
     0x55, /* 01010101 */
     0xaa, /* 10101010 */
     0x55, /* 01010101 */
@@ -1791,7 +1791,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x55, /* 01010101 */
     0xaa, /* 10101010 */
 
-    /* 178 0xb2 '' */
+    /* 178 0xb2 '▓' */
     0x77, /* 01110111 */
     0xdd, /* 11011101 */
     0x77, /* 01110111 */
@@ -1801,7 +1801,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x77, /* 01110111 */
     0xdd, /* 11011101 */
 
-    /* 179 0xb3 '' */
+    /* 179 0xb3 '│' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -1811,7 +1811,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 180 0xb4 '' */
+    /* 180 0xb4 '┤' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -1821,7 +1821,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 181 0xb5 '' */
+    /* 181 0xb5 '╡' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0xf8, /* 11111000 */
@@ -1831,7 +1831,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 182 0xb6 '' */
+    /* 182 0xb6 '╢' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -1841,7 +1841,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 183 0xb7 '' */
+    /* 183 0xb7 '╖' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -1851,7 +1851,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 184 0xb8 '' */
+    /* 184 0xb8 '╕' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0xf8, /* 11111000 */
@@ -1861,7 +1861,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 185 0xb9 '' */
+    /* 185 0xb9 '╣' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0xf6, /* 11110110 */
@@ -1871,7 +1871,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 186 0xba '' */
+    /* 186 0xba '║' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -1881,7 +1881,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 187 0xbb '' */
+    /* 187 0xbb '╗' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0xfe, /* 11111110 */
@@ -1891,7 +1891,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 188 0xbc '' */
+    /* 188 0xbc '╝' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0xf6, /* 11110110 */
@@ -1901,7 +1901,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 189 0xbd '' */
+    /* 189 0xbd '╜' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -1911,7 +1911,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 190 0xbe '' */
+    /* 190 0xbe '╛' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0xf8, /* 11111000 */
@@ -1921,7 +1921,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 191 0xbf '' */
+    /* 191 0xbf '┐' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -1931,7 +1931,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 192 0xc0 '' */
+    /* 192 0xc0 '└' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -1941,7 +1941,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 193 0xc1 '' */
+    /* 193 0xc1 '┴' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -1951,7 +1951,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 194 0xc2 '' */
+    /* 194 0xc2 '┬' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -1961,7 +1961,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 195 0xc3 '' */
+    /* 195 0xc3 '├' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -1971,7 +1971,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 196 0xc4 '' */
+    /* 196 0xc4 '─' */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
     0x00, /* 00000000 */
@@ -1981,7 +1981,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */
 
-    /* 197 0xc5 '' */
+    /* 197 0xc5 '┼' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
@@ -1991,7 +1991,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 198 0xc6 '' */
+    /* 198 0xc6 '╞' */
     0x18, /* 00011000 */
     0x18, /* 00011000 */
     0x1f, /* 00011111 */
@@ -2001,7 +2001,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x18, /* 00011000 */
     0x18, /* 00011000 */
 
-    /* 199 0xc7 '' */
+    /* 199 0xc7 '╟' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
@@ -2011,7 +2011,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x36, /* 00110110 */
     0x36, /* 00110110 */
 
-    /* 200 0xc8 '' */
+    /* 200 0xc8 '╚' */
     0x36, /* 00110110 */
     0x36, /* 00110110 */
     0x37, /* 00110111 */
@@ -2021,7 +2021,7 @@ static const unsigned char fontdata_8x8[FONTDATAMAX] = {
     0x00, /* 00000000 */
     0x00, /* 00000000 */


From xen-changelog-bounces@lists.xenproject.org Wed Oct 02 07:00:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 02 Oct 2024 07:00:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.808612.1220551 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svtLL-0002yK-6f; Wed, 02 Oct 2024 07:00:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 808612.1220551; Wed, 02 Oct 2024 07: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 1svtLL-0002yA-3b; Wed, 02 Oct 2024 07:00:15 +0000
Received: by outflank-mailman (input) for mailman id 808612;
 Wed, 02 Oct 2024 07: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 1svtLK-0002y2-17
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 07: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 1svtLJ-0008FQ-Vk
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 07:00:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svtLJ-0004YU-TF
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 07: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=LtBr/2NiO7b3q2/wTPs/Oge+UCgInWmCIk3eibocGI8=; b=s+iZHgoClejOAzP/RdpSYWI/wp
	ikjRfuQtah8ucfUUMAt2X1u1a1sZQmvXcde6NukEQRJ7aTrCyayJsOwLW4nMcNNu8IheROeN6+osi
	O9Pw36TzpUSEJMa1r6ecbSFbzz/CxO8lPtC2gFrgnwfMdqVn/Gd8l0l0Zd9kZ7AjQ3tA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: page table handling
Message-Id: <E1svtLJ-0004YU-TF@xenbits.xenproject.org>
Date: Wed, 02 Oct 2024 07:00:13 +0000

commit 557b7f1b9a57a666181f93c2240177676af68dd9
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Oct 2 08:53:59 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 2 08:53:59 2024 +0200

    xen/riscv: page table handling
    
    Implement map_pages_to_xen() which requires several
    functions to manage page tables and entries:
    - pt_update()
    - pt_mapping_level()
    - pt_update_entry()
    - pt_next_level()
    - pt_check_entry()
    
    To support these operations, add functions for creating,
    mapping, and unmapping Xen tables:
    - create_table()
    - map_table()
    - unmap_table()
    
    Introduce PTE_SMALL to indicate that 4KB mapping is needed
    and PTE_POPULATE.
    
    In addition introduce flush_tlb_range_va() for TLB flushing across
    CPUs after updating the PTE for the requested mapping.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/Makefile                     |   1 +
 xen/arch/riscv/include/asm/flushtlb.h       |   9 +
 xen/arch/riscv/include/asm/mm.h             |   2 +
 xen/arch/riscv/include/asm/page.h           |  80 ++++++
 xen/arch/riscv/include/asm/riscv_encoding.h |   2 +
 xen/arch/riscv/mm.c                         |   9 -
 xen/arch/riscv/pt.c                         | 421 ++++++++++++++++++++++++++++
 7 files changed, 515 insertions(+), 9 deletions(-)

diff --git a/xen/arch/riscv/Makefile b/xen/arch/riscv/Makefile
index 6832549133..a5eb2aed4b 100644
--- a/xen/arch/riscv/Makefile
+++ b/xen/arch/riscv/Makefile
@@ -1,6 +1,7 @@
 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
 obj-y += entry.o
 obj-y += mm.o
+obj-y += pt.o
 obj-$(CONFIG_RISCV_64) += riscv64/
 obj-y += sbi.o
 obj-y += setup.o
diff --git a/xen/arch/riscv/include/asm/flushtlb.h b/xen/arch/riscv/include/asm/flushtlb.h
index f4a735fd6c..43214f5e95 100644
--- a/xen/arch/riscv/include/asm/flushtlb.h
+++ b/xen/arch/riscv/include/asm/flushtlb.h
@@ -5,12 +5,21 @@
 #include <xen/bug.h>
 #include <xen/cpumask.h>
 
+#include <asm/sbi.h>
+
 /* Flush TLB of local processor for address va. */
 static inline void flush_tlb_one_local(vaddr_t va)
 {
     asm volatile ( "sfence.vma %0" :: "r" (va) : "memory" );
 }
 
+/* Flush a range of VA's hypervisor mappings from the TLB of all processors. */
+static inline void flush_tlb_range_va(vaddr_t va, size_t size)
+{
+    BUG_ON(!sbi_has_rfence());
+    sbi_remote_sfence_vma(NULL, va, size);
+}
+
 /*
  * Filter the given set of CPUs, removing those that definitely flushed their
  * TLB since @page_timestamp.
diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/mm.h
index a0bdc2bc3a..ce1557bb27 100644
--- a/xen/arch/riscv/include/asm/mm.h
+++ b/xen/arch/riscv/include/asm/mm.h
@@ -42,6 +42,8 @@ static inline void *maddr_to_virt(paddr_t ma)
 #define virt_to_mfn(va)     __virt_to_mfn(va)
 #define mfn_to_virt(mfn)    __mfn_to_virt(mfn)
 
+#define mfn_from_pte(pte) maddr_to_mfn(pte_to_paddr(pte))
+
 struct page_info
 {
     /* Each frame can be threaded onto a doubly-linked list. */
diff --git a/xen/arch/riscv/include/asm/page.h b/xen/arch/riscv/include/asm/page.h
index eb79cb9409..89fa290697 100644
--- a/xen/arch/riscv/include/asm/page.h
+++ b/xen/arch/riscv/include/asm/page.h
@@ -21,6 +21,11 @@
 #define XEN_PT_LEVEL_MAP_MASK(lvl)  (~(XEN_PT_LEVEL_SIZE(lvl) - 1))
 #define XEN_PT_LEVEL_MASK(lvl)      (VPN_MASK << XEN_PT_LEVEL_SHIFT(lvl))
 
+/*
+ * PTE format:
+ * | XLEN-1  10 | 9             8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
+ *       PFN      reserved for SW   D   A   G   U   X   W   R   V
+ */
 #define PTE_VALID                   BIT(0, UL)
 #define PTE_READABLE                BIT(1, UL)
 #define PTE_WRITABLE                BIT(2, UL)
@@ -34,15 +39,49 @@
 #define PTE_LEAF_DEFAULT            (PTE_VALID | PTE_READABLE | PTE_WRITABLE)
 #define PTE_TABLE                   (PTE_VALID)
 
+#define PAGE_HYPERVISOR_RO          (PTE_VALID | PTE_READABLE)
 #define PAGE_HYPERVISOR_RW          (PTE_VALID | PTE_READABLE | PTE_WRITABLE)
+#define PAGE_HYPERVISOR_RX          (PTE_VALID | PTE_READABLE | PTE_EXECUTABLE)
 
 #define PAGE_HYPERVISOR             PAGE_HYPERVISOR_RW
 
+/*
+ * The PTE format does not contain the following bits within itself;
+ * they are created artificially to inform the Xen page table
+ * handling algorithm. These bits should not be explicitly written
+ * to the PTE entry.
+ */
+#define PTE_SMALL       BIT(10, UL)
+#define PTE_POPULATE    BIT(11, UL)
+
+#define PTE_ACCESS_MASK (PTE_READABLE | PTE_WRITABLE | PTE_EXECUTABLE)
+
 /* Calculate the offsets into the pagetables for a given VA */
 #define pt_linear_offset(lvl, va)   ((va) >> XEN_PT_LEVEL_SHIFT(lvl))
 
 #define pt_index(lvl, va) (pt_linear_offset((lvl), (va)) & VPN_MASK)
 
+#define PAGETABLE_ORDER_MASK ((_AC(1, U) << PAGETABLE_ORDER) - 1)
+#define TABLE_OFFSET(offs) (_AT(unsigned int, offs) & PAGETABLE_ORDER_MASK)
+
+#if RV_STAGE1_MODE > SATP_MODE_SV39
+#error "need to to update DECLARE_OFFSETS macros"
+#else
+
+#define l0_table_offset(va) TABLE_OFFSET(pt_linear_offset(0, va))
+#define l1_table_offset(va) TABLE_OFFSET(pt_linear_offset(1, va))
+#define l2_table_offset(va) TABLE_OFFSET(pt_linear_offset(2, va))
+
+/* Generate an array @var containing the offset for each level from @addr */
+#define DECLARE_OFFSETS(var, addr)          \
+    const unsigned int var[] = {            \
+        l0_table_offset(addr),              \
+        l1_table_offset(addr),              \
+        l2_table_offset(addr),              \
+    }
+
+#endif
+
 /* Page Table entry */
 typedef struct {
 #ifdef CONFIG_RISCV_64
@@ -68,6 +107,47 @@ static inline bool pte_is_valid(pte_t p)
     return p.pte & PTE_VALID;
 }
 
+/*
+ * From the RISC-V spec:
+ *   The V bit indicates whether the PTE is valid; if it is 0, all other bits
+ *   in the PTE are don’t-cares and may be used freely by software.
+ *
+ *   If V=1 the encoding of PTE R/W/X bits could be find in "the encoding
+ *   of the permission bits" table.
+ *
+ *   The encoding of the permission bits table:
+ *      X W R Meaning
+ *      0 0 0 Pointer to next level of page table.
+ *      0 0 1 Read-only page.
+ *      0 1 0 Reserved for future use.
+ *      0 1 1 Read-write page.
+ *      1 0 0 Execute-only page.
+ *      1 0 1 Read-execute page.
+ *      1 1 0 Reserved for future use.
+ *      1 1 1 Read-write-execute page.
+ */
+static inline bool pte_is_table(pte_t p)
+{
+    /*
+     * According to the spec if V=1 and W=1 then R also needs to be 1 as
+     * R = 0 is reserved for future use ( look at the Table 4.5 ) so check
+     * in ASSERT that if (V==1 && W==1) then R isn't 0.
+     *
+     * PAGE_HYPERVISOR_RW contains PTE_VALID too.
+     */
+    ASSERT(((p.pte & PAGE_HYPERVISOR_RW) != (PTE_VALID | PTE_WRITABLE)));
+
+    return ((p.pte & (PTE_VALID | PTE_ACCESS_MASK)) == PTE_VALID);
+}
+
+static inline bool pte_is_mapping(pte_t p)
+{
+    /* See pte_is_table() */
+    ASSERT(((p.pte & PAGE_HYPERVISOR_RW) != (PTE_VALID | PTE_WRITABLE)));
+
+    return (p.pte & PTE_VALID) && (p.pte & PTE_ACCESS_MASK);
+}
+
 static inline void invalidate_icache(void)
 {
     BUG_ON("unimplemented");
diff --git a/xen/arch/riscv/include/asm/riscv_encoding.h b/xen/arch/riscv/include/asm/riscv_encoding.h
index 58abe5eccc..e31e94e77e 100644
--- a/xen/arch/riscv/include/asm/riscv_encoding.h
+++ b/xen/arch/riscv/include/asm/riscv_encoding.h
@@ -164,6 +164,7 @@
 #define SSTATUS_SD			SSTATUS64_SD
 #define SATP_MODE			SATP64_MODE
 #define SATP_MODE_SHIFT			SATP64_MODE_SHIFT
+#define SATP_PPN_MASK			SATP64_PPN
 
 #define HGATP_PPN			HGATP64_PPN
 #define HGATP_VMID_SHIFT		HGATP64_VMID_SHIFT
@@ -174,6 +175,7 @@
 #define SSTATUS_SD			SSTATUS32_SD
 #define SATP_MODE			SATP32_MODE
 #define SATP_MODE_SHIFT			SATP32_MODE_SHIFT
+#define SATP_PPN_MASK			SATP32_PPN
 
 #define HGATP_PPN			HGATP32_PPN
 #define HGATP_VMID_SHIFT		HGATP32_VMID_SHIFT
diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c
index b8ff91cf4e..e8430def14 100644
--- a/xen/arch/riscv/mm.c
+++ b/xen/arch/riscv/mm.c
@@ -369,12 +369,3 @@ 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/pt.c b/xen/arch/riscv/pt.c
new file mode 100644
index 0000000000..cc5e2d3266
--- /dev/null
+++ b/xen/arch/riscv/pt.c
@@ -0,0 +1,421 @@
+#include <xen/bug.h>
+#include <xen/domain_page.h>
+#include <xen/errno.h>
+#include <xen/lib.h>
+#include <xen/mm.h>
+#include <xen/pfn.h>
+#include <xen/pmap.h>
+#include <xen/spinlock.h>
+
+#include <asm/flushtlb.h>
+#include <asm/page.h>
+
+static inline mfn_t get_root_page(void)
+{
+    paddr_t root_maddr = pfn_to_paddr(csr_read(CSR_SATP) & SATP_PPN_MASK);
+
+    return maddr_to_mfn(root_maddr);
+}
+
+/*
+ * Sanity check a page table entry about to be updated as per an (MFN,flags)
+ * tuple.
+ * See the comment about the possible combination of (mfn, flags) in
+ * the comment above pt_update().
+ */
+static bool pt_check_entry(pte_t entry, mfn_t mfn, unsigned int flags)
+{
+    /* Sanity check when modifying an entry. */
+    if ( (flags & PTE_VALID) && mfn_eq(mfn, INVALID_MFN) )
+    {
+        /* We don't allow modifying an invalid entry. */
+        if ( !pte_is_valid(entry) )
+        {
+            dprintk(XENLOG_ERR, "Modifying invalid entry is not allowed\n");
+            return false;
+        }
+
+        /* We don't allow modifying a table entry */
+        if ( pte_is_table(entry) )
+        {
+            dprintk(XENLOG_ERR, "Modifying a table entry is not allowed\n");
+            return false;
+        }
+    }
+    /* Sanity check when inserting a mapping */
+    else if ( flags & PTE_VALID )
+    {
+        /*
+         * We don't allow replacing any valid entry.
+         *
+         * Note that the function pt_update() relies on this
+         * assumption and will skip the TLB flush (when Svvptc
+         * extension will be ratified). The function will need
+         * to be updated if the check is relaxed.
+         */
+        if ( pte_is_valid(entry) )
+        {
+            if ( pte_is_mapping(entry) )
+                dprintk(XENLOG_ERR, "Changing MFN for valid PTE is not allowed (%#"PRI_mfn" -> %#"PRI_mfn")\n",
+                        mfn_x(mfn_from_pte(entry)), mfn_x(mfn));
+            else
+                dprintk(XENLOG_ERR, "Trying to replace table with mapping\n");
+            return false;
+        }
+    }
+    /* Sanity check when removing a mapping. */
+    else if ( !(flags & PTE_POPULATE) )
+    {
+        /* We should be here with an invalid MFN. */
+        ASSERT(mfn_eq(mfn, INVALID_MFN));
+
+        /* We don't allow removing a table */
+        if ( pte_is_table(entry) )
+        {
+            dprintk(XENLOG_ERR, "Removing a table is not allowed\n");
+            return false;
+        }
+    }
+    /* Sanity check when populating the page-table. No check so far. */
+    else
+    {
+        /* We should be here with an invalid MFN */
+        ASSERT(mfn_eq(mfn, INVALID_MFN));
+    }
+
+    return true;
+}
+
+static pte_t *map_table(mfn_t mfn)
+{
+    /*
+     * During early boot, map_domain_page() may be unusable. Use the
+     * PMAP to map temporarily a page-table.
+     */
+    if ( system_state == SYS_STATE_early_boot )
+        return pmap_map(mfn);
+
+    return map_domain_page(mfn);
+}
+
+static void unmap_table(const pte_t *table)
+{
+    /*
+     * During early boot, map_table() will not use map_domain_page()
+     * but the PMAP.
+     */
+    if ( system_state == SYS_STATE_early_boot )
+        pmap_unmap(table);
+    else
+        unmap_domain_page(table);
+}
+
+static bool create_table(pte_t *entry)
+{
+    mfn_t mfn;
+    void *p;
+    pte_t pte;
+
+    if ( system_state != SYS_STATE_early_boot )
+    {
+        struct page_info *pg = alloc_domheap_page(NULL, 0);
+
+        if ( pg == NULL )
+            return false;
+
+        mfn = page_to_mfn(pg);
+    }
+    else
+        mfn = alloc_boot_pages(1, 1);
+
+    p = map_table(mfn);
+    clear_page(p);
+    unmap_table(p);
+
+    pte = pte_from_mfn(mfn, PTE_TABLE);
+    write_pte(entry, pte);
+
+    return true;
+}
+
+#define XEN_TABLE_MAP_NONE 0
+#define XEN_TABLE_MAP_NOMEM 1
+#define XEN_TABLE_SUPER_PAGE 2
+#define XEN_TABLE_NORMAL 3
+
+/*
+ * Take the currently mapped table, find the corresponding entry,
+ * and map the next table, if available.
+ *
+ * The alloc_tbl parameters indicates whether intermediate tables should
+ * be allocated when not present.
+ *
+ * Return values:
+ *  XEN_TABLE_MAP_NONE: a table allocation isn't permitted.
+ *  XEN_TABLE_MAP_NOMEM: allocating a new page failed.
+ *  XEN_TABLE_NORMAL: next level or leaf mapped normally.
+ *  XEN_TABLE_SUPER_PAGE: The next entry points to a superpage.
+ */
+static int pt_next_level(bool alloc_tbl, pte_t **table, unsigned int offset)
+{
+    pte_t *entry;
+    mfn_t mfn;
+
+    entry = *table + offset;
+
+    if ( !pte_is_valid(*entry) )
+    {
+        if ( !alloc_tbl )
+            return XEN_TABLE_MAP_NONE;
+
+        if ( !create_table(entry) )
+            return XEN_TABLE_MAP_NOMEM;
+    }
+
+    if ( pte_is_mapping(*entry) )
+        return XEN_TABLE_SUPER_PAGE;
+
+    mfn = mfn_from_pte(*entry);
+
+    unmap_table(*table);
+    *table = map_table(mfn);
+
+    return XEN_TABLE_NORMAL;
+}
+
+/* Update an entry at the level @target. */
+static int pt_update_entry(mfn_t root, vaddr_t virt,
+                           mfn_t mfn, unsigned int target,
+                           unsigned int flags)
+{
+    int rc;
+    unsigned int level = HYP_PT_ROOT_LEVEL;
+    pte_t *table;
+    /*
+     * The intermediate page table shouldn't be allocated when MFN isn't
+     * valid and we are not populating page table.
+     * This means we either modify permissions or remove an entry, or
+     * inserting brand new entry.
+     *
+     * See the comment above pt_update() for an additional explanation about
+     * combinations of (mfn, flags).
+    */
+    bool alloc_tbl = !mfn_eq(mfn, INVALID_MFN) || (flags & PTE_POPULATE);
+    pte_t pte, *entry;
+
+    /* convenience aliases */
+    DECLARE_OFFSETS(offsets, virt);
+
+    table = map_table(root);
+    for ( ; level > target; level-- )
+    {
+        rc = pt_next_level(alloc_tbl, &table, offsets[level]);
+        if ( rc == XEN_TABLE_MAP_NOMEM )
+        {
+            rc = -ENOMEM;
+            goto out;
+        }
+
+        if ( rc == XEN_TABLE_MAP_NONE )
+        {
+            rc = 0;
+            goto out;
+        }
+
+        if ( rc != XEN_TABLE_NORMAL )
+            break;
+    }
+
+    if ( level != target )
+    {
+        dprintk(XENLOG_ERR,
+                "%s: Shattering superpage is not supported\n", __func__);
+        rc = -EOPNOTSUPP;
+        goto out;
+    }
+
+    entry = table + offsets[level];
+
+    rc = -EINVAL;
+    if ( !pt_check_entry(*entry, mfn, flags) )
+        goto out;
+
+    /* We are removing the page */
+    if ( !(flags & PTE_VALID) )
+        /*
+         * There is also a check in pt_check_entry() which check that
+         * mfn=INVALID_MFN
+         */
+        pte.pte = 0;
+    else
+    {
+        /* We are inserting a mapping => Create new pte. */
+        if ( !mfn_eq(mfn, INVALID_MFN) )
+            pte = pte_from_mfn(mfn, PTE_VALID);
+        else /* We are updating the permission => Copy the current pte. */
+        {
+            pte = *entry;
+            pte.pte &= ~PTE_ACCESS_MASK;
+        }
+
+        /* update permission according to the flags */
+        pte.pte |= (flags & PTE_ACCESS_MASK) | PTE_ACCESSED | PTE_DIRTY;
+    }
+
+    write_pte(entry, pte);
+
+    rc = 0;
+
+ out:
+    unmap_table(table);
+
+    return rc;
+}
+
+/* Return the level where mapping should be done */
+static int pt_mapping_level(unsigned long vfn, mfn_t mfn, unsigned long nr,
+                            unsigned int flags)
+{
+    unsigned int level = 0;
+    unsigned long mask;
+    unsigned int i;
+
+    /*
+     * Use a larger mapping than 4K unless the caller specifically requests
+     * 4K mapping
+     */
+    if ( unlikely(flags & PTE_SMALL) )
+        return level;
+
+    /*
+     * Don't take into account the MFN when removing mapping (i.e
+     * MFN_INVALID) to calculate the correct target order.
+     *
+     * `vfn` and `mfn` must be both superpage aligned.
+     * They are or-ed together and then checked against the size of
+     * each level.
+     *
+     * `left` ( variable declared in pt_update() ) is not included
+     * and checked separately to allow superpage mapping even if it
+     * is not properly aligned (the user may have asked to map 2MB + 4k).
+     */
+    mask = !mfn_eq(mfn, INVALID_MFN) ? mfn_x(mfn) : 0;
+    mask |= vfn;
+
+    for ( i = HYP_PT_ROOT_LEVEL; i != 0; i-- )
+    {
+        if ( !(mask & (BIT(XEN_PT_LEVEL_ORDER(i), UL) - 1)) &&
+             (nr >= BIT(XEN_PT_LEVEL_ORDER(i), UL)) )
+        {
+            level = i;
+            break;
+        }
+    }
+
+    return level;
+}
+
+static DEFINE_SPINLOCK(pt_lock);
+
+/*
+ * If `mfn` equals `INVALID_MFN`, it indicates that the following page table
+ * update operation might be related to either:
+ *   - populating the table (PTE_POPULATE will be set additionaly),
+ *   - destroying a mapping (PTE_VALID=0),
+ *   - modifying an existing mapping (PTE_VALID=1).
+ *
+ * If `mfn` != INVALID_MFN and flags has PTE_VALID bit set then it means that
+ * inserting will be done.
+ */
+static int pt_update(vaddr_t virt, mfn_t mfn,
+                     unsigned long nr_mfns, unsigned int flags)
+{
+    int rc = 0;
+    unsigned long vfn = PFN_DOWN(virt);
+    unsigned long left = nr_mfns;
+    const mfn_t root = get_root_page();
+
+    /*
+     * It is bad idea to have mapping both writeable and
+     * executable.
+     * When modifying/creating mapping (i.e PTE_VALID is set),
+     * prevent any update if this happen.
+     */
+    if ( (flags & PTE_VALID) && (flags & PTE_WRITABLE) &&
+         (flags & PTE_EXECUTABLE) )
+    {
+        dprintk(XENLOG_ERR,
+                "Mappings should not be both Writeable and Executable\n");
+        return -EINVAL;
+    }
+
+    if ( !IS_ALIGNED(virt, PAGE_SIZE) )
+    {
+        dprintk(XENLOG_ERR,
+                "The virtual address is not aligned to the page-size\n");
+        return -EINVAL;
+    }
+
+    spin_lock(&pt_lock);
+
+    while ( left )
+    {
+        unsigned int order, level;
+
+        level = pt_mapping_level(vfn, mfn, left, flags);
+        order = XEN_PT_LEVEL_ORDER(level);
+
+        ASSERT(left >= BIT(order, UL));
+
+        rc = pt_update_entry(root, vfn << PAGE_SHIFT, mfn, level, flags);
+        if ( rc )
+            break;
+
+        vfn += 1UL << order;
+        if ( !mfn_eq(mfn, INVALID_MFN) )
+            mfn = mfn_add(mfn, 1UL << order);
+
+        left -= (1UL << order);
+    }
+
+    /* Ensure that PTEs are all updated before flushing */
+    RISCV_FENCE(rw, rw);
+
+    spin_unlock(&pt_lock);
+
+    /*
+     * Always flush TLB at the end of the function as non-present entries
+     * can be put in the TLB.
+     *
+     * The remote fence operation applies to the entire address space if
+     * either:
+     *  - start and size are both 0, or
+     *  - size is equal to 2^XLEN-1.
+     *
+     * TODO: come up with something which will allow not to flash the entire
+     *       address space.
+     */
+    flush_tlb_range_va(0, 0);
+
+    return rc;
+}
+
+int map_pages_to_xen(unsigned long virt,
+                     mfn_t mfn,
+                     unsigned long nr_mfns,
+                     unsigned int flags)
+{
+    /*
+     * Ensure that flags has PTE_VALID bit as map_pages_to_xen() is supposed
+     * to create a mapping.
+     *
+     * Ensure that we have a valid MFN before proceeding.
+     *
+     * If the MFN is invalid, pt_update() might misinterpret the operation,
+     * treating it as either a population, a mapping destruction,
+     * or a mapping modification.
+     */
+    ASSERT(!mfn_eq(mfn, INVALID_MFN) && (flags & PTE_VALID));
+
+    return pt_update(virt, mfn, nr_mfns, flags);
+}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 02 07:00:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 02 Oct 2024 07:00:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.808611.1220547 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svtLC-0002ww-56; Wed, 02 Oct 2024 07:00:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 808611.1220547; Wed, 02 Oct 2024 07: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 1svtLC-0002wp-27; Wed, 02 Oct 2024 07:00:06 +0000
Received: by outflank-mailman (input) for mailman id 808611;
 Wed, 02 Oct 2024 07: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 1svtLA-0002c4-BQ
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 07: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 1svtL9-0008FK-Qi
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 07:00:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svtL9-0003MV-PP
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 07: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=eOI5sg5hkMRiUw3MmgaZGjtpsno+gM9BLVSqhF7aRt0=; b=Knts6Pa6Df7KlPXOCOPBjvtTDg
	o4u6uQC+kyqu7yq99MsdC0Dw1PkvZ+UEu6x+DXsIKXQ+7wQvtZhC5n8BFwUoNfQ65qy/Ztrvrtvyh
	atiOizyTM7t2guFX+UKNlzVILknkCmy/dBxdlgep1T/pRZVpQ40Rq7RCFGBLWPkoWGl4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: prefer RDTSCP in rdtsc_ordered()
Message-Id: <E1svtL9-0003MV-PP@xenbits.xenproject.org>
Date: Wed, 02 Oct 2024 07:00:03 +0000

commit 3a38cc2bd753fc0f19bfc1bd5da1d8d662d8b730
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Oct 2 08:52:18 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 2 08:52:18 2024 +0200

    x86: prefer RDTSCP in rdtsc_ordered()
    
    If available, its use is supposed to be cheaper than LFENCE+RDTSC, and
    is virtually guaranteed to be cheaper than MFENCE+RDTSC.
    
    Update commentary (and indentation) while there.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/msr.h | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index e1e7439d6c..355fb324ec 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -108,18 +108,24 @@ static inline uint64_t rdtsc(void)
 
 static inline uint64_t rdtsc_ordered(void)
 {
-	/*
-	 * The RDTSC instruction is not ordered relative to memory access.
-	 * The Intel SDM and the AMD APM are both vague on this point, but
-	 * empirically an RDTSC instruction can be speculatively executed
-	 * before prior loads.  An RDTSC immediately after an appropriate
-	 * barrier appears to be ordered as a normal load, that is, it
-	 * provides the same ordering guarantees as reading from a global
-	 * memory location that some other imaginary CPU is updating
-	 * continuously with a time stamp.
-	 */
-	alternative("lfence", "mfence", X86_FEATURE_MFENCE_RDTSC);
-	return rdtsc();
+    uint64_t low, high, aux;
+
+    /*
+     * The RDTSC instruction is not serializing.  Make it dispatch serializing
+     * for the purposes here by issuing LFENCE (or MFENCE if necessary) ahead
+     * of it.
+     *
+     * RDTSCP, otoh, "does wait until all previous instructions have executed
+     * and all previous loads are globally visible" (SDM) / "forces all older
+     * instructions to retire before reading the timestamp counter" (APM).
+     */
+    alternative_io_2("lfence; rdtsc",
+                     "mfence; rdtsc", X86_FEATURE_MFENCE_RDTSC,
+                     "rdtscp",        X86_FEATURE_RDTSCP,
+                     ASM_OUTPUT2("=a" (low), "=d" (high), "=c" (aux)),
+                     /* no inputs */);
+
+    return (high << 32) | low;
 }
 
 #define __write_tsc(val) wrmsrl(MSR_IA32_TSC, val)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 02 07:00:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 02 Oct 2024 07:00:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.808613.1220556 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svtLV-000318-8V; Wed, 02 Oct 2024 07:00:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 808613.1220556; Wed, 02 Oct 2024 07: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 1svtLV-000310-5G; Wed, 02 Oct 2024 07:00:25 +0000
Received: by outflank-mailman (input) for mailman id 808613;
 Wed, 02 Oct 2024 07: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 1svtLU-00030n-4x
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 07: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 1svtLU-0008Fb-3R
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 07:00:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svtLU-0004tI-1n
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 07: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=sTJnxJW9ZZx22qfsJ9KPgrgHpbMUos2HSP4JweGzh00=; b=xDf9BEVPRmPinLl8EFNg35vIlT
	PO5apffrzMsiKziv991Q05xGhfJaQGG4KCbBFs2FeKekxCSlLH6k8VIihqtuB/TtnO2NXm/pzyjNR
	ZhSjPgyBq+y3cgfX4n0dUI4tpoz46oYjxioJFtKQGOdXJ+KwcU5vWfvdvTmuO5VFIIQY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: introduce early_fdt_map()
Message-Id: <E1svtLU-0004tI-1n@xenbits.xenproject.org>
Date: Wed, 02 Oct 2024 07:00:24 +0000

commit bcd932b5b2b8647f831066c6c6c11064b3645cdd
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Oct 2 08:54:36 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 2 08:54:36 2024 +0200

    xen/riscv: introduce early_fdt_map()
    
    Introduce function which allows to map FDT to Xen.
    
    Also, initialization of device_tree_flattened happens using
    early_fdt_map().
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/mm.h |  2 ++
 xen/arch/riscv/mm.c             | 55 +++++++++++++++++++++++++++++++++++++++++
 xen/arch/riscv/setup.c          |  7 ++++++
 3 files changed, 64 insertions(+)

diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/mm.h
index ce1557bb27..4b7b00b850 100644
--- a/xen/arch/riscv/include/asm/mm.h
+++ b/xen/arch/riscv/include/asm/mm.h
@@ -259,4 +259,6 @@ static inline unsigned int arch_get_dma_bitsize(void)
 
 void setup_fixmap_mappings(void);
 
+void *early_fdt_map(paddr_t fdt_paddr);
+
 #endif /* _ASM_RISCV_MM_H */
diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c
index e8430def14..4a628aef83 100644
--- a/xen/arch/riscv/mm.c
+++ b/xen/arch/riscv/mm.c
@@ -1,13 +1,16 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
+#include <xen/bootfdt.h>
 #include <xen/bug.h>
 #include <xen/compiler.h>
 #include <xen/init.h>
 #include <xen/kernel.h>
+#include <xen/libfdt/libfdt.h>
 #include <xen/macros.h>
 #include <xen/mm.h>
 #include <xen/pfn.h>
 #include <xen/sections.h>
+#include <xen/sizes.h>
 
 #include <asm/early_printk.h>
 #include <asm/csr.h>
@@ -369,3 +372,55 @@ int destroy_xen_mappings(unsigned long s, unsigned long e)
     BUG_ON("unimplemented");
     return -1;
 }
+
+void * __init early_fdt_map(paddr_t fdt_paddr)
+{
+    /* We are using 2MB superpage for mapping the FDT */
+    paddr_t base_paddr = fdt_paddr & XEN_PT_LEVEL_MAP_MASK(1);
+    paddr_t offset;
+    void *fdt_virt;
+    uint32_t size;
+    int rc;
+
+    /*
+     * Check whether the physical FDT address is set and meets the minimum
+     * alignment requirement. Since we are relying on MIN_FDT_ALIGN to be at
+     * least 8 bytes so that we always access the magic and size fields
+     * of the FDT header after mapping the first chunk, double check if
+     * that is indeed the case.
+     */
+    BUILD_BUG_ON(MIN_FDT_ALIGN < 8);
+    if ( !fdt_paddr || fdt_paddr % MIN_FDT_ALIGN )
+        return NULL;
+
+    /* The FDT is mapped using 2MB superpage */
+    BUILD_BUG_ON(BOOT_FDT_VIRT_START % MB(2));
+
+    rc = map_pages_to_xen(BOOT_FDT_VIRT_START, maddr_to_mfn(base_paddr),
+                          MB(2) >> PAGE_SHIFT,
+                          PAGE_HYPERVISOR_RO);
+    if ( rc )
+        panic("Unable to map the device-tree.\n");
+
+    offset = fdt_paddr % XEN_PT_LEVEL_SIZE(1);
+    fdt_virt = (void *)BOOT_FDT_VIRT_START + offset;
+
+    if ( fdt_magic(fdt_virt) != FDT_MAGIC )
+        return NULL;
+
+    size = fdt_totalsize(fdt_virt);
+    if ( size > BOOT_FDT_VIRT_SIZE )
+        return NULL;
+
+    if ( (offset + size) > MB(2) )
+    {
+        rc = map_pages_to_xen(BOOT_FDT_VIRT_START + MB(2),
+                              maddr_to_mfn(base_paddr + MB(2)),
+                              MB(2) >> PAGE_SHIFT,
+                              PAGE_HYPERVISOR_RO);
+        if ( rc )
+            panic("Unable to map the device-tree\n");
+    }
+
+    return fdt_virt;
+}
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index 1d81e0b64f..6d156c3a40 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -2,6 +2,7 @@
 
 #include <xen/bug.h>
 #include <xen/compile.h>
+#include <xen/device_tree.h>
 #include <xen/init.h>
 #include <xen/mm.h>
 #include <xen/shutdown.h>
@@ -37,6 +38,12 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
 
     setup_fixmap_mappings();
 
+    device_tree_flattened = early_fdt_map(dtb_addr);
+    if ( !device_tree_flattened )
+        panic("Invalid device tree blob at physical address %#lx. The DTB must be 8-byte aligned and must not exceed %lld bytes in size.\n\n"
+              "Please check your bootloader.\n",
+              dtb_addr, BOOT_FDT_VIRT_SIZE);
+
     printk("All set up\n");
 
     machine_halt();
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 02 07:00:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 02 Oct 2024 07:00:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.808615.1220559 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svtLf-00034a-BO; Wed, 02 Oct 2024 07:00:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 808615.1220559; Wed, 02 Oct 2024 07: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 1svtLf-00034S-8Y; Wed, 02 Oct 2024 07:00:35 +0000
Received: by outflank-mailman (input) for mailman id 808615;
 Wed, 02 Oct 2024 07: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 1svtLe-00034H-8z
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 07: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 1svtLe-0008Fl-7P
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 07:00:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svtLe-0004uj-5W
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 07: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=ZQzqT2+80Td2ZBjXnXOMvKBmMqIgw963zqP2p7mdeV4=; b=sIIKIfNnuWnWLcHz35tuapUWOt
	CxVdVl8NSVp7CMWTCqn+WbGmNXRS2kG8CbbwhhQc6ECl12pMHIhiGl6Wsa7Ri640uOxEIwqcKw7ah
	V5ssupysELjD+B1cJ3hVHzZ/gc+uDzhc98zLU4aTQm3f+fHtcX+uWUWQC5RlKuT4CTFo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] VMX: convert entry point annotations
Message-Id: <E1svtLe-0004uj-5W@xenbits.xenproject.org>
Date: Wed, 02 Oct 2024 07:00:34 +0000

commit 1d199e83c7f7a4a10cb2076a1b8a8eecbd3dfd29
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Oct 2 08:55:02 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 2 08:55:02 2024 +0200

    VMX: convert entry point annotations
    
    Use the generic framework from xen/linkage.h.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/vmx/entry.S | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S
index 7233e771d8..6aaeb28a5b 100644
--- a/xen/arch/x86/hvm/vmx/entry.S
+++ b/xen/arch/x86/hvm/vmx/entry.S
@@ -24,7 +24,7 @@
 #define VMRESUME     .byte 0x0f,0x01,0xc3
 #define VMLAUNCH     .byte 0x0f,0x01,0xc2
 
-ENTRY(vmx_asm_vmexit_handler)
+FUNC(vmx_asm_vmexit_handler)
         SAVE_ALL
 
         mov  %cr2,%rax
@@ -187,7 +187,7 @@ UNLIKELY_END(realmode)
         call vmx_vmentry_failure
         jmp  .Lvmx_process_softirqs
 
-ENTRY(vmx_asm_do_vmentry)
+LABEL(vmx_asm_do_vmentry)
         GET_CURRENT(bx)
         jmp  .Lvmx_do_vmentry
 
@@ -205,6 +205,4 @@ ENTRY(vmx_asm_do_vmentry)
         sti
         call do_softirq
         jmp  .Lvmx_do_vmentry
-
-        .type vmx_asm_vmexit_handler, @function
-        .size vmx_asm_vmexit_handler, . - vmx_asm_vmexit_handler
+END(vmx_asm_vmexit_handler)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 02 07:00:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 02 Oct 2024 07:00:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.808616.1220563 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svtLq-00037d-CT; Wed, 02 Oct 2024 07:00:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 808616.1220563; Wed, 02 Oct 2024 07:00: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 1svtLq-00037V-9v; Wed, 02 Oct 2024 07:00:46 +0000
Received: by outflank-mailman (input) for mailman id 808616;
 Wed, 02 Oct 2024 07: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 1svtLo-00037A-CF
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 07: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 1svtLo-0008G8-AK
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 07:00:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svtLo-0004w5-9V
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 07: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=Ar5uBUaRCcYiV18WQEw8MhNUPyHIrH2HHuGzl7QwSnQ=; b=SETryxM4ylvKHJYHkcQK0SFwii
	EGGZ8QkPv53RiTzRB554B136zaWpViigzwgxLWm/hMLxzJCC9NM5Bfc5a9jxMeZd4ivTAW/tKQYsn
	Q20rbcjVC6xKrsjXpIrMpvhHDoDz7hTEHrYoQAzjkM4ixLoudXHEdR9a2S32Edg7XIXg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/ACPI: annotate assembly function/data with type and size
Message-Id: <E1svtLo-0004w5-9V@xenbits.xenproject.org>
Date: Wed, 02 Oct 2024 07:00:44 +0000

commit a8c8d6c5299a356919e4d059403c7f9c2971e7b2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Oct 2 08:55:31 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 2 08:55:31 2024 +0200

    x86/ACPI: annotate assembly function/data with type and size
    
    Use the generic framework from xen/linkage.h.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/acpi/wakeup_prot.S | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/acpi/wakeup_prot.S b/xen/arch/x86/acpi/wakeup_prot.S
index 3855ff1ddb..8ce57ad137 100644
--- a/xen/arch/x86/acpi/wakeup_prot.S
+++ b/xen/arch/x86/acpi/wakeup_prot.S
@@ -7,7 +7,7 @@
         .text
         .code64
 
-ENTRY(do_suspend_lowlevel)
+FUNC(do_suspend_lowlevel)
         push    %rbp
         push    %rbx
         push    %r12
@@ -43,7 +43,7 @@ ENTRY(do_suspend_lowlevel)
          *
          * Everything else, including the stack, needs restoring.
          */
-ENTRY(s3_resume)
+LABEL(s3_resume)
         lgdt    boot_gdtr(%rip)
 
         mov     saved_cr0(%rip), %rax
@@ -132,6 +132,7 @@ ENTRY(s3_resume)
         pop     %rbx
         pop     %rbp
         ret
+END(do_suspend_lowlevel)
 
 .data
         .align 16
@@ -142,5 +143,4 @@ saved_cr0:      .quad   0
 saved_ssp:      .quad   0
 #endif
 
-GLOBAL(saved_magic)
-        .long   0x9abcdef0
+ASM_INT(saved_magic, 0x9abcdef0)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 02 07:00:56 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 02 Oct 2024 07:00:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.808617.1220567 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svtM0-0003AJ-Ds; Wed, 02 Oct 2024 07:00:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 808617.1220567; Wed, 02 Oct 2024 07:00: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 1svtM0-0003AB-BI; Wed, 02 Oct 2024 07:00:56 +0000
Received: by outflank-mailman (input) for mailman id 808617;
 Wed, 02 Oct 2024 07: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 1svtLy-00039w-Ev
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 07: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 1svtLy-0008GF-DQ
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 07:00:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svtLy-0004xT-CN
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 07: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=UqKmiD9K+TKloYWrKEgawsZ2ROaQi4lUesJALuaOrZc=; b=J/1zMhudEq1dN2fmlIuympoW29
	tKQlOgoQdaEHU4ApJVR+0WJ13L/WnldBZ5/NaTl3IwKjjmaiHe1YNkS7b48KJkPSSByKPA/yduM1u
	Ztw/OozO8wQrD/W8Q41H8BFN9ZFPUBEadLgbh4/3mT2kP2vQRlM71eFOvQm0T1CIJ54g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/kexec: convert entry point annotations
Message-Id: <E1svtLy-0004xT-CN@xenbits.xenproject.org>
Date: Wed, 02 Oct 2024 07:00:54 +0000

commit 373d93cfce4d6f5b87e9d777da963664fd0dfb74
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Oct 2 08:56:04 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 2 08:56:04 2024 +0200

    x86/kexec: convert entry point annotations
    
    Use the generic framework from xen/linkage.h.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_64/kexec_reloc.S | 40 +++++++++++++++++----------------------
 1 file changed, 17 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/x86_64/kexec_reloc.S b/xen/arch/x86/x86_64/kexec_reloc.S
index 035164e96f..9f40c80d7c 100644
--- a/xen/arch/x86/x86_64/kexec_reloc.S
+++ b/xen/arch/x86/x86_64/kexec_reloc.S
@@ -13,6 +13,9 @@
 
         .file __FILE__
 
+/* All contents of .text.kexec wants to be kept together. */
+#undef CONFIG_CC_SPLIT_SECTIONS
+
 #include <xen/kimage.h>
 
 #include <asm/asm_defns.h>
@@ -21,10 +24,9 @@
 #include <asm/machine_kexec.h>
 
         .section .text.kexec, "ax", @progbits
-        .align PAGE_SIZE
         .code64
 
-ENTRY(kexec_reloc)
+FUNC(kexec_reloc, PAGE_SIZE)
         /* %rdi - code page maddr */
         /* %rsi - page table maddr */
         /* %rdx - indirection page maddr */
@@ -91,8 +93,9 @@ ENTRY(kexec_reloc)
         push    $0x10
         push    %rax
         lretq
+END(kexec_reloc)
 
-relocate_pages:
+FUNC_LOCAL(relocate_pages)
         /* %rdi - indirection page maddr */
         pushq   %rbx
 
@@ -138,10 +141,11 @@ relocate_pages:
 .L_done:
         popq    %rbx
         ret
+END(relocate_pages)
 
         .code32
 
-compatibility_mode:
+FUNC_LOCAL(compatibility_mode)
         /* Setup some sane segments. */
         movl    $0x0008, %eax
         movl    %eax, %ds
@@ -168,39 +172,29 @@ compatibility_mode:
         /* Call the image entry point.  This should never return. */
         call    *%ebp
         ud2
+END(compatibility_mode)
 
-        .align 4
-compat_mode_gdt_desc:
+DATA_LOCAL(compat_mode_gdt_desc, 4)
         .word .Lcompat_mode_gdt_end - compat_mode_gdt -1
         .quad 0x0000000000000000     /* set in call_32_bit above */
+END(compat_mode_gdt_desc)
 
-        .type compat_mode_gdt_desc, @object
-        .size compat_mode_gdt_desc, . - compat_mode_gdt_desc
-
-        .align 8
-compat_mode_gdt:
+DATA_LOCAL(compat_mode_gdt, 8)
         .quad 0x0000000000000000     /* null                              */
         .quad 0x00cf93000000ffff     /* 0x0008 ring 0 data                */
         .quad 0x00cf9b000000ffff     /* 0x0010 ring 0 code, compatibility */
 .Lcompat_mode_gdt_end:
+END(compat_mode_gdt)
 
-        .type compat_mode_gdt, @object
-        .size compat_mode_gdt, . - compat_mode_gdt
-
-compat_mode_idt:
+DATA_LOCAL(compat_mode_idt)
         .word 0                      /* limit */
         .long 0                      /* base */
-
-        .type compat_mode_idt, @object
-        .size compat_mode_idt, . - compat_mode_idt
+END(compat_mode_idt)
 
         /*
          * 16 words of stack are more than enough.
          */
-        .align 8
-reloc_stack:
+DATA_LOCAL(reloc_stack, 8)
         .fill 16,8,0
 .Lreloc_stack_base:
-
-        .type reloc_stack, @object
-        .size reloc_stack, . - reloc_stack
+END(reloc_stack)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 02 07:01:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 02 Oct 2024 07:01:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.808618.1220572 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svtMA-0003ET-GN; Wed, 02 Oct 2024 07:01:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 808618.1220572; Wed, 02 Oct 2024 07:01: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 1svtMA-0003EM-Cg; Wed, 02 Oct 2024 07:01:06 +0000
Received: by outflank-mailman (input) for mailman id 808618;
 Wed, 02 Oct 2024 07: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 1svtM8-0003E7-HG
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 07: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 1svtM8-0008Ga-GZ
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 07:01:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svtM8-0004zT-Fc
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 07: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=fUngFaHVlQcCPoV4hKzGq8SM2yCXJL7yod6YqjDwj+c=; b=OFj3v9OPIUTLuJ0nIeVokHdvj/
	myy79wW2PBEGKDcvUl5zINGpDUs4ePEvs6sRqRiqx3v2TAPNqLqNKljSMWHboh/vtC8GtIfilMj3R
	lWRJgIlLmLQYhWOVZyJfhFIBrwUqfB0N1R8jk8qiYa8WBjqof+5DG1XTsadnUOvAIC7U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: convert dom_crash_sync_extable() annotation
Message-Id: <E1svtM8-0004zT-Fc@xenbits.xenproject.org>
Date: Wed, 02 Oct 2024 07:01:04 +0000

commit eaa7a72eda5dfc3e5080479eb9a89ba0171e0ac2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Oct 2 08:56:45 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 2 08:56:45 2024 +0200

    x86: convert dom_crash_sync_extable() annotation
    
    ... to that from the generic framework in xen/linkage.h.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_64/entry.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 9b0cdb7640..3e720a358b 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -624,7 +624,7 @@ domain_crash_page_fault_0x8:
         ALTERNATIVE "", clac, X86_FEATURE_XEN_SMAP
         movq  %rsi,%rdi
         call  show_page_walk
-ENTRY(dom_crash_sync_extable)
+LABEL(dom_crash_sync_extable, 0)
         ALTERNATIVE "", clac, X86_FEATURE_XEN_SMAP
         # Get out of the guest-save area of the stack.
         GET_STACK_END(ax)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 02 07:01:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 02 Oct 2024 07:01:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.808619.1220574 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1svtMK-0003Gv-HB; Wed, 02 Oct 2024 07:01:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 808619.1220574; Wed, 02 Oct 2024 07:01: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 1svtMK-0003Gq-Ea; Wed, 02 Oct 2024 07:01:16 +0000
Received: by outflank-mailman (input) for mailman id 808619;
 Wed, 02 Oct 2024 07: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 1svtMI-0003Gd-KP
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 07: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 1svtMI-0008Gk-Jm
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 07:01:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1svtMI-00052C-Iq
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 07: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=HcQ4g8Rp3xI0tIifWmEY1gm0a6opKp+CvZ52Us6fvC0=; b=p22U1+NPZdiNsXgQLIqbwlSgs9
	v80Lr/U1DJ5PeQgErl/nXGg6QszM7DiHe1hTH3IoYF+/D+zGSniUZmP6SJ2JvFv6T5euPsOKUs0Po
	QGwskBDjcG3DL02FNanmIrvto+VlVHaPoWq9OqSJ/tSOoW62vHo59WNRO94o5EcOiKXs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: move ENTRY(), GLOBAL(), and ALIGN
Message-Id: <E1svtMI-00052C-Iq@xenbits.xenproject.org>
Date: Wed, 02 Oct 2024 07:01:14 +0000

commit b102c9f1ce29262f33400920eeb41f23394ea99d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Oct 2 08:59:03 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 2 08:59:03 2024 +0200

    x86: move ENTRY(), GLOBAL(), and ALIGN
    
    ... to boot code, limiting their scope and thus allowing to drop
    respective #undef-s from the linker script.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/head.S          | 9 +++++++++
 xen/arch/x86/include/asm/config.h | 8 --------
 xen/arch/x86/x86_64/entry.S       | 2 +-
 xen/arch/x86/xen.lds.S            | 2 --
 4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index e0901ee400..6a06f6c9ea 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -10,6 +10,15 @@
 #include <asm/cpufeature.h>
 #include <public/elfnote.h>
 
+#define ALIGN .align CONFIG_FUNCTION_ALIGNMENT, CODE_FILL
+#define ENTRY(name)                             \
+  ALIGN;                                        \
+  GLOBAL(name)
+#define GLOBAL(name)                            \
+  .globl name;                                  \
+  .hidden name;                                 \
+  name:
+
         .section .text.header, "ax", @progbits
         .code32
 
diff --git a/xen/arch/x86/include/asm/config.h b/xen/arch/x86/include/asm/config.h
index 1f828bfd52..f8a5a4913b 100644
--- a/xen/arch/x86/include/asm/config.h
+++ b/xen/arch/x86/include/asm/config.h
@@ -42,14 +42,6 @@
 /* Linkage for x86 */
 #ifdef __ASSEMBLY__
 #define CODE_FILL 0x90
-#define ALIGN .align CONFIG_FUNCTION_ALIGNMENT, CODE_FILL
-#define ENTRY(name)                             \
-  ALIGN;                                        \
-  GLOBAL(name)
-#define GLOBAL(name)                            \
-  .globl name;                                  \
-  .hidden name;                                 \
-  name:
 #endif
 
 #define NR_hypercalls 64
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 3e720a358b..c5c723b5f4 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -1254,7 +1254,7 @@ FUNC_LOCAL(autogen_stubs, 0) /* Automatically generated stubs. */
         .if vec >= FIRST_IRQ_VECTOR
 #endif
 
-        ALIGN
+        .align CONFIG_FUNCTION_ALIGNMENT, CODE_FILL
 1:
         ENDBR64
         pushq $0
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index b60d2f0d82..94079fc164 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -5,8 +5,6 @@
 #include <xen/lib.h>
 #include <xen/xen.lds.h>
 #include <asm/page.h>
-#undef ENTRY
-#undef ALIGN
 
 #ifdef EFI
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 02 14:11:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 02 Oct 2024 14:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.808812.1220834 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sw04F-0007s6-HN; Wed, 02 Oct 2024 14:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 808812.1220834; Wed, 02 Oct 2024 14:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sw04F-0007rz-EV; Wed, 02 Oct 2024 14:11:03 +0000
Received: by outflank-mailman (input) for mailman id 808812;
 Wed, 02 Oct 2024 14: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 1sw04E-0007rr-M6
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 14: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 1sw04E-0001Nz-Fx
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 14:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sw04E-0006gm-Dm
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 14:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nXZSE7/27e0drDd9c6iK+Wyp7S5bPFFHZP0aZIOhz5U=; b=Z+r8a44+5T07L5jZLQyVvvq4vB
	cpw6SkaNNEDBxTAKY7pL5DN3zwRLzwO7D1dy+VOCTbVTeDoSraDxg26/Ogx3gPZjUDGVjfy97DwRV
	SqUc1Mufxc8N4FqOrDEq21wdABh4h3YtGAcm1jV/ryDPMDn2XvD89TgiBySjcQg3JgT8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/PV: simplify (and thus correct) guest accessor functions
Message-Id: <E1sw04E-0006gm-Dm@xenbits.xenproject.org>
Date: Wed, 02 Oct 2024 14:11:02 +0000

commit 67a8e5721e1ea9c28526883036bf08fb2e8a8c9c
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Oct 1 09:44:55 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 1 09:44:55 2024 +0200

    x86/PV: simplify (and thus correct) guest accessor functions
    
    Taking a fault on a non-byte-granular insn means that the "number of
    bytes not handled" return value would need extra care in calculating, if
    we want callers to be able to derive e.g. exception context (to be
    injected to the guest) - CR2 for #PF in particular - from the value. To
    simplify things rather than complicating them, reduce inline assembly to
    just byte-granular string insns. On recent CPUs that's also supposed to
    be more efficient anyway.
    
    For singular element accessors, however, alignment checks are added,
    hence slightly complicating the code. Misaligned (user) buffer accesses
    will now be forwarded to copy_{from,to}_guest_ll().
    
    Naturally copy_{from,to}_unsafe_ll() accessors end up being adjusted the
    same way, as they're produced by mere re-processing of the same code.
    Otoh copy_{from,to}_unsafe() aren't similarly adjusted, but have their
    comments made match reality; down the road we may want to change their
    return types, e.g. to bool.
    
    Fixes: 76974398a63c ("Added user-memory accessing functionality for x86_64")
    Fixes: 7b8c36701d26 ("Introduce clear_user and clear_guest")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/uaccess.h | 12 +++----
 xen/arch/x86/usercopy.c            | 66 +++++---------------------------------
 2 files changed, 14 insertions(+), 64 deletions(-)

diff --git a/xen/arch/x86/include/asm/uaccess.h b/xen/arch/x86/include/asm/uaccess.h
index 395dc42795..2d01669b96 100644
--- a/xen/arch/x86/include/asm/uaccess.h
+++ b/xen/arch/x86/include/asm/uaccess.h
@@ -251,7 +251,8 @@ do {                                                                       \
 static always_inline unsigned long
 __copy_to_guest_pv(void __user *to, const void *from, unsigned long n)
 {
-    if (__builtin_constant_p(n)) {
+    if ( __builtin_constant_p(n) && !((unsigned long)to & (n - 1)) )
+    {
         unsigned long ret;
 
         switch (n) {
@@ -291,7 +292,8 @@ __copy_to_guest_pv(void __user *to, const void *from, unsigned long n)
 static always_inline unsigned long
 __copy_from_guest_pv(void *to, const void __user *from, unsigned long n)
 {
-    if (__builtin_constant_p(n)) {
+    if ( __builtin_constant_p(n) && !((unsigned long)from & (n - 1)) )
+    {
         unsigned long ret;
 
         switch (n) {
@@ -321,8 +323,7 @@ __copy_from_guest_pv(void *to, const void __user *from, unsigned long n)
  *
  * Copy data from hypervisor space to a potentially unmapped area.
  *
- * Returns number of bytes that could not be copied.
- * On success, this will be zero.
+ * Returns zero on success and non-zero if some bytes could not be copied.
  */
 static always_inline unsigned int
 copy_to_unsafe(void __user *to, const void *from, unsigned int n)
@@ -358,8 +359,7 @@ copy_to_unsafe(void __user *to, const void *from, unsigned int n)
  *
  * Copy data from a potentially unmapped area space to hypervisor space.
  *
- * Returns number of bytes that could not be copied.
- * On success, this will be zero.
+ * Returns zero on success and non-zero if some bytes could not be copied.
  *
  * If some data could not be copied, this function will pad the copied
  * data to the requested size using zero bytes.
diff --git a/xen/arch/x86/usercopy.c b/xen/arch/x86/usercopy.c
index b8c2d1cc0b..7ab2009efe 100644
--- a/xen/arch/x86/usercopy.c
+++ b/xen/arch/x86/usercopy.c
@@ -16,42 +16,19 @@
 
 unsigned int copy_to_guest_ll(void __user *to, const void *from, unsigned int n)
 {
-    unsigned dummy;
+    GUARD(unsigned dummy);
 
     stac();
     asm volatile (
         GUARD(
         "    guest_access_mask_ptr %[to], %q[scratch1], %q[scratch2]\n"
         )
-        "    cmp  $"STR(2*BYTES_PER_LONG-1)", %[cnt]\n"
-        "    jbe  1f\n"
-        "    mov  %k[to], %[cnt]\n"
-        "    neg  %[cnt]\n"
-        "    and  $"STR(BYTES_PER_LONG-1)", %[cnt]\n"
-        "    sub  %[cnt], %[aux]\n"
-        "4:  rep movsb\n" /* make 'to' address aligned */
-        "    mov  %[aux], %[cnt]\n"
-        "    shr  $"STR(LONG_BYTEORDER)", %[cnt]\n"
-        "    and  $"STR(BYTES_PER_LONG-1)", %[aux]\n"
-        "    .align 2,0x90\n"
-        "0:  rep movs"__OS"\n" /* as many words as possible... */
-        "    mov  %[aux],%[cnt]\n"
-        "1:  rep movsb\n" /* ...remainder copied as bytes */
+        "1:  rep movsb\n"
         "2:\n"
-        ".section .fixup,\"ax\"\n"
-        "5:  add %[aux], %[cnt]\n"
-        "    jmp 2b\n"
-        "3:  lea (%q[aux], %q[cnt], "STR(BYTES_PER_LONG)"), %[cnt]\n"
-        "    jmp 2b\n"
-        ".previous\n"
-        _ASM_EXTABLE(4b, 5b)
-        _ASM_EXTABLE(0b, 3b)
         _ASM_EXTABLE(1b, 2b)
-        : [cnt] "+c" (n), [to] "+D" (to), [from] "+S" (from),
-          [aux] "=&r" (dummy)
+        : [cnt] "+c" (n), [to] "+D" (to), [from] "+S" (from)
           GUARD(, [scratch1] "=&r" (dummy), [scratch2] "=&r" (dummy))
-        : "[aux]" (n)
-        : "memory" );
+        :: "memory" );
     clac();
 
     return n;
@@ -66,25 +43,9 @@ unsigned int copy_from_guest_ll(void *to, const void __user *from, unsigned int
         GUARD(
         "    guest_access_mask_ptr %[from], %q[scratch1], %q[scratch2]\n"
         )
-        "    cmp  $"STR(2*BYTES_PER_LONG-1)", %[cnt]\n"
-        "    jbe  1f\n"
-        "    mov  %k[to], %[cnt]\n"
-        "    neg  %[cnt]\n"
-        "    and  $"STR(BYTES_PER_LONG-1)", %[cnt]\n"
-        "    sub  %[cnt], %[aux]\n"
-        "4:  rep movsb\n" /* make 'to' address aligned */
-        "    mov  %[aux],%[cnt]\n"
-        "    shr  $"STR(LONG_BYTEORDER)", %[cnt]\n"
-        "    and  $"STR(BYTES_PER_LONG-1)", %[aux]\n"
-        "    .align 2,0x90\n"
-        "0:  rep movs"__OS"\n" /* as many words as possible... */
-        "    mov  %[aux], %[cnt]\n"
-        "1:  rep movsb\n" /* ...remainder copied as bytes */
+        "1:  rep movsb\n"
         "2:\n"
         ".section .fixup,\"ax\"\n"
-        "5:  add  %[aux], %[cnt]\n"
-        "    jmp 6f\n"
-        "3:  lea  (%q[aux], %q[cnt], "STR(BYTES_PER_LONG)"), %[cnt]\n"
         "6:  mov  %[cnt], %k[from]\n"
         "    xchg %%eax, %[aux]\n"
         "    xor  %%eax, %%eax\n"
@@ -93,14 +54,11 @@ unsigned int copy_from_guest_ll(void *to, const void __user *from, unsigned int
         "    mov  %k[from], %[cnt]\n"
         "    jmp 2b\n"
         ".previous\n"
-        _ASM_EXTABLE(4b, 5b)
-        _ASM_EXTABLE(0b, 3b)
         _ASM_EXTABLE(1b, 6b)
         : [cnt] "+c" (n), [to] "+D" (to), [from] "+S" (from),
           [aux] "=&r" (dummy)
           GUARD(, [scratch1] "=&r" (dummy), [scratch2] "=&r" (dummy))
-        : "[aux]" (n)
-        : "memory" );
+        :: "memory" );
     clac();
 
     return n;
@@ -145,20 +103,12 @@ unsigned int clear_guest_pv(void __user *to, unsigned int n)
         stac();
         asm volatile (
             "    guest_access_mask_ptr %[to], %[scratch1], %[scratch2]\n"
-            "0:  rep stos"__OS"\n"
-            "    mov  %[bytes], %[cnt]\n"
             "1:  rep stosb\n"
             "2:\n"
-            ".section .fixup,\"ax\"\n"
-            "3:  lea  (%q[bytes], %q[longs], "STR(BYTES_PER_LONG)"), %[cnt]\n"
-            "    jmp  2b\n"
-            ".previous\n"
-            _ASM_EXTABLE(0b,3b)
             _ASM_EXTABLE(1b,2b)
-            : [cnt] "=&c" (n), [to] "+D" (to), [scratch1] "=&r" (dummy),
+            : [cnt] "+c" (n), [to] "+D" (to), [scratch1] "=&r" (dummy),
               [scratch2] "=&r" (dummy)
-            : [bytes] "r" (n & (BYTES_PER_LONG - 1)),
-              [longs] "0" (n / BYTES_PER_LONG), "a" (0) );
+            : "a" (0) );
         clac();
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 02 14:11:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 02 Oct 2024 14:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.808813.1220837 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sw04P-0007tk-Ii; Wed, 02 Oct 2024 14:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 808813.1220837; Wed, 02 Oct 2024 14:11:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sw04P-0007tc-GE; Wed, 02 Oct 2024 14:11:13 +0000
Received: by outflank-mailman (input) for mailman id 808813;
 Wed, 02 Oct 2024 14: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 1sw04O-0007tW-Kx
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 14: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 1sw04O-0001O6-KB
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 14:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sw04O-0006j7-IJ
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 14:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=eYk29ICmGsy4DJJOwc/htKKw2v2J1ueix3FGvuJrZI8=; b=ouPrn7WKkdWqz0sHgBXXRI+HzT
	8UVcjNlWUAK076HiIX0kqANTVwmZAZEjq/icxFjELTJlqEjBCEvPlRquaF82CxK1vbjZDcCM232Xv
	KqGt5MfcmN3T3/4ihDRejQqLgxnXCZRfI1OEmpwsabIGWgInbj69eiHEJ0QyoPpSyQGY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/traps: Re-enable interrupts after reading cr2 in the #PF handler
Message-Id: <E1sw04O-0006j7-IJ@xenbits.xenproject.org>
Date: Wed, 02 Oct 2024 14:11:12 +0000

commit b06e76db7c35974f1b127762683e7852ca0c8e76
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Tue Oct 1 09:45:49 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 1 09:45:49 2024 +0200

    x86/traps: Re-enable interrupts after reading cr2 in the #PF handler
    
    Hitting a page fault clobbers %cr2, so if a page fault is handled while
    handling a previous page fault then %cr2 will hold the address of the
    latter fault rather than the former. In particular, if a debug key
    handler happens to trigger during #PF and before %cr2 is read, and that
    handler itself encounters a #PF, then %cr2 will be corrupt for the outer #PF
    handler.
    
    This patch makes the page fault path delay re-enabling IRQs until %cr2
    has been read in order to ensure it stays consistent.
    
    A similar argument holds in additional cases, but they happen to be safe:
        * %dr6 inside #DB: Safe because IST exceptions don't re-enable IRQs.
        * MSR_XFD_ERR inside #NM: Safe because AMX isn't used in #NM handler.
    
    While in the area, remove redundant q suffix to a movq in entry.S and
    the space after the comma.
    
    Fixes: a4cd20a19073 ("[XEN] 'd' key dumps both host and guest state.")
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/traps.c        |  8 ++++++++
 xen/arch/x86/x86_64/entry.S | 20 ++++++++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 708136f625..a9c2c607eb 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1600,6 +1600,14 @@ void asmlinkage do_page_fault(struct cpu_user_regs *regs)
 
     addr = read_cr2();
 
+    /*
+     * Don't re-enable interrupts if we were running an IRQ-off region when
+     * we hit the page fault, or we'll break that code.
+     */
+    ASSERT(!local_irq_is_enabled());
+    if ( regs->flags & X86_EFLAGS_IF )
+        local_irq_enable();
+
     /* fixup_page_fault() might change regs->error_code, so cache it here. */
     error_code = regs->error_code;
 
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index b8482de8ee..9b0cdb7640 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -844,9 +844,9 @@ handle_exception_saved:
 #elif !defined(CONFIG_PV)
         ASSERT_CONTEXT_IS_XEN
 #endif /* CONFIG_PV */
-        sti
-1:      movq  %rsp,%rdi
-        movzbl UREGS_entry_vector(%rsp),%eax
+.Ldispatch_exceptions:
+        mov   %rsp, %rdi
+        movzbl UREGS_entry_vector(%rsp), %eax
 #ifdef CONFIG_PERF_COUNTERS
         lea   per_cpu__perfcounters(%rip), %rcx
         add   STACK_CPUINFO_FIELD(per_cpu_offset)(%r14), %rcx
@@ -866,7 +866,19 @@ handle_exception_saved:
         jmp   .L_exn_dispatch_done;    \
 .L_ ## vec ## _done:
 
+        /*
+         * IRQs kept off to derisk being hit by a nested interrupt before
+         * reading %cr2. Otherwise a page fault in the nested interrupt handler
+         * would corrupt %cr2.
+         */
         DISPATCH(X86_EXC_PF, do_page_fault)
+
+        /* Only re-enable IRQs if they were active before taking the fault */
+        testb $X86_EFLAGS_IF >> 8, UREGS_eflags + 1(%rsp)
+        jz    1f
+        sti
+1:
+
         DISPATCH(X86_EXC_GP, do_general_protection)
         DISPATCH(X86_EXC_UD, do_invalid_op)
         DISPATCH(X86_EXC_NM, do_device_not_available)
@@ -911,7 +923,7 @@ exception_with_ints_disabled:
         movq  %rsp,%rdi
         call  search_pre_exception_table
         testq %rax,%rax                 # no fixup code for faulting EIP?
-        jz    1b
+        jz    .Ldispatch_exceptions
         movq  %rax,UREGS_rip(%rsp)      # fixup regular stack
 
 #ifdef CONFIG_XEN_SHSTK
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 02 14:11:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 02 Oct 2024 14:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.808814.1220842 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sw04Z-0007wq-Ke; Wed, 02 Oct 2024 14:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 808814.1220842; Wed, 02 Oct 2024 14:11:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sw04Z-0007wf-Hi; Wed, 02 Oct 2024 14:11:23 +0000
Received: by outflank-mailman (input) for mailman id 808814;
 Wed, 02 Oct 2024 14: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 1sw04Y-0007wV-Om
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 14: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 1sw04Y-0001OJ-O5
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 14:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sw04Y-0006kZ-MO
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 14:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=S92zAzlL62QqLU7Uxfz/15UPPtdZl86BWCLrmQOqUKk=; b=Pspnmf/WYwhyVIrHH5CaZtl1AU
	I6x0o8w4l3Qd/fTLRudpmdhmwyySHCZK+Vp/9olRMeZlUXvInHtmdGjUGhtzt84NrPluj4Tx7jPzy
	+7l8zh+sxobN6JJm1uV0+r4oglIuswyBEPnDUzWhS6NJSrKytgli0IbItZETVUqOIXGU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] iommu/amd-vi: make IOMMU list ro after init
Message-Id: <E1sw04Y-0006kZ-MO@xenbits.xenproject.org>
Date: Wed, 02 Oct 2024 14:11:22 +0000

commit db70a52f751626e3fc7d803dcc18fba2511cf073
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Oct 1 09:46:09 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 1 09:46:09 2024 +0200

    iommu/amd-vi: make IOMMU list ro after init
    
    The only functions to modify the list, amd_iommu_detect_one_acpi() and
    amd_iommu_init_cleanup(), are already init.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/amd/iommu_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index 6c0dc2d5cb..3023625020 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -32,7 +32,7 @@ unsigned int __read_mostly amd_iommu_acpi_info;
 unsigned int __read_mostly ivrs_bdf_entries;
 u8 __read_mostly ivhd_type;
 static struct radix_tree_root ivrs_maps;
-LIST_HEAD_READ_MOSTLY(amd_iommu_head);
+LIST_HEAD_RO_AFTER_INIT(amd_iommu_head);
 bool iommuv2_enabled;
 
 bool __ro_after_init amd_iommu_perdev_intremap = true;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 02 14:11:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 02 Oct 2024 14:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.808815.1220845 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sw04j-0007zd-Lr; Wed, 02 Oct 2024 14:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 808815.1220845; Wed, 02 Oct 2024 14:11:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sw04j-0007zV-J7; Wed, 02 Oct 2024 14:11:33 +0000
Received: by outflank-mailman (input) for mailman id 808815;
 Wed, 02 Oct 2024 14: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 1sw04i-0007zN-Rk
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 14: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 1sw04i-0001OR-R5
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 14:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sw04i-0006nG-QC
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 14:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Cx7nxXMSvkjFmtzDhmfECKf/YX+7+TJ6TarjzLP8QzY=; b=DNwCEDa09ttrz+3qOyxEcPUytz
	nRGOUqW/DU2sU3Nay9USoktStJJqBMHJCsvpizArAcdNTmRTKkXoVSQaeZ6pGD4AEXXhhk+Mx/Z84
	Z+g8F3BnVRaPz8cGT7dwgH+T9EqhTRVtskqOhz9LXqxD4bMA+pqzk/5p7TWZdlTjHBeY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: use alternative_input() in cache_flush()
Message-Id: <E1sw04i-0006nG-QC@xenbits.xenproject.org>
Date: Wed, 02 Oct 2024 14:11:32 +0000

commit b42cf31d1165f06032f205a2bd71f5d099ea2218
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Oct 1 09:47:05 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 1 09:47:05 2024 +0200

    x86: use alternative_input() in cache_flush()
    
    There's no point using alternative_io() when there are no outputs. While
    there drop the unnecessary semicolon after "ds".
    
    No functional change.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/flushtlb.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/flushtlb.c b/xen/arch/x86/flushtlb.c
index 18748b2bc8..2a70c5151b 100644
--- a/xen/arch/x86/flushtlb.c
+++ b/xen/arch/x86/flushtlb.c
@@ -286,11 +286,10 @@ void cache_flush(const void *addr, unsigned int size)
          * + prefix than a clflush + nop, and hence the prefix is added instead
          * of letting the alternative framework fill the gap by appending nops.
          */
-        alternative_io("ds; clflush %[p]",
-                       "data16 clflush %[p]", /* clflushopt */
-                       X86_FEATURE_CLFLUSHOPT,
-                       /* no outputs */,
-                       [p] "m" (*(const char *)(addr)));
+        alternative_input("ds clflush %[p]",
+                          "data16 clflush %[p]", /* clflushopt */
+                           X86_FEATURE_CLFLUSHOPT,
+                           [p] "m" (*(const char *)(addr)));
     }
 
     alternative_2("",
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 02 14:11:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 02 Oct 2024 14:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.808816.1220850 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sw04t-00082G-N4; Wed, 02 Oct 2024 14:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 808816.1220850; Wed, 02 Oct 2024 14: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 1sw04t-000828-KY; Wed, 02 Oct 2024 14:11:43 +0000
Received: by outflank-mailman (input) for mailman id 808816;
 Wed, 02 Oct 2024 14:11: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 1sw04s-00081y-Vs
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 14: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 1sw04s-0001Or-V3
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 14:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sw04s-0006o1-TH
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 14: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=fKpoU+Q3bS/OPeEwdf7tsmQdU0a6OCi9k4/zt5VykoM=; b=n2rrcjkLk6/e9p2kyPdiSrK29w
	145oR1zWNAJBZQ7Qr3wQNjPcWpXX7RxCEVh0Eq+t6PgxuwkLBvFDUpyINmHMvIt0eqWuaaSG24jv7
	VkGE3sc1TD2DR8D7hkWQOXytPEPudhlOhRauwpTnRjq+PhGmHmxoiUCysqCFUa11G55Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/MSR: improve code gen for rdmsr_safe() and rdtsc()
Message-Id: <E1sw04s-0006o1-TH@xenbits.xenproject.org>
Date: Wed, 02 Oct 2024 14:11:42 +0000

commit 66878a8b7566e9a98d20b69ab95ddaffe1130683
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Oct 1 09:47:32 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 1 09:47:32 2024 +0200

    x86/MSR: improve code gen for rdmsr_safe() and rdtsc()
    
    To fold two 32-bit outputs from the asm()-s into a single 64-bit value
    the compiler needs to emit a zero-extension insn for the low half. Both
    RDMSR and RDTSC clear the upper halves of their output registers anyway,
    though. So despite that zero-extending insn (a simple MOV) being cheap,
    we can do better: Without one, by declaring the local variables as 64-
    bit ones.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/msr.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index c95330a5a1..e1e7439d6c 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -54,17 +54,17 @@ static inline void wrmsr_ns(uint32_t msr, uint32_t lo, uint32_t hi)
 /* rdmsr with exception handling */
 #define rdmsr_safe(msr,val) ({\
     int rc_; \
-    uint32_t lo_, hi_; \
+    uint64_t lo_, hi_; \
     __asm__ __volatile__( \
         "1: rdmsr\n2:\n" \
         ".section .fixup,\"ax\"\n" \
-        "3: xorl %0,%0\n; xorl %1,%1\n" \
+        "3: xorl %k0,%k0\n; xorl %k1,%k1\n" \
         "   movl %5,%2\n; jmp 2b\n" \
         ".previous\n" \
         _ASM_EXTABLE(1b, 3b) \
         : "=a" (lo_), "=d" (hi_), "=&r" (rc_) \
         : "c" (msr), "2" (0), "i" (-EFAULT)); \
-    val = lo_ | ((uint64_t)hi_ << 32); \
+    val = lo_ | (hi_ << 32); \
     rc_; })
 
 /* wrmsr with exception handling */
@@ -99,11 +99,11 @@ static inline void msr_split(struct cpu_user_regs *regs, uint64_t val)
 
 static inline uint64_t rdtsc(void)
 {
-    uint32_t low, high;
+    uint64_t low, high;
 
     __asm__ __volatile__("rdtsc" : "=a" (low), "=d" (high));
 
-    return ((uint64_t)high << 32) | low;
+    return (high << 32) | low;
 }
 
 static inline uint64_t rdtsc_ordered(void)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 02 14:11:53 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 02 Oct 2024 14:11:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.808817.1220855 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sw053-000852-Pg; Wed, 02 Oct 2024 14:11:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 808817.1220855; Wed, 02 Oct 2024 14:11:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sw053-00084m-Lu; Wed, 02 Oct 2024 14:11:53 +0000
Received: by outflank-mailman (input) for mailman id 808817;
 Wed, 02 Oct 2024 14:11: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 1sw053-00084c-2Q
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 14:11: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 1sw053-0001Oy-1k
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 14:11:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sw053-0006oo-0y
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 14:11: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=m2qk4g8Q2HmUOy4BUdwffUBy3I8eqOUJeD5AQVuNRRg=; b=lnGlKeFRl/xyaOD9jzSy92RZXq
	kFTg6+6PzlzNoutQ8x4YxZmJ1XCBUdenHEQwVyKGud7Ek6PnvSMr2qs4sCB0/TiLsFTs+144SsNXb
	DREs1sleFXCHhYueIeppS4u7qB9hcSD2e04PsKPgdnv+M335QZQh46POn9OSHOOEGLLI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pv: Rework guest_io_okay() to return X86EMUL_*
Message-Id: <E1sw053-0006oo-0y@xenbits.xenproject.org>
Date: Wed, 02 Oct 2024 14:11:53 +0000

commit 7429e1cc071b0e20ea9581da4893fb9b2f6d21d4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Sep 30 16:09:51 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 1 14:58:18 2024 +0100

    x86/pv: Rework guest_io_okay() to return X86EMUL_*
    
    In order to fix a bug with guest_io_okay() (subsequent patch), rework
    guest_io_okay() to take in an emulation context, and return X86EMUL_* rather
    than a boolean.
    
    For the failing case, take the opportunity to inject #GP explicitly, rather
    than returning X86EMUL_UNHANDLEABLE.  There is a logical difference between
    "we know what this is, and it's #GP", vs "we don't know what this is".
    
    There is no change in practice as emulation is the final step on general #GP
    resolution, but returning X86EMUL_UNHANDLEABLE would be a latent bug if a
    subsequent action were to appear.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/pv/emul-priv-op.c | 36 +++++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index b90f745c75..cc66ffbf8e 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -156,14 +156,16 @@ static bool iopl_ok(const struct vcpu *v, const struct cpu_user_regs *regs)
 }
 
 /* Has the guest requested sufficient permission for this I/O access? */
-static bool guest_io_okay(unsigned int port, unsigned int bytes,
-                          struct vcpu *v, struct cpu_user_regs *regs)
+static int guest_io_okay(unsigned int port, unsigned int bytes,
+                         struct x86_emulate_ctxt *ctxt)
 {
+    const struct cpu_user_regs *regs = ctxt->regs;
+    struct vcpu *v = current;
     /* If in user mode, switch to kernel mode just to read I/O bitmap. */
     const bool user_mode = !(v->arch.flags & TF_kernel_mode);
 
     if ( iopl_ok(v, regs) )
-        return true;
+        return X86EMUL_OKAY;
 
     if ( (port + bytes) <= v->arch.pv.iobmp_limit )
     {
@@ -190,10 +192,12 @@ static bool guest_io_okay(unsigned int port, unsigned int bytes,
             toggle_guest_pt(v);
 
         if ( (x.mask & (((1 << bytes) - 1) << (port & 7))) == 0 )
-            return true;
+            return X86EMUL_OKAY;
     }
 
-    return false;
+    x86_emul_hw_exception(X86_EXC_GP, 0, ctxt);
+
+    return X86EMUL_EXCEPTION;
 }
 
 /* Has the administrator granted sufficient permission for this I/O access? */
@@ -353,12 +357,14 @@ static int cf_check read_io(
     struct priv_op_ctxt *poc = container_of(ctxt, struct priv_op_ctxt, ctxt);
     struct vcpu *curr = current;
     struct domain *currd = current->domain;
+    int rc;
 
     /* INS must not come here. */
     ASSERT((ctxt->opcode & ~9) == 0xe4);
 
-    if ( !guest_io_okay(port, bytes, curr, ctxt->regs) )
-        return X86EMUL_UNHANDLEABLE;
+    rc = guest_io_okay(port, bytes, ctxt);
+    if ( rc != X86EMUL_OKAY )
+        return rc;
 
     poc->bpmatch = check_guest_io_breakpoint(curr, port, bytes);
 
@@ -458,12 +464,14 @@ static int cf_check write_io(
     struct priv_op_ctxt *poc = container_of(ctxt, struct priv_op_ctxt, ctxt);
     struct vcpu *curr = current;
     struct domain *currd = current->domain;
+    int rc;
 
     /* OUTS must not come here. */
     ASSERT((ctxt->opcode & ~9) == 0xe6);
 
-    if ( !guest_io_okay(port, bytes, curr, ctxt->regs) )
-        return X86EMUL_UNHANDLEABLE;
+    rc = guest_io_okay(port, bytes, ctxt);
+    if ( rc != X86EMUL_OKAY )
+        return rc;
 
     poc->bpmatch = check_guest_io_breakpoint(curr, port, bytes);
 
@@ -612,8 +620,9 @@ static int cf_check rep_ins(
 
     *reps = 0;
 
-    if ( !guest_io_okay(port, bytes_per_rep, curr, ctxt->regs) )
-        return X86EMUL_UNHANDLEABLE;
+    rc = guest_io_okay(port, bytes_per_rep, ctxt);
+    if ( rc != X86EMUL_OKAY )
+        return rc;
 
     rc = read_segment(x86_seg_es, &sreg, ctxt);
     if ( rc != X86EMUL_OKAY )
@@ -678,8 +687,9 @@ static int cf_check rep_outs(
 
     *reps = 0;
 
-    if ( !guest_io_okay(port, bytes_per_rep, curr, ctxt->regs) )
-        return X86EMUL_UNHANDLEABLE;
+    rc = guest_io_okay(port, bytes_per_rep, ctxt);
+    if ( rc != X86EMUL_OKAY )
+        return rc;
 
     rc = read_segment(seg, &sreg, ctxt);
     if ( rc != X86EMUL_OKAY )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 02 14:12:03 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 02 Oct 2024 14:12:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.808819.1220857 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sw05D-000886-RT; Wed, 02 Oct 2024 14:12:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 808819.1220857; Wed, 02 Oct 2024 14:12:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sw05D-00087z-Op; Wed, 02 Oct 2024 14:12:03 +0000
Received: by outflank-mailman (input) for mailman id 808819;
 Wed, 02 Oct 2024 14:12: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 1sw05D-00087r-5G
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 14:12: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 1sw05D-0001PJ-4X
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 14:12:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sw05D-0006qG-3p
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 14:12:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Kb7PxIKufaubo9dwec+181LakDdRooaGn8bEbjOTF90=; b=egKCxCFnQBLk/G8adzFkY4vg9t
	y1dYdUV6i+AnQ6CAyDk8pK617x5KoCEb2K5q9YZjYDR13tV3ULOYvjcm5xJ/GqFA6iyTJ3/+h6W05
	o6CGey54FZD7fH1iwdPIZgVi4QIxnVYOYIwzyDzvsjl2IOiqMKMBW3kP9q8JflWcF5Ak=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pv: Handle #PF correctly when reading the IO permission bitmap
Message-Id: <E1sw05D-0006qG-3p@xenbits.xenproject.org>
Date: Wed, 02 Oct 2024 14:12:03 +0000

commit 8a6c495d725408d333c1b47bb8af44615a5bfb18
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Sep 30 16:20:29 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 1 14:58:18 2024 +0100

    x86/pv: Handle #PF correctly when reading the IO permission bitmap
    
    The switch statement in guest_io_okay() is a very expensive way of
    pre-initialising x with ~0, and performing a partial read into it.
    
    However, the logic isn't correct either.
    
    In a real TSS, the CPU always reads two bytes (like here), and any TSS limit
    violation turns silently into no-access.  But, in-limit accesses trigger #PF
    as usual.  AMD document this property explicitly, and while Intel don't (so
    far as I can tell), they do behave consistently with AMD.
    
    Switch from __copy_from_guest_offset() to __copy_from_guest_pv(), like
    everything else in this file.  This removes code generation setting up
    copy_from_user_hvm() (in the likely path even), and safety LFENCEs from
    evaluate_nospec().
    
    Change the logic to raise #PF if __copy_from_guest_pv() fails, rather than
    disallowing the IO port access.  This brings the behaviour better in line with
    normal x86.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/pv/emul-priv-op.c | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index cc66ffbf8e..e35285d4ab 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -169,29 +169,26 @@ static int guest_io_okay(unsigned int port, unsigned int bytes,
 
     if ( (port + bytes) <= v->arch.pv.iobmp_limit )
     {
-        union { uint8_t bytes[2]; uint16_t mask; } x;
+        const void *__user addr = v->arch.pv.iobmp.p + (port >> 3);
+        uint16_t mask;
+        int rc;
 
-        /*
-         * Grab permission bytes from guest space. Inaccessible bytes are
-         * read as 0xff (no access allowed).
-         */
+        /* Grab permission bytes from guest space. */
         if ( user_mode )
             toggle_guest_pt(v);
 
-        switch ( __copy_from_guest_offset(x.bytes, v->arch.pv.iobmp,
-                                          port>>3, 2) )
-        {
-        default: x.bytes[0] = ~0;
-            /* fallthrough */
-        case 1:  x.bytes[1] = ~0;
-            /* fallthrough */
-        case 0:  break;
-        }
+        rc = __copy_from_guest_pv(&mask, addr, 2);
 
         if ( user_mode )
             toggle_guest_pt(v);
 
-        if ( (x.mask & (((1 << bytes) - 1) << (port & 7))) == 0 )
+        if ( rc )
+        {
+            x86_emul_pagefault(0, (unsigned long)addr + bytes - rc, ctxt);
+            return X86EMUL_EXCEPTION;
+        }
+
+        if ( (mask & (((1 << bytes) - 1) << (port & 7))) == 0 )
             return X86EMUL_OKAY;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 02 14:12:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 02 Oct 2024 14:12:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.808820.1220862 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sw05N-0008An-T2; Wed, 02 Oct 2024 14:12:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 808820.1220862; Wed, 02 Oct 2024 14:12:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sw05N-0008Af-QK; Wed, 02 Oct 2024 14:12:13 +0000
Received: by outflank-mailman (input) for mailman id 808820;
 Wed, 02 Oct 2024 14:12: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 1sw05N-0008AZ-8W
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 14:12: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 1sw05N-0001PS-7g
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 14:12:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sw05N-0006r7-6m
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 14:12:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=c27LpE9N0Do+ayCATsxA4lX1UPayf2VxNJo9pL6xK7k=; b=Kx3LIE/GYWsZHZhOPv8huIv2PV
	eJogFxivkWBB6Z0mrU+yewEGUVG4s/UeFOzMk8cSvlglzKL0BAGCXg+alHP7G4uHtgWCCvRHfV/Yh
	He0Q/GMNsBvdW/JKq3xEDVJj16P0oLc6s7YE4aBcOF2EfV4aa6tQ1fH4Nh2mdFC9WkWU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pv: Rename pv.iobmp_limit to iobmp_nr and clarify behaviour
Message-Id: <E1sw05N-0006r7-6m@xenbits.xenproject.org>
Date: Wed, 02 Oct 2024 14:12:13 +0000

commit 633ee8b2df963f7e5cb8de1219c1a48bfb4447f6
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Oct 1 13:00:13 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 1 14:58:18 2024 +0100

    x86/pv: Rename pv.iobmp_limit to iobmp_nr and clarify behaviour
    
    Ever since it's introduction in commit 013351bd7ab3 ("Define new event-channel
    and physdev hypercalls") in 2006, the public interface was named nr_ports
    while the internal field was called iobmp_limit.
    
    Rename the internal field to iobmp_nr to match the public interface, and
    clarify that, when nonzero, Xen will read 2 bytes.
    
    There isn't a perfect parallel with a real TSS, but iobmp_nr being 0 is the
    paravirt "no IOPB" case, and it is important that no read occurs in this case.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/domain.h | 2 +-
 xen/arch/x86/physdev.c            | 2 +-
 xen/arch/x86/pv/emul-priv-op.c    | 6 +++++-
 xen/include/public/physdev.h      | 3 +++
 4 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index 811251852f..bdcdb8de09 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -573,7 +573,7 @@ struct pv_vcpu
 
     /* I/O-port access bitmap. */
     XEN_GUEST_HANDLE(uint8) iobmp; /* Guest kernel vaddr of the bitmap. */
-    unsigned int iobmp_limit; /* Number of ports represented in the bitmap. */
+    unsigned int iobmp_nr;    /* Number of ports represented in the bitmap. */
 #define IOPL(val) MASK_INSR(val, X86_EFLAGS_IOPL)
     unsigned int iopl;        /* Current IOPL for this VCPU, shifted left by
                                * 12 to match the eflags register. */
diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c
index d6dd622952..69fd42667c 100644
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
@@ -436,7 +436,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 #else
         guest_from_compat_handle(curr->arch.pv.iobmp, set_iobitmap.bitmap);
 #endif
-        curr->arch.pv.iobmp_limit = set_iobitmap.nr_ports;
+        curr->arch.pv.iobmp_nr = set_iobitmap.nr_ports;
         break;
     }
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index e35285d4ab..70150c2722 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -167,7 +167,11 @@ static int guest_io_okay(unsigned int port, unsigned int bytes,
     if ( iopl_ok(v, regs) )
         return X86EMUL_OKAY;
 
-    if ( (port + bytes) <= v->arch.pv.iobmp_limit )
+    /*
+     * When @iobmp_nr is non-zero, Xen, like real CPUs and the TSS IOPB,
+     * always reads 2 bytes from @iobmp, which might be one byte @iobmp_nr.
+     */
+    if ( (port + bytes) <= v->arch.pv.iobmp_nr )
     {
         const void *__user addr = v->arch.pv.iobmp.p + (port >> 3);
         uint16_t mask;
diff --git a/xen/include/public/physdev.h b/xen/include/public/physdev.h
index 45e1c18541..3149049a9a 100644
--- a/xen/include/public/physdev.h
+++ b/xen/include/public/physdev.h
@@ -87,6 +87,9 @@ DEFINE_XEN_GUEST_HANDLE(physdev_set_iopl_t);
 /*
  * Set the current VCPU's I/O-port permissions bitmap.
  * @arg == pointer to physdev_set_iobitmap structure.
+ *
+ * When @nr_ports is non-zero, Xen, like real CPUs and the TSS IOPB, always
+ * reads 2 bytes from @bitmap, which might be one byte beyond @nr_ports.
  */
 #define PHYSDEVOP_set_iobitmap           7
 struct physdev_set_iobitmap {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 02 18:22:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 02 Oct 2024 18:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.808987.1221082 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sw3zB-00009c-Iv; Wed, 02 Oct 2024 18:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 808987.1221082; Wed, 02 Oct 2024 18: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 1sw3zB-00009U-G2; Wed, 02 Oct 2024 18:22:05 +0000
Received: by outflank-mailman (input) for mailman id 808987;
 Wed, 02 Oct 2024 18: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 1sw3zA-00009E-8h
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 18: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 1sw3z9-0006No-Vf
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 18:22:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sw3z9-0007EB-Ub
 for xen-changelog@lists.xenproject.org; Wed, 02 Oct 2024 18: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=FRdIcaQCg0mqm4ZT2NXiDvdK7BOTRcRri2GxmE9FKn0=; b=GnKBTZXqB5Oom+m7Gn5rT3NTIE
	0uJvc3rbJuZnoH1dVb1r+BaoLvyJbdJ5gBTgjmQKlOiOP6WauydxR83aDxYytzVFKGDhq1RelPTa6
	lcDkRhjxmOvidfcYNfQzEeEM5dmFnpOiBQ4bFwL55PVj+H74QSGobrna/4X21h94Gl/8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/kexec: Separate code and data into different cache lines
Message-Id: <E1sw3z9-0007EB-Ub@xenbits.xenproject.org>
Date: Wed, 02 Oct 2024 18:22:03 +0000

commit 41190d2ceb03b12ffc17a66c04de519c26a6052a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 17 17:01:22 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 2 19:08:27 2024 +0100

    x86/kexec: Separate code and data into different cache lines
    
    No functional change, but it performs a bit better.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/x86_64/kexec_reloc.S | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/x86_64/kexec_reloc.S b/xen/arch/x86/x86_64/kexec_reloc.S
index 9f40c80d7c..50ba454abd 100644
--- a/xen/arch/x86/x86_64/kexec_reloc.S
+++ b/xen/arch/x86/x86_64/kexec_reloc.S
@@ -19,6 +19,7 @@
 #include <xen/kimage.h>
 
 #include <asm/asm_defns.h>
+#include <asm/cache.h>
 #include <asm/msr-index.h>
 #include <asm/page.h>
 #include <asm/machine_kexec.h>
@@ -174,6 +175,9 @@ FUNC_LOCAL(compatibility_mode)
         ud2
 END(compatibility_mode)
 
+        /* Separate code and data into into different cache lines */
+        .balign L1_CACHE_BYTES
+
 DATA_LOCAL(compat_mode_gdt_desc, 4)
         .word .Lcompat_mode_gdt_end - compat_mode_gdt -1
         .quad 0x0000000000000000     /* set in call_32_bit above */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 03 01:22:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 03 Oct 2024 01:22:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.809158.1221346 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swAXa-0003U8-Ak; Thu, 03 Oct 2024 01:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 809158.1221346; Thu, 03 Oct 2024 01: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 1swAXa-0003U0-7x; Thu, 03 Oct 2024 01:22:02 +0000
Received: by outflank-mailman (input) for mailman id 809158;
 Thu, 03 Oct 2024 01: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 1swAXZ-0003Ts-R1
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01: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 1swAXZ-0005DD-QE
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swAXZ-0003Aw-OD
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01: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=pPwQvsHL3a9K+Pvrrc8M9/RrtK/83JYyoSoQ0VOwNvE=; b=Ogg3xXweIEdK+9l2eP4QOwGQTv
	YMWUtDhQrspUCf5hbWYUzW8Qr2nulDvLCtylxNiZRtp0Yw7RLhOG8SGEo5XHzNixrUfRYQknPYnZW
	RW18H3RclV+MXqBEbeeZ5uoqqXlhAeZPkPYhh0VfmWV4TWCGfWl0z+ORWNN2GMM+3X6o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: fusa: Add Assumption of Use (AOU)
Message-Id: <E1swAXZ-0003Aw-OD@xenbits.xenproject.org>
Date: Thu, 03 Oct 2024 01:22:01 +0000

commit f9ce66ea9d24aa8b26fcb2c18828caf314328ca3
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Tue Sep 24 09:29:23 2024 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Oct 1 17:32:15 2024 -0700

    docs: fusa: Add Assumption of Use (AOU)
    
    AoU are the assumptions that Xen relies on other components (eg platform
    platform, domains) to fulfill its requirements. In our case, platform means
    a combination of hardware, firmware and bootloader.
    
    We have defined AoU in the intro.rst and added AoU for the generic
    timer.
    
    Also, fixed a requirement to denote that Xen shall **not** expose the
    system counter frequency via the "clock-frequency" device tree property.
    The reason being the device tree documentation strongly discourages the
    use of this peoperty. Further if the "clock-frequency" is exposed, then
    it overrides the value programmed in the CNTFRQ_EL0 register.
    
    So, the frequency shall be exposed via the CNTFRQ_EL0 register only and
    consequently there is an assumption on the platform to program the
    register correctly.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/fusa/reqs/design-reqs/arm64/generic-timer.rst | 24 +++++++++++++++++++++-
 docs/fusa/reqs/intro.rst                           | 10 +++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/docs/fusa/reqs/design-reqs/arm64/generic-timer.rst b/docs/fusa/reqs/design-reqs/arm64/generic-timer.rst
index f2a0cd7fb8..9d2a5a8085 100644
--- a/docs/fusa/reqs/design-reqs/arm64/generic-timer.rst
+++ b/docs/fusa/reqs/design-reqs/arm64/generic-timer.rst
@@ -30,7 +30,7 @@ Read system counter frequency
 
 Description:
 Xen shall expose the frequency of the system counter to the domains in
-CNTFRQ_EL0 register and/or domain device tree's "clock-frequency" property.
+CNTFRQ_EL0 register.
 
 Rationale:
 
@@ -116,6 +116,28 @@ Rationale:
 
 Comments:
 
+Covers:
+ - `XenProd~emulated_timer~1`
+
+Assumption of Use on the Platform
+=================================
+
+Expose system timer frequency via register
+------------------------------------------
+
+`XenSwdgn~arm64_generic_timer_plat_program_cntfrq_el0~1`
+
+Description:
+CNTFRQ_EL0 register shall be programmed with the value of the system timer
+frequency.
+
+Rationale:
+Xen reads the CNTFRQ_EL0 register to get the value of system timer frequency.
+
+Comments:
+While there is a provision to get this value by reading the "clock-frequency"
+dt property [2], the use of this property is strongly discouraged.
+
 Covers:
  - `XenProd~emulated_timer~1`
 
diff --git a/docs/fusa/reqs/intro.rst b/docs/fusa/reqs/intro.rst
index 245a219ff2..d8b43f5785 100644
--- a/docs/fusa/reqs/intro.rst
+++ b/docs/fusa/reqs/intro.rst
@@ -38,6 +38,16 @@ The requirements are linked using OpenFastTrace
 OpenFastTrace parses through the requirements and generates a traceability
 report.
 
+Assumption of Use
+=================
+
+Xen is making several assumptions on the status of the platform or on some
+functions being present and operational. For example, Xen might assume that
+some registers are set.
+Anybody who wants to use Xen must validate that the platform it is used on
+(meaning the hardware and any software running before Xen like the firmware)
+fulfils all the AoU described by Xen.
+
 The following is the skeleton for a requirement.
 
 Title of the requirement
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 03 01:22:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 03 Oct 2024 01:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.809159.1221350 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swAXk-0003WE-Ck; Thu, 03 Oct 2024 01:22:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 809159.1221350; Thu, 03 Oct 2024 01: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 1swAXk-0003W7-9T; Thu, 03 Oct 2024 01:22:12 +0000
Received: by outflank-mailman (input) for mailman id 809159;
 Thu, 03 Oct 2024 01: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 1swAXj-0003Vz-U0
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01: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 1swAXj-0005DM-TL
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01:22:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swAXj-0003Bq-SM
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01: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=h6G1ED/Gz//6yJMOKF7do0unjvC/pXY+sldua3LsHw0=; b=lJwEtweYsOdeyq0kNvmamsfDPG
	43IR8rOW87Uu5e4B5nQFKvs6Xal6XIG/XlvT6070pxX1IeMafCj5UUWJwZpUt+igkpIPp2rJvQQeQ
	JbvOC7VBDM6IhOFPJinXio5+QNJOhyj0SKDpOyu+HNIMY2UA2QaxBRi4DqoCTi30WDxY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: prefer RDTSCP in rdtsc_ordered()
Message-Id: <E1swAXj-0003Bq-SM@xenbits.xenproject.org>
Date: Thu, 03 Oct 2024 01:22:11 +0000

commit 3a38cc2bd753fc0f19bfc1bd5da1d8d662d8b730
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Oct 2 08:52:18 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 2 08:52:18 2024 +0200

    x86: prefer RDTSCP in rdtsc_ordered()
    
    If available, its use is supposed to be cheaper than LFENCE+RDTSC, and
    is virtually guaranteed to be cheaper than MFENCE+RDTSC.
    
    Update commentary (and indentation) while there.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/msr.h | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index e1e7439d6c..355fb324ec 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -108,18 +108,24 @@ static inline uint64_t rdtsc(void)
 
 static inline uint64_t rdtsc_ordered(void)
 {
-	/*
-	 * The RDTSC instruction is not ordered relative to memory access.
-	 * The Intel SDM and the AMD APM are both vague on this point, but
-	 * empirically an RDTSC instruction can be speculatively executed
-	 * before prior loads.  An RDTSC immediately after an appropriate
-	 * barrier appears to be ordered as a normal load, that is, it
-	 * provides the same ordering guarantees as reading from a global
-	 * memory location that some other imaginary CPU is updating
-	 * continuously with a time stamp.
-	 */
-	alternative("lfence", "mfence", X86_FEATURE_MFENCE_RDTSC);
-	return rdtsc();
+    uint64_t low, high, aux;
+
+    /*
+     * The RDTSC instruction is not serializing.  Make it dispatch serializing
+     * for the purposes here by issuing LFENCE (or MFENCE if necessary) ahead
+     * of it.
+     *
+     * RDTSCP, otoh, "does wait until all previous instructions have executed
+     * and all previous loads are globally visible" (SDM) / "forces all older
+     * instructions to retire before reading the timestamp counter" (APM).
+     */
+    alternative_io_2("lfence; rdtsc",
+                     "mfence; rdtsc", X86_FEATURE_MFENCE_RDTSC,
+                     "rdtscp",        X86_FEATURE_RDTSCP,
+                     ASM_OUTPUT2("=a" (low), "=d" (high), "=c" (aux)),
+                     /* no inputs */);
+
+    return (high << 32) | low;
 }
 
 #define __write_tsc(val) wrmsrl(MSR_IA32_TSC, val)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 03 01:22:22 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 03 Oct 2024 01:22:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.809160.1221354 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swAXu-0003Z4-DX; Thu, 03 Oct 2024 01:22:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 809160.1221354; Thu, 03 Oct 2024 01: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 1swAXu-0003Yx-B1; Thu, 03 Oct 2024 01:22:22 +0000
Received: by outflank-mailman (input) for mailman id 809160;
 Thu, 03 Oct 2024 01: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 1swAXu-0003Yr-13
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01: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 1swAXu-0005DU-0G
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swAXt-0003CK-VZ
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01: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=zl7ACjmaNyN2R/RiNzaHicHsRBGPQNkp6MBUGfhvmhY=; b=4DCy9fIbQkA9PNmeKPY39d56if
	/h7//uFHNMRmCaRhYQOs22Zs3l+4MMd8GScB2MHWpitYVWWLTjoGN+FJ2tY2UGya/PEO7VG5MDXeA
	k887/s5Pe0Zp0IdQjyIKUjkJwFEVmNiMnngFqDii3122zeJORjGq7k82EknsvOhKkzwQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: page table handling
Message-Id: <E1swAXt-0003CK-VZ@xenbits.xenproject.org>
Date: Thu, 03 Oct 2024 01:22:21 +0000

commit 557b7f1b9a57a666181f93c2240177676af68dd9
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Oct 2 08:53:59 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 2 08:53:59 2024 +0200

    xen/riscv: page table handling
    
    Implement map_pages_to_xen() which requires several
    functions to manage page tables and entries:
    - pt_update()
    - pt_mapping_level()
    - pt_update_entry()
    - pt_next_level()
    - pt_check_entry()
    
    To support these operations, add functions for creating,
    mapping, and unmapping Xen tables:
    - create_table()
    - map_table()
    - unmap_table()
    
    Introduce PTE_SMALL to indicate that 4KB mapping is needed
    and PTE_POPULATE.
    
    In addition introduce flush_tlb_range_va() for TLB flushing across
    CPUs after updating the PTE for the requested mapping.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/Makefile                     |   1 +
 xen/arch/riscv/include/asm/flushtlb.h       |   9 +
 xen/arch/riscv/include/asm/mm.h             |   2 +
 xen/arch/riscv/include/asm/page.h           |  80 ++++++
 xen/arch/riscv/include/asm/riscv_encoding.h |   2 +
 xen/arch/riscv/mm.c                         |   9 -
 xen/arch/riscv/pt.c                         | 421 ++++++++++++++++++++++++++++
 7 files changed, 515 insertions(+), 9 deletions(-)

diff --git a/xen/arch/riscv/Makefile b/xen/arch/riscv/Makefile
index 6832549133..a5eb2aed4b 100644
--- a/xen/arch/riscv/Makefile
+++ b/xen/arch/riscv/Makefile
@@ -1,6 +1,7 @@
 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
 obj-y += entry.o
 obj-y += mm.o
+obj-y += pt.o
 obj-$(CONFIG_RISCV_64) += riscv64/
 obj-y += sbi.o
 obj-y += setup.o
diff --git a/xen/arch/riscv/include/asm/flushtlb.h b/xen/arch/riscv/include/asm/flushtlb.h
index f4a735fd6c..43214f5e95 100644
--- a/xen/arch/riscv/include/asm/flushtlb.h
+++ b/xen/arch/riscv/include/asm/flushtlb.h
@@ -5,12 +5,21 @@
 #include <xen/bug.h>
 #include <xen/cpumask.h>
 
+#include <asm/sbi.h>
+
 /* Flush TLB of local processor for address va. */
 static inline void flush_tlb_one_local(vaddr_t va)
 {
     asm volatile ( "sfence.vma %0" :: "r" (va) : "memory" );
 }
 
+/* Flush a range of VA's hypervisor mappings from the TLB of all processors. */
+static inline void flush_tlb_range_va(vaddr_t va, size_t size)
+{
+    BUG_ON(!sbi_has_rfence());
+    sbi_remote_sfence_vma(NULL, va, size);
+}
+
 /*
  * Filter the given set of CPUs, removing those that definitely flushed their
  * TLB since @page_timestamp.
diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/mm.h
index a0bdc2bc3a..ce1557bb27 100644
--- a/xen/arch/riscv/include/asm/mm.h
+++ b/xen/arch/riscv/include/asm/mm.h
@@ -42,6 +42,8 @@ static inline void *maddr_to_virt(paddr_t ma)
 #define virt_to_mfn(va)     __virt_to_mfn(va)
 #define mfn_to_virt(mfn)    __mfn_to_virt(mfn)
 
+#define mfn_from_pte(pte) maddr_to_mfn(pte_to_paddr(pte))
+
 struct page_info
 {
     /* Each frame can be threaded onto a doubly-linked list. */
diff --git a/xen/arch/riscv/include/asm/page.h b/xen/arch/riscv/include/asm/page.h
index eb79cb9409..89fa290697 100644
--- a/xen/arch/riscv/include/asm/page.h
+++ b/xen/arch/riscv/include/asm/page.h
@@ -21,6 +21,11 @@
 #define XEN_PT_LEVEL_MAP_MASK(lvl)  (~(XEN_PT_LEVEL_SIZE(lvl) - 1))
 #define XEN_PT_LEVEL_MASK(lvl)      (VPN_MASK << XEN_PT_LEVEL_SHIFT(lvl))
 
+/*
+ * PTE format:
+ * | XLEN-1  10 | 9             8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
+ *       PFN      reserved for SW   D   A   G   U   X   W   R   V
+ */
 #define PTE_VALID                   BIT(0, UL)
 #define PTE_READABLE                BIT(1, UL)
 #define PTE_WRITABLE                BIT(2, UL)
@@ -34,15 +39,49 @@
 #define PTE_LEAF_DEFAULT            (PTE_VALID | PTE_READABLE | PTE_WRITABLE)
 #define PTE_TABLE                   (PTE_VALID)
 
+#define PAGE_HYPERVISOR_RO          (PTE_VALID | PTE_READABLE)
 #define PAGE_HYPERVISOR_RW          (PTE_VALID | PTE_READABLE | PTE_WRITABLE)
+#define PAGE_HYPERVISOR_RX          (PTE_VALID | PTE_READABLE | PTE_EXECUTABLE)
 
 #define PAGE_HYPERVISOR             PAGE_HYPERVISOR_RW
 
+/*
+ * The PTE format does not contain the following bits within itself;
+ * they are created artificially to inform the Xen page table
+ * handling algorithm. These bits should not be explicitly written
+ * to the PTE entry.
+ */
+#define PTE_SMALL       BIT(10, UL)
+#define PTE_POPULATE    BIT(11, UL)
+
+#define PTE_ACCESS_MASK (PTE_READABLE | PTE_WRITABLE | PTE_EXECUTABLE)
+
 /* Calculate the offsets into the pagetables for a given VA */
 #define pt_linear_offset(lvl, va)   ((va) >> XEN_PT_LEVEL_SHIFT(lvl))
 
 #define pt_index(lvl, va) (pt_linear_offset((lvl), (va)) & VPN_MASK)
 
+#define PAGETABLE_ORDER_MASK ((_AC(1, U) << PAGETABLE_ORDER) - 1)
+#define TABLE_OFFSET(offs) (_AT(unsigned int, offs) & PAGETABLE_ORDER_MASK)
+
+#if RV_STAGE1_MODE > SATP_MODE_SV39
+#error "need to to update DECLARE_OFFSETS macros"
+#else
+
+#define l0_table_offset(va) TABLE_OFFSET(pt_linear_offset(0, va))
+#define l1_table_offset(va) TABLE_OFFSET(pt_linear_offset(1, va))
+#define l2_table_offset(va) TABLE_OFFSET(pt_linear_offset(2, va))
+
+/* Generate an array @var containing the offset for each level from @addr */
+#define DECLARE_OFFSETS(var, addr)          \
+    const unsigned int var[] = {            \
+        l0_table_offset(addr),              \
+        l1_table_offset(addr),              \
+        l2_table_offset(addr),              \
+    }
+
+#endif
+
 /* Page Table entry */
 typedef struct {
 #ifdef CONFIG_RISCV_64
@@ -68,6 +107,47 @@ static inline bool pte_is_valid(pte_t p)
     return p.pte & PTE_VALID;
 }
 
+/*
+ * From the RISC-V spec:
+ *   The V bit indicates whether the PTE is valid; if it is 0, all other bits
+ *   in the PTE are don’t-cares and may be used freely by software.
+ *
+ *   If V=1 the encoding of PTE R/W/X bits could be find in "the encoding
+ *   of the permission bits" table.
+ *
+ *   The encoding of the permission bits table:
+ *      X W R Meaning
+ *      0 0 0 Pointer to next level of page table.
+ *      0 0 1 Read-only page.
+ *      0 1 0 Reserved for future use.
+ *      0 1 1 Read-write page.
+ *      1 0 0 Execute-only page.
+ *      1 0 1 Read-execute page.
+ *      1 1 0 Reserved for future use.
+ *      1 1 1 Read-write-execute page.
+ */
+static inline bool pte_is_table(pte_t p)
+{
+    /*
+     * According to the spec if V=1 and W=1 then R also needs to be 1 as
+     * R = 0 is reserved for future use ( look at the Table 4.5 ) so check
+     * in ASSERT that if (V==1 && W==1) then R isn't 0.
+     *
+     * PAGE_HYPERVISOR_RW contains PTE_VALID too.
+     */
+    ASSERT(((p.pte & PAGE_HYPERVISOR_RW) != (PTE_VALID | PTE_WRITABLE)));
+
+    return ((p.pte & (PTE_VALID | PTE_ACCESS_MASK)) == PTE_VALID);
+}
+
+static inline bool pte_is_mapping(pte_t p)
+{
+    /* See pte_is_table() */
+    ASSERT(((p.pte & PAGE_HYPERVISOR_RW) != (PTE_VALID | PTE_WRITABLE)));
+
+    return (p.pte & PTE_VALID) && (p.pte & PTE_ACCESS_MASK);
+}
+
 static inline void invalidate_icache(void)
 {
     BUG_ON("unimplemented");
diff --git a/xen/arch/riscv/include/asm/riscv_encoding.h b/xen/arch/riscv/include/asm/riscv_encoding.h
index 58abe5eccc..e31e94e77e 100644
--- a/xen/arch/riscv/include/asm/riscv_encoding.h
+++ b/xen/arch/riscv/include/asm/riscv_encoding.h
@@ -164,6 +164,7 @@
 #define SSTATUS_SD			SSTATUS64_SD
 #define SATP_MODE			SATP64_MODE
 #define SATP_MODE_SHIFT			SATP64_MODE_SHIFT
+#define SATP_PPN_MASK			SATP64_PPN
 
 #define HGATP_PPN			HGATP64_PPN
 #define HGATP_VMID_SHIFT		HGATP64_VMID_SHIFT
@@ -174,6 +175,7 @@
 #define SSTATUS_SD			SSTATUS32_SD
 #define SATP_MODE			SATP32_MODE
 #define SATP_MODE_SHIFT			SATP32_MODE_SHIFT
+#define SATP_PPN_MASK			SATP32_PPN
 
 #define HGATP_PPN			HGATP32_PPN
 #define HGATP_VMID_SHIFT		HGATP32_VMID_SHIFT
diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c
index b8ff91cf4e..e8430def14 100644
--- a/xen/arch/riscv/mm.c
+++ b/xen/arch/riscv/mm.c
@@ -369,12 +369,3 @@ 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/pt.c b/xen/arch/riscv/pt.c
new file mode 100644
index 0000000000..cc5e2d3266
--- /dev/null
+++ b/xen/arch/riscv/pt.c
@@ -0,0 +1,421 @@
+#include <xen/bug.h>
+#include <xen/domain_page.h>
+#include <xen/errno.h>
+#include <xen/lib.h>
+#include <xen/mm.h>
+#include <xen/pfn.h>
+#include <xen/pmap.h>
+#include <xen/spinlock.h>
+
+#include <asm/flushtlb.h>
+#include <asm/page.h>
+
+static inline mfn_t get_root_page(void)
+{
+    paddr_t root_maddr = pfn_to_paddr(csr_read(CSR_SATP) & SATP_PPN_MASK);
+
+    return maddr_to_mfn(root_maddr);
+}
+
+/*
+ * Sanity check a page table entry about to be updated as per an (MFN,flags)
+ * tuple.
+ * See the comment about the possible combination of (mfn, flags) in
+ * the comment above pt_update().
+ */
+static bool pt_check_entry(pte_t entry, mfn_t mfn, unsigned int flags)
+{
+    /* Sanity check when modifying an entry. */
+    if ( (flags & PTE_VALID) && mfn_eq(mfn, INVALID_MFN) )
+    {
+        /* We don't allow modifying an invalid entry. */
+        if ( !pte_is_valid(entry) )
+        {
+            dprintk(XENLOG_ERR, "Modifying invalid entry is not allowed\n");
+            return false;
+        }
+
+        /* We don't allow modifying a table entry */
+        if ( pte_is_table(entry) )
+        {
+            dprintk(XENLOG_ERR, "Modifying a table entry is not allowed\n");
+            return false;
+        }
+    }
+    /* Sanity check when inserting a mapping */
+    else if ( flags & PTE_VALID )
+    {
+        /*
+         * We don't allow replacing any valid entry.
+         *
+         * Note that the function pt_update() relies on this
+         * assumption and will skip the TLB flush (when Svvptc
+         * extension will be ratified). The function will need
+         * to be updated if the check is relaxed.
+         */
+        if ( pte_is_valid(entry) )
+        {
+            if ( pte_is_mapping(entry) )
+                dprintk(XENLOG_ERR, "Changing MFN for valid PTE is not allowed (%#"PRI_mfn" -> %#"PRI_mfn")\n",
+                        mfn_x(mfn_from_pte(entry)), mfn_x(mfn));
+            else
+                dprintk(XENLOG_ERR, "Trying to replace table with mapping\n");
+            return false;
+        }
+    }
+    /* Sanity check when removing a mapping. */
+    else if ( !(flags & PTE_POPULATE) )
+    {
+        /* We should be here with an invalid MFN. */
+        ASSERT(mfn_eq(mfn, INVALID_MFN));
+
+        /* We don't allow removing a table */
+        if ( pte_is_table(entry) )
+        {
+            dprintk(XENLOG_ERR, "Removing a table is not allowed\n");
+            return false;
+        }
+    }
+    /* Sanity check when populating the page-table. No check so far. */
+    else
+    {
+        /* We should be here with an invalid MFN */
+        ASSERT(mfn_eq(mfn, INVALID_MFN));
+    }
+
+    return true;
+}
+
+static pte_t *map_table(mfn_t mfn)
+{
+    /*
+     * During early boot, map_domain_page() may be unusable. Use the
+     * PMAP to map temporarily a page-table.
+     */
+    if ( system_state == SYS_STATE_early_boot )
+        return pmap_map(mfn);
+
+    return map_domain_page(mfn);
+}
+
+static void unmap_table(const pte_t *table)
+{
+    /*
+     * During early boot, map_table() will not use map_domain_page()
+     * but the PMAP.
+     */
+    if ( system_state == SYS_STATE_early_boot )
+        pmap_unmap(table);
+    else
+        unmap_domain_page(table);
+}
+
+static bool create_table(pte_t *entry)
+{
+    mfn_t mfn;
+    void *p;
+    pte_t pte;
+
+    if ( system_state != SYS_STATE_early_boot )
+    {
+        struct page_info *pg = alloc_domheap_page(NULL, 0);
+
+        if ( pg == NULL )
+            return false;
+
+        mfn = page_to_mfn(pg);
+    }
+    else
+        mfn = alloc_boot_pages(1, 1);
+
+    p = map_table(mfn);
+    clear_page(p);
+    unmap_table(p);
+
+    pte = pte_from_mfn(mfn, PTE_TABLE);
+    write_pte(entry, pte);
+
+    return true;
+}
+
+#define XEN_TABLE_MAP_NONE 0
+#define XEN_TABLE_MAP_NOMEM 1
+#define XEN_TABLE_SUPER_PAGE 2
+#define XEN_TABLE_NORMAL 3
+
+/*
+ * Take the currently mapped table, find the corresponding entry,
+ * and map the next table, if available.
+ *
+ * The alloc_tbl parameters indicates whether intermediate tables should
+ * be allocated when not present.
+ *
+ * Return values:
+ *  XEN_TABLE_MAP_NONE: a table allocation isn't permitted.
+ *  XEN_TABLE_MAP_NOMEM: allocating a new page failed.
+ *  XEN_TABLE_NORMAL: next level or leaf mapped normally.
+ *  XEN_TABLE_SUPER_PAGE: The next entry points to a superpage.
+ */
+static int pt_next_level(bool alloc_tbl, pte_t **table, unsigned int offset)
+{
+    pte_t *entry;
+    mfn_t mfn;
+
+    entry = *table + offset;
+
+    if ( !pte_is_valid(*entry) )
+    {
+        if ( !alloc_tbl )
+            return XEN_TABLE_MAP_NONE;
+
+        if ( !create_table(entry) )
+            return XEN_TABLE_MAP_NOMEM;
+    }
+
+    if ( pte_is_mapping(*entry) )
+        return XEN_TABLE_SUPER_PAGE;
+
+    mfn = mfn_from_pte(*entry);
+
+    unmap_table(*table);
+    *table = map_table(mfn);
+
+    return XEN_TABLE_NORMAL;
+}
+
+/* Update an entry at the level @target. */
+static int pt_update_entry(mfn_t root, vaddr_t virt,
+                           mfn_t mfn, unsigned int target,
+                           unsigned int flags)
+{
+    int rc;
+    unsigned int level = HYP_PT_ROOT_LEVEL;
+    pte_t *table;
+    /*
+     * The intermediate page table shouldn't be allocated when MFN isn't
+     * valid and we are not populating page table.
+     * This means we either modify permissions or remove an entry, or
+     * inserting brand new entry.
+     *
+     * See the comment above pt_update() for an additional explanation about
+     * combinations of (mfn, flags).
+    */
+    bool alloc_tbl = !mfn_eq(mfn, INVALID_MFN) || (flags & PTE_POPULATE);
+    pte_t pte, *entry;
+
+    /* convenience aliases */
+    DECLARE_OFFSETS(offsets, virt);
+
+    table = map_table(root);
+    for ( ; level > target; level-- )
+    {
+        rc = pt_next_level(alloc_tbl, &table, offsets[level]);
+        if ( rc == XEN_TABLE_MAP_NOMEM )
+        {
+            rc = -ENOMEM;
+            goto out;
+        }
+
+        if ( rc == XEN_TABLE_MAP_NONE )
+        {
+            rc = 0;
+            goto out;
+        }
+
+        if ( rc != XEN_TABLE_NORMAL )
+            break;
+    }
+
+    if ( level != target )
+    {
+        dprintk(XENLOG_ERR,
+                "%s: Shattering superpage is not supported\n", __func__);
+        rc = -EOPNOTSUPP;
+        goto out;
+    }
+
+    entry = table + offsets[level];
+
+    rc = -EINVAL;
+    if ( !pt_check_entry(*entry, mfn, flags) )
+        goto out;
+
+    /* We are removing the page */
+    if ( !(flags & PTE_VALID) )
+        /*
+         * There is also a check in pt_check_entry() which check that
+         * mfn=INVALID_MFN
+         */
+        pte.pte = 0;
+    else
+    {
+        /* We are inserting a mapping => Create new pte. */
+        if ( !mfn_eq(mfn, INVALID_MFN) )
+            pte = pte_from_mfn(mfn, PTE_VALID);
+        else /* We are updating the permission => Copy the current pte. */
+        {
+            pte = *entry;
+            pte.pte &= ~PTE_ACCESS_MASK;
+        }
+
+        /* update permission according to the flags */
+        pte.pte |= (flags & PTE_ACCESS_MASK) | PTE_ACCESSED | PTE_DIRTY;
+    }
+
+    write_pte(entry, pte);
+
+    rc = 0;
+
+ out:
+    unmap_table(table);
+
+    return rc;
+}
+
+/* Return the level where mapping should be done */
+static int pt_mapping_level(unsigned long vfn, mfn_t mfn, unsigned long nr,
+                            unsigned int flags)
+{
+    unsigned int level = 0;
+    unsigned long mask;
+    unsigned int i;
+
+    /*
+     * Use a larger mapping than 4K unless the caller specifically requests
+     * 4K mapping
+     */
+    if ( unlikely(flags & PTE_SMALL) )
+        return level;
+
+    /*
+     * Don't take into account the MFN when removing mapping (i.e
+     * MFN_INVALID) to calculate the correct target order.
+     *
+     * `vfn` and `mfn` must be both superpage aligned.
+     * They are or-ed together and then checked against the size of
+     * each level.
+     *
+     * `left` ( variable declared in pt_update() ) is not included
+     * and checked separately to allow superpage mapping even if it
+     * is not properly aligned (the user may have asked to map 2MB + 4k).
+     */
+    mask = !mfn_eq(mfn, INVALID_MFN) ? mfn_x(mfn) : 0;
+    mask |= vfn;
+
+    for ( i = HYP_PT_ROOT_LEVEL; i != 0; i-- )
+    {
+        if ( !(mask & (BIT(XEN_PT_LEVEL_ORDER(i), UL) - 1)) &&
+             (nr >= BIT(XEN_PT_LEVEL_ORDER(i), UL)) )
+        {
+            level = i;
+            break;
+        }
+    }
+
+    return level;
+}
+
+static DEFINE_SPINLOCK(pt_lock);
+
+/*
+ * If `mfn` equals `INVALID_MFN`, it indicates that the following page table
+ * update operation might be related to either:
+ *   - populating the table (PTE_POPULATE will be set additionaly),
+ *   - destroying a mapping (PTE_VALID=0),
+ *   - modifying an existing mapping (PTE_VALID=1).
+ *
+ * If `mfn` != INVALID_MFN and flags has PTE_VALID bit set then it means that
+ * inserting will be done.
+ */
+static int pt_update(vaddr_t virt, mfn_t mfn,
+                     unsigned long nr_mfns, unsigned int flags)
+{
+    int rc = 0;
+    unsigned long vfn = PFN_DOWN(virt);
+    unsigned long left = nr_mfns;
+    const mfn_t root = get_root_page();
+
+    /*
+     * It is bad idea to have mapping both writeable and
+     * executable.
+     * When modifying/creating mapping (i.e PTE_VALID is set),
+     * prevent any update if this happen.
+     */
+    if ( (flags & PTE_VALID) && (flags & PTE_WRITABLE) &&
+         (flags & PTE_EXECUTABLE) )
+    {
+        dprintk(XENLOG_ERR,
+                "Mappings should not be both Writeable and Executable\n");
+        return -EINVAL;
+    }
+
+    if ( !IS_ALIGNED(virt, PAGE_SIZE) )
+    {
+        dprintk(XENLOG_ERR,
+                "The virtual address is not aligned to the page-size\n");
+        return -EINVAL;
+    }
+
+    spin_lock(&pt_lock);
+
+    while ( left )
+    {
+        unsigned int order, level;
+
+        level = pt_mapping_level(vfn, mfn, left, flags);
+        order = XEN_PT_LEVEL_ORDER(level);
+
+        ASSERT(left >= BIT(order, UL));
+
+        rc = pt_update_entry(root, vfn << PAGE_SHIFT, mfn, level, flags);
+        if ( rc )
+            break;
+
+        vfn += 1UL << order;
+        if ( !mfn_eq(mfn, INVALID_MFN) )
+            mfn = mfn_add(mfn, 1UL << order);
+
+        left -= (1UL << order);
+    }
+
+    /* Ensure that PTEs are all updated before flushing */
+    RISCV_FENCE(rw, rw);
+
+    spin_unlock(&pt_lock);
+
+    /*
+     * Always flush TLB at the end of the function as non-present entries
+     * can be put in the TLB.
+     *
+     * The remote fence operation applies to the entire address space if
+     * either:
+     *  - start and size are both 0, or
+     *  - size is equal to 2^XLEN-1.
+     *
+     * TODO: come up with something which will allow not to flash the entire
+     *       address space.
+     */
+    flush_tlb_range_va(0, 0);
+
+    return rc;
+}
+
+int map_pages_to_xen(unsigned long virt,
+                     mfn_t mfn,
+                     unsigned long nr_mfns,
+                     unsigned int flags)
+{
+    /*
+     * Ensure that flags has PTE_VALID bit as map_pages_to_xen() is supposed
+     * to create a mapping.
+     *
+     * Ensure that we have a valid MFN before proceeding.
+     *
+     * If the MFN is invalid, pt_update() might misinterpret the operation,
+     * treating it as either a population, a mapping destruction,
+     * or a mapping modification.
+     */
+    ASSERT(!mfn_eq(mfn, INVALID_MFN) && (flags & PTE_VALID));
+
+    return pt_update(virt, mfn, nr_mfns, flags);
+}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 03 01:22:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 03 Oct 2024 01:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.809162.1221358 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swAY5-0003cn-HJ; Thu, 03 Oct 2024 01:22:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 809162.1221358; Thu, 03 Oct 2024 01: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 1swAY5-0003cf-E8; Thu, 03 Oct 2024 01:22:33 +0000
Received: by outflank-mailman (input) for mailman id 809162;
 Thu, 03 Oct 2024 01: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 1swAY4-0003cV-4A
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01: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 1swAY4-0005F8-3O
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01:22:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swAY4-0003DK-2N
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01: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=/RUjZNmthJvrc/TjE0c2uWM3SRV9k9nzukHzYIoPy5s=; b=T64dz4ZHfIVwBpRJpkpIdUqrO6
	KjhfgIzTr7g2I0Kjw7ezBVDh/94Sp3BZtFEdvNbODmUOmmgEPY+OgiKqdCkdxGgeqgUIemBgaAjRn
	MTmxR3ElTOKr57H0LQx+VoKvrpO8RemPMTuF06GuyNYun7/wpeAKIpbJ1/tHMwsawz6A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: introduce early_fdt_map()
Message-Id: <E1swAY4-0003DK-2N@xenbits.xenproject.org>
Date: Thu, 03 Oct 2024 01:22:32 +0000

commit bcd932b5b2b8647f831066c6c6c11064b3645cdd
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Oct 2 08:54:36 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 2 08:54:36 2024 +0200

    xen/riscv: introduce early_fdt_map()
    
    Introduce function which allows to map FDT to Xen.
    
    Also, initialization of device_tree_flattened happens using
    early_fdt_map().
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/mm.h |  2 ++
 xen/arch/riscv/mm.c             | 55 +++++++++++++++++++++++++++++++++++++++++
 xen/arch/riscv/setup.c          |  7 ++++++
 3 files changed, 64 insertions(+)

diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/mm.h
index ce1557bb27..4b7b00b850 100644
--- a/xen/arch/riscv/include/asm/mm.h
+++ b/xen/arch/riscv/include/asm/mm.h
@@ -259,4 +259,6 @@ static inline unsigned int arch_get_dma_bitsize(void)
 
 void setup_fixmap_mappings(void);
 
+void *early_fdt_map(paddr_t fdt_paddr);
+
 #endif /* _ASM_RISCV_MM_H */
diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c
index e8430def14..4a628aef83 100644
--- a/xen/arch/riscv/mm.c
+++ b/xen/arch/riscv/mm.c
@@ -1,13 +1,16 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
+#include <xen/bootfdt.h>
 #include <xen/bug.h>
 #include <xen/compiler.h>
 #include <xen/init.h>
 #include <xen/kernel.h>
+#include <xen/libfdt/libfdt.h>
 #include <xen/macros.h>
 #include <xen/mm.h>
 #include <xen/pfn.h>
 #include <xen/sections.h>
+#include <xen/sizes.h>
 
 #include <asm/early_printk.h>
 #include <asm/csr.h>
@@ -369,3 +372,55 @@ int destroy_xen_mappings(unsigned long s, unsigned long e)
     BUG_ON("unimplemented");
     return -1;
 }
+
+void * __init early_fdt_map(paddr_t fdt_paddr)
+{
+    /* We are using 2MB superpage for mapping the FDT */
+    paddr_t base_paddr = fdt_paddr & XEN_PT_LEVEL_MAP_MASK(1);
+    paddr_t offset;
+    void *fdt_virt;
+    uint32_t size;
+    int rc;
+
+    /*
+     * Check whether the physical FDT address is set and meets the minimum
+     * alignment requirement. Since we are relying on MIN_FDT_ALIGN to be at
+     * least 8 bytes so that we always access the magic and size fields
+     * of the FDT header after mapping the first chunk, double check if
+     * that is indeed the case.
+     */
+    BUILD_BUG_ON(MIN_FDT_ALIGN < 8);
+    if ( !fdt_paddr || fdt_paddr % MIN_FDT_ALIGN )
+        return NULL;
+
+    /* The FDT is mapped using 2MB superpage */
+    BUILD_BUG_ON(BOOT_FDT_VIRT_START % MB(2));
+
+    rc = map_pages_to_xen(BOOT_FDT_VIRT_START, maddr_to_mfn(base_paddr),
+                          MB(2) >> PAGE_SHIFT,
+                          PAGE_HYPERVISOR_RO);
+    if ( rc )
+        panic("Unable to map the device-tree.\n");
+
+    offset = fdt_paddr % XEN_PT_LEVEL_SIZE(1);
+    fdt_virt = (void *)BOOT_FDT_VIRT_START + offset;
+
+    if ( fdt_magic(fdt_virt) != FDT_MAGIC )
+        return NULL;
+
+    size = fdt_totalsize(fdt_virt);
+    if ( size > BOOT_FDT_VIRT_SIZE )
+        return NULL;
+
+    if ( (offset + size) > MB(2) )
+    {
+        rc = map_pages_to_xen(BOOT_FDT_VIRT_START + MB(2),
+                              maddr_to_mfn(base_paddr + MB(2)),
+                              MB(2) >> PAGE_SHIFT,
+                              PAGE_HYPERVISOR_RO);
+        if ( rc )
+            panic("Unable to map the device-tree\n");
+    }
+
+    return fdt_virt;
+}
diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index 1d81e0b64f..6d156c3a40 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -2,6 +2,7 @@
 
 #include <xen/bug.h>
 #include <xen/compile.h>
+#include <xen/device_tree.h>
 #include <xen/init.h>
 #include <xen/mm.h>
 #include <xen/shutdown.h>
@@ -37,6 +38,12 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
 
     setup_fixmap_mappings();
 
+    device_tree_flattened = early_fdt_map(dtb_addr);
+    if ( !device_tree_flattened )
+        panic("Invalid device tree blob at physical address %#lx. The DTB must be 8-byte aligned and must not exceed %lld bytes in size.\n\n"
+              "Please check your bootloader.\n",
+              dtb_addr, BOOT_FDT_VIRT_SIZE);
+
     printk("All set up\n");
 
     machine_halt();
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 03 01:22:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 03 Oct 2024 01:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.809163.1221362 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swAYF-0003fY-IE; Thu, 03 Oct 2024 01:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 809163.1221362; Thu, 03 Oct 2024 01: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 1swAYF-0003fQ-Fi; Thu, 03 Oct 2024 01:22:43 +0000
Received: by outflank-mailman (input) for mailman id 809163;
 Thu, 03 Oct 2024 01: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 1swAYE-0003fG-7I
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01: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 1swAYE-0005FF-6W
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01:22:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swAYE-0003E4-5b
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01: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=yFwjmsV2ruJ3qZB7N8oZki2kt5YME1xfvJj7HEUohGw=; b=SDpbnmXEZu94x7QK5gmBLzI0Kj
	keY+tGC5t5JAAei9illJiE0AP1PDmjSjfZeYZzdmrvc1gXuN17aJaaAbwxJQ4q/NfNHQy0tzWr7gP
	iPJU2FCVPwEMMcmt0UGBdhpWhv5ALGrkVcq+ZaHQ/QSLbc51oSo6Rt4rZYtX6wHC8LsA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] VMX: convert entry point annotations
Message-Id: <E1swAYE-0003E4-5b@xenbits.xenproject.org>
Date: Thu, 03 Oct 2024 01:22:42 +0000

commit 1d199e83c7f7a4a10cb2076a1b8a8eecbd3dfd29
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Oct 2 08:55:02 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 2 08:55:02 2024 +0200

    VMX: convert entry point annotations
    
    Use the generic framework from xen/linkage.h.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/hvm/vmx/entry.S | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/entry.S b/xen/arch/x86/hvm/vmx/entry.S
index 7233e771d8..6aaeb28a5b 100644
--- a/xen/arch/x86/hvm/vmx/entry.S
+++ b/xen/arch/x86/hvm/vmx/entry.S
@@ -24,7 +24,7 @@
 #define VMRESUME     .byte 0x0f,0x01,0xc3
 #define VMLAUNCH     .byte 0x0f,0x01,0xc2
 
-ENTRY(vmx_asm_vmexit_handler)
+FUNC(vmx_asm_vmexit_handler)
         SAVE_ALL
 
         mov  %cr2,%rax
@@ -187,7 +187,7 @@ UNLIKELY_END(realmode)
         call vmx_vmentry_failure
         jmp  .Lvmx_process_softirqs
 
-ENTRY(vmx_asm_do_vmentry)
+LABEL(vmx_asm_do_vmentry)
         GET_CURRENT(bx)
         jmp  .Lvmx_do_vmentry
 
@@ -205,6 +205,4 @@ ENTRY(vmx_asm_do_vmentry)
         sti
         call do_softirq
         jmp  .Lvmx_do_vmentry
-
-        .type vmx_asm_vmexit_handler, @function
-        .size vmx_asm_vmexit_handler, . - vmx_asm_vmexit_handler
+END(vmx_asm_vmexit_handler)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 03 01:22:53 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 03 Oct 2024 01:22:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.809164.1221366 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swAYP-0003iK-Jj; Thu, 03 Oct 2024 01:22:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 809164.1221366; Thu, 03 Oct 2024 01: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 1swAYP-0003iC-H8; Thu, 03 Oct 2024 01:22:53 +0000
Received: by outflank-mailman (input) for mailman id 809164;
 Thu, 03 Oct 2024 01: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 1swAYO-0003hy-AA
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01: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 1swAYO-0005Fc-9T
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01:22:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swAYO-0003Eh-8Y
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01: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=rgNb+RagG+oLeSa5G8Dl8B0YXEJeOpn2A9fwL2Wdvgw=; b=cjApiYEpCC0iJCMQzdnO3/ne8d
	1pQazggeJBNIDg0zdWrXbMcwr9Ord9S/HFnK296vglAkCaQ+b5fOVn1/hslXLYRE22j0PsyACJ6uQ
	fzQF7pRQdSxpw428a4fXu450FsLX8BG0h8GnGhyB0zIjhNKM0bR8RRr1Qnj9pui/ONVY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/ACPI: annotate assembly function/data with type and size
Message-Id: <E1swAYO-0003Eh-8Y@xenbits.xenproject.org>
Date: Thu, 03 Oct 2024 01:22:52 +0000

commit a8c8d6c5299a356919e4d059403c7f9c2971e7b2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Oct 2 08:55:31 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 2 08:55:31 2024 +0200

    x86/ACPI: annotate assembly function/data with type and size
    
    Use the generic framework from xen/linkage.h.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/acpi/wakeup_prot.S | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/acpi/wakeup_prot.S b/xen/arch/x86/acpi/wakeup_prot.S
index 3855ff1ddb..8ce57ad137 100644
--- a/xen/arch/x86/acpi/wakeup_prot.S
+++ b/xen/arch/x86/acpi/wakeup_prot.S
@@ -7,7 +7,7 @@
         .text
         .code64
 
-ENTRY(do_suspend_lowlevel)
+FUNC(do_suspend_lowlevel)
         push    %rbp
         push    %rbx
         push    %r12
@@ -43,7 +43,7 @@ ENTRY(do_suspend_lowlevel)
          *
          * Everything else, including the stack, needs restoring.
          */
-ENTRY(s3_resume)
+LABEL(s3_resume)
         lgdt    boot_gdtr(%rip)
 
         mov     saved_cr0(%rip), %rax
@@ -132,6 +132,7 @@ ENTRY(s3_resume)
         pop     %rbx
         pop     %rbp
         ret
+END(do_suspend_lowlevel)
 
 .data
         .align 16
@@ -142,5 +143,4 @@ saved_cr0:      .quad   0
 saved_ssp:      .quad   0
 #endif
 
-GLOBAL(saved_magic)
-        .long   0x9abcdef0
+ASM_INT(saved_magic, 0x9abcdef0)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 03 01:23:03 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 03 Oct 2024 01:23:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.809165.1221370 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swAYZ-0003l1-LC; Thu, 03 Oct 2024 01:23:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 809165.1221370; Thu, 03 Oct 2024 01: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 1swAYZ-0003kt-IX; Thu, 03 Oct 2024 01:23:03 +0000
Received: by outflank-mailman (input) for mailman id 809165;
 Thu, 03 Oct 2024 01: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 1swAYY-0003kl-D8
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01: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 1swAYY-0005G3-CQ
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01:23:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swAYY-0003FW-Be
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01: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=5b06QfJPqvgCxoiFX38zEefar+6zXdMc6U770UIDlYM=; b=q1qde2f8BUGVkcgK8UM6FfFHUZ
	fZM7VbA1NXWVi/TdmWJDlVLSIM+NYA2/i0yeEfMgpfh/MLIrbvnMIZb5EdiWyv423j/tcqG1dgm6z
	+IxI5wR01SyN1bI2jQTDcP4NP0QatylNS5fV4adVxfjjYTQ58b/fx+zLJJOH80qEDeek=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/kexec: convert entry point annotations
Message-Id: <E1swAYY-0003FW-Be@xenbits.xenproject.org>
Date: Thu, 03 Oct 2024 01:23:02 +0000

commit 373d93cfce4d6f5b87e9d777da963664fd0dfb74
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Oct 2 08:56:04 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 2 08:56:04 2024 +0200

    x86/kexec: convert entry point annotations
    
    Use the generic framework from xen/linkage.h.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_64/kexec_reloc.S | 40 +++++++++++++++++----------------------
 1 file changed, 17 insertions(+), 23 deletions(-)

diff --git a/xen/arch/x86/x86_64/kexec_reloc.S b/xen/arch/x86/x86_64/kexec_reloc.S
index 035164e96f..9f40c80d7c 100644
--- a/xen/arch/x86/x86_64/kexec_reloc.S
+++ b/xen/arch/x86/x86_64/kexec_reloc.S
@@ -13,6 +13,9 @@
 
         .file __FILE__
 
+/* All contents of .text.kexec wants to be kept together. */
+#undef CONFIG_CC_SPLIT_SECTIONS
+
 #include <xen/kimage.h>
 
 #include <asm/asm_defns.h>
@@ -21,10 +24,9 @@
 #include <asm/machine_kexec.h>
 
         .section .text.kexec, "ax", @progbits
-        .align PAGE_SIZE
         .code64
 
-ENTRY(kexec_reloc)
+FUNC(kexec_reloc, PAGE_SIZE)
         /* %rdi - code page maddr */
         /* %rsi - page table maddr */
         /* %rdx - indirection page maddr */
@@ -91,8 +93,9 @@ ENTRY(kexec_reloc)
         push    $0x10
         push    %rax
         lretq
+END(kexec_reloc)
 
-relocate_pages:
+FUNC_LOCAL(relocate_pages)
         /* %rdi - indirection page maddr */
         pushq   %rbx
 
@@ -138,10 +141,11 @@ relocate_pages:
 .L_done:
         popq    %rbx
         ret
+END(relocate_pages)
 
         .code32
 
-compatibility_mode:
+FUNC_LOCAL(compatibility_mode)
         /* Setup some sane segments. */
         movl    $0x0008, %eax
         movl    %eax, %ds
@@ -168,39 +172,29 @@ compatibility_mode:
         /* Call the image entry point.  This should never return. */
         call    *%ebp
         ud2
+END(compatibility_mode)
 
-        .align 4
-compat_mode_gdt_desc:
+DATA_LOCAL(compat_mode_gdt_desc, 4)
         .word .Lcompat_mode_gdt_end - compat_mode_gdt -1
         .quad 0x0000000000000000     /* set in call_32_bit above */
+END(compat_mode_gdt_desc)
 
-        .type compat_mode_gdt_desc, @object
-        .size compat_mode_gdt_desc, . - compat_mode_gdt_desc
-
-        .align 8
-compat_mode_gdt:
+DATA_LOCAL(compat_mode_gdt, 8)
         .quad 0x0000000000000000     /* null                              */
         .quad 0x00cf93000000ffff     /* 0x0008 ring 0 data                */
         .quad 0x00cf9b000000ffff     /* 0x0010 ring 0 code, compatibility */
 .Lcompat_mode_gdt_end:
+END(compat_mode_gdt)
 
-        .type compat_mode_gdt, @object
-        .size compat_mode_gdt, . - compat_mode_gdt
-
-compat_mode_idt:
+DATA_LOCAL(compat_mode_idt)
         .word 0                      /* limit */
         .long 0                      /* base */
-
-        .type compat_mode_idt, @object
-        .size compat_mode_idt, . - compat_mode_idt
+END(compat_mode_idt)
 
         /*
          * 16 words of stack are more than enough.
          */
-        .align 8
-reloc_stack:
+DATA_LOCAL(reloc_stack, 8)
         .fill 16,8,0
 .Lreloc_stack_base:
-
-        .type reloc_stack, @object
-        .size reloc_stack, . - reloc_stack
+END(reloc_stack)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 03 01:23:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 03 Oct 2024 01:23:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.809166.1221374 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swAYj-0003nk-MP; Thu, 03 Oct 2024 01:23:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 809166.1221374; Thu, 03 Oct 2024 01: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 1swAYj-0003nc-Jx; Thu, 03 Oct 2024 01:23:13 +0000
Received: by outflank-mailman (input) for mailman id 809166;
 Thu, 03 Oct 2024 01: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 1swAYi-0003nN-Fs
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01: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 1swAYi-0005GC-FA
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01:23:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swAYi-0003G1-EV
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01: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=aIjnJYW4Vzdw7JrnfCSBZjv0KtCp6nUMktdxi9GmePw=; b=ChM5pWTcZnkkvkSCKFdq02hAoX
	XvlaEDjU9WMaqYYcXAUytnIU0C3nEMYI2Um/yI7MGurIjyhJJCpNfCkox47zylAC5rzBs9GSIntt9
	yWD8Xqk8yrgiLj6cTSTKHSF11WmfEvkvLNPFmc0j7yz2f3koLFL19HmjwSIiWpBTA9iY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: convert dom_crash_sync_extable() annotation
Message-Id: <E1swAYi-0003G1-EV@xenbits.xenproject.org>
Date: Thu, 03 Oct 2024 01:23:12 +0000

commit eaa7a72eda5dfc3e5080479eb9a89ba0171e0ac2
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Oct 2 08:56:45 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 2 08:56:45 2024 +0200

    x86: convert dom_crash_sync_extable() annotation
    
    ... to that from the generic framework in xen/linkage.h.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_64/entry.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 9b0cdb7640..3e720a358b 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -624,7 +624,7 @@ domain_crash_page_fault_0x8:
         ALTERNATIVE "", clac, X86_FEATURE_XEN_SMAP
         movq  %rsi,%rdi
         call  show_page_walk
-ENTRY(dom_crash_sync_extable)
+LABEL(dom_crash_sync_extable, 0)
         ALTERNATIVE "", clac, X86_FEATURE_XEN_SMAP
         # Get out of the guest-save area of the stack.
         GET_STACK_END(ax)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 03 01:23:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 03 Oct 2024 01:23:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.809167.1221378 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swAYt-0003qJ-O0; Thu, 03 Oct 2024 01:23:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 809167.1221378; Thu, 03 Oct 2024 01: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 1swAYt-0003qB-LM; Thu, 03 Oct 2024 01:23:23 +0000
Received: by outflank-mailman (input) for mailman id 809167;
 Thu, 03 Oct 2024 01: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 1swAYs-0003q0-JM
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01: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 1swAYs-0005GL-Ih
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01:23:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swAYs-0003Gg-HN
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 01: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=Rhqwef5EDUIAr86sAcCGLF3TR8tOQqt5gSgcnrjUlmM=; b=xPBhMJTaLtNoWkvbM1L6NY/9tr
	T4uIs0KRKXQUFBGRkPSeoWpqCzqPgNkEk2+8bDGetx5jjhPB1InCEbWxKlwn+7gDe/NWEzirGr8hg
	SLMecenW1gtPzczl5+KTUYhk6mW4ZqDCCUPjhzlb9DwgctUVvpb9vMCmY2vsYoaIzJIQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: move ENTRY(), GLOBAL(), and ALIGN
Message-Id: <E1swAYs-0003Gg-HN@xenbits.xenproject.org>
Date: Thu, 03 Oct 2024 01:23:22 +0000

commit b102c9f1ce29262f33400920eeb41f23394ea99d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Oct 2 08:59:03 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 2 08:59:03 2024 +0200

    x86: move ENTRY(), GLOBAL(), and ALIGN
    
    ... to boot code, limiting their scope and thus allowing to drop
    respective #undef-s from the linker script.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/head.S          | 9 +++++++++
 xen/arch/x86/include/asm/config.h | 8 --------
 xen/arch/x86/x86_64/entry.S       | 2 +-
 xen/arch/x86/xen.lds.S            | 2 --
 4 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index e0901ee400..6a06f6c9ea 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -10,6 +10,15 @@
 #include <asm/cpufeature.h>
 #include <public/elfnote.h>
 
+#define ALIGN .align CONFIG_FUNCTION_ALIGNMENT, CODE_FILL
+#define ENTRY(name)                             \
+  ALIGN;                                        \
+  GLOBAL(name)
+#define GLOBAL(name)                            \
+  .globl name;                                  \
+  .hidden name;                                 \
+  name:
+
         .section .text.header, "ax", @progbits
         .code32
 
diff --git a/xen/arch/x86/include/asm/config.h b/xen/arch/x86/include/asm/config.h
index 1f828bfd52..f8a5a4913b 100644
--- a/xen/arch/x86/include/asm/config.h
+++ b/xen/arch/x86/include/asm/config.h
@@ -42,14 +42,6 @@
 /* Linkage for x86 */
 #ifdef __ASSEMBLY__
 #define CODE_FILL 0x90
-#define ALIGN .align CONFIG_FUNCTION_ALIGNMENT, CODE_FILL
-#define ENTRY(name)                             \
-  ALIGN;                                        \
-  GLOBAL(name)
-#define GLOBAL(name)                            \
-  .globl name;                                  \
-  .hidden name;                                 \
-  name:
 #endif
 
 #define NR_hypercalls 64
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index 3e720a358b..c5c723b5f4 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -1254,7 +1254,7 @@ FUNC_LOCAL(autogen_stubs, 0) /* Automatically generated stubs. */
         .if vec >= FIRST_IRQ_VECTOR
 #endif
 
-        ALIGN
+        .align CONFIG_FUNCTION_ALIGNMENT, CODE_FILL
 1:
         ENDBR64
         pushq $0
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index b60d2f0d82..94079fc164 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -5,8 +5,6 @@
 #include <xen/lib.h>
 #include <xen/xen.lds.h>
 #include <asm/page.h>
-#undef ENTRY
-#undef ALIGN
 
 #ifdef EFI
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 03 09:11:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 03 Oct 2024 09:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.809214.1221422 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swHrV-0005Vn-9m; Thu, 03 Oct 2024 09:11:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 809214.1221422; Thu, 03 Oct 2024 09: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 1swHrV-0005Vf-6j; Thu, 03 Oct 2024 09:11:05 +0000
Received: by outflank-mailman (input) for mailman id 809214;
 Thu, 03 Oct 2024 09: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 1swHrT-0005VZ-V3
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 09: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 1swHrT-0006xh-ON
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 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 1swHrT-000512-Mt
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 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=u91rbPC2KDJUrYo677Amv10kvs9kaLIammP5zlIrmts=; b=DJJK7bB3oOoZpwHyU8mdWS73dB
	S1ERDf24AhsncZnBKJbDuXEt4uxYoG5dkPnR/Se2RuNZo2biUtTpC0oXCgurYe9qFGSCxQgneRJbF
	3/2LtpAIL1wVpYIn/lF5N9apmu/ZOrO3SNzf2enmvbBqKO6BiSI2hrsovrpAi8+aJkO8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] stubdom: Fix newlib build with GCC-14
Message-Id: <E1swHrT-000512-Mt@xenbits.xenproject.org>
Date: Thu, 03 Oct 2024 09:11:03 +0000

commit 444cb9350f2c1cc202b6b86176ddd8e57525e2d9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Oct 2 19:01:26 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 3 10:07:25 2024 +0100

    stubdom: Fix newlib build with GCC-14
    
    Based on a fix from OpenSUSE, but adjusted to be Clang-compatible too.  Pass
    -Wno-implicit-function-declaration library-wide rather than using local GCC
    pragmas.
    
    Fix of copy_past_newline() to avoid triggering -Wstrict-prototypes.
    
    Link: https://build.opensuse.org/request/show/1178775
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 stubdom/Makefile                           |  2 ++
 stubdom/newlib-fix-copy_past_newline.patch | 10 ++++++++++
 2 files changed, 12 insertions(+)

diff --git a/stubdom/Makefile b/stubdom/Makefile
index 8c503c2bf8..f8c31fd35d 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -97,10 +97,12 @@ newlib-$(NEWLIB_VERSION): newlib-$(NEWLIB_VERSION).tar.gz
 	patch -d $@ -p1 < newlib-disable-texinfo.patch
 	patch -d $@ -p1 < newlib-cygmon-gmon.patch
 	patch -d $@ -p1 < newlib-makedoc.patch
+	patch -d $@ -p1 < newlib-fix-copy_past_newline.patch
 	find $@ -type f | xargs perl -i.bak \
 		-pe 's/\b_(tzname|daylight|timezone)\b/$$1/g'
 	touch $@
 
+NEWLIB_CFLAGS += -Wno-implicit-function-declaration
 NEWLIB_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libc.a
 .PHONY: cross-newlib
 cross-newlib: $(NEWLIB_STAMPFILE)
diff --git a/stubdom/newlib-fix-copy_past_newline.patch b/stubdom/newlib-fix-copy_past_newline.patch
new file mode 100644
index 0000000000..f8452480bc
--- /dev/null
+++ b/stubdom/newlib-fix-copy_past_newline.patch
@@ -0,0 +1,10 @@
+--- newlib-1.16.0/newlib/doc/makedoc.c.orig
++++ newlib-1.16.0/newlib/doc/makedoc.c
+@@ -798,6 +798,7 @@ DEFUN( iscommand,(ptr, idx),
+ }
+
+
++static unsigned int
+ DEFUN(copy_past_newline,(ptr, idx, dst),
+       string_type *ptr AND
+       unsigned int idx AND
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 03 12:11:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 03 Oct 2024 12:11:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.809316.1221556 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swKfl-0003GE-Ve; Thu, 03 Oct 2024 12:11:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 809316.1221556; Thu, 03 Oct 2024 12:11:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swKfl-0003G7-SN; Thu, 03 Oct 2024 12:11:09 +0000
Received: by outflank-mailman (input) for mailman id 809316;
 Thu, 03 Oct 2024 12:11:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swKfk-0003G1-M2
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 12:11:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swKfk-0001h7-Gm
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 12:11:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swKfk-00011B-Ed
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 12:11:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=l1atLjZgYMihESw3jwnA1nRdG0+m99YZFhoBeAxiF9U=; b=CbEYp4U3BugIvClocg4sTJ83WH
	SMCKpJYrBWIHvjwEkq7/JoEtbzl/lzD7pbbO4M0dtGnhvOyS7WN8LqJUuU097vXTz7d+NBz/+U3oU
	TUjEdGO6Nx9P25gUzde1Qfpuv9wcSK88k6TSN+rSZKDhTrdkcOZxKvIw/KWl+V/6l6OM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging] Merge tag 'v9.1.0' into 'staging'
Message-Id: <E1swKfk-00011B-Ed@xenbits.xenproject.org>
Date: Thu, 03 Oct 2024 12:11:08 +0000

=== This changeset includes merge from high-traffic branch ===
Commits on that branch are not reported individually.

commit 3fdb3cd3a27a22a050c7d27126a24807a7a45745
Merge: fd1952d814da738ed107e05583b3e02ac11e88ff 0df9387c8983e1b1e72d8c574356f572342c03e6
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Thu Oct 3 14:02:52 2024 +0200
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Thu Oct 3 14:02:52 2024 +0200

    Merge tag 'v9.1.0' into 'staging'
 .gitlab-ci.d/base.yml                              |    73 +-
 .gitlab-ci.d/buildtest-template.yml                |    41 +-
 .gitlab-ci.d/buildtest.yml                         |   254 +-
 .gitlab-ci.d/cirrus.yml                            |    76 +-
 .gitlab-ci.d/cirrus/build.yml                      |     6 +-
 .gitlab-ci.d/cirrus/freebsd-12.vars                |    16 -
 .gitlab-ci.d/cirrus/freebsd-13.vars                |     2 +-
 .gitlab-ci.d/cirrus/kvm-build.yml                  |    31 -
 .gitlab-ci.d/cirrus/macos-12.vars                  |    16 -
 .gitlab-ci.d/cirrus/macos-13.vars                  |    16 +
 .gitlab-ci.d/cirrus/macos-14.vars                  |    16 +
 .gitlab-ci.d/container-core.yml                    |     4 +-
 .gitlab-ci.d/container-cross.yml                   |    68 +-
 .gitlab-ci.d/container-template.yml                |     8 +-
 .gitlab-ci.d/containers.yml                        |     2 +-
 .gitlab-ci.d/crossbuild-template.yml               |    37 +-
 .gitlab-ci.d/crossbuilds.yml                       |    51 +-
 .gitlab-ci.d/custom-runners.yml                    |    12 +-
 .../custom-runners/centos-stream-8-x86_64.yml      |    24 -
 .gitlab-ci.d/custom-runners/ubuntu-20.04-s390x.yml |   130 -
 .../custom-runners/ubuntu-22.04-aarch32.yml        |     4 +-
 .../custom-runners/ubuntu-22.04-aarch64.yml        |    30 +-
 .gitlab-ci.d/custom-runners/ubuntu-22.04-s390x.yml |   128 +
 .gitlab-ci.d/opensbi.yml                           |    13 +-
 .gitlab-ci.d/qemu-project.yml                      |     7 +
 .gitlab-ci.d/static_checks.yml                     |     4 +-
 .gitlab-ci.d/windows.yml                           |   159 +-
 .gitmodules                                        |    18 -
 .mailmap                                           |    30 +-
 .readthedocs.yml                                   |    19 +-
 .travis.yml                                        |    45 +-
 Kconfig.host                                       |    12 +-
 MAINTAINERS                                        |   654 +-
 Makefile                                           |    93 +-
 README.rst                                         |     6 +-
 VERSION                                            |     2 +-
 accel/Kconfig                                      |     4 +-
 accel/accel-blocker.c                              |    10 +-
 accel/accel-common.c                               |   155 -
 accel/accel-softmmu.c                              |   106 -
 accel/accel-softmmu.h                              |    15 -
 accel/accel-system.c                               |   106 +
 accel/accel-system.h                               |    15 +
 accel/accel-target.c                               |   176 +
 accel/dummy-cpus.c                                 |    12 +-
 accel/hvf/hvf-accel-ops.c                          |   157 +-
 accel/hvf/hvf-all.c                                |    65 +-
 accel/kvm/kvm-accel-ops.c                          |    14 +-
 accel/kvm/kvm-all.c                                |  1037 +-
 accel/kvm/kvm-cpus.h                               |     1 -
 accel/kvm/trace-events                             |    14 +-
 accel/meson.build                                  |     6 +-
 accel/qtest/meson.build                            |     2 +-
 accel/qtest/qtest.c                                |    13 +
 accel/stubs/hax-stub.c                             |    24 -
 accel/stubs/kvm-stub.c                             |    32 +-
 accel/stubs/meson.build                            |    11 +-
 accel/stubs/tcg-stub.c                             |    22 -
 accel/tcg/atomic_common.c.inc                      |    50 +-
 accel/tcg/atomic_template.h                        |   113 +-
 accel/tcg/cpu-exec-common.c                        |    36 +-
 accel/tcg/cpu-exec.c                               |   416 +-
 accel/tcg/cputlb.c                                 |  2770 +--
 accel/tcg/debuginfo.c                              |    96 -
 accel/tcg/debuginfo.h                              |    79 -
 accel/tcg/icount-common.c                          |   502 +
 accel/tcg/internal-common.h                        |    59 +
 accel/tcg/internal-target.h                        |   118 +
 accel/tcg/internal.h                               |    70 -
 accel/tcg/ldst_atomicity.c.inc                     |  1111 ++
 accel/tcg/ldst_common.c.inc                        |   295 +-
 accel/tcg/meson.build                              |    29 +-
 accel/tcg/monitor.c                                |   202 +-
 accel/tcg/perf.c                                   |   375 -
 accel/tcg/perf.h                                   |    49 -
 accel/tcg/plugin-gen.c                             |  1095 +-
 accel/tcg/plugin-helpers.h                         |     4 -
 accel/tcg/tb-hash.h                                |    16 +-
 accel/tcg/tb-jmp-cache.h                           |    17 +-
 accel/tcg/tb-maint.c                               |   290 +-
 accel/tcg/tcg-accel-ops-icount.c                   |    35 +-
 accel/tcg/tcg-accel-ops-icount.h                   |     3 +-
 accel/tcg/tcg-accel-ops-mttcg.c                    |    39 +-
 accel/tcg/tcg-accel-ops-rr.c                       |    96 +-
 accel/tcg/tcg-accel-ops.c                          |    33 +-
 accel/tcg/tcg-accel-ops.h                          |     4 +-
 accel/tcg/tcg-all.c                                |    67 +-
 accel/tcg/tcg-runtime-gvec.c                       |    39 +-
 accel/tcg/tcg-runtime.c                            |     6 +-
 accel/tcg/tcg-runtime.h                            |    79 +-
 accel/tcg/translate-all.c                          |   315 +-
 accel/tcg/translator.c                             |   446 +-
 accel/tcg/user-exec-stub.c                         |     6 +-
 accel/tcg/user-exec.c                              |   489 +-
 accel/tcg/vcpu-state.h                             |    18 +
 accel/tcg/watchpoint.c                             |   143 +
 accel/xen/xen-all.c                                |     1 +
 audio/alsaaudio.c                                  |     3 +-
 audio/audio-hmp-cmds.c                             |     6 +-
 audio/audio.c                                      |   246 +-
 audio/audio.h                                      |    10 +-
 audio/audio_int.h                                  |     7 +-
 audio/audio_legacy.c                               |   591 -
 audio/audio_template.h                             |    13 +-
 audio/coreaudio.m                                  |    16 +-
 audio/dbusaudio.c                                  |    48 +-
 audio/dsoundaudio.c                                |     3 +-
 audio/jackaudio.c                                  |    24 +-
 audio/meson.build                                  |    13 +-
 audio/mixeng.h                                     |     2 +-
 audio/noaudio.c                                    |     3 +-
 audio/ossaudio.c                                   |    13 +-
 audio/paaudio.c                                    |     8 +-
 audio/pwaudio.c                                    |   857 +
 audio/sdlaudio.c                                   |     6 +-
 audio/sndioaudio.c                                 |     3 +-
 audio/spiceaudio.c                                 |     5 +-
 audio/trace-events                                 |    10 +-
 audio/wavaudio.c                                   |     7 +-
 backends/Kconfig                                   |     8 +
 backends/cryptodev-builtin.c                       |    13 +-
 backends/cryptodev-vhost-user.c                    |     9 +-
 backends/cryptodev.c                               |    24 +-
 backends/dbus-vmstate.c                            |     5 +-
 backends/host_iommu_device.c                       |    33 +
 backends/hostmem-epc.c                             |    19 +-
 backends/hostmem-file.c                            |   114 +-
 backends/hostmem-memfd.c                           |    15 +-
 backends/hostmem-ram.c                             |    13 +-
 backends/hostmem-shm.c                             |   123 +
 backends/hostmem.c                                 |   188 +-
 backends/iommufd.c                                 |   360 +
 backends/meson.build                               |    29 +-
 backends/rng-random.c                              |     5 +-
 backends/spdm-socket.c                             |   216 +
 backends/tpm/meson.build                           |     8 +-
 backends/tpm/tpm_backend.c                         |     4 +-
 backends/tpm/tpm_emulator.c                        |    17 +-
 backends/tpm/tpm_ioctl.h                           |     2 +-
 backends/tpm/tpm_util.c                            |    16 +-
 backends/tpm/trace-events                          |     3 +-
 backends/trace-events                              |    13 +
 block.c                                            |  1034 +-
 block/amend.c                                      |     8 +-
 block/backup.c                                     |    25 +-
 block/blkdebug.c                                   |    35 +-
 block/blkio.c                                      |   345 +-
 block/blklogwrites.c                               |   124 +-
 block/blkreplay.c                                  |     8 +-
 block/blkverify.c                                  |    27 +-
 block/block-backend.c                              |   468 +-
 block/block-copy.c                                 |    29 +-
 block/bochs.c                                      |    13 +-
 block/cloop.c                                      |    15 +-
 block/commit.c                                     |    46 +-
 block/copy-before-write.c                          |    63 +-
 block/copy-before-write.h                          |     1 +
 block/copy-on-read.c                               |    27 +-
 block/copy-on-read.h                               |     3 +-
 block/coroutines.h                                 |     5 +-
 block/create.c                                     |     1 -
 block/crypto.c                                     |   188 +-
 block/crypto.h                                     |     8 +
 block/curl.c                                       |    64 +-
 block/dmg.c                                        |    51 +-
 block/dmg.h                                        |     8 +-
 block/export/export.c                              |    41 +-
 block/export/fuse.c                                |    56 +-
 block/export/vduse-blk.c                           |   130 +-
 block/export/vhost-user-blk-server.c               |    81 +-
 block/export/vhost-user-blk-server.h               |     2 +-
 block/file-posix.c                                 |   910 +-
 block/file-win32.c                                 |     8 +-
 block/filter-compress.c                            |     5 +-
 block/gluster.c                                    |   120 +-
 block/graph-lock.c                                 |    69 +-
 block/io.c                                         |   645 +-
 block/io_uring.c                                   |    78 +-
 block/iscsi.c                                      |    10 +-
 block/linux-aio.c                                  |    89 +-
 block/meson.build                                  |    55 +-
 block/mirror.c                                     |   304 +-
 block/monitor/bitmap-qmp-cmds.c                    |    39 +-
 block/monitor/block-hmp-cmds.c                     |    46 +-
 block/monitor/meson.build                          |     2 +-
 block/nbd.c                                        |   342 +-
 block/nfs.c                                        |   119 +-
 block/null.c                                       |     8 +-
 block/nvme.c                                       |    72 +-
 block/parallels-ext.c                              |    23 +-
 block/parallels.c                                  |   875 +-
 block/parallels.h                                  |     9 +-
 block/preallocate.c                                |   154 +-
 block/qapi-sysemu.c                                |    43 +-
 block/qapi.c                                       |    99 +-
 block/qcow.c                                       |    63 +-
 block/qcow2-bitmap.c                               |    84 +-
 block/qcow2-cache.c                                |    11 +-
 block/qcow2-cluster.c                              |   162 +-
 block/qcow2-refcount.c                             |   218 +-
 block/qcow2-snapshot.c                             |    25 +-
 block/qcow2-threads.c                              |     3 +-
 block/qcow2.c                                      |   399 +-
 block/qcow2.h                                      |   299 +-
 block/qed-check.c                                  |     5 +-
 block/qed-table.c                                  |     6 +-
 block/qed.c                                        |   132 +-
 block/qed.h                                        |     2 +-
 block/quorum.c                                     |    31 +-
 block/raw-format.c                                 |    68 +-
 block/rbd.c                                        |     9 +-
 block/replication.c                                |   106 +-
 block/snapshot-access.c                            |     7 +-
 block/snapshot.c                                   |    95 +-
 block/ssh.c                                        |    85 +-
 block/stream.c                                     |    92 +-
 block/throttle-groups.c                            |   163 +-
 block/throttle.c                                   |    11 +-
 block/trace-events                                 |    13 +-
 block/vdi.c                                        |    41 +-
 block/vhdx-log.c                                   |    76 +-
 block/vhdx.c                                       |   131 +-
 block/vhdx.h                                       |    23 +-
 block/vmdk.c                                       |   216 +-
 block/vpc.c                                        |    73 +-
 block/vvfat.c                                      |   144 +-
 block/win32-aio.c                                  |     6 +-
 block/write-threshold.c                            |     6 -
 blockdev-nbd.c                                     |    59 +-
 blockdev.c                                         |  1070 +-
 blockjob.c                                         |    66 +-
 bsd-user/aarch64/signal.c                          |   137 +
 bsd-user/aarch64/target.h                          |    20 +
 bsd-user/aarch64/target_arch.h                     |    29 +
 bsd-user/aarch64/target_arch_cpu.c                 |    31 +
 bsd-user/aarch64/target_arch_cpu.h                 |   189 +
 bsd-user/aarch64/target_arch_elf.h                 |   163 +
 bsd-user/aarch64/target_arch_reg.h                 |    56 +
 bsd-user/aarch64/target_arch_signal.h              |    82 +
 bsd-user/aarch64/target_arch_sigtramp.h            |    48 +
 bsd-user/aarch64/target_arch_sysarch.h             |    42 +
 bsd-user/aarch64/target_arch_thread.h              |    61 +
 bsd-user/aarch64/target_arch_vmparam.h             |    74 +
 bsd-user/aarch64/target_syscall.h                  |    51 +
 bsd-user/arm/target_arch.h                         |     1 +
 bsd-user/arm/target_arch_elf.h                     |     1 -
 bsd-user/arm/target_arch_signal.h                  |     2 +
 bsd-user/bsd-file.h                                |     8 +-
 bsd-user/bsd-mem.c                                 |   104 +
 bsd-user/bsd-mem.h                                 |   453 +
 bsd-user/bsd-proc.c                                |   145 +
 bsd-user/bsd-proc.h                                |   382 +-
 bsd-user/elfload.c                                 |    11 +-
 bsd-user/errno_defs.h                              |     2 +-
 bsd-user/freebsd/meson.build                       |     2 +
 bsd-user/freebsd/os-misc.h                         |    98 +
 bsd-user/freebsd/os-proc.c                         |   368 +
 bsd-user/freebsd/os-proc.h                         |   293 +
 bsd-user/freebsd/os-stat.c                         |   262 +
 bsd-user/freebsd/os-stat.h                         |   663 +
 bsd-user/freebsd/os-syscall.c                      |   436 +-
 bsd-user/freebsd/qemu-os.h                         |    50 +
 bsd-user/freebsd/target_os_elf.h                   |     1 +
 bsd-user/freebsd/target_os_siginfo.h               |     2 +-
 bsd-user/freebsd/target_os_stack.h                 |     5 +-
 bsd-user/freebsd/target_os_user.h                  |     2 +-
 bsd-user/i386/target_arch_cpu.h                    |     4 +
 bsd-user/i386/target_arch_elf.h                    |     1 -
 bsd-user/i386/target_arch_signal.h                 |     2 +
 bsd-user/main.c                                    |   214 +-
 bsd-user/meson.build                               |     9 +-
 bsd-user/mmap.c                                    |   103 +-
 bsd-user/netbsd/target_os_elf.h                    |     1 +
 bsd-user/openbsd/target_os_elf.h                   |     1 +
 bsd-user/qemu-bsd.h                                |    58 +
 bsd-user/qemu.h                                    |   153 +-
 bsd-user/signal-common.h                           |     5 +-
 bsd-user/signal.c                                  |    72 +-
 bsd-user/strace.c                                  |     1 +
 bsd-user/syscall_defs.h                            |   312 +-
 bsd-user/trace-events                              |     2 +-
 bsd-user/x86_64/target_arch_elf.h                  |     1 -
 bsd-user/x86_64/target_arch_signal.h               |     2 +
 chardev/char-fe.c                                  |    30 +-
 chardev/char-file.c                                |     8 +
 chardev/char-io.c                                  |    47 +-
 chardev/char-parallel.c                            |     7 +-
 chardev/char-pty.c                                 |    24 +-
 chardev/char-socket.c                              |    65 +-
 chardev/char-stdio.c                               |     4 +
 chardev/char-win-stdio.c                           |     7 +-
 chardev/char.c                                     |    92 +-
 chardev/meson.build                                |    28 +-
 chardev/msmouse.c                                  |     4 +-
 chardev/trace-events                               |    10 +
 chardev/wctablet.c                                 |     2 +-
 configs/devices/aarch64-softmmu/default.mak        |     8 +-
 configs/devices/alpha-softmmu/default.mak          |     5 +-
 configs/devices/arm-softmmu/default.mak            |    86 +-
 configs/devices/avr-softmmu/default.mak            |     5 +-
 configs/devices/cris-softmmu/default.mak           |     5 +-
 configs/devices/hppa-softmmu/default.mak           |     5 +-
 configs/devices/i386-softmmu/default.mak           |    11 +-
 configs/devices/loongarch64-softmmu/default.mak    |     6 +-
 configs/devices/m68k-softmmu/default.mak           |    15 +-
 configs/devices/microblaze-softmmu/default.mak     |     9 +-
 configs/devices/mips-softmmu/common.mak            |    34 +-
 configs/devices/mips64-softmmu/default.mak         |     4 +-
 configs/devices/mips64el-softmmu/default.mak       |    13 +-
 configs/devices/nios2-softmmu/default.mak          |     8 -
 configs/devices/or1k-softmmu/default.mak           |     9 +-
 configs/devices/ppc-softmmu/default.mak            |    29 +-
 configs/devices/ppc64-softmmu/default.mak          |     8 +-
 configs/devices/riscv32-softmmu/default.mak        |    19 +-
 configs/devices/riscv64-softmmu/default.mak        |    21 +-
 configs/devices/rx-softmmu/default.mak             |     3 +-
 configs/devices/s390x-softmmu/default.mak          |     6 +-
 configs/devices/sh4-softmmu/default.mak            |     7 +-
 configs/devices/sparc-softmmu/default.mak          |     7 +-
 configs/devices/sparc64-softmmu/default.mak        |     7 +-
 configs/devices/tricore-softmmu/default.mak        |     7 +-
 configs/devices/xtensa-softmmu/default.mak         |    13 +-
 configs/meson/windows.txt                          |     9 +
 configs/targets/aarch64-bsd-user.mak               |     3 +
 configs/targets/aarch64-linux-user.mak             |     2 +-
 configs/targets/aarch64-softmmu.mak                |     2 +
 configs/targets/alpha-linux-user.mak               |     1 -
 configs/targets/alpha-softmmu.mak                  |     1 -
 configs/targets/arm-softmmu.mak                    |     1 +
 configs/targets/hexagon-linux-user.mak             |     1 +
 configs/targets/hppa-linux-user.mak                |     2 +-
 configs/targets/hppa-softmmu.mak                   |     1 -
 configs/targets/i386-softmmu.mak                   |     2 +-
 configs/targets/loongarch64-linux-user.mak         |     1 +
 configs/targets/loongarch64-softmmu.mak            |     4 +-
 configs/targets/microblaze-softmmu.mak             |     1 +
 configs/targets/microblazeel-softmmu.mak           |     1 +
 configs/targets/mips-linux-user.mak                |     1 -
 configs/targets/mips-softmmu.mak                   |     1 -
 configs/targets/mips64-linux-user.mak              |     1 -
 configs/targets/mips64-softmmu.mak                 |     1 -
 configs/targets/mips64el-linux-user.mak            |     1 -
 configs/targets/mips64el-softmmu.mak               |     2 -
 configs/targets/mipsel-linux-user.mak              |     1 -
 configs/targets/mipsel-softmmu.mak                 |     1 -
 configs/targets/mipsn32-linux-user.mak             |     1 -
 configs/targets/mipsn32el-linux-user.mak           |     1 -
 configs/targets/nios2-linux-user.mak               |     1 -
 configs/targets/nios2-softmmu.mak                  |     3 -
 configs/targets/or1k-softmmu.mak                   |     1 +
 configs/targets/ppc-softmmu.mak                    |     2 +-
 configs/targets/ppc64-softmmu.mak                  |     2 +
 configs/targets/riscv32-softmmu.mak                |     1 +
 configs/targets/riscv64-softmmu.mak                |     2 +
 configs/targets/rx-softmmu.mak                     |     1 +
 configs/targets/s390x-linux-user.mak               |     2 +-
 configs/targets/s390x-softmmu.mak                  |     3 +-
 configs/targets/sh4-linux-user.mak                 |     1 -
 configs/targets/sh4-softmmu.mak                    |     1 -
 configs/targets/sh4eb-linux-user.mak               |     1 -
 configs/targets/sh4eb-softmmu.mak                  |     1 -
 configs/targets/sparc-linux-user.mak               |     1 -
 configs/targets/sparc-softmmu.mak                  |     2 +-
 configs/targets/sparc32plus-linux-user.mak         |     1 -
 configs/targets/sparc64-linux-user.mak             |     1 -
 configs/targets/sparc64-softmmu.mak                |     2 +-
 configs/targets/x86_64-softmmu.mak                 |     2 +-
 configure                                          |  1910 +-
 contrib/elf2dmp/addrspace.c                        |    99 +-
 contrib/elf2dmp/addrspace.h                        |     7 +-
 contrib/elf2dmp/download.c                         |    12 +-
 contrib/elf2dmp/download.h                         |     2 +-
 contrib/elf2dmp/main.c                             |   330 +-
 contrib/elf2dmp/pdb.c                              |   104 +-
 contrib/elf2dmp/pdb.h                              |     4 +-
 contrib/elf2dmp/qemu_elf.c                         |   203 +-
 contrib/elf2dmp/qemu_elf.h                         |     4 +-
 contrib/gitdm/domain-map                           |     4 +
 contrib/ivshmem-client/meson.build                 |     2 +-
 contrib/ivshmem-server/main.c                      |     4 +-
 contrib/ivshmem-server/meson.build                 |     2 +-
 contrib/plugins/Makefile                           |    68 +-
 contrib/plugins/cache.c                            |    45 +-
 contrib/plugins/drcov.c                            |     4 +-
 contrib/plugins/execlog.c                          |   345 +-
 contrib/plugins/hotblocks.c                        |    52 +-
 contrib/plugins/hotpages.c                         |     2 +-
 contrib/plugins/howvec.c                           |    65 +-
 contrib/plugins/hwprofile.c                        |     2 +-
 contrib/plugins/ips.c                              |   164 +
 contrib/plugins/lockstep.c                         |    70 +-
 contrib/plugins/stoptrigger.c                      |   151 +
 contrib/plugins/win32_linker.c                     |    34 +
 contrib/rdmacm-mux/main.c                          |   831 -
 contrib/rdmacm-mux/meson.build                     |     7 -
 contrib/rdmacm-mux/rdmacm-mux.h                    |    61 -
 contrib/systemd/qemu-vmsr-helper.service           |    15 +
 contrib/systemd/qemu-vmsr-helper.socket            |     9 +
 contrib/vhost-user-blk/meson.build                 |     2 +-
 contrib/vhost-user-blk/vhost-user-blk.c            |    15 +-
 contrib/vhost-user-gpu/vhost-user-gpu.c            |    82 +-
 contrib/vhost-user-gpu/virgl.c                     |    56 +-
 contrib/vhost-user-gpu/vugpu.h                     |    28 +-
 contrib/vhost-user-input/main.c                    |    16 +-
 contrib/vhost-user-input/meson.build               |     2 +-
 contrib/vhost-user-scsi/meson.build                |     2 +-
 cpu-common.c                                       |   454 +
 cpu-target.c                                       |   474 +
 cpu.c                                              |   441 -
 cpus-common.c                                      |   442 -
 crypto/aes.c                                       |   774 +-
 crypto/afalg.c                                     |     2 +-
 crypto/block-luks.c                                |    69 +-
 crypto/block-qcow.c                                |     8 +-
 crypto/block.c                                     |   118 +-
 crypto/blockpriv.h                                 |    15 +-
 crypto/cipher-gcrypt.c.inc                         |   119 +-
 crypto/cipher-gnutls.c.inc                         |     4 +-
 crypto/cipher-nettle.c.inc                         |    49 +
 crypto/cipher.c                                    |     6 +
 crypto/clmul.c                                     |   111 +
 crypto/der.c                                       |     2 +-
 crypto/der.h                                       |     6 +-
 crypto/hmacpriv.h                                  |    13 +-
 crypto/init.c                                      |    15 +-
 crypto/meson.build                                 |    12 +-
 crypto/rsakey-builtin.c.inc                        |     8 +-
 crypto/sm4.c                                       |    10 +
 crypto/tls-cipher-suites.c                         |     1 -
 crypto/tlscredspsk.c                               |     1 +
 crypto/tlssession.c                                |   124 +-
 disas.c                                            |   398 -
 disas/cris.c                                       |    26 +-
 disas/disas-common.c                               |   104 +
 disas/disas-host.c                                 |   129 +
 disas/disas-internal.h                             |    25 +
 disas/disas-mon.c                                  |    81 +
 disas/disas-target.c                               |    99 +
 disas/hppa.c                                       |    12 +-
 disas/m68k.c                                       |    10 +-
 disas/meson.build                                  |    17 +-
 disas/microblaze.c                                 |   544 +-
 disas/nanomips.c                                   |   194 +-
 disas/nios2.c                                      |  3514 ----
 disas/objdump.c                                    |    37 +
 disas/riscv-xthead.c                               |   708 +
 disas/riscv-xthead.h                               |    28 +
 disas/riscv-xventana.c                             |    42 +
 disas/riscv-xventana.h                             |    18 +
 disas/riscv.c                                      |  2561 ++-
 disas/riscv.h                                      |   305 +
 docs/COLO-FT.txt                                   |     1 +
 docs/about/build-platforms.rst                     |     6 +-
 docs/about/deprecated.rst                          |   323 +-
 docs/about/emulation.rst                           |   616 +-
 docs/about/index.rst                               |     2 +-
 docs/about/license.rst                             |     2 +-
 docs/about/removed-features.rst                    |   281 +-
 docs/colo-proxy.txt                                |     6 +-
 docs/conf.py                                       |    28 +-
 docs/config/q35-emulated.cfg                       |     4 +
 docs/config/q35-virtio-graphical.cfg               |     4 +
 docs/devel/acpi-bits.rst                           |    63 +-
 docs/devel/atomics.rst                             |    40 +-
 docs/devel/build-system.rst                        |   408 +-
 docs/devel/ci-jobs.rst.inc                         |    27 +-
 docs/devel/ci-runners.rst.inc                      |    13 +-
 docs/devel/clocks.rst                              |     6 +-
 docs/devel/crypto.rst                              |    10 +
 docs/devel/decodetree.rst                          |    33 +-
 docs/devel/docs.rst                                |    68 +
 docs/devel/index-api.rst                           |     4 +
 docs/devel/index-build.rst                         |     1 +
 docs/devel/index-internals.rst                     |     6 +-
 docs/devel/index-process.rst                       |     2 +
 docs/devel/index-tcg.rst                           |     2 +
 docs/devel/index.rst                               |    24 +-
 docs/devel/kconfig.rst                             |    34 +-
 docs/devel/loads-stores.rst                        |    78 +-
 docs/devel/luks-detached-header.rst                |   182 +
 docs/devel/migration.rst                           |   879 -
 docs/devel/migration/CPR.rst                       |   147 +
 docs/devel/migration/best-practices.rst            |    48 +
 docs/devel/migration/compatibility.rst             |   517 +
 docs/devel/migration/dirty-limit.rst               |    71 +
 docs/devel/migration/features.rst                  |    16 +
 docs/devel/migration/index.rst                     |    13 +
 docs/devel/migration/main.rst                      |   596 +
 docs/devel/migration/mapped-ram.rst                |   142 +
 docs/devel/migration/postcopy.rst                  |   314 +
 docs/devel/migration/qpl-compression.rst           |   260 +
 docs/devel/migration/uadk-compression.rst          |   144 +
 docs/devel/migration/vfio.rst                      |   208 +
 docs/devel/migration/virtio.rst                    |   115 +
 docs/devel/multi-process.rst                       |     5 +-
 docs/devel/multi-thread-tcg.rst                    |    21 +-
 docs/devel/multiple-iothreads.txt                  |    68 +-
 docs/devel/nested-papr.txt                         |   119 +
 docs/devel/pci.rst                                 |     8 +
 docs/devel/qapi-code-gen.rst                       |   233 +-
 docs/devel/qdev-api.rst                            |     7 +
 docs/devel/qom-api.rst                             |     9 +
 docs/devel/qom.rst                                 |   101 +-
 docs/devel/qtest.rst                               |     2 +-
 docs/devel/replay.rst                              |     2 +-
 docs/devel/reset.rst                               |    88 +-
 docs/devel/s390-cpu-topology.rst                   |   170 +
 docs/devel/style.rst                               |   123 +-
 docs/devel/submitting-a-patch.rst                  |     2 +-
 docs/devel/tcg-icount.rst                          |     6 -
 docs/devel/tcg-ops.rst                             |    28 +-
 docs/devel/tcg-plugins.rst                         |   532 +-
 docs/devel/tcg.rst                                 |     2 +
 docs/devel/testing.rst                             |   132 +-
 docs/devel/tracing.rst                             |     3 +-
 docs/devel/vfio-iommufd.rst                        |   166 +
 docs/devel/vfio-migration.rst                      |   162 -
 docs/devel/virtio-migration.txt                    |   108 -
 docs/devel/writing-monitor-commands.rst            |   494 +-
 docs/devel/zoned-storage.rst                       |    62 +
 docs/interop/bitmaps.rst                           |     6 +-
 docs/interop/firmware.json                         |   441 +-
 docs/interop/index.rst                             |     4 +
 docs/interop/live-block-operations.rst             |     4 +-
 docs/interop/nbd.rst                               |    89 +
 docs/interop/nbd.txt                               |    71 -
 docs/interop/parallels.rst                         |   240 +
 docs/interop/parallels.txt                         |   232 -
 docs/interop/prl-xml.rst                           |   192 +
 docs/interop/prl-xml.txt                           |   158 -
 docs/interop/qcow2.txt                             |    11 +-
 docs/interop/qemu-ga.rst                           |    29 +-
 docs/interop/qmp-intro.txt                         |    88 -
 docs/interop/qmp-spec.rst                          |   439 +
 docs/interop/qmp-spec.txt                          |   406 -
 docs/interop/vhost-user-gpu.rst                    |    52 +-
 docs/interop/vhost-user.rst                        |   439 +-
 docs/meson.build                                   |    19 +-
 docs/multi-thread-compression.txt                  |    12 +-
 docs/pci_expander_bridge.txt                       |     2 +-
 docs/pcie_sriov.txt                                |     9 +-
 docs/pvrdma.txt                                    |   345 -
 docs/rdma.txt                                      |     2 +-
 docs/requirements.txt                              |     5 +
 docs/specs/acpi_hw_reduced_hotplug.rst             |     3 +-
 docs/specs/edu.rst                                 |   135 +
 docs/specs/edu.txt                                 |   115 -
 docs/specs/fsi.rst                                 |   122 +
 docs/specs/index.rst                               |    15 +
 docs/specs/ivshmem-spec.rst                        |   241 +
 docs/specs/ivshmem-spec.txt                        |   258 -
 docs/specs/pci-ids.rst                             |   104 +
 docs/specs/pci-ids.txt                             |    70 -
 docs/specs/pci-serial.rst                          |    37 +
 docs/specs/pci-serial.txt                          |    34 -
 docs/specs/pci-testdev.rst                         |    39 +
 docs/specs/pci-testdev.txt                         |    31 -
 docs/specs/pvpanic.rst                             |    69 +
 docs/specs/pvpanic.txt                             |    54 -
 docs/specs/rapl-msr.rst                            |   155 +
 docs/specs/rocker.rst                              |  1015 +
 docs/specs/rocker.txt                              |  1014 -
 docs/specs/spdm.rst                                |   134 +
 docs/specs/standard-vga.rst                        |    94 +
 docs/specs/standard-vga.txt                        |    81 -
 docs/specs/tpm.rst                                 |    29 +-
 docs/specs/virt-ctlr.rst                           |    24 +
 docs/specs/virt-ctlr.txt                           |    26 -
 docs/specs/vmcoreinfo.rst                          |    54 +
 docs/specs/vmcoreinfo.txt                          |    53 -
 docs/specs/vmgenid.rst                             |   246 +
 docs/specs/vmgenid.txt                             |   245 -
 docs/specs/vmw_pvscsi-spec.rst                     |   115 +
 docs/specs/vmw_pvscsi-spec.txt                     |    92 -
 docs/sphinx-static/theme_overrides.css             |    49 +
 docs/sphinx/dbusdomain.py                          |     4 +
 docs/sphinx/depfile.py                             |     2 +-
 docs/sphinx/fakedbusdoc.py                         |     5 +
 docs/sphinx/hxtool.py                              |    39 +-
 docs/sphinx/kerneldoc.py                           |    38 +-
 docs/sphinx/kernellog.py                           |    28 -
 docs/sphinx/qapidoc.py                             |   307 +-
 docs/sphinx/qmp_lexer.py                           |     5 +
 docs/system/arm/aspeed.rst                         |    87 +-
 docs/system/arm/b-l475e-iot01a.rst                 |    46 +
 docs/system/arm/bananapi_m2u.rst                   |   140 +
 docs/system/arm/cpu-features.rst                   |    42 +-
 docs/system/arm/cubieboard.rst                     |     1 +
 docs/system/arm/emulation.rst                      |    64 +-
 docs/system/arm/mps2.rst                           |    37 +-
 docs/system/arm/orangepi.rst                       |     1 +
 docs/system/arm/palm.rst                           |     2 +-
 docs/system/arm/raspi.rst                          |    16 +-
 docs/system/arm/sbsa.rst                           |    90 +-
 docs/system/arm/stm32.rst                          |     6 +-
 docs/system/arm/vexpress.rst                       |     3 +
 docs/system/arm/virt.rst                           |    30 +-
 docs/system/arm/xenpvh.rst                         |    39 +
 docs/system/arm/xlnx-versal-virt.rst               |    35 +-
 docs/system/arm/xlnx-zynq.rst                      |    47 +
 docs/system/arm/xscale.rst                         |     2 +-
 docs/system/cpu-models-x86-abi.csv                 |    20 +-
 docs/system/cpu-models-x86.rst.inc                 |     2 +-
 docs/system/device-emulation.rst                   |     5 +
 docs/system/device-url-syntax.rst.inc              |     4 +-
 docs/system/devices/can.rst                        |     6 +-
 docs/system/devices/canokey.rst                    |     2 +-
 docs/system/devices/cxl.rst                        |    82 +-
 docs/system/devices/igb.rst                        |    16 +-
 docs/system/devices/ivshmem.rst                    |     4 +-
 docs/system/devices/keyboard.rst                   |   129 +
 docs/system/devices/net.rst                        |     2 +-
 docs/system/devices/nvme.rst                       |    56 +-
 docs/system/devices/usb-u2f.rst                    |    93 +
 docs/system/devices/usb.rst                        |     6 +-
 docs/system/devices/vhost-user-input.rst           |    45 +
 docs/system/devices/vhost-user-rng.rst             |     2 +
 docs/system/devices/vhost-user.rst                 |    81 +-
 docs/system/devices/virtio-gpu.rst                 |   112 +
 docs/system/devices/virtio-snd.rst                 |    49 +
 docs/system/gdb.rst                                |    48 +
 docs/system/guest-loader.rst                       |     6 +-
 docs/system/i386/amd-memory-encryption.rst         |    76 +-
 docs/system/i386/sgx.rst                           |     2 +-
 docs/system/i386/xen.rst                           |   108 +-
 docs/system/index.rst                              |     3 +-
 docs/system/introduction.rst                       |     7 +-
 docs/system/invocation.rst                         |     5 +
 docs/system/keys.rst                               |     2 +-
 docs/system/keys.rst.inc                           |    13 +-
 docs/system/linuxboot.rst                          |     2 +-
 docs/system/loongarch/virt.rst                     |     2 +-
 docs/system/ppc/amigang.rst                        |   161 +
 docs/system/ppc/powernv.rst                        |     5 -
 docs/system/qemu-block-drivers.rst.inc             |     7 +-
 docs/system/qemu-manpage.rst                       |     5 +
 docs/system/replay.rst                             |     4 +-
 docs/system/riscv/sifive_u.rst                     |    33 +-
 docs/system/riscv/virt.rst                         |    39 +-
 docs/system/s390x/cpu-topology.rst                 |   246 +
 docs/system/target-arm.rst                         |     8 +-
 docs/system/target-i386-desc.rst.inc               |    11 +-
 docs/system/target-i386.rst                        |     4 -
 docs/system/target-ppc.rst                         |     1 +
 docs/system/target-riscv.rst                       |    24 +-
 docs/system/target-s390x.rst                       |     1 +
 docs/system/target-sparc.rst                       |    14 +-
 docs/system/vm-templating.rst                      |   125 +
 docs/tools/index.rst                               |     1 +
 docs/tools/qemu-img.rst                            |    27 +-
 docs/tools/qemu-nbd.rst                            |     4 +-
 docs/tools/qemu-vmsr-helper.rst                    |    89 +
 docs/tools/virtfs-proxy-helper.rst                 |     3 +
 docs/u2f.txt                                       |   110 -
 docs/user/main.rst                                 |    19 +-
 dtc                                                |     1 -
 dump/dump-hmp-cmds.c                               |    19 +-
 dump/dump.c                                        |   195 +-
 dump/meson.build                                   |     4 +-
 dump/win_dump.c                                    |     7 +-
 ebpf/ebpf.c                                        |    69 +
 ebpf/ebpf.h                                        |    29 +
 ebpf/ebpf_rss-stub.c                               |     6 +
 ebpf/ebpf_rss.c                                    |   151 +-
 ebpf/ebpf_rss.h                                    |    10 +
 ebpf/meson.build                                   |     2 +-
 ebpf/rss.bpf.skeleton.h                            |  1509 +-
 ebpf/trace-events                                  |     2 +-
 fpu/softfloat-parts.c.inc                          |    85 +-
 fpu/softfloat-specialize.c.inc                     |    33 +-
 fpu/softfloat.c                                    |   120 +-
 fsdev/meson.build                                  |     6 +-
 fsdev/qemu-fsdev-throttle.c                        |    18 +-
 fsdev/qemu-fsdev-throttle.h                        |     4 +-
 fsdev/qemu-fsdev.c                                 |     8 +
 fsdev/virtfs-proxy-helper.c                        |     9 +
 gdb-xml/aarch64-mte.xml                            |    11 +
 gdb-xml/aarch64-pauth.xml                          |     2 +-
 gdb-xml/arm-neon.xml                               |     2 +-
 gdb-xml/hexagon-core.xml                           |    88 +
 gdb-xml/hexagon-hvx.xml                            |    96 +
 gdb-xml/loongarch-base32.xml                       |    45 +
 gdb-xml/loongarch-fpu.xml                          |     9 +-
 gdb-xml/loongarch-lasx.xml                         |    60 +
 gdb-xml/loongarch-lsx.xml                          |    59 +
 gdb-xml/s390-virt-kvm.xml                          |    14 +
 gdb-xml/s390-virt.xml                              |     4 -
 gdbstub/gdbstub.c                                  |   889 +-
 gdbstub/internals.h                                |    79 +-
 gdbstub/meson.build                                |    26 +-
 gdbstub/softmmu.c                                  |   651 -
 gdbstub/syscalls.c                                 |     7 +-
 gdbstub/system.c                                   |   665 +
 gdbstub/trace-events                               |     3 +-
 gdbstub/user-target.c                              |   153 +-
 gdbstub/user.c                                     |   420 +-
 hmp-commands-info.hx                               |    48 +-
 hmp-commands.hx                                    |    65 +-
 host/include/aarch64/host/atomic128-cas.h          |    45 +
 host/include/aarch64/host/atomic128-ldst.h         |    79 +
 host/include/aarch64/host/bufferiszero.c.inc       |    76 +
 host/include/aarch64/host/cpuinfo.h                |    25 +
 host/include/aarch64/host/crypto/aes-round.h       |   205 +
 host/include/aarch64/host/crypto/clmul.h           |    41 +
 .../aarch64/host/load-extract-al16-al8.h.inc       |    40 +
 host/include/aarch64/host/store-insert-al16.h.inc  |    47 +
 host/include/generic/host/atomic128-cas.h          |    47 +
 host/include/generic/host/atomic128-ldst.h         |    81 +
 host/include/generic/host/bufferiszero.c.inc       |    10 +
 host/include/generic/host/cpuinfo.h                |     4 +
 host/include/generic/host/crypto/aes-round.h       |    33 +
 host/include/generic/host/crypto/clmul.h           |    15 +
 .../generic/host/load-extract-al16-al8.h.inc       |    45 +
 host/include/generic/host/store-insert-al16.h.inc  |    50 +
 host/include/i386/host/bufferiszero.c.inc          |   125 +
 host/include/i386/host/cpuinfo.h                   |    39 +
 host/include/i386/host/crypto/aes-round.h          |   152 +
 host/include/i386/host/crypto/clmul.h              |    29 +
 host/include/loongarch64/host/atomic128-ldst.h     |    52 +
 host/include/loongarch64/host/bufferiszero.c.inc   |   143 +
 host/include/loongarch64/host/cpuinfo.h            |    22 +
 .../loongarch64/host/load-extract-al16-al8.h.inc   |    39 +
 .../loongarch64/host/store-insert-al16.h.inc       |    12 +
 host/include/ppc/host/cpuinfo.h                    |    30 +
 host/include/ppc/host/crypto/aes-round.h           |   182 +
 host/include/ppc64/host/cpuinfo.h                  |     1 +
 host/include/ppc64/host/crypto/aes-round.h         |     1 +
 host/include/riscv/host/cpuinfo.h                  |    23 +
 host/include/x86_64/host/atomic128-ldst.h          |    75 +
 host/include/x86_64/host/bufferiszero.c.inc        |     1 +
 host/include/x86_64/host/cpuinfo.h                 |     1 +
 host/include/x86_64/host/crypto/aes-round.h        |     1 +
 host/include/x86_64/host/crypto/clmul.h            |     1 +
 .../x86_64/host/load-extract-al16-al8.h.inc        |    50 +
 hw/9pfs/9p-local.c                                 |     8 +-
 hw/9pfs/9p-proxy.c                                 |     7 +-
 hw/9pfs/9p-proxy.h                                 |     5 +
 hw/9pfs/9p-synth.c                                 |     2 +-
 hw/9pfs/9p-util.h                                  |     2 +-
 hw/9pfs/9p.c                                       |    19 +-
 hw/9pfs/9p.h                                       |     6 +-
 hw/9pfs/codir.c                                    |     6 +-
 hw/9pfs/cofile.c                                   |     4 +-
 hw/9pfs/coth.c                                     |     3 +-
 hw/9pfs/meson.build                                |     9 +-
 hw/9pfs/virtio-9p-device.c                         |     2 +-
 hw/9pfs/xen-9p-backend.c                           |    13 +-
 hw/Kconfig                                         |     5 +-
 hw/acpi/acpi-cpu-hotplug-stub.c                    |     6 +
 hw/acpi/acpi-x86-stub.c                            |     6 -
 hw/acpi/acpi_generic_initiator.c                   |   148 +
 hw/acpi/aml-build.c                                |    59 +-
 hw/acpi/core.c                                     |    61 +-
 hw/acpi/cpu.c                                      |    29 +-
 hw/acpi/cpu_hotplug.c                              |    49 +-
 hw/acpi/cxl.c                                      |    80 +-
 hw/acpi/erst.c                                     |    12 +-
 hw/acpi/generic_event_device.c                     |    62 +-
 hw/acpi/hmat.c                                     |    18 +-
 hw/acpi/hmat.h                                     |     3 +-
 hw/acpi/ich9.c                                     |    58 +-
 hw/acpi/ich9_tco.c                                 |     2 +-
 hw/acpi/memory_hotplug.c                           |    13 +-
 hw/acpi/meson.build                                |    14 +-
 hw/acpi/nvdimm.c                                   |    13 +-
 hw/acpi/pcihp.c                                    |     7 +-
 hw/acpi/piix4.c                                    |    17 +-
 hw/acpi/trace-events                               |    10 +-
 hw/acpi/vmgenid.c                                  |     2 +-
 hw/adc/aspeed_adc.c                                |    18 +-
 hw/adc/max111x.c                                   |     2 +-
 hw/adc/meson.build                                 |    10 +-
 hw/adc/npcm7xx_adc.c                               |     4 +-
 hw/adc/stm32f2xx_adc.c                             |     2 +-
 hw/adc/zynq-xadc.c                                 |     2 +-
 hw/alpha/Kconfig                                   |     2 +
 hw/alpha/dp264.c                                   |     6 +-
 hw/alpha/typhoon.c                                 |     6 +-
 hw/arm/Kconfig                                     |   184 +-
 hw/arm/allwinner-a10.c                             |    67 +-
 hw/arm/allwinner-h3.c                              |    16 +-
 hw/arm/allwinner-r40.c                             |   565 +
 hw/arm/armsse.c                                    |    40 +-
 hw/arm/armv7m.c                                    |    38 +-
 hw/arm/aspeed.c                                    |   390 +-
 hw/arm/aspeed_ast10x0.c                            |    64 +-
 hw/arm/aspeed_ast2400.c                            |   580 +
 hw/arm/aspeed_ast2600.c                            |   127 +-
 hw/arm/aspeed_ast27x0.c                            |   665 +
 hw/arm/aspeed_eeprom.c                             |    46 +-
 hw/arm/aspeed_eeprom.h                             |     6 +-
 hw/arm/aspeed_soc.c                                |   683 -
 hw/arm/aspeed_soc_common.c                         |   171 +
 hw/arm/b-l475e-iot01a.c                            |   137 +
 hw/arm/bananapi_m2u.c                              |   146 +
 hw/arm/bcm2835_peripherals.c                       |   294 +-
 hw/arm/bcm2836.c                                   |   143 +-
 hw/arm/bcm2838.c                                   |   263 +
 hw/arm/bcm2838_peripherals.c                       |   224 +
 hw/arm/boot.c                                      |    99 +-
 hw/arm/collie.c                                    |     1 -
 hw/arm/cubieboard.c                                |    13 +-
 hw/arm/exynos4210.c                                |    21 +-
 hw/arm/exynos4_boards.c                            |    21 +-
 hw/arm/fby35.c                                     |    48 +-
 hw/arm/fsl-imx25.c                                 |    25 +-
 hw/arm/fsl-imx31.c                                 |    20 +-
 hw/arm/fsl-imx6.c                                  |    61 +-
 hw/arm/fsl-imx6ul.c                                |   227 +-
 hw/arm/fsl-imx7.c                                  |   224 +-
 hw/arm/gumstix.c                                   |     9 +-
 hw/arm/highbank.c                                  |    28 +-
 hw/arm/imx25_pdk.c                                 |     1 +
 hw/arm/integratorcp.c                              |    38 +-
 hw/arm/kzm.c                                       |     5 +-
 hw/arm/mainstone.c                                 |     5 +-
 hw/arm/mcimx6ul-evk.c                              |     3 +
 hw/arm/mcimx7d-sabre.c                             |     3 +
 hw/arm/meson.build                                 |    44 +-
 hw/arm/mps2-tz.c                                   |    81 +-
 hw/arm/mps2.c                                      |    40 +-
 hw/arm/mps3r.c                                     |   640 +
 hw/arm/msf2-soc.c                                  |     9 +-
 hw/arm/msf2-som.c                                  |    17 +-
 hw/arm/musca.c                                     |    13 +-
 hw/arm/musicpal.c                                  |   161 +-
 hw/arm/netduino2.c                                 |     8 +-
 hw/arm/netduinoplus2.c                             |     8 +-
 hw/arm/npcm7xx.c                                   |    61 +-
 hw/arm/npcm7xx_boards.c                            |    13 +-
 hw/arm/nrf51_soc.c                                 |     7 +-
 hw/arm/nseries.c                                   |    10 +-
 hw/arm/olimex-stm32-h405.c                         |     9 +-
 hw/arm/omap1.c                                     |     3 +-
 hw/arm/omap2.c                                     |    11 +-
 hw/arm/omap_sx1.c                                  |     1 -
 hw/arm/orangepi.c                                  |    15 +-
 hw/arm/palm.c                                      |     4 +-
 hw/arm/pxa2xx.c                                    |    35 +-
 hw/arm/pxa2xx_gpio.c                               |    10 +-
 hw/arm/pxa2xx_pic.c                                |    40 +-
 hw/arm/raspi.c                                     |   130 +-
 hw/arm/raspi4b.c                                   |   136 +
 hw/arm/realview.c                                  |    47 +-
 hw/arm/sabrelite.c                                 |     1 +
 hw/arm/sbsa-ref.c                                  |   190 +-
 hw/arm/smmu-common.c                               |   510 +-
 hw/arm/smmu-internal.h                             |    37 +
 hw/arm/smmuv3-internal.h                           |   115 +-
 hw/arm/smmuv3.c                                    |   720 +-
 hw/arm/spitz.c                                     |    27 +-
 hw/arm/stellaris.c                                 |   134 +-
 hw/arm/stm32f100_soc.c                             |    10 +-
 hw/arm/stm32f205_soc.c                             |    10 +-
 hw/arm/stm32f405_soc.c                             |     9 +-
 hw/arm/stm32l4x5_soc.c                             |   492 +
 hw/arm/stm32vldiscovery.c                          |     8 +-
 hw/arm/strongarm.c                                 |    96 +-
 hw/arm/tosa.c                                      |     1 +
 hw/arm/trace-events                                |    44 +-
 hw/arm/versatilepb.c                               |    35 +-
 hw/arm/vexpress.c                                  |   105 +-
 hw/arm/virt-acpi-build.c                           |   215 +-
 hw/arm/virt.c                                      |   490 +-
 hw/arm/xen_arm.c                                   |   267 +
 hw/arm/xilinx_zynq.c                               |   106 +-
 hw/arm/xlnx-versal-virt.c                          |   107 +-
 hw/arm/xlnx-versal.c                               |   228 +-
 hw/arm/xlnx-zcu102.c                               |     9 +
 hw/arm/xlnx-zynqmp.c                               |    10 +-
 hw/arm/z2.c                                        |    48 +-
 hw/audio/Kconfig                                   |     8 +
 hw/audio/ac97.c                                    |    10 +-
 hw/audio/adlib.c                                   |     6 +-
 hw/audio/asc.c                                     |   727 +
 hw/audio/cs4231.c                                  |     2 +-
 hw/audio/cs4231a.c                                 |     8 +-
 hw/audio/es1370.c                                  |   307 +-
 hw/audio/fmopl.c                                   |     8 +-
 hw/audio/fmopl.h                                   |     2 +-
 hw/audio/gus.c                                     |     8 +-
 hw/audio/gusemu_hal.c                              |     4 +-
 hw/audio/hda-codec.c                               |    74 +-
 hw/audio/intel-hda-defs.h                          |     4 +-
 hw/audio/intel-hda.c                               |     8 +-
 hw/audio/intel-hda.h                               |     2 +-
 hw/audio/lm4549.c                                  |    13 +-
 hw/audio/lm4549.h                                  |     3 +-
 hw/audio/marvell_88w8618.c                         |     2 +-
 hw/audio/meson.build                               |    31 +-
 hw/audio/pcspk.c                                   |     6 +-
 hw/audio/pl041.c                                   |    10 +-
 hw/audio/sb16.c                                    |    18 +-
 hw/audio/soundhw.c                                 |     6 +-
 hw/audio/trace-events                              |    41 +
 hw/audio/via-ac97.c                                |    14 +-
 hw/audio/virtio-snd-pci.c                          |    95 +
 hw/audio/virtio-snd.c                              |  1418 ++
 hw/audio/wm8750.c                                  |     7 +-
 hw/avr/Kconfig                                     |     3 +
 hw/avr/atmega.c                                    |     4 +
 hw/block/block.c                                   |    27 +-
 hw/block/dataplane/meson.build                     |     1 -
 hw/block/dataplane/trace-events                    |     5 -
 hw/block/dataplane/trace.h                         |     1 -
 hw/block/dataplane/virtio-blk.c                    |   359 -
 hw/block/dataplane/virtio-blk.h                    |    31 -
 hw/block/dataplane/xen-block.c                     |    73 +-
 hw/block/dataplane/xen-block.h                     |     2 +
 hw/block/ecc.c                                     |     2 +-
 hw/block/fdc-internal.h                            |     4 -
 hw/block/fdc-isa.c                                 |    22 +-
 hw/block/fdc-sysbus.c                              |     8 +-
 hw/block/fdc.c                                     |    20 +-
 hw/block/hd-geometry.c                             |     4 +-
 hw/block/m25p80.c                                  |    44 +-
 hw/block/m25p80_sfdp.c                             |    36 +
 hw/block/m25p80_sfdp.h                             |     1 +
 hw/block/meson.build                               |    28 +-
 hw/block/nand.c                                    |    57 +-
 hw/block/onenand.c                                 |     2 +-
 hw/block/pflash_cfi01.c                            |   186 +-
 hw/block/pflash_cfi02.c                            |     4 +-
 hw/block/swim.c                                    |   267 +-
 hw/block/tc58128.c                                 |     3 +
 hw/block/trace-events                              |    22 +-
 hw/block/vhost-user-blk.c                          |    36 +-
 hw/block/virtio-blk-common.c                       |     2 +
 hw/block/virtio-blk.c                              |  1195 +-
 hw/block/xen-block.c                               |   176 +-
 hw/char/Kconfig                                    |     3 +
 hw/char/bcm2835_aux.c                              |     4 +-
 hw/char/cadence_uart.c                             |    14 +-
 hw/char/cmsdk-apb-uart.c                           |     8 +-
 hw/char/digic-uart.c                               |     2 +-
 hw/char/escc.c                                     |    89 +-
 hw/char/exynos4210_uart.c                          |     4 +-
 hw/char/goldfish_tty.c                             |    14 +-
 hw/char/grlib_apbuart.c                            |     6 +-
 hw/char/ibex_uart.c                                |    10 +-
 hw/char/imx_serial.c                               |   109 +-
 hw/char/ipoctal232.c                               |     6 +-
 hw/char/mcf_uart.c                                 |    13 +-
 hw/char/mchp_pfsoc_mmuart.c                        |     2 +-
 hw/char/meson.build                                |    72 +-
 hw/char/nrf51_uart.c                               |     6 +-
 hw/char/omap_uart.c                                |    58 +-
 hw/char/parallel-isa.c                             |    17 +-
 hw/char/parallel.c                                 |    37 +-
 hw/char/pl011.c                                    |   185 +-
 hw/char/renesas_sci.c                              |     2 +-
 hw/char/riscv_htif.c                               |    61 +-
 hw/char/sclpconsole-lm.c                           |     2 +-
 hw/char/sclpconsole.c                              |     2 +-
 hw/char/serial-isa.c                               |    16 +-
 hw/char/serial-pci-multi.c                         |     4 +-
 hw/char/serial-pci.c                               |     4 +-
 hw/char/serial.c                                   |    24 +-
 hw/char/sifive_uart.c                              |     4 +-
 hw/char/spapr_vty.c                                |     2 +-
 hw/char/stm32f2xx_usart.c                          |    29 +-
 hw/char/stm32l4x5_usart.c                          |   638 +
 hw/char/trace-events                               |    24 +-
 hw/char/virtio-console.c                           |     2 +-
 hw/char/virtio-serial-bus.c                        |     4 +-
 hw/char/xen_console.c                              |   573 +-
 hw/core/Kconfig                                    |     9 +-
 hw/core/bus.c                                      |    67 -
 hw/core/clock-vmstate.c                            |     6 +-
 hw/core/clock.c                                    |     9 +-
 hw/core/cpu-common.c                               |    99 +-
 hw/core/cpu-sysemu.c                               |     8 +-
 hw/core/generic-loader.c                           |     6 +-
 hw/core/hotplug-stubs.c                            |    34 -
 hw/core/loader-fit.c                               |     4 +-
 hw/core/loader.c                                   |    64 +-
 hw/core/machine-hmp-cmds.c                         |    25 +
 hw/core/machine-qmp-cmds.c                         |   105 +-
 hw/core/machine-smp.c                              |   105 +-
 hw/core/machine.c                                  |   298 +-
 hw/core/meson.build                                |    44 +-
 hw/core/numa.c                                     |    16 +-
 hw/core/or-irq.c                                   |     6 +-
 hw/core/ptimer.c                                   |     6 +-
 hw/core/qdev-properties-system.c                   |   158 +-
 hw/core/qdev-properties.c                          |   270 +-
 hw/core/qdev.c                                     |    16 +-
 hw/core/reset.c                                    |   163 +-
 hw/core/resetcontainer.c                           |    77 +
 hw/core/resettable.c                               |     8 +-
 hw/core/sysbus.c                                   |    11 -
 hw/core/trace-events                               |     3 +
 hw/core/vm-change-state-handler.c                  |    14 +-
 hw/cpu/Kconfig                                     |    15 +-
 hw/cpu/a15mpcore.c                                 |     3 +-
 hw/cpu/a9mpcore.c                                  |     2 +-
 hw/cpu/cluster.c                                   |     5 +-
 hw/cpu/core.c                                      |     7 +-
 hw/cpu/meson.build                                 |     9 +-
 hw/cris/Kconfig                                    |     2 +
 hw/cris/axis_dev88.c                               |     9 +-
 hw/cxl/cxl-cdat.c                                  |    98 +-
 hw/cxl/cxl-component-utils.c                       |   282 +-
 hw/cxl/cxl-device-utils.c                          |   234 +-
 hw/cxl/cxl-events.c                                |   262 +
 hw/cxl/cxl-host.c                                  |    87 +-
 hw/cxl/cxl-mailbox-utils.c                         |  3029 ++-
 hw/cxl/meson.build                                 |     6 +-
 hw/cxl/switch-mailbox-cci.c                        |   111 +
 hw/display/Kconfig                                 |    13 +-
 hw/display/artist.c                                |     2 +-
 hw/display/ati.c                                   |    78 +-
 hw/display/ati_2d.c                                |    81 +-
 hw/display/ati_dbg.c                               |     2 +
 hw/display/ati_int.h                               |     2 +
 hw/display/ati_regs.h                              |     2 +
 hw/display/bcm2835_fb.c                            |     4 +-
 hw/display/bochs-display.c                         |     4 +-
 hw/display/cg3.c                                   |     2 +-
 hw/display/cirrus_vga.c                            |    32 +-
 hw/display/dm163.c                                 |   349 +
 hw/display/dpcd.c                                  |     2 +-
 hw/display/exynos4210_fimd.c                       |    23 +-
 hw/display/g364fb.c                                |     4 +-
 hw/display/i2c-ddc.c                               |     2 +-
 hw/display/jazz_led.c                              |     2 +-
 hw/display/macfb.c                                 |    26 +-
 hw/display/meson.build                             |   132 +-
 hw/display/pl110.c                                 |    22 +-
 hw/display/pxa2xx_lcd.c                            |     4 +-
 hw/display/qxl-render.c                            |     6 +-
 hw/display/qxl.c                                   |    26 +-
 hw/display/qxl.h                                   |     2 +-
 hw/display/ramfb-standalone.c                      |    27 +
 hw/display/ramfb-stubs.c                           |    15 +
 hw/display/ramfb.c                                 |    20 +
 hw/display/sii9022.c                               |     2 +-
 hw/display/sm501.c                                 |    51 +-
 hw/display/ssd0303.c                               |     4 +-
 hw/display/ssd0323.c                               |     4 +-
 hw/display/tcx.c                                   |     2 +-
 hw/display/trace-events                            |    14 +
 hw/display/vga-helpers.h                           |   121 +-
 hw/display/vga-isa.c                               |     2 +-
 hw/display/vga-pci.c                               |     4 +-
 hw/display/vga.c                                   |   656 +-
 hw/display/vga_int.h                               |    19 +-
 hw/display/vga_regs.h                              |     4 +
 hw/display/vhost-user-gpu.c                        |    92 +-
 hw/display/virtio-dmabuf.c                         |   146 +
 hw/display/virtio-gpu-base.c                       |    37 +-
 hw/display/virtio-gpu-gl.c                         |     9 +-
 hw/display/virtio-gpu-pci-rutabaga.c               |    48 +
 hw/display/virtio-gpu-pci.c                        |    14 +
 hw/display/virtio-gpu-rutabaga.c                   |  1143 ++
 hw/display/virtio-gpu-udmabuf.c                    |    30 +-
 hw/display/virtio-gpu-virgl.c                      |    45 +-
 hw/display/virtio-gpu.c                            |   474 +-
 hw/display/virtio-vga-rutabaga.c                   |    50 +
 hw/display/virtio-vga.c                            |    39 +-
 hw/display/vmware_vga.c                            |    18 +-
 hw/display/xenfb.c                                 |    26 +-
 hw/display/xlnx_dp.c                               |    23 +-
 hw/dma/bcm2835_dma.c                               |     4 +-
 hw/dma/etraxfs_dma.c                               |     1 +
 hw/dma/i82374.c                                    |     4 +-
 hw/dma/i8257.c                                     |     8 +-
 hw/dma/meson.build                                 |    32 +-
 hw/dma/omap_dma.c                                  |     4 +-
 hw/dma/pl080.c                                     |     4 +-
 hw/dma/pl330.c                                     |    35 +-
 hw/dma/pxa2xx_dma.c                                |     4 +-
 hw/dma/rc4030.c                                    |     2 +-
 hw/dma/soc_dma.c                                   |     4 +-
 hw/dma/sparc32_dma.c                               |     2 +-
 hw/dma/trace-events                                |     3 +
 hw/dma/xilinx_axidma.c                             |    41 +-
 hw/dma/xlnx-zdma.c                                 |     9 +-
 hw/dma/xlnx-zynq-devcfg.c                          |     4 +-
 hw/dma/xlnx_csu_dma.c                              |    29 +-
 hw/dma/xlnx_dpdma.c                                |    90 +-
 hw/fsi/Kconfig                                     |     7 +
 hw/fsi/aspeed_apb2opb.c                            |   367 +
 hw/fsi/cfam.c                                      |   168 +
 hw/fsi/fsi-master.c                                |   170 +
 hw/fsi/fsi.c                                       |   102 +
 hw/fsi/lbus.c                                      |   117 +
 hw/fsi/meson.build                                 |     2 +
 hw/fsi/trace-events                                |    13 +
 hw/fsi/trace.h                                     |     1 +
 hw/gpio/Kconfig                                    |     7 +
 hw/gpio/aspeed_gpio.c                              |    21 +-
 hw/gpio/bcm2835_gpio.c                             |     2 +-
 hw/gpio/bcm2838_gpio.c                             |   390 +
 hw/gpio/gpio_key.c                                 |     2 +-
 hw/gpio/imx_gpio.c                                 |     2 +-
 hw/gpio/max7310.c                                  |     2 +-
 hw/gpio/meson.build                                |    33 +-
 hw/gpio/mpc8xxx.c                                  |     2 +-
 hw/gpio/npcm7xx_gpio.c                             |     4 +-
 hw/gpio/nrf51_gpio.c                               |    16 +-
 hw/gpio/pca9552.c                                  |   481 +
 hw/gpio/pca9554.c                                  |   328 +
 hw/gpio/pcf8574.c                                  |   162 +
 hw/gpio/pl061.c                                    |     4 +-
 hw/gpio/sifive_gpio.c                              |     2 +-
 hw/gpio/stm32l4x5_gpio.c                           |   479 +
 hw/gpio/trace-events                               |    10 +
 hw/gpio/zaurus.c                                   |    63 +-
 hw/hppa/Kconfig                                    |     5 +
 hw/hppa/hppa_hardware.h                            |     1 -
 hw/hppa/machine.c                                  |   556 +-
 hw/hyperv/Kconfig                                  |    10 +
 hw/hyperv/hv-balloon-internal.h                    |    32 +
 hw/hyperv/hv-balloon-our_range_memslots.c          |   202 +
 hw/hyperv/hv-balloon-our_range_memslots.h          |   109 +
 hw/hyperv/hv-balloon-page_range_tree.c             |   229 +
 hw/hyperv/hv-balloon-page_range_tree.h             |   117 +
 hw/hyperv/hv-balloon-stub.c                        |    19 +
 hw/hyperv/hv-balloon.c                             |  1773 ++
 hw/hyperv/hyperv.c                                 |    41 +
 hw/hyperv/meson.build                              |     1 +
 hw/hyperv/trace-events                             |    18 +
 hw/hyperv/vmbus.c                                  |    33 +-
 hw/i2c/Kconfig                                     |     4 +
 hw/i2c/allwinner-i2c.c                             |     7 +-
 hw/i2c/aspeed_i2c.c                                |    90 +-
 hw/i2c/bcm2835_i2c.c                               |   282 +
 hw/i2c/bitbang_i2c.c                               |     2 +-
 hw/i2c/core.c                                      |     6 +-
 hw/i2c/exynos4210_i2c.c                            |     2 +-
 hw/i2c/i2c_mux_pca954x.c                           |    22 +
 hw/i2c/imx_i2c.c                                   |     2 +-
 hw/i2c/meson.build                                 |     3 +-
 hw/i2c/microbit_i2c.c                              |     2 +-
 hw/i2c/mpc_i2c.c                                   |    10 +-
 hw/i2c/npcm7xx_smbus.c                             |     4 +-
 hw/i2c/pm_smbus.c                                  |    26 +-
 hw/i2c/pmbus_device.c                              |   258 +-
 hw/i2c/smbus_eeprom.c                              |     2 +-
 hw/i2c/smbus_ich9.c                                |     2 +-
 hw/i2c/smbus_slave.c                               |    12 +-
 hw/i2c/trace-events                                |     8 +-
 hw/i386/Kconfig                                    |    21 +-
 hw/i386/acpi-build.c                               |   302 +-
 hw/i386/acpi-common.c                              |    15 +-
 hw/i386/acpi-common.h                              |     6 +-
 hw/i386/acpi-microvm.c                             |    22 +-
 hw/i386/amd_iommu-stub.c                           |    26 +
 hw/i386/amd_iommu.c                                |   137 +-
 hw/i386/amd_iommu.h                                |    27 +-
 hw/i386/e820_memory_layout.c                       |    17 +-
 hw/i386/e820_memory_layout.h                       |     8 +-
 hw/i386/fw_cfg.c                                   |    40 +-
 hw/i386/fw_cfg.h                                   |     5 +-
 hw/i386/generic_event_device_x86.c                 |    36 -
 hw/i386/intel_iommu.c                              |   506 +-
 hw/i386/intel_iommu_internal.h                     |    13 +-
 hw/i386/kvm/apic.c                                 |     3 +-
 hw/i386/kvm/clock.c                                |    14 +-
 hw/i386/kvm/clock.h                                |    18 +
 hw/i386/kvm/i8254.c                                |    40 +-
 hw/i386/kvm/ioapic.c                               |     3 +-
 hw/i386/kvm/meson.build                            |     3 +-
 hw/i386/kvm/trace-events                           |     2 +
 hw/i386/kvm/xen-stubs.c                            |     8 +
 hw/i386/kvm/xen_evtchn.c                           |   235 +-
 hw/i386/kvm/xen_evtchn.h                           |     3 +-
 hw/i386/kvm/xen_gnttab.c                           |    11 +-
 hw/i386/kvm/xen_overlay.c                          |     4 +-
 hw/i386/kvm/xen_primary_console.c                  |   193 +
 hw/i386/kvm/xen_primary_console.h                  |    23 +
 hw/i386/kvm/xen_xenstore.c                         |    39 +-
 hw/i386/kvm/xenstore_impl.c                        |    14 +-
 hw/i386/kvmvapic.c                                 |   871 -
 hw/i386/meson.build                                |    11 +-
 hw/i386/microvm.c                                  |    21 +-
 hw/i386/monitor.c                                  |    46 +
 hw/i386/pc.c                                       |   668 +-
 hw/i386/pc_piix.c                                  |   693 +-
 hw/i386/pc_q35.c                                   |   413 +-
 hw/i386/pc_sysfw.c                                 |    55 +-
 hw/i386/port92.c                                   |     3 +-
 hw/i386/sgx-stub.c                                 |     7 +-
 hw/i386/sgx.c                                      |    34 +-
 hw/i386/trace-events                               |    10 +
 hw/i386/vapic.c                                    |   870 +
 hw/i386/vmmouse.c                                  |    57 +-
 hw/i386/x86-common.c                               |  1049 +
 hw/i386/x86-cpu.c                                  |    97 +
 hw/i386/x86-iommu.c                                |     2 +-
 hw/i386/x86.c                                      |  1088 +-
 hw/i386/xen/meson.build                            |     5 +-
 hw/i386/xen/trace-events                           |    19 -
 hw/i386/xen/xen-hvm.c                              |  1166 +-
 hw/i386/xen/xen-mapcache.c                         |   599 -
 hw/i386/xen/xen_apic.c                             |     3 +-
 hw/i386/xen/xen_platform.c                         |    80 +-
 hw/i386/xen/xen_pvdevice.c                         |     2 +-
 hw/ide/Kconfig                                     |    32 +-
 hw/ide/ahci-allwinner.c                            |     5 +-
 hw/ide/ahci-internal.h                             |   386 +
 hw/ide/ahci.c                                      |   186 +-
 hw/ide/ahci_internal.h                             |   393 -
 hw/ide/atapi.c                                     |    16 +-
 hw/ide/cf.c                                        |    58 +
 hw/ide/cmd646.c                                    |     6 +-
 hw/ide/core.c                                      |   116 +-
 hw/ide/ich.c                                       |    14 +-
 hw/ide/ide-bus.c                                   |   111 +
 hw/ide/ide-dev.c                                   |   270 +
 hw/ide/ide-internal.h                              |   448 +
 hw/ide/ioport.c                                    |    14 +-
 hw/ide/isa.c                                       |     6 +-
 hw/ide/macio.c                                     |    14 +-
 hw/ide/meson.build                                 |    30 +-
 hw/ide/microdrive.c                                |     4 +-
 hw/ide/mmio.c                                      |     4 +-
 hw/ide/pci.c                                       |   118 +-
 hw/ide/piix.c                                      |     9 +-
 hw/ide/qdev.c                                      |   403 -
 hw/ide/sii3112.c                                   |     8 +-
 hw/ide/via.c                                       |    59 +-
 hw/input/Kconfig                                   |     2 +-
 hw/input/adb-kbd.c                                 |     4 +-
 hw/input/adb-mouse.c                               |     2 +-
 hw/input/adb.c                                     |    13 +-
 hw/input/ads7846.c                                 |     4 +-
 hw/input/hid.c                                     |    14 +-
 hw/input/lasips2.c                                 |    14 +-
 hw/input/lm832x.c                                  |     2 +-
 hw/input/meson.build                               |    31 +-
 hw/input/pckbd.c                                   |    17 +-
 hw/input/pl050.c                                   |     2 +-
 hw/input/ps2.c                                     |    30 +-
 hw/input/pxa2xx_keypad.c                           |     2 +-
 hw/input/stellaris_gamepad.c                       |   107 +
 hw/input/stellaris_input.c                         |    93 -
 hw/input/tsc2005.c                                 |   145 +-
 hw/input/tsc210x.c                                 |    77 +-
 hw/input/vhost-user-input.c                        |   136 -
 hw/input/virtio-input-hid.c                        |   162 +-
 hw/input/virtio-input.c                            |     2 +-
 hw/intc/Kconfig                                    |    20 +-
 hw/intc/allwinner-a10-pic.c                        |     2 +-
 hw/intc/apic.c                                     |   476 +-
 hw/intc/apic_common.c                              |    53 +-
 hw/intc/arm_gic.c                                  |    20 +-
 hw/intc/arm_gic_common.c                           |    21 +-
 hw/intc/arm_gic_kvm.c                              |     7 +-
 hw/intc/arm_gicv3.c                                |    67 +-
 hw/intc/arm_gicv3_common.c                         |    80 +-
 hw/intc/arm_gicv3_cpuif.c                          |   308 +-
 hw/intc/arm_gicv3_dist.c                           |    36 +
 hw/intc/arm_gicv3_its.c                            |    25 +-
 hw/intc/arm_gicv3_its_common.c                     |    15 +-
 hw/intc/arm_gicv3_its_kvm.c                        |    10 +-
 hw/intc/arm_gicv3_kvm.c                            |    12 +-
 hw/intc/arm_gicv3_redist.c                         |    24 +-
 hw/intc/armv7m_nvic.c                              |    34 +-
 hw/intc/aspeed_intc.c                              |   361 +
 hw/intc/aspeed_vic.c                               |     2 +-
 hw/intc/bcm2835_ic.c                               |     2 +-
 hw/intc/bcm2836_control.c                          |     2 +-
 hw/intc/exynos4210_combiner.c                      |     4 +-
 hw/intc/gic_internal.h                             |     8 +-
 hw/intc/gicv3_internal.h                           |    13 +
 hw/intc/goldfish_pic.c                             |    10 +-
 hw/intc/grlib_irqmp.c                              |   111 +-
 hw/intc/heathrow_pic.c                             |     4 +-
 hw/intc/i8259_common.c                             |    20 +-
 hw/intc/imx_avic.c                                 |     2 +-
 hw/intc/imx_gpcv2.c                                |     2 +-
 hw/intc/ioapic-stub.c                              |    29 +
 hw/intc/ioapic_common.c                            |    63 +-
 hw/intc/loongarch_extioi.c                         |   312 +-
 hw/intc/loongarch_ipi.c                            |   275 +-
 hw/intc/loongarch_pch_pic.c                        |     9 +-
 hw/intc/loongson_ipi.c                             |    99 +
 hw/intc/loongson_ipi_common.c                      |   347 +
 hw/intc/loongson_liointc.c                         |     2 +-
 hw/intc/m68k_irqc.c                                |    17 +-
 hw/intc/meson.build                                |    48 +-
 hw/intc/mips_gic.c                                 |     2 +-
 hw/intc/nios2_vic.c                                |   313 -
 hw/intc/omap_intc.c                                |     2 +-
 hw/intc/ompic.c                                    |     4 +-
 hw/intc/openpic.c                                  |    19 +-
 hw/intc/pl190.c                                    |     2 +-
 hw/intc/pnv_xive.c                                 |   221 +-
 hw/intc/pnv_xive2.c                                |   709 +-
 hw/intc/pnv_xive2_regs.h                           |   116 +
 hw/intc/pnv_xive_regs.h                            |     1 +
 hw/intc/ppc-uic.c                                  |     2 +-
 hw/intc/riscv_aclint.c                             |    25 +-
 hw/intc/riscv_aplic.c                              |   100 +-
 hw/intc/riscv_imsic.c                              |    29 +-
 hw/intc/rx_icu.c                                   |     2 +-
 hw/intc/s390_flic.c                                |   109 +-
 hw/intc/s390_flic_kvm.c                            |    43 +-
 hw/intc/sifive_plic.c                              |     2 +-
 hw/intc/slavio_intctl.c                            |    15 +-
 hw/intc/spapr_xive.c                               |    77 +-
 hw/intc/spapr_xive_kvm.c                           |     6 +-
 hw/intc/trace-events                               |    30 +-
 hw/intc/xics.c                                     |    52 +-
 hw/intc/xics_spapr.c                               |     7 +-
 hw/intc/xive.c                                     |   241 +-
 hw/intc/xive2.c                                    |   128 +-
 hw/intc/xlnx-pmu-iomod-intc.c                      |     2 +-
 hw/intc/xlnx-zynqmp-ipi.c                          |     2 +-
 hw/ipack/ipack.c                                   |     2 +-
 hw/ipack/meson.build                               |     2 +-
 hw/ipack/tpci200.c                                 |     2 +-
 hw/ipmi/ipmi_bmc_extern.c                          |    33 +-
 hw/ipmi/ipmi_bmc_sim.c                             |     2 +-
 hw/ipmi/ipmi_bt.c                                  |     2 +-
 hw/ipmi/ipmi_kcs.c                                 |     2 +-
 hw/ipmi/isa_ipmi_bt.c                              |    34 +-
 hw/ipmi/isa_ipmi_kcs.c                             |    48 +-
 hw/ipmi/meson.build                                |     2 +-
 hw/ipmi/pci_ipmi_bt.c                              |     2 +-
 hw/ipmi/pci_ipmi_kcs.c                             |     2 +-
 hw/ipmi/smbus_ipmi.c                               |     2 +-
 hw/isa/Kconfig                                     |    28 +-
 hw/isa/apm.c                                       |     2 +-
 hw/isa/fdc37m81x-superio.c                         |    32 +
 hw/isa/i82378.c                                    |    10 +-
 hw/isa/isa-bus.c                                   |    11 +-
 hw/isa/isa-superio.c                               |    26 +-
 hw/isa/lpc_ich9.c                                  |    44 +-
 hw/isa/meson.build                                 |    18 +-
 hw/isa/pc87312.c                                   |     6 +-
 hw/isa/piix.c                                      |   522 +
 hw/isa/piix3.c                                     |   432 -
 hw/isa/piix4.c                                     |   302 -
 hw/isa/smc37c669-superio.c                         |    19 -
 hw/isa/vt82c686.c                                  |   168 +-
 hw/loongarch/Kconfig                               |     7 +-
 hw/loongarch/acpi-build.c                          |   203 +-
 hw/loongarch/boot.c                                |   339 +
 hw/loongarch/fw_cfg.c                              |     2 +-
 hw/loongarch/fw_cfg.h                              |     2 +-
 hw/loongarch/meson.build                           |     3 +-
 hw/loongarch/virt.c                                |  1188 +-
 hw/m68k/Kconfig                                    |    13 +
 hw/m68k/an5206.c                                   |     6 +-
 hw/m68k/bootinfo.h                                 |    10 +-
 hw/m68k/mcf5206.c                                  |    35 +-
 hw/m68k/mcf5208.c                                  |    69 +-
 hw/m68k/mcf_intc.c                                 |    21 +-
 hw/m68k/meson.build                                |     2 +-
 hw/m68k/next-cube.c                                |   653 +-
 hw/m68k/next-kbd.c                                 |     2 +-
 hw/m68k/q800-glue.c                                |   259 +
 hw/m68k/q800.c                                     |   695 +-
 hw/m68k/virt.c                                     |   101 +-
 hw/mem/cxl_type3.c                                 |  1505 +-
 hw/mem/cxl_type3_stubs.c                           |    77 +
 hw/mem/memory-device-stubs.c                       |    22 +
 hw/mem/memory-device.c                             |   320 +-
 hw/mem/meson.build                                 |     8 +-
 hw/mem/nvdimm.c                                    |    10 +-
 hw/mem/pc-dimm.c                                   |    13 +-
 hw/meson.build                                     |     4 +-
 hw/microblaze/Kconfig                              |     6 +
 hw/microblaze/boot.c                               |     9 +-
 hw/microblaze/petalogix_ml605_mmu.c                |     8 +-
 hw/microblaze/petalogix_s3adsp1800_mmu.c           |     3 +-
 hw/microblaze/xlnx-zynqmp-pmu.c                    |     2 +
 hw/mips/Kconfig                                    |    44 +-
 hw/mips/boston.c                                   |    17 +-
 hw/mips/cps.c                                      |    11 +-
 hw/mips/fuloong2e.c                                |    34 +-
 hw/mips/jazz.c                                     |   108 +-
 hw/mips/loongson3_bootp.c                          |     3 +-
 hw/mips/loongson3_bootp.h                          |     7 +-
 hw/mips/loongson3_virt.c                           |    95 +-
 hw/mips/malta.c                                    |    85 +-
 hw/mips/meson.build                                |     4 +-
 hw/mips/mips_int.c                                 |     3 +-
 hw/mips/mipssim.c                                  |    43 +-
 hw/misc/Kconfig                                    |    35 +-
 hw/misc/a9scu.c                                    |     2 +-
 hw/misc/allwinner-a10-ccm.c                        |     2 +-
 hw/misc/allwinner-a10-dramc.c                      |     2 +-
 hw/misc/allwinner-cpucfg.c                         |     2 +-
 hw/misc/allwinner-h3-ccu.c                         |     2 +-
 hw/misc/allwinner-h3-dramc.c                       |     2 +-
 hw/misc/allwinner-h3-sysctrl.c                     |     2 +-
 hw/misc/allwinner-r40-ccu.c                        |   209 +
 hw/misc/allwinner-r40-dramc.c                      |   511 +
 hw/misc/allwinner-sid.c                            |     2 +-
 hw/misc/allwinner-sramc.c                          |   185 +
 hw/misc/applesmc.c                                 |    36 +-
 hw/misc/arm_l2x0.c                                 |     2 +-
 hw/misc/arm_sysctl.c                               |     8 +-
 hw/misc/armsse-cpu-pwrctrl.c                       |     2 +-
 hw/misc/armsse-mhu.c                               |     2 +-
 hw/misc/aspeed_hace.c                              |     2 +-
 hw/misc/aspeed_i3c.c                               |    10 +-
 hw/misc/aspeed_lpc.c                               |     2 +-
 hw/misc/aspeed_sbc.c                               |     2 +-
 hw/misc/aspeed_scu.c                               |   308 +-
 hw/misc/aspeed_sdmc.c                              |   227 +-
 hw/misc/aspeed_sli.c                               |   177 +
 hw/misc/aspeed_xdma.c                              |     2 +-
 hw/misc/axp209.c                                   |   238 -
 hw/misc/axp2xx.c                                   |   283 +
 hw/misc/bcm2835_cprman.c                           |    10 +-
 hw/misc/bcm2835_mbox.c                             |     4 +-
 hw/misc/bcm2835_mphi.c                             |     2 +-
 hw/misc/bcm2835_powermgt.c                         |     2 +-
 hw/misc/bcm2835_property.c                         |   295 +-
 hw/misc/bcm2835_rng.c                              |     2 +-
 hw/misc/bcm2835_thermal.c                          |     4 +-
 hw/misc/debugexit.c                                |     4 +-
 hw/misc/djmemc.c                                   |   135 +
 hw/misc/eccmemctl.c                                |     2 +-
 hw/misc/edu.c                                      |    40 +-
 hw/misc/exynos4210_clk.c                           |     2 +-
 hw/misc/exynos4210_pmu.c                           |     2 +-
 hw/misc/exynos4210_rng.c                           |     6 +-
 hw/misc/i2c-echo.c                                 |    10 +
 hw/misc/imx25_ccm.c                                |     4 +-
 hw/misc/imx31_ccm.c                                |     4 +-
 hw/misc/imx6_ccm.c                                 |    47 +-
 hw/misc/imx6_src.c                                 |     6 +-
 hw/misc/imx6ul_ccm.c                               |     6 +-
 hw/misc/imx7_ccm.c                                 |     6 +-
 hw/misc/imx7_snvs.c                                |    94 +-
 hw/misc/imx7_src.c                                 |   276 +
 hw/misc/imx_rngc.c                                 |     8 +-
 hw/misc/iosb.c                                     |   133 +
 hw/misc/iotkit-secctl.c                            |    10 +-
 hw/misc/iotkit-sysctl.c                            |     8 +-
 hw/misc/ivshmem.c                                  |    21 +-
 hw/misc/lasi.c                                     |    19 +-
 hw/misc/led.c                                      |     4 +-
 hw/misc/mac_via.c                                  |   261 +-
 hw/misc/macio/cuda.c                               |     6 +-
 hw/misc/macio/gpio.c                               |     2 +-
 hw/misc/macio/mac_dbdma.c                          |    10 +-
 hw/misc/macio/macio.c                              |    13 +-
 hw/misc/macio/meson.build                          |     2 +-
 hw/misc/macio/pmu.c                                |    13 +-
 hw/misc/meson.build                                |   166 +-
 hw/misc/mips_cmgcr.c                               |     2 +-
 hw/misc/mips_cpc.c                                 |     2 +-
 hw/misc/mips_itu.c                                 |    38 +-
 hw/misc/mos6522.c                                  |     6 +-
 hw/misc/mps2-fpgaio.c                              |     2 +-
 hw/misc/mps2-scc.c                                 |   148 +-
 hw/misc/msf2-sysreg.c                              |     2 +-
 hw/misc/mst_fpga.c                                 |     2 +-
 hw/misc/npcm7xx_clk.c                              |    21 +-
 hw/misc/npcm7xx_gcr.c                              |    14 +-
 hw/misc/npcm7xx_mft.c                              |     4 +-
 hw/misc/npcm7xx_pwm.c                              |     6 +-
 hw/misc/npcm7xx_rng.c                              |     2 +-
 hw/misc/nrf51_rng.c                                |     2 +-
 hw/misc/pca9552.c                                  |   437 -
 hw/misc/pci-testdev.c                              |     3 +-
 hw/misc/pvpanic-isa.c                              |     3 +-
 hw/misc/pvpanic-pci.c                              |     8 +-
 hw/misc/pvpanic.c                                  |     9 +-
 hw/misc/sifive_e_aon.c                             |   319 +
 hw/misc/sifive_test.c                              |     9 +-
 hw/misc/slavio_misc.c                              |     2 +-
 hw/misc/stm32f2xx_syscfg.c                         |     4 +-
 hw/misc/stm32f4xx_exti.c                           |     2 +-
 hw/misc/stm32f4xx_syscfg.c                         |     2 +-
 hw/misc/stm32l4x5_exti.c                           |   293 +
 hw/misc/stm32l4x5_rcc.c                            |  1474 ++
 hw/misc/stm32l4x5_syscfg.c                         |   267 +
 hw/misc/trace-events                               |   101 +-
 hw/misc/tz-mpc.c                                   |     2 +-
 hw/misc/tz-msc.c                                   |     2 +-
 hw/misc/tz-ppc.c                                   |     2 +-
 hw/misc/virt_ctrl.c                                |     2 +-
 hw/misc/vmcoreinfo.c                               |     2 +-
 hw/misc/xlnx-cfi-if.c                              |    34 +
 hw/misc/xlnx-versal-cframe-reg.c                   |   858 +
 hw/misc/xlnx-versal-cfu.c                          |   563 +
 hw/misc/xlnx-versal-crl.c                          |     9 +-
 hw/misc/xlnx-versal-pmc-iou-slcr.c                 |     4 +-
 hw/misc/xlnx-versal-trng.c                         |   716 +
 hw/misc/xlnx-versal-xramc.c                        |     4 +-
 hw/misc/xlnx-zynqmp-apu-ctrl.c                     |     4 +-
 hw/misc/xlnx-zynqmp-crf.c                          |     4 +-
 hw/misc/zynq_slcr.c                                |    30 +-
 hw/net/Kconfig                                     |     6 +-
 hw/net/allwinner-sun8i-emac.c                      |     5 +-
 hw/net/allwinner_emac.c                            |     9 +-
 hw/net/cadence_gem.c                               |   922 +-
 hw/net/can/can_kvaser_pci.c                        |     2 +-
 hw/net/can/can_mioe3680_pci.c                      |     2 +-
 hw/net/can/can_pcm3680_pci.c                       |     2 +-
 hw/net/can/can_sja1000.c                           |     6 +-
 hw/net/can/ctucan_core.c                           |     4 +-
 hw/net/can/ctucan_pci.c                            |     2 +-
 hw/net/can/meson.build                             |    15 +-
 hw/net/can/trace-events                            |     7 +
 hw/net/can/xlnx-versal-canfd.c                     |  2110 ++
 hw/net/can/xlnx-zynqmp-can.c                       |    71 +-
 hw/net/dp8393x.c                                   |    39 +-
 hw/net/e1000.c                                     |   142 +-
 hw/net/e1000_regs.h                                |     2 +-
 hw/net/e1000e.c                                    |    11 +-
 hw/net/e1000e_core.c                               |   422 +-
 hw/net/e1000e_core.h                               |     4 -
 hw/net/e1000x_common.c                             |    54 +-
 hw/net/e1000x_common.h                             |     4 +-
 hw/net/e1000x_regs.h                               |    26 +-
 hw/net/eepro100.c                                  |     9 +-
 hw/net/etraxfs_eth.c                               |     8 +-
 hw/net/fsl_etsec/etsec.c                           |     3 +-
 hw/net/fsl_etsec/rings.c                           |    14 +-
 hw/net/ftgmac100.c                                 |   174 +-
 hw/net/i82596.c                                    |    23 +-
 hw/net/igb.c                                       |    42 +-
 hw/net/igb_common.h                                |    25 +-
 hw/net/igb_core.c                                  |  1368 +-
 hw/net/igb_core.h                                  |     5 +-
 hw/net/igb_regs.h                                  |    84 +-
 hw/net/igbvf.c                                     |    28 +-
 hw/net/imx_fec.c                                   |    37 +-
 hw/net/lan9118.c                                   |    40 +-
 hw/net/lance.c                                     |     2 +-
 hw/net/lasi_i82596.c                               |    15 +-
 hw/net/mcf_fec.c                                   |     5 +-
 hw/net/meson.build                                 |    94 +-
 hw/net/mipsnet.c                                   |     5 +-
 hw/net/msf2-emac.c                                 |     5 +-
 hw/net/mv88w8618_eth.c                             |     5 +-
 hw/net/ne2000-isa.c                                |     5 +-
 hw/net/ne2000-pci.c                                |     5 +-
 hw/net/ne2000.c                                    |    14 +-
 hw/net/net_rx_pkt.c                                |    93 +-
 hw/net/net_rx_pkt.h                                |    28 +-
 hw/net/net_tx_pkt.c                                |   110 +-
 hw/net/net_tx_pkt.h                                |    46 +-
 hw/net/npcm7xx_emc.c                               |    37 +-
 hw/net/npcm_gmac.c                                 |   942 +
 hw/net/opencores_eth.c                             |     3 +-
 hw/net/pcnet-pci.c                                 |     2 +-
 hw/net/pcnet.c                                     |    16 +-
 hw/net/rocker/rocker_fp.c                          |     6 +-
 hw/net/rocker/rocker_of_dpa.c                      |     2 +-
 hw/net/rtl8139.c                                   |    29 +-
 hw/net/smc91c111.c                                 |    12 +-
 hw/net/spapr_llan.c                                |    17 +-
 hw/net/stellaris_enet.c                            |     7 +-
 hw/net/sungem.c                                    |    72 +-
 hw/net/sunhme.c                                    |    18 +-
 hw/net/trace-events                                |    59 +-
 hw/net/tulip.c                                     |    11 +-
 hw/net/vhost_net.c                                 |    33 +-
 hw/net/virtio-net.c                                |   462 +-
 hw/net/vmxnet3.c                                   |    56 +-
 hw/net/vmxnet3.h                                   |     2 +-
 hw/net/xen_nic.c                                   |   486 +-
 hw/net/xgmac.c                                     |     7 +-
 hw/net/xilinx_axienet.c                            |     5 +-
 hw/net/xilinx_ethlite.c                            |     5 +-
 hw/nios2/10m50_devboard.c                          |   180 -
 hw/nios2/Kconfig                                   |    13 -
 hw/nios2/boot.c                                    |   239 -
 hw/nios2/boot.h                                    |    10 -
 hw/nios2/generic_nommu.c                           |   100 -
 hw/nios2/meson.build                               |     6 -
 hw/nubus/meson.build                               |     3 +-
 hw/nubus/nubus-device.c                            |    18 +-
 hw/nubus/nubus-virtio-mmio.c                       |   104 +
 hw/nubus/trace-events                              |     2 +-
 hw/nvme/Kconfig                                    |     2 +-
 hw/nvme/ctrl.c                                     |   821 +-
 hw/nvme/dif.c                                      |     4 +-
 hw/nvme/meson.build                                |     2 +-
 hw/nvme/nguid.c                                    |   187 +
 hw/nvme/ns.c                                       |    59 +-
 hw/nvme/nvme.h                                     |    56 +-
 hw/nvme/subsys.c                                   |    16 +-
 hw/nvme/trace-events                               |     3 +-
 hw/nvram/bcm2835_otp.c                             |   187 +
 hw/nvram/ds1225y.c                                 |     2 +-
 hw/nvram/eeprom93xx.c                              |     4 +-
 hw/nvram/eeprom_at24c.c                            |     2 +-
 hw/nvram/fw_cfg-acpi.c                             |    24 +
 hw/nvram/fw_cfg.c                                  |    16 +-
 hw/nvram/mac_nvram.c                               |     8 +-
 hw/nvram/meson.build                               |    34 +-
 hw/nvram/npcm7xx_otp.c                             |     2 +-
 hw/nvram/nrf51_nvm.c                               |     9 +-
 hw/nvram/spapr_nvram.c                             |     2 +-
 hw/nvram/xlnx-bbram.c                              |    10 +-
 hw/nvram/xlnx-efuse.c                              |    19 +-
 hw/nvram/xlnx-versal-efuse-ctrl.c                  |    18 +-
 hw/nvram/xlnx-zynqmp-efuse.c                       |    10 +-
 hw/openrisc/Kconfig                                |     6 +
 hw/openrisc/cputimer.c                             |     2 +-
 hw/openrisc/meson.build                            |     4 +-
 hw/openrisc/openrisc_sim.c                         |    18 +-
 hw/pci-bridge/Kconfig                              |     5 +
 hw/pci-bridge/cxl_downstream.c                     |    26 +-
 hw/pci-bridge/cxl_root_port.c                      |    12 +-
 hw/pci-bridge/cxl_upstream.c                       |    56 +-
 hw/pci-bridge/gen_pcie_root_port.c                 |     2 +-
 hw/pci-bridge/i82801b11.c                          |     2 +-
 hw/pci-bridge/ioh3420.c                            |     2 +-
 hw/pci-bridge/meson.build                          |     7 +-
 hw/pci-bridge/pci_bridge_dev.c                     |     2 +-
 hw/pci-bridge/pci_expander_bridge.c                |    63 +-
 hw/pci-bridge/pcie_pci_bridge.c                    |     2 +-
 hw/pci-bridge/pcie_root_port.c                     |     2 +-
 hw/pci-bridge/xio3130_downstream.c                 |     2 +-
 hw/pci-bridge/xio3130_upstream.c                   |     2 +-
 hw/pci-host/Kconfig                                |    17 +
 hw/pci-host/articia.c                              |   293 +
 hw/pci-host/astro.c                                |   907 +
 hw/pci-host/bonito.c                               |    38 +-
 hw/pci-host/designware.c                           |    23 +-
 hw/pci-host/dino.c                                 |    10 +-
 hw/pci-host/gpex-acpi.c                            |    28 +-
 hw/pci-host/gpex.c                                 |    14 +-
 hw/pci-host/gt64120.c                              |    29 +-
 hw/pci-host/i440fx.c                               |   139 +-
 hw/pci-host/meson.build                            |     7 +-
 hw/pci-host/mv64361.c                              |     6 +
 hw/pci-host/mv643xx.h                              |     3 +
 hw/pci-host/pam.c                                  |    12 +-
 hw/pci-host/pnv_phb.c                              |     6 +-
 hw/pci-host/pnv_phb3.c                             |     8 +-
 hw/pci-host/pnv_phb3_msi.c                         |    27 +-
 hw/pci-host/pnv_phb4.c                             |    89 +-
 hw/pci-host/pnv_phb4_pec.c                         |    33 +-
 hw/pci-host/ppc440_pcix.c                          |   542 +
 hw/pci-host/ppc4xx_pci.c                           |   400 +
 hw/pci-host/ppce500.c                              |    14 +-
 hw/pci-host/q35.c                                  |    89 +-
 hw/pci-host/raven.c                                |    22 +-
 hw/pci-host/sabre.c                                |    12 +-
 hw/pci-host/sh_pci.c                               |    57 +-
 hw/pci-host/trace-events                           |    23 +
 hw/pci-host/versatile.c                            |     2 +-
 hw/pci/Kconfig                                     |     3 +
 hw/pci/meson.build                                 |     7 +-
 hw/pci/msi.c                                       |     3 +-
 hw/pci/msix.c                                      |     5 +-
 hw/pci/pci.c                                       |   396 +-
 hw/pci/pci_bridge.c                                |    33 +-
 hw/pci/pci_host.c                                  |     4 +-
 hw/pci/pcie.c                                      |    79 +-
 hw/pci/pcie_aer.c                                  |     6 +-
 hw/pci/pcie_sriov.c                                |    43 +-
 hw/pci/shpc.c                                      |    50 +-
 hw/pci/trace-events                                |     6 +
 hw/pcmcia/meson.build                              |     4 +-
 hw/pcmcia/pxa2xx.c                                 |    15 -
 hw/ppc/Kconfig                                     |    51 +-
 hw/ppc/amigaone.c                                  |   178 +
 hw/ppc/e500.c                                      |    19 +-
 hw/ppc/e500plat.c                                  |     1 +
 hw/ppc/mac_newworld.c                              |    12 +-
 hw/ppc/mac_oldworld.c                              |     7 +-
 hw/ppc/meson.build                                 |    26 +-
 hw/ppc/mpc8544_guts.c                              |     3 +-
 hw/ppc/mpc8544ds.c                                 |     1 +
 hw/ppc/pef.c                                       |    11 +-
 hw/ppc/pegasos2.c                                  |    92 +-
 hw/ppc/pnv.c                                       |   848 +-
 hw/ppc/pnv_adu.c                                   |   206 +
 hw/ppc/pnv_bmc.c                                   |    10 +-
 hw/ppc/pnv_chiptod.c                               |   585 +
 hw/ppc/pnv_core.c                                  |   405 +-
 hw/ppc/pnv_i2c.c                                   |   584 +
 hw/ppc/pnv_lpc.c                                   |   165 +-
 hw/ppc/pnv_n1_chiplet.c                            |   173 +
 hw/ppc/pnv_nest_pervasive.c                        |   208 +
 hw/ppc/pnv_occ.c                                   |     2 +-
 hw/ppc/pnv_psi.c                                   |    47 +-
 hw/ppc/pnv_sbe.c                                   |     2 +-
 hw/ppc/pnv_xscom.c                                 |    19 +-
 hw/ppc/ppc.c                                       |   292 +-
 hw/ppc/ppc405_boards.c                             |     1 +
 hw/ppc/ppc440.h                                    |     1 -
 hw/ppc/ppc440_bamboo.c                             |    39 +-
 hw/ppc/ppc440_pcix.c                               |   538 -
 hw/ppc/ppc440_uc.c                                 |   235 +-
 hw/ppc/ppc4xx_pci.c                                |   401 -
 hw/ppc/ppce500_spin.c                              |     5 +-
 hw/ppc/prep.c                                      |    40 +-
 hw/ppc/prep_systemio.c                             |     4 +-
 hw/ppc/rs6000_mc.c                                 |     9 +-
 hw/ppc/sam460ex.c                                  |    66 +-
 hw/ppc/spapr.c                                     |   566 +-
 hw/ppc/spapr_caps.c                                |   115 +-
 hw/ppc/spapr_cpu_core.c                            |    55 +-
 hw/ppc/spapr_drc.c                                 |    20 +-
 hw/ppc/spapr_events.c                              |     8 +-
 hw/ppc/spapr_hcall.c                               |   469 +-
 hw/ppc/spapr_iommu.c                               |     8 +-
 hw/ppc/spapr_irq.c                                 |    10 +-
 hw/ppc/spapr_nested.c                              |  1905 ++
 hw/ppc/spapr_numa.c                                |    49 +-
 hw/ppc/spapr_nvdimm.c                              |    20 +-
 hw/ppc/spapr_ovec.c                                |     2 +-
 hw/ppc/spapr_pci.c                                 |    53 +-
 hw/ppc/spapr_pci_nvlink2.c                         |   442 -
 hw/ppc/spapr_pci_vfio.c                            |   138 +-
 hw/ppc/spapr_rng.c                                 |     4 +-
 hw/ppc/spapr_rtas.c                                |    36 +-
 hw/ppc/spapr_rtc.c                                 |     2 +-
 hw/ppc/spapr_softmmu.c                             |   615 -
 hw/ppc/spapr_vhyp_mmu.c                            |   611 +
 hw/ppc/spapr_vio.c                                 |     5 +-
 hw/ppc/spapr_vof.c                                 |     2 +-
 hw/ppc/trace-events                                |    20 +-
 hw/ppc/virtex_ml507.c                              |     2 +-
 hw/ppc/vof.c                                       |     4 +-
 hw/rdma/Kconfig                                    |     3 -
 hw/rdma/meson.build                                |    10 -
 hw/rdma/rdma.c                                     |    30 -
 hw/rdma/rdma_backend.c                             |  1401 --
 hw/rdma/rdma_backend.h                             |   129 -
 hw/rdma/rdma_backend_defs.h                        |    76 -
 hw/rdma/rdma_rm.c                                  |   816 -
 hw/rdma/rdma_rm.h                                  |    97 -
 hw/rdma/rdma_rm_defs.h                             |   146 -
 hw/rdma/rdma_utils.c                               |   126 -
 hw/rdma/rdma_utils.h                               |    63 -
 hw/rdma/trace-events                               |    31 -
 hw/rdma/trace.h                                    |     1 -
 hw/rdma/vmw/pvrdma.h                               |   144 -
 hw/rdma/vmw/pvrdma_cmd.c                           |   811 -
 hw/rdma/vmw/pvrdma_dev_ring.c                      |   141 -
 hw/rdma/vmw/pvrdma_dev_ring.h                      |    46 -
 hw/rdma/vmw/pvrdma_main.c                          |   719 -
 hw/rdma/vmw/pvrdma_qp_ops.c                        |   298 -
 hw/rdma/vmw/pvrdma_qp_ops.h                        |    28 -
 hw/rdma/vmw/trace-events                           |    17 -
 hw/rdma/vmw/trace.h                                |     1 -
 hw/remote/iommu.c                                  |     6 +-
 hw/remote/meson.build                              |     5 +-
 hw/remote/message.c                                |     5 +-
 hw/remote/mpqemu-link.c                            |    22 +-
 hw/remote/proxy-memory-listener.c                  |     2 +-
 hw/remote/proxy.c                                  |     8 +-
 hw/remote/remote-obj.c                             |     1 +
 hw/remote/vfio-user-obj-stub.c                     |     6 +
 hw/remote/vfio-user-obj.c                          |    20 +-
 hw/riscv/Kconfig                                   |    23 +
 hw/riscv/boot.c                                    |    21 +-
 hw/riscv/meson.build                               |     2 +-
 hw/riscv/microchip_pfsoc.c                         |    16 +-
 hw/riscv/numa.c                                    |     8 +-
 hw/riscv/opentitan.c                               |    40 +-
 hw/riscv/shakti_c.c                                |    13 +-
 hw/riscv/sifive_e.c                                |    19 +-
 hw/riscv/sifive_u.c                                |    17 +-
 hw/riscv/spike.c                                   |    21 +-
 hw/riscv/virt-acpi-build.c                         |   456 +-
 hw/riscv/virt.c                                    |   931 +-
 hw/rtc/allwinner-rtc.c                             |     2 +-
 hw/rtc/aspeed_rtc.c                                |     7 +-
 hw/rtc/ds1338.c                                    |     2 +-
 hw/rtc/exynos4210_rtc.c                            |     4 +-
 hw/rtc/goldfish_rtc.c                              |     2 +-
 hw/rtc/ls7a_rtc.c                                  |     6 +-
 hw/rtc/m48t59.c                                    |     8 +-
 hw/rtc/mc146818rtc.c                               |    22 +-
 hw/rtc/meson.build                                 |    28 +-
 hw/rtc/pl031.c                                     |     7 +-
 hw/rtc/sun4v-rtc.c                                 |     2 +-
 hw/rtc/twl92230.c                                  |     8 +-
 hw/rtc/xlnx-zynqmp-rtc.c                           |     2 +-
 hw/rx/Kconfig                                      |     3 +
 hw/rx/rx-gdbsim.c                                  |     1 +
 hw/rx/rx62n.c                                      |    40 +-
 hw/s390x/Kconfig                                   |     7 +-
 hw/s390x/ccw-device.c                              |     5 +-
 hw/s390x/ccw-device.h                              |     2 +-
 hw/s390x/cpu-topology.c                            |   469 +
 hw/s390x/css-bridge.c                              |    12 +-
 hw/s390x/css.c                                     |    49 +-
 hw/s390x/event-facility.c                          |    21 +-
 hw/s390x/ipl.c                                     |    16 +-
 hw/s390x/ipl.h                                     |     2 +-
 hw/s390x/meson.build                               |     2 +-
 hw/s390x/pv.c                                      |   360 -
 hw/s390x/s390-ccw.c                                |    36 +-
 hw/s390x/s390-pci-bus.c                            |    59 +-
 hw/s390x/s390-pci-inst.c                           |    48 +-
 hw/s390x/s390-pci-kvm.c                            |    36 +-
 hw/s390x/s390-pci-vfio.c                           |    43 +-
 hw/s390x/s390-skeys.c                              |    65 +-
 hw/s390x/s390-stattrib-kvm.c                       |    12 +-
 hw/s390x/s390-stattrib.c                           |    74 +-
 hw/s390x/s390-virtio-ccw.c                         |   308 +-
 hw/s390x/s390-virtio-hcall.h                       |     2 +
 hw/s390x/sclp.c                                    |    27 +-
 hw/s390x/sclpcpu.c                                 |     4 +-
 hw/s390x/sclpquiesce.c                             |    10 +-
 hw/s390x/tod-kvm.c                                 |     2 +-
 hw/s390x/trace-events                              |    21 +
 hw/s390x/virtio-ccw.c                              |    10 +-
 hw/scsi/Kconfig                                    |     6 +
 hw/scsi/esp-pci.c                                  |    79 +-
 hw/scsi/esp.c                                      |  1460 +-
 hw/scsi/lsi53c895a.c                               |    92 +-
 hw/scsi/megasas.c                                  |    20 +-
 hw/scsi/meson.build                                |    20 +-
 hw/scsi/mfi.h                                      |     2 +-
 hw/scsi/mptsas.c                                   |    11 +-
 hw/scsi/scsi-bus.c                                 |   366 +-
 hw/scsi/scsi-disk.c                                |   235 +-
 hw/scsi/scsi-generic.c                             |    21 +-
 hw/scsi/spapr_vscsi.c                              |     4 +-
 hw/scsi/trace-events                               |     5 +
 hw/scsi/vhost-scsi-common.c                        |    47 +-
 hw/scsi/vhost-scsi.c                               |    80 +-
 hw/scsi/vhost-user-scsi.c                          |   275 +-
 hw/scsi/virtio-scsi-dataplane.c                    |    45 +-
 hw/scsi/virtio-scsi.c                              |   235 +-
 hw/scsi/vmw_pvscsi.c                               |     9 +-
 hw/sd/allwinner-sdhost.c                           |    76 +-
 hw/sd/aspeed_sdhci.c                               |    21 +-
 hw/sd/bcm2835_sdhost.c                             |    35 +-
 hw/sd/cadence_sdhci.c                              |    23 +-
 hw/sd/core.c                                       |    48 +-
 hw/sd/meson.build                                  |    24 +-
 hw/sd/npcm7xx_sdhci.c                              |    26 +-
 hw/sd/pl181.c                                      |    37 +-
 hw/sd/pxa2xx_mmci.c                                |    44 +-
 hw/sd/sd.c                                         |  2216 ++-
 hw/sd/sdhci-pci.c                                  |    25 +-
 hw/sd/sdhci.c                                      |    45 +-
 hw/sd/sdmmc-internal.c                             |    72 -
 hw/sd/sdmmc-internal.h                             |   125 +-
 hw/sd/ssi-sd.c                                     |    21 +-
 hw/sd/trace-events                                 |    11 +-
 hw/sensor/Kconfig                                  |     5 +
 hw/sensor/adm1266.c                                |   254 +
 hw/sensor/adm1272.c                                |     6 +-
 hw/sensor/dps310.c                                 |     2 +-
 hw/sensor/emc141x.c                                |     2 +-
 hw/sensor/isl_pmbus_vr.c                           |    12 +-
 hw/sensor/lsm303dlhc_mag.c                         |     2 +-
 hw/sensor/max31785.c                               |     4 +-
 hw/sensor/max34451.c                               |     6 +-
 hw/sensor/meson.build                              |    19 +-
 hw/sensor/tmp105.c                                 |     6 +-
 hw/sensor/tmp421.c                                 |     2 +-
 hw/sh4/Kconfig                                     |     5 +-
 hw/sh4/meson.build                                 |     2 +-
 hw/sh4/r2d.c                                       |    15 +-
 hw/sh4/sh7750_regs.h                               |    28 +-
 hw/sh4/shix.c                                      |     1 +
 hw/sh4/trace-events                                |     4 +-
 hw/smbios/Kconfig                                  |     2 +
 hw/smbios/meson.build                              |    11 +-
 hw/smbios/smbios.c                                 |   733 +-
 hw/smbios/smbios_legacy.c                          |   192 +
 hw/smbios/smbios_legacy_stub.c                     |    20 +
 hw/sparc/Kconfig                                   |     4 +
 hw/sparc/leon3.c                                   |   150 +-
 hw/sparc/sun4m.c                                   |    54 +-
 hw/sparc/sun4m_iommu.c                             |    10 +-
 hw/sparc64/Kconfig                                 |     4 +
 hw/sparc64/sparc64.c                               |     4 +-
 hw/sparc64/sun4u.c                                 |    71 +-
 hw/ssi/Kconfig                                     |     8 +
 hw/ssi/aspeed_smc.c                                |   369 +-
 hw/ssi/bcm2835_spi.c                               |   288 +
 hw/ssi/ibex_spi_host.c                             |     8 +-
 hw/ssi/imx_spi.c                                   |     4 +-
 hw/ssi/meson.build                                 |    28 +-
 hw/ssi/mss-spi.c                                   |     2 +-
 hw/ssi/npcm7xx_fiu.c                               |     4 +-
 hw/ssi/npcm_pspi.c                                 |     2 +-
 hw/ssi/pl022.c                                     |     2 +-
 hw/ssi/pnv_spi.c                                   |  1268 ++
 hw/ssi/ssi.c                                       |    45 +-
 hw/ssi/stm32f2xx_spi.c                             |     2 +-
 hw/ssi/trace-events                                |    23 +-
 hw/ssi/xilinx_spi.c                                |     2 +-
 hw/ssi/xilinx_spips.c                              |    19 +-
 hw/ssi/xlnx-versal-ospi.c                          |    12 +-
 hw/timer/Kconfig                                   |     4 -
 hw/timer/a9gtimer.c                                |    13 +-
 hw/timer/allwinner-a10-pit.c                       |     2 +-
 hw/timer/altera_timer.c                            |   244 -
 hw/timer/arm_mptimer.c                             |     4 +-
 hw/timer/arm_timer.c                               |     6 +-
 hw/timer/armv7m_systick.c                          |     2 +-
 hw/timer/aspeed_timer.c                            |     6 +-
 hw/timer/bcm2835_systmr.c                          |     2 +-
 hw/timer/cadence_ttc.c                             |     4 +-
 hw/timer/cmsdk-apb-dualtimer.c                     |     4 +-
 hw/timer/cmsdk-apb-timer.c                         |     2 +-
 hw/timer/digic-timer.c                             |     2 +-
 hw/timer/etraxfs_timer.c                           |     6 +-
 hw/timer/exynos4210_mct.c                          |    25 +-
 hw/timer/exynos4210_pwm.c                          |     4 +-
 hw/timer/grlib_gptimer.c                           |     6 +-
 hw/timer/hpet.c                                    |   362 +-
 hw/timer/i8254.c                                   |     6 -
 hw/timer/i8254_common.c                            |    14 +-
 hw/timer/ibex_timer.c                              |     2 +-
 hw/timer/imx_epit.c                                |     2 +-
 hw/timer/imx_gpt.c                                 |     2 +-
 hw/timer/meson.build                               |    73 +-
 hw/timer/mss-timer.c                               |     4 +-
 hw/timer/npcm7xx_timer.c                           |    13 +-
 hw/timer/nrf51_timer.c                             |     2 +-
 hw/timer/pxa2xx_timer.c                            |     9 +-
 hw/timer/renesas_cmt.c                             |     2 +-
 hw/timer/renesas_tmr.c                             |     4 +-
 hw/timer/sifive_pwm.c                              |     2 +-
 hw/timer/slavio_timer.c                            |     4 +-
 hw/timer/sse-counter.c                             |     2 +-
 hw/timer/sse-timer.c                               |     2 +-
 hw/timer/stellaris-gptm.c                          |     2 +-
 hw/timer/stm32f2xx_timer.c                         |     2 +-
 hw/timer/trace-events                              |    17 +-
 hw/tpm/Kconfig                                     |     7 +
 hw/tpm/meson.build                                 |    13 +-
 hw/tpm/tpm_crb.c                                   |     2 +-
 hw/tpm/tpm_ppi.c                                   |     6 +-
 hw/tpm/tpm_spapr.c                                 |     2 +-
 hw/tpm/tpm_tis.h                                   |     5 +-
 hw/tpm/tpm_tis_common.c                            |    40 +-
 hw/tpm/tpm_tis_i2c.c                               |   571 +
 hw/tpm/tpm_tis_isa.c                               |     4 +-
 hw/tpm/tpm_tis_sysbus.c                            |     5 +-
 hw/tpm/trace-events                                |     6 +
 hw/tricore/Kconfig                                 |     4 +
 hw/tricore/tricore_testboard.c                     |     4 +-
 hw/tricore/tricore_testdevice.c                    |     4 +
 hw/ufs/Kconfig                                     |     4 +
 hw/ufs/lu.c                                        |   446 +
 hw/ufs/meson.build                                 |     1 +
 hw/ufs/trace-events                                |    50 +
 hw/ufs/trace.h                                     |     1 +
 hw/ufs/ufs.c                                       |  1822 ++
 hw/ufs/ufs.h                                       |   233 +
 hw/usb/Kconfig                                     |    17 +-
 hw/usb/bus-stub.c                                  |    28 +
 hw/usb/bus.c                                       |    45 +-
 hw/usb/canokey.c                                   |     2 +-
 hw/usb/canokey.h                                   |     2 +-
 hw/usb/ccid-card-emulated.c                        |     2 +-
 hw/usb/ccid-card-passthru.c                        |     2 +-
 hw/usb/desc.c                                      |     2 +-
 hw/usb/dev-audio.c                                 |     9 +-
 hw/usb/dev-hid.c                                   |     4 +-
 hw/usb/dev-hub.c                                   |    16 +-
 hw/usb/dev-mtp.c                                   |     4 +-
 hw/usb/dev-network.c                               |    11 +-
 hw/usb/dev-smartcard-reader.c                      |     8 +-
 hw/usb/dev-storage-classic.c                       |    14 +-
 hw/usb/dev-storage.c                               |     8 +-
 hw/usb/dev-uas.c                                   |     5 +-
 hw/usb/hcd-dwc2.c                                  |    24 +-
 hw/usb/hcd-dwc3.c                                  |     2 +-
 hw/usb/hcd-ehci-pci.c                              |     6 +-
 hw/usb/hcd-ehci-sysbus.c                           |     4 +-
 hw/usb/hcd-ehci.c                                  |    34 +-
 hw/usb/hcd-ehci.h                                  |     8 +-
 hw/usb/hcd-ohci-pci.c                              |     2 +-
 hw/usb/hcd-ohci-sysbus.c                           |    88 +
 hw/usb/hcd-ohci.c                                  |    77 +-
 hw/usb/hcd-uhci.c                                  |    30 +-
 hw/usb/hcd-uhci.h                                  |     4 +-
 hw/usb/hcd-xhci-nec.c                              |     4 -
 hw/usb/hcd-xhci-pci.c                              |     6 +-
 hw/usb/hcd-xhci-sysbus.c                           |     2 +-
 hw/usb/hcd-xhci.c                                  |    74 +-
 hw/usb/hcd-xhci.h                                  |     4 +-
 hw/usb/host-libusb.c                               |    13 +-
 hw/usb/host.h                                      |    44 -
 hw/usb/imx-usb-phy.c                               |     2 +-
 hw/usb/meson.build                                 |    81 +-
 hw/usb/quirks.h                                    |     2 +-
 hw/usb/redirect.c                                  |    28 +-
 hw/usb/trace-events                                |    10 +-
 hw/usb/u2f-passthru.c                              |     6 +-
 hw/usb/u2f.c                                       |     2 +-
 hw/usb/vt82c686-uhci-pci.c                         |     9 +
 hw/usb/xen-usb.c                                   |    19 +-
 hw/usb/xlnx-versal-usb2-ctrl-regs.c                |     4 +-
 hw/vfio/ap.c                                       |   204 +-
 hw/vfio/ccw.c                                      |   196 +-
 hw/vfio/common.c                                   |  2510 +--
 hw/vfio/container-base.c                           |   142 +
 hw/vfio/container.c                                |  1214 ++
 hw/vfio/cpr.c                                      |    39 +
 hw/vfio/display.c                                  |    87 +-
 hw/vfio/helpers.c                                  |   702 +
 hw/vfio/igd.c                                      |    35 +-
 hw/vfio/iommufd.c                                  |   871 +
 hw/vfio/meson.build                                |     9 +-
 hw/vfio/migration.c                                |   641 +-
 hw/vfio/pci-quirks.c                               |   210 +-
 hw/vfio/pci.c                                      |   909 +-
 hw/vfio/pci.h                                      |    27 +-
 hw/vfio/platform.c                                 |   142 +-
 hw/vfio/spapr.c                                    |   353 +-
 hw/vfio/trace-events                               |    46 +-
 hw/virtio/Kconfig                                  |    24 +-
 hw/virtio/meson.build                              |    73 +-
 hw/virtio/trace-events                             |    31 +-
 hw/virtio/vdpa-dev.c                               |    21 +-
 hw/virtio/vhost-backend.c                          |    34 +-
 hw/virtio/vhost-shadow-virtqueue.c                 |    58 +-
 hw/virtio/vhost-shadow-virtqueue.h                 |     3 +-
 hw/virtio/vhost-stub.c                             |     9 +-
 hw/virtio/vhost-user-base.c                        |   374 +
 hw/virtio/vhost-user-device-pci.c                  |    72 +
 hw/virtio/vhost-user-device.c                      |    64 +
 hw/virtio/vhost-user-fs.c                          |   108 +-
 hw/virtio/vhost-user-gpio.c                        |   400 +-
 hw/virtio/vhost-user-i2c.c                         |   256 +-
 hw/virtio/vhost-user-input-pci.c                   |     3 -
 hw/virtio/vhost-user-input.c                       |    58 +
 hw/virtio/vhost-user-rng.c                         |   278 +-
 hw/virtio/vhost-user-scmi-pci.c                    |    68 +
 hw/virtio/vhost-user-scmi.c                        |   313 +
 hw/virtio/vhost-user-snd-pci.c                     |    75 +
 hw/virtio/vhost-user-snd.c                         |    67 +
 hw/virtio/vhost-user-vsock.c                       |     2 +
 hw/virtio/vhost-user.c                             |   801 +-
 hw/virtio/vhost-vdpa.c                             |   432 +-
 hw/virtio/vhost-vsock-common.c                     |     7 +-
 hw/virtio/vhost-vsock.c                            |     3 +-
 hw/virtio/vhost.c                                  |   513 +-
 hw/virtio/virtio-acpi.c                            |    34 +
 hw/virtio/virtio-balloon.c                         |    52 +-
 hw/virtio/virtio-crypto.c                          |    16 +-
 hw/virtio/virtio-input-pci.c                       |    25 +-
 hw/virtio/virtio-iommu-pci.c                       |    16 +-
 hw/virtio/virtio-iommu.c                           |   444 +-
 hw/virtio/virtio-md-pci.c                          |   151 +
 hw/virtio/virtio-md-stubs.c                        |    24 +
 hw/virtio/virtio-mem-pci.c                         |    81 +-
 hw/virtio/virtio-mem-pci.h                         |     6 +-
 hw/virtio/virtio-mem.c                             |   553 +-
 hw/virtio/virtio-mmio.c                            |    24 +-
 hw/virtio/virtio-pci.c                             |   182 +-
 hw/virtio/virtio-pmem-pci.c                        |    11 +-
 hw/virtio/virtio-pmem-pci.h                        |     6 +-
 hw/virtio/virtio-pmem.c                            |     3 +-
 hw/virtio/virtio-qmp.c                             |   147 +-
 hw/virtio/virtio-qmp.h                             |     7 -
 hw/virtio/virtio-rng.c                             |     7 +-
 hw/virtio/virtio.c                                 |   475 +-
 hw/watchdog/Kconfig                                |     4 +
 hw/watchdog/allwinner-wdt.c                        |   416 +
 hw/watchdog/cmsdk-apb-watchdog.c                   |     2 +-
 hw/watchdog/meson.build                            |    17 +-
 hw/watchdog/sbsa_gwdt.c                            |    17 +-
 hw/watchdog/spapr_watchdog.c                       |     2 +-
 hw/watchdog/trace-events                           |    13 +
 hw/watchdog/wdt_aspeed.c                           |    27 +-
 hw/watchdog/wdt_diag288.c                          |     2 +-
 hw/watchdog/wdt_i6300esb.c                         |     2 +-
 hw/watchdog/wdt_ib700.c                            |     2 +-
 hw/watchdog/wdt_imx2.c                             |    30 +-
 hw/xen/meson.build                                 |     8 +-
 hw/xen/trace-events                                |    38 +
 hw/xen/xen-backend.c                               |    27 +-
 hw/xen/xen-bus.c                                   |    42 +-
 hw/xen/xen-host-pci-device.c                       |    76 +-
 hw/xen/xen-host-pci-device.h                       |     6 +
 hw/xen/xen-hvm-common.c                            |   900 +
 hw/xen/xen-legacy-backend.c                        |    25 +-
 hw/xen/xen-mapcache.c                              |   772 +
 hw/xen/xen-operations.c                            |    57 +-
 hw/xen/xen_devconfig.c                             |    53 -
 hw/xen/xen_pt.c                                    |    20 +-
 hw/xen/xen_pt.h                                    |    32 +-
 hw/xen/xen_pt_config_init.c                        |    10 +-
 hw/xen/xen_pt_graphics.c                           |     3 +-
 hw/xen/xen_pt_load_rom.c                           |     2 +-
 hw/xen/xen_pt_stub.c                               |     2 +-
 hw/xen/xen_pvdev.c                                 |     2 +-
 hw/xenpv/xen_machine_pv.c                          |    26 +-
 hw/xtensa/Kconfig                                  |     7 +
 hw/xtensa/bootparam.h                              |     2 +
 hw/xtensa/pic_cpu.c                                |     1 +
 hw/xtensa/sim.c                                    |     7 +-
 hw/xtensa/virt.c                                   |    17 +-
 hw/xtensa/xtfpga.c                                 |    32 +-
 include/block/accounting.h                         |     1 +
 include/block/aio-wait.h                           |    20 +-
 include/block/aio.h                                |   127 +-
 include/block/block-common.h                       |    74 +
 include/block/block-copy.h                         |     2 +
 include/block/block-global-state.h                 |   155 +-
 include/block/block-io.h                           |   148 +-
 include/block/block_int-common.h                   |   300 +-
 include/block/block_int-global-state.h             |    42 +-
 include/block/block_int-io.h                       |    26 +-
 include/block/blockjob.h                           |    22 +-
 include/block/blockjob_int.h                       |    35 +-
 include/block/export.h                             |     2 +
 include/block/graph-lock.h                         |    46 +-
 include/block/nbd.h                                |   225 +-
 include/block/nvme.h                               |    38 +-
 include/block/qapi.h                               |    33 +-
 include/block/raw-aio.h                            |    29 +-
 include/block/snapshot.h                           |    26 +-
 include/block/thread-pool.h                        |    15 +-
 include/block/throttle-groups.h                    |     6 +-
 include/block/ufs.h                                |  1215 ++
 include/chardev/char-fe.h                          |    40 +-
 include/chardev/char.h                             |     3 -
 include/crypto/aes-round.h                         |   164 +
 include/crypto/aes.h                               |    25 +-
 include/crypto/akcipher.h                          |     2 +-
 include/crypto/block.h                             |    18 +-
 include/crypto/clmul.h                             |    83 +
 include/crypto/ivgen.h                             |     4 +-
 include/crypto/secret_common.h                     |    14 +-
 include/crypto/sm4.h                               |     9 +
 include/crypto/tlssession.h                        |    33 +-
 include/disas/capstone.h                           |     1 +
 include/disas/dis-asm.h                            |    15 +-
 include/disas/disas.h                              |    30 +-
 include/elf.h                                      |    70 +-
 include/exec/abi_ptr.h                             |    33 +
 include/exec/address-spaces.h                      |     2 -
 include/exec/breakpoint.h                          |    30 +
 include/exec/confidential-guest-support.h          |    39 +-
 include/exec/cpu-all.h                             |   315 +-
 include/exec/cpu-common.h                          |   156 +-
 include/exec/cpu-defs.h                            |   183 +-
 include/exec/cpu_ldst.h                            |   229 +-
 include/exec/cputlb.h                              |     6 +-
 include/exec/exec-all.h                            |   402 +-
 include/exec/gdbstub.h                             |   138 +-
 include/exec/gen-icount.h                          |    83 -
 include/exec/helper-gen-common.h                   |    14 +
 include/exec/helper-gen.h                          |    97 +-
 include/exec/helper-gen.h.inc                      |   110 +
 include/exec/helper-head.h                         |   147 -
 include/exec/helper-head.h.inc                     |   135 +
 include/exec/helper-info.c.inc                     |    96 +
 include/exec/helper-proto-common.h                 |    16 +
 include/exec/helper-proto.h                        |    73 +-
 include/exec/helper-proto.h.inc                    |    68 +
 include/exec/helper-tcg.h                          |    75 -
 include/exec/ioport.h                              |     4 +-
 include/exec/memattrs.h                            |    21 +-
 include/exec/memop.h                               |    56 +-
 include/exec/memory.h                              |   281 +-
 include/exec/memory_ldst.h.inc                     |    42 +-
 include/exec/mmu-access-type.h                     |    18 +
 include/exec/page-protection.h                     |    41 +
 include/exec/page-vary.h                           |     4 +-
 include/exec/plugin-gen.h                          |    39 +-
 include/exec/poison.h                              |     5 -
 include/exec/ram_addr.h                            |    50 +-
 include/exec/ramblock.h                            |    19 +-
 include/exec/target_long.h                         |     2 +
 include/exec/target_page.h                         |     2 +
 include/exec/tb-flush.h                            |     2 +
 include/exec/tlb-common.h                          |    56 +
 include/exec/translate-all.h                       |     1 -
 include/exec/translation-block.h                   |   155 +
 include/exec/translator.h                          |   105 +-
 include/exec/tswap.h                               |    82 +
 include/exec/user/abitypes.h                       |    71 -
 include/exec/user/thunk.h                          |   203 -
 include/exec/vaddr.h                               |    18 +
 include/fpu/softfloat.h                            |    15 +
 include/gdbstub/commands.h                         |   108 +
 include/gdbstub/enums.h                            |    21 +
 include/gdbstub/helpers.h                          |    12 +-
 include/gdbstub/syscalls.h                         |     9 +
 include/gdbstub/user.h                             |    30 +-
 include/glib-compat.h                              |    27 +-
 include/hw/acpi/acpi-defs.h                        |    33 +
 include/hw/acpi/acpi_dev_interface.h               |     3 -
 include/hw/acpi/acpi_generic_initiator.h           |    47 +
 include/hw/acpi/aml-build.h                        |     6 +-
 include/hw/acpi/cpu.h                              |    14 +-
 include/hw/acpi/cxl.h                              |     1 +
 include/hw/acpi/generic_event_device.h             |     7 +-
 include/hw/acpi/ich9_tco.h                         |     1 +
 include/hw/acpi/memory_hotplug.h                   |     1 +
 include/hw/acpi/pc-hotplug.h                       |     2 +-
 include/hw/acpi/pcihp.h                            |     2 +-
 include/hw/acpi/tpm.h                              |    41 +
 include/hw/acpi/vmgenid.h                          |     2 +-
 include/hw/adc/aspeed_adc.h                        |     1 +
 include/hw/arm/allwinner-a10.h                     |     5 +-
 include/hw/arm/allwinner-h3.h                      |     6 +-
 include/hw/arm/allwinner-r40.h                     |   157 +
 include/hw/arm/armsse.h                            |     5 +
 include/hw/arm/armv7m.h                            |     9 +
 include/hw/arm/aspeed_soc.h                        |    93 +-
 include/hw/arm/bcm2835_peripherals.h               |    39 +-
 include/hw/arm/bcm2836.h                           |    27 +-
 include/hw/arm/bcm2838.h                           |    31 +
 include/hw/arm/bcm2838_peripherals.h               |    84 +
 include/hw/arm/bsa.h                               |    35 +
 include/hw/arm/exynos4210.h                        |     2 +-
 include/hw/arm/fsl-imx25.h                         |     1 -
 include/hw/arm/fsl-imx31.h                         |     1 -
 include/hw/arm/fsl-imx6.h                          |    45 +-
 include/hw/arm/fsl-imx6ul.h                        |   140 +-
 include/hw/arm/fsl-imx7.h                          |   338 +-
 include/hw/arm/msf2-soc.h                          |     3 -
 include/hw/arm/npcm7xx.h                           |     2 +
 include/hw/arm/omap.h                              |     4 +-
 include/hw/arm/pxa.h                               |     2 -
 include/hw/arm/raspberrypi-fw-defs.h               |   175 +
 include/hw/arm/raspi_platform.h                    |    48 +-
 include/hw/arm/smmu-common.h                       |    86 +-
 include/hw/arm/smmuv3.h                            |     4 +
 include/hw/arm/stm32f100_soc.h                     |     4 -
 include/hw/arm/stm32f205_soc.h                     |     4 -
 include/hw/arm/stm32f405_soc.h                     |     4 -
 include/hw/arm/stm32l4x5_soc.h                     |    74 +
 include/hw/arm/virt.h                              |    22 +-
 include/hw/arm/xen_arch_hvm.h                      |     9 +
 include/hw/arm/xlnx-versal.h                       |   104 +-
 include/hw/arm/xlnx-zynqmp.h                       |     3 +-
 include/hw/audio/asc.h                             |    85 +
 include/hw/audio/pcspk.h                           |    10 -
 include/hw/audio/soundhw.h                         |     2 +-
 include/hw/audio/virtio-snd.h                      |   250 +
 include/hw/block/block.h                           |     4 +-
 include/hw/block/fdc.h                             |     3 +
 include/hw/block/flash.h                           |     6 +
 include/hw/block/swim.h                            |    21 +-
 include/hw/boards.h                                |   377 +-
 include/hw/char/avr_usart.h                        |     2 +-
 include/hw/char/escc.h                             |     1 +
 include/hw/char/grlib_uart.h                       |    32 +
 include/hw/char/imx_serial.h                       |    21 +-
 include/hw/char/parallel-isa.h                     |    35 +
 include/hw/char/parallel.h                         |    19 +
 include/hw/char/riscv_htif.h                       |     3 +
 include/hw/char/serial.h                           |     2 +
 include/hw/char/stm32f2xx_usart.h                  |    10 +-
 include/hw/char/stm32l4x5_usart.h                  |    67 +
 include/hw/clock.h                                 |     6 +-
 include/hw/core/accel-cpu.h                        |     2 +-
 include/hw/core/cpu.h                              |   365 +-
 include/hw/core/resetcontainer.h                   |    48 +
 include/hw/core/sysemu-cpu-ops.h                   |     2 +-
 include/hw/core/tcg-cpu-ops.h                      |   134 +-
 include/hw/cris/etraxfs.h                          |     2 +-
 include/hw/cxl/cxl.h                               |    11 +-
 include/hw/cxl/cxl_cdat.h                          |    27 +-
 include/hw/cxl/cxl_component.h                     |    90 +-
 include/hw/cxl/cxl_device.h                        |   464 +-
 include/hw/cxl/cxl_events.h                        |   187 +
 include/hw/cxl/cxl_mailbox.h                       |    18 +
 include/hw/cxl/cxl_pci.h                           |    74 +-
 include/hw/display/bcm2835_fb.h                    |     2 +
 include/hw/display/dm163.h                         |    59 +
 include/hw/display/ramfb.h                         |     4 +
 include/hw/dma/i8257.h                             |     2 +-
 include/hw/elf_ops.h                               |   624 -
 include/hw/elf_ops.h.inc                           |   627 +
 include/hw/firmware/smbios.h                       |    45 +-
 include/hw/fsi/aspeed_apb2opb.h                    |    46 +
 include/hw/fsi/cfam.h                              |    34 +
 include/hw/fsi/fsi-master.h                        |    32 +
 include/hw/fsi/fsi.h                               |    37 +
 include/hw/fsi/lbus.h                              |    43 +
 include/hw/gpio/aspeed_gpio.h                      |     1 +
 include/hw/gpio/bcm2838_gpio.h                     |    45 +
 include/hw/gpio/nrf51_gpio.h                       |     1 +
 include/hw/gpio/pca9552.h                          |    38 +
 include/hw/gpio/pca9552_regs.h                     |    32 +
 include/hw/gpio/pca9554.h                          |    36 +
 include/hw/gpio/pca9554_regs.h                     |    19 +
 include/hw/gpio/pcf8574.h                          |    15 +
 include/hw/gpio/stm32l4x5_gpio.h                   |    71 +
 include/hw/hyperv/dynmem-proto.h                   |   430 +
 include/hw/hyperv/hv-balloon.h                     |    18 +
 include/hw/hyperv/hyperv.h                         |     4 +
 include/hw/hyperv/vmbus.h                          |     2 +-
 include/hw/i2c/aspeed_i2c.h                        |    18 +-
 include/hw/i2c/bcm2835_i2c.h                       |    80 +
 include/hw/i2c/npcm7xx_smbus.h                     |     2 +-
 include/hw/i2c/pmbus_device.h                      |    17 +
 include/hw/i2c/pnv_i2c_regs.h                      |   143 +
 include/hw/i386/apic.h                             |     9 +-
 include/hw/i386/apic_internal.h                    |     9 +-
 include/hw/i386/intel_iommu.h                      |     2 +
 include/hw/i386/pc.h                               |   142 +-
 include/hw/i386/sgx-epc.h                          |     1 +
 include/hw/i386/topology.h                         |    93 +-
 include/hw/i386/x86.h                              |    34 +-
 include/hw/i386/xen_arch_hvm.h                     |    11 +
 include/hw/ide.h                                   |     9 -
 include/hw/ide/ahci-pci.h                          |    22 +
 include/hw/ide/ahci-sysbus.h                       |    35 +
 include/hw/ide/ahci.h                              |    38 +-
 include/hw/ide/ide-bus.h                           |    42 +
 include/hw/ide/ide-dev.h                           |   186 +
 include/hw/ide/ide-dma.h                           |    37 +
 include/hw/ide/internal.h                          |   656 -
 include/hw/ide/pci.h                               |     4 +-
 include/hw/input/gamepad.h                         |    18 -
 include/hw/input/i8042.h                           |     1 -
 include/hw/input/stellaris_gamepad.h               |    37 +
 include/hw/intc/arm_gic.h                          |     2 +
 include/hw/intc/arm_gic_common.h                   |     2 +
 include/hw/intc/arm_gicv3_common.h                 |    24 +
 include/hw/intc/arm_gicv3_its_common.h             |     9 +
 include/hw/intc/armv7m_nvic.h                      |     4 +-
 include/hw/intc/aspeed_intc.h                      |    44 +
 include/hw/intc/grlib_irqmp.h                      |    41 +
 include/hw/intc/i8259.h                            |     2 +
 include/hw/intc/intc.h                             |     2 +-
 include/hw/intc/loongarch_extioi.h                 |    35 +-
 include/hw/intc/loongarch_ipi.h                    |    50 +-
 include/hw/intc/loongson_ipi.h                     |    31 +
 include/hw/intc/loongson_ipi_common.h              |    74 +
 include/hw/intc/m68k_irqc.h                        |     1 +
 include/hw/intc/nios2_vic.h                        |    66 -
 include/hw/kvm/clock.h                             |    28 -
 include/hw/loader.h                                |     7 +-
 include/hw/loongarch/boot.h                        |   119 +
 include/hw/loongarch/virt.h                        |    40 +-
 include/hw/m68k/mcf.h                              |     4 +-
 include/hw/m68k/q800-glue.h                        |    51 +
 include/hw/m68k/q800.h                             |    78 +
 include/hw/mem/memory-device.h                     |    65 +-
 include/hw/mem/nvdimm.h                            |     6 +
 include/hw/mem/pc-dimm.h                           |     3 +-
 include/hw/mips/bios.h                             |    14 -
 include/hw/mips/cpudevs.h                          |    14 -
 include/hw/misc/allwinner-r40-ccu.h                |    65 +
 include/hw/misc/allwinner-r40-dramc.h              |   108 +
 include/hw/misc/allwinner-sramc.h                  |    69 +
 include/hw/misc/aspeed_scu.h                       |    53 +-
 include/hw/misc/aspeed_sdmc.h                      |     5 +-
 include/hw/misc/aspeed_sli.h                       |    27 +
 include/hw/misc/auxbus.h                           |     2 +-
 include/hw/misc/bcm2835_property.h                 |     3 +
 include/hw/misc/djmemc.h                           |    30 +
 include/hw/misc/imx7_snvs.h                        |     7 +-
 include/hw/misc/imx7_src.h                         |    66 +
 include/hw/misc/iosb.h                             |    25 +
 include/hw/misc/lasi.h                             |     5 +-
 include/hw/misc/mac_via.h                          |     3 +
 include/hw/misc/macio/macio.h                      |     9 +-
 include/hw/misc/macio/pmu.h                        |     2 +-
 include/hw/misc/mips_itu.h                         |     4 -
 include/hw/misc/mps2-scc.h                         |     1 +
 include/hw/misc/pca9552.h                          |    37 -
 include/hw/misc/pca9552_regs.h                     |    32 -
 include/hw/misc/pvpanic.h                          |     6 +
 include/hw/misc/sifive_e_aon.h                     |    60 +
 include/hw/misc/stm32l4x5_exti.h                   |    53 +
 include/hw/misc/stm32l4x5_rcc.h                    |   239 +
 include/hw/misc/stm32l4x5_rcc_internals.h          |  1042 +
 include/hw/misc/stm32l4x5_syscfg.h                 |    53 +
 include/hw/misc/xlnx-cfi-if.h                      |    58 +
 include/hw/misc/xlnx-versal-cframe-reg.h           |   303 +
 include/hw/misc/xlnx-versal-cfu.h                  |   258 +
 include/hw/misc/xlnx-versal-crl.h                  |     4 +-
 include/hw/misc/xlnx-versal-pmc-iou-slcr.h         |     2 +-
 include/hw/misc/xlnx-versal-trng.h                 |    58 +
 include/hw/net/dp8393x.h                           |    60 +
 include/hw/net/ftgmac100.h                         |    17 +-
 include/hw/net/imx_fec.h                           |     2 +
 include/hw/net/lan9118.h                           |     2 +-
 include/hw/net/lasi_82596.h                        |     4 +-
 include/hw/net/mii.h                               |     2 +-
 include/hw/net/ne2000-isa.h                        |     2 -
 include/hw/net/npcm_gmac.h                         |   343 +
 include/hw/net/smc91c111.h                         |     2 +-
 include/hw/net/xlnx-versal-canfd.h                 |    87 +
 include/hw/nubus/nubus-virtio-mmio.h               |    36 +
 include/hw/nubus/nubus.h                           |     2 +-
 include/hw/nvram/bcm2835_otp.h                     |    68 +
 include/hw/nvram/fw_cfg.h                          |     2 +
 include/hw/nvram/fw_cfg_acpi.h                     |    14 +
 include/hw/nvram/npcm7xx_otp.h                     |     4 +-
 include/hw/nvram/xlnx-bbram.h                      |     2 +-
 include/hw/nvram/xlnx-efuse.h                      |     2 +-
 include/hw/nvram/xlnx-versal-efuse.h               |     4 +-
 include/hw/nvram/xlnx-zynqmp-efuse.h               |     2 +-
 include/hw/pci-bridge/cxl_upstream_port.h          |    19 +
 include/hw/pci-host/articia.h                      |    17 +
 include/hw/pci-host/astro.h                        |    94 +
 include/hw/pci-host/dino.h                         |     2 +-
 include/hw/pci-host/gpex.h                         |    28 +-
 include/hw/pci-host/i440fx.h                       |    16 +-
 include/hw/pci-host/ls7a.h                         |     2 +
 include/hw/pci-host/pam.h                          |     5 +-
 include/hw/pci-host/pnv_phb3.h                     |     2 +-
 include/hw/pci-host/pnv_phb4.h                     |     4 +-
 include/hw/pci-host/pnv_phb4_regs.h                |     4 +-
 include/hw/pci-host/ppc4xx.h                       |    17 +
 include/hw/pci-host/q35.h                          |     7 +-
 include/hw/pci-host/spapr.h                        |    45 -
 include/hw/pci/pci.h                               |    98 +-
 include/hw/pci/pci_bridge.h                        |    33 +-
 include/hw/pci/pci_bus.h                           |     2 +-
 include/hw/pci/pci_device.h                        |     7 +
 include/hw/pci/pci_host.h                          |     2 +
 include/hw/pci/pci_ids.h                           |     3 +
 include/hw/pci/pcie.h                              |     6 +-
 include/hw/pci/pcie_aer.h                          |    40 +-
 include/hw/pci/pcie_doe.h                          |     5 +
 include/hw/pci/pcie_regs.h                         |     2 +
 include/hw/pci/pcie_sriov.h                        |    12 +-
 include/hw/pci/shpc.h                              |     2 +-
 include/hw/ppc/fdt.h                               |     8 +-
 include/hw/ppc/openpic.h                           |     4 +-
 include/hw/ppc/pef.h                               |    17 -
 include/hw/ppc/pnv.h                               |    13 +-
 include/hw/ppc/pnv_adu.h                           |    32 +
 include/hw/ppc/pnv_chip.h                          |    32 +-
 include/hw/ppc/pnv_chiptod.h                       |    53 +
 include/hw/ppc/pnv_core.h                          |    50 +-
 include/hw/ppc/pnv_i2c.h                           |    38 +
 include/hw/ppc/pnv_lpc.h                           |    22 +-
 include/hw/ppc/pnv_n1_chiplet.h                    |    32 +
 include/hw/ppc/pnv_nest_pervasive.h                |    32 +
 include/hw/ppc/pnv_psi.h                           |     2 +-
 include/hw/ppc/pnv_xive.h                          |     4 +-
 include/hw/ppc/pnv_xscom.h                         |    52 +-
 include/hw/ppc/ppc.h                               |     6 +-
 include/hw/ppc/ppc4xx.h                            |     2 -
 include/hw/ppc/spapr.h                             |   114 +-
 include/hw/ppc/spapr_cpu_core.h                    |     5 +-
 include/hw/ppc/spapr_irq.h                         |    18 +-
 include/hw/ppc/spapr_nested.h                      |   524 +
 include/hw/ppc/spapr_rtas.h                        |    10 -
 include/hw/ppc/xics.h                              |     4 +-
 include/hw/ppc/xive.h                              |    10 +-
 include/hw/ppc/xive2_regs.h                        |    19 +-
 include/hw/ppc/xive_regs.h                         |    24 +-
 include/hw/qdev-core.h                             |   459 +-
 include/hw/qdev-properties-system.h                |    20 +
 include/hw/qdev-properties.h                       |    42 +-
 include/hw/rdma/rdma.h                             |    37 -
 include/hw/resettable.h                            |     5 +-
 include/hw/riscv/opentitan.h                       |     6 +-
 include/hw/riscv/riscv_hart.h                      |     2 +-
 include/hw/riscv/sifive_e.h                        |     9 +-
 include/hw/riscv/virt.h                            |    27 +
 include/hw/rtc/aspeed_rtc.h                        |     2 +-
 include/hw/rtc/mc146818rtc.h                       |     2 +-
 include/hw/rtc/sun4v-rtc.h                         |     2 +-
 include/hw/rx/rx62n.h                              |     2 -
 include/hw/s390x/adapter.h                         |     4 +-
 include/hw/s390x/cpu-topology.h                    |    83 +
 include/hw/s390x/css.h                             |     8 +-
 include/hw/s390x/event-facility.h                  |     2 +-
 include/hw/s390x/pv.h                              |    96 -
 include/hw/s390x/s390-ccw.h                        |     2 +-
 include/hw/s390x/s390-pci-bus.h                    |     4 +-
 include/hw/s390x/s390-virtio-ccw.h                 |    16 +-
 include/hw/s390x/s390_flic.h                       |     5 +-
 include/hw/s390x/sclp.h                            |    17 +-
 include/hw/s390x/storage-attributes.h              |     2 +-
 include/hw/s390x/storage-keys.h                    |    10 +
 include/hw/s390x/vfio-ccw.h                        |     2 -
 include/hw/scsi/esp.h                              |    18 +-
 include/hw/scsi/scsi.h                             |    27 +-
 include/hw/sd/allwinner-sdhost.h                   |     9 +
 include/hw/sd/sd.h                                 |    14 +-
 include/hw/southbridge/ich9.h                      |     2 +
 include/hw/southbridge/piix.h                      |    32 +-
 include/hw/sparc/grlib.h                           |    45 -
 include/hw/ssi/aspeed_smc.h                        |     3 +
 include/hw/ssi/bcm2835_spi.h                       |    81 +
 include/hw/ssi/pnv_spi.h                           |    67 +
 include/hw/ssi/pnv_spi_regs.h                      |   133 +
 include/hw/ssi/ssi.h                               |     5 +
 include/hw/ssi/xilinx_spips.h                      |     5 +-
 include/hw/ssi/xlnx-versal-ospi.h                  |     2 +-
 include/hw/sysbus.h                                |     3 -
 include/hw/timer/grlib_gptimer.h                   |    32 +
 include/hw/timer/hpet.h                            |     2 +
 include/hw/tricore/tricore_testdevice.h            |     3 -
 include/hw/usb.h                                   |    28 +-
 include/hw/vfio/vfio-common.h                      |   176 +-
 include/hw/vfio/vfio-container-base.h              |   165 +
 include/hw/vfio/vfio.h                             |     7 -
 include/hw/virtio/vhost-backend.h                  |    52 +-
 include/hw/virtio/vhost-scsi-common.h              |     2 +-
 include/hw/virtio/vhost-user-base.h                |    49 +
 include/hw/virtio/vhost-user-gpio.h                |    25 +-
 include/hw/virtio/vhost-user-i2c.h                 |    14 +-
 include/hw/virtio/vhost-user-rng.h                 |    13 +-
 include/hw/virtio/vhost-user-scmi.h                |    31 +
 include/hw/virtio/vhost-user-scsi.h                |     6 +
 include/hw/virtio/vhost-user-snd.h                 |    24 +
 include/hw/virtio/vhost-user.h                     |    24 +
 include/hw/virtio/vhost-vdpa.h                     |    53 +-
 include/hw/virtio/vhost-vsock-common.h             |     1 +
 include/hw/virtio/vhost.h                          |   130 +-
 include/hw/virtio/virtio-acpi.h                    |    15 +
 include/hw/virtio/virtio-blk.h                     |    21 +-
 include/hw/virtio/virtio-dmabuf.h                  |   100 +
 include/hw/virtio/virtio-gpu-bswap.h               |    18 +
 include/hw/virtio/virtio-gpu.h                     |    66 +-
 include/hw/virtio/virtio-input.h                   |    17 +-
 include/hw/virtio/virtio-iommu.h                   |    13 +-
 include/hw/virtio/virtio-md-pci.h                  |    44 +
 include/hw/virtio/virtio-mem.h                     |    33 +-
 include/hw/virtio/virtio-net.h                     |    13 +-
 include/hw/virtio/virtio-pci.h                     |    10 +
 include/hw/virtio/virtio-scsi.h                    |    18 +-
 include/hw/virtio/virtio.h                         |    66 +-
 include/hw/watchdog/allwinner-wdt.h                |   123 +
 include/hw/watchdog/sbsa_gwdt.h                    |     3 +-
 include/hw/watchdog/wdt_aspeed.h                   |     3 +-
 include/hw/xen/arch_hvm.h                          |     5 +
 include/hw/xen/interface/arch-arm.h                |    37 +-
 include/hw/xen/interface/arch-x86/cpuid.h          |    31 +-
 include/hw/xen/interface/arch-x86/xen-x86_32.h     |    19 +-
 include/hw/xen/interface/arch-x86/xen-x86_64.h     |    19 +-
 include/hw/xen/interface/arch-x86/xen.h            |    26 +-
 include/hw/xen/interface/event_channel.h           |    19 +-
 include/hw/xen/interface/features.h                |    19 +-
 include/hw/xen/interface/grant_table.h             |    19 +-
 include/hw/xen/interface/hvm/hvm_op.h              |    19 +-
 include/hw/xen/interface/hvm/params.h              |    19 +-
 include/hw/xen/interface/io/blkif.h                |    27 +-
 include/hw/xen/interface/io/console.h              |    19 +-
 include/hw/xen/interface/io/fbif.h                 |    19 +-
 include/hw/xen/interface/io/kbdif.h                |    19 +-
 include/hw/xen/interface/io/netif.h                |    25 +-
 include/hw/xen/interface/io/protocols.h            |    19 +-
 include/hw/xen/interface/io/ring.h                 |    49 +-
 include/hw/xen/interface/io/usbif.h                |    19 +-
 include/hw/xen/interface/io/xenbus.h               |    19 +-
 include/hw/xen/interface/io/xs_wire.h              |    36 +-
 include/hw/xen/interface/memory.h                  |    30 +-
 include/hw/xen/interface/physdev.h                 |    23 +-
 include/hw/xen/interface/sched.h                   |    19 +-
 include/hw/xen/interface/trace.h                   |    19 +-
 include/hw/xen/interface/vcpu.h                    |    19 +-
 include/hw/xen/interface/version.h                 |    19 +-
 include/hw/xen/interface/xen-compat.h              |    19 +-
 include/hw/xen/interface/xen.h                     |    19 +-
 include/hw/xen/xen-backend.h                       |     1 +
 include/hw/xen/xen-bus.h                           |     3 +
 include/hw/xen/xen-hvm-common.h                    |   101 +
 include/hw/xen/xen-legacy-backend.h                |    17 +-
 include/hw/xen/xen.h                               |     3 +-
 include/hw/xen/xen_igd.h                           |    33 +
 include/hw/xen/xen_native.h                        |   135 +-
 include/hw/xen/xen_pvdev.h                         |     3 +-
 include/io/channel-file.h                          |    18 +
 include/io/channel-socket.h                        |     4 +-
 include/io/channel-util.h                          |    23 +
 include/io/channel.h                               |   251 +-
 include/io/task.h                                  |     4 +-
 include/migration/blocker.h                        |    66 +-
 include/migration/client-options.h                 |    25 +
 include/migration/colo.h                           |    18 +-
 include/migration/global_state.h                   |     2 +-
 include/migration/misc.h                           |    66 +-
 include/migration/qemu-file-types.h                |    18 +-
 include/migration/register.h                       |   274 +-
 include/migration/snapshot.h                       |     7 +
 include/migration/vmstate.h                        |    64 +-
 include/monitor/hmp-target.h                       |    11 +-
 include/monitor/hmp.h                              |     7 +-
 include/monitor/monitor.h                          |     6 +-
 include/net/announce.h                             |     4 +-
 include/net/eth.h                                  |    23 +-
 include/net/filter.h                               |     2 +-
 include/net/net.h                                  |    93 +-
 include/net/vhost_net.h                            |     3 -
 include/qapi/clone-visitor.h                       |    37 +-
 include/qapi/error.h                               |     2 +-
 include/qapi/qmp/dispatch.h                        |     4 +-
 include/qapi/qmp/qerror.h                          |    30 -
 include/qapi/qmp/qobject.h                         |    10 +-
 include/qapi/string-output-visitor.h               |     6 +-
 include/qapi/type-helpers.h                        |     8 +
 include/qapi/util.h                                |    13 +
 include/qapi/visitor.h                             |     2 +-
 include/qemu/accel.h                               |    12 +-
 include/qemu/atomic.h                              |    78 +-
 include/qemu/atomic128.h                           |   150 +-
 include/qemu/bitmap.h                              |    19 +-
 include/qemu/bitops.h                              |    29 +-
 include/qemu/bswap.h                               |    48 +-
 include/qemu/chardev_open.h                        |    16 +
 include/qemu/compiler.h                            |    76 +
 include/qemu/config-file.h                         |     3 +
 include/qemu/coroutine-core.h                      |     2 +-
 include/qemu/coroutine.h                           |     6 +-
 include/qemu/cpuid.h                               |    21 +
 include/qemu/crc-ccitt.h                           |     4 +-
 include/qemu/crc32c.h                              |     1 +
 include/qemu/cutils.h                              |    57 +-
 include/qemu/defer-call.h                          |    16 +
 include/qemu/fifo8.h                               |    84 +-
 include/qemu/guest-random.h                        |     8 +-
 include/qemu/help-texts.h                          |     2 +-
 include/qemu/host-utils.h                          |    75 +-
 include/qemu/int128.h                              |    10 +-
 include/qemu/iov.h                                 |     8 +-
 include/qemu/iova-tree.h                           |     4 +-
 include/qemu/job.h                                 |    22 +-
 include/qemu/lockable.h                            |    27 +-
 include/qemu/log.h                                 |     2 +
 include/qemu/main-loop.h                           |    75 +-
 include/qemu/mmap-alloc.h                          |     7 +
 include/qemu/notify.h                              |     8 +-
 include/qemu/option.h                              |     2 +
 include/qemu/osdep.h                               |   116 +-
 include/qemu/plugin-memory.h                       |    13 +-
 include/qemu/plugin.h                              |   140 +-
 include/qemu/processor.h                           |     2 -
 include/qemu/qemu-options.h                        |    41 -
 include/qemu/qemu-plugin.h                         |   367 +-
 include/qemu/qtree.h                               |     1 -
 include/qemu/range.h                               |    29 +-
 include/qemu/rcu.h                                 |    19 +-
 include/qemu/reserved-region.h                     |    32 +
 include/qemu/selfmap.h                             |    24 +-
 include/qemu/stats64.h                             |     6 +
 include/qemu/sys_membarrier.h                      |     4 +-
 include/qemu/thread.h                              |     2 +-
 include/qemu/throttle.h                            |    16 +-
 include/qemu/timer.h                               |    55 +-
 include/qemu/typedefs.h                            |    32 +-
 include/qemu/uri.h                                 |   103 -
 include/qemu/uuid.h                                |     7 +-
 include/qemu/vhost-user-server.h                   |    10 +-
 include/qemu/xxhash.h                              |    23 +-
 include/qemu/yank.h                                |     4 +-
 include/qom/object.h                               |   117 +-
 include/qom/object_interfaces.h                    |    16 +-
 include/scsi/constants.h                           |     1 +
 include/semihosting/semihost.h                     |     2 +-
 include/semihosting/softmmu-uaccess.h              |    59 -
 include/semihosting/syscalls.h                     |     2 +
 include/semihosting/uaccess.h                      |    66 +
 include/standard-headers/asm-x86/bootparam.h       |    17 +-
 include/standard-headers/asm-x86/kvm_para.h        |     3 +-
 include/standard-headers/asm-x86/setup_data.h      |    83 +
 .../infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h      |   685 -
 .../infiniband/hw/vmw_pvrdma/pvrdma_verbs.h        |   348 -
 include/standard-headers/drm/drm_fourcc.h          |    67 +-
 include/standard-headers/linux/const.h             |     2 +-
 include/standard-headers/linux/ethtool.h           |   192 +-
 include/standard-headers/linux/fuse.h              |   147 +-
 include/standard-headers/linux/input-event-codes.h |     1 +
 include/standard-headers/linux/kvm_para.h          |    38 +
 include/standard-headers/linux/pci_regs.h          |    32 +-
 include/standard-headers/linux/pvpanic.h           |     9 -
 include/standard-headers/linux/vhost_types.h       |    29 +
 include/standard-headers/linux/virtio_blk.h        |   105 +
 include/standard-headers/linux/virtio_bt.h         |     1 -
 include/standard-headers/linux/virtio_config.h     |    19 +-
 include/standard-headers/linux/virtio_gpu.h        |     2 +
 include/standard-headers/linux/virtio_mem.h        |     2 +
 include/standard-headers/linux/virtio_net.h        |   158 +
 include/standard-headers/linux/virtio_pci.h        |    79 +
 include/standard-headers/linux/virtio_pmem.h       |     7 +
 include/standard-headers/linux/virtio_snd.h        |   154 +
 include/standard-headers/misc/pvpanic.h            |    12 +
 include/standard-headers/rdma/vmw_pvrdma-abi.h     |   310 -
 include/sysemu/accel-blocker.h                     |    14 +-
 include/sysemu/accel-ops.h                         |    19 +-
 include/sysemu/arch_init.h                         |     1 -
 include/sysemu/block-backend-common.h              |    25 +-
 include/sysemu/block-backend-global-state.h        |     9 +-
 include/sysemu/block-backend-io.h                  |    33 +-
 include/sysemu/cpu-timers-internal.h               |    71 +
 include/sysemu/cpu-timers.h                        |    35 +-
 include/sysemu/cpus.h                              |     7 -
 include/sysemu/cryptodev-vhost.h                   |     2 +-
 include/sysemu/cryptodev.h                         |     6 +-
 include/sysemu/device_tree.h                       |     7 +-
 include/sysemu/dirtylimit.h                        |     2 +
 include/sysemu/dump-arch.h                         |     1 +
 include/sysemu/dump.h                              |     3 +-
 include/sysemu/hax.h                               |    47 -
 include/sysemu/host_iommu_device.h                 |   110 +
 include/sysemu/hostmem.h                           |    11 +-
 include/sysemu/hvf.h                               |    42 +-
 include/sysemu/hvf_int.h                           |    14 +-
 include/sysemu/hw_accel.h                          |     1 -
 include/sysemu/iommufd.h                           |    66 +
 include/sysemu/iothread.h                          |     2 +-
 include/sysemu/kvm.h                               |   138 +-
 include/sysemu/kvm_int.h                           |    46 +-
 include/sysemu/kvm_xen.h                           |     1 +
 include/sysemu/memory_mapping.h                    |     2 +-
 include/sysemu/numa.h                              |     9 +-
 include/sysemu/nvmm.h                              |     6 +-
 include/sysemu/os-posix.h                          |     9 +-
 include/sysemu/os-win32.h                          |    17 +-
 include/sysemu/qtest.h                             |     8 +-
 include/sysemu/replay.h                            |    11 +-
 include/sysemu/reset.h                             |   113 +
 include/sysemu/rtc.h                               |     4 +-
 include/sysemu/runstate-action.h                   |     2 +-
 include/sysemu/runstate.h                          |    33 +-
 include/sysemu/spdm-socket.h                       |    74 +
 include/sysemu/stats.h                             |     2 +-
 include/sysemu/sysemu.h                            |     5 +-
 include/sysemu/tcg.h                               |     2 +
 include/sysemu/tpm.h                               |     5 +-
 include/sysemu/tpm_backend.h                       |     2 +-
 include/sysemu/whpx.h                              |     6 +-
 include/sysemu/xen-mapcache.h                      |    16 +-
 include/sysemu/xen.h                               |    16 +-
 include/tcg/debug-assert.h                         |    17 +
 include/tcg/debuginfo.h                            |    79 +
 include/tcg/helper-info.h                          |    67 +
 include/tcg/insn-start-words.h                     |    17 +
 include/tcg/oversized-guest.h                      |    23 +
 include/tcg/perf.h                                 |    49 +
 include/tcg/startup.h                              |    58 +
 include/tcg/tcg-cond.h                             |    64 +-
 include/tcg/tcg-ldst.h                             |    74 +-
 include/tcg/tcg-op-common.h                        |   561 +
 include/tcg/tcg-op-gvec-common.h                   |   434 +
 include/tcg/tcg-op-gvec.h                          |   440 +-
 include/tcg/tcg-op.h                               |  1145 +-
 include/tcg/tcg-opc.h                              |    63 +-
 include/tcg/tcg-temp-internal.h                    |    58 +-
 include/tcg/tcg.h                                  |   307 +-
 include/ui/clipboard.h                             |     2 +-
 include/ui/console.h                               |   170 +-
 include/ui/dmabuf.h                                |    49 +
 include/ui/egl-helpers.h                           |    11 +-
 include/ui/gtk.h                                   |     6 +-
 include/ui/input.h                                 |    12 +-
 include/ui/kbd-state.h                             |    13 +-
 include/ui/pixman-minimal.h                        |   239 +
 include/ui/qemu-pixman.h                           |    28 +-
 include/ui/rect.h                                  |    57 +
 include/ui/sdl2.h                                  |     3 +-
 include/ui/spice-display.h                         |     2 +-
 include/ui/surface.h                               |    95 +
 include/user/abitypes.h                            |    87 +
 include/user/guest-base.h                          |    18 +
 include/user/safe-syscall.h                        |     8 +-
 include/user/syscall-trace.h                       |    13 +-
 include/user/thunk.h                               |   213 +
 include/user/tswap-target.h                        |    22 +
 io/channel-command.c                               |    12 +-
 io/channel-file.c                                  |    94 +-
 io/channel-null.c                                  |     3 +-
 io/channel-socket.c                                |    43 +-
 io/channel-tls.c                                   |    99 +-
 io/channel-util.c                                  |    24 +
 io/channel-websock.c                               |     1 +
 io/channel.c                                       |   267 +-
 io/meson.build                                     |     2 +-
 io/net-listener.c                                  |     4 +-
 io/trace-events                                    |     1 +
 iothread.c                                         |    20 +-
 job.c                                              |    17 +-
 linux-headers/asm-arm64/kvm.h                      |    81 +-
 linux-headers/asm-arm64/sve_context.h              |    11 +
 linux-headers/asm-generic/bitsperlong.h            |    17 +-
 linux-headers/asm-generic/unistd.h                 |   161 +-
 linux-headers/asm-loongarch/bitsperlong.h          |     1 +
 linux-headers/asm-loongarch/kvm.h                  |   111 +
 linux-headers/asm-loongarch/mman.h                 |     1 +
 linux-headers/asm-loongarch/unistd.h               |     5 +
 linux-headers/asm-mips/kvm.h                       |     2 -
 linux-headers/asm-mips/mman.h                      |     2 +-
 linux-headers/asm-mips/unistd_n32.h                |    12 +
 linux-headers/asm-mips/unistd_n64.h                |    12 +
 linux-headers/asm-mips/unistd_o32.h                |    12 +
 linux-headers/asm-powerpc/kvm.h                    |    48 +-
 linux-headers/asm-powerpc/unistd_32.h              |    12 +
 linux-headers/asm-powerpc/unistd_64.h              |    12 +
 linux-headers/asm-riscv/kvm.h                      |   206 +-
 linux-headers/asm-riscv/ptrace.h                   |   132 +
 linux-headers/asm-riscv/unistd.h                   |     9 +
 linux-headers/asm-s390/kvm.h                       |   331 +-
 linux-headers/asm-s390/unistd_32.h                 |    13 +
 linux-headers/asm-s390/unistd_64.h                 |    13 +
 linux-headers/asm-x86/kvm.h                        |   406 +-
 linux-headers/asm-x86/kvm_para.h                   |     1 +
 linux-headers/asm-x86/mman.h                       |    10 +-
 linux-headers/asm-x86/unistd_32.h                  |    12 +
 linux-headers/asm-x86/unistd_64.h                  |    12 +
 linux-headers/asm-x86/unistd_x32.h                 |    12 +
 linux-headers/linux/bits.h                         |    15 +
 linux-headers/linux/const.h                        |    36 +
 linux-headers/linux/iommufd.h                      |   695 +
 linux-headers/linux/kvm.h                          |   856 +-
 linux-headers/linux/kvm_para.h                     |     2 +
 linux-headers/linux/memfd.h                        |    39 +
 linux-headers/linux/mman.h                         |    14 +
 linux-headers/linux/nvme_ioctl.h                   |   114 +
 linux-headers/linux/psp-sev.h                      |    67 +
 linux-headers/linux/stddef.h                       |    66 +
 linux-headers/linux/userfaultfd.h                  |    74 +-
 linux-headers/linux/vfio.h                         |   240 +-
 linux-headers/linux/vhost.h                        |    67 +-
 linux-user/aarch64/Makefile.vdso                   |    15 +
 linux-user/aarch64/cpu_loop.c                      |     3 +-
 linux-user/aarch64/meson.build                     |    13 +
 linux-user/aarch64/mte_user_helper.c               |    35 +
 linux-user/aarch64/mte_user_helper.h               |    32 +
 linux-user/aarch64/signal.c                        |     3 +-
 linux-user/aarch64/target_mman.h                   |    21 +
 linux-user/aarch64/target_prctl.h                  |    19 +-
 linux-user/aarch64/target_proc.h                   |     1 +
 linux-user/aarch64/vdso-be.so                      |   Bin 0 -> 3224 bytes
 linux-user/aarch64/vdso-le.so                      |   Bin 0 -> 3224 bytes
 linux-user/aarch64/vdso.S                          |    75 +
 linux-user/aarch64/vdso.ld                         |    72 +
 linux-user/alpha/signal.c                          |     2 +-
 linux-user/alpha/target_elf.h                      |     2 +-
 linux-user/alpha/target_mman.h                     |    24 +
 linux-user/alpha/target_proc.h                     |    67 +
 linux-user/arm/Makefile.vdso                       |    17 +
 linux-user/arm/cpu_loop.c                          |     5 +-
 linux-user/arm/meson.build                         |    12 +
 linux-user/arm/signal.c                            |    52 +-
 linux-user/arm/target_mman.h                       |    11 +
 linux-user/arm/target_proc.h                       |   101 +
 linux-user/arm/vdso-asmoffset.h                    |     3 +
 linux-user/arm/vdso-be.so                          |   Bin 0 -> 2648 bytes
 linux-user/arm/vdso-le.so                          |   Bin 0 -> 2648 bytes
 linux-user/arm/vdso.S                              |   174 +
 linux-user/arm/vdso.ld                             |    67 +
 linux-user/cris/cpu_loop.c                         |     2 +-
 linux-user/cris/signal.c                           |     8 -
 linux-user/cris/target_mman.h                      |    12 +
 linux-user/cris/target_proc.h                      |     1 +
 linux-user/elfload.c                               |  2332 ++-
 linux-user/exit.c                                  |     8 +-
 linux-user/flat.h                                  |     5 +-
 linux-user/flatload.c                              |   307 +-
 linux-user/gen-vdso-elfn.c.inc                     |   314 +
 linux-user/gen-vdso.c                              |   223 +
 linux-user/generic/target_mman.h                   |    58 +
 linux-user/hexagon/cpu_loop.c                      |     7 +
 linux-user/hexagon/signal.c                        |     2 +-
 linux-user/hexagon/target_elf.h                    |    20 +-
 linux-user/hexagon/target_mman.h                   |    13 +
 linux-user/hexagon/target_proc.h                   |     1 +
 linux-user/hppa/Makefile.vdso                      |    11 +
 linux-user/hppa/cpu_loop.c                         |    18 +-
 linux-user/hppa/meson.build                        |     5 +
 linux-user/hppa/signal.c                           |    46 +-
 linux-user/hppa/target_cpu.h                       |     4 +-
 linux-user/hppa/target_elf.h                       |     2 +-
 linux-user/hppa/target_mman.h                      |    16 +
 linux-user/hppa/target_proc.h                      |    26 +
 linux-user/hppa/vdso-asmoffset.h                   |    12 +
 linux-user/hppa/vdso.S                             |   165 +
 linux-user/hppa/vdso.ld                            |    77 +
 linux-user/hppa/vdso.so                            |   Bin 0 -> 2104 bytes
 linux-user/i386/Makefile.vdso                      |    11 +
 linux-user/i386/cpu_loop.c                         |    70 +-
 linux-user/i386/meson.build                        |     7 +
 linux-user/i386/signal.c                           |   681 +-
 linux-user/i386/target_mman.h                      |    16 +
 linux-user/i386/target_proc.h                      |     1 +
 linux-user/i386/vdso-asmoffset.h                   |     6 +
 linux-user/i386/vdso.S                             |   143 +
 linux-user/i386/vdso.ld                            |    76 +
 linux-user/i386/vdso.so                            |   Bin 0 -> 2672 bytes
 linux-user/include/host/alpha/host-signal.h        |    55 -
 linux-user/include/host/s390/host-signal.h         |   138 -
 linux-user/include/host/s390x/host-signal.h        |   139 +-
 linux-user/include/host/x32/host-signal.h          |     1 -
 linux-user/ioctls.h                                |    10 +
 linux-user/linuxload.c                             |   135 +-
 linux-user/loader.h                                |    69 +-
 linux-user/loongarch64/Makefile.vdso               |    11 +
 linux-user/loongarch64/cpu_loop.c                  |    13 +
 linux-user/loongarch64/meson.build                 |     4 +
 linux-user/loongarch64/signal.c                    |   209 +-
 linux-user/loongarch64/target_mman.h               |    11 +
 linux-user/loongarch64/target_proc.h               |     1 +
 linux-user/loongarch64/target_syscall.h            |     7 -
 linux-user/loongarch64/vdso-asmoffset.h            |     8 +
 linux-user/loongarch64/vdso.S                      |   130 +
 linux-user/loongarch64/vdso.ld                     |    73 +
 linux-user/loongarch64/vdso.so                     |   Bin 0 -> 3560 bytes
 linux-user/m68k/cpu_loop.c                         |     2 +-
 linux-user/m68k/signal.c                           |     4 +-
 linux-user/m68k/target_cpu.h                       |     2 +-
 linux-user/m68k/target_mman.h                      |     5 +
 linux-user/m68k/target_proc.h                      |    16 +
 linux-user/main.c                                  |   151 +-
 linux-user/meson.build                             |     9 +-
 linux-user/microblaze/signal.c                     |     2 +-
 linux-user/microblaze/target_mman.h                |    11 +
 linux-user/microblaze/target_proc.h                |     1 +
 linux-user/mips/cpu_loop.c                         |     6 +-
 linux-user/mips/signal.c                           |     4 +-
 linux-user/mips/target_elf.h                       |     3 -
 linux-user/mips/target_mman.h                      |    28 +
 linux-user/mips/target_proc.h                      |     1 +
 linux-user/mips64/target_elf.h                     |    24 +-
 linux-user/mips64/target_mman.h                    |     2 +-
 linux-user/mips64/target_proc.h                    |     1 +
 linux-user/mmap.c                                  |  1517 +-
 linux-user/nios2/cpu_loop.c                        |   156 -
 linux-user/nios2/signal.c                          |   210 -
 linux-user/nios2/sockbits.h                        |     1 -
 linux-user/nios2/syscall_nr.h                      |   333 -
 linux-user/nios2/target_cpu.h                      |    49 -
 linux-user/nios2/target_elf.h                      |    14 -
 linux-user/nios2/target_errno_defs.h               |     7 -
 linux-user/nios2/target_fcntl.h                    |    11 -
 linux-user/nios2/target_mman.h                     |     1 -
 linux-user/nios2/target_prctl.h                    |     1 -
 linux-user/nios2/target_resource.h                 |     1 -
 linux-user/nios2/target_signal.h                   |     9 -
 linux-user/nios2/target_structs.h                  |     1 -
 linux-user/nios2/target_syscall.h                  |    37 -
 linux-user/nios2/termbits.h                        |     1 -
 linux-user/openrisc/signal.c                       |     2 +-
 linux-user/openrisc/target_mman.h                  |    10 +
 linux-user/openrisc/target_proc.h                  |     1 +
 linux-user/ppc/Makefile.vdso                       |    20 +
 linux-user/ppc/meson.build                         |    12 +
 linux-user/ppc/signal.c                            |    49 +-
 linux-user/ppc/target_mman.h                       |    28 +
 linux-user/ppc/target_proc.h                       |     1 +
 linux-user/ppc/vdso-32.ld                          |    70 +
 linux-user/ppc/vdso-32.so                          |   Bin 0 -> 3020 bytes
 linux-user/ppc/vdso-64.ld                          |    68 +
 linux-user/ppc/vdso-64.so                          |   Bin 0 -> 3896 bytes
 linux-user/ppc/vdso-64le.so                        |   Bin 0 -> 3896 bytes
 linux-user/ppc/vdso-asmoffset.h                    |    20 +
 linux-user/ppc/vdso.S                              |   239 +
 linux-user/qemu.h                                  |    21 +-
 linux-user/riscv/Makefile.vdso                     |    15 +
 linux-user/riscv/cpu_loop.c                        |     2 +-
 linux-user/riscv/meson.build                       |     7 +
 linux-user/riscv/signal.c                          |    14 +-
 linux-user/riscv/syscall32_nr.h                    |     1 +
 linux-user/riscv/syscall64_nr.h                    |     1 +
 linux-user/riscv/target_elf.h                      |     3 +-
 linux-user/riscv/target_mman.h                     |    10 +
 linux-user/riscv/target_proc.h                     |    37 +
 linux-user/riscv/vdso-32.so                        |   Bin 0 -> 2980 bytes
 linux-user/riscv/vdso-64.so                        |   Bin 0 -> 3944 bytes
 linux-user/riscv/vdso-asmoffset.h                  |     9 +
 linux-user/riscv/vdso.S                            |   187 +
 linux-user/riscv/vdso.ld                           |    74 +
 linux-user/s390x/Makefile.vdso                     |    11 +
 linux-user/s390x/meson.build                       |     6 +
 linux-user/s390x/signal.c                          |     9 +-
 linux-user/s390x/target_mman.h                     |    20 +
 linux-user/s390x/target_proc.h                     |   109 +
 linux-user/s390x/vdso-asmoffset.h                  |     2 +
 linux-user/s390x/vdso.S                            |    61 +
 linux-user/s390x/vdso.ld                           |    72 +
 linux-user/s390x/vdso.so                           |   Bin 0 -> 3464 bytes
 linux-user/sh4/signal.c                            |    10 +-
 linux-user/sh4/target_mman.h                       |     7 +
 linux-user/sh4/target_proc.h                       |     1 +
 linux-user/sh4/termbits.h                          |   204 +-
 linux-user/signal-common.h                         |     4 +-
 linux-user/signal.c                                |   535 +-
 linux-user/sparc/cpu_loop.c                        |    13 +-
 linux-user/sparc/signal.c                          |    23 +-
 linux-user/sparc/target_cpu.h                      |    17 +-
 linux-user/sparc/target_mman.h                     |    34 +
 linux-user/sparc/target_proc.h                     |    16 +
 linux-user/sparc/target_syscall.h                  |     6 +-
 linux-user/strace.c                                |   160 +-
 linux-user/strace.list                             |     6 +-
 linux-user/syscall.c                               |  1248 +-
 linux-user/syscall_defs.h                          |  2312 +--
 linux-user/syscall_types.h                         |     5 +
 linux-user/thunk.c                                 |    26 +-
 linux-user/uaccess.c                               |     4 +-
 linux-user/user-internals.h                        |     4 +-


From xen-changelog-bounces@lists.xenproject.org Thu Oct 03 13:44:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 03 Oct 2024 13:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.809475.1221810 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swM7g-0004HH-Se; Thu, 03 Oct 2024 13:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 809475.1221810; Thu, 03 Oct 2024 13: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 1swM7g-0004H9-Q4; Thu, 03 Oct 2024 13:44:04 +0000
Received: by outflank-mailman (input) for mailman id 809475;
 Thu, 03 Oct 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 1swM7f-0004H3-Nb
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 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 1swM7f-0003HH-G3
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 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 1swM7f-0007iU-Da
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 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=YzDLwanpNfMZABIz1E8HItkPcxrKF7e4bW0SaPBwCBg=; b=jKSPeBRBr3ClJNopNKGg+vJfyl
	sTW9IjLqzvVK3goag1Hm5qGP1qtW+s2MQD6QNfvpEvA7OYD2QYUPZdUzewC9Uc3OntC9yYjgjQQ95
	UHxmJGuI+BE5EHO2a7MuOcUZfIWVZExfPd63QWQ0fGAjq5mv3L2FosaJVk4K6lcfgQsI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Rewrite EFI/MBI2 code partly in C
Message-Id: <E1swM7f-0007iU-Da@xenbits.xenproject.org>
Date: Thu, 03 Oct 2024 13:44:03 +0000

commit eb21ce14d709ef0c0030d0625028a4868c81126f
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Tue Oct 1 11:22:38 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 3 14:40:55 2024 +0100

    x86/boot: Rewrite EFI/MBI2 code partly in C
    
    No need to have it coded in assembly.
    Declare efi_multiboot2 in a new header to reuse between implementations
    and caller.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/arch/x86/boot/head.S       | 146 +++++++++--------------------------------
 xen/arch/x86/efi/Makefile      |   1 +
 xen/arch/x86/efi/efi-boot.h    |   7 +-
 xen/arch/x86/efi/mbi2.c        |  63 ++++++++++++++++++
 xen/arch/x86/efi/stub.c        |  10 +--
 xen/arch/x86/include/asm/efi.h |  18 +++++
 6 files changed, 120 insertions(+), 125 deletions(-)

diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 6a06f6c9ea..d1856d8012 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -130,8 +130,6 @@ multiboot2_header:
 .Lbad_cpu_msg: .asciz "ERR: Not a 64-bit CPU!"
 .Lbad_ldr_msg: .asciz "ERR: Not a Multiboot bootloader!"
 .Lbad_ldr_nbs: .asciz "ERR: Bootloader shutdown EFI x64 boot services!"
-.Lbad_ldr_nst: .asciz "ERR: EFI SystemTable is not provided by bootloader!"
-.Lbad_ldr_nih: .asciz "ERR: EFI ImageHandle is not provided by bootloader!"
 .Lbad_efi_msg: .asciz "ERR: EFI IA-32 platforms are not supported!"
 .Lbag_alg_msg: .asciz "ERR: Xen must be loaded at a 2Mb boundary!"
 .Lno_nx_msg:   .asciz "ERR: Not an NX-capable CPU!"
@@ -170,17 +168,6 @@ early_error: /* Here to improve the disassembly. */
         mov     $sym_offs(.Lno_nx_msg), %ecx
         jmp     .Lget_vtb
 #endif
-.Lmb2_no_st:
-        /*
-         * Here we are on EFI platform. vga_text_buffer was zapped earlier
-         * because there is pretty good chance that VGA is unavailable.
-         */
-        mov     $sym_offs(.Lbad_ldr_nst), %ecx
-        jmp     .Lget_vtb
-.Lmb2_no_ih:
-        /* Ditto. */
-        mov     $sym_offs(.Lbad_ldr_nih), %ecx
-        jmp     .Lget_vtb
 .Lmb2_no_bs:
         /*
          * Ditto. Additionally, here there is a chance that Xen was started
@@ -198,6 +185,10 @@ early_error: /* Here to improve the disassembly. */
         mov     $sym_offs(.Lbad_efi_msg), %ecx
         xor     %edi,%edi                       # No VGA text buffer
         jmp     .Lprint_err
+.Ldirect_error:
+        mov     sym_esi(vga_text_buffer), %edi
+        mov     %eax, %esi
+        jmp     1f
 .Lget_vtb:
         mov     sym_esi(vga_text_buffer), %edi
 .Lprint_err:
@@ -244,53 +235,49 @@ __efi64_mb2_start:
 
         /*
          * Align the stack as UEFI spec requires. Keep it aligned
-         * before efi_multiboot2() call by pushing/popping even
+         * before efi_multiboot2_prelude() call by pushing/popping even
          * numbers of items on it.
          */
         and     $~15, %rsp
 
+        /* Save magic number, we need it later but we need to use %eax. */
+        mov     %eax, %edx
+
         /*
          * Initialize BSS (no nasty surprises!).
          * It must be done earlier than in BIOS case
-         * because efi_multiboot2() touches it.
+         * because efi_multiboot2_prelude() touches it.
          */
-        mov     %eax, %edx
         lea     __bss_start(%rip), %edi
         lea     __bss_end(%rip), %ecx
         sub     %edi, %ecx
         shr     $3, %ecx
         xor     %eax, %eax
         rep stosq
-        mov     %edx, %eax
-
-        /* Check for Multiboot2 bootloader. */
-        cmp     $MULTIBOOT2_BOOTLOADER_MAGIC,%eax
-        je      .Lefi_multiboot2_proto
-
-        /* Jump to .Lnot_multiboot after switching CPU to x86_32 mode. */
-        lea     .Lnot_multiboot(%rip), %r15
-        jmp     x86_32_switch
 
-.Lefi_multiboot2_proto:
-        /* Zero EFI SystemTable, EFI ImageHandle addresses and cmdline. */
-        xor     %esi,%esi
-        xor     %edi,%edi
-        xor     %edx,%edx
-
-        /* Skip Multiboot2 information fixed part. */
-        lea     (MB2_fixed_sizeof+MULTIBOOT2_TAG_ALIGN-1)(%rbx),%ecx
-        and     $~(MULTIBOOT2_TAG_ALIGN-1),%ecx
-
-.Lefi_mb2_tsize:
-        /* Check Multiboot2 information total size. */
-        mov     %ecx,%r8d
-        sub     %ebx,%r8d
-        cmp     %r8d,MB2_fixed_total_size(%rbx)
-        jbe     .Lrun_bs
+        /*
+         * Spill MB2 magic.
+         * Spill the pointer too, to keep the stack aligned.
+         */
+        push    %rdx
+        push    %rbx
 
-        /* Are EFI boot services available? */
-        cmpl    $MULTIBOOT2_TAG_TYPE_EFI_BS,MB2_tag_type(%rcx)
-        jne     .Lefi_mb2_st
+        /*
+         * efi_multiboot2_prelude() is called according to System V AMD64 ABI:
+         *   - IN:  %edi - Multiboot2 magic,
+         *          %rsi - Multiboot2 pointer.
+         *   - OUT: %rax - error string.
+         */
+        mov     %edx, %edi
+        mov     %rbx, %rsi
+        call    efi_multiboot2_prelude
+        lea     .Ldirect_error(%rip), %r15
+        test    %rax, %rax
+        jnz     x86_32_switch
+
+        /* Restore Multiboot2 pointer and magic. */
+        pop     %rbx
+        pop     %rax
 
         /* We are on EFI platform and EFI boot services are available. */
         incb    efi_platform(%rip)
@@ -300,77 +287,6 @@ __efi64_mb2_start:
          * be run on EFI platforms.
          */
         incb    skip_realmode(%rip)
-        jmp     .Lefi_mb2_next_tag
-
-.Lefi_mb2_st:
-        /* Get EFI SystemTable address from Multiboot2 information. */
-        cmpl    $MULTIBOOT2_TAG_TYPE_EFI64,MB2_tag_type(%rcx)
-        cmove   MB2_efi64_st(%rcx),%rsi
-        je      .Lefi_mb2_next_tag
-
-        /* Get EFI ImageHandle address from Multiboot2 information. */
-        cmpl    $MULTIBOOT2_TAG_TYPE_EFI64_IH,MB2_tag_type(%rcx)
-        cmove   MB2_efi64_ih(%rcx),%rdi
-        je      .Lefi_mb2_next_tag
-
-        /* Get command line from Multiboot2 information. */
-        cmpl    $MULTIBOOT2_TAG_TYPE_CMDLINE, MB2_tag_type(%rcx)
-        jne     .Lno_cmdline
-        lea     MB2_tag_string(%rcx), %rdx
-        jmp     .Lefi_mb2_next_tag
-.Lno_cmdline:
-
-        /* Is it the end of Multiboot2 information? */
-        cmpl    $MULTIBOOT2_TAG_TYPE_END,MB2_tag_type(%rcx)
-        je      .Lrun_bs
-
-.Lefi_mb2_next_tag:
-        /* Go to next Multiboot2 information tag. */
-        add     MB2_tag_size(%rcx),%ecx
-        add     $(MULTIBOOT2_TAG_ALIGN-1),%ecx
-        and     $~(MULTIBOOT2_TAG_ALIGN-1),%ecx
-        jmp     .Lefi_mb2_tsize
-
-.Lrun_bs:
-        /* Are EFI boot services available? */
-        cmpb    $0,efi_platform(%rip)
-
-        /* Jump to .Lmb2_no_bs after switching CPU to x86_32 mode. */
-        lea     .Lmb2_no_bs(%rip),%r15
-        jz      x86_32_switch
-
-        /* Is EFI SystemTable address provided by boot loader? */
-        test    %rsi,%rsi
-
-        /* Jump to .Lmb2_no_st after switching CPU to x86_32 mode. */
-        lea     .Lmb2_no_st(%rip),%r15
-        jz      x86_32_switch
-
-        /* Is EFI ImageHandle address provided by boot loader? */
-        test    %rdi,%rdi
-
-        /* Jump to .Lmb2_no_ih after switching CPU to x86_32 mode. */
-        lea     .Lmb2_no_ih(%rip),%r15
-        jz      x86_32_switch
-
-        /* Save Multiboot2 magic on the stack. */
-        push    %rax
-
-        /* Save EFI ImageHandle on the stack. */
-        push    %rdi
-
-        /*
-         * efi_multiboot2() is called according to System V AMD64 ABI:
-         *   - IN:  %rdi - EFI ImageHandle, %rsi - EFI SystemTable,
-         *          %rdx - MB2 cmdline
-         */
-        call    efi_multiboot2
-
-        /* Just pop an item from the stack. */
-        pop     %rax
-
-        /* Restore Multiboot2 magic. */
-        pop     %rax
 
         /* Jump to trampoline_setup after switching CPU to x86_32 mode. */
         lea     trampoline_setup(%rip),%r15
diff --git a/xen/arch/x86/efi/Makefile b/xen/arch/x86/efi/Makefile
index 24dfecfad1..7e2b5c07de 100644
--- a/xen/arch/x86/efi/Makefile
+++ b/xen/arch/x86/efi/Makefile
@@ -14,5 +14,6 @@ $(addprefix $(obj)/,$(EFIOBJ-y)): CFLAGS_stack_boundary := $(cflags-stack-bounda
 obj-y := common-stub.o stub.o
 obj-$(XEN_BUILD_EFI) := $(filter-out %.init.o,$(EFIOBJ-y))
 obj-bin-$(XEN_BUILD_EFI) := $(filter %.init.o,$(EFIOBJ-y))
+obj-bin-y += mbi2.o
 extra-$(XEN_BUILD_EFI) += buildid.o relocs-dummy.o
 nocov-$(XEN_BUILD_EFI) += stub.o
diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index 7aa55e7aaf..94f3443364 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -10,6 +10,7 @@
 #include <asm/msr.h>
 #include <asm/setup.h>
 #include <asm/trampoline.h>
+#include <asm/efi.h>
 
 static struct file __initdata ucode;
 static multiboot_info_t __initdata mbi = {
@@ -816,9 +817,9 @@ static const char *__init get_option(const char *cmd, const char *opt)
     return o;
 }
 
-void asmlinkage __init efi_multiboot2(EFI_HANDLE ImageHandle,
-                                      EFI_SYSTEM_TABLE *SystemTable,
-                                      const char *cmdline)
+void __init efi_multiboot2(EFI_HANDLE ImageHandle,
+                           EFI_SYSTEM_TABLE *SystemTable,
+                           const char *cmdline)
 {
     EFI_GRAPHICS_OUTPUT_PROTOCOL *gop;
     EFI_HANDLE gop_handle;
diff --git a/xen/arch/x86/efi/mbi2.c b/xen/arch/x86/efi/mbi2.c
new file mode 100644
index 0000000000..55a1777483
--- /dev/null
+++ b/xen/arch/x86/efi/mbi2.c
@@ -0,0 +1,63 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <xen/efi.h>
+#include <xen/init.h>
+#include <xen/multiboot2.h>
+#include <asm/asm_defns.h>
+#include <asm/efi.h>
+
+const char * asmlinkage __init
+efi_multiboot2_prelude(uint32_t magic, const multiboot2_fixed_t *mbi)
+{
+    const multiboot2_tag_t *tag;
+    EFI_HANDLE ImageHandle = NULL;
+    EFI_SYSTEM_TABLE *SystemTable = NULL;
+    const char *cmdline = NULL;
+    bool have_bs = false;
+
+    if ( magic != MULTIBOOT2_BOOTLOADER_MAGIC )
+        return "ERR: Not a Multiboot2 bootloader!";
+
+    /* Skip Multiboot2 information fixed part. */
+    tag = _p(ROUNDUP((unsigned long)(mbi + 1), MULTIBOOT2_TAG_ALIGN));
+
+    for ( ; (const void *)tag - (const void *)mbi < mbi->total_size &&
+            tag->type != MULTIBOOT2_TAG_TYPE_END;
+          tag = _p(ROUNDUP((unsigned long)tag + tag->size,
+                   MULTIBOOT2_TAG_ALIGN)) )
+    {
+        switch ( tag->type )
+        {
+        case MULTIBOOT2_TAG_TYPE_EFI_BS:
+            have_bs = true;
+            break;
+
+        case MULTIBOOT2_TAG_TYPE_EFI64:
+            SystemTable = _p(((const multiboot2_tag_efi64_t *)tag)->pointer);
+            break;
+
+        case MULTIBOOT2_TAG_TYPE_EFI64_IH:
+            ImageHandle = _p(((const multiboot2_tag_efi64_ih_t *)tag)->pointer);
+            break;
+
+        case MULTIBOOT2_TAG_TYPE_CMDLINE:
+            cmdline = ((const multiboot2_tag_string_t *)tag)->string;
+            break;
+
+        default:
+            /* Satisfy MISRA requirement. */
+            break;
+        }
+    }
+
+    if ( !have_bs )
+        return "ERR: Bootloader shutdown EFI x64 boot services!";
+    if ( !SystemTable )
+        return "ERR: EFI SystemTable is not provided by bootloader!";
+    if ( !ImageHandle )
+        return "ERR: EFI ImageHandle is not provided by bootloader!";
+
+    efi_multiboot2(ImageHandle, SystemTable, cmdline);
+
+    return NULL;
+}
diff --git a/xen/arch/x86/efi/stub.c b/xen/arch/x86/efi/stub.c
index 2cd5c8d4dc..7d824151a7 100644
--- a/xen/arch/x86/efi/stub.c
+++ b/xen/arch/x86/efi/stub.c
@@ -1,13 +1,8 @@
 #include <xen/efi.h>
 #include <xen/init.h>
 #include <asm/asm_defns.h>
-#include <asm/efibind.h>
+#include <asm/efi.h>
 #include <asm/page.h>
-#include <efi/efidef.h>
-#include <efi/eficapsule.h>
-#include <efi/eficon.h>
-#include <efi/efidevp.h>
-#include <efi/efiapi.h>
 
 /*
  * Here we are in EFI stub. EFI calls are not supported due to lack
@@ -17,7 +12,8 @@
  */
 
 void __init noreturn efi_multiboot2(EFI_HANDLE ImageHandle,
-                                    EFI_SYSTEM_TABLE *SystemTable)
+                                    EFI_SYSTEM_TABLE *SystemTable,
+                                    const char *cmdline)
 {
     static const CHAR16 __initconst err[] =
         L"Xen does not have EFI code build in!\r\nSystem halted!\r\n";
diff --git a/xen/arch/x86/include/asm/efi.h b/xen/arch/x86/include/asm/efi.h
new file mode 100644
index 0000000000..575a33e302
--- /dev/null
+++ b/xen/arch/x86/include/asm/efi.h
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef X86_ASM_EFI_H
+#define X86_ASM_EFI_H
+
+#include <xen/types.h>
+#include <asm/x86_64/efibind.h>
+#include <efi/efidef.h>
+#include <efi/eficapsule.h>
+#include <efi/eficon.h>
+#include <efi/efidevp.h>
+#include <efi/efiapi.h>
+
+void efi_multiboot2(EFI_HANDLE ImageHandle,
+                    EFI_SYSTEM_TABLE *SystemTable,
+                    const char *cmdline);
+
+#endif /* X86_ASM_EFI_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 03 14:33:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 03 Oct 2024 14:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.809534.1221934 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swMt5-00032g-8I; Thu, 03 Oct 2024 14:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 809534.1221934; Thu, 03 Oct 2024 14:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swMt5-00032Y-5m; Thu, 03 Oct 2024 14:33:03 +0000
Received: by outflank-mailman (input) for mailman id 809534;
 Thu, 03 Oct 2024 14: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 1swMt3-00032D-O2
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 14: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 1swMt3-0004Fu-Ie
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 14:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swMt3-0002sQ-Hc
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 14:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=IcGXvhRR0M7eszWTh86j6J/zIuv6+udcZx4vmdpGagk=; b=lUej0ytHi8LR6QkFsN0n52NKae
	T/VdUFxs5rr5UfjCnIrVLvCHD24v9Rw9ZdQnvulOpMDvdkxfK8f3+irgITOYySnAwSr8ZYXFI43bi
	xcgTSZsDIksZYORz39antnEXOp3VVIA1eBQpCIaplfyCGmCVnAekMxCaitzeuoJsYG+c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/kexec: Separate code and data into different cache lines
Message-Id: <E1swMt3-0002sQ-Hc@xenbits.xenproject.org>
Date: Thu, 03 Oct 2024 14:33:01 +0000

commit 41190d2ceb03b12ffc17a66c04de519c26a6052a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Feb 17 17:01:22 2023 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 2 19:08:27 2024 +0100

    x86/kexec: Separate code and data into different cache lines
    
    No functional change, but it performs a bit better.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/x86_64/kexec_reloc.S | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/x86_64/kexec_reloc.S b/xen/arch/x86/x86_64/kexec_reloc.S
index 9f40c80d7c..50ba454abd 100644
--- a/xen/arch/x86/x86_64/kexec_reloc.S
+++ b/xen/arch/x86/x86_64/kexec_reloc.S
@@ -19,6 +19,7 @@
 #include <xen/kimage.h>
 
 #include <asm/asm_defns.h>
+#include <asm/cache.h>
 #include <asm/msr-index.h>
 #include <asm/page.h>
 #include <asm/machine_kexec.h>
@@ -174,6 +175,9 @@ FUNC_LOCAL(compatibility_mode)
         ud2
 END(compatibility_mode)
 
+        /* Separate code and data into into different cache lines */
+        .balign L1_CACHE_BYTES
+
 DATA_LOCAL(compat_mode_gdt_desc, 4)
         .word .Lcompat_mode_gdt_end - compat_mode_gdt -1
         .quad 0x0000000000000000     /* set in call_32_bit above */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 03 17:11:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 03 Oct 2024 17:11:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.809667.1222108 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swPM1-0008DT-0O; Thu, 03 Oct 2024 17:11:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 809667.1222108; Thu, 03 Oct 2024 17: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 1swPM0-0008DM-Ti; Thu, 03 Oct 2024 17:11:04 +0000
Received: by outflank-mailman (input) for mailman id 809667;
 Thu, 03 Oct 2024 17: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 1swPM0-0008DG-FK
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 17: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 1swPM0-0007Zh-AN
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 17:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swPM0-0004OB-8X
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 17: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=SJSXHqAe2qD+URj96hHvHxoh+VPIpcmFY2Z3Z2ao87M=; b=LNhmbGRSqvD+QNR/lE9kf6M0jy
	889NiMq70oG5fAuWZFndjM3BYsUR7tghA0UPjHdaOG2gF2Cg9e2d1iLM2A1yqfmNSyO9LjQl65ww3
	pOyELgvtDft+hsHV5T+/28TFSt1uEmeZY334IYx8KW3MB9v4I/ostH5fylS6F2vv5fNA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: move per-cpu area management into common code
Message-Id: <E1swPM0-0004OB-8X@xenbits.xenproject.org>
Date: Thu, 03 Oct 2024 17:11:04 +0000

commit f75780d26b2f0e66bb1f3b3c82c50d46f11fda19
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Oct 3 16:08:55 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 3 18:07:36 2024 +0100

    xen: move per-cpu area management into common code
    
    Centralize per-cpu area management to reduce code duplication and
    enhance maintainability across architectures.
    
    The per-cpu area management code, which is largely common among
    architectures, is moved to a shared implementation in
    xen/common/percpu.c. This change includes:
     * Remove percpu.c from the X86 and Arm architectures.
     * For x86, define INVALID_PERCPU_AREAS and PARK_OFFLINE_CPUS_VAR.
     * Drop the declaration of __per_cpu_offset[] from stubs.c in
       PPC and RISC-V to facilitate the build of the common per-cpu code.
    
    No functional changes for x86.
    
    For Arm add support of CPU_RESUME_FAILED, CPU_REMOVE and freeing of
    percpu in the case when system_state != SYS_STATE_suspend, however,
    there is no change in behavior for Arm at this time.
    
    Move the asm-generic/percpu.h definitions to xen/percpu.h, except for
    __per_cpu_start[] and __per_cpu_data_end[], which are moved to
    common/percpu.c as they are only used in common/percpu.c.
    
    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/Makefile             |   1 -
 xen/arch/arm/include/asm/smp.h    |   7 +--
 xen/arch/arm/percpu.c             |  85 ---------------------------
 xen/arch/ppc/include/asm/smp.h    |   6 --
 xen/arch/ppc/stubs.c              |   1 -
 xen/arch/riscv/include/asm/smp.h  |   6 --
 xen/arch/riscv/stubs.c            |   1 -
 xen/arch/x86/Makefile             |   1 -
 xen/arch/x86/include/asm/Makefile |   1 -
 xen/arch/x86/include/asm/percpu.h |  14 +++++
 xen/arch/x86/percpu.c             | 112 -----------------------------------
 xen/common/Makefile               |   1 +
 xen/common/percpu.c               | 119 ++++++++++++++++++++++++++++++++++++++
 xen/include/asm-generic/percpu.h  |  23 --------
 xen/include/xen/percpu.h          |  30 ++++++++++
 15 files changed, 165 insertions(+), 243 deletions(-)

diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 7792bff597..e4ad1ce851 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -39,7 +39,6 @@ obj-$(CONFIG_MEM_ACCESS) += mem_access.o
 obj-y += mm.o
 obj-y += monitor.o
 obj-y += p2m.o
-obj-y += percpu.o
 obj-y += platform.o
 obj-y += platform_hypercall.o
 obj-y += physdev.o
diff --git a/xen/arch/arm/include/asm/smp.h b/xen/arch/arm/include/asm/smp.h
index e99a3a3f53..8f765ed12a 100644
--- a/xen/arch/arm/include/asm/smp.h
+++ b/xen/arch/arm/include/asm/smp.h
@@ -2,6 +2,7 @@
 #define __ASM_SMP_H
 
 #ifndef __ASSEMBLY__
+#include <xen/percpu.h>
 #include <xen/cpumask.h>
 #include <asm/current.h>
 #endif
@@ -12,12 +13,6 @@ extern unsigned long smp_up_cpu;
 DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_mask);
 DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
 
-/*
- * Do we, for platform reasons, need to actually keep CPUs online when we
- * would otherwise prefer them to be off?
- */
-#define park_offline_cpus false
-
 extern void noreturn stop_cpu(void);
 
 extern int arch_smp_init(void);
diff --git a/xen/arch/arm/percpu.c b/xen/arch/arm/percpu.c
deleted file mode 100644
index 87fe960330..0000000000
--- a/xen/arch/arm/percpu.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#include <xen/percpu.h>
-#include <xen/cpu.h>
-#include <xen/init.h>
-#include <xen/mm.h>
-#include <xen/rcupdate.h>
-
-unsigned long __per_cpu_offset[NR_CPUS];
-#define INVALID_PERCPU_AREA (-(long)__per_cpu_start)
-#define PERCPU_ORDER (get_order_from_bytes(__per_cpu_data_end-__per_cpu_start))
-
-void __init percpu_init_areas(void)
-{
-    unsigned int cpu;
-    for ( cpu = 1; cpu < NR_CPUS; cpu++ )
-        __per_cpu_offset[cpu] = INVALID_PERCPU_AREA;
-}
-
-static int init_percpu_area(unsigned int cpu)
-{
-    char *p;
-    if ( __per_cpu_offset[cpu] != INVALID_PERCPU_AREA )
-        return -EBUSY;
-    if ( (p = alloc_xenheap_pages(PERCPU_ORDER, 0)) == NULL )
-        return -ENOMEM;
-    memset(p, 0, __per_cpu_data_end - __per_cpu_start);
-    __per_cpu_offset[cpu] = p - __per_cpu_start;
-    return 0;
-}
-
-struct free_info {
-    unsigned int cpu;
-    struct rcu_head rcu;
-};
-static DEFINE_PER_CPU(struct free_info, free_info);
-
-static void _free_percpu_area(struct rcu_head *head)
-{
-    struct free_info *info = container_of(head, struct free_info, rcu);
-    unsigned int cpu = info->cpu;
-    char *p = __per_cpu_start + __per_cpu_offset[cpu];
-    free_xenheap_pages(p, PERCPU_ORDER);
-    __per_cpu_offset[cpu] = INVALID_PERCPU_AREA;
-}
-
-static void free_percpu_area(unsigned int cpu)
-{
-    struct free_info *info = &per_cpu(free_info, cpu);
-    info->cpu = cpu;
-    call_rcu(&info->rcu, _free_percpu_area);
-}
-
-static int cpu_percpu_callback(
-    struct notifier_block *nfb, unsigned long action, void *hcpu)
-{
-    unsigned int cpu = (unsigned long)hcpu;
-    int rc = 0;
-
-    switch ( action )
-    {
-    case CPU_UP_PREPARE:
-        rc = init_percpu_area(cpu);
-        break;
-    case CPU_UP_CANCELED:
-    case CPU_DEAD:
-        free_percpu_area(cpu);
-        break;
-    default:
-        break;
-    }
-
-    return notifier_from_errno(rc);
-}
-
-static struct notifier_block cpu_percpu_nfb = {
-    .notifier_call = cpu_percpu_callback,
-    .priority = 100 /* highest priority */
-};
-
-static int __init percpu_presmp_init(void)
-{
-    register_cpu_notifier(&cpu_percpu_nfb);
-    return 0;
-}
-presmp_initcall(percpu_presmp_init);
diff --git a/xen/arch/ppc/include/asm/smp.h b/xen/arch/ppc/include/asm/smp.h
index 7b1517ce18..2b872218be 100644
--- a/xen/arch/ppc/include/asm/smp.h
+++ b/xen/arch/ppc/include/asm/smp.h
@@ -7,10 +7,4 @@
 DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_mask);
 DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
 
-/*
- * Do we, for platform reasons, need to actually keep CPUs online when we
- * would otherwise prefer them to be off?
- */
-#define park_offline_cpus false
-
 #endif
diff --git a/xen/arch/ppc/stubs.c b/xen/arch/ppc/stubs.c
index bdb5f8c66d..fff82f5cf3 100644
--- a/xen/arch/ppc/stubs.c
+++ b/xen/arch/ppc/stubs.c
@@ -141,7 +141,6 @@ void smp_send_state_dump(unsigned int cpu)
 /* 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)
 {
diff --git a/xen/arch/riscv/include/asm/smp.h b/xen/arch/riscv/include/asm/smp.h
index a824be8e78..092b101ff4 100644
--- a/xen/arch/riscv/include/asm/smp.h
+++ b/xen/arch/riscv/include/asm/smp.h
@@ -10,12 +10,6 @@
 DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_mask);
 DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
 
-/*
- * Do we, for platform reasons, need to actually keep CPUs online when we
- * would otherwise prefer them to be off?
- */
-#define park_offline_cpus false
-
 /*
  * Mapping between Xen logical cpu index and hartid.
  */
diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c
index 2aa245f272..5951b0ce91 100644
--- a/xen/arch/riscv/stubs.c
+++ b/xen/arch/riscv/stubs.c
@@ -133,7 +133,6 @@ void smp_send_state_dump(unsigned int cpu)
 /* 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)
 {
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 1fa12ed4aa..b35fd5196c 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -54,7 +54,6 @@ obj-y += mpparse.o
 obj-y += nmi.o
 obj-y += numa.o
 obj-y += pci.o
-obj-y += percpu.o
 obj-y += physdev.o
 obj-$(CONFIG_COMPAT) += x86_64/physdev.o
 obj-$(CONFIG_X86_PSR) += psr.o
diff --git a/xen/arch/x86/include/asm/Makefile b/xen/arch/x86/include/asm/Makefile
index daab34ff0a..2c27787d31 100644
--- a/xen/arch/x86/include/asm/Makefile
+++ b/xen/arch/x86/include/asm/Makefile
@@ -1,3 +1,2 @@
 # SPDX-License-Identifier: GPL-2.0-only
 generic-y += div64.h
-generic-y += percpu.h
diff --git a/xen/arch/x86/include/asm/percpu.h b/xen/arch/x86/include/asm/percpu.h
new file mode 100644
index 0000000000..34f589f990
--- /dev/null
+++ b/xen/arch/x86/include/asm/percpu.h
@@ -0,0 +1,14 @@
+#ifndef __X86_PERCPU_H__
+#define __X86_PERCPU_H__
+
+#define PARK_OFFLINE_CPUS_VAR
+
+/*
+ * Force uses of per_cpu() with an invalid area to attempt to access the
+ * middle of the non-canonical address space resulting in a #GP, rather than a
+ * possible #PF at (NULL + a little) which has security implications in the
+ * context of PV guests.
+ */
+#define INVALID_PERCPU_AREA (0x8000000000000000UL - (unsigned long)__per_cpu_start)
+
+#endif /* __X86_PERCPU_H__ */
diff --git a/xen/arch/x86/percpu.c b/xen/arch/x86/percpu.c
deleted file mode 100644
index 3205eacea6..0000000000
--- a/xen/arch/x86/percpu.c
+++ /dev/null
@@ -1,112 +0,0 @@
-#include <xen/percpu.h>
-#include <xen/cpu.h>
-#include <xen/init.h>
-#include <xen/mm.h>
-#include <xen/rcupdate.h>
-
-unsigned long __per_cpu_offset[NR_CPUS];
-
-/*
- * Force uses of per_cpu() with an invalid area to attempt to access the
- * middle of the non-canonical address space resulting in a #GP, rather than a
- * possible #PF at (NULL + a little) which has security implications in the
- * context of PV guests.
- */
-#define INVALID_PERCPU_AREA (0x8000000000000000UL - (unsigned long)__per_cpu_start)
-#define PERCPU_ORDER get_order_from_bytes(__per_cpu_data_end - __per_cpu_start)
-
-void __init percpu_init_areas(void)
-{
-    unsigned int cpu;
-
-    for ( cpu = 1; cpu < NR_CPUS; cpu++ )
-        __per_cpu_offset[cpu] = INVALID_PERCPU_AREA;
-}
-
-static int init_percpu_area(unsigned int cpu)
-{
-    char *p;
-
-    if ( __per_cpu_offset[cpu] != INVALID_PERCPU_AREA )
-        return 0;
-
-    if ( (p = alloc_xenheap_pages(PERCPU_ORDER, 0)) == NULL )
-        return -ENOMEM;
-
-    memset(p, 0, __per_cpu_data_end - __per_cpu_start);
-    __per_cpu_offset[cpu] = p - __per_cpu_start;
-
-    return 0;
-}
-
-struct free_info {
-    unsigned int cpu;
-    struct rcu_head rcu;
-};
-static DEFINE_PER_CPU(struct free_info, free_info);
-
-static void cf_check _free_percpu_area(struct rcu_head *head)
-{
-    struct free_info *info = container_of(head, struct free_info, rcu);
-    unsigned int cpu = info->cpu;
-    char *p = __per_cpu_start + __per_cpu_offset[cpu];
-
-    free_xenheap_pages(p, PERCPU_ORDER);
-    __per_cpu_offset[cpu] = INVALID_PERCPU_AREA;
-}
-
-static void free_percpu_area(unsigned int cpu)
-{
-    struct free_info *info = &per_cpu(free_info, cpu);
-
-    info->cpu = cpu;
-    call_rcu(&info->rcu, _free_percpu_area);
-}
-
-static int cf_check cpu_percpu_callback(
-    struct notifier_block *nfb, unsigned long action, void *hcpu)
-{
-    unsigned int cpu = (unsigned long)hcpu;
-    int rc = 0;
-
-    switch ( action )
-    {
-    case CPU_UP_PREPARE:
-        rc = init_percpu_area(cpu);
-        break;
-    case CPU_UP_CANCELED:
-    case CPU_DEAD:
-    case CPU_RESUME_FAILED:
-        if ( !park_offline_cpus && system_state != SYS_STATE_suspend )
-            free_percpu_area(cpu);
-        break;
-    case CPU_REMOVE:
-        if ( park_offline_cpus )
-            free_percpu_area(cpu);
-        break;
-    }
-
-    return notifier_from_errno(rc);
-}
-
-static struct notifier_block cpu_percpu_nfb = {
-    .notifier_call = cpu_percpu_callback,
-    .priority = 100 /* highest priority */
-};
-
-static int __init cf_check percpu_presmp_init(void)
-{
-    register_cpu_notifier(&cpu_percpu_nfb);
-
-    return 0;
-}
-presmp_initcall(percpu_presmp_init);
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/xen/common/Makefile b/xen/common/Makefile
index fc52e0857d..f90bb00d23 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -31,6 +31,7 @@ obj-y += notifier.o
 obj-$(CONFIG_NUMA) += numa.o
 obj-y += page_alloc.o
 obj-y += pdx.o
+obj-y += percpu.o
 obj-$(CONFIG_PERF_COUNTERS) += perfc.o
 obj-bin-$(CONFIG_HAS_PMAP) += pmap.init.o
 obj-y += preempt.o
diff --git a/xen/common/percpu.c b/xen/common/percpu.c
new file mode 100644
index 0000000000..e4e8b7bcab
--- /dev/null
+++ b/xen/common/percpu.c
@@ -0,0 +1,119 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#include <xen/percpu.h>
+#include <xen/cpu.h>
+#include <xen/init.h>
+#include <xen/mm.h>
+#include <xen/rcupdate.h>
+#include <xen/sections.h>
+
+#ifndef INVALID_PERCPU_AREA
+#define INVALID_PERCPU_AREA (-(long)__per_cpu_start)
+#endif
+
+#define PERCPU_ORDER get_order_from_bytes(__per_cpu_data_end - __per_cpu_start)
+
+extern char __per_cpu_start[];
+extern const char __per_cpu_data_end[];
+
+unsigned long __read_mostly __per_cpu_offset[NR_CPUS];
+
+void __init percpu_init_areas(void)
+{
+    unsigned int cpu;
+
+    for ( cpu = 1; cpu < NR_CPUS; cpu++ )
+        __per_cpu_offset[cpu] = INVALID_PERCPU_AREA;
+}
+
+static int init_percpu_area(unsigned int cpu)
+{
+    char *p;
+
+    if ( __per_cpu_offset[cpu] != INVALID_PERCPU_AREA )
+        return park_offline_cpus ? 0 : -EBUSY;
+
+    if ( (p = alloc_xenheap_pages(PERCPU_ORDER, 0)) == NULL )
+        return -ENOMEM;
+
+    memset(p, 0, __per_cpu_data_end - __per_cpu_start);
+    __per_cpu_offset[cpu] = p - __per_cpu_start;
+
+    return 0;
+}
+
+struct free_info {
+    unsigned int cpu;
+    struct rcu_head rcu;
+};
+static DEFINE_PER_CPU(struct free_info, free_info);
+
+static void cf_check _free_percpu_area(struct rcu_head *head)
+{
+    struct free_info *info = container_of(head, struct free_info, rcu);
+    unsigned int cpu = info->cpu;
+    char *p = __per_cpu_start + __per_cpu_offset[cpu];
+
+    free_xenheap_pages(p, PERCPU_ORDER);
+    __per_cpu_offset[cpu] = INVALID_PERCPU_AREA;
+}
+
+static void free_percpu_area(unsigned int cpu)
+{
+    struct free_info *info = &per_cpu(free_info, cpu);
+
+    info->cpu = cpu;
+    call_rcu(&info->rcu, _free_percpu_area);
+}
+
+static int cf_check cpu_percpu_callback(
+    struct notifier_block *nfb, unsigned long action, void *hcpu)
+{
+    unsigned int cpu = (unsigned long)hcpu;
+    int rc = 0;
+
+    switch ( action )
+    {
+    case CPU_UP_PREPARE:
+        rc = init_percpu_area(cpu);
+        break;
+
+    case CPU_UP_CANCELED:
+    case CPU_DEAD:
+    case CPU_RESUME_FAILED:
+        if ( !park_offline_cpus && system_state != SYS_STATE_suspend )
+            free_percpu_area(cpu);
+        break;
+
+    case CPU_REMOVE:
+        if ( park_offline_cpus )
+            free_percpu_area(cpu);
+        break;
+
+    default:
+        break;
+    }
+
+    return notifier_from_errno(rc);
+}
+
+static struct notifier_block cpu_percpu_nfb = {
+    .notifier_call = cpu_percpu_callback,
+    .priority = 100 /* highest priority */
+};
+
+static int __init cf_check percpu_presmp_init(void)
+{
+    register_cpu_notifier(&cpu_percpu_nfb);
+
+    return 0;
+}
+presmp_initcall(percpu_presmp_init);
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/include/asm-generic/percpu.h b/xen/include/asm-generic/percpu.h
index 60af4f9ff9..3fdb3a2a02 100644
--- a/xen/include/asm-generic/percpu.h
+++ b/xen/include/asm-generic/percpu.h
@@ -2,29 +2,6 @@
 #ifndef __ASM_GENERIC_PERCPU_H__
 #define __ASM_GENERIC_PERCPU_H__
 
-#ifndef __ASSEMBLY__
-
-#include <xen/types.h>
-#include <asm/current.h>
-
-extern char __per_cpu_start[];
-extern const char __per_cpu_data_end[];
-extern unsigned long __per_cpu_offset[NR_CPUS];
-void percpu_init_areas(void);
-
-#define per_cpu(var, cpu)  \
-    (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
-
-#define this_cpu(var) \
-    (*RELOC_HIDE(&per_cpu__##var, get_per_cpu_offset()))
-
-#define per_cpu_ptr(var, cpu)  \
-    (*RELOC_HIDE(var, __per_cpu_offset[cpu]))
-#define this_cpu_ptr(var) \
-    (*RELOC_HIDE(var, get_per_cpu_offset()))
-
-#endif
-
 #endif /* __ASM_GENERIC_PERCPU_H__ */
 
 /*
diff --git a/xen/include/xen/percpu.h b/xen/include/xen/percpu.h
index 57522f346b..e7f585c7ed 100644
--- a/xen/include/xen/percpu.h
+++ b/xen/include/xen/percpu.h
@@ -29,6 +29,36 @@
 
 #include <asm/percpu.h>
 
+#ifndef __ASSEMBLY__
+
+#include <xen/types.h>
+#include <asm/current.h>
+
+#ifndef PARK_OFFLINE_CPUS_VAR
+/*
+ * Do we, for platform reasons, need to actually keep CPUs online when we
+ * would otherwise prefer them to be off?
+ */
+#define park_offline_cpus false
+#endif
+
+extern unsigned long __per_cpu_offset[];
+
+#define per_cpu(var, cpu)  \
+    (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
+
+#define this_cpu(var) \
+    (*RELOC_HIDE(&per_cpu__##var, get_per_cpu_offset()))
+
+#define per_cpu_ptr(var, cpu)  \
+    (*RELOC_HIDE(var, __per_cpu_offset[cpu]))
+#define this_cpu_ptr(var) \
+    (*RELOC_HIDE(var, get_per_cpu_offset()))
+
+void percpu_init_areas(void);
+
+#endif /* __ASSEMBLY__ */
+
 /* Linux compatibility. */
 #define get_cpu_var(var) this_cpu(var)
 #define put_cpu_var(var)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 03 17:11:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 03 Oct 2024 17:11:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.809669.1222111 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swPMB-0008Fy-2k; Thu, 03 Oct 2024 17:11:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 809669.1222111; Thu, 03 Oct 2024 17: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 1swPMB-0008Fr-0L; Thu, 03 Oct 2024 17:11:15 +0000
Received: by outflank-mailman (input) for mailman id 809669;
 Thu, 03 Oct 2024 17: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 1swPMA-0008Fj-GN
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 17: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 1swPMA-0007Zo-EZ
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 17:11:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swPMA-0004PW-Cw
 for xen-changelog@lists.xenproject.org; Thu, 03 Oct 2024 17: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=s/nxOy0OZmOiz5iWoOcRbR0xuRhK9gvZztFjTbi82Is=; b=iTi6eMWDqF+jt6U4tuzORIQEj1
	XXSdBYi/VJRf8irCd+lr5ECU4Wp0MMtRYl+m0cac1pP6baah94Nul24IAjdPN8Q6+Ff4XD4seHLlC
	C89bdeAtXQVuvn3RP2E9G40UbAczIaMOjcdv8Izm/mkFiiD6I9EWy0cmpyIFbUhqO7tQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Don't use INC to set defaults
Message-Id: <E1swPMA-0004PW-Cw@xenbits.xenproject.org>
Date: Thu, 03 Oct 2024 17:11:14 +0000

commit 163338e6fbec2c549d55782e1ae4cf238b793f4a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Oct 3 15:03:38 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 3 18:07:36 2024 +0100

    x86/boot: Don't use INC to set defaults
    
    __efi64_mb2_start() makes some bold assumptions about the efi_platform and
    skip_realmode booleans.  Set them to 1 explicitly, which is more robust.
    
    Make the comment a little more concise.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/boot/head.S | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index d1856d8012..af776c201a 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -279,14 +279,12 @@ __efi64_mb2_start:
         pop     %rbx
         pop     %rax
 
-        /* We are on EFI platform and EFI boot services are available. */
-        incb    efi_platform(%rip)
-
         /*
-         * Disable real mode and other legacy stuff which should not
-         * be run on EFI platforms.
+         * efi_multiboot2_prelude() is happy that we're on EFI platform.  Skip
+         * the BIOS initialisation path.
          */
-        incb    skip_realmode(%rip)
+        movb    $1, efi_platform(%rip)
+        movb    $1, skip_realmode(%rip)
 
         /* Jump to trampoline_setup after switching CPU to x86_32 mode. */
         lea     trampoline_setup(%rip),%r15
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Oct 04 00:44:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 04 Oct 2024 00:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.809921.1222488 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swWQO-0000t9-V3; Fri, 04 Oct 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 809921.1222488; Fri, 04 Oct 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 1swWQO-0000t2-Sb; Fri, 04 Oct 2024 00:44:04 +0000
Received: by outflank-mailman (input) for mailman id 809921;
 Fri, 04 Oct 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 1swWQN-0000sv-QJ
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 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 1swWQN-0008Ds-HJ
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 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 1swWQN-0007GF-F6
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 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=tB3Dn3Dt/8VC6J5vJvgxl9pD0Zxjxb9MeLM1fsTxzwI=; b=tRG0oCjlgADg47lBPDyHxSL1CX
	K/AxcE3AkIHZCjQKvvMRnZS30TzXEh53uCKaTKOdgnSQnHA67n/vWw+NekLf3ZRycDzN1py+2awpl
	CX/f0xI1X0w4oM0qSY9TkfdH+kZa813AnVWsrdExynO1Sp6Xe0O2gb6QyAeR4e5aQIKo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: introduce TEST_TIMEOUT_OVERRIDE
Message-Id: <E1swWQN-0007GF-F6@xenbits.xenproject.org>
Date: Fri, 04 Oct 2024 00:44:03 +0000

commit d82e0e094e7a07353ba0fb35732724316c2ec2f6
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Thu Oct 3 13:22:51 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Oct 3 17:32:58 2024 -0700

    automation: introduce TEST_TIMEOUT_OVERRIDE
    
    TEST_TIMEOUT is set as a CI/CD project variable, as it should be, to
    match the capability and speed of the testing infrastructure.
    
    As it turns out, TEST_TIMEOUT defined in test.yaml cannot override
    TEST_TIMEOUT defined as CI/CD project variable. As a consequence, today
    the TEST_TIMEOUT setting in test.yaml for the Xilinx jobs is ignored.
    
    Instead, rename TEST_TIMEOUT to TEST_TIMEOUT_OVERRIDE in test.yaml and
    check for TEST_TIMEOUT_OVERRIDE first in console.exp.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 automation/gitlab-ci/test.yaml | 4 ++--
 automation/scripts/console.exp | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 8675016b6a..e947736195 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -84,7 +84,7 @@
   variables:
     CONTAINER: ubuntu:xenial-xilinx
     LOGFILE: qemu-smoke-xilinx.log
-    TEST_TIMEOUT: 120
+    TEST_TIMEOUT_OVERRIDE: 120
   artifacts:
     paths:
       - smoke.serial
@@ -104,7 +104,7 @@
     LOGFILE: xilinx-smoke-x86_64.log
     XEN_CMD_CONSOLE: "console=com2 com2=57600,8n1,0x2F8,4"
     TEST_BOARD: "crater"
-    TEST_TIMEOUT: 1000
+    TEST_TIMEOUT_OVERRIDE: 1000
   artifacts:
     paths:
       - smoke.serial
diff --git a/automation/scripts/console.exp b/automation/scripts/console.exp
index f538aa6bd0..310543c33e 100755
--- a/automation/scripts/console.exp
+++ b/automation/scripts/console.exp
@@ -1,6 +1,8 @@
 #!/usr/bin/expect -f
 
-if {[info exists env(TEST_TIMEOUT)]} {
+if {[info exists env(TEST_TIMEOUT_OVERRIDE)]} {
+    set timeout $env(TEST_TIMEOUT_OVERRIDE)
+} elseif {[info exists env(TEST_TIMEOUT)]} {
     set timeout $env(TEST_TIMEOUT)
 } else {
     set timeout 1500
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Oct 04 05:44:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 04 Oct 2024 05:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.809981.1222553 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swb6l-0000TL-Ba; Fri, 04 Oct 2024 05:44:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 809981.1222553; Fri, 04 Oct 2024 05:44: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 1swb6l-0000TE-86; Fri, 04 Oct 2024 05:44:07 +0000
Received: by outflank-mailman (input) for mailman id 809981;
 Fri, 04 Oct 2024 05:44: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 1swb6k-0000T8-Je
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 2024 05:44: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 1swb6k-0004j9-82
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 2024 05:44:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swb6k-0001g2-6X
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 2024 05:44: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=l1atLjZgYMihESw3jwnA1nRdG0+m99YZFhoBeAxiF9U=; b=t0mOaWgDGC8eTz/EmcNhY9UkaX
	83ZPwUVxLEDRd06AfnuoiFUzBqTwuk91Ro47g7On/pltGZXGMbnYkITSIQrsDpZX4LVHTxF7cvV8i
	utO8zGOieG1jSXJVHadq0LF+HMkUpXD1LERnAMuI35CpbMJOH3TlxM/rFVCP+M1rGBM8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen master] Merge tag 'v9.1.0' into 'staging'
Message-Id: <E1swb6k-0001g2-6X@xenbits.xenproject.org>
Date: Fri, 04 Oct 2024 05:44:06 +0000

=== This changeset includes merge from high-traffic branch ===
Commits on that branch are not reported individually.

commit 3fdb3cd3a27a22a050c7d27126a24807a7a45745
Merge: fd1952d814da738ed107e05583b3e02ac11e88ff 0df9387c8983e1b1e72d8c574356f572342c03e6
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Thu Oct 3 14:02:52 2024 +0200
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Thu Oct 3 14:02:52 2024 +0200

    Merge tag 'v9.1.0' into 'staging'
 .gitlab-ci.d/base.yml                              |    73 +-
 .gitlab-ci.d/buildtest-template.yml                |    41 +-
 .gitlab-ci.d/buildtest.yml                         |   254 +-
 .gitlab-ci.d/cirrus.yml                            |    76 +-
 .gitlab-ci.d/cirrus/build.yml                      |     6 +-
 .gitlab-ci.d/cirrus/freebsd-12.vars                |    16 -
 .gitlab-ci.d/cirrus/freebsd-13.vars                |     2 +-
 .gitlab-ci.d/cirrus/kvm-build.yml                  |    31 -
 .gitlab-ci.d/cirrus/macos-12.vars                  |    16 -
 .gitlab-ci.d/cirrus/macos-13.vars                  |    16 +
 .gitlab-ci.d/cirrus/macos-14.vars                  |    16 +
 .gitlab-ci.d/container-core.yml                    |     4 +-
 .gitlab-ci.d/container-cross.yml                   |    68 +-
 .gitlab-ci.d/container-template.yml                |     8 +-
 .gitlab-ci.d/containers.yml                        |     2 +-
 .gitlab-ci.d/crossbuild-template.yml               |    37 +-
 .gitlab-ci.d/crossbuilds.yml                       |    51 +-
 .gitlab-ci.d/custom-runners.yml                    |    12 +-
 .../custom-runners/centos-stream-8-x86_64.yml      |    24 -
 .gitlab-ci.d/custom-runners/ubuntu-20.04-s390x.yml |   130 -
 .../custom-runners/ubuntu-22.04-aarch32.yml        |     4 +-
 .../custom-runners/ubuntu-22.04-aarch64.yml        |    30 +-
 .gitlab-ci.d/custom-runners/ubuntu-22.04-s390x.yml |   128 +
 .gitlab-ci.d/opensbi.yml                           |    13 +-
 .gitlab-ci.d/qemu-project.yml                      |     7 +
 .gitlab-ci.d/static_checks.yml                     |     4 +-
 .gitlab-ci.d/windows.yml                           |   159 +-
 .gitmodules                                        |    18 -
 .mailmap                                           |    30 +-
 .readthedocs.yml                                   |    19 +-
 .travis.yml                                        |    45 +-
 Kconfig.host                                       |    12 +-
 MAINTAINERS                                        |   654 +-
 Makefile                                           |    93 +-
 README.rst                                         |     6 +-
 VERSION                                            |     2 +-
 accel/Kconfig                                      |     4 +-
 accel/accel-blocker.c                              |    10 +-
 accel/accel-common.c                               |   155 -
 accel/accel-softmmu.c                              |   106 -
 accel/accel-softmmu.h                              |    15 -
 accel/accel-system.c                               |   106 +
 accel/accel-system.h                               |    15 +
 accel/accel-target.c                               |   176 +
 accel/dummy-cpus.c                                 |    12 +-
 accel/hvf/hvf-accel-ops.c                          |   157 +-
 accel/hvf/hvf-all.c                                |    65 +-
 accel/kvm/kvm-accel-ops.c                          |    14 +-
 accel/kvm/kvm-all.c                                |  1037 +-
 accel/kvm/kvm-cpus.h                               |     1 -
 accel/kvm/trace-events                             |    14 +-
 accel/meson.build                                  |     6 +-
 accel/qtest/meson.build                            |     2 +-
 accel/qtest/qtest.c                                |    13 +
 accel/stubs/hax-stub.c                             |    24 -
 accel/stubs/kvm-stub.c                             |    32 +-
 accel/stubs/meson.build                            |    11 +-
 accel/stubs/tcg-stub.c                             |    22 -
 accel/tcg/atomic_common.c.inc                      |    50 +-
 accel/tcg/atomic_template.h                        |   113 +-
 accel/tcg/cpu-exec-common.c                        |    36 +-
 accel/tcg/cpu-exec.c                               |   416 +-
 accel/tcg/cputlb.c                                 |  2770 +--
 accel/tcg/debuginfo.c                              |    96 -
 accel/tcg/debuginfo.h                              |    79 -
 accel/tcg/icount-common.c                          |   502 +
 accel/tcg/internal-common.h                        |    59 +
 accel/tcg/internal-target.h                        |   118 +
 accel/tcg/internal.h                               |    70 -
 accel/tcg/ldst_atomicity.c.inc                     |  1111 ++
 accel/tcg/ldst_common.c.inc                        |   295 +-
 accel/tcg/meson.build                              |    29 +-
 accel/tcg/monitor.c                                |   202 +-
 accel/tcg/perf.c                                   |   375 -
 accel/tcg/perf.h                                   |    49 -
 accel/tcg/plugin-gen.c                             |  1095 +-
 accel/tcg/plugin-helpers.h                         |     4 -
 accel/tcg/tb-hash.h                                |    16 +-
 accel/tcg/tb-jmp-cache.h                           |    17 +-
 accel/tcg/tb-maint.c                               |   290 +-
 accel/tcg/tcg-accel-ops-icount.c                   |    35 +-
 accel/tcg/tcg-accel-ops-icount.h                   |     3 +-
 accel/tcg/tcg-accel-ops-mttcg.c                    |    39 +-
 accel/tcg/tcg-accel-ops-rr.c                       |    96 +-
 accel/tcg/tcg-accel-ops.c                          |    33 +-
 accel/tcg/tcg-accel-ops.h                          |     4 +-
 accel/tcg/tcg-all.c                                |    67 +-
 accel/tcg/tcg-runtime-gvec.c                       |    39 +-
 accel/tcg/tcg-runtime.c                            |     6 +-
 accel/tcg/tcg-runtime.h                            |    79 +-
 accel/tcg/translate-all.c                          |   315 +-
 accel/tcg/translator.c                             |   446 +-
 accel/tcg/user-exec-stub.c                         |     6 +-
 accel/tcg/user-exec.c                              |   489 +-
 accel/tcg/vcpu-state.h                             |    18 +
 accel/tcg/watchpoint.c                             |   143 +
 accel/xen/xen-all.c                                |     1 +
 audio/alsaaudio.c                                  |     3 +-
 audio/audio-hmp-cmds.c                             |     6 +-
 audio/audio.c                                      |   246 +-
 audio/audio.h                                      |    10 +-
 audio/audio_int.h                                  |     7 +-
 audio/audio_legacy.c                               |   591 -
 audio/audio_template.h                             |    13 +-
 audio/coreaudio.m                                  |    16 +-
 audio/dbusaudio.c                                  |    48 +-
 audio/dsoundaudio.c                                |     3 +-
 audio/jackaudio.c                                  |    24 +-
 audio/meson.build                                  |    13 +-
 audio/mixeng.h                                     |     2 +-
 audio/noaudio.c                                    |     3 +-
 audio/ossaudio.c                                   |    13 +-
 audio/paaudio.c                                    |     8 +-
 audio/pwaudio.c                                    |   857 +
 audio/sdlaudio.c                                   |     6 +-
 audio/sndioaudio.c                                 |     3 +-
 audio/spiceaudio.c                                 |     5 +-
 audio/trace-events                                 |    10 +-
 audio/wavaudio.c                                   |     7 +-
 backends/Kconfig                                   |     8 +
 backends/cryptodev-builtin.c                       |    13 +-
 backends/cryptodev-vhost-user.c                    |     9 +-
 backends/cryptodev.c                               |    24 +-
 backends/dbus-vmstate.c                            |     5 +-
 backends/host_iommu_device.c                       |    33 +
 backends/hostmem-epc.c                             |    19 +-
 backends/hostmem-file.c                            |   114 +-
 backends/hostmem-memfd.c                           |    15 +-
 backends/hostmem-ram.c                             |    13 +-
 backends/hostmem-shm.c                             |   123 +
 backends/hostmem.c                                 |   188 +-
 backends/iommufd.c                                 |   360 +
 backends/meson.build                               |    29 +-
 backends/rng-random.c                              |     5 +-
 backends/spdm-socket.c                             |   216 +
 backends/tpm/meson.build                           |     8 +-
 backends/tpm/tpm_backend.c                         |     4 +-
 backends/tpm/tpm_emulator.c                        |    17 +-
 backends/tpm/tpm_ioctl.h                           |     2 +-
 backends/tpm/tpm_util.c                            |    16 +-
 backends/tpm/trace-events                          |     3 +-
 backends/trace-events                              |    13 +
 block.c                                            |  1034 +-
 block/amend.c                                      |     8 +-
 block/backup.c                                     |    25 +-
 block/blkdebug.c                                   |    35 +-
 block/blkio.c                                      |   345 +-
 block/blklogwrites.c                               |   124 +-
 block/blkreplay.c                                  |     8 +-
 block/blkverify.c                                  |    27 +-
 block/block-backend.c                              |   468 +-
 block/block-copy.c                                 |    29 +-
 block/bochs.c                                      |    13 +-
 block/cloop.c                                      |    15 +-
 block/commit.c                                     |    46 +-
 block/copy-before-write.c                          |    63 +-
 block/copy-before-write.h                          |     1 +
 block/copy-on-read.c                               |    27 +-
 block/copy-on-read.h                               |     3 +-
 block/coroutines.h                                 |     5 +-
 block/create.c                                     |     1 -
 block/crypto.c                                     |   188 +-
 block/crypto.h                                     |     8 +
 block/curl.c                                       |    64 +-
 block/dmg.c                                        |    51 +-
 block/dmg.h                                        |     8 +-
 block/export/export.c                              |    41 +-
 block/export/fuse.c                                |    56 +-
 block/export/vduse-blk.c                           |   130 +-
 block/export/vhost-user-blk-server.c               |    81 +-
 block/export/vhost-user-blk-server.h               |     2 +-
 block/file-posix.c                                 |   910 +-
 block/file-win32.c                                 |     8 +-
 block/filter-compress.c                            |     5 +-
 block/gluster.c                                    |   120 +-
 block/graph-lock.c                                 |    69 +-
 block/io.c                                         |   645 +-
 block/io_uring.c                                   |    78 +-
 block/iscsi.c                                      |    10 +-
 block/linux-aio.c                                  |    89 +-
 block/meson.build                                  |    55 +-
 block/mirror.c                                     |   304 +-
 block/monitor/bitmap-qmp-cmds.c                    |    39 +-
 block/monitor/block-hmp-cmds.c                     |    46 +-
 block/monitor/meson.build                          |     2 +-
 block/nbd.c                                        |   342 +-
 block/nfs.c                                        |   119 +-
 block/null.c                                       |     8 +-
 block/nvme.c                                       |    72 +-
 block/parallels-ext.c                              |    23 +-
 block/parallels.c                                  |   875 +-
 block/parallels.h                                  |     9 +-
 block/preallocate.c                                |   154 +-
 block/qapi-sysemu.c                                |    43 +-
 block/qapi.c                                       |    99 +-
 block/qcow.c                                       |    63 +-
 block/qcow2-bitmap.c                               |    84 +-
 block/qcow2-cache.c                                |    11 +-
 block/qcow2-cluster.c                              |   162 +-
 block/qcow2-refcount.c                             |   218 +-
 block/qcow2-snapshot.c                             |    25 +-
 block/qcow2-threads.c                              |     3 +-
 block/qcow2.c                                      |   399 +-
 block/qcow2.h                                      |   299 +-
 block/qed-check.c                                  |     5 +-
 block/qed-table.c                                  |     6 +-
 block/qed.c                                        |   132 +-
 block/qed.h                                        |     2 +-
 block/quorum.c                                     |    31 +-
 block/raw-format.c                                 |    68 +-
 block/rbd.c                                        |     9 +-
 block/replication.c                                |   106 +-
 block/snapshot-access.c                            |     7 +-
 block/snapshot.c                                   |    95 +-
 block/ssh.c                                        |    85 +-
 block/stream.c                                     |    92 +-
 block/throttle-groups.c                            |   163 +-
 block/throttle.c                                   |    11 +-
 block/trace-events                                 |    13 +-
 block/vdi.c                                        |    41 +-
 block/vhdx-log.c                                   |    76 +-
 block/vhdx.c                                       |   131 +-
 block/vhdx.h                                       |    23 +-
 block/vmdk.c                                       |   216 +-
 block/vpc.c                                        |    73 +-
 block/vvfat.c                                      |   144 +-
 block/win32-aio.c                                  |     6 +-
 block/write-threshold.c                            |     6 -
 blockdev-nbd.c                                     |    59 +-
 blockdev.c                                         |  1070 +-
 blockjob.c                                         |    66 +-
 bsd-user/aarch64/signal.c                          |   137 +
 bsd-user/aarch64/target.h                          |    20 +
 bsd-user/aarch64/target_arch.h                     |    29 +
 bsd-user/aarch64/target_arch_cpu.c                 |    31 +
 bsd-user/aarch64/target_arch_cpu.h                 |   189 +
 bsd-user/aarch64/target_arch_elf.h                 |   163 +
 bsd-user/aarch64/target_arch_reg.h                 |    56 +
 bsd-user/aarch64/target_arch_signal.h              |    82 +
 bsd-user/aarch64/target_arch_sigtramp.h            |    48 +
 bsd-user/aarch64/target_arch_sysarch.h             |    42 +
 bsd-user/aarch64/target_arch_thread.h              |    61 +
 bsd-user/aarch64/target_arch_vmparam.h             |    74 +
 bsd-user/aarch64/target_syscall.h                  |    51 +
 bsd-user/arm/target_arch.h                         |     1 +
 bsd-user/arm/target_arch_elf.h                     |     1 -
 bsd-user/arm/target_arch_signal.h                  |     2 +
 bsd-user/bsd-file.h                                |     8 +-
 bsd-user/bsd-mem.c                                 |   104 +
 bsd-user/bsd-mem.h                                 |   453 +
 bsd-user/bsd-proc.c                                |   145 +
 bsd-user/bsd-proc.h                                |   382 +-
 bsd-user/elfload.c                                 |    11 +-
 bsd-user/errno_defs.h                              |     2 +-
 bsd-user/freebsd/meson.build                       |     2 +
 bsd-user/freebsd/os-misc.h                         |    98 +
 bsd-user/freebsd/os-proc.c                         |   368 +
 bsd-user/freebsd/os-proc.h                         |   293 +
 bsd-user/freebsd/os-stat.c                         |   262 +
 bsd-user/freebsd/os-stat.h                         |   663 +
 bsd-user/freebsd/os-syscall.c                      |   436 +-
 bsd-user/freebsd/qemu-os.h                         |    50 +
 bsd-user/freebsd/target_os_elf.h                   |     1 +
 bsd-user/freebsd/target_os_siginfo.h               |     2 +-
 bsd-user/freebsd/target_os_stack.h                 |     5 +-
 bsd-user/freebsd/target_os_user.h                  |     2 +-
 bsd-user/i386/target_arch_cpu.h                    |     4 +
 bsd-user/i386/target_arch_elf.h                    |     1 -
 bsd-user/i386/target_arch_signal.h                 |     2 +
 bsd-user/main.c                                    |   214 +-
 bsd-user/meson.build                               |     9 +-
 bsd-user/mmap.c                                    |   103 +-
 bsd-user/netbsd/target_os_elf.h                    |     1 +
 bsd-user/openbsd/target_os_elf.h                   |     1 +
 bsd-user/qemu-bsd.h                                |    58 +
 bsd-user/qemu.h                                    |   153 +-
 bsd-user/signal-common.h                           |     5 +-
 bsd-user/signal.c                                  |    72 +-
 bsd-user/strace.c                                  |     1 +
 bsd-user/syscall_defs.h                            |   312 +-
 bsd-user/trace-events                              |     2 +-
 bsd-user/x86_64/target_arch_elf.h                  |     1 -
 bsd-user/x86_64/target_arch_signal.h               |     2 +
 chardev/char-fe.c                                  |    30 +-
 chardev/char-file.c                                |     8 +
 chardev/char-io.c                                  |    47 +-
 chardev/char-parallel.c                            |     7 +-
 chardev/char-pty.c                                 |    24 +-
 chardev/char-socket.c                              |    65 +-
 chardev/char-stdio.c                               |     4 +
 chardev/char-win-stdio.c                           |     7 +-
 chardev/char.c                                     |    92 +-
 chardev/meson.build                                |    28 +-
 chardev/msmouse.c                                  |     4 +-
 chardev/trace-events                               |    10 +
 chardev/wctablet.c                                 |     2 +-
 configs/devices/aarch64-softmmu/default.mak        |     8 +-
 configs/devices/alpha-softmmu/default.mak          |     5 +-
 configs/devices/arm-softmmu/default.mak            |    86 +-
 configs/devices/avr-softmmu/default.mak            |     5 +-
 configs/devices/cris-softmmu/default.mak           |     5 +-
 configs/devices/hppa-softmmu/default.mak           |     5 +-
 configs/devices/i386-softmmu/default.mak           |    11 +-
 configs/devices/loongarch64-softmmu/default.mak    |     6 +-
 configs/devices/m68k-softmmu/default.mak           |    15 +-
 configs/devices/microblaze-softmmu/default.mak     |     9 +-
 configs/devices/mips-softmmu/common.mak            |    34 +-
 configs/devices/mips64-softmmu/default.mak         |     4 +-
 configs/devices/mips64el-softmmu/default.mak       |    13 +-
 configs/devices/nios2-softmmu/default.mak          |     8 -
 configs/devices/or1k-softmmu/default.mak           |     9 +-
 configs/devices/ppc-softmmu/default.mak            |    29 +-
 configs/devices/ppc64-softmmu/default.mak          |     8 +-
 configs/devices/riscv32-softmmu/default.mak        |    19 +-
 configs/devices/riscv64-softmmu/default.mak        |    21 +-
 configs/devices/rx-softmmu/default.mak             |     3 +-
 configs/devices/s390x-softmmu/default.mak          |     6 +-
 configs/devices/sh4-softmmu/default.mak            |     7 +-
 configs/devices/sparc-softmmu/default.mak          |     7 +-
 configs/devices/sparc64-softmmu/default.mak        |     7 +-
 configs/devices/tricore-softmmu/default.mak        |     7 +-
 configs/devices/xtensa-softmmu/default.mak         |    13 +-
 configs/meson/windows.txt                          |     9 +
 configs/targets/aarch64-bsd-user.mak               |     3 +
 configs/targets/aarch64-linux-user.mak             |     2 +-
 configs/targets/aarch64-softmmu.mak                |     2 +
 configs/targets/alpha-linux-user.mak               |     1 -
 configs/targets/alpha-softmmu.mak                  |     1 -
 configs/targets/arm-softmmu.mak                    |     1 +
 configs/targets/hexagon-linux-user.mak             |     1 +
 configs/targets/hppa-linux-user.mak                |     2 +-
 configs/targets/hppa-softmmu.mak                   |     1 -
 configs/targets/i386-softmmu.mak                   |     2 +-
 configs/targets/loongarch64-linux-user.mak         |     1 +
 configs/targets/loongarch64-softmmu.mak            |     4 +-
 configs/targets/microblaze-softmmu.mak             |     1 +
 configs/targets/microblazeel-softmmu.mak           |     1 +
 configs/targets/mips-linux-user.mak                |     1 -
 configs/targets/mips-softmmu.mak                   |     1 -
 configs/targets/mips64-linux-user.mak              |     1 -
 configs/targets/mips64-softmmu.mak                 |     1 -
 configs/targets/mips64el-linux-user.mak            |     1 -
 configs/targets/mips64el-softmmu.mak               |     2 -
 configs/targets/mipsel-linux-user.mak              |     1 -
 configs/targets/mipsel-softmmu.mak                 |     1 -
 configs/targets/mipsn32-linux-user.mak             |     1 -
 configs/targets/mipsn32el-linux-user.mak           |     1 -
 configs/targets/nios2-linux-user.mak               |     1 -
 configs/targets/nios2-softmmu.mak                  |     3 -
 configs/targets/or1k-softmmu.mak                   |     1 +
 configs/targets/ppc-softmmu.mak                    |     2 +-
 configs/targets/ppc64-softmmu.mak                  |     2 +
 configs/targets/riscv32-softmmu.mak                |     1 +
 configs/targets/riscv64-softmmu.mak                |     2 +
 configs/targets/rx-softmmu.mak                     |     1 +
 configs/targets/s390x-linux-user.mak               |     2 +-
 configs/targets/s390x-softmmu.mak                  |     3 +-
 configs/targets/sh4-linux-user.mak                 |     1 -
 configs/targets/sh4-softmmu.mak                    |     1 -
 configs/targets/sh4eb-linux-user.mak               |     1 -
 configs/targets/sh4eb-softmmu.mak                  |     1 -
 configs/targets/sparc-linux-user.mak               |     1 -
 configs/targets/sparc-softmmu.mak                  |     2 +-
 configs/targets/sparc32plus-linux-user.mak         |     1 -
 configs/targets/sparc64-linux-user.mak             |     1 -
 configs/targets/sparc64-softmmu.mak                |     2 +-
 configs/targets/x86_64-softmmu.mak                 |     2 +-
 configure                                          |  1910 +-
 contrib/elf2dmp/addrspace.c                        |    99 +-
 contrib/elf2dmp/addrspace.h                        |     7 +-
 contrib/elf2dmp/download.c                         |    12 +-
 contrib/elf2dmp/download.h                         |     2 +-
 contrib/elf2dmp/main.c                             |   330 +-
 contrib/elf2dmp/pdb.c                              |   104 +-
 contrib/elf2dmp/pdb.h                              |     4 +-
 contrib/elf2dmp/qemu_elf.c                         |   203 +-
 contrib/elf2dmp/qemu_elf.h                         |     4 +-
 contrib/gitdm/domain-map                           |     4 +
 contrib/ivshmem-client/meson.build                 |     2 +-
 contrib/ivshmem-server/main.c                      |     4 +-
 contrib/ivshmem-server/meson.build                 |     2 +-
 contrib/plugins/Makefile                           |    68 +-
 contrib/plugins/cache.c                            |    45 +-
 contrib/plugins/drcov.c                            |     4 +-
 contrib/plugins/execlog.c                          |   345 +-
 contrib/plugins/hotblocks.c                        |    52 +-
 contrib/plugins/hotpages.c                         |     2 +-
 contrib/plugins/howvec.c                           |    65 +-
 contrib/plugins/hwprofile.c                        |     2 +-
 contrib/plugins/ips.c                              |   164 +
 contrib/plugins/lockstep.c                         |    70 +-
 contrib/plugins/stoptrigger.c                      |   151 +
 contrib/plugins/win32_linker.c                     |    34 +
 contrib/rdmacm-mux/main.c                          |   831 -
 contrib/rdmacm-mux/meson.build                     |     7 -
 contrib/rdmacm-mux/rdmacm-mux.h                    |    61 -
 contrib/systemd/qemu-vmsr-helper.service           |    15 +
 contrib/systemd/qemu-vmsr-helper.socket            |     9 +
 contrib/vhost-user-blk/meson.build                 |     2 +-
 contrib/vhost-user-blk/vhost-user-blk.c            |    15 +-
 contrib/vhost-user-gpu/vhost-user-gpu.c            |    82 +-
 contrib/vhost-user-gpu/virgl.c                     |    56 +-
 contrib/vhost-user-gpu/vugpu.h                     |    28 +-
 contrib/vhost-user-input/main.c                    |    16 +-
 contrib/vhost-user-input/meson.build               |     2 +-
 contrib/vhost-user-scsi/meson.build                |     2 +-
 cpu-common.c                                       |   454 +
 cpu-target.c                                       |   474 +
 cpu.c                                              |   441 -
 cpus-common.c                                      |   442 -
 crypto/aes.c                                       |   774 +-
 crypto/afalg.c                                     |     2 +-
 crypto/block-luks.c                                |    69 +-
 crypto/block-qcow.c                                |     8 +-
 crypto/block.c                                     |   118 +-
 crypto/blockpriv.h                                 |    15 +-
 crypto/cipher-gcrypt.c.inc                         |   119 +-
 crypto/cipher-gnutls.c.inc                         |     4 +-
 crypto/cipher-nettle.c.inc                         |    49 +
 crypto/cipher.c                                    |     6 +
 crypto/clmul.c                                     |   111 +
 crypto/der.c                                       |     2 +-
 crypto/der.h                                       |     6 +-
 crypto/hmacpriv.h                                  |    13 +-
 crypto/init.c                                      |    15 +-
 crypto/meson.build                                 |    12 +-
 crypto/rsakey-builtin.c.inc                        |     8 +-
 crypto/sm4.c                                       |    10 +
 crypto/tls-cipher-suites.c                         |     1 -
 crypto/tlscredspsk.c                               |     1 +
 crypto/tlssession.c                                |   124 +-
 disas.c                                            |   398 -
 disas/cris.c                                       |    26 +-
 disas/disas-common.c                               |   104 +
 disas/disas-host.c                                 |   129 +
 disas/disas-internal.h                             |    25 +
 disas/disas-mon.c                                  |    81 +
 disas/disas-target.c                               |    99 +
 disas/hppa.c                                       |    12 +-
 disas/m68k.c                                       |    10 +-
 disas/meson.build                                  |    17 +-
 disas/microblaze.c                                 |   544 +-
 disas/nanomips.c                                   |   194 +-
 disas/nios2.c                                      |  3514 ----
 disas/objdump.c                                    |    37 +
 disas/riscv-xthead.c                               |   708 +
 disas/riscv-xthead.h                               |    28 +
 disas/riscv-xventana.c                             |    42 +
 disas/riscv-xventana.h                             |    18 +
 disas/riscv.c                                      |  2561 ++-
 disas/riscv.h                                      |   305 +
 docs/COLO-FT.txt                                   |     1 +
 docs/about/build-platforms.rst                     |     6 +-
 docs/about/deprecated.rst                          |   323 +-
 docs/about/emulation.rst                           |   616 +-
 docs/about/index.rst                               |     2 +-
 docs/about/license.rst                             |     2 +-
 docs/about/removed-features.rst                    |   281 +-
 docs/colo-proxy.txt                                |     6 +-
 docs/conf.py                                       |    28 +-
 docs/config/q35-emulated.cfg                       |     4 +
 docs/config/q35-virtio-graphical.cfg               |     4 +
 docs/devel/acpi-bits.rst                           |    63 +-
 docs/devel/atomics.rst                             |    40 +-
 docs/devel/build-system.rst                        |   408 +-
 docs/devel/ci-jobs.rst.inc                         |    27 +-
 docs/devel/ci-runners.rst.inc                      |    13 +-
 docs/devel/clocks.rst                              |     6 +-
 docs/devel/crypto.rst                              |    10 +
 docs/devel/decodetree.rst                          |    33 +-
 docs/devel/docs.rst                                |    68 +
 docs/devel/index-api.rst                           |     4 +
 docs/devel/index-build.rst                         |     1 +
 docs/devel/index-internals.rst                     |     6 +-
 docs/devel/index-process.rst                       |     2 +
 docs/devel/index-tcg.rst                           |     2 +
 docs/devel/index.rst                               |    24 +-
 docs/devel/kconfig.rst                             |    34 +-
 docs/devel/loads-stores.rst                        |    78 +-
 docs/devel/luks-detached-header.rst                |   182 +
 docs/devel/migration.rst                           |   879 -
 docs/devel/migration/CPR.rst                       |   147 +
 docs/devel/migration/best-practices.rst            |    48 +
 docs/devel/migration/compatibility.rst             |   517 +
 docs/devel/migration/dirty-limit.rst               |    71 +
 docs/devel/migration/features.rst                  |    16 +
 docs/devel/migration/index.rst                     |    13 +
 docs/devel/migration/main.rst                      |   596 +
 docs/devel/migration/mapped-ram.rst                |   142 +
 docs/devel/migration/postcopy.rst                  |   314 +
 docs/devel/migration/qpl-compression.rst           |   260 +
 docs/devel/migration/uadk-compression.rst          |   144 +
 docs/devel/migration/vfio.rst                      |   208 +
 docs/devel/migration/virtio.rst                    |   115 +
 docs/devel/multi-process.rst                       |     5 +-
 docs/devel/multi-thread-tcg.rst                    |    21 +-
 docs/devel/multiple-iothreads.txt                  |    68 +-
 docs/devel/nested-papr.txt                         |   119 +
 docs/devel/pci.rst                                 |     8 +
 docs/devel/qapi-code-gen.rst                       |   233 +-
 docs/devel/qdev-api.rst                            |     7 +
 docs/devel/qom-api.rst                             |     9 +
 docs/devel/qom.rst                                 |   101 +-
 docs/devel/qtest.rst                               |     2 +-
 docs/devel/replay.rst                              |     2 +-
 docs/devel/reset.rst                               |    88 +-
 docs/devel/s390-cpu-topology.rst                   |   170 +
 docs/devel/style.rst                               |   123 +-
 docs/devel/submitting-a-patch.rst                  |     2 +-
 docs/devel/tcg-icount.rst                          |     6 -
 docs/devel/tcg-ops.rst                             |    28 +-
 docs/devel/tcg-plugins.rst                         |   532 +-
 docs/devel/tcg.rst                                 |     2 +
 docs/devel/testing.rst                             |   132 +-
 docs/devel/tracing.rst                             |     3 +-
 docs/devel/vfio-iommufd.rst                        |   166 +
 docs/devel/vfio-migration.rst                      |   162 -
 docs/devel/virtio-migration.txt                    |   108 -
 docs/devel/writing-monitor-commands.rst            |   494 +-
 docs/devel/zoned-storage.rst                       |    62 +
 docs/interop/bitmaps.rst                           |     6 +-
 docs/interop/firmware.json                         |   441 +-
 docs/interop/index.rst                             |     4 +
 docs/interop/live-block-operations.rst             |     4 +-
 docs/interop/nbd.rst                               |    89 +
 docs/interop/nbd.txt                               |    71 -
 docs/interop/parallels.rst                         |   240 +
 docs/interop/parallels.txt                         |   232 -
 docs/interop/prl-xml.rst                           |   192 +
 docs/interop/prl-xml.txt                           |   158 -
 docs/interop/qcow2.txt                             |    11 +-
 docs/interop/qemu-ga.rst                           |    29 +-
 docs/interop/qmp-intro.txt                         |    88 -
 docs/interop/qmp-spec.rst                          |   439 +
 docs/interop/qmp-spec.txt                          |   406 -
 docs/interop/vhost-user-gpu.rst                    |    52 +-
 docs/interop/vhost-user.rst                        |   439 +-
 docs/meson.build                                   |    19 +-
 docs/multi-thread-compression.txt                  |    12 +-
 docs/pci_expander_bridge.txt                       |     2 +-
 docs/pcie_sriov.txt                                |     9 +-
 docs/pvrdma.txt                                    |   345 -
 docs/rdma.txt                                      |     2 +-
 docs/requirements.txt                              |     5 +
 docs/specs/acpi_hw_reduced_hotplug.rst             |     3 +-
 docs/specs/edu.rst                                 |   135 +
 docs/specs/edu.txt                                 |   115 -
 docs/specs/fsi.rst                                 |   122 +
 docs/specs/index.rst                               |    15 +
 docs/specs/ivshmem-spec.rst                        |   241 +
 docs/specs/ivshmem-spec.txt                        |   258 -
 docs/specs/pci-ids.rst                             |   104 +
 docs/specs/pci-ids.txt                             |    70 -
 docs/specs/pci-serial.rst                          |    37 +
 docs/specs/pci-serial.txt                          |    34 -
 docs/specs/pci-testdev.rst                         |    39 +
 docs/specs/pci-testdev.txt                         |    31 -
 docs/specs/pvpanic.rst                             |    69 +
 docs/specs/pvpanic.txt                             |    54 -
 docs/specs/rapl-msr.rst                            |   155 +
 docs/specs/rocker.rst                              |  1015 +
 docs/specs/rocker.txt                              |  1014 -
 docs/specs/spdm.rst                                |   134 +
 docs/specs/standard-vga.rst                        |    94 +
 docs/specs/standard-vga.txt                        |    81 -
 docs/specs/tpm.rst                                 |    29 +-
 docs/specs/virt-ctlr.rst                           |    24 +
 docs/specs/virt-ctlr.txt                           |    26 -
 docs/specs/vmcoreinfo.rst                          |    54 +
 docs/specs/vmcoreinfo.txt                          |    53 -
 docs/specs/vmgenid.rst                             |   246 +
 docs/specs/vmgenid.txt                             |   245 -
 docs/specs/vmw_pvscsi-spec.rst                     |   115 +
 docs/specs/vmw_pvscsi-spec.txt                     |    92 -
 docs/sphinx-static/theme_overrides.css             |    49 +
 docs/sphinx/dbusdomain.py                          |     4 +
 docs/sphinx/depfile.py                             |     2 +-
 docs/sphinx/fakedbusdoc.py                         |     5 +
 docs/sphinx/hxtool.py                              |    39 +-
 docs/sphinx/kerneldoc.py                           |    38 +-
 docs/sphinx/kernellog.py                           |    28 -
 docs/sphinx/qapidoc.py                             |   307 +-
 docs/sphinx/qmp_lexer.py                           |     5 +
 docs/system/arm/aspeed.rst                         |    87 +-
 docs/system/arm/b-l475e-iot01a.rst                 |    46 +
 docs/system/arm/bananapi_m2u.rst                   |   140 +
 docs/system/arm/cpu-features.rst                   |    42 +-
 docs/system/arm/cubieboard.rst                     |     1 +
 docs/system/arm/emulation.rst                      |    64 +-
 docs/system/arm/mps2.rst                           |    37 +-
 docs/system/arm/orangepi.rst                       |     1 +
 docs/system/arm/palm.rst                           |     2 +-
 docs/system/arm/raspi.rst                          |    16 +-
 docs/system/arm/sbsa.rst                           |    90 +-
 docs/system/arm/stm32.rst                          |     6 +-
 docs/system/arm/vexpress.rst                       |     3 +
 docs/system/arm/virt.rst                           |    30 +-
 docs/system/arm/xenpvh.rst                         |    39 +
 docs/system/arm/xlnx-versal-virt.rst               |    35 +-
 docs/system/arm/xlnx-zynq.rst                      |    47 +
 docs/system/arm/xscale.rst                         |     2 +-
 docs/system/cpu-models-x86-abi.csv                 |    20 +-
 docs/system/cpu-models-x86.rst.inc                 |     2 +-
 docs/system/device-emulation.rst                   |     5 +
 docs/system/device-url-syntax.rst.inc              |     4 +-
 docs/system/devices/can.rst                        |     6 +-
 docs/system/devices/canokey.rst                    |     2 +-
 docs/system/devices/cxl.rst                        |    82 +-
 docs/system/devices/igb.rst                        |    16 +-
 docs/system/devices/ivshmem.rst                    |     4 +-
 docs/system/devices/keyboard.rst                   |   129 +
 docs/system/devices/net.rst                        |     2 +-
 docs/system/devices/nvme.rst                       |    56 +-
 docs/system/devices/usb-u2f.rst                    |    93 +
 docs/system/devices/usb.rst                        |     6 +-
 docs/system/devices/vhost-user-input.rst           |    45 +
 docs/system/devices/vhost-user-rng.rst             |     2 +
 docs/system/devices/vhost-user.rst                 |    81 +-
 docs/system/devices/virtio-gpu.rst                 |   112 +
 docs/system/devices/virtio-snd.rst                 |    49 +
 docs/system/gdb.rst                                |    48 +
 docs/system/guest-loader.rst                       |     6 +-
 docs/system/i386/amd-memory-encryption.rst         |    76 +-
 docs/system/i386/sgx.rst                           |     2 +-
 docs/system/i386/xen.rst                           |   108 +-
 docs/system/index.rst                              |     3 +-
 docs/system/introduction.rst                       |     7 +-
 docs/system/invocation.rst                         |     5 +
 docs/system/keys.rst                               |     2 +-
 docs/system/keys.rst.inc                           |    13 +-
 docs/system/linuxboot.rst                          |     2 +-
 docs/system/loongarch/virt.rst                     |     2 +-
 docs/system/ppc/amigang.rst                        |   161 +
 docs/system/ppc/powernv.rst                        |     5 -
 docs/system/qemu-block-drivers.rst.inc             |     7 +-
 docs/system/qemu-manpage.rst                       |     5 +
 docs/system/replay.rst                             |     4 +-
 docs/system/riscv/sifive_u.rst                     |    33 +-
 docs/system/riscv/virt.rst                         |    39 +-
 docs/system/s390x/cpu-topology.rst                 |   246 +
 docs/system/target-arm.rst                         |     8 +-
 docs/system/target-i386-desc.rst.inc               |    11 +-
 docs/system/target-i386.rst                        |     4 -
 docs/system/target-ppc.rst                         |     1 +
 docs/system/target-riscv.rst                       |    24 +-
 docs/system/target-s390x.rst                       |     1 +
 docs/system/target-sparc.rst                       |    14 +-
 docs/system/vm-templating.rst                      |   125 +
 docs/tools/index.rst                               |     1 +
 docs/tools/qemu-img.rst                            |    27 +-
 docs/tools/qemu-nbd.rst                            |     4 +-
 docs/tools/qemu-vmsr-helper.rst                    |    89 +
 docs/tools/virtfs-proxy-helper.rst                 |     3 +
 docs/u2f.txt                                       |   110 -
 docs/user/main.rst                                 |    19 +-
 dtc                                                |     1 -
 dump/dump-hmp-cmds.c                               |    19 +-
 dump/dump.c                                        |   195 +-
 dump/meson.build                                   |     4 +-
 dump/win_dump.c                                    |     7 +-
 ebpf/ebpf.c                                        |    69 +
 ebpf/ebpf.h                                        |    29 +
 ebpf/ebpf_rss-stub.c                               |     6 +
 ebpf/ebpf_rss.c                                    |   151 +-
 ebpf/ebpf_rss.h                                    |    10 +
 ebpf/meson.build                                   |     2 +-
 ebpf/rss.bpf.skeleton.h                            |  1509 +-
 ebpf/trace-events                                  |     2 +-
 fpu/softfloat-parts.c.inc                          |    85 +-
 fpu/softfloat-specialize.c.inc                     |    33 +-
 fpu/softfloat.c                                    |   120 +-
 fsdev/meson.build                                  |     6 +-
 fsdev/qemu-fsdev-throttle.c                        |    18 +-
 fsdev/qemu-fsdev-throttle.h                        |     4 +-
 fsdev/qemu-fsdev.c                                 |     8 +
 fsdev/virtfs-proxy-helper.c                        |     9 +
 gdb-xml/aarch64-mte.xml                            |    11 +
 gdb-xml/aarch64-pauth.xml                          |     2 +-
 gdb-xml/arm-neon.xml                               |     2 +-
 gdb-xml/hexagon-core.xml                           |    88 +
 gdb-xml/hexagon-hvx.xml                            |    96 +
 gdb-xml/loongarch-base32.xml                       |    45 +
 gdb-xml/loongarch-fpu.xml                          |     9 +-
 gdb-xml/loongarch-lasx.xml                         |    60 +
 gdb-xml/loongarch-lsx.xml                          |    59 +
 gdb-xml/s390-virt-kvm.xml                          |    14 +
 gdb-xml/s390-virt.xml                              |     4 -
 gdbstub/gdbstub.c                                  |   889 +-
 gdbstub/internals.h                                |    79 +-
 gdbstub/meson.build                                |    26 +-
 gdbstub/softmmu.c                                  |   651 -
 gdbstub/syscalls.c                                 |     7 +-
 gdbstub/system.c                                   |   665 +
 gdbstub/trace-events                               |     3 +-
 gdbstub/user-target.c                              |   153 +-
 gdbstub/user.c                                     |   420 +-
 hmp-commands-info.hx                               |    48 +-
 hmp-commands.hx                                    |    65 +-
 host/include/aarch64/host/atomic128-cas.h          |    45 +
 host/include/aarch64/host/atomic128-ldst.h         |    79 +
 host/include/aarch64/host/bufferiszero.c.inc       |    76 +
 host/include/aarch64/host/cpuinfo.h                |    25 +
 host/include/aarch64/host/crypto/aes-round.h       |   205 +
 host/include/aarch64/host/crypto/clmul.h           |    41 +
 .../aarch64/host/load-extract-al16-al8.h.inc       |    40 +
 host/include/aarch64/host/store-insert-al16.h.inc  |    47 +
 host/include/generic/host/atomic128-cas.h          |    47 +
 host/include/generic/host/atomic128-ldst.h         |    81 +
 host/include/generic/host/bufferiszero.c.inc       |    10 +
 host/include/generic/host/cpuinfo.h                |     4 +
 host/include/generic/host/crypto/aes-round.h       |    33 +
 host/include/generic/host/crypto/clmul.h           |    15 +
 .../generic/host/load-extract-al16-al8.h.inc       |    45 +
 host/include/generic/host/store-insert-al16.h.inc  |    50 +
 host/include/i386/host/bufferiszero.c.inc          |   125 +
 host/include/i386/host/cpuinfo.h                   |    39 +
 host/include/i386/host/crypto/aes-round.h          |   152 +
 host/include/i386/host/crypto/clmul.h              |    29 +
 host/include/loongarch64/host/atomic128-ldst.h     |    52 +
 host/include/loongarch64/host/bufferiszero.c.inc   |   143 +
 host/include/loongarch64/host/cpuinfo.h            |    22 +
 .../loongarch64/host/load-extract-al16-al8.h.inc   |    39 +
 .../loongarch64/host/store-insert-al16.h.inc       |    12 +
 host/include/ppc/host/cpuinfo.h                    |    30 +
 host/include/ppc/host/crypto/aes-round.h           |   182 +
 host/include/ppc64/host/cpuinfo.h                  |     1 +
 host/include/ppc64/host/crypto/aes-round.h         |     1 +
 host/include/riscv/host/cpuinfo.h                  |    23 +
 host/include/x86_64/host/atomic128-ldst.h          |    75 +
 host/include/x86_64/host/bufferiszero.c.inc        |     1 +
 host/include/x86_64/host/cpuinfo.h                 |     1 +
 host/include/x86_64/host/crypto/aes-round.h        |     1 +
 host/include/x86_64/host/crypto/clmul.h            |     1 +
 .../x86_64/host/load-extract-al16-al8.h.inc        |    50 +
 hw/9pfs/9p-local.c                                 |     8 +-
 hw/9pfs/9p-proxy.c                                 |     7 +-
 hw/9pfs/9p-proxy.h                                 |     5 +
 hw/9pfs/9p-synth.c                                 |     2 +-
 hw/9pfs/9p-util.h                                  |     2 +-
 hw/9pfs/9p.c                                       |    19 +-
 hw/9pfs/9p.h                                       |     6 +-
 hw/9pfs/codir.c                                    |     6 +-
 hw/9pfs/cofile.c                                   |     4 +-
 hw/9pfs/coth.c                                     |     3 +-
 hw/9pfs/meson.build                                |     9 +-
 hw/9pfs/virtio-9p-device.c                         |     2 +-
 hw/9pfs/xen-9p-backend.c                           |    13 +-
 hw/Kconfig                                         |     5 +-
 hw/acpi/acpi-cpu-hotplug-stub.c                    |     6 +
 hw/acpi/acpi-x86-stub.c                            |     6 -
 hw/acpi/acpi_generic_initiator.c                   |   148 +
 hw/acpi/aml-build.c                                |    59 +-
 hw/acpi/core.c                                     |    61 +-
 hw/acpi/cpu.c                                      |    29 +-
 hw/acpi/cpu_hotplug.c                              |    49 +-
 hw/acpi/cxl.c                                      |    80 +-
 hw/acpi/erst.c                                     |    12 +-
 hw/acpi/generic_event_device.c                     |    62 +-
 hw/acpi/hmat.c                                     |    18 +-
 hw/acpi/hmat.h                                     |     3 +-
 hw/acpi/ich9.c                                     |    58 +-
 hw/acpi/ich9_tco.c                                 |     2 +-
 hw/acpi/memory_hotplug.c                           |    13 +-
 hw/acpi/meson.build                                |    14 +-
 hw/acpi/nvdimm.c                                   |    13 +-
 hw/acpi/pcihp.c                                    |     7 +-
 hw/acpi/piix4.c                                    |    17 +-
 hw/acpi/trace-events                               |    10 +-
 hw/acpi/vmgenid.c                                  |     2 +-
 hw/adc/aspeed_adc.c                                |    18 +-
 hw/adc/max111x.c                                   |     2 +-
 hw/adc/meson.build                                 |    10 +-
 hw/adc/npcm7xx_adc.c                               |     4 +-
 hw/adc/stm32f2xx_adc.c                             |     2 +-
 hw/adc/zynq-xadc.c                                 |     2 +-
 hw/alpha/Kconfig                                   |     2 +
 hw/alpha/dp264.c                                   |     6 +-
 hw/alpha/typhoon.c                                 |     6 +-
 hw/arm/Kconfig                                     |   184 +-
 hw/arm/allwinner-a10.c                             |    67 +-
 hw/arm/allwinner-h3.c                              |    16 +-
 hw/arm/allwinner-r40.c                             |   565 +
 hw/arm/armsse.c                                    |    40 +-
 hw/arm/armv7m.c                                    |    38 +-
 hw/arm/aspeed.c                                    |   390 +-
 hw/arm/aspeed_ast10x0.c                            |    64 +-
 hw/arm/aspeed_ast2400.c                            |   580 +
 hw/arm/aspeed_ast2600.c                            |   127 +-
 hw/arm/aspeed_ast27x0.c                            |   665 +
 hw/arm/aspeed_eeprom.c                             |    46 +-
 hw/arm/aspeed_eeprom.h                             |     6 +-
 hw/arm/aspeed_soc.c                                |   683 -
 hw/arm/aspeed_soc_common.c                         |   171 +
 hw/arm/b-l475e-iot01a.c                            |   137 +
 hw/arm/bananapi_m2u.c                              |   146 +
 hw/arm/bcm2835_peripherals.c                       |   294 +-
 hw/arm/bcm2836.c                                   |   143 +-
 hw/arm/bcm2838.c                                   |   263 +
 hw/arm/bcm2838_peripherals.c                       |   224 +
 hw/arm/boot.c                                      |    99 +-
 hw/arm/collie.c                                    |     1 -
 hw/arm/cubieboard.c                                |    13 +-
 hw/arm/exynos4210.c                                |    21 +-
 hw/arm/exynos4_boards.c                            |    21 +-
 hw/arm/fby35.c                                     |    48 +-
 hw/arm/fsl-imx25.c                                 |    25 +-
 hw/arm/fsl-imx31.c                                 |    20 +-
 hw/arm/fsl-imx6.c                                  |    61 +-
 hw/arm/fsl-imx6ul.c                                |   227 +-
 hw/arm/fsl-imx7.c                                  |   224 +-
 hw/arm/gumstix.c                                   |     9 +-
 hw/arm/highbank.c                                  |    28 +-
 hw/arm/imx25_pdk.c                                 |     1 +
 hw/arm/integratorcp.c                              |    38 +-
 hw/arm/kzm.c                                       |     5 +-
 hw/arm/mainstone.c                                 |     5 +-
 hw/arm/mcimx6ul-evk.c                              |     3 +
 hw/arm/mcimx7d-sabre.c                             |     3 +
 hw/arm/meson.build                                 |    44 +-
 hw/arm/mps2-tz.c                                   |    81 +-
 hw/arm/mps2.c                                      |    40 +-
 hw/arm/mps3r.c                                     |   640 +
 hw/arm/msf2-soc.c                                  |     9 +-
 hw/arm/msf2-som.c                                  |    17 +-
 hw/arm/musca.c                                     |    13 +-
 hw/arm/musicpal.c                                  |   161 +-
 hw/arm/netduino2.c                                 |     8 +-
 hw/arm/netduinoplus2.c                             |     8 +-
 hw/arm/npcm7xx.c                                   |    61 +-
 hw/arm/npcm7xx_boards.c                            |    13 +-
 hw/arm/nrf51_soc.c                                 |     7 +-
 hw/arm/nseries.c                                   |    10 +-
 hw/arm/olimex-stm32-h405.c                         |     9 +-
 hw/arm/omap1.c                                     |     3 +-
 hw/arm/omap2.c                                     |    11 +-
 hw/arm/omap_sx1.c                                  |     1 -
 hw/arm/orangepi.c                                  |    15 +-
 hw/arm/palm.c                                      |     4 +-
 hw/arm/pxa2xx.c                                    |    35 +-
 hw/arm/pxa2xx_gpio.c                               |    10 +-
 hw/arm/pxa2xx_pic.c                                |    40 +-
 hw/arm/raspi.c                                     |   130 +-
 hw/arm/raspi4b.c                                   |   136 +
 hw/arm/realview.c                                  |    47 +-
 hw/arm/sabrelite.c                                 |     1 +
 hw/arm/sbsa-ref.c                                  |   190 +-
 hw/arm/smmu-common.c                               |   510 +-
 hw/arm/smmu-internal.h                             |    37 +
 hw/arm/smmuv3-internal.h                           |   115 +-
 hw/arm/smmuv3.c                                    |   720 +-
 hw/arm/spitz.c                                     |    27 +-
 hw/arm/stellaris.c                                 |   134 +-
 hw/arm/stm32f100_soc.c                             |    10 +-
 hw/arm/stm32f205_soc.c                             |    10 +-
 hw/arm/stm32f405_soc.c                             |     9 +-
 hw/arm/stm32l4x5_soc.c                             |   492 +
 hw/arm/stm32vldiscovery.c                          |     8 +-
 hw/arm/strongarm.c                                 |    96 +-
 hw/arm/tosa.c                                      |     1 +
 hw/arm/trace-events                                |    44 +-
 hw/arm/versatilepb.c                               |    35 +-
 hw/arm/vexpress.c                                  |   105 +-
 hw/arm/virt-acpi-build.c                           |   215 +-
 hw/arm/virt.c                                      |   490 +-
 hw/arm/xen_arm.c                                   |   267 +
 hw/arm/xilinx_zynq.c                               |   106 +-
 hw/arm/xlnx-versal-virt.c                          |   107 +-
 hw/arm/xlnx-versal.c                               |   228 +-
 hw/arm/xlnx-zcu102.c                               |     9 +
 hw/arm/xlnx-zynqmp.c                               |    10 +-
 hw/arm/z2.c                                        |    48 +-
 hw/audio/Kconfig                                   |     8 +
 hw/audio/ac97.c                                    |    10 +-
 hw/audio/adlib.c                                   |     6 +-
 hw/audio/asc.c                                     |   727 +
 hw/audio/cs4231.c                                  |     2 +-
 hw/audio/cs4231a.c                                 |     8 +-
 hw/audio/es1370.c                                  |   307 +-
 hw/audio/fmopl.c                                   |     8 +-
 hw/audio/fmopl.h                                   |     2 +-
 hw/audio/gus.c                                     |     8 +-
 hw/audio/gusemu_hal.c                              |     4 +-
 hw/audio/hda-codec.c                               |    74 +-
 hw/audio/intel-hda-defs.h                          |     4 +-
 hw/audio/intel-hda.c                               |     8 +-
 hw/audio/intel-hda.h                               |     2 +-
 hw/audio/lm4549.c                                  |    13 +-
 hw/audio/lm4549.h                                  |     3 +-
 hw/audio/marvell_88w8618.c                         |     2 +-
 hw/audio/meson.build                               |    31 +-
 hw/audio/pcspk.c                                   |     6 +-
 hw/audio/pl041.c                                   |    10 +-
 hw/audio/sb16.c                                    |    18 +-
 hw/audio/soundhw.c                                 |     6 +-
 hw/audio/trace-events                              |    41 +
 hw/audio/via-ac97.c                                |    14 +-
 hw/audio/virtio-snd-pci.c                          |    95 +
 hw/audio/virtio-snd.c                              |  1418 ++
 hw/audio/wm8750.c                                  |     7 +-
 hw/avr/Kconfig                                     |     3 +
 hw/avr/atmega.c                                    |     4 +
 hw/block/block.c                                   |    27 +-
 hw/block/dataplane/meson.build                     |     1 -
 hw/block/dataplane/trace-events                    |     5 -
 hw/block/dataplane/trace.h                         |     1 -
 hw/block/dataplane/virtio-blk.c                    |   359 -
 hw/block/dataplane/virtio-blk.h                    |    31 -
 hw/block/dataplane/xen-block.c                     |    73 +-
 hw/block/dataplane/xen-block.h                     |     2 +
 hw/block/ecc.c                                     |     2 +-
 hw/block/fdc-internal.h                            |     4 -
 hw/block/fdc-isa.c                                 |    22 +-
 hw/block/fdc-sysbus.c                              |     8 +-
 hw/block/fdc.c                                     |    20 +-
 hw/block/hd-geometry.c                             |     4 +-
 hw/block/m25p80.c                                  |    44 +-
 hw/block/m25p80_sfdp.c                             |    36 +
 hw/block/m25p80_sfdp.h                             |     1 +
 hw/block/meson.build                               |    28 +-
 hw/block/nand.c                                    |    57 +-
 hw/block/onenand.c                                 |     2 +-
 hw/block/pflash_cfi01.c                            |   186 +-
 hw/block/pflash_cfi02.c                            |     4 +-
 hw/block/swim.c                                    |   267 +-
 hw/block/tc58128.c                                 |     3 +
 hw/block/trace-events                              |    22 +-
 hw/block/vhost-user-blk.c                          |    36 +-
 hw/block/virtio-blk-common.c                       |     2 +
 hw/block/virtio-blk.c                              |  1195 +-
 hw/block/xen-block.c                               |   176 +-
 hw/char/Kconfig                                    |     3 +
 hw/char/bcm2835_aux.c                              |     4 +-
 hw/char/cadence_uart.c                             |    14 +-
 hw/char/cmsdk-apb-uart.c                           |     8 +-
 hw/char/digic-uart.c                               |     2 +-
 hw/char/escc.c                                     |    89 +-
 hw/char/exynos4210_uart.c                          |     4 +-
 hw/char/goldfish_tty.c                             |    14 +-
 hw/char/grlib_apbuart.c                            |     6 +-
 hw/char/ibex_uart.c                                |    10 +-
 hw/char/imx_serial.c                               |   109 +-
 hw/char/ipoctal232.c                               |     6 +-
 hw/char/mcf_uart.c                                 |    13 +-
 hw/char/mchp_pfsoc_mmuart.c                        |     2 +-
 hw/char/meson.build                                |    72 +-
 hw/char/nrf51_uart.c                               |     6 +-
 hw/char/omap_uart.c                                |    58 +-
 hw/char/parallel-isa.c                             |    17 +-
 hw/char/parallel.c                                 |    37 +-
 hw/char/pl011.c                                    |   185 +-
 hw/char/renesas_sci.c                              |     2 +-
 hw/char/riscv_htif.c                               |    61 +-
 hw/char/sclpconsole-lm.c                           |     2 +-
 hw/char/sclpconsole.c                              |     2 +-
 hw/char/serial-isa.c                               |    16 +-
 hw/char/serial-pci-multi.c                         |     4 +-
 hw/char/serial-pci.c                               |     4 +-
 hw/char/serial.c                                   |    24 +-
 hw/char/sifive_uart.c                              |     4 +-
 hw/char/spapr_vty.c                                |     2 +-
 hw/char/stm32f2xx_usart.c                          |    29 +-
 hw/char/stm32l4x5_usart.c                          |   638 +
 hw/char/trace-events                               |    24 +-
 hw/char/virtio-console.c                           |     2 +-
 hw/char/virtio-serial-bus.c                        |     4 +-
 hw/char/xen_console.c                              |   573 +-
 hw/core/Kconfig                                    |     9 +-
 hw/core/bus.c                                      |    67 -
 hw/core/clock-vmstate.c                            |     6 +-
 hw/core/clock.c                                    |     9 +-
 hw/core/cpu-common.c                               |    99 +-
 hw/core/cpu-sysemu.c                               |     8 +-
 hw/core/generic-loader.c                           |     6 +-
 hw/core/hotplug-stubs.c                            |    34 -
 hw/core/loader-fit.c                               |     4 +-
 hw/core/loader.c                                   |    64 +-
 hw/core/machine-hmp-cmds.c                         |    25 +
 hw/core/machine-qmp-cmds.c                         |   105 +-
 hw/core/machine-smp.c                              |   105 +-
 hw/core/machine.c                                  |   298 +-
 hw/core/meson.build                                |    44 +-
 hw/core/numa.c                                     |    16 +-
 hw/core/or-irq.c                                   |     6 +-
 hw/core/ptimer.c                                   |     6 +-
 hw/core/qdev-properties-system.c                   |   158 +-
 hw/core/qdev-properties.c                          |   270 +-
 hw/core/qdev.c                                     |    16 +-
 hw/core/reset.c                                    |   163 +-
 hw/core/resetcontainer.c                           |    77 +
 hw/core/resettable.c                               |     8 +-
 hw/core/sysbus.c                                   |    11 -
 hw/core/trace-events                               |     3 +
 hw/core/vm-change-state-handler.c                  |    14 +-
 hw/cpu/Kconfig                                     |    15 +-
 hw/cpu/a15mpcore.c                                 |     3 +-
 hw/cpu/a9mpcore.c                                  |     2 +-
 hw/cpu/cluster.c                                   |     5 +-
 hw/cpu/core.c                                      |     7 +-
 hw/cpu/meson.build                                 |     9 +-
 hw/cris/Kconfig                                    |     2 +
 hw/cris/axis_dev88.c                               |     9 +-
 hw/cxl/cxl-cdat.c                                  |    98 +-
 hw/cxl/cxl-component-utils.c                       |   282 +-
 hw/cxl/cxl-device-utils.c                          |   234 +-
 hw/cxl/cxl-events.c                                |   262 +
 hw/cxl/cxl-host.c                                  |    87 +-
 hw/cxl/cxl-mailbox-utils.c                         |  3029 ++-
 hw/cxl/meson.build                                 |     6 +-
 hw/cxl/switch-mailbox-cci.c                        |   111 +
 hw/display/Kconfig                                 |    13 +-
 hw/display/artist.c                                |     2 +-
 hw/display/ati.c                                   |    78 +-
 hw/display/ati_2d.c                                |    81 +-
 hw/display/ati_dbg.c                               |     2 +
 hw/display/ati_int.h                               |     2 +
 hw/display/ati_regs.h                              |     2 +
 hw/display/bcm2835_fb.c                            |     4 +-
 hw/display/bochs-display.c                         |     4 +-
 hw/display/cg3.c                                   |     2 +-
 hw/display/cirrus_vga.c                            |    32 +-
 hw/display/dm163.c                                 |   349 +
 hw/display/dpcd.c                                  |     2 +-
 hw/display/exynos4210_fimd.c                       |    23 +-
 hw/display/g364fb.c                                |     4 +-
 hw/display/i2c-ddc.c                               |     2 +-
 hw/display/jazz_led.c                              |     2 +-
 hw/display/macfb.c                                 |    26 +-
 hw/display/meson.build                             |   132 +-
 hw/display/pl110.c                                 |    22 +-
 hw/display/pxa2xx_lcd.c                            |     4 +-
 hw/display/qxl-render.c                            |     6 +-
 hw/display/qxl.c                                   |    26 +-
 hw/display/qxl.h                                   |     2 +-
 hw/display/ramfb-standalone.c                      |    27 +
 hw/display/ramfb-stubs.c                           |    15 +
 hw/display/ramfb.c                                 |    20 +
 hw/display/sii9022.c                               |     2 +-
 hw/display/sm501.c                                 |    51 +-
 hw/display/ssd0303.c                               |     4 +-
 hw/display/ssd0323.c                               |     4 +-
 hw/display/tcx.c                                   |     2 +-
 hw/display/trace-events                            |    14 +
 hw/display/vga-helpers.h                           |   121 +-
 hw/display/vga-isa.c                               |     2 +-
 hw/display/vga-pci.c                               |     4 +-
 hw/display/vga.c                                   |   656 +-
 hw/display/vga_int.h                               |    19 +-
 hw/display/vga_regs.h                              |     4 +
 hw/display/vhost-user-gpu.c                        |    92 +-
 hw/display/virtio-dmabuf.c                         |   146 +
 hw/display/virtio-gpu-base.c                       |    37 +-
 hw/display/virtio-gpu-gl.c                         |     9 +-
 hw/display/virtio-gpu-pci-rutabaga.c               |    48 +
 hw/display/virtio-gpu-pci.c                        |    14 +
 hw/display/virtio-gpu-rutabaga.c                   |  1143 ++
 hw/display/virtio-gpu-udmabuf.c                    |    30 +-
 hw/display/virtio-gpu-virgl.c                      |    45 +-
 hw/display/virtio-gpu.c                            |   474 +-
 hw/display/virtio-vga-rutabaga.c                   |    50 +
 hw/display/virtio-vga.c                            |    39 +-
 hw/display/vmware_vga.c                            |    18 +-
 hw/display/xenfb.c                                 |    26 +-
 hw/display/xlnx_dp.c                               |    23 +-
 hw/dma/bcm2835_dma.c                               |     4 +-
 hw/dma/etraxfs_dma.c                               |     1 +
 hw/dma/i82374.c                                    |     4 +-
 hw/dma/i8257.c                                     |     8 +-
 hw/dma/meson.build                                 |    32 +-
 hw/dma/omap_dma.c                                  |     4 +-
 hw/dma/pl080.c                                     |     4 +-
 hw/dma/pl330.c                                     |    35 +-
 hw/dma/pxa2xx_dma.c                                |     4 +-
 hw/dma/rc4030.c                                    |     2 +-
 hw/dma/soc_dma.c                                   |     4 +-
 hw/dma/sparc32_dma.c                               |     2 +-
 hw/dma/trace-events                                |     3 +
 hw/dma/xilinx_axidma.c                             |    41 +-
 hw/dma/xlnx-zdma.c                                 |     9 +-
 hw/dma/xlnx-zynq-devcfg.c                          |     4 +-
 hw/dma/xlnx_csu_dma.c                              |    29 +-
 hw/dma/xlnx_dpdma.c                                |    90 +-
 hw/fsi/Kconfig                                     |     7 +
 hw/fsi/aspeed_apb2opb.c                            |   367 +
 hw/fsi/cfam.c                                      |   168 +
 hw/fsi/fsi-master.c                                |   170 +
 hw/fsi/fsi.c                                       |   102 +
 hw/fsi/lbus.c                                      |   117 +
 hw/fsi/meson.build                                 |     2 +
 hw/fsi/trace-events                                |    13 +
 hw/fsi/trace.h                                     |     1 +
 hw/gpio/Kconfig                                    |     7 +
 hw/gpio/aspeed_gpio.c                              |    21 +-
 hw/gpio/bcm2835_gpio.c                             |     2 +-
 hw/gpio/bcm2838_gpio.c                             |   390 +
 hw/gpio/gpio_key.c                                 |     2 +-
 hw/gpio/imx_gpio.c                                 |     2 +-
 hw/gpio/max7310.c                                  |     2 +-
 hw/gpio/meson.build                                |    33 +-
 hw/gpio/mpc8xxx.c                                  |     2 +-
 hw/gpio/npcm7xx_gpio.c                             |     4 +-
 hw/gpio/nrf51_gpio.c                               |    16 +-
 hw/gpio/pca9552.c                                  |   481 +
 hw/gpio/pca9554.c                                  |   328 +
 hw/gpio/pcf8574.c                                  |   162 +
 hw/gpio/pl061.c                                    |     4 +-
 hw/gpio/sifive_gpio.c                              |     2 +-
 hw/gpio/stm32l4x5_gpio.c                           |   479 +
 hw/gpio/trace-events                               |    10 +
 hw/gpio/zaurus.c                                   |    63 +-
 hw/hppa/Kconfig                                    |     5 +
 hw/hppa/hppa_hardware.h                            |     1 -
 hw/hppa/machine.c                                  |   556 +-
 hw/hyperv/Kconfig                                  |    10 +
 hw/hyperv/hv-balloon-internal.h                    |    32 +
 hw/hyperv/hv-balloon-our_range_memslots.c          |   202 +
 hw/hyperv/hv-balloon-our_range_memslots.h          |   109 +
 hw/hyperv/hv-balloon-page_range_tree.c             |   229 +
 hw/hyperv/hv-balloon-page_range_tree.h             |   117 +
 hw/hyperv/hv-balloon-stub.c                        |    19 +
 hw/hyperv/hv-balloon.c                             |  1773 ++
 hw/hyperv/hyperv.c                                 |    41 +
 hw/hyperv/meson.build                              |     1 +
 hw/hyperv/trace-events                             |    18 +
 hw/hyperv/vmbus.c                                  |    33 +-
 hw/i2c/Kconfig                                     |     4 +
 hw/i2c/allwinner-i2c.c                             |     7 +-
 hw/i2c/aspeed_i2c.c                                |    90 +-
 hw/i2c/bcm2835_i2c.c                               |   282 +
 hw/i2c/bitbang_i2c.c                               |     2 +-
 hw/i2c/core.c                                      |     6 +-
 hw/i2c/exynos4210_i2c.c                            |     2 +-
 hw/i2c/i2c_mux_pca954x.c                           |    22 +
 hw/i2c/imx_i2c.c                                   |     2 +-
 hw/i2c/meson.build                                 |     3 +-
 hw/i2c/microbit_i2c.c                              |     2 +-
 hw/i2c/mpc_i2c.c                                   |    10 +-
 hw/i2c/npcm7xx_smbus.c                             |     4 +-
 hw/i2c/pm_smbus.c                                  |    26 +-
 hw/i2c/pmbus_device.c                              |   258 +-
 hw/i2c/smbus_eeprom.c                              |     2 +-
 hw/i2c/smbus_ich9.c                                |     2 +-
 hw/i2c/smbus_slave.c                               |    12 +-
 hw/i2c/trace-events                                |     8 +-
 hw/i386/Kconfig                                    |    21 +-
 hw/i386/acpi-build.c                               |   302 +-
 hw/i386/acpi-common.c                              |    15 +-
 hw/i386/acpi-common.h                              |     6 +-
 hw/i386/acpi-microvm.c                             |    22 +-
 hw/i386/amd_iommu-stub.c                           |    26 +
 hw/i386/amd_iommu.c                                |   137 +-
 hw/i386/amd_iommu.h                                |    27 +-
 hw/i386/e820_memory_layout.c                       |    17 +-
 hw/i386/e820_memory_layout.h                       |     8 +-
 hw/i386/fw_cfg.c                                   |    40 +-
 hw/i386/fw_cfg.h                                   |     5 +-
 hw/i386/generic_event_device_x86.c                 |    36 -
 hw/i386/intel_iommu.c                              |   506 +-
 hw/i386/intel_iommu_internal.h                     |    13 +-
 hw/i386/kvm/apic.c                                 |     3 +-
 hw/i386/kvm/clock.c                                |    14 +-
 hw/i386/kvm/clock.h                                |    18 +
 hw/i386/kvm/i8254.c                                |    40 +-
 hw/i386/kvm/ioapic.c                               |     3 +-
 hw/i386/kvm/meson.build                            |     3 +-
 hw/i386/kvm/trace-events                           |     2 +
 hw/i386/kvm/xen-stubs.c                            |     8 +
 hw/i386/kvm/xen_evtchn.c                           |   235 +-
 hw/i386/kvm/xen_evtchn.h                           |     3 +-
 hw/i386/kvm/xen_gnttab.c                           |    11 +-
 hw/i386/kvm/xen_overlay.c                          |     4 +-
 hw/i386/kvm/xen_primary_console.c                  |   193 +
 hw/i386/kvm/xen_primary_console.h                  |    23 +
 hw/i386/kvm/xen_xenstore.c                         |    39 +-
 hw/i386/kvm/xenstore_impl.c                        |    14 +-
 hw/i386/kvmvapic.c                                 |   871 -
 hw/i386/meson.build                                |    11 +-
 hw/i386/microvm.c                                  |    21 +-
 hw/i386/monitor.c                                  |    46 +
 hw/i386/pc.c                                       |   668 +-
 hw/i386/pc_piix.c                                  |   693 +-
 hw/i386/pc_q35.c                                   |   413 +-
 hw/i386/pc_sysfw.c                                 |    55 +-
 hw/i386/port92.c                                   |     3 +-
 hw/i386/sgx-stub.c                                 |     7 +-
 hw/i386/sgx.c                                      |    34 +-
 hw/i386/trace-events                               |    10 +
 hw/i386/vapic.c                                    |   870 +
 hw/i386/vmmouse.c                                  |    57 +-
 hw/i386/x86-common.c                               |  1049 +
 hw/i386/x86-cpu.c                                  |    97 +
 hw/i386/x86-iommu.c                                |     2 +-
 hw/i386/x86.c                                      |  1088 +-
 hw/i386/xen/meson.build                            |     5 +-
 hw/i386/xen/trace-events                           |    19 -
 hw/i386/xen/xen-hvm.c                              |  1166 +-
 hw/i386/xen/xen-mapcache.c                         |   599 -
 hw/i386/xen/xen_apic.c                             |     3 +-
 hw/i386/xen/xen_platform.c                         |    80 +-
 hw/i386/xen/xen_pvdevice.c                         |     2 +-
 hw/ide/Kconfig                                     |    32 +-
 hw/ide/ahci-allwinner.c                            |     5 +-
 hw/ide/ahci-internal.h                             |   386 +
 hw/ide/ahci.c                                      |   186 +-
 hw/ide/ahci_internal.h                             |   393 -
 hw/ide/atapi.c                                     |    16 +-
 hw/ide/cf.c                                        |    58 +
 hw/ide/cmd646.c                                    |     6 +-
 hw/ide/core.c                                      |   116 +-
 hw/ide/ich.c                                       |    14 +-
 hw/ide/ide-bus.c                                   |   111 +
 hw/ide/ide-dev.c                                   |   270 +
 hw/ide/ide-internal.h                              |   448 +
 hw/ide/ioport.c                                    |    14 +-
 hw/ide/isa.c                                       |     6 +-
 hw/ide/macio.c                                     |    14 +-
 hw/ide/meson.build                                 |    30 +-
 hw/ide/microdrive.c                                |     4 +-
 hw/ide/mmio.c                                      |     4 +-
 hw/ide/pci.c                                       |   118 +-
 hw/ide/piix.c                                      |     9 +-
 hw/ide/qdev.c                                      |   403 -
 hw/ide/sii3112.c                                   |     8 +-
 hw/ide/via.c                                       |    59 +-
 hw/input/Kconfig                                   |     2 +-
 hw/input/adb-kbd.c                                 |     4 +-
 hw/input/adb-mouse.c                               |     2 +-
 hw/input/adb.c                                     |    13 +-
 hw/input/ads7846.c                                 |     4 +-
 hw/input/hid.c                                     |    14 +-
 hw/input/lasips2.c                                 |    14 +-
 hw/input/lm832x.c                                  |     2 +-
 hw/input/meson.build                               |    31 +-
 hw/input/pckbd.c                                   |    17 +-
 hw/input/pl050.c                                   |     2 +-
 hw/input/ps2.c                                     |    30 +-
 hw/input/pxa2xx_keypad.c                           |     2 +-
 hw/input/stellaris_gamepad.c                       |   107 +
 hw/input/stellaris_input.c                         |    93 -
 hw/input/tsc2005.c                                 |   145 +-
 hw/input/tsc210x.c                                 |    77 +-
 hw/input/vhost-user-input.c                        |   136 -
 hw/input/virtio-input-hid.c                        |   162 +-
 hw/input/virtio-input.c                            |     2 +-
 hw/intc/Kconfig                                    |    20 +-
 hw/intc/allwinner-a10-pic.c                        |     2 +-
 hw/intc/apic.c                                     |   476 +-
 hw/intc/apic_common.c                              |    53 +-
 hw/intc/arm_gic.c                                  |    20 +-
 hw/intc/arm_gic_common.c                           |    21 +-
 hw/intc/arm_gic_kvm.c                              |     7 +-
 hw/intc/arm_gicv3.c                                |    67 +-
 hw/intc/arm_gicv3_common.c                         |    80 +-
 hw/intc/arm_gicv3_cpuif.c                          |   308 +-
 hw/intc/arm_gicv3_dist.c                           |    36 +
 hw/intc/arm_gicv3_its.c                            |    25 +-
 hw/intc/arm_gicv3_its_common.c                     |    15 +-
 hw/intc/arm_gicv3_its_kvm.c                        |    10 +-
 hw/intc/arm_gicv3_kvm.c                            |    12 +-
 hw/intc/arm_gicv3_redist.c                         |    24 +-
 hw/intc/armv7m_nvic.c                              |    34 +-
 hw/intc/aspeed_intc.c                              |   361 +
 hw/intc/aspeed_vic.c                               |     2 +-
 hw/intc/bcm2835_ic.c                               |     2 +-
 hw/intc/bcm2836_control.c                          |     2 +-
 hw/intc/exynos4210_combiner.c                      |     4 +-
 hw/intc/gic_internal.h                             |     8 +-
 hw/intc/gicv3_internal.h                           |    13 +
 hw/intc/goldfish_pic.c                             |    10 +-
 hw/intc/grlib_irqmp.c                              |   111 +-
 hw/intc/heathrow_pic.c                             |     4 +-
 hw/intc/i8259_common.c                             |    20 +-
 hw/intc/imx_avic.c                                 |     2 +-
 hw/intc/imx_gpcv2.c                                |     2 +-
 hw/intc/ioapic-stub.c                              |    29 +
 hw/intc/ioapic_common.c                            |    63 +-
 hw/intc/loongarch_extioi.c                         |   312 +-
 hw/intc/loongarch_ipi.c                            |   275 +-
 hw/intc/loongarch_pch_pic.c                        |     9 +-
 hw/intc/loongson_ipi.c                             |    99 +
 hw/intc/loongson_ipi_common.c                      |   347 +
 hw/intc/loongson_liointc.c                         |     2 +-
 hw/intc/m68k_irqc.c                                |    17 +-
 hw/intc/meson.build                                |    48 +-
 hw/intc/mips_gic.c                                 |     2 +-
 hw/intc/nios2_vic.c                                |   313 -
 hw/intc/omap_intc.c                                |     2 +-
 hw/intc/ompic.c                                    |     4 +-
 hw/intc/openpic.c                                  |    19 +-
 hw/intc/pl190.c                                    |     2 +-
 hw/intc/pnv_xive.c                                 |   221 +-
 hw/intc/pnv_xive2.c                                |   709 +-
 hw/intc/pnv_xive2_regs.h                           |   116 +
 hw/intc/pnv_xive_regs.h                            |     1 +
 hw/intc/ppc-uic.c                                  |     2 +-
 hw/intc/riscv_aclint.c                             |    25 +-
 hw/intc/riscv_aplic.c                              |   100 +-
 hw/intc/riscv_imsic.c                              |    29 +-
 hw/intc/rx_icu.c                                   |     2 +-
 hw/intc/s390_flic.c                                |   109 +-
 hw/intc/s390_flic_kvm.c                            |    43 +-
 hw/intc/sifive_plic.c                              |     2 +-
 hw/intc/slavio_intctl.c                            |    15 +-
 hw/intc/spapr_xive.c                               |    77 +-
 hw/intc/spapr_xive_kvm.c                           |     6 +-
 hw/intc/trace-events                               |    30 +-
 hw/intc/xics.c                                     |    52 +-
 hw/intc/xics_spapr.c                               |     7 +-
 hw/intc/xive.c                                     |   241 +-
 hw/intc/xive2.c                                    |   128 +-
 hw/intc/xlnx-pmu-iomod-intc.c                      |     2 +-
 hw/intc/xlnx-zynqmp-ipi.c                          |     2 +-
 hw/ipack/ipack.c                                   |     2 +-
 hw/ipack/meson.build                               |     2 +-
 hw/ipack/tpci200.c                                 |     2 +-
 hw/ipmi/ipmi_bmc_extern.c                          |    33 +-
 hw/ipmi/ipmi_bmc_sim.c                             |     2 +-
 hw/ipmi/ipmi_bt.c                                  |     2 +-
 hw/ipmi/ipmi_kcs.c                                 |     2 +-
 hw/ipmi/isa_ipmi_bt.c                              |    34 +-
 hw/ipmi/isa_ipmi_kcs.c                             |    48 +-
 hw/ipmi/meson.build                                |     2 +-
 hw/ipmi/pci_ipmi_bt.c                              |     2 +-
 hw/ipmi/pci_ipmi_kcs.c                             |     2 +-
 hw/ipmi/smbus_ipmi.c                               |     2 +-
 hw/isa/Kconfig                                     |    28 +-
 hw/isa/apm.c                                       |     2 +-
 hw/isa/fdc37m81x-superio.c                         |    32 +
 hw/isa/i82378.c                                    |    10 +-
 hw/isa/isa-bus.c                                   |    11 +-
 hw/isa/isa-superio.c                               |    26 +-
 hw/isa/lpc_ich9.c                                  |    44 +-
 hw/isa/meson.build                                 |    18 +-
 hw/isa/pc87312.c                                   |     6 +-
 hw/isa/piix.c                                      |   522 +
 hw/isa/piix3.c                                     |   432 -
 hw/isa/piix4.c                                     |   302 -
 hw/isa/smc37c669-superio.c                         |    19 -
 hw/isa/vt82c686.c                                  |   168 +-
 hw/loongarch/Kconfig                               |     7 +-
 hw/loongarch/acpi-build.c                          |   203 +-
 hw/loongarch/boot.c                                |   339 +
 hw/loongarch/fw_cfg.c                              |     2 +-
 hw/loongarch/fw_cfg.h                              |     2 +-
 hw/loongarch/meson.build                           |     3 +-
 hw/loongarch/virt.c                                |  1188 +-
 hw/m68k/Kconfig                                    |    13 +
 hw/m68k/an5206.c                                   |     6 +-
 hw/m68k/bootinfo.h                                 |    10 +-
 hw/m68k/mcf5206.c                                  |    35 +-
 hw/m68k/mcf5208.c                                  |    69 +-
 hw/m68k/mcf_intc.c                                 |    21 +-
 hw/m68k/meson.build                                |     2 +-
 hw/m68k/next-cube.c                                |   653 +-
 hw/m68k/next-kbd.c                                 |     2 +-
 hw/m68k/q800-glue.c                                |   259 +
 hw/m68k/q800.c                                     |   695 +-
 hw/m68k/virt.c                                     |   101 +-
 hw/mem/cxl_type3.c                                 |  1505 +-
 hw/mem/cxl_type3_stubs.c                           |    77 +
 hw/mem/memory-device-stubs.c                       |    22 +
 hw/mem/memory-device.c                             |   320 +-
 hw/mem/meson.build                                 |     8 +-
 hw/mem/nvdimm.c                                    |    10 +-
 hw/mem/pc-dimm.c                                   |    13 +-
 hw/meson.build                                     |     4 +-
 hw/microblaze/Kconfig                              |     6 +
 hw/microblaze/boot.c                               |     9 +-
 hw/microblaze/petalogix_ml605_mmu.c                |     8 +-
 hw/microblaze/petalogix_s3adsp1800_mmu.c           |     3 +-
 hw/microblaze/xlnx-zynqmp-pmu.c                    |     2 +
 hw/mips/Kconfig                                    |    44 +-
 hw/mips/boston.c                                   |    17 +-
 hw/mips/cps.c                                      |    11 +-
 hw/mips/fuloong2e.c                                |    34 +-
 hw/mips/jazz.c                                     |   108 +-
 hw/mips/loongson3_bootp.c                          |     3 +-
 hw/mips/loongson3_bootp.h                          |     7 +-
 hw/mips/loongson3_virt.c                           |    95 +-
 hw/mips/malta.c                                    |    85 +-
 hw/mips/meson.build                                |     4 +-
 hw/mips/mips_int.c                                 |     3 +-
 hw/mips/mipssim.c                                  |    43 +-
 hw/misc/Kconfig                                    |    35 +-
 hw/misc/a9scu.c                                    |     2 +-
 hw/misc/allwinner-a10-ccm.c                        |     2 +-
 hw/misc/allwinner-a10-dramc.c                      |     2 +-
 hw/misc/allwinner-cpucfg.c                         |     2 +-
 hw/misc/allwinner-h3-ccu.c                         |     2 +-
 hw/misc/allwinner-h3-dramc.c                       |     2 +-
 hw/misc/allwinner-h3-sysctrl.c                     |     2 +-
 hw/misc/allwinner-r40-ccu.c                        |   209 +
 hw/misc/allwinner-r40-dramc.c                      |   511 +
 hw/misc/allwinner-sid.c                            |     2 +-
 hw/misc/allwinner-sramc.c                          |   185 +
 hw/misc/applesmc.c                                 |    36 +-
 hw/misc/arm_l2x0.c                                 |     2 +-
 hw/misc/arm_sysctl.c                               |     8 +-
 hw/misc/armsse-cpu-pwrctrl.c                       |     2 +-
 hw/misc/armsse-mhu.c                               |     2 +-
 hw/misc/aspeed_hace.c                              |     2 +-
 hw/misc/aspeed_i3c.c                               |    10 +-
 hw/misc/aspeed_lpc.c                               |     2 +-
 hw/misc/aspeed_sbc.c                               |     2 +-
 hw/misc/aspeed_scu.c                               |   308 +-
 hw/misc/aspeed_sdmc.c                              |   227 +-
 hw/misc/aspeed_sli.c                               |   177 +
 hw/misc/aspeed_xdma.c                              |     2 +-
 hw/misc/axp209.c                                   |   238 -
 hw/misc/axp2xx.c                                   |   283 +
 hw/misc/bcm2835_cprman.c                           |    10 +-
 hw/misc/bcm2835_mbox.c                             |     4 +-
 hw/misc/bcm2835_mphi.c                             |     2 +-
 hw/misc/bcm2835_powermgt.c                         |     2 +-
 hw/misc/bcm2835_property.c                         |   295 +-
 hw/misc/bcm2835_rng.c                              |     2 +-
 hw/misc/bcm2835_thermal.c                          |     4 +-
 hw/misc/debugexit.c                                |     4 +-
 hw/misc/djmemc.c                                   |   135 +
 hw/misc/eccmemctl.c                                |     2 +-
 hw/misc/edu.c                                      |    40 +-
 hw/misc/exynos4210_clk.c                           |     2 +-
 hw/misc/exynos4210_pmu.c                           |     2 +-
 hw/misc/exynos4210_rng.c                           |     6 +-
 hw/misc/i2c-echo.c                                 |    10 +
 hw/misc/imx25_ccm.c                                |     4 +-
 hw/misc/imx31_ccm.c                                |     4 +-
 hw/misc/imx6_ccm.c                                 |    47 +-
 hw/misc/imx6_src.c                                 |     6 +-
 hw/misc/imx6ul_ccm.c                               |     6 +-
 hw/misc/imx7_ccm.c                                 |     6 +-
 hw/misc/imx7_snvs.c                                |    94 +-
 hw/misc/imx7_src.c                                 |   276 +
 hw/misc/imx_rngc.c                                 |     8 +-
 hw/misc/iosb.c                                     |   133 +
 hw/misc/iotkit-secctl.c                            |    10 +-
 hw/misc/iotkit-sysctl.c                            |     8 +-
 hw/misc/ivshmem.c                                  |    21 +-
 hw/misc/lasi.c                                     |    19 +-
 hw/misc/led.c                                      |     4 +-
 hw/misc/mac_via.c                                  |   261 +-
 hw/misc/macio/cuda.c                               |     6 +-
 hw/misc/macio/gpio.c                               |     2 +-
 hw/misc/macio/mac_dbdma.c                          |    10 +-
 hw/misc/macio/macio.c                              |    13 +-
 hw/misc/macio/meson.build                          |     2 +-
 hw/misc/macio/pmu.c                                |    13 +-
 hw/misc/meson.build                                |   166 +-
 hw/misc/mips_cmgcr.c                               |     2 +-
 hw/misc/mips_cpc.c                                 |     2 +-
 hw/misc/mips_itu.c                                 |    38 +-
 hw/misc/mos6522.c                                  |     6 +-
 hw/misc/mps2-fpgaio.c                              |     2 +-
 hw/misc/mps2-scc.c                                 |   148 +-
 hw/misc/msf2-sysreg.c                              |     2 +-
 hw/misc/mst_fpga.c                                 |     2 +-
 hw/misc/npcm7xx_clk.c                              |    21 +-
 hw/misc/npcm7xx_gcr.c                              |    14 +-
 hw/misc/npcm7xx_mft.c                              |     4 +-
 hw/misc/npcm7xx_pwm.c                              |     6 +-
 hw/misc/npcm7xx_rng.c                              |     2 +-
 hw/misc/nrf51_rng.c                                |     2 +-
 hw/misc/pca9552.c                                  |   437 -
 hw/misc/pci-testdev.c                              |     3 +-
 hw/misc/pvpanic-isa.c                              |     3 +-
 hw/misc/pvpanic-pci.c                              |     8 +-
 hw/misc/pvpanic.c                                  |     9 +-
 hw/misc/sifive_e_aon.c                             |   319 +
 hw/misc/sifive_test.c                              |     9 +-
 hw/misc/slavio_misc.c                              |     2 +-
 hw/misc/stm32f2xx_syscfg.c                         |     4 +-
 hw/misc/stm32f4xx_exti.c                           |     2 +-
 hw/misc/stm32f4xx_syscfg.c                         |     2 +-
 hw/misc/stm32l4x5_exti.c                           |   293 +
 hw/misc/stm32l4x5_rcc.c                            |  1474 ++
 hw/misc/stm32l4x5_syscfg.c                         |   267 +
 hw/misc/trace-events                               |   101 +-
 hw/misc/tz-mpc.c                                   |     2 +-
 hw/misc/tz-msc.c                                   |     2 +-
 hw/misc/tz-ppc.c                                   |     2 +-
 hw/misc/virt_ctrl.c                                |     2 +-
 hw/misc/vmcoreinfo.c                               |     2 +-
 hw/misc/xlnx-cfi-if.c                              |    34 +
 hw/misc/xlnx-versal-cframe-reg.c                   |   858 +
 hw/misc/xlnx-versal-cfu.c                          |   563 +
 hw/misc/xlnx-versal-crl.c                          |     9 +-
 hw/misc/xlnx-versal-pmc-iou-slcr.c                 |     4 +-
 hw/misc/xlnx-versal-trng.c                         |   716 +
 hw/misc/xlnx-versal-xramc.c                        |     4 +-
 hw/misc/xlnx-zynqmp-apu-ctrl.c                     |     4 +-
 hw/misc/xlnx-zynqmp-crf.c                          |     4 +-
 hw/misc/zynq_slcr.c                                |    30 +-
 hw/net/Kconfig                                     |     6 +-
 hw/net/allwinner-sun8i-emac.c                      |     5 +-
 hw/net/allwinner_emac.c                            |     9 +-
 hw/net/cadence_gem.c                               |   922 +-
 hw/net/can/can_kvaser_pci.c                        |     2 +-
 hw/net/can/can_mioe3680_pci.c                      |     2 +-
 hw/net/can/can_pcm3680_pci.c                       |     2 +-
 hw/net/can/can_sja1000.c                           |     6 +-
 hw/net/can/ctucan_core.c                           |     4 +-
 hw/net/can/ctucan_pci.c                            |     2 +-
 hw/net/can/meson.build                             |    15 +-
 hw/net/can/trace-events                            |     7 +
 hw/net/can/xlnx-versal-canfd.c                     |  2110 ++
 hw/net/can/xlnx-zynqmp-can.c                       |    71 +-
 hw/net/dp8393x.c                                   |    39 +-
 hw/net/e1000.c                                     |   142 +-
 hw/net/e1000_regs.h                                |     2 +-
 hw/net/e1000e.c                                    |    11 +-
 hw/net/e1000e_core.c                               |   422 +-
 hw/net/e1000e_core.h                               |     4 -
 hw/net/e1000x_common.c                             |    54 +-
 hw/net/e1000x_common.h                             |     4 +-
 hw/net/e1000x_regs.h                               |    26 +-
 hw/net/eepro100.c                                  |     9 +-
 hw/net/etraxfs_eth.c                               |     8 +-
 hw/net/fsl_etsec/etsec.c                           |     3 +-
 hw/net/fsl_etsec/rings.c                           |    14 +-
 hw/net/ftgmac100.c                                 |   174 +-
 hw/net/i82596.c                                    |    23 +-
 hw/net/igb.c                                       |    42 +-
 hw/net/igb_common.h                                |    25 +-
 hw/net/igb_core.c                                  |  1368 +-
 hw/net/igb_core.h                                  |     5 +-
 hw/net/igb_regs.h                                  |    84 +-
 hw/net/igbvf.c                                     |    28 +-
 hw/net/imx_fec.c                                   |    37 +-
 hw/net/lan9118.c                                   |    40 +-
 hw/net/lance.c                                     |     2 +-
 hw/net/lasi_i82596.c                               |    15 +-
 hw/net/mcf_fec.c                                   |     5 +-
 hw/net/meson.build                                 |    94 +-
 hw/net/mipsnet.c                                   |     5 +-
 hw/net/msf2-emac.c                                 |     5 +-
 hw/net/mv88w8618_eth.c                             |     5 +-
 hw/net/ne2000-isa.c                                |     5 +-
 hw/net/ne2000-pci.c                                |     5 +-
 hw/net/ne2000.c                                    |    14 +-
 hw/net/net_rx_pkt.c                                |    93 +-
 hw/net/net_rx_pkt.h                                |    28 +-
 hw/net/net_tx_pkt.c                                |   110 +-
 hw/net/net_tx_pkt.h                                |    46 +-
 hw/net/npcm7xx_emc.c                               |    37 +-
 hw/net/npcm_gmac.c                                 |   942 +
 hw/net/opencores_eth.c                             |     3 +-
 hw/net/pcnet-pci.c                                 |     2 +-
 hw/net/pcnet.c                                     |    16 +-
 hw/net/rocker/rocker_fp.c                          |     6 +-
 hw/net/rocker/rocker_of_dpa.c                      |     2 +-
 hw/net/rtl8139.c                                   |    29 +-
 hw/net/smc91c111.c                                 |    12 +-
 hw/net/spapr_llan.c                                |    17 +-
 hw/net/stellaris_enet.c                            |     7 +-
 hw/net/sungem.c                                    |    72 +-
 hw/net/sunhme.c                                    |    18 +-
 hw/net/trace-events                                |    59 +-
 hw/net/tulip.c                                     |    11 +-
 hw/net/vhost_net.c                                 |    33 +-
 hw/net/virtio-net.c                                |   462 +-
 hw/net/vmxnet3.c                                   |    56 +-
 hw/net/vmxnet3.h                                   |     2 +-
 hw/net/xen_nic.c                                   |   486 +-
 hw/net/xgmac.c                                     |     7 +-
 hw/net/xilinx_axienet.c                            |     5 +-
 hw/net/xilinx_ethlite.c                            |     5 +-
 hw/nios2/10m50_devboard.c                          |   180 -
 hw/nios2/Kconfig                                   |    13 -
 hw/nios2/boot.c                                    |   239 -
 hw/nios2/boot.h                                    |    10 -
 hw/nios2/generic_nommu.c                           |   100 -
 hw/nios2/meson.build                               |     6 -
 hw/nubus/meson.build                               |     3 +-
 hw/nubus/nubus-device.c                            |    18 +-
 hw/nubus/nubus-virtio-mmio.c                       |   104 +
 hw/nubus/trace-events                              |     2 +-
 hw/nvme/Kconfig                                    |     2 +-
 hw/nvme/ctrl.c                                     |   821 +-
 hw/nvme/dif.c                                      |     4 +-
 hw/nvme/meson.build                                |     2 +-
 hw/nvme/nguid.c                                    |   187 +
 hw/nvme/ns.c                                       |    59 +-
 hw/nvme/nvme.h                                     |    56 +-
 hw/nvme/subsys.c                                   |    16 +-
 hw/nvme/trace-events                               |     3 +-
 hw/nvram/bcm2835_otp.c                             |   187 +
 hw/nvram/ds1225y.c                                 |     2 +-
 hw/nvram/eeprom93xx.c                              |     4 +-
 hw/nvram/eeprom_at24c.c                            |     2 +-
 hw/nvram/fw_cfg-acpi.c                             |    24 +
 hw/nvram/fw_cfg.c                                  |    16 +-
 hw/nvram/mac_nvram.c                               |     8 +-
 hw/nvram/meson.build                               |    34 +-
 hw/nvram/npcm7xx_otp.c                             |     2 +-
 hw/nvram/nrf51_nvm.c                               |     9 +-
 hw/nvram/spapr_nvram.c                             |     2 +-
 hw/nvram/xlnx-bbram.c                              |    10 +-
 hw/nvram/xlnx-efuse.c                              |    19 +-
 hw/nvram/xlnx-versal-efuse-ctrl.c                  |    18 +-
 hw/nvram/xlnx-zynqmp-efuse.c                       |    10 +-
 hw/openrisc/Kconfig                                |     6 +
 hw/openrisc/cputimer.c                             |     2 +-
 hw/openrisc/meson.build                            |     4 +-
 hw/openrisc/openrisc_sim.c                         |    18 +-
 hw/pci-bridge/Kconfig                              |     5 +
 hw/pci-bridge/cxl_downstream.c                     |    26 +-
 hw/pci-bridge/cxl_root_port.c                      |    12 +-
 hw/pci-bridge/cxl_upstream.c                       |    56 +-
 hw/pci-bridge/gen_pcie_root_port.c                 |     2 +-
 hw/pci-bridge/i82801b11.c                          |     2 +-
 hw/pci-bridge/ioh3420.c                            |     2 +-
 hw/pci-bridge/meson.build                          |     7 +-
 hw/pci-bridge/pci_bridge_dev.c                     |     2 +-
 hw/pci-bridge/pci_expander_bridge.c                |    63 +-
 hw/pci-bridge/pcie_pci_bridge.c                    |     2 +-
 hw/pci-bridge/pcie_root_port.c                     |     2 +-
 hw/pci-bridge/xio3130_downstream.c                 |     2 +-
 hw/pci-bridge/xio3130_upstream.c                   |     2 +-
 hw/pci-host/Kconfig                                |    17 +
 hw/pci-host/articia.c                              |   293 +
 hw/pci-host/astro.c                                |   907 +
 hw/pci-host/bonito.c                               |    38 +-
 hw/pci-host/designware.c                           |    23 +-
 hw/pci-host/dino.c                                 |    10 +-
 hw/pci-host/gpex-acpi.c                            |    28 +-
 hw/pci-host/gpex.c                                 |    14 +-
 hw/pci-host/gt64120.c                              |    29 +-
 hw/pci-host/i440fx.c                               |   139 +-
 hw/pci-host/meson.build                            |     7 +-
 hw/pci-host/mv64361.c                              |     6 +
 hw/pci-host/mv643xx.h                              |     3 +
 hw/pci-host/pam.c                                  |    12 +-
 hw/pci-host/pnv_phb.c                              |     6 +-
 hw/pci-host/pnv_phb3.c                             |     8 +-
 hw/pci-host/pnv_phb3_msi.c                         |    27 +-
 hw/pci-host/pnv_phb4.c                             |    89 +-
 hw/pci-host/pnv_phb4_pec.c                         |    33 +-
 hw/pci-host/ppc440_pcix.c                          |   542 +
 hw/pci-host/ppc4xx_pci.c                           |   400 +
 hw/pci-host/ppce500.c                              |    14 +-
 hw/pci-host/q35.c                                  |    89 +-
 hw/pci-host/raven.c                                |    22 +-
 hw/pci-host/sabre.c                                |    12 +-
 hw/pci-host/sh_pci.c                               |    57 +-
 hw/pci-host/trace-events                           |    23 +
 hw/pci-host/versatile.c                            |     2 +-
 hw/pci/Kconfig                                     |     3 +
 hw/pci/meson.build                                 |     7 +-
 hw/pci/msi.c                                       |     3 +-
 hw/pci/msix.c                                      |     5 +-
 hw/pci/pci.c                                       |   396 +-
 hw/pci/pci_bridge.c                                |    33 +-
 hw/pci/pci_host.c                                  |     4 +-
 hw/pci/pcie.c                                      |    79 +-
 hw/pci/pcie_aer.c                                  |     6 +-
 hw/pci/pcie_sriov.c                                |    43 +-
 hw/pci/shpc.c                                      |    50 +-
 hw/pci/trace-events                                |     6 +
 hw/pcmcia/meson.build                              |     4 +-
 hw/pcmcia/pxa2xx.c                                 |    15 -
 hw/ppc/Kconfig                                     |    51 +-
 hw/ppc/amigaone.c                                  |   178 +
 hw/ppc/e500.c                                      |    19 +-
 hw/ppc/e500plat.c                                  |     1 +
 hw/ppc/mac_newworld.c                              |    12 +-
 hw/ppc/mac_oldworld.c                              |     7 +-
 hw/ppc/meson.build                                 |    26 +-
 hw/ppc/mpc8544_guts.c                              |     3 +-
 hw/ppc/mpc8544ds.c                                 |     1 +
 hw/ppc/pef.c                                       |    11 +-
 hw/ppc/pegasos2.c                                  |    92 +-
 hw/ppc/pnv.c                                       |   848 +-
 hw/ppc/pnv_adu.c                                   |   206 +
 hw/ppc/pnv_bmc.c                                   |    10 +-
 hw/ppc/pnv_chiptod.c                               |   585 +
 hw/ppc/pnv_core.c                                  |   405 +-
 hw/ppc/pnv_i2c.c                                   |   584 +
 hw/ppc/pnv_lpc.c                                   |   165 +-
 hw/ppc/pnv_n1_chiplet.c                            |   173 +
 hw/ppc/pnv_nest_pervasive.c                        |   208 +
 hw/ppc/pnv_occ.c                                   |     2 +-
 hw/ppc/pnv_psi.c                                   |    47 +-
 hw/ppc/pnv_sbe.c                                   |     2 +-
 hw/ppc/pnv_xscom.c                                 |    19 +-
 hw/ppc/ppc.c                                       |   292 +-
 hw/ppc/ppc405_boards.c                             |     1 +
 hw/ppc/ppc440.h                                    |     1 -
 hw/ppc/ppc440_bamboo.c                             |    39 +-
 hw/ppc/ppc440_pcix.c                               |   538 -
 hw/ppc/ppc440_uc.c                                 |   235 +-
 hw/ppc/ppc4xx_pci.c                                |   401 -
 hw/ppc/ppce500_spin.c                              |     5 +-
 hw/ppc/prep.c                                      |    40 +-
 hw/ppc/prep_systemio.c                             |     4 +-
 hw/ppc/rs6000_mc.c                                 |     9 +-
 hw/ppc/sam460ex.c                                  |    66 +-
 hw/ppc/spapr.c                                     |   566 +-
 hw/ppc/spapr_caps.c                                |   115 +-
 hw/ppc/spapr_cpu_core.c                            |    55 +-
 hw/ppc/spapr_drc.c                                 |    20 +-
 hw/ppc/spapr_events.c                              |     8 +-
 hw/ppc/spapr_hcall.c                               |   469 +-
 hw/ppc/spapr_iommu.c                               |     8 +-
 hw/ppc/spapr_irq.c                                 |    10 +-
 hw/ppc/spapr_nested.c                              |  1905 ++
 hw/ppc/spapr_numa.c                                |    49 +-
 hw/ppc/spapr_nvdimm.c                              |    20 +-
 hw/ppc/spapr_ovec.c                                |     2 +-
 hw/ppc/spapr_pci.c                                 |    53 +-
 hw/ppc/spapr_pci_nvlink2.c                         |   442 -
 hw/ppc/spapr_pci_vfio.c                            |   138 +-
 hw/ppc/spapr_rng.c                                 |     4 +-
 hw/ppc/spapr_rtas.c                                |    36 +-
 hw/ppc/spapr_rtc.c                                 |     2 +-
 hw/ppc/spapr_softmmu.c                             |   615 -
 hw/ppc/spapr_vhyp_mmu.c                            |   611 +
 hw/ppc/spapr_vio.c                                 |     5 +-
 hw/ppc/spapr_vof.c                                 |     2 +-
 hw/ppc/trace-events                                |    20 +-
 hw/ppc/virtex_ml507.c                              |     2 +-
 hw/ppc/vof.c                                       |     4 +-
 hw/rdma/Kconfig                                    |     3 -
 hw/rdma/meson.build                                |    10 -
 hw/rdma/rdma.c                                     |    30 -
 hw/rdma/rdma_backend.c                             |  1401 --
 hw/rdma/rdma_backend.h                             |   129 -
 hw/rdma/rdma_backend_defs.h                        |    76 -
 hw/rdma/rdma_rm.c                                  |   816 -
 hw/rdma/rdma_rm.h                                  |    97 -
 hw/rdma/rdma_rm_defs.h                             |   146 -
 hw/rdma/rdma_utils.c                               |   126 -
 hw/rdma/rdma_utils.h                               |    63 -
 hw/rdma/trace-events                               |    31 -
 hw/rdma/trace.h                                    |     1 -
 hw/rdma/vmw/pvrdma.h                               |   144 -
 hw/rdma/vmw/pvrdma_cmd.c                           |   811 -
 hw/rdma/vmw/pvrdma_dev_ring.c                      |   141 -
 hw/rdma/vmw/pvrdma_dev_ring.h                      |    46 -
 hw/rdma/vmw/pvrdma_main.c                          |   719 -
 hw/rdma/vmw/pvrdma_qp_ops.c                        |   298 -
 hw/rdma/vmw/pvrdma_qp_ops.h                        |    28 -
 hw/rdma/vmw/trace-events                           |    17 -
 hw/rdma/vmw/trace.h                                |     1 -
 hw/remote/iommu.c                                  |     6 +-
 hw/remote/meson.build                              |     5 +-
 hw/remote/message.c                                |     5 +-
 hw/remote/mpqemu-link.c                            |    22 +-
 hw/remote/proxy-memory-listener.c                  |     2 +-
 hw/remote/proxy.c                                  |     8 +-
 hw/remote/remote-obj.c                             |     1 +
 hw/remote/vfio-user-obj-stub.c                     |     6 +
 hw/remote/vfio-user-obj.c                          |    20 +-
 hw/riscv/Kconfig                                   |    23 +
 hw/riscv/boot.c                                    |    21 +-
 hw/riscv/meson.build                               |     2 +-
 hw/riscv/microchip_pfsoc.c                         |    16 +-
 hw/riscv/numa.c                                    |     8 +-
 hw/riscv/opentitan.c                               |    40 +-
 hw/riscv/shakti_c.c                                |    13 +-
 hw/riscv/sifive_e.c                                |    19 +-
 hw/riscv/sifive_u.c                                |    17 +-
 hw/riscv/spike.c                                   |    21 +-
 hw/riscv/virt-acpi-build.c                         |   456 +-
 hw/riscv/virt.c                                    |   931 +-
 hw/rtc/allwinner-rtc.c                             |     2 +-
 hw/rtc/aspeed_rtc.c                                |     7 +-
 hw/rtc/ds1338.c                                    |     2 +-
 hw/rtc/exynos4210_rtc.c                            |     4 +-
 hw/rtc/goldfish_rtc.c                              |     2 +-
 hw/rtc/ls7a_rtc.c                                  |     6 +-
 hw/rtc/m48t59.c                                    |     8 +-
 hw/rtc/mc146818rtc.c                               |    22 +-
 hw/rtc/meson.build                                 |    28 +-
 hw/rtc/pl031.c                                     |     7 +-
 hw/rtc/sun4v-rtc.c                                 |     2 +-
 hw/rtc/twl92230.c                                  |     8 +-
 hw/rtc/xlnx-zynqmp-rtc.c                           |     2 +-
 hw/rx/Kconfig                                      |     3 +
 hw/rx/rx-gdbsim.c                                  |     1 +
 hw/rx/rx62n.c                                      |    40 +-
 hw/s390x/Kconfig                                   |     7 +-
 hw/s390x/ccw-device.c                              |     5 +-
 hw/s390x/ccw-device.h                              |     2 +-
 hw/s390x/cpu-topology.c                            |   469 +
 hw/s390x/css-bridge.c                              |    12 +-
 hw/s390x/css.c                                     |    49 +-
 hw/s390x/event-facility.c                          |    21 +-
 hw/s390x/ipl.c                                     |    16 +-
 hw/s390x/ipl.h                                     |     2 +-
 hw/s390x/meson.build                               |     2 +-
 hw/s390x/pv.c                                      |   360 -
 hw/s390x/s390-ccw.c                                |    36 +-
 hw/s390x/s390-pci-bus.c                            |    59 +-
 hw/s390x/s390-pci-inst.c                           |    48 +-
 hw/s390x/s390-pci-kvm.c                            |    36 +-
 hw/s390x/s390-pci-vfio.c                           |    43 +-
 hw/s390x/s390-skeys.c                              |    65 +-
 hw/s390x/s390-stattrib-kvm.c                       |    12 +-
 hw/s390x/s390-stattrib.c                           |    74 +-
 hw/s390x/s390-virtio-ccw.c                         |   308 +-
 hw/s390x/s390-virtio-hcall.h                       |     2 +
 hw/s390x/sclp.c                                    |    27 +-
 hw/s390x/sclpcpu.c                                 |     4 +-
 hw/s390x/sclpquiesce.c                             |    10 +-
 hw/s390x/tod-kvm.c                                 |     2 +-
 hw/s390x/trace-events                              |    21 +
 hw/s390x/virtio-ccw.c                              |    10 +-
 hw/scsi/Kconfig                                    |     6 +
 hw/scsi/esp-pci.c                                  |    79 +-
 hw/scsi/esp.c                                      |  1460 +-
 hw/scsi/lsi53c895a.c                               |    92 +-
 hw/scsi/megasas.c                                  |    20 +-
 hw/scsi/meson.build                                |    20 +-
 hw/scsi/mfi.h                                      |     2 +-
 hw/scsi/mptsas.c                                   |    11 +-
 hw/scsi/scsi-bus.c                                 |   366 +-
 hw/scsi/scsi-disk.c                                |   235 +-
 hw/scsi/scsi-generic.c                             |    21 +-
 hw/scsi/spapr_vscsi.c                              |     4 +-
 hw/scsi/trace-events                               |     5 +
 hw/scsi/vhost-scsi-common.c                        |    47 +-
 hw/scsi/vhost-scsi.c                               |    80 +-
 hw/scsi/vhost-user-scsi.c                          |   275 +-
 hw/scsi/virtio-scsi-dataplane.c                    |    45 +-
 hw/scsi/virtio-scsi.c                              |   235 +-
 hw/scsi/vmw_pvscsi.c                               |     9 +-
 hw/sd/allwinner-sdhost.c                           |    76 +-
 hw/sd/aspeed_sdhci.c                               |    21 +-
 hw/sd/bcm2835_sdhost.c                             |    35 +-
 hw/sd/cadence_sdhci.c                              |    23 +-
 hw/sd/core.c                                       |    48 +-
 hw/sd/meson.build                                  |    24 +-
 hw/sd/npcm7xx_sdhci.c                              |    26 +-
 hw/sd/pl181.c                                      |    37 +-
 hw/sd/pxa2xx_mmci.c                                |    44 +-
 hw/sd/sd.c                                         |  2216 ++-
 hw/sd/sdhci-pci.c                                  |    25 +-
 hw/sd/sdhci.c                                      |    45 +-
 hw/sd/sdmmc-internal.c                             |    72 -
 hw/sd/sdmmc-internal.h                             |   125 +-
 hw/sd/ssi-sd.c                                     |    21 +-
 hw/sd/trace-events                                 |    11 +-
 hw/sensor/Kconfig                                  |     5 +
 hw/sensor/adm1266.c                                |   254 +
 hw/sensor/adm1272.c                                |     6 +-
 hw/sensor/dps310.c                                 |     2 +-
 hw/sensor/emc141x.c                                |     2 +-
 hw/sensor/isl_pmbus_vr.c                           |    12 +-
 hw/sensor/lsm303dlhc_mag.c                         |     2 +-
 hw/sensor/max31785.c                               |     4 +-
 hw/sensor/max34451.c                               |     6 +-
 hw/sensor/meson.build                              |    19 +-
 hw/sensor/tmp105.c                                 |     6 +-
 hw/sensor/tmp421.c                                 |     2 +-
 hw/sh4/Kconfig                                     |     5 +-
 hw/sh4/meson.build                                 |     2 +-
 hw/sh4/r2d.c                                       |    15 +-
 hw/sh4/sh7750_regs.h                               |    28 +-
 hw/sh4/shix.c                                      |     1 +
 hw/sh4/trace-events                                |     4 +-
 hw/smbios/Kconfig                                  |     2 +
 hw/smbios/meson.build                              |    11 +-
 hw/smbios/smbios.c                                 |   733 +-
 hw/smbios/smbios_legacy.c                          |   192 +
 hw/smbios/smbios_legacy_stub.c                     |    20 +
 hw/sparc/Kconfig                                   |     4 +
 hw/sparc/leon3.c                                   |   150 +-
 hw/sparc/sun4m.c                                   |    54 +-
 hw/sparc/sun4m_iommu.c                             |    10 +-
 hw/sparc64/Kconfig                                 |     4 +
 hw/sparc64/sparc64.c                               |     4 +-
 hw/sparc64/sun4u.c                                 |    71 +-
 hw/ssi/Kconfig                                     |     8 +
 hw/ssi/aspeed_smc.c                                |   369 +-
 hw/ssi/bcm2835_spi.c                               |   288 +
 hw/ssi/ibex_spi_host.c                             |     8 +-
 hw/ssi/imx_spi.c                                   |     4 +-
 hw/ssi/meson.build                                 |    28 +-
 hw/ssi/mss-spi.c                                   |     2 +-
 hw/ssi/npcm7xx_fiu.c                               |     4 +-
 hw/ssi/npcm_pspi.c                                 |     2 +-
 hw/ssi/pl022.c                                     |     2 +-
 hw/ssi/pnv_spi.c                                   |  1268 ++
 hw/ssi/ssi.c                                       |    45 +-
 hw/ssi/stm32f2xx_spi.c                             |     2 +-
 hw/ssi/trace-events                                |    23 +-
 hw/ssi/xilinx_spi.c                                |     2 +-
 hw/ssi/xilinx_spips.c                              |    19 +-
 hw/ssi/xlnx-versal-ospi.c                          |    12 +-
 hw/timer/Kconfig                                   |     4 -
 hw/timer/a9gtimer.c                                |    13 +-
 hw/timer/allwinner-a10-pit.c                       |     2 +-
 hw/timer/altera_timer.c                            |   244 -
 hw/timer/arm_mptimer.c                             |     4 +-
 hw/timer/arm_timer.c                               |     6 +-
 hw/timer/armv7m_systick.c                          |     2 +-
 hw/timer/aspeed_timer.c                            |     6 +-
 hw/timer/bcm2835_systmr.c                          |     2 +-
 hw/timer/cadence_ttc.c                             |     4 +-
 hw/timer/cmsdk-apb-dualtimer.c                     |     4 +-
 hw/timer/cmsdk-apb-timer.c                         |     2 +-
 hw/timer/digic-timer.c                             |     2 +-
 hw/timer/etraxfs_timer.c                           |     6 +-
 hw/timer/exynos4210_mct.c                          |    25 +-
 hw/timer/exynos4210_pwm.c                          |     4 +-
 hw/timer/grlib_gptimer.c                           |     6 +-
 hw/timer/hpet.c                                    |   362 +-
 hw/timer/i8254.c                                   |     6 -
 hw/timer/i8254_common.c                            |    14 +-
 hw/timer/ibex_timer.c                              |     2 +-
 hw/timer/imx_epit.c                                |     2 +-
 hw/timer/imx_gpt.c                                 |     2 +-
 hw/timer/meson.build                               |    73 +-
 hw/timer/mss-timer.c                               |     4 +-
 hw/timer/npcm7xx_timer.c                           |    13 +-
 hw/timer/nrf51_timer.c                             |     2 +-
 hw/timer/pxa2xx_timer.c                            |     9 +-
 hw/timer/renesas_cmt.c                             |     2 +-
 hw/timer/renesas_tmr.c                             |     4 +-
 hw/timer/sifive_pwm.c                              |     2 +-
 hw/timer/slavio_timer.c                            |     4 +-
 hw/timer/sse-counter.c                             |     2 +-
 hw/timer/sse-timer.c                               |     2 +-
 hw/timer/stellaris-gptm.c                          |     2 +-
 hw/timer/stm32f2xx_timer.c                         |     2 +-
 hw/timer/trace-events                              |    17 +-
 hw/tpm/Kconfig                                     |     7 +
 hw/tpm/meson.build                                 |    13 +-
 hw/tpm/tpm_crb.c                                   |     2 +-
 hw/tpm/tpm_ppi.c                                   |     6 +-
 hw/tpm/tpm_spapr.c                                 |     2 +-
 hw/tpm/tpm_tis.h                                   |     5 +-
 hw/tpm/tpm_tis_common.c                            |    40 +-
 hw/tpm/tpm_tis_i2c.c                               |   571 +
 hw/tpm/tpm_tis_isa.c                               |     4 +-
 hw/tpm/tpm_tis_sysbus.c                            |     5 +-
 hw/tpm/trace-events                                |     6 +
 hw/tricore/Kconfig                                 |     4 +
 hw/tricore/tricore_testboard.c                     |     4 +-
 hw/tricore/tricore_testdevice.c                    |     4 +
 hw/ufs/Kconfig                                     |     4 +
 hw/ufs/lu.c                                        |   446 +
 hw/ufs/meson.build                                 |     1 +
 hw/ufs/trace-events                                |    50 +
 hw/ufs/trace.h                                     |     1 +
 hw/ufs/ufs.c                                       |  1822 ++
 hw/ufs/ufs.h                                       |   233 +
 hw/usb/Kconfig                                     |    17 +-
 hw/usb/bus-stub.c                                  |    28 +
 hw/usb/bus.c                                       |    45 +-
 hw/usb/canokey.c                                   |     2 +-
 hw/usb/canokey.h                                   |     2 +-
 hw/usb/ccid-card-emulated.c                        |     2 +-
 hw/usb/ccid-card-passthru.c                        |     2 +-
 hw/usb/desc.c                                      |     2 +-
 hw/usb/dev-audio.c                                 |     9 +-
 hw/usb/dev-hid.c                                   |     4 +-
 hw/usb/dev-hub.c                                   |    16 +-
 hw/usb/dev-mtp.c                                   |     4 +-
 hw/usb/dev-network.c                               |    11 +-
 hw/usb/dev-smartcard-reader.c                      |     8 +-
 hw/usb/dev-storage-classic.c                       |    14 +-
 hw/usb/dev-storage.c                               |     8 +-
 hw/usb/dev-uas.c                                   |     5 +-
 hw/usb/hcd-dwc2.c                                  |    24 +-
 hw/usb/hcd-dwc3.c                                  |     2 +-
 hw/usb/hcd-ehci-pci.c                              |     6 +-
 hw/usb/hcd-ehci-sysbus.c                           |     4 +-
 hw/usb/hcd-ehci.c                                  |    34 +-
 hw/usb/hcd-ehci.h                                  |     8 +-
 hw/usb/hcd-ohci-pci.c                              |     2 +-
 hw/usb/hcd-ohci-sysbus.c                           |    88 +
 hw/usb/hcd-ohci.c                                  |    77 +-
 hw/usb/hcd-uhci.c                                  |    30 +-
 hw/usb/hcd-uhci.h                                  |     4 +-
 hw/usb/hcd-xhci-nec.c                              |     4 -
 hw/usb/hcd-xhci-pci.c                              |     6 +-
 hw/usb/hcd-xhci-sysbus.c                           |     2 +-
 hw/usb/hcd-xhci.c                                  |    74 +-
 hw/usb/hcd-xhci.h                                  |     4 +-
 hw/usb/host-libusb.c                               |    13 +-
 hw/usb/host.h                                      |    44 -
 hw/usb/imx-usb-phy.c                               |     2 +-
 hw/usb/meson.build                                 |    81 +-
 hw/usb/quirks.h                                    |     2 +-
 hw/usb/redirect.c                                  |    28 +-
 hw/usb/trace-events                                |    10 +-
 hw/usb/u2f-passthru.c                              |     6 +-
 hw/usb/u2f.c                                       |     2 +-
 hw/usb/vt82c686-uhci-pci.c                         |     9 +
 hw/usb/xen-usb.c                                   |    19 +-
 hw/usb/xlnx-versal-usb2-ctrl-regs.c                |     4 +-
 hw/vfio/ap.c                                       |   204 +-
 hw/vfio/ccw.c                                      |   196 +-
 hw/vfio/common.c                                   |  2510 +--
 hw/vfio/container-base.c                           |   142 +
 hw/vfio/container.c                                |  1214 ++
 hw/vfio/cpr.c                                      |    39 +
 hw/vfio/display.c                                  |    87 +-
 hw/vfio/helpers.c                                  |   702 +
 hw/vfio/igd.c                                      |    35 +-
 hw/vfio/iommufd.c                                  |   871 +
 hw/vfio/meson.build                                |     9 +-
 hw/vfio/migration.c                                |   641 +-
 hw/vfio/pci-quirks.c                               |   210 +-
 hw/vfio/pci.c                                      |   909 +-
 hw/vfio/pci.h                                      |    27 +-
 hw/vfio/platform.c                                 |   142 +-
 hw/vfio/spapr.c                                    |   353 +-
 hw/vfio/trace-events                               |    46 +-
 hw/virtio/Kconfig                                  |    24 +-
 hw/virtio/meson.build                              |    73 +-
 hw/virtio/trace-events                             |    31 +-
 hw/virtio/vdpa-dev.c                               |    21 +-
 hw/virtio/vhost-backend.c                          |    34 +-
 hw/virtio/vhost-shadow-virtqueue.c                 |    58 +-
 hw/virtio/vhost-shadow-virtqueue.h                 |     3 +-
 hw/virtio/vhost-stub.c                             |     9 +-
 hw/virtio/vhost-user-base.c                        |   374 +
 hw/virtio/vhost-user-device-pci.c                  |    72 +
 hw/virtio/vhost-user-device.c                      |    64 +
 hw/virtio/vhost-user-fs.c                          |   108 +-
 hw/virtio/vhost-user-gpio.c                        |   400 +-
 hw/virtio/vhost-user-i2c.c                         |   256 +-
 hw/virtio/vhost-user-input-pci.c                   |     3 -
 hw/virtio/vhost-user-input.c                       |    58 +
 hw/virtio/vhost-user-rng.c                         |   278 +-
 hw/virtio/vhost-user-scmi-pci.c                    |    68 +
 hw/virtio/vhost-user-scmi.c                        |   313 +
 hw/virtio/vhost-user-snd-pci.c                     |    75 +
 hw/virtio/vhost-user-snd.c                         |    67 +
 hw/virtio/vhost-user-vsock.c                       |     2 +
 hw/virtio/vhost-user.c                             |   801 +-
 hw/virtio/vhost-vdpa.c                             |   432 +-
 hw/virtio/vhost-vsock-common.c                     |     7 +-
 hw/virtio/vhost-vsock.c                            |     3 +-
 hw/virtio/vhost.c                                  |   513 +-
 hw/virtio/virtio-acpi.c                            |    34 +
 hw/virtio/virtio-balloon.c                         |    52 +-
 hw/virtio/virtio-crypto.c                          |    16 +-
 hw/virtio/virtio-input-pci.c                       |    25 +-
 hw/virtio/virtio-iommu-pci.c                       |    16 +-
 hw/virtio/virtio-iommu.c                           |   444 +-
 hw/virtio/virtio-md-pci.c                          |   151 +
 hw/virtio/virtio-md-stubs.c                        |    24 +
 hw/virtio/virtio-mem-pci.c                         |    81 +-
 hw/virtio/virtio-mem-pci.h                         |     6 +-
 hw/virtio/virtio-mem.c                             |   553 +-
 hw/virtio/virtio-mmio.c                            |    24 +-
 hw/virtio/virtio-pci.c                             |   182 +-
 hw/virtio/virtio-pmem-pci.c                        |    11 +-
 hw/virtio/virtio-pmem-pci.h                        |     6 +-
 hw/virtio/virtio-pmem.c                            |     3 +-
 hw/virtio/virtio-qmp.c                             |   147 +-
 hw/virtio/virtio-qmp.h                             |     7 -
 hw/virtio/virtio-rng.c                             |     7 +-
 hw/virtio/virtio.c                                 |   475 +-
 hw/watchdog/Kconfig                                |     4 +
 hw/watchdog/allwinner-wdt.c                        |   416 +
 hw/watchdog/cmsdk-apb-watchdog.c                   |     2 +-
 hw/watchdog/meson.build                            |    17 +-
 hw/watchdog/sbsa_gwdt.c                            |    17 +-
 hw/watchdog/spapr_watchdog.c                       |     2 +-
 hw/watchdog/trace-events                           |    13 +
 hw/watchdog/wdt_aspeed.c                           |    27 +-
 hw/watchdog/wdt_diag288.c                          |     2 +-
 hw/watchdog/wdt_i6300esb.c                         |     2 +-
 hw/watchdog/wdt_ib700.c                            |     2 +-
 hw/watchdog/wdt_imx2.c                             |    30 +-
 hw/xen/meson.build                                 |     8 +-
 hw/xen/trace-events                                |    38 +
 hw/xen/xen-backend.c                               |    27 +-
 hw/xen/xen-bus.c                                   |    42 +-
 hw/xen/xen-host-pci-device.c                       |    76 +-
 hw/xen/xen-host-pci-device.h                       |     6 +
 hw/xen/xen-hvm-common.c                            |   900 +
 hw/xen/xen-legacy-backend.c                        |    25 +-
 hw/xen/xen-mapcache.c                              |   772 +
 hw/xen/xen-operations.c                            |    57 +-
 hw/xen/xen_devconfig.c                             |    53 -
 hw/xen/xen_pt.c                                    |    20 +-
 hw/xen/xen_pt.h                                    |    32 +-
 hw/xen/xen_pt_config_init.c                        |    10 +-
 hw/xen/xen_pt_graphics.c                           |     3 +-
 hw/xen/xen_pt_load_rom.c                           |     2 +-
 hw/xen/xen_pt_stub.c                               |     2 +-
 hw/xen/xen_pvdev.c                                 |     2 +-
 hw/xenpv/xen_machine_pv.c                          |    26 +-
 hw/xtensa/Kconfig                                  |     7 +
 hw/xtensa/bootparam.h                              |     2 +
 hw/xtensa/pic_cpu.c                                |     1 +
 hw/xtensa/sim.c                                    |     7 +-
 hw/xtensa/virt.c                                   |    17 +-
 hw/xtensa/xtfpga.c                                 |    32 +-
 include/block/accounting.h                         |     1 +
 include/block/aio-wait.h                           |    20 +-
 include/block/aio.h                                |   127 +-
 include/block/block-common.h                       |    74 +
 include/block/block-copy.h                         |     2 +
 include/block/block-global-state.h                 |   155 +-
 include/block/block-io.h                           |   148 +-
 include/block/block_int-common.h                   |   300 +-
 include/block/block_int-global-state.h             |    42 +-
 include/block/block_int-io.h                       |    26 +-
 include/block/blockjob.h                           |    22 +-
 include/block/blockjob_int.h                       |    35 +-
 include/block/export.h                             |     2 +
 include/block/graph-lock.h                         |    46 +-
 include/block/nbd.h                                |   225 +-
 include/block/nvme.h                               |    38 +-
 include/block/qapi.h                               |    33 +-
 include/block/raw-aio.h                            |    29 +-
 include/block/snapshot.h                           |    26 +-
 include/block/thread-pool.h                        |    15 +-
 include/block/throttle-groups.h                    |     6 +-
 include/block/ufs.h                                |  1215 ++
 include/chardev/char-fe.h                          |    40 +-
 include/chardev/char.h                             |     3 -
 include/crypto/aes-round.h                         |   164 +
 include/crypto/aes.h                               |    25 +-
 include/crypto/akcipher.h                          |     2 +-
 include/crypto/block.h                             |    18 +-
 include/crypto/clmul.h                             |    83 +
 include/crypto/ivgen.h                             |     4 +-
 include/crypto/secret_common.h                     |    14 +-
 include/crypto/sm4.h                               |     9 +
 include/crypto/tlssession.h                        |    33 +-
 include/disas/capstone.h                           |     1 +
 include/disas/dis-asm.h                            |    15 +-
 include/disas/disas.h                              |    30 +-
 include/elf.h                                      |    70 +-
 include/exec/abi_ptr.h                             |    33 +
 include/exec/address-spaces.h                      |     2 -
 include/exec/breakpoint.h                          |    30 +
 include/exec/confidential-guest-support.h          |    39 +-
 include/exec/cpu-all.h                             |   315 +-
 include/exec/cpu-common.h                          |   156 +-
 include/exec/cpu-defs.h                            |   183 +-
 include/exec/cpu_ldst.h                            |   229 +-
 include/exec/cputlb.h                              |     6 +-
 include/exec/exec-all.h                            |   402 +-
 include/exec/gdbstub.h                             |   138 +-
 include/exec/gen-icount.h                          |    83 -
 include/exec/helper-gen-common.h                   |    14 +
 include/exec/helper-gen.h                          |    97 +-
 include/exec/helper-gen.h.inc                      |   110 +
 include/exec/helper-head.h                         |   147 -
 include/exec/helper-head.h.inc                     |   135 +
 include/exec/helper-info.c.inc                     |    96 +
 include/exec/helper-proto-common.h                 |    16 +
 include/exec/helper-proto.h                        |    73 +-
 include/exec/helper-proto.h.inc                    |    68 +
 include/exec/helper-tcg.h                          |    75 -
 include/exec/ioport.h                              |     4 +-
 include/exec/memattrs.h                            |    21 +-
 include/exec/memop.h                               |    56 +-
 include/exec/memory.h                              |   281 +-
 include/exec/memory_ldst.h.inc                     |    42 +-
 include/exec/mmu-access-type.h                     |    18 +
 include/exec/page-protection.h                     |    41 +
 include/exec/page-vary.h                           |     4 +-
 include/exec/plugin-gen.h                          |    39 +-
 include/exec/poison.h                              |     5 -
 include/exec/ram_addr.h                            |    50 +-
 include/exec/ramblock.h                            |    19 +-
 include/exec/target_long.h                         |     2 +
 include/exec/target_page.h                         |     2 +
 include/exec/tb-flush.h                            |     2 +
 include/exec/tlb-common.h                          |    56 +
 include/exec/translate-all.h                       |     1 -
 include/exec/translation-block.h                   |   155 +
 include/exec/translator.h                          |   105 +-
 include/exec/tswap.h                               |    82 +
 include/exec/user/abitypes.h                       |    71 -
 include/exec/user/thunk.h                          |   203 -
 include/exec/vaddr.h                               |    18 +
 include/fpu/softfloat.h                            |    15 +
 include/gdbstub/commands.h                         |   108 +
 include/gdbstub/enums.h                            |    21 +
 include/gdbstub/helpers.h                          |    12 +-
 include/gdbstub/syscalls.h                         |     9 +
 include/gdbstub/user.h                             |    30 +-
 include/glib-compat.h                              |    27 +-
 include/hw/acpi/acpi-defs.h                        |    33 +
 include/hw/acpi/acpi_dev_interface.h               |     3 -
 include/hw/acpi/acpi_generic_initiator.h           |    47 +
 include/hw/acpi/aml-build.h                        |     6 +-
 include/hw/acpi/cpu.h                              |    14 +-
 include/hw/acpi/cxl.h                              |     1 +
 include/hw/acpi/generic_event_device.h             |     7 +-
 include/hw/acpi/ich9_tco.h                         |     1 +
 include/hw/acpi/memory_hotplug.h                   |     1 +
 include/hw/acpi/pc-hotplug.h                       |     2 +-
 include/hw/acpi/pcihp.h                            |     2 +-
 include/hw/acpi/tpm.h                              |    41 +
 include/hw/acpi/vmgenid.h                          |     2 +-
 include/hw/adc/aspeed_adc.h                        |     1 +
 include/hw/arm/allwinner-a10.h                     |     5 +-
 include/hw/arm/allwinner-h3.h                      |     6 +-
 include/hw/arm/allwinner-r40.h                     |   157 +
 include/hw/arm/armsse.h                            |     5 +
 include/hw/arm/armv7m.h                            |     9 +
 include/hw/arm/aspeed_soc.h                        |    93 +-
 include/hw/arm/bcm2835_peripherals.h               |    39 +-
 include/hw/arm/bcm2836.h                           |    27 +-
 include/hw/arm/bcm2838.h                           |    31 +
 include/hw/arm/bcm2838_peripherals.h               |    84 +
 include/hw/arm/bsa.h                               |    35 +
 include/hw/arm/exynos4210.h                        |     2 +-
 include/hw/arm/fsl-imx25.h                         |     1 -
 include/hw/arm/fsl-imx31.h                         |     1 -
 include/hw/arm/fsl-imx6.h                          |    45 +-
 include/hw/arm/fsl-imx6ul.h                        |   140 +-
 include/hw/arm/fsl-imx7.h                          |   338 +-
 include/hw/arm/msf2-soc.h                          |     3 -
 include/hw/arm/npcm7xx.h                           |     2 +
 include/hw/arm/omap.h                              |     4 +-
 include/hw/arm/pxa.h                               |     2 -
 include/hw/arm/raspberrypi-fw-defs.h               |   175 +
 include/hw/arm/raspi_platform.h                    |    48 +-
 include/hw/arm/smmu-common.h                       |    86 +-
 include/hw/arm/smmuv3.h                            |     4 +
 include/hw/arm/stm32f100_soc.h                     |     4 -
 include/hw/arm/stm32f205_soc.h                     |     4 -
 include/hw/arm/stm32f405_soc.h                     |     4 -
 include/hw/arm/stm32l4x5_soc.h                     |    74 +
 include/hw/arm/virt.h                              |    22 +-
 include/hw/arm/xen_arch_hvm.h                      |     9 +
 include/hw/arm/xlnx-versal.h                       |   104 +-
 include/hw/arm/xlnx-zynqmp.h                       |     3 +-
 include/hw/audio/asc.h                             |    85 +
 include/hw/audio/pcspk.h                           |    10 -
 include/hw/audio/soundhw.h                         |     2 +-
 include/hw/audio/virtio-snd.h                      |   250 +
 include/hw/block/block.h                           |     4 +-
 include/hw/block/fdc.h                             |     3 +
 include/hw/block/flash.h                           |     6 +
 include/hw/block/swim.h                            |    21 +-
 include/hw/boards.h                                |   377 +-
 include/hw/char/avr_usart.h                        |     2 +-
 include/hw/char/escc.h                             |     1 +
 include/hw/char/grlib_uart.h                       |    32 +
 include/hw/char/imx_serial.h                       |    21 +-
 include/hw/char/parallel-isa.h                     |    35 +
 include/hw/char/parallel.h                         |    19 +
 include/hw/char/riscv_htif.h                       |     3 +
 include/hw/char/serial.h                           |     2 +
 include/hw/char/stm32f2xx_usart.h                  |    10 +-
 include/hw/char/stm32l4x5_usart.h                  |    67 +
 include/hw/clock.h                                 |     6 +-
 include/hw/core/accel-cpu.h                        |     2 +-
 include/hw/core/cpu.h                              |   365 +-
 include/hw/core/resetcontainer.h                   |    48 +
 include/hw/core/sysemu-cpu-ops.h                   |     2 +-
 include/hw/core/tcg-cpu-ops.h                      |   134 +-
 include/hw/cris/etraxfs.h                          |     2 +-
 include/hw/cxl/cxl.h                               |    11 +-
 include/hw/cxl/cxl_cdat.h                          |    27 +-
 include/hw/cxl/cxl_component.h                     |    90 +-
 include/hw/cxl/cxl_device.h                        |   464 +-
 include/hw/cxl/cxl_events.h                        |   187 +
 include/hw/cxl/cxl_mailbox.h                       |    18 +
 include/hw/cxl/cxl_pci.h                           |    74 +-
 include/hw/display/bcm2835_fb.h                    |     2 +
 include/hw/display/dm163.h                         |    59 +
 include/hw/display/ramfb.h                         |     4 +
 include/hw/dma/i8257.h                             |     2 +-
 include/hw/elf_ops.h                               |   624 -
 include/hw/elf_ops.h.inc                           |   627 +
 include/hw/firmware/smbios.h                       |    45 +-
 include/hw/fsi/aspeed_apb2opb.h                    |    46 +
 include/hw/fsi/cfam.h                              |    34 +
 include/hw/fsi/fsi-master.h                        |    32 +
 include/hw/fsi/fsi.h                               |    37 +
 include/hw/fsi/lbus.h                              |    43 +
 include/hw/gpio/aspeed_gpio.h                      |     1 +
 include/hw/gpio/bcm2838_gpio.h                     |    45 +
 include/hw/gpio/nrf51_gpio.h                       |     1 +
 include/hw/gpio/pca9552.h                          |    38 +
 include/hw/gpio/pca9552_regs.h                     |    32 +
 include/hw/gpio/pca9554.h                          |    36 +
 include/hw/gpio/pca9554_regs.h                     |    19 +
 include/hw/gpio/pcf8574.h                          |    15 +
 include/hw/gpio/stm32l4x5_gpio.h                   |    71 +
 include/hw/hyperv/dynmem-proto.h                   |   430 +
 include/hw/hyperv/hv-balloon.h                     |    18 +
 include/hw/hyperv/hyperv.h                         |     4 +
 include/hw/hyperv/vmbus.h                          |     2 +-
 include/hw/i2c/aspeed_i2c.h                        |    18 +-
 include/hw/i2c/bcm2835_i2c.h                       |    80 +
 include/hw/i2c/npcm7xx_smbus.h                     |     2 +-
 include/hw/i2c/pmbus_device.h                      |    17 +
 include/hw/i2c/pnv_i2c_regs.h                      |   143 +
 include/hw/i386/apic.h                             |     9 +-
 include/hw/i386/apic_internal.h                    |     9 +-
 include/hw/i386/intel_iommu.h                      |     2 +
 include/hw/i386/pc.h                               |   142 +-
 include/hw/i386/sgx-epc.h                          |     1 +
 include/hw/i386/topology.h                         |    93 +-
 include/hw/i386/x86.h                              |    34 +-
 include/hw/i386/xen_arch_hvm.h                     |    11 +
 include/hw/ide.h                                   |     9 -
 include/hw/ide/ahci-pci.h                          |    22 +
 include/hw/ide/ahci-sysbus.h                       |    35 +
 include/hw/ide/ahci.h                              |    38 +-
 include/hw/ide/ide-bus.h                           |    42 +
 include/hw/ide/ide-dev.h                           |   186 +
 include/hw/ide/ide-dma.h                           |    37 +
 include/hw/ide/internal.h                          |   656 -
 include/hw/ide/pci.h                               |     4 +-
 include/hw/input/gamepad.h                         |    18 -
 include/hw/input/i8042.h                           |     1 -
 include/hw/input/stellaris_gamepad.h               |    37 +
 include/hw/intc/arm_gic.h                          |     2 +
 include/hw/intc/arm_gic_common.h                   |     2 +
 include/hw/intc/arm_gicv3_common.h                 |    24 +
 include/hw/intc/arm_gicv3_its_common.h             |     9 +
 include/hw/intc/armv7m_nvic.h                      |     4 +-
 include/hw/intc/aspeed_intc.h                      |    44 +
 include/hw/intc/grlib_irqmp.h                      |    41 +
 include/hw/intc/i8259.h                            |     2 +
 include/hw/intc/intc.h                             |     2 +-
 include/hw/intc/loongarch_extioi.h                 |    35 +-
 include/hw/intc/loongarch_ipi.h                    |    50 +-
 include/hw/intc/loongson_ipi.h                     |    31 +
 include/hw/intc/loongson_ipi_common.h              |    74 +
 include/hw/intc/m68k_irqc.h                        |     1 +
 include/hw/intc/nios2_vic.h                        |    66 -
 include/hw/kvm/clock.h                             |    28 -
 include/hw/loader.h                                |     7 +-
 include/hw/loongarch/boot.h                        |   119 +
 include/hw/loongarch/virt.h                        |    40 +-
 include/hw/m68k/mcf.h                              |     4 +-
 include/hw/m68k/q800-glue.h                        |    51 +
 include/hw/m68k/q800.h                             |    78 +
 include/hw/mem/memory-device.h                     |    65 +-
 include/hw/mem/nvdimm.h                            |     6 +
 include/hw/mem/pc-dimm.h                           |     3 +-
 include/hw/mips/bios.h                             |    14 -
 include/hw/mips/cpudevs.h                          |    14 -
 include/hw/misc/allwinner-r40-ccu.h                |    65 +
 include/hw/misc/allwinner-r40-dramc.h              |   108 +
 include/hw/misc/allwinner-sramc.h                  |    69 +
 include/hw/misc/aspeed_scu.h                       |    53 +-
 include/hw/misc/aspeed_sdmc.h                      |     5 +-
 include/hw/misc/aspeed_sli.h                       |    27 +
 include/hw/misc/auxbus.h                           |     2 +-
 include/hw/misc/bcm2835_property.h                 |     3 +
 include/hw/misc/djmemc.h                           |    30 +
 include/hw/misc/imx7_snvs.h                        |     7 +-
 include/hw/misc/imx7_src.h                         |    66 +
 include/hw/misc/iosb.h                             |    25 +
 include/hw/misc/lasi.h                             |     5 +-
 include/hw/misc/mac_via.h                          |     3 +
 include/hw/misc/macio/macio.h                      |     9 +-
 include/hw/misc/macio/pmu.h                        |     2 +-
 include/hw/misc/mips_itu.h                         |     4 -
 include/hw/misc/mps2-scc.h                         |     1 +
 include/hw/misc/pca9552.h                          |    37 -
 include/hw/misc/pca9552_regs.h                     |    32 -
 include/hw/misc/pvpanic.h                          |     6 +
 include/hw/misc/sifive_e_aon.h                     |    60 +
 include/hw/misc/stm32l4x5_exti.h                   |    53 +
 include/hw/misc/stm32l4x5_rcc.h                    |   239 +
 include/hw/misc/stm32l4x5_rcc_internals.h          |  1042 +
 include/hw/misc/stm32l4x5_syscfg.h                 |    53 +
 include/hw/misc/xlnx-cfi-if.h                      |    58 +
 include/hw/misc/xlnx-versal-cframe-reg.h           |   303 +
 include/hw/misc/xlnx-versal-cfu.h                  |   258 +
 include/hw/misc/xlnx-versal-crl.h                  |     4 +-
 include/hw/misc/xlnx-versal-pmc-iou-slcr.h         |     2 +-
 include/hw/misc/xlnx-versal-trng.h                 |    58 +
 include/hw/net/dp8393x.h                           |    60 +
 include/hw/net/ftgmac100.h                         |    17 +-
 include/hw/net/imx_fec.h                           |     2 +
 include/hw/net/lan9118.h                           |     2 +-
 include/hw/net/lasi_82596.h                        |     4 +-
 include/hw/net/mii.h                               |     2 +-
 include/hw/net/ne2000-isa.h                        |     2 -
 include/hw/net/npcm_gmac.h                         |   343 +
 include/hw/net/smc91c111.h                         |     2 +-
 include/hw/net/xlnx-versal-canfd.h                 |    87 +
 include/hw/nubus/nubus-virtio-mmio.h               |    36 +
 include/hw/nubus/nubus.h                           |     2 +-
 include/hw/nvram/bcm2835_otp.h                     |    68 +
 include/hw/nvram/fw_cfg.h                          |     2 +
 include/hw/nvram/fw_cfg_acpi.h                     |    14 +
 include/hw/nvram/npcm7xx_otp.h                     |     4 +-
 include/hw/nvram/xlnx-bbram.h                      |     2 +-
 include/hw/nvram/xlnx-efuse.h                      |     2 +-
 include/hw/nvram/xlnx-versal-efuse.h               |     4 +-
 include/hw/nvram/xlnx-zynqmp-efuse.h               |     2 +-
 include/hw/pci-bridge/cxl_upstream_port.h          |    19 +
 include/hw/pci-host/articia.h                      |    17 +
 include/hw/pci-host/astro.h                        |    94 +
 include/hw/pci-host/dino.h                         |     2 +-
 include/hw/pci-host/gpex.h                         |    28 +-
 include/hw/pci-host/i440fx.h                       |    16 +-
 include/hw/pci-host/ls7a.h                         |     2 +
 include/hw/pci-host/pam.h                          |     5 +-
 include/hw/pci-host/pnv_phb3.h                     |     2 +-
 include/hw/pci-host/pnv_phb4.h                     |     4 +-
 include/hw/pci-host/pnv_phb4_regs.h                |     4 +-
 include/hw/pci-host/ppc4xx.h                       |    17 +
 include/hw/pci-host/q35.h                          |     7 +-
 include/hw/pci-host/spapr.h                        |    45 -
 include/hw/pci/pci.h                               |    98 +-
 include/hw/pci/pci_bridge.h                        |    33 +-
 include/hw/pci/pci_bus.h                           |     2 +-
 include/hw/pci/pci_device.h                        |     7 +
 include/hw/pci/pci_host.h                          |     2 +
 include/hw/pci/pci_ids.h                           |     3 +
 include/hw/pci/pcie.h                              |     6 +-
 include/hw/pci/pcie_aer.h                          |    40 +-
 include/hw/pci/pcie_doe.h                          |     5 +
 include/hw/pci/pcie_regs.h                         |     2 +
 include/hw/pci/pcie_sriov.h                        |    12 +-
 include/hw/pci/shpc.h                              |     2 +-
 include/hw/ppc/fdt.h                               |     8 +-
 include/hw/ppc/openpic.h                           |     4 +-
 include/hw/ppc/pef.h                               |    17 -
 include/hw/ppc/pnv.h                               |    13 +-
 include/hw/ppc/pnv_adu.h                           |    32 +
 include/hw/ppc/pnv_chip.h                          |    32 +-
 include/hw/ppc/pnv_chiptod.h                       |    53 +
 include/hw/ppc/pnv_core.h                          |    50 +-
 include/hw/ppc/pnv_i2c.h                           |    38 +
 include/hw/ppc/pnv_lpc.h                           |    22 +-
 include/hw/ppc/pnv_n1_chiplet.h                    |    32 +
 include/hw/ppc/pnv_nest_pervasive.h                |    32 +
 include/hw/ppc/pnv_psi.h                           |     2 +-
 include/hw/ppc/pnv_xive.h                          |     4 +-
 include/hw/ppc/pnv_xscom.h                         |    52 +-
 include/hw/ppc/ppc.h                               |     6 +-
 include/hw/ppc/ppc4xx.h                            |     2 -
 include/hw/ppc/spapr.h                             |   114 +-
 include/hw/ppc/spapr_cpu_core.h                    |     5 +-
 include/hw/ppc/spapr_irq.h                         |    18 +-
 include/hw/ppc/spapr_nested.h                      |   524 +
 include/hw/ppc/spapr_rtas.h                        |    10 -
 include/hw/ppc/xics.h                              |     4 +-
 include/hw/ppc/xive.h                              |    10 +-
 include/hw/ppc/xive2_regs.h                        |    19 +-
 include/hw/ppc/xive_regs.h                         |    24 +-
 include/hw/qdev-core.h                             |   459 +-
 include/hw/qdev-properties-system.h                |    20 +
 include/hw/qdev-properties.h                       |    42 +-
 include/hw/rdma/rdma.h                             |    37 -
 include/hw/resettable.h                            |     5 +-
 include/hw/riscv/opentitan.h                       |     6 +-
 include/hw/riscv/riscv_hart.h                      |     2 +-
 include/hw/riscv/sifive_e.h                        |     9 +-
 include/hw/riscv/virt.h                            |    27 +
 include/hw/rtc/aspeed_rtc.h                        |     2 +-
 include/hw/rtc/mc146818rtc.h                       |     2 +-
 include/hw/rtc/sun4v-rtc.h                         |     2 +-
 include/hw/rx/rx62n.h                              |     2 -
 include/hw/s390x/adapter.h                         |     4 +-
 include/hw/s390x/cpu-topology.h                    |    83 +
 include/hw/s390x/css.h                             |     8 +-
 include/hw/s390x/event-facility.h                  |     2 +-
 include/hw/s390x/pv.h                              |    96 -
 include/hw/s390x/s390-ccw.h                        |     2 +-
 include/hw/s390x/s390-pci-bus.h                    |     4 +-
 include/hw/s390x/s390-virtio-ccw.h                 |    16 +-
 include/hw/s390x/s390_flic.h                       |     5 +-
 include/hw/s390x/sclp.h                            |    17 +-
 include/hw/s390x/storage-attributes.h              |     2 +-
 include/hw/s390x/storage-keys.h                    |    10 +
 include/hw/s390x/vfio-ccw.h                        |     2 -
 include/hw/scsi/esp.h                              |    18 +-
 include/hw/scsi/scsi.h                             |    27 +-
 include/hw/sd/allwinner-sdhost.h                   |     9 +
 include/hw/sd/sd.h                                 |    14 +-
 include/hw/southbridge/ich9.h                      |     2 +
 include/hw/southbridge/piix.h                      |    32 +-
 include/hw/sparc/grlib.h                           |    45 -
 include/hw/ssi/aspeed_smc.h                        |     3 +
 include/hw/ssi/bcm2835_spi.h                       |    81 +
 include/hw/ssi/pnv_spi.h                           |    67 +
 include/hw/ssi/pnv_spi_regs.h                      |   133 +
 include/hw/ssi/ssi.h                               |     5 +
 include/hw/ssi/xilinx_spips.h                      |     5 +-
 include/hw/ssi/xlnx-versal-ospi.h                  |     2 +-
 include/hw/sysbus.h                                |     3 -
 include/hw/timer/grlib_gptimer.h                   |    32 +
 include/hw/timer/hpet.h                            |     2 +
 include/hw/tricore/tricore_testdevice.h            |     3 -
 include/hw/usb.h                                   |    28 +-
 include/hw/vfio/vfio-common.h                      |   176 +-
 include/hw/vfio/vfio-container-base.h              |   165 +
 include/hw/vfio/vfio.h                             |     7 -
 include/hw/virtio/vhost-backend.h                  |    52 +-
 include/hw/virtio/vhost-scsi-common.h              |     2 +-
 include/hw/virtio/vhost-user-base.h                |    49 +
 include/hw/virtio/vhost-user-gpio.h                |    25 +-
 include/hw/virtio/vhost-user-i2c.h                 |    14 +-
 include/hw/virtio/vhost-user-rng.h                 |    13 +-
 include/hw/virtio/vhost-user-scmi.h                |    31 +
 include/hw/virtio/vhost-user-scsi.h                |     6 +
 include/hw/virtio/vhost-user-snd.h                 |    24 +
 include/hw/virtio/vhost-user.h                     |    24 +
 include/hw/virtio/vhost-vdpa.h                     |    53 +-
 include/hw/virtio/vhost-vsock-common.h             |     1 +
 include/hw/virtio/vhost.h                          |   130 +-
 include/hw/virtio/virtio-acpi.h                    |    15 +
 include/hw/virtio/virtio-blk.h                     |    21 +-
 include/hw/virtio/virtio-dmabuf.h                  |   100 +
 include/hw/virtio/virtio-gpu-bswap.h               |    18 +
 include/hw/virtio/virtio-gpu.h                     |    66 +-
 include/hw/virtio/virtio-input.h                   |    17 +-
 include/hw/virtio/virtio-iommu.h                   |    13 +-
 include/hw/virtio/virtio-md-pci.h                  |    44 +
 include/hw/virtio/virtio-mem.h                     |    33 +-
 include/hw/virtio/virtio-net.h                     |    13 +-
 include/hw/virtio/virtio-pci.h                     |    10 +
 include/hw/virtio/virtio-scsi.h                    |    18 +-
 include/hw/virtio/virtio.h                         |    66 +-
 include/hw/watchdog/allwinner-wdt.h                |   123 +
 include/hw/watchdog/sbsa_gwdt.h                    |     3 +-
 include/hw/watchdog/wdt_aspeed.h                   |     3 +-
 include/hw/xen/arch_hvm.h                          |     5 +
 include/hw/xen/interface/arch-arm.h                |    37 +-
 include/hw/xen/interface/arch-x86/cpuid.h          |    31 +-
 include/hw/xen/interface/arch-x86/xen-x86_32.h     |    19 +-
 include/hw/xen/interface/arch-x86/xen-x86_64.h     |    19 +-
 include/hw/xen/interface/arch-x86/xen.h            |    26 +-
 include/hw/xen/interface/event_channel.h           |    19 +-
 include/hw/xen/interface/features.h                |    19 +-
 include/hw/xen/interface/grant_table.h             |    19 +-
 include/hw/xen/interface/hvm/hvm_op.h              |    19 +-
 include/hw/xen/interface/hvm/params.h              |    19 +-
 include/hw/xen/interface/io/blkif.h                |    27 +-
 include/hw/xen/interface/io/console.h              |    19 +-
 include/hw/xen/interface/io/fbif.h                 |    19 +-
 include/hw/xen/interface/io/kbdif.h                |    19 +-
 include/hw/xen/interface/io/netif.h                |    25 +-
 include/hw/xen/interface/io/protocols.h            |    19 +-
 include/hw/xen/interface/io/ring.h                 |    49 +-
 include/hw/xen/interface/io/usbif.h                |    19 +-
 include/hw/xen/interface/io/xenbus.h               |    19 +-
 include/hw/xen/interface/io/xs_wire.h              |    36 +-
 include/hw/xen/interface/memory.h                  |    30 +-
 include/hw/xen/interface/physdev.h                 |    23 +-
 include/hw/xen/interface/sched.h                   |    19 +-
 include/hw/xen/interface/trace.h                   |    19 +-
 include/hw/xen/interface/vcpu.h                    |    19 +-
 include/hw/xen/interface/version.h                 |    19 +-
 include/hw/xen/interface/xen-compat.h              |    19 +-
 include/hw/xen/interface/xen.h                     |    19 +-
 include/hw/xen/xen-backend.h                       |     1 +
 include/hw/xen/xen-bus.h                           |     3 +
 include/hw/xen/xen-hvm-common.h                    |   101 +
 include/hw/xen/xen-legacy-backend.h                |    17 +-
 include/hw/xen/xen.h                               |     3 +-
 include/hw/xen/xen_igd.h                           |    33 +
 include/hw/xen/xen_native.h                        |   135 +-
 include/hw/xen/xen_pvdev.h                         |     3 +-
 include/io/channel-file.h                          |    18 +
 include/io/channel-socket.h                        |     4 +-
 include/io/channel-util.h                          |    23 +
 include/io/channel.h                               |   251 +-
 include/io/task.h                                  |     4 +-
 include/migration/blocker.h                        |    66 +-
 include/migration/client-options.h                 |    25 +
 include/migration/colo.h                           |    18 +-
 include/migration/global_state.h                   |     2 +-
 include/migration/misc.h                           |    66 +-
 include/migration/qemu-file-types.h                |    18 +-
 include/migration/register.h                       |   274 +-
 include/migration/snapshot.h                       |     7 +
 include/migration/vmstate.h                        |    64 +-
 include/monitor/hmp-target.h                       |    11 +-
 include/monitor/hmp.h                              |     7 +-
 include/monitor/monitor.h                          |     6 +-
 include/net/announce.h                             |     4 +-
 include/net/eth.h                                  |    23 +-
 include/net/filter.h                               |     2 +-
 include/net/net.h                                  |    93 +-
 include/net/vhost_net.h                            |     3 -
 include/qapi/clone-visitor.h                       |    37 +-
 include/qapi/error.h                               |     2 +-
 include/qapi/qmp/dispatch.h                        |     4 +-
 include/qapi/qmp/qerror.h                          |    30 -
 include/qapi/qmp/qobject.h                         |    10 +-
 include/qapi/string-output-visitor.h               |     6 +-
 include/qapi/type-helpers.h                        |     8 +
 include/qapi/util.h                                |    13 +
 include/qapi/visitor.h                             |     2 +-
 include/qemu/accel.h                               |    12 +-
 include/qemu/atomic.h                              |    78 +-
 include/qemu/atomic128.h                           |   150 +-
 include/qemu/bitmap.h                              |    19 +-
 include/qemu/bitops.h                              |    29 +-
 include/qemu/bswap.h                               |    48 +-
 include/qemu/chardev_open.h                        |    16 +
 include/qemu/compiler.h                            |    76 +
 include/qemu/config-file.h                         |     3 +
 include/qemu/coroutine-core.h                      |     2 +-
 include/qemu/coroutine.h                           |     6 +-
 include/qemu/cpuid.h                               |    21 +
 include/qemu/crc-ccitt.h                           |     4 +-
 include/qemu/crc32c.h                              |     1 +
 include/qemu/cutils.h                              |    57 +-
 include/qemu/defer-call.h                          |    16 +
 include/qemu/fifo8.h                               |    84 +-
 include/qemu/guest-random.h                        |     8 +-
 include/qemu/help-texts.h                          |     2 +-
 include/qemu/host-utils.h                          |    75 +-
 include/qemu/int128.h                              |    10 +-
 include/qemu/iov.h                                 |     8 +-
 include/qemu/iova-tree.h                           |     4 +-
 include/qemu/job.h                                 |    22 +-
 include/qemu/lockable.h                            |    27 +-
 include/qemu/log.h                                 |     2 +
 include/qemu/main-loop.h                           |    75 +-
 include/qemu/mmap-alloc.h                          |     7 +
 include/qemu/notify.h                              |     8 +-
 include/qemu/option.h                              |     2 +
 include/qemu/osdep.h                               |   116 +-
 include/qemu/plugin-memory.h                       |    13 +-
 include/qemu/plugin.h                              |   140 +-
 include/qemu/processor.h                           |     2 -
 include/qemu/qemu-options.h                        |    41 -
 include/qemu/qemu-plugin.h                         |   367 +-
 include/qemu/qtree.h                               |     1 -
 include/qemu/range.h                               |    29 +-
 include/qemu/rcu.h                                 |    19 +-
 include/qemu/reserved-region.h                     |    32 +
 include/qemu/selfmap.h                             |    24 +-
 include/qemu/stats64.h                             |     6 +
 include/qemu/sys_membarrier.h                      |     4 +-
 include/qemu/thread.h                              |     2 +-
 include/qemu/throttle.h                            |    16 +-
 include/qemu/timer.h                               |    55 +-
 include/qemu/typedefs.h                            |    32 +-
 include/qemu/uri.h                                 |   103 -
 include/qemu/uuid.h                                |     7 +-
 include/qemu/vhost-user-server.h                   |    10 +-
 include/qemu/xxhash.h                              |    23 +-
 include/qemu/yank.h                                |     4 +-
 include/qom/object.h                               |   117 +-
 include/qom/object_interfaces.h                    |    16 +-
 include/scsi/constants.h                           |     1 +
 include/semihosting/semihost.h                     |     2 +-
 include/semihosting/softmmu-uaccess.h              |    59 -
 include/semihosting/syscalls.h                     |     2 +
 include/semihosting/uaccess.h                      |    66 +
 include/standard-headers/asm-x86/bootparam.h       |    17 +-
 include/standard-headers/asm-x86/kvm_para.h        |     3 +-
 include/standard-headers/asm-x86/setup_data.h      |    83 +
 .../infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h      |   685 -
 .../infiniband/hw/vmw_pvrdma/pvrdma_verbs.h        |   348 -
 include/standard-headers/drm/drm_fourcc.h          |    67 +-
 include/standard-headers/linux/const.h             |     2 +-
 include/standard-headers/linux/ethtool.h           |   192 +-
 include/standard-headers/linux/fuse.h              |   147 +-
 include/standard-headers/linux/input-event-codes.h |     1 +
 include/standard-headers/linux/kvm_para.h          |    38 +
 include/standard-headers/linux/pci_regs.h          |    32 +-
 include/standard-headers/linux/pvpanic.h           |     9 -
 include/standard-headers/linux/vhost_types.h       |    29 +
 include/standard-headers/linux/virtio_blk.h        |   105 +
 include/standard-headers/linux/virtio_bt.h         |     1 -
 include/standard-headers/linux/virtio_config.h     |    19 +-
 include/standard-headers/linux/virtio_gpu.h        |     2 +
 include/standard-headers/linux/virtio_mem.h        |     2 +
 include/standard-headers/linux/virtio_net.h        |   158 +
 include/standard-headers/linux/virtio_pci.h        |    79 +
 include/standard-headers/linux/virtio_pmem.h       |     7 +
 include/standard-headers/linux/virtio_snd.h        |   154 +
 include/standard-headers/misc/pvpanic.h            |    12 +
 include/standard-headers/rdma/vmw_pvrdma-abi.h     |   310 -
 include/sysemu/accel-blocker.h                     |    14 +-
 include/sysemu/accel-ops.h                         |    19 +-
 include/sysemu/arch_init.h                         |     1 -
 include/sysemu/block-backend-common.h              |    25 +-
 include/sysemu/block-backend-global-state.h        |     9 +-
 include/sysemu/block-backend-io.h                  |    33 +-
 include/sysemu/cpu-timers-internal.h               |    71 +
 include/sysemu/cpu-timers.h                        |    35 +-
 include/sysemu/cpus.h                              |     7 -
 include/sysemu/cryptodev-vhost.h                   |     2 +-
 include/sysemu/cryptodev.h                         |     6 +-
 include/sysemu/device_tree.h                       |     7 +-
 include/sysemu/dirtylimit.h                        |     2 +
 include/sysemu/dump-arch.h                         |     1 +
 include/sysemu/dump.h                              |     3 +-
 include/sysemu/hax.h                               |    47 -
 include/sysemu/host_iommu_device.h                 |   110 +
 include/sysemu/hostmem.h                           |    11 +-
 include/sysemu/hvf.h                               |    42 +-
 include/sysemu/hvf_int.h                           |    14 +-
 include/sysemu/hw_accel.h                          |     1 -
 include/sysemu/iommufd.h                           |    66 +
 include/sysemu/iothread.h                          |     2 +-
 include/sysemu/kvm.h                               |   138 +-
 include/sysemu/kvm_int.h                           |    46 +-
 include/sysemu/kvm_xen.h                           |     1 +
 include/sysemu/memory_mapping.h                    |     2 +-
 include/sysemu/numa.h                              |     9 +-
 include/sysemu/nvmm.h                              |     6 +-
 include/sysemu/os-posix.h                          |     9 +-
 include/sysemu/os-win32.h                          |    17 +-
 include/sysemu/qtest.h                             |     8 +-
 include/sysemu/replay.h                            |    11 +-
 include/sysemu/reset.h                             |   113 +
 include/sysemu/rtc.h                               |     4 +-
 include/sysemu/runstate-action.h                   |     2 +-
 include/sysemu/runstate.h                          |    33 +-
 include/sysemu/spdm-socket.h                       |    74 +
 include/sysemu/stats.h                             |     2 +-
 include/sysemu/sysemu.h                            |     5 +-
 include/sysemu/tcg.h                               |     2 +
 include/sysemu/tpm.h                               |     5 +-
 include/sysemu/tpm_backend.h                       |     2 +-
 include/sysemu/whpx.h                              |     6 +-
 include/sysemu/xen-mapcache.h                      |    16 +-
 include/sysemu/xen.h                               |    16 +-
 include/tcg/debug-assert.h                         |    17 +
 include/tcg/debuginfo.h                            |    79 +
 include/tcg/helper-info.h                          |    67 +
 include/tcg/insn-start-words.h                     |    17 +
 include/tcg/oversized-guest.h                      |    23 +
 include/tcg/perf.h                                 |    49 +
 include/tcg/startup.h                              |    58 +
 include/tcg/tcg-cond.h                             |    64 +-
 include/tcg/tcg-ldst.h                             |    74 +-
 include/tcg/tcg-op-common.h                        |   561 +
 include/tcg/tcg-op-gvec-common.h                   |   434 +
 include/tcg/tcg-op-gvec.h                          |   440 +-
 include/tcg/tcg-op.h                               |  1145 +-
 include/tcg/tcg-opc.h                              |    63 +-
 include/tcg/tcg-temp-internal.h                    |    58 +-
 include/tcg/tcg.h                                  |   307 +-
 include/ui/clipboard.h                             |     2 +-
 include/ui/console.h                               |   170 +-
 include/ui/dmabuf.h                                |    49 +
 include/ui/egl-helpers.h                           |    11 +-
 include/ui/gtk.h                                   |     6 +-
 include/ui/input.h                                 |    12 +-
 include/ui/kbd-state.h                             |    13 +-
 include/ui/pixman-minimal.h                        |   239 +
 include/ui/qemu-pixman.h                           |    28 +-
 include/ui/rect.h                                  |    57 +
 include/ui/sdl2.h                                  |     3 +-
 include/ui/spice-display.h                         |     2 +-
 include/ui/surface.h                               |    95 +
 include/user/abitypes.h                            |    87 +
 include/user/guest-base.h                          |    18 +
 include/user/safe-syscall.h                        |     8 +-
 include/user/syscall-trace.h                       |    13 +-
 include/user/thunk.h                               |   213 +
 include/user/tswap-target.h                        |    22 +
 io/channel-command.c                               |    12 +-
 io/channel-file.c                                  |    94 +-
 io/channel-null.c                                  |     3 +-
 io/channel-socket.c                                |    43 +-
 io/channel-tls.c                                   |    99 +-
 io/channel-util.c                                  |    24 +
 io/channel-websock.c                               |     1 +
 io/channel.c                                       |   267 +-
 io/meson.build                                     |     2 +-
 io/net-listener.c                                  |     4 +-
 io/trace-events                                    |     1 +
 iothread.c                                         |    20 +-
 job.c                                              |    17 +-
 linux-headers/asm-arm64/kvm.h                      |    81 +-
 linux-headers/asm-arm64/sve_context.h              |    11 +
 linux-headers/asm-generic/bitsperlong.h            |    17 +-
 linux-headers/asm-generic/unistd.h                 |   161 +-
 linux-headers/asm-loongarch/bitsperlong.h          |     1 +
 linux-headers/asm-loongarch/kvm.h                  |   111 +
 linux-headers/asm-loongarch/mman.h                 |     1 +
 linux-headers/asm-loongarch/unistd.h               |     5 +
 linux-headers/asm-mips/kvm.h                       |     2 -
 linux-headers/asm-mips/mman.h                      |     2 +-
 linux-headers/asm-mips/unistd_n32.h                |    12 +
 linux-headers/asm-mips/unistd_n64.h                |    12 +
 linux-headers/asm-mips/unistd_o32.h                |    12 +
 linux-headers/asm-powerpc/kvm.h                    |    48 +-
 linux-headers/asm-powerpc/unistd_32.h              |    12 +
 linux-headers/asm-powerpc/unistd_64.h              |    12 +
 linux-headers/asm-riscv/kvm.h                      |   206 +-
 linux-headers/asm-riscv/ptrace.h                   |   132 +
 linux-headers/asm-riscv/unistd.h                   |     9 +
 linux-headers/asm-s390/kvm.h                       |   331 +-
 linux-headers/asm-s390/unistd_32.h                 |    13 +
 linux-headers/asm-s390/unistd_64.h                 |    13 +
 linux-headers/asm-x86/kvm.h                        |   406 +-
 linux-headers/asm-x86/kvm_para.h                   |     1 +
 linux-headers/asm-x86/mman.h                       |    10 +-
 linux-headers/asm-x86/unistd_32.h                  |    12 +
 linux-headers/asm-x86/unistd_64.h                  |    12 +
 linux-headers/asm-x86/unistd_x32.h                 |    12 +
 linux-headers/linux/bits.h                         |    15 +
 linux-headers/linux/const.h                        |    36 +
 linux-headers/linux/iommufd.h                      |   695 +
 linux-headers/linux/kvm.h                          |   856 +-
 linux-headers/linux/kvm_para.h                     |     2 +
 linux-headers/linux/memfd.h                        |    39 +
 linux-headers/linux/mman.h                         |    14 +
 linux-headers/linux/nvme_ioctl.h                   |   114 +
 linux-headers/linux/psp-sev.h                      |    67 +
 linux-headers/linux/stddef.h                       |    66 +
 linux-headers/linux/userfaultfd.h                  |    74 +-
 linux-headers/linux/vfio.h                         |   240 +-
 linux-headers/linux/vhost.h                        |    67 +-
 linux-user/aarch64/Makefile.vdso                   |    15 +
 linux-user/aarch64/cpu_loop.c                      |     3 +-
 linux-user/aarch64/meson.build                     |    13 +
 linux-user/aarch64/mte_user_helper.c               |    35 +
 linux-user/aarch64/mte_user_helper.h               |    32 +
 linux-user/aarch64/signal.c                        |     3 +-
 linux-user/aarch64/target_mman.h                   |    21 +
 linux-user/aarch64/target_prctl.h                  |    19 +-
 linux-user/aarch64/target_proc.h                   |     1 +
 linux-user/aarch64/vdso-be.so                      |   Bin 0 -> 3224 bytes
 linux-user/aarch64/vdso-le.so                      |   Bin 0 -> 3224 bytes
 linux-user/aarch64/vdso.S                          |    75 +
 linux-user/aarch64/vdso.ld                         |    72 +
 linux-user/alpha/signal.c                          |     2 +-
 linux-user/alpha/target_elf.h                      |     2 +-
 linux-user/alpha/target_mman.h                     |    24 +
 linux-user/alpha/target_proc.h                     |    67 +
 linux-user/arm/Makefile.vdso                       |    17 +
 linux-user/arm/cpu_loop.c                          |     5 +-
 linux-user/arm/meson.build                         |    12 +
 linux-user/arm/signal.c                            |    52 +-
 linux-user/arm/target_mman.h                       |    11 +
 linux-user/arm/target_proc.h                       |   101 +
 linux-user/arm/vdso-asmoffset.h                    |     3 +
 linux-user/arm/vdso-be.so                          |   Bin 0 -> 2648 bytes
 linux-user/arm/vdso-le.so                          |   Bin 0 -> 2648 bytes
 linux-user/arm/vdso.S                              |   174 +
 linux-user/arm/vdso.ld                             |    67 +
 linux-user/cris/cpu_loop.c                         |     2 +-
 linux-user/cris/signal.c                           |     8 -
 linux-user/cris/target_mman.h                      |    12 +
 linux-user/cris/target_proc.h                      |     1 +
 linux-user/elfload.c                               |  2332 ++-
 linux-user/exit.c                                  |     8 +-
 linux-user/flat.h                                  |     5 +-
 linux-user/flatload.c                              |   307 +-
 linux-user/gen-vdso-elfn.c.inc                     |   314 +
 linux-user/gen-vdso.c                              |   223 +
 linux-user/generic/target_mman.h                   |    58 +
 linux-user/hexagon/cpu_loop.c                      |     7 +
 linux-user/hexagon/signal.c                        |     2 +-
 linux-user/hexagon/target_elf.h                    |    20 +-
 linux-user/hexagon/target_mman.h                   |    13 +
 linux-user/hexagon/target_proc.h                   |     1 +
 linux-user/hppa/Makefile.vdso                      |    11 +
 linux-user/hppa/cpu_loop.c                         |    18 +-
 linux-user/hppa/meson.build                        |     5 +
 linux-user/hppa/signal.c                           |    46 +-
 linux-user/hppa/target_cpu.h                       |     4 +-
 linux-user/hppa/target_elf.h                       |     2 +-
 linux-user/hppa/target_mman.h                      |    16 +
 linux-user/hppa/target_proc.h                      |    26 +
 linux-user/hppa/vdso-asmoffset.h                   |    12 +
 linux-user/hppa/vdso.S                             |   165 +
 linux-user/hppa/vdso.ld                            |    77 +
 linux-user/hppa/vdso.so                            |   Bin 0 -> 2104 bytes
 linux-user/i386/Makefile.vdso                      |    11 +
 linux-user/i386/cpu_loop.c                         |    70 +-
 linux-user/i386/meson.build                        |     7 +
 linux-user/i386/signal.c                           |   681 +-
 linux-user/i386/target_mman.h                      |    16 +
 linux-user/i386/target_proc.h                      |     1 +
 linux-user/i386/vdso-asmoffset.h                   |     6 +
 linux-user/i386/vdso.S                             |   143 +
 linux-user/i386/vdso.ld                            |    76 +
 linux-user/i386/vdso.so                            |   Bin 0 -> 2672 bytes
 linux-user/include/host/alpha/host-signal.h        |    55 -
 linux-user/include/host/s390/host-signal.h         |   138 -
 linux-user/include/host/s390x/host-signal.h        |   139 +-
 linux-user/include/host/x32/host-signal.h          |     1 -
 linux-user/ioctls.h                                |    10 +
 linux-user/linuxload.c                             |   135 +-
 linux-user/loader.h                                |    69 +-
 linux-user/loongarch64/Makefile.vdso               |    11 +
 linux-user/loongarch64/cpu_loop.c                  |    13 +
 linux-user/loongarch64/meson.build                 |     4 +
 linux-user/loongarch64/signal.c                    |   209 +-
 linux-user/loongarch64/target_mman.h               |    11 +
 linux-user/loongarch64/target_proc.h               |     1 +
 linux-user/loongarch64/target_syscall.h            |     7 -
 linux-user/loongarch64/vdso-asmoffset.h            |     8 +
 linux-user/loongarch64/vdso.S                      |   130 +
 linux-user/loongarch64/vdso.ld                     |    73 +
 linux-user/loongarch64/vdso.so                     |   Bin 0 -> 3560 bytes
 linux-user/m68k/cpu_loop.c                         |     2 +-
 linux-user/m68k/signal.c                           |     4 +-
 linux-user/m68k/target_cpu.h                       |     2 +-
 linux-user/m68k/target_mman.h                      |     5 +
 linux-user/m68k/target_proc.h                      |    16 +
 linux-user/main.c                                  |   151 +-
 linux-user/meson.build                             |     9 +-
 linux-user/microblaze/signal.c                     |     2 +-
 linux-user/microblaze/target_mman.h                |    11 +
 linux-user/microblaze/target_proc.h                |     1 +
 linux-user/mips/cpu_loop.c                         |     6 +-
 linux-user/mips/signal.c                           |     4 +-
 linux-user/mips/target_elf.h                       |     3 -
 linux-user/mips/target_mman.h                      |    28 +
 linux-user/mips/target_proc.h                      |     1 +
 linux-user/mips64/target_elf.h                     |    24 +-
 linux-user/mips64/target_mman.h                    |     2 +-
 linux-user/mips64/target_proc.h                    |     1 +
 linux-user/mmap.c                                  |  1517 +-
 linux-user/nios2/cpu_loop.c                        |   156 -
 linux-user/nios2/signal.c                          |   210 -
 linux-user/nios2/sockbits.h                        |     1 -
 linux-user/nios2/syscall_nr.h                      |   333 -
 linux-user/nios2/target_cpu.h                      |    49 -
 linux-user/nios2/target_elf.h                      |    14 -
 linux-user/nios2/target_errno_defs.h               |     7 -
 linux-user/nios2/target_fcntl.h                    |    11 -
 linux-user/nios2/target_mman.h                     |     1 -
 linux-user/nios2/target_prctl.h                    |     1 -
 linux-user/nios2/target_resource.h                 |     1 -
 linux-user/nios2/target_signal.h                   |     9 -
 linux-user/nios2/target_structs.h                  |     1 -
 linux-user/nios2/target_syscall.h                  |    37 -
 linux-user/nios2/termbits.h                        |     1 -
 linux-user/openrisc/signal.c                       |     2 +-
 linux-user/openrisc/target_mman.h                  |    10 +
 linux-user/openrisc/target_proc.h                  |     1 +
 linux-user/ppc/Makefile.vdso                       |    20 +
 linux-user/ppc/meson.build                         |    12 +
 linux-user/ppc/signal.c                            |    49 +-
 linux-user/ppc/target_mman.h                       |    28 +
 linux-user/ppc/target_proc.h                       |     1 +
 linux-user/ppc/vdso-32.ld                          |    70 +
 linux-user/ppc/vdso-32.so                          |   Bin 0 -> 3020 bytes
 linux-user/ppc/vdso-64.ld                          |    68 +
 linux-user/ppc/vdso-64.so                          |   Bin 0 -> 3896 bytes
 linux-user/ppc/vdso-64le.so                        |   Bin 0 -> 3896 bytes
 linux-user/ppc/vdso-asmoffset.h                    |    20 +
 linux-user/ppc/vdso.S                              |   239 +
 linux-user/qemu.h                                  |    21 +-
 linux-user/riscv/Makefile.vdso                     |    15 +
 linux-user/riscv/cpu_loop.c                        |     2 +-
 linux-user/riscv/meson.build                       |     7 +
 linux-user/riscv/signal.c                          |    14 +-
 linux-user/riscv/syscall32_nr.h                    |     1 +
 linux-user/riscv/syscall64_nr.h                    |     1 +
 linux-user/riscv/target_elf.h                      |     3 +-
 linux-user/riscv/target_mman.h                     |    10 +
 linux-user/riscv/target_proc.h                     |    37 +
 linux-user/riscv/vdso-32.so                        |   Bin 0 -> 2980 bytes
 linux-user/riscv/vdso-64.so                        |   Bin 0 -> 3944 bytes
 linux-user/riscv/vdso-asmoffset.h                  |     9 +
 linux-user/riscv/vdso.S                            |   187 +
 linux-user/riscv/vdso.ld                           |    74 +
 linux-user/s390x/Makefile.vdso                     |    11 +
 linux-user/s390x/meson.build                       |     6 +
 linux-user/s390x/signal.c                          |     9 +-
 linux-user/s390x/target_mman.h                     |    20 +
 linux-user/s390x/target_proc.h                     |   109 +
 linux-user/s390x/vdso-asmoffset.h                  |     2 +
 linux-user/s390x/vdso.S                            |    61 +
 linux-user/s390x/vdso.ld                           |    72 +
 linux-user/s390x/vdso.so                           |   Bin 0 -> 3464 bytes
 linux-user/sh4/signal.c                            |    10 +-
 linux-user/sh4/target_mman.h                       |     7 +
 linux-user/sh4/target_proc.h                       |     1 +
 linux-user/sh4/termbits.h                          |   204 +-
 linux-user/signal-common.h                         |     4 +-
 linux-user/signal.c                                |   535 +-
 linux-user/sparc/cpu_loop.c                        |    13 +-
 linux-user/sparc/signal.c                          |    23 +-
 linux-user/sparc/target_cpu.h                      |    17 +-
 linux-user/sparc/target_mman.h                     |    34 +
 linux-user/sparc/target_proc.h                     |    16 +
 linux-user/sparc/target_syscall.h                  |     6 +-
 linux-user/strace.c                                |   160 +-
 linux-user/strace.list                             |     6 +-
 linux-user/syscall.c                               |  1248 +-
 linux-user/syscall_defs.h                          |  2312 +--
 linux-user/syscall_types.h                         |     5 +
 linux-user/thunk.c                                 |    26 +-
 linux-user/uaccess.c                               |     4 +-
 linux-user/user-internals.h                        |     4 +-


From xen-changelog-bounces@lists.xenproject.org Fri Oct 04 11:22:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 04 Oct 2024 11:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.810299.1222996 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swgNp-0005rm-RU; Fri, 04 Oct 2024 11:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 810299.1222996; Fri, 04 Oct 2024 11: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 1swgNp-0005re-P2; Fri, 04 Oct 2024 11:22:05 +0000
Received: by outflank-mailman (input) for mailman id 810299;
 Fri, 04 Oct 2024 11: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 1swgNo-0005rS-HD
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 2024 11: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 1swgNo-0002sh-AL
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 2024 11:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swgNo-0002g1-8p
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 2024 11:22: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=nH07FFoc+e766pyDRaFFk+2xCFjkYTHcrXLjl81GqXI=; b=qi9OR85Gd5O+hp753etHncXW6N
	8963Aruhb52GVMz+EYh4leydNexeMy/9E7zYi74TgJbhcpuv9G8rR/wpH1Wk/MLyw07zriyC4HKq2
	WERBoR3MIoRcCxHdQVLQ1DyyLVIATeKeCIZFMoRGY0JC9Qs9oPRErbBeZlLN3Sv77ftQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Convert remaining uses of the legacy ALIGN
Message-Id: <E1swgNo-0002g1-8p@xenbits.xenproject.org>
Date: Fri, 04 Oct 2024 11:22:04 +0000

commit 7fd80df2bf4a255ef7efbfb165f9e3aee09374c9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Oct 2 20:59:19 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 4 12:13:32 2024 +0100

    x86/boot: Convert remaining uses of the legacy ALIGN
    
    There are only two remaining standalone uses the legacy ALIGN macro.
    
    Drop these by switching the .incbin's over to using FUNC()/END() which has
    alignment handled internally.  While the incbin's aren't technically one
    single function, they behave as if they are.
    
    Finally, expand ALIGN inside the legacy ENTRY() macro in order to remove ALIGN
    itself.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/boot/head.S | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index af776c201a..c4de1dfab5 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -10,9 +10,8 @@
 #include <asm/cpufeature.h>
 #include <public/elfnote.h>
 
-#define ALIGN .align CONFIG_FUNCTION_ALIGNMENT, CODE_FILL
 #define ENTRY(name)                             \
-  ALIGN;                                        \
+  .align CONFIG_FUNCTION_ALIGNMENT, CODE_FILL;  \
   GLOBAL(name)
 #define GLOBAL(name)                            \
   .globl name;                                  \
@@ -764,13 +763,13 @@ trampoline_setup:
          * cmdline and reloc are written in C, and linked to be 32bit PIC with
          * entrypoints at 0 and using the fastcall convention.
          */
-        ALIGN
-cmdline_parse_early:
+FUNC_LOCAL(cmdline_parse_early)
         .incbin "cmdline.bin"
+END(cmdline_parse_early)
 
-        ALIGN
-reloc:
+FUNC_LOCAL(reloc)
         .incbin "reloc.bin"
+END(reloc)
 
 ENTRY(trampoline_start)
 #include "trampoline.S"
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Oct 04 11:22:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 04 Oct 2024 11:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.810300.1223001 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swgNz-0005tR-TY; Fri, 04 Oct 2024 11:22:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 810300.1223001; Fri, 04 Oct 2024 11: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 1swgNz-0005tK-QY; Fri, 04 Oct 2024 11:22:15 +0000
Received: by outflank-mailman (input) for mailman id 810300;
 Fri, 04 Oct 2024 11: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 1swgNy-0005t2-Ft
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 2024 11: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 1swgNy-0002t6-F2
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 2024 11:22:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swgNy-0002gw-Dy
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 2024 11: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=MhbXxe2EymE+0mR2YEG0BJHC/HVLYLrAZROQg1k8+gU=; b=QUE5b4nB7VRMYzJMKRabux7zZu
	Wp0CYpGfyTykbUjJsHSsNwLlPdu+TQCwukNS9AsL7ayuPFhX1dDQ/1JheaBOF9gwofNNJmvP0KxzY
	8XMrdHx4504HMftSgSSkXOHBHd+a9IvoyyuZuDdOtWDxYDvaPrpsxfT+cLz3DPcF49iM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: Introduce X86_ET_* constants in x86-defns.h
Message-Id: <E1swgNy-0002gw-Dy@xenbits.xenproject.org>
Date: Fri, 04 Oct 2024 11:22:14 +0000

commit 1eeb7c337905c0c602d5924696c86b0436489e84
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Sep 18 16:50:15 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 4 12:13:32 2024 +0100

    x86: Introduce X86_ET_* constants in x86-defns.h
    
    The FRED spec architecturalises the Event Type encoding, previously exposed
    only in VMCB/VMCS fields.
    
    Introduce the constants in x86-defns.h, making them a bit more concise, and
    retire enum x86_event_type.
    
    Take the opportunity to introduce X86_ET_OTHER.  It's absence appears to be a
    bug in Introspection's Monitor Trap Flag support, when considering VECTORING
    events during another VMExit.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/include/xendevicemodel.h         |  2 +-
 xen/arch/x86/hvm/hvm.c                 |  8 +++---
 xen/arch/x86/hvm/svm/intr.c            |  4 +--
 xen/arch/x86/hvm/svm/svm.c             | 47 +++++++++++++++++-----------------
 xen/arch/x86/hvm/vmx/vmx.c             | 42 ++++++++++++++----------------
 xen/arch/x86/hvm/vmx/vvmx.c            | 12 ++++-----
 xen/arch/x86/include/asm/domain.h      |  8 +++---
 xen/arch/x86/include/asm/hvm/hvm.h     |  4 +--
 xen/arch/x86/include/asm/x86-defns.h   | 14 ++++++++++
 xen/arch/x86/mm/shadow/multi.c         |  2 +-
 xen/arch/x86/pv/ro-page-fault.c        |  2 +-
 xen/arch/x86/pv/traps.c                |  6 ++---
 xen/arch/x86/x86_emulate/x86_emulate.c | 26 +++++++++----------
 xen/arch/x86/x86_emulate/x86_emulate.h | 19 +++-----------
 xen/include/public/hvm/dm_op.h         |  2 +-
 15 files changed, 96 insertions(+), 102 deletions(-)

diff --git a/tools/include/xendevicemodel.h b/tools/include/xendevicemodel.h
index 797e0c6b29..227e7fd810 100644
--- a/tools/include/xendevicemodel.h
+++ b/tools/include/xendevicemodel.h
@@ -308,7 +308,7 @@ int xendevicemodel_set_mem_type(
  * @parm domid the domain id to be serviced
  * @parm vcpu the vcpu id
  * @parm vector the interrupt vector
- * @parm type the event type (see the definition of enum x86_event_type)
+ * @parm type the event type (see x86-defns.h:X86_ET_*)
  * @parm error_code the error code or ~0 to skip
  * @parm insn_len the instruction length
  * @parm extra type-specific extra data (%cr2 for #PF, pending_dbg for #DB)
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index b2e782d596..7b2e1c9813 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -219,10 +219,10 @@ int hvm_event_needs_reinjection(uint8_t type, uint8_t vector)
 {
     switch ( type )
     {
-    case X86_EVENTTYPE_EXT_INTR:
-    case X86_EVENTTYPE_NMI:
+    case X86_ET_EXT_INTR:
+    case X86_ET_NMI:
         return 1;
-    case X86_EVENTTYPE_HW_EXCEPTION:
+    case X86_ET_HW_EXC:
         /*
          * SVM uses type 3 ("HW Exception") for #OF and #BP. We explicitly
          * check for these vectors, as they are really SW Exceptions. SVM has
@@ -1738,7 +1738,7 @@ void hvm_inject_event(const struct x86_event *event)
 {
     struct vcpu *curr = current;
     const uint8_t vector = event->vector;
-    const bool has_ec = ((event->type == X86_EVENTTYPE_HW_EXCEPTION) &&
+    const bool has_ec = ((event->type == X86_ET_HW_EXC) &&
                          (vector < 32) && ((X86_EXC_HAVE_EC & (1u << vector))));
 
     ASSERT(vector == event->vector); /* Confirm no truncation. */
diff --git a/xen/arch/x86/hvm/svm/intr.c b/xen/arch/x86/hvm/svm/intr.c
index 780c7e178a..46186a1102 100644
--- a/xen/arch/x86/hvm/svm/intr.c
+++ b/xen/arch/x86/hvm/svm/intr.c
@@ -35,7 +35,7 @@ static void svm_inject_nmi(struct vcpu *v)
 
     event.raw = 0;
     event.v = true;
-    event.type = X86_EVENTTYPE_NMI;
+    event.type = X86_ET_NMI;
     event.vector = X86_EXC_NMI;
 
     ASSERT(!vmcb->event_inj.v);
@@ -56,7 +56,7 @@ static void svm_inject_extint(struct vcpu *v, int vector)
 
     event.raw = 0;
     event.v = true;
-    event.type = X86_EVENTTYPE_EXT_INTR;
+    event.type = X86_ET_EXT_INTR;
     event.vector = vector;
 
     ASSERT(!vmcb->event_inj.v);
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index e0793b26db..b8f87aa1ed 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1185,7 +1185,7 @@ static void svm_emul_swint_injection(struct x86_event *event)
 
     /* ICEBP sets the External Event bit despite being an instruction. */
     ec = (trap << 3) | X86_XEC_IDT |
-        (type == X86_EVENTTYPE_PRI_SW_EXCEPTION ? X86_XEC_EXT : 0);
+         (type == X86_ET_PRIV_SW_EXC ? X86_XEC_EXT : 0);
 
     /*
      * TODO: This does not cover the v8086 mode with CR4.VME case
@@ -1243,7 +1243,7 @@ static void svm_emul_swint_injection(struct x86_event *event)
         goto raise_exception;
 
     /* ICEBP counts as a hardware event, and bypasses the dpl check. */
-    if ( type != X86_EVENTTYPE_PRI_SW_EXCEPTION &&
+    if ( type != X86_ET_PRIV_SW_EXC &&
          vmcb_get_cpl(vmcb) > ((idte.b >> 13) & 3) )
         goto raise_exception;
 
@@ -1264,7 +1264,7 @@ static void svm_emul_swint_injection(struct x86_event *event)
 
  raise_exception:
     event->vector = fault;
-    event->type = X86_EVENTTYPE_HW_EXCEPTION;
+    event->type = X86_ET_HW_EXC;
     event->insn_len = 0;
     event->error_code = ec;
 }
@@ -1285,11 +1285,11 @@ static void cf_check svm_inject_event(const struct x86_event *event)
      * further fault shouldn't occur during delivery.  This covers the fact
      * that hardware doesn't perform DPL checking on injection.
      */
-    if ( event->type == X86_EVENTTYPE_PRI_SW_EXCEPTION ||
-         (!cpu_has_svm_nrips && (event->type >= X86_EVENTTYPE_SW_INTERRUPT)) )
+    if ( event->type == X86_ET_PRIV_SW_EXC ||
+         (!cpu_has_svm_nrips && (event->type >= X86_ET_SW_INT)) )
         svm_emul_swint_injection(&_event);
 
-    switch ( _event.vector | -(_event.type == X86_EVENTTYPE_SW_INTERRUPT) )
+    switch ( _event.vector | -(_event.type == X86_ET_SW_INT) )
     {
     case X86_EXC_DB:
         if ( regs->eflags & X86_EFLAGS_TF )
@@ -1308,13 +1308,13 @@ static void cf_check svm_inject_event(const struct x86_event *event)
         break;
 
     case X86_EXC_PF:
-        ASSERT(_event.type == X86_EVENTTYPE_HW_EXCEPTION);
+        ASSERT(_event.type == X86_ET_HW_EXC);
         curr->arch.hvm.guest_cr[2] = _event.cr2;
         vmcb_set_cr2(vmcb, _event.cr2);
         break;
     }
 
-    if ( eventinj.v && (eventinj.type == X86_EVENTTYPE_HW_EXCEPTION) )
+    if ( eventinj.v && (eventinj.type == X86_ET_HW_EXC) )
     {
         _event.vector = hvm_combine_hw_exceptions(
             eventinj.vector, _event.vector);
@@ -1339,15 +1339,15 @@ static void cf_check svm_inject_event(const struct x86_event *event)
      */
     switch ( _event.type )
     {
-    case X86_EVENTTYPE_SW_INTERRUPT: /* int $n */
+    case X86_ET_SW_INT: /* int $n */
         if ( cpu_has_svm_nrips )
             vmcb->nextrip = regs->rip + _event.insn_len;
         else
             regs->rip += _event.insn_len;
-        eventinj.type = X86_EVENTTYPE_SW_INTERRUPT;
+        eventinj.type = X86_ET_SW_INT;
         break;
 
-    case X86_EVENTTYPE_PRI_SW_EXCEPTION: /* icebp */
+    case X86_ET_PRIV_SW_EXC: /* icebp */
         /*
          * icebp's injection must always be emulated, as hardware does not
          * special case HW_EXCEPTION with vector 1 (#DB) as having trap
@@ -1356,10 +1356,10 @@ static void cf_check svm_inject_event(const struct x86_event *event)
         regs->rip += _event.insn_len;
         if ( cpu_has_svm_nrips )
             vmcb->nextrip = regs->rip;
-        eventinj.type = X86_EVENTTYPE_HW_EXCEPTION;
+        eventinj.type = X86_ET_HW_EXC;
         break;
 
-    case X86_EVENTTYPE_SW_EXCEPTION: /* int3, into */
+    case X86_ET_SW_EXC: /* int3, into */
         /*
          * Hardware special cases HW_EXCEPTION with vectors 3 and 4 as having
          * trap semantics, and will perform DPL checks.
@@ -1368,11 +1368,11 @@ static void cf_check svm_inject_event(const struct x86_event *event)
             vmcb->nextrip = regs->rip + _event.insn_len;
         else
             regs->rip += _event.insn_len;
-        eventinj.type = X86_EVENTTYPE_HW_EXCEPTION;
+        eventinj.type = X86_ET_HW_EXC;
         break;
 
     default:
-        eventinj.type = X86_EVENTTYPE_HW_EXCEPTION;
+        eventinj.type = X86_ET_HW_EXC;
         eventinj.ev = (_event.error_code != X86_EVENT_NO_EC);
         eventinj.ec = _event.error_code;
         break;
@@ -1391,8 +1391,7 @@ static void cf_check svm_inject_event(const struct x86_event *event)
     ASSERT(!eventinj.ev || eventinj.ec == (uint16_t)eventinj.ec);
     vmcb->event_inj = eventinj;
 
-    if ( _event.vector == X86_EXC_PF &&
-         _event.type == X86_EVENTTYPE_HW_EXCEPTION )
+    if ( _event.vector == X86_EXC_PF && _event.type == X86_ET_HW_EXC )
         TRACE(TRC_HVM_PF_INJECT64, _event.error_code,
               _event.cr2, _event.cr2 >> 32);
     else
@@ -2694,12 +2693,12 @@ void asmlinkage svm_vmexit_handler(void)
 
             if ( likely(exit_reason != VMEXIT_ICEBP) )
             {
-                trap_type = X86_EVENTTYPE_HW_EXCEPTION;
+                trap_type = X86_ET_HW_EXC;
                 insn_len = 0;
             }
             else
             {
-                trap_type = X86_EVENTTYPE_PRI_SW_EXCEPTION;
+                trap_type = X86_ET_PRIV_SW_EXC;
                 insn_len = svm_get_insn_len(v, INSTR_ICEBP);
 
                 if ( !insn_len )
@@ -2736,13 +2735,13 @@ void asmlinkage svm_vmexit_handler(void)
         {
            rc = hvm_monitor_debug(regs->rip,
                                   HVM_MONITOR_SOFTWARE_BREAKPOINT,
-                                  X86_EVENTTYPE_SW_EXCEPTION,
+                                  X86_ET_SW_EXC,
                                   insn_len, 0);
            if ( rc < 0 )
                goto unexpected_exit_type;
            if ( !rc )
                hvm_inject_exception(X86_EXC_BP,
-                                    X86_EVENTTYPE_SW_EXCEPTION,
+                                    X86_ET_SW_EXC,
                                     insn_len, X86_EVENT_NO_EC);
         }
         break;
@@ -2835,13 +2834,13 @@ void asmlinkage svm_vmexit_handler(void)
                  * ICEBP is handled specially, and already has fault
                  * semantics.
                  */
-            case X86_EVENTTYPE_HW_EXCEPTION:
+            case X86_ET_HW_EXC:
                 if ( vmcb->exit_int_info.vector == X86_EXC_BP ||
                      vmcb->exit_int_info.vector == X86_EXC_OF )
                     break;
                 /* Fallthrough */
-            case X86_EVENTTYPE_EXT_INTR:
-            case X86_EVENTTYPE_NMI:
+            case X86_ET_EXT_INTR:
+            case X86_ET_NMI:
                 insn_len = 0;
                 break;
             }
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 12f8a66458..b6885d0e27 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1994,14 +1994,13 @@ void vmx_inject_extint(int trap, uint8_t source)
         if ( pin_based_cntrl & PIN_BASED_EXT_INTR_MASK ) {
             nvmx_enqueue_n2_exceptions (v, 
                INTR_INFO_VALID_MASK |
-               MASK_INSR(X86_EVENTTYPE_EXT_INTR, INTR_INFO_INTR_TYPE_MASK) |
+               MASK_INSR(X86_ET_EXT_INTR, INTR_INFO_INTR_TYPE_MASK) |
                MASK_INSR(trap, INTR_INFO_VECTOR_MASK),
                X86_EVENT_NO_EC, source);
             return;
         }
     }
-    __vmx_inject_exception(trap, X86_EVENTTYPE_EXT_INTR,
-                           X86_EVENT_NO_EC);
+    __vmx_inject_exception(trap, X86_ET_EXT_INTR, X86_EVENT_NO_EC);
 }
 
 void vmx_inject_nmi(void)
@@ -2014,23 +2013,22 @@ void vmx_inject_nmi(void)
         if ( pin_based_cntrl & PIN_BASED_NMI_EXITING ) {
             nvmx_enqueue_n2_exceptions (v, 
                INTR_INFO_VALID_MASK |
-               MASK_INSR(X86_EVENTTYPE_NMI, INTR_INFO_INTR_TYPE_MASK) |
+               MASK_INSR(X86_ET_NMI, INTR_INFO_INTR_TYPE_MASK) |
                MASK_INSR(X86_EXC_NMI, INTR_INFO_VECTOR_MASK),
                X86_EVENT_NO_EC, hvm_intsrc_nmi);
             return;
         }
     }
-    __vmx_inject_exception(2, X86_EVENTTYPE_NMI,
-                           X86_EVENT_NO_EC);
+    __vmx_inject_exception(2, X86_ET_NMI, X86_EVENT_NO_EC);
 }
 
 /*
  * Generate a virtual event in the guest.
  * NOTES:
- *  - INT 3 (CC) and INTO (CE) are X86_EVENTTYPE_SW_EXCEPTION;
- *  - INT nn (CD nn) is X86_EVENTTYPE_SW_INTERRUPT;
- *  - #DB is X86_EVENTTYPE_HW_EXCEPTION, except when generated by
- *    opcode 0xf1 (which is X86_EVENTTYPE_PRI_SW_EXCEPTION)
+ *  - INT3 (CC) and INTO (CE) are X86_ET_SW_EXC;
+ *  - INT $n (CD nn) is X86_ET_SW_INT;
+ *  - #DB is X86_ET_HW_EXC, except when generated by
+ *    ICEBP/INT1 (which is X86_ET_PRIV_SW_EXC)
  */
 static void cf_check vmx_inject_event(const struct x86_event *event)
 {
@@ -2038,7 +2036,7 @@ static void cf_check vmx_inject_event(const struct x86_event *event)
     struct vcpu *curr = current;
     struct x86_event _event = *event;
 
-    switch ( _event.vector | -(_event.type == X86_EVENTTYPE_SW_INTERRUPT) )
+    switch ( _event.vector | -(_event.type == X86_ET_SW_INT) )
     {
     case X86_EXC_DB:
         if ( guest_cpu_user_regs()->eflags & X86_EFLAGS_TF )
@@ -2069,7 +2067,7 @@ static void cf_check vmx_inject_event(const struct x86_event *event)
         break;
 
     case X86_EXC_PF:
-        ASSERT(_event.type == X86_EVENTTYPE_HW_EXCEPTION);
+        ASSERT(_event.type == X86_ET_HW_EXC);
         curr->arch.hvm.guest_cr[2] = _event.cr2;
         break;
     }
@@ -2080,8 +2078,7 @@ static void cf_check vmx_inject_event(const struct x86_event *event)
         __vmread(VM_ENTRY_INTR_INFO, &intr_info);
 
     if ( unlikely(intr_info & INTR_INFO_VALID_MASK) &&
-         (MASK_EXTR(intr_info, INTR_INFO_INTR_TYPE_MASK) ==
-          X86_EVENTTYPE_HW_EXCEPTION) )
+         (MASK_EXTR(intr_info, INTR_INFO_INTR_TYPE_MASK) == X86_ET_HW_EXC) )
     {
         _event.vector = hvm_combine_hw_exceptions(
             (uint8_t)intr_info, _event.vector);
@@ -2089,7 +2086,7 @@ static void cf_check vmx_inject_event(const struct x86_event *event)
             _event.error_code = 0;
     }
 
-    if ( _event.type >= X86_EVENTTYPE_SW_INTERRUPT )
+    if ( _event.type >= X86_ET_SW_INT )
         __vmwrite(VM_ENTRY_INSTRUCTION_LEN, _event.insn_len);
 
     if ( nestedhvm_vcpu_in_guestmode(curr) &&
@@ -2105,8 +2102,7 @@ static void cf_check vmx_inject_event(const struct x86_event *event)
     else
         __vmx_inject_exception(_event.vector, _event.type, _event.error_code);
 
-    if ( (_event.vector == X86_EXC_PF) &&
-         (_event.type == X86_EVENTTYPE_HW_EXCEPTION) )
+    if ( (_event.vector == X86_EXC_PF) && (_event.type == X86_ET_HW_EXC) )
         TRACE(TRC_HVM_PF_INJECT64, _event.error_code,
               curr->arch.hvm.guest_cr[2], curr->arch.hvm.guest_cr[2] >> 32);
     else
@@ -3951,7 +3947,7 @@ static void vmx_propagate_intr(unsigned long intr)
     else
         event.error_code = X86_EVENT_NO_EC;
 
-    if ( event.type >= X86_EVENTTYPE_SW_INTERRUPT )
+    if ( event.type >= X86_ET_SW_INT )
     {
         __vmread(VM_EXIT_INSTRUCTION_LEN, &tmp);
         event.insn_len = tmp;
@@ -3990,7 +3986,7 @@ static void vmx_idtv_reinject(unsigned long idtv_info)
          */
         if ( cpu_has_vmx_vnmi &&
              ((idtv_info & INTR_INFO_INTR_TYPE_MASK) ==
-              MASK_INSR(X86_EVENTTYPE_NMI, INTR_INFO_INTR_TYPE_MASK)) )
+              MASK_INSR(X86_ET_NMI, INTR_INFO_INTR_TYPE_MASK)) )
         {
             unsigned long intr_info;
 
@@ -4115,7 +4111,7 @@ void asmlinkage vmx_vmexit_handler(struct cpu_user_regs *regs)
             do_machine_check(regs);
         if ( (vector == X86_EXC_NMI) &&
              ((intr_info & INTR_INFO_INTR_TYPE_MASK) ==
-              MASK_INSR(X86_EVENTTYPE_NMI, INTR_INFO_INTR_TYPE_MASK)) )
+              MASK_INSR(X86_ET_NMI, INTR_INFO_INTR_TYPE_MASK)) )
         {
             do_nmi(regs);
             enable_nmis();
@@ -4317,7 +4313,7 @@ void asmlinkage vmx_vmexit_handler(struct cpu_user_regs *regs)
                 unsigned long trap_type = MASK_EXTR(intr_info,
                                                     INTR_INFO_INTR_TYPE_MASK);
 
-                if ( trap_type >= X86_EVENTTYPE_SW_INTERRUPT )
+                if ( trap_type >= X86_ET_SW_INT )
                     __vmread(VM_EXIT_INSTRUCTION_LEN, &insn_len);
 
                 rc = hvm_monitor_debug(regs->rip,
@@ -4342,7 +4338,7 @@ void asmlinkage vmx_vmexit_handler(struct cpu_user_regs *regs)
                 __vmread(VM_EXIT_INSTRUCTION_LEN, &insn_len);
                 rc = hvm_monitor_debug(regs->rip,
                                        HVM_MONITOR_SOFTWARE_BREAKPOINT,
-                                       X86_EVENTTYPE_SW_EXCEPTION,
+                                       X86_ET_SW_EXC,
                                        insn_len, 0);
 
                 if ( rc < 0 )
@@ -4391,7 +4387,7 @@ void asmlinkage vmx_vmexit_handler(struct cpu_user_regs *regs)
             break;
         case X86_EXC_NMI:
             if ( MASK_EXTR(intr_info, INTR_INFO_INTR_TYPE_MASK) !=
-                 X86_EVENTTYPE_NMI )
+                 X86_ET_NMI )
                 goto exit_and_crash;
             TRACE(TRC_HVM_NMI);
             /* Already handled above. */
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index c05e0e9326..78135ca23b 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -1346,7 +1346,7 @@ static void sync_exception_state(struct vcpu *v)
 
     switch ( MASK_EXTR(nvmx->intr.intr_info, INTR_INFO_INTR_TYPE_MASK) )
     {
-    case X86_EVENTTYPE_EXT_INTR:
+    case X86_ET_EXT_INTR:
         /* rename exit_reason to EXTERNAL_INTERRUPT */
         set_vvmcs(v, VM_EXIT_REASON, EXIT_REASON_EXTERNAL_INTERRUPT);
         set_vvmcs(v, EXIT_QUALIFICATION, 0);
@@ -1355,14 +1355,14 @@ static void sync_exception_state(struct vcpu *v)
                                                          : 0);
         break;
 
-    case X86_EVENTTYPE_HW_EXCEPTION:
-    case X86_EVENTTYPE_SW_INTERRUPT:
-    case X86_EVENTTYPE_SW_EXCEPTION:
+    case X86_ET_HW_EXC:
+    case X86_ET_SW_INT:
+    case X86_ET_SW_EXC:
         /* throw to L1 */
         set_vvmcs(v, VM_EXIT_INTR_INFO, nvmx->intr.intr_info);
         set_vvmcs(v, VM_EXIT_INTR_ERROR_CODE, nvmx->intr.error_code);
         break;
-    case X86_EVENTTYPE_NMI:
+    case X86_ET_NMI:
         set_vvmcs(v, VM_EXIT_REASON, EXIT_REASON_EXCEPTION_NMI);
         set_vvmcs(v, EXIT_QUALIFICATION, 0);
         set_vvmcs(v, VM_EXIT_INTR_INFO, nvmx->intr.intr_info);
@@ -2445,7 +2445,7 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs,
     case EXIT_REASON_EXCEPTION_NMI:
     {
         unsigned long intr_info;
-        u32 valid_mask = MASK_INSR(X86_EVENTTYPE_HW_EXCEPTION,
+        u32 valid_mask = MASK_INSR(X86_ET_HW_EXC,
                                   INTR_INFO_INTR_TYPE_MASK) |
                          INTR_INFO_VALID_MASK;
         u64 exec_bitmap;
diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index bdcdb8de09..5219c4fb0f 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -724,7 +724,7 @@ static inline void pv_inject_hw_exception(unsigned int vector, int errcode)
 {
     const struct x86_event event = {
         .vector = vector,
-        .type = X86_EVENTTYPE_HW_EXCEPTION,
+        .type = X86_ET_HW_EXC,
         .error_code = errcode,
     };
 
@@ -735,7 +735,7 @@ static inline void pv_inject_DB(unsigned long pending_dbg)
 {
     struct x86_event event = {
         .vector      = X86_EXC_DB,
-        .type        = X86_EVENTTYPE_HW_EXCEPTION,
+        .type        = X86_ET_HW_EXC,
         .error_code  = X86_EVENT_NO_EC,
     };
 
@@ -748,7 +748,7 @@ static inline void pv_inject_page_fault(int errcode, unsigned long cr2)
 {
     struct x86_event event = {
         .vector = X86_EXC_PF,
-        .type = X86_EVENTTYPE_HW_EXCEPTION,
+        .type = X86_ET_HW_EXC,
         .error_code = errcode,
     };
 
@@ -761,7 +761,7 @@ static inline void pv_inject_sw_interrupt(unsigned int vector)
 {
     const struct x86_event event = {
         .vector = vector,
-        .type = X86_EVENTTYPE_SW_INTERRUPT,
+        .type = X86_ET_SW_INT,
         .error_code = X86_EVENT_NO_EC,
     };
 
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index dd7d4872b5..02de18c7d4 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -522,7 +522,7 @@ static inline void hvm_inject_hw_exception(unsigned int vector, int errcode)
 {
     struct x86_event event = {
         .vector = vector,
-        .type = X86_EVENTTYPE_HW_EXCEPTION,
+        .type = X86_ET_HW_EXC,
         .error_code = errcode,
     };
 
@@ -533,7 +533,7 @@ static inline void hvm_inject_page_fault(int errcode, unsigned long cr2)
 {
     struct x86_event event = {
         .vector = X86_EXC_PF,
-        .type = X86_EVENTTYPE_HW_EXCEPTION,
+        .type = X86_ET_HW_EXC,
         .error_code = errcode,
     };
 
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index 7abc5bcd42..2493ec277f 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -204,4 +204,18 @@
 #define X86_MT_UCM    0x07 /* UC- */
 #define X86_NUM_MT    0x08
 
+/*
+ * Event Types.
+ *
+ * These encodings were first used in VMCB/VMCS fields, but have become
+ * architectural in the FRED spec.
+ */
+#define X86_ET_EXT_INTR    0 /* External Interrupt */
+#define X86_ET_NMI         2 /* NMI */
+#define X86_ET_HW_EXC      3 /* Hardware Exception (#PF/#GP/etc) */
+#define X86_ET_SW_INT      4 /* Software Interrupt (INT $n) */
+#define X86_ET_PRIV_SW_EXC 5 /* Privileged Software Exception (ICEBP/INT1) */
+#define X86_ET_SW_EXC      6 /* Software Exception (INT3, INTO) */
+#define X86_ET_OTHER       7 /* Misc event: MTF=0, SYSCALL=1, SYSENTER=2 */
+
 #endif	/* __XEN_X86_DEFNS_H__ */
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 376f6823cd..10ddc408ff 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -2701,7 +2701,7 @@ static int cf_check sh_page_fault(
          * else is an emulation bug, or a guest playing with the instruction
          * stream under Xen's feet.
          */
-        if ( emul_ctxt.ctxt.event.type == X86_EVENTTYPE_HW_EXCEPTION &&
+        if ( emul_ctxt.ctxt.event.type == X86_ET_HW_EXC &&
              ((emul_ctxt.ctxt.event.vector == X86_EXC_PF) ||
               (((emul_ctxt.ctxt.event.vector == X86_EXC_GP) ||
                 (emul_ctxt.ctxt.event.vector == X86_EXC_SS)) &&
diff --git a/xen/arch/x86/pv/ro-page-fault.c b/xen/arch/x86/pv/ro-page-fault.c
index d0fe07e3a1..6a739f9e9a 100644
--- a/xen/arch/x86/pv/ro-page-fault.c
+++ b/xen/arch/x86/pv/ro-page-fault.c
@@ -379,7 +379,7 @@ int pv_ro_page_fault(unsigned long addr, struct cpu_user_regs *regs)
          * concurrent pagetable update).  Anything else is an emulation bug,
          * or a guest playing with the instruction stream under Xen's feet.
          */
-        if ( ctxt.event.type == X86_EVENTTYPE_HW_EXCEPTION &&
+        if ( ctxt.event.type == X86_ET_HW_EXC &&
              ctxt.event.vector == X86_EXC_PF )
             pv_inject_event(&ctxt.event);
         else
diff --git a/xen/arch/x86/pv/traps.c b/xen/arch/x86/pv/traps.c
index 5a7341abf0..ed8aa97382 100644
--- a/xen/arch/x86/pv/traps.c
+++ b/xen/arch/x86/pv/traps.c
@@ -29,14 +29,14 @@ void pv_inject_event(const struct x86_event *event)
     bool use_error_code;
 
     ASSERT(vector == event->vector); /* Confirm no truncation. */
-    if ( event->type == X86_EVENTTYPE_HW_EXCEPTION )
+    if ( event->type == X86_ET_HW_EXC )
     {
         ASSERT(vector < 32);
         use_error_code = X86_EXC_HAVE_EC & (1u << vector);
     }
     else
     {
-        ASSERT(event->type == X86_EVENTTYPE_SW_INTERRUPT);
+        ASSERT(event->type == X86_ET_SW_INT);
         use_error_code = false;
     }
     if ( use_error_code )
@@ -51,7 +51,7 @@ void pv_inject_event(const struct x86_event *event)
     tb->cs    = ti->cs;
     tb->eip   = ti->address;
 
-    switch ( vector | -(event->type == X86_EVENTTYPE_SW_INTERRUPT) )
+    switch ( vector | -(event->type == X86_ET_SW_INT) )
     {
     case X86_EXC_PF:
         curr->arch.pv.ctrlreg[2] = event->cr2;
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index bbda0ffc2f..0ea0d5e67e 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -2372,19 +2372,19 @@ x86_emulate(
         {
         case 0xcc: /* int3 */
             ctxt->event.vector = X86_EXC_BP;
-            ctxt->event.type = X86_EVENTTYPE_SW_EXCEPTION;
+            ctxt->event.type = X86_ET_SW_EXC;
             break;
         case 0xcd: /* int imm8 */
             ctxt->event.vector = imm1;
-            ctxt->event.type = X86_EVENTTYPE_SW_INTERRUPT;
+            ctxt->event.type = X86_ET_SW_INT;
             break;
         case 0xce: /* into */
             ctxt->event.vector = X86_EXC_OF;
-            ctxt->event.type = X86_EVENTTYPE_SW_EXCEPTION;
+            ctxt->event.type = X86_ET_SW_EXC;
             break;
         case 0xf1: /* icebp */
             ctxt->event.vector = X86_EXC_DB;
-            ctxt->event.type = X86_EVENTTYPE_PRI_SW_EXCEPTION;
+            ctxt->event.type = X86_ET_PRIV_SW_EXC;
             break;
         }
         ctxt->event.error_code = X86_EVENT_NO_EC;
@@ -8597,16 +8597,14 @@ static void __init __maybe_unused build_assertions(void)
     BUILD_BUG_ON(x86_seg_fs != 4);
     BUILD_BUG_ON(x86_seg_gs != 5);
 
-    /*
-     * Check X86_EVENTTYPE_* against VMCB EVENTINJ and VMCS INTR_INFO type
-     * fields.
-     */
-    BUILD_BUG_ON(X86_EVENTTYPE_EXT_INTR != 0);
-    BUILD_BUG_ON(X86_EVENTTYPE_NMI != 2);
-    BUILD_BUG_ON(X86_EVENTTYPE_HW_EXCEPTION != 3);
-    BUILD_BUG_ON(X86_EVENTTYPE_SW_INTERRUPT != 4);
-    BUILD_BUG_ON(X86_EVENTTYPE_PRI_SW_EXCEPTION != 5);
-    BUILD_BUG_ON(X86_EVENTTYPE_SW_EXCEPTION != 6);
+    /* Check X86_ET_* against VMCB EVENTINJ and VMCS INTR_INFO type fields. */
+    BUILD_BUG_ON(X86_ET_EXT_INTR    != 0);
+    BUILD_BUG_ON(X86_ET_NMI         != 2);
+    BUILD_BUG_ON(X86_ET_HW_EXC      != 3);
+    BUILD_BUG_ON(X86_ET_SW_INT      != 4);
+    BUILD_BUG_ON(X86_ET_PRIV_SW_EXC != 5);
+    BUILD_BUG_ON(X86_ET_SW_EXC      != 6);
+    BUILD_BUG_ON(X86_ET_OTHER       != 7);
 }
 
 #ifndef NDEBUG
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.h b/xen/arch/x86/x86_emulate/x86_emulate.h
index 3e819d4174..d75658eba0 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.h
+++ b/xen/arch/x86/x86_emulate/x86_emulate.h
@@ -59,24 +59,11 @@ static inline bool is_x86_system_segment(enum x86_segment seg)
     return seg >= x86_seg_tr && seg < x86_seg_none;
 }
 
-/*
- * x86 event types. This enumeration is valid for:
- *  Intel VMX: {VM_ENTRY,VM_EXIT,IDT_VECTORING}_INTR_INFO[10:8]
- *  AMD SVM: eventinj[10:8] and exitintinfo[10:8] (types 0-4 only)
- */
-enum x86_event_type {
-    X86_EVENTTYPE_EXT_INTR,         /* External interrupt */
-    X86_EVENTTYPE_NMI = 2,          /* NMI */
-    X86_EVENTTYPE_HW_EXCEPTION,     /* Hardware exception */
-    X86_EVENTTYPE_SW_INTERRUPT,     /* Software interrupt (CD nn) */
-    X86_EVENTTYPE_PRI_SW_EXCEPTION, /* ICEBP (F1) */
-    X86_EVENTTYPE_SW_EXCEPTION,     /* INT3 (CC), INTO (CE) */
-};
 #define X86_EVENT_NO_EC (-1)        /* No error code. */
 
 struct x86_event {
     int16_t       vector;
-    uint8_t       type;         /* X86_EVENTTYPE_* */
+    uint8_t       type;         /* X86_ET_* */
     uint8_t       insn_len;     /* Instruction length */
     int32_t       error_code;   /* X86_EVENT_NO_EC if n/a */
     union {
@@ -821,7 +808,7 @@ static inline void x86_emul_hw_exception(
     ASSERT(!ctxt->event_pending);
 
     ctxt->event.vector = vector;
-    ctxt->event.type = X86_EVENTTYPE_HW_EXCEPTION;
+    ctxt->event.type = X86_ET_HW_EXC;
     ctxt->event.error_code = error_code;
 
     ctxt->event_pending = true;
@@ -833,7 +820,7 @@ static inline void x86_emul_pagefault(
     ASSERT(!ctxt->event_pending);
 
     ctxt->event.vector = X86_EXC_PF;
-    ctxt->event.type = X86_EVENTTYPE_HW_EXCEPTION;
+    ctxt->event.type = X86_ET_HW_EXC;
     ctxt->event.error_code = error_code;
     ctxt->event.cr2 = cr2;
 
diff --git a/xen/include/public/hvm/dm_op.h b/xen/include/public/hvm/dm_op.h
index fa98551914..2bf0fdc1ae 100644
--- a/xen/include/public/hvm/dm_op.h
+++ b/xen/include/public/hvm/dm_op.h
@@ -302,7 +302,7 @@ struct xen_dm_op_inject_event {
     uint8_t vector;
     /* IN - event type (DMOP_EVENT_* ) */
     uint8_t type;
-/* NB. This enumeration precisely matches hvm.h:X86_EVENTTYPE_* */
+/* NB. This enumeration precisely matches x86-defns.h:X86_ET_* */
 # define XEN_DMOP_EVENT_ext_int    0 /* external interrupt */
 # define XEN_DMOP_EVENT_nmi        2 /* nmi */
 # define XEN_DMOP_EVENT_hw_exc     3 /* hardware exception */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Oct 04 11:22:26 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 04 Oct 2024 11:22:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.810302.1223005 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swgOA-0005wf-0J; Fri, 04 Oct 2024 11:22:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 810302.1223005; Fri, 04 Oct 2024 11: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 1swgO9-0005wX-Tl; Fri, 04 Oct 2024 11:22:25 +0000
Received: by outflank-mailman (input) for mailman id 810302;
 Fri, 04 Oct 2024 11:22: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 1swgO8-0005wA-K0
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 2024 11:22: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 1swgO8-0002up-IR
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 2024 11:22:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swgO8-0002i0-H7
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 2024 11:22: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=n5zAynR5Ixa0vhSfHOHt9zPXvGKno9J3RoqYYyQr3Ww=; b=TKZMQkUDgUuQxx5Oun/EDXJUu8
	RpgVdQ8vZvgjV97UqR4T/PjMrC4SA9+1xPiIvP5cFqfJD75Oe4uUUW2jbAlspBmzVCPPXz9IRvsYg
	zNSKZdhzrPXfzS9UOi20o+th/tVUqONq//9L8anqe3rUZ/hjSJX8GRgpv7EM6I2/T0Bk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: preserve built xen.efi
Message-Id: <E1swgO8-0002i0-H7@xenbits.xenproject.org>
Date: Fri, 04 Oct 2024 11:22:24 +0000

commit 636e66b143ac1aad2f6a9c2e7166d8ba88f4559a
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Fri Oct 4 04:29:37 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 4 12:13:32 2024 +0100

    automation: preserve built xen.efi
    
    It will be useful for further tests.  Deuplicate the collection.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/scripts/build | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/automation/scripts/build b/automation/scripts/build
index b3c71fb6fb..1879c1db6d 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -41,19 +41,30 @@ cp xen/.config xen-config
 # Directory for the artefacts to be dumped into
 mkdir -p binaries
 
+collect_xen_artefacts()
+{
+    local f
+
+    for f in xen/xen xen/xen.efi; do
+        if [[ -f $f ]]; then
+            cp $f binaries/
+        fi
+    done
+}
+
 if [[ "${CPPCHECK}" == "y" ]] && [[ "${HYPERVISOR_ONLY}" == "y" ]]; then
     # Cppcheck analysis invokes Xen-only build
     xen/scripts/xen-analysis.py --run-cppcheck --cppcheck-misra -- -j$(nproc)
 
     # Preserve artefacts
-    cp xen/xen binaries/xen
+    collect_xen_artefacts
     cp xen/cppcheck-report/xen-cppcheck.txt xen-cppcheck.txt
 elif [[ "${HYPERVISOR_ONLY}" == "y" ]]; then
     # Xen-only build
     make -j$(nproc) xen
 
     # Preserve artefacts
-    cp xen/xen binaries/xen
+    collect_xen_artefacts
 else
     # Full build.  Figure out our ./configure options
     cfgargs=()
@@ -101,5 +112,5 @@ else
     # even though dist/ contains everything, while some containers don't even
     # build Xen
     cp -r dist binaries/
-    if [[ -f xen/xen ]] ; then cp xen/xen binaries/xen; fi
+    collect_xen_artefacts
 fi
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Oct 04 11:22:36 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 04 Oct 2024 11:22:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.810303.1223008 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swgOK-0005zR-1Y; Fri, 04 Oct 2024 11:22:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 810303.1223008; Fri, 04 Oct 2024 11:22: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 1swgOJ-0005zJ-VF; Fri, 04 Oct 2024 11:22:35 +0000
Received: by outflank-mailman (input) for mailman id 810303;
 Fri, 04 Oct 2024 11:22: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 1swgOI-0005z8-Mf
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 2024 11:22: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 1swgOI-0002uw-Lu
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 2024 11:22:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swgOI-0002j1-KZ
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 2024 11:22: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=O08Lhj1QKyNr9FPsi4tI3LQC27edVVG2PbNCqQenMtY=; b=l44Cl7PossO0i4nR6rJlwWDCtJ
	vNE7VmOZPia5+p5vlAk5TlIts7qAJ5kVTZDza+775nCeVFvaLVNcmGKZiqLahCVcp7CXM2OOc1uKf
	K7njxEnqI6NlHvDPhayQbtQOUs/9ABRJaQXq45zNvobeYtWUZvUl9Lhae2MHjb2JGxbE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: add a smoke test for xen.efi on X86
Message-Id: <E1swgOI-0002j1-KZ@xenbits.xenproject.org>
Date: Fri, 04 Oct 2024 11:22:34 +0000

commit 2d1c673baea563bb1af00b1e977b4ff7c213cf7f
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Fri Oct 4 04:29:38 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 4 12:13:32 2024 +0100

    automation: add a smoke test for xen.efi on X86
    
    Check if xen.efi is bootable with an XTF dom0.
    The multiboot2+EFI path is tested on hardware tests already.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/build/debian/bookworm.dockerfile |  2 ++
 automation/gitlab-ci/test.yaml              |  7 +++++
 automation/scripts/qemu-smoke-x86-64-efi.sh | 43 +++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+)

diff --git a/automation/build/debian/bookworm.dockerfile b/automation/build/debian/bookworm.dockerfile
index 3dd70cb6b2..72e01aa58b 100644
--- a/automation/build/debian/bookworm.dockerfile
+++ b/automation/build/debian/bookworm.dockerfile
@@ -46,6 +46,8 @@ RUN apt-get update && \
         # for test phase, qemu-smoke-* jobs
         qemu-system-x86 \
         expect \
+        # For *-efi jobs
+        ovmf \
         # for test phase, qemu-alpine-* jobs
         cpio \
         busybox-static \
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index e947736195..5687eaf914 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -463,6 +463,13 @@ qemu-smoke-x86-64-clang-pvh:
   needs:
     - debian-bookworm-clang-debug
 
+qemu-smoke-x86-64-gcc-efi:
+  extends: .qemu-x86-64
+  script:
+    - ./automation/scripts/qemu-smoke-x86-64-efi.sh pv 2>&1 | tee ${LOGFILE}
+  needs:
+    - debian-bookworm-gcc-debug
+
 qemu-smoke-riscv64-gcc:
   extends: .qemu-riscv64
   script:
diff --git a/automation/scripts/qemu-smoke-x86-64-efi.sh b/automation/scripts/qemu-smoke-x86-64-efi.sh
new file mode 100755
index 0000000000..7572722be6
--- /dev/null
+++ b/automation/scripts/qemu-smoke-x86-64-efi.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+set -ex -o pipefail
+
+# variant should be either pv or pvh
+variant=$1
+
+# Clone and build XTF
+git clone https://xenbits.xen.org/git-http/xtf.git
+cd xtf && make -j$(nproc) && cd -
+
+case $variant in
+    pvh) k=test-hvm64-example    extra="dom0-iommu=none dom0=pvh" ;;
+    *)   k=test-pv64-example     extra= ;;
+esac
+
+mkdir -p boot-esp/EFI/BOOT
+cp binaries/xen.efi boot-esp/EFI/BOOT/BOOTX64.EFI
+cp xtf/tests/example/$k boot-esp/EFI/BOOT/kernel
+
+cat > boot-esp/EFI/BOOT/BOOTX64.cfg <<EOF
+[global]
+default=test
+
+[test]
+options=loglvl=all console=com1 noreboot console_timestamps=boot $extra
+kernel=kernel
+EOF
+
+cp /usr/share/OVMF/OVMF_CODE.fd OVMF_CODE.fd
+cp /usr/share/OVMF/OVMF_VARS.fd OVMF_VARS.fd
+
+rm -f smoke.serial
+export TEST_CMD="qemu-system-x86_64 -nographic -M q35,kernel-irqchip=split \
+        -drive if=pflash,format=raw,readonly=on,file=OVMF_CODE.fd \
+        -drive if=pflash,format=raw,file=OVMF_VARS.fd \
+        -drive file=fat:rw:boot-esp,media=disk,index=0,format=raw \
+        -m 512 -monitor none -serial stdio"
+
+export TEST_LOG="smoke.serial"
+export PASSED="Test result: SUCCESS"
+
+./automation/scripts/console.exp | sed 's/\r\+$//'
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Oct 04 11:22:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 04 Oct 2024 11:22:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.810305.1223013 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swgOU-00062K-3A; Fri, 04 Oct 2024 11:22:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 810305.1223013; Fri, 04 Oct 2024 11:22: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 1swgOU-00062C-0T; Fri, 04 Oct 2024 11:22:46 +0000
Received: by outflank-mailman (input) for mailman id 810305;
 Fri, 04 Oct 2024 11:22: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 1swgOS-000624-PW
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 2024 11:22: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 1swgOS-0002v3-Oj
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 2024 11:22:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swgOS-0002jl-Ny
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 2024 11:22: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=RN0A0UBmjDENGMXp/CkDuvEz7BQ8JyCp404e/F/wMco=; b=Jy0aAJAgt6WBO7b8wrQ1h0q/to
	YLc2qshKHqmal18EH2e0e9WGbGGxiQwlVUlvY9LMdzPl8lMqCji8QMuXnQO0Yo8lAqvXwE3HIMZHK
	AWA4XIzo7iuJPO7Fiv5oNhsxsxbh/QEn8ULTmgVCT/SA9m5XhGfRBBzEBsk04MT00ZUQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: shorten the timeout for smoke tests
Message-Id: <E1swgOS-0002jl-Ny@xenbits.xenproject.org>
Date: Fri, 04 Oct 2024 11:22:44 +0000

commit bcce5a6b62761c8b678aebce33c55ea66f879f66
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Fri Oct 4 04:29:39 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 4 12:13:32 2024 +0100

    automation: shorten the timeout for smoke tests
    
    The smoke tests when successful complete in about 5s. Don't waste
    20min+ on failure, shorten the timeout to 120s
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/gitlab-ci/test.yaml | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 5687eaf914..b27c2be174 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -53,6 +53,11 @@
   tags:
     - x86_64
 
+.qemu-smoke-x86-64:
+  extends: .qemu-x86-64
+  variables:
+    TEST_TIMEOUT_OVERRIDE: 120
+
 .qemu-riscv64:
   extends: .test-jobs-common
   variables:
@@ -436,35 +441,35 @@ qemu-alpine-x86_64-gcc:
     - alpine-3.18-gcc
 
 qemu-smoke-x86-64-gcc:
-  extends: .qemu-x86-64
+  extends: .qemu-smoke-x86-64
   script:
     - ./automation/scripts/qemu-smoke-x86-64.sh pv 2>&1 | tee ${LOGFILE}
   needs:
     - debian-bookworm-gcc-debug
 
 qemu-smoke-x86-64-clang:
-  extends: .qemu-x86-64
+  extends: .qemu-smoke-x86-64
   script:
     - ./automation/scripts/qemu-smoke-x86-64.sh pv 2>&1 | tee ${LOGFILE}
   needs:
     - debian-bookworm-clang-debug
 
 qemu-smoke-x86-64-gcc-pvh:
-  extends: .qemu-x86-64
+  extends: .qemu-smoke-x86-64
   script:
     - ./automation/scripts/qemu-smoke-x86-64.sh pvh 2>&1 | tee ${LOGFILE}
   needs:
     - debian-bookworm-gcc-debug
 
 qemu-smoke-x86-64-clang-pvh:
-  extends: .qemu-x86-64
+  extends: .qemu-smoke-x86-64
   script:
     - ./automation/scripts/qemu-smoke-x86-64.sh pvh 2>&1 | tee ${LOGFILE}
   needs:
     - debian-bookworm-clang-debug
 
 qemu-smoke-x86-64-gcc-efi:
-  extends: .qemu-x86-64
+  extends: .qemu-smoke-x86-64
   script:
     - ./automation/scripts/qemu-smoke-x86-64-efi.sh pv 2>&1 | tee ${LOGFILE}
   needs:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Oct 04 13:44:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 04 Oct 2024 13:44:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.810448.1223171 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swibC-0001Wn-Ul; Fri, 04 Oct 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 810448.1223171; Fri, 04 Oct 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 1swibC-0001Wg-SF; Fri, 04 Oct 2024 13:44:02 +0000
Received: by outflank-mailman (input) for mailman id 810448;
 Fri, 04 Oct 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 1swibB-0001WT-MT
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 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 1swibB-0005KV-KT
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 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 1swibB-0000DN-JT
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 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=oE61RzG7yyOL77blI0DFYEGxP8ElvE/vkoeOkJTgu8Q=; b=1X3+6jRgpTgK7lvRwO3kD3+uRd
	L07gJVFuJtEnkhx0Rj9LP7nLSfZrhrqmWre9WaEj9VyZZr/vsnsA26fK98UpYNRSQutWCunHFwBRO
	kKh1U+UyOPCngwmys/jNFrpMfwulfmlsKunsgpSMBWOhhZm0BG9x5mwJgOx8MLf0u7Ls=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] stubdom: Fix newlib build with GCC-14
Message-Id: <E1swibB-0000DN-JT@xenbits.xenproject.org>
Date: Fri, 04 Oct 2024 13:44:01 +0000

commit 444cb9350f2c1cc202b6b86176ddd8e57525e2d9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Oct 2 19:01:26 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 3 10:07:25 2024 +0100

    stubdom: Fix newlib build with GCC-14
    
    Based on a fix from OpenSUSE, but adjusted to be Clang-compatible too.  Pass
    -Wno-implicit-function-declaration library-wide rather than using local GCC
    pragmas.
    
    Fix of copy_past_newline() to avoid triggering -Wstrict-prototypes.
    
    Link: https://build.opensuse.org/request/show/1178775
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 stubdom/Makefile                           |  2 ++
 stubdom/newlib-fix-copy_past_newline.patch | 10 ++++++++++
 2 files changed, 12 insertions(+)

diff --git a/stubdom/Makefile b/stubdom/Makefile
index 8c503c2bf8..f8c31fd35d 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -97,10 +97,12 @@ newlib-$(NEWLIB_VERSION): newlib-$(NEWLIB_VERSION).tar.gz
 	patch -d $@ -p1 < newlib-disable-texinfo.patch
 	patch -d $@ -p1 < newlib-cygmon-gmon.patch
 	patch -d $@ -p1 < newlib-makedoc.patch
+	patch -d $@ -p1 < newlib-fix-copy_past_newline.patch
 	find $@ -type f | xargs perl -i.bak \
 		-pe 's/\b_(tzname|daylight|timezone)\b/$$1/g'
 	touch $@
 
+NEWLIB_CFLAGS += -Wno-implicit-function-declaration
 NEWLIB_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libc.a
 .PHONY: cross-newlib
 cross-newlib: $(NEWLIB_STAMPFILE)
diff --git a/stubdom/newlib-fix-copy_past_newline.patch b/stubdom/newlib-fix-copy_past_newline.patch
new file mode 100644
index 0000000000..f8452480bc
--- /dev/null
+++ b/stubdom/newlib-fix-copy_past_newline.patch
@@ -0,0 +1,10 @@
+--- newlib-1.16.0/newlib/doc/makedoc.c.orig
++++ newlib-1.16.0/newlib/doc/makedoc.c
+@@ -798,6 +798,7 @@ DEFUN( iscommand,(ptr, idx),
+ }
+
+
++static unsigned int
+ DEFUN(copy_past_newline,(ptr, idx, dst),
+       string_type *ptr AND
+       unsigned int idx AND
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Oct 04 18:33:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 04 Oct 2024 18:33:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.810601.1223309 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swn6w-0007Tl-Aq; Fri, 04 Oct 2024 18:33:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 810601.1223309; Fri, 04 Oct 2024 18: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 1swn6w-0007Td-8I; Fri, 04 Oct 2024 18:33:06 +0000
Received: by outflank-mailman (input) for mailman id 810601;
 Fri, 04 Oct 2024 18: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 1swn6u-0007TX-7D
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 2024 18: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 1swn6u-0002Rn-0N
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 2024 18:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swn6t-0007m2-Uq
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 2024 18: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=fnbTrSM9ETQIC3EG6JnxcIO3zeIr1P6gshYcBf3MnCE=; b=f7p5/tnyKlMmyf+lNMTyj6tEh5
	u3DIKvZPNbNqzYoShLl/m6T4bkd1AD8anSEiDKS9r5Fw3whXYs3MRHVsVavgjae4NgFSh+rOdHpdA
	zEp/8OcZWVo0KBYKHl9SKg6lS8MXKrGumoxcy+ZlXR6C/JiMhkAZTeoTd0SrQRici96w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CI: Fix builds following qemu-xen update
Message-Id: <E1swn6t-0007m2-Uq@xenbits.xenproject.org>
Date: Fri, 04 Oct 2024 18:33:03 +0000

commit 1223375d8b7faf0eab642834292bf4924e40f425
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Oct 4 14:27:02 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 4 19:27:40 2024 +0100

    CI: Fix builds following qemu-xen update
    
    A recent update to qemu-xen has bumped the build requirements, with Python 3.8
    being the new baseline but also needing the 'ensurepip' and 'tomllib/tomli'
    packages.
    
     * Ubuntu/Debian package 'ensurepip' separately, but it can be obtained by
       installing the python3-venv package.
    
     * 'tomllib' was added to the python standard library in Python 3.11, but
       previously it was a separate package named 'tomli'.
    
    In terms of changes required to build QEMU:
    
     * Ubuntu 24.04 (Noble) has Python 3.12 so only needs python3-venv
    
     * Ubuntu 22.04 (Jammy) has Python 3.10 but does have a python3-tomli package
       that QEMU is happy with.
    
     * FreeBSD has Python 3.9, but Python 3.11 is available.
    
    In terms of exclusions:
    
     * Ubuntu 20.04 (Focal) has Python 3.8, but lacks any kind of tomli package.
    
     * Fedora 29 (Python 3.7), OpenSUSE Leap 15.6 (Python 3.6), and Ubuntu
       18.04/Bionic (Python 3.6) are now too old.
    
    Detecting tomllib/tomli is more than can fit in build's one-liner, so break it
    out into a proper script.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 .cirrus.yml                                     |  3 ++-
 automation/build/ubuntu/22.04-x86_64.dockerfile |  2 ++
 automation/build/ubuntu/24.04-x86_64.dockerfile |  1 +
 automation/scripts/build                        |  4 ++--
 automation/scripts/qemu-deps-check.py           | 19 +++++++++++++++++++
 5 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 1c2a6cb812..00e4c57678 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -7,10 +7,11 @@ freebsd_template: &FREEBSD_TEMPLATE
   install_script: pkg install -y seabios gmake ninja bash
                                  pkgconf python bison perl5
                                  yajl lzo2 pixman argp-standalone
-                                 libxml2 glib git
+                                 libxml2 glib git python311
 
   build_script:
     - cc --version
+    - export PYTHON=/usr/local/bin/python3.11
     - ./configure --with-system-seabios=/usr/local/share/seabios/bios.bin
     - gmake -j`sysctl -n hw.ncpu` clang=y
 
diff --git a/automation/build/ubuntu/22.04-x86_64.dockerfile b/automation/build/ubuntu/22.04-x86_64.dockerfile
index 230903f624..6aa3c4d188 100644
--- a/automation/build/ubuntu/22.04-x86_64.dockerfile
+++ b/automation/build/ubuntu/22.04-x86_64.dockerfile
@@ -62,6 +62,8 @@ RUN <<EOF
         meson
         ninja-build
         python3-packaging
+        python3-tomli
+        python3-venv
     )
 
     apt-get -y --no-install-recommends install "${DEPS[@]}"
diff --git a/automation/build/ubuntu/24.04-x86_64.dockerfile b/automation/build/ubuntu/24.04-x86_64.dockerfile
index 277f92facf..c46d152abf 100644
--- a/automation/build/ubuntu/24.04-x86_64.dockerfile
+++ b/automation/build/ubuntu/24.04-x86_64.dockerfile
@@ -62,6 +62,7 @@ RUN <<EOF
         meson
         ninja-build
         python3-packaging
+        python3-venv
     )
 
     apt-get -y --no-install-recommends install "${DEPS[@]}"
diff --git a/automation/scripts/build b/automation/scripts/build
index 1879c1db6d..34416297a4 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -91,9 +91,9 @@ else
         cfgargs+=("--with-extra-qemuu-configure-args=\"--disable-werror\"")
     fi
 
-    # Qemu requires Python 3.5 or later, and ninja
+    # Qemu requires Python 3.8 or later, and ninja
     # and Clang 10 or later
-    if ! type python3 || python3 -c "import sys; res = sys.version_info < (3, 5); exit(not(res))" \
+    if ! type python3 || ! python3 automation/scripts/qemu-deps-check.py \
             || [[ "$cc_is_clang" == y && "$cc_ver" -lt 0x0a0000 ]] \
             || ! type ninja; then
         cfgargs+=("--with-system-qemu=/bin/false")
diff --git a/automation/scripts/qemu-deps-check.py b/automation/scripts/qemu-deps-check.py
new file mode 100755
index 0000000000..f6188afb3e
--- /dev/null
+++ b/automation/scripts/qemu-deps-check.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+import sys
+
+if sys.version_info < (3, 8):
+    print("Python %d.%d.%d too old" %
+          (sys.version_info.major,
+           sys.version_info.minor,
+           sys.version_info.micro))
+    exit(1)
+
+try:
+    import tomllib
+except ImportError:
+    try:
+        import tomli
+    except ImportError:
+        print("No tomli")
+        exit(1)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Oct 04 21:33:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 04 Oct 2024 21:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.810682.1223433 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swpv7-00042Q-8n; Fri, 04 Oct 2024 21:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 810682.1223433; Fri, 04 Oct 2024 21: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 1swpv7-00042I-6E; Fri, 04 Oct 2024 21:33:05 +0000
Received: by outflank-mailman (input) for mailman id 810682;
 Fri, 04 Oct 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 1swpv6-00042C-2R
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 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 1swpv5-0005b3-O6
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 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 1swpv5-0000ZR-M3
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 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=Q2yYawUdrbWFBkLMXSj4OcNBsfdrj5tjj1bmO5cWHpw=; b=Y0oIaQinymdZ/g+7u2wlDoAnbF
	Nil7Y0K1VFqM4VgbqYuXtc3LonKSlxzeo1odmQnNW+J9I+542slSzacg78PEnLkuif2cFQkypYmVK
	8hUrX2UDANWI35Bb+g2CZ/421yT7xniYcxYHVWVCy5WDa1s/pEk/zO4+z0scolqtVh84=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] EFI: address a violation of MISRA C Rule 13.6
Message-Id: <E1swpv5-0000ZR-M3@xenbits.xenproject.org>
Date: Fri, 04 Oct 2024 21:33:03 +0000

commit 6f621f23bc3eb76fd8440d69ef4ed6bec0fb2eff
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Mon Sep 30 14:49:15 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Oct 4 14:23:15 2024 -0700

    EFI: address a violation of MISRA C Rule 13.6
    
    guest_handle_ok()'s expansion contains a sizeof() involving its
    first argument which is guest_handle_cast().
    The expansion of the latter, in turn, contains a variable
    initialization.
    
    Since MISRA considers the initialization (even of a local variable)
    a side effect, the chain of expansions mentioned above violates
    MISRA C:2012 Rule 13.6 (The operand of the `sizeof' operator shall not
    contain any expression which has potential side effect).
    
    Refactor the code to address the rule violation.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/common/efi/runtime.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c
index d03e5c90ce..acf08dcaa3 100644
--- a/xen/common/efi/runtime.c
+++ b/xen/common/efi/runtime.c
@@ -250,14 +250,20 @@ int efi_get_info(uint32_t idx, union xenpf_efi_info *info)
         info->cfg.addr = __pa(efi_ct);
         info->cfg.nent = efi_num_ct;
         break;
+
     case XEN_FW_EFI_VENDOR:
+    {
+        XEN_GUEST_HANDLE_PARAM(CHAR16) vendor_name =
+            guest_handle_cast(info->vendor.name, CHAR16);
+
         if ( !efi_fw_vendor )
             return -EOPNOTSUPP;
+
         info->vendor.revision = efi_fw_revision;
         n = info->vendor.bufsz / sizeof(*efi_fw_vendor);
-        if ( !guest_handle_okay(guest_handle_cast(info->vendor.name,
-                                                  CHAR16), n) )
+        if ( !guest_handle_okay(vendor_name, n) )
             return -EFAULT;
+
         for ( i = 0; i < n; ++i )
         {
             if ( __copy_to_guest_offset(info->vendor.name, i,
@@ -267,6 +273,8 @@ int efi_get_info(uint32_t idx, union xenpf_efi_info *info)
                 break;
         }
         break;
+    }
+
     case XEN_FW_EFI_MEM_INFO:
         for ( i = 0; i < efi_memmap_size; i += efi_mdesc_size )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Oct 04 21:33:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 04 Oct 2024 21:33:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.810683.1223437 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swpvH-00044A-B2; Fri, 04 Oct 2024 21:33:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 810683.1223437; Fri, 04 Oct 2024 21: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 1swpvH-00043y-7Y; Fri, 04 Oct 2024 21:33:15 +0000
Received: by outflank-mailman (input) for mailman id 810683;
 Fri, 04 Oct 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 1swpvF-00043o-Rw
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 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 1swpvF-0005bA-RH
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 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 1swpvF-0000a9-QD
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 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=8NIPzKxMaHnuaCQeId5FyZmzxdS4PdO1imN1mqqSXJQ=; b=xADlHac/vX1CzeA3KsS0EIfLB7
	FJx/i4YZ5kudo51XMVWyXbOwE2KVUFl87p4rGzLwWUz9SOXwhi1w1fQxClUo6fIxq4LZhEpPvdNxq
	RrCypdySsaOE0Blfn16Wn37N4Zog1WDRdBHd0D8acDL0hp8zxnm6CCOyc3JOWBug17sQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/gnttab: address a violation of MISRA C Rule 13.6
Message-Id: <E1swpvF-0000a9-QD@xenbits.xenproject.org>
Date: Fri, 04 Oct 2024 21:33:13 +0000

commit a0094dc136c35e8602f5a01a34904e4e5e2e6b19
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Mon Sep 30 14:49:16 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Oct 4 14:24:05 2024 -0700

    xen/gnttab: address a violation of MISRA C Rule 13.6
    
    guest_handle_ok()'s expansion contains a sizeof() involving its
    first argument guest_handle_cast().
    The expansion of the latter, in turn, contains a variable
    initialization.
    
    Since MISRA considers the initialization (even of a local variable)
    a side effect, the chain of expansions mentioned above violates
    MISRA C:2012 Rule 13.6 (The operand of the `sizeof' operator shall not
    contain any expression which has potential side effect).
    
    Refactor the code to address the rule violation.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/compat/grant_table.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/xen/common/compat/grant_table.c b/xen/common/compat/grant_table.c
index 5ad0debf96..bbb717bf64 100644
--- a/xen/common/compat/grant_table.c
+++ b/xen/common/compat/grant_table.c
@@ -78,12 +78,15 @@ int compat_grant_table_op(
         cmd_op = cmd;
     switch ( cmd_op )
     {
-#define CASE(name) \
-    case GNTTABOP_##name: \
-        if ( unlikely(!guest_handle_okay(guest_handle_cast(uop, \
-                                                           gnttab_##name##_compat_t), \
-                                         count)) ) \
-            rc = -EFAULT; \
+#define CASE(name)                                                  \
+    case GNTTABOP_ ## name:                                         \
+    {                                                               \
+        XEN_GUEST_HANDLE_PARAM(gnttab_ ## name ## _compat_t) h =    \
+            guest_handle_cast(uop, gnttab_ ## name ## _compat_t);   \
+                                                                    \
+        if ( unlikely(!guest_handle_okay(h, count)) )               \
+            rc = -EFAULT;                                           \
+    }                                                               \
         break
 
 #ifndef CHECK_gnttab_map_grant_ref
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Oct 04 21:33:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 04 Oct 2024 21:33:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.810684.1223441 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swpvR-00046e-Bg; Fri, 04 Oct 2024 21:33:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 810684.1223441; Fri, 04 Oct 2024 21: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 1swpvR-00046W-97; Fri, 04 Oct 2024 21:33:25 +0000
Received: by outflank-mailman (input) for mailman id 810684;
 Fri, 04 Oct 2024 21: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 1swpvP-00046J-Uy
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 2024 21:33: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 1swpvP-0005ba-UC
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 2024 21:33:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swpvP-0000bA-TJ
 for xen-changelog@lists.xenproject.org; Fri, 04 Oct 2024 21:33: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=2oo8nHaABlqeHwgz3k+pA126GFc1DC1MCD8yIL7I6s8=; b=P8ZG1o4U5PcvjPM3kVhW8sFEen
	Fpk9TxZ1VO5VF/4NdCuFNgYcSixUs7aZ12sfme5baQnSBCzrSW3BQo0PNkqSdilkJieGij0nVgFYz
	AuSisyClFoIAqbN/8a0ItW3etV0zvwsM2GqXqkWi+l+pk3Ej+MWzWiNu4d1SnhR5qFgw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation/eclair: tag Rule 13.6 as clean
Message-Id: <E1swpvP-0000bA-TJ@xenbits.xenproject.org>
Date: Fri, 04 Oct 2024 21:33:23 +0000

commit 6b20755c24ccd69d2482b45dfb9193940cdc346e
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Mon Sep 30 14:49:17 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Oct 4 14:24:58 2024 -0700

    automation/eclair: tag Rule 13.6 as clean
    
    Update ECLAIR configuration to consider Rule 13.6 as clean:
    new violations of this rule will cause a failure of the CI pipeline.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/tagging.ecl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index b8448938e6..76032b1fe1 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -60,6 +60,7 @@ MC3R1.R11.6||
 MC3R1.R11.7||
 MC3R1.R11.9||
 MC3R1.R12.5||
+MC3R1.R13.6||
 MC3R1.R14.1||
 MC3R1.R14.3||
 MC3R1.R14.4||
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Oct 05 05:55:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 05 Oct 2024 05:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.810759.1223506 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swxkt-0003tA-VY; Sat, 05 Oct 2024 05:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 810759.1223506; Sat, 05 Oct 2024 05:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swxkt-0003t2-Qs; Sat, 05 Oct 2024 05:55:03 +0000
Received: by outflank-mailman (input) for mailman id 810759;
 Sat, 05 Oct 2024 05: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 1swxks-0003su-GJ
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 05: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 1swxks-0006VV-Cp
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 05:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swxks-0002PO-Ab
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 05: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=kW9UwT+seDXmoXSLu847e32iTsGTDbJmv5Ak4qUkJZk=; b=ex37YnMr7YedaCE4cbj5TrNb5P
	E8SSn6fhYp+H+JX2fPfJZqLiaRyqNOfBeImmuGgqDT6nICi/cISkWz9648YF12pD7v66FzY9BDdHg
	6Kt4WpbzaVTzB9IsQ8d4jJGHILzYipL5lguDEOy/KIZ/e/x+OU6aa9NoJPaO4wvuTBDY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Rewrite EFI/MBI2 code partly in C
Message-Id: <E1swxks-0002PO-Ab@xenbits.xenproject.org>
Date: Sat, 05 Oct 2024 05:55:02 +0000

commit eb21ce14d709ef0c0030d0625028a4868c81126f
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Tue Oct 1 11:22:38 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 3 14:40:55 2024 +0100

    x86/boot: Rewrite EFI/MBI2 code partly in C
    
    No need to have it coded in assembly.
    Declare efi_multiboot2 in a new header to reuse between implementations
    and caller.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/arch/x86/boot/head.S       | 146 +++++++++--------------------------------
 xen/arch/x86/efi/Makefile      |   1 +
 xen/arch/x86/efi/efi-boot.h    |   7 +-
 xen/arch/x86/efi/mbi2.c        |  63 ++++++++++++++++++
 xen/arch/x86/efi/stub.c        |  10 +--
 xen/arch/x86/include/asm/efi.h |  18 +++++
 6 files changed, 120 insertions(+), 125 deletions(-)

diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 6a06f6c9ea..d1856d8012 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -130,8 +130,6 @@ multiboot2_header:
 .Lbad_cpu_msg: .asciz "ERR: Not a 64-bit CPU!"
 .Lbad_ldr_msg: .asciz "ERR: Not a Multiboot bootloader!"
 .Lbad_ldr_nbs: .asciz "ERR: Bootloader shutdown EFI x64 boot services!"
-.Lbad_ldr_nst: .asciz "ERR: EFI SystemTable is not provided by bootloader!"
-.Lbad_ldr_nih: .asciz "ERR: EFI ImageHandle is not provided by bootloader!"
 .Lbad_efi_msg: .asciz "ERR: EFI IA-32 platforms are not supported!"
 .Lbag_alg_msg: .asciz "ERR: Xen must be loaded at a 2Mb boundary!"
 .Lno_nx_msg:   .asciz "ERR: Not an NX-capable CPU!"
@@ -170,17 +168,6 @@ early_error: /* Here to improve the disassembly. */
         mov     $sym_offs(.Lno_nx_msg), %ecx
         jmp     .Lget_vtb
 #endif
-.Lmb2_no_st:
-        /*
-         * Here we are on EFI platform. vga_text_buffer was zapped earlier
-         * because there is pretty good chance that VGA is unavailable.
-         */
-        mov     $sym_offs(.Lbad_ldr_nst), %ecx
-        jmp     .Lget_vtb
-.Lmb2_no_ih:
-        /* Ditto. */
-        mov     $sym_offs(.Lbad_ldr_nih), %ecx
-        jmp     .Lget_vtb
 .Lmb2_no_bs:
         /*
          * Ditto. Additionally, here there is a chance that Xen was started
@@ -198,6 +185,10 @@ early_error: /* Here to improve the disassembly. */
         mov     $sym_offs(.Lbad_efi_msg), %ecx
         xor     %edi,%edi                       # No VGA text buffer
         jmp     .Lprint_err
+.Ldirect_error:
+        mov     sym_esi(vga_text_buffer), %edi
+        mov     %eax, %esi
+        jmp     1f
 .Lget_vtb:
         mov     sym_esi(vga_text_buffer), %edi
 .Lprint_err:
@@ -244,53 +235,49 @@ __efi64_mb2_start:
 
         /*
          * Align the stack as UEFI spec requires. Keep it aligned
-         * before efi_multiboot2() call by pushing/popping even
+         * before efi_multiboot2_prelude() call by pushing/popping even
          * numbers of items on it.
          */
         and     $~15, %rsp
 
+        /* Save magic number, we need it later but we need to use %eax. */
+        mov     %eax, %edx
+
         /*
          * Initialize BSS (no nasty surprises!).
          * It must be done earlier than in BIOS case
-         * because efi_multiboot2() touches it.
+         * because efi_multiboot2_prelude() touches it.
          */
-        mov     %eax, %edx
         lea     __bss_start(%rip), %edi
         lea     __bss_end(%rip), %ecx
         sub     %edi, %ecx
         shr     $3, %ecx
         xor     %eax, %eax
         rep stosq
-        mov     %edx, %eax
-
-        /* Check for Multiboot2 bootloader. */
-        cmp     $MULTIBOOT2_BOOTLOADER_MAGIC,%eax
-        je      .Lefi_multiboot2_proto
-
-        /* Jump to .Lnot_multiboot after switching CPU to x86_32 mode. */
-        lea     .Lnot_multiboot(%rip), %r15
-        jmp     x86_32_switch
 
-.Lefi_multiboot2_proto:
-        /* Zero EFI SystemTable, EFI ImageHandle addresses and cmdline. */
-        xor     %esi,%esi
-        xor     %edi,%edi
-        xor     %edx,%edx
-
-        /* Skip Multiboot2 information fixed part. */
-        lea     (MB2_fixed_sizeof+MULTIBOOT2_TAG_ALIGN-1)(%rbx),%ecx
-        and     $~(MULTIBOOT2_TAG_ALIGN-1),%ecx
-
-.Lefi_mb2_tsize:
-        /* Check Multiboot2 information total size. */
-        mov     %ecx,%r8d
-        sub     %ebx,%r8d
-        cmp     %r8d,MB2_fixed_total_size(%rbx)
-        jbe     .Lrun_bs
+        /*
+         * Spill MB2 magic.
+         * Spill the pointer too, to keep the stack aligned.
+         */
+        push    %rdx
+        push    %rbx
 
-        /* Are EFI boot services available? */
-        cmpl    $MULTIBOOT2_TAG_TYPE_EFI_BS,MB2_tag_type(%rcx)
-        jne     .Lefi_mb2_st
+        /*
+         * efi_multiboot2_prelude() is called according to System V AMD64 ABI:
+         *   - IN:  %edi - Multiboot2 magic,
+         *          %rsi - Multiboot2 pointer.
+         *   - OUT: %rax - error string.
+         */
+        mov     %edx, %edi
+        mov     %rbx, %rsi
+        call    efi_multiboot2_prelude
+        lea     .Ldirect_error(%rip), %r15
+        test    %rax, %rax
+        jnz     x86_32_switch
+
+        /* Restore Multiboot2 pointer and magic. */
+        pop     %rbx
+        pop     %rax
 
         /* We are on EFI platform and EFI boot services are available. */
         incb    efi_platform(%rip)
@@ -300,77 +287,6 @@ __efi64_mb2_start:
          * be run on EFI platforms.
          */
         incb    skip_realmode(%rip)
-        jmp     .Lefi_mb2_next_tag
-
-.Lefi_mb2_st:
-        /* Get EFI SystemTable address from Multiboot2 information. */
-        cmpl    $MULTIBOOT2_TAG_TYPE_EFI64,MB2_tag_type(%rcx)
-        cmove   MB2_efi64_st(%rcx),%rsi
-        je      .Lefi_mb2_next_tag
-
-        /* Get EFI ImageHandle address from Multiboot2 information. */
-        cmpl    $MULTIBOOT2_TAG_TYPE_EFI64_IH,MB2_tag_type(%rcx)
-        cmove   MB2_efi64_ih(%rcx),%rdi
-        je      .Lefi_mb2_next_tag
-
-        /* Get command line from Multiboot2 information. */
-        cmpl    $MULTIBOOT2_TAG_TYPE_CMDLINE, MB2_tag_type(%rcx)
-        jne     .Lno_cmdline
-        lea     MB2_tag_string(%rcx), %rdx
-        jmp     .Lefi_mb2_next_tag
-.Lno_cmdline:
-
-        /* Is it the end of Multiboot2 information? */
-        cmpl    $MULTIBOOT2_TAG_TYPE_END,MB2_tag_type(%rcx)
-        je      .Lrun_bs
-
-.Lefi_mb2_next_tag:
-        /* Go to next Multiboot2 information tag. */
-        add     MB2_tag_size(%rcx),%ecx
-        add     $(MULTIBOOT2_TAG_ALIGN-1),%ecx
-        and     $~(MULTIBOOT2_TAG_ALIGN-1),%ecx
-        jmp     .Lefi_mb2_tsize
-
-.Lrun_bs:
-        /* Are EFI boot services available? */
-        cmpb    $0,efi_platform(%rip)
-
-        /* Jump to .Lmb2_no_bs after switching CPU to x86_32 mode. */
-        lea     .Lmb2_no_bs(%rip),%r15
-        jz      x86_32_switch
-
-        /* Is EFI SystemTable address provided by boot loader? */
-        test    %rsi,%rsi
-
-        /* Jump to .Lmb2_no_st after switching CPU to x86_32 mode. */
-        lea     .Lmb2_no_st(%rip),%r15
-        jz      x86_32_switch
-
-        /* Is EFI ImageHandle address provided by boot loader? */
-        test    %rdi,%rdi
-
-        /* Jump to .Lmb2_no_ih after switching CPU to x86_32 mode. */
-        lea     .Lmb2_no_ih(%rip),%r15
-        jz      x86_32_switch
-
-        /* Save Multiboot2 magic on the stack. */
-        push    %rax
-
-        /* Save EFI ImageHandle on the stack. */
-        push    %rdi
-
-        /*
-         * efi_multiboot2() is called according to System V AMD64 ABI:
-         *   - IN:  %rdi - EFI ImageHandle, %rsi - EFI SystemTable,
-         *          %rdx - MB2 cmdline
-         */
-        call    efi_multiboot2
-
-        /* Just pop an item from the stack. */
-        pop     %rax
-
-        /* Restore Multiboot2 magic. */
-        pop     %rax
 
         /* Jump to trampoline_setup after switching CPU to x86_32 mode. */
         lea     trampoline_setup(%rip),%r15
diff --git a/xen/arch/x86/efi/Makefile b/xen/arch/x86/efi/Makefile
index 24dfecfad1..7e2b5c07de 100644
--- a/xen/arch/x86/efi/Makefile
+++ b/xen/arch/x86/efi/Makefile
@@ -14,5 +14,6 @@ $(addprefix $(obj)/,$(EFIOBJ-y)): CFLAGS_stack_boundary := $(cflags-stack-bounda
 obj-y := common-stub.o stub.o
 obj-$(XEN_BUILD_EFI) := $(filter-out %.init.o,$(EFIOBJ-y))
 obj-bin-$(XEN_BUILD_EFI) := $(filter %.init.o,$(EFIOBJ-y))
+obj-bin-y += mbi2.o
 extra-$(XEN_BUILD_EFI) += buildid.o relocs-dummy.o
 nocov-$(XEN_BUILD_EFI) += stub.o
diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index 7aa55e7aaf..94f3443364 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -10,6 +10,7 @@
 #include <asm/msr.h>
 #include <asm/setup.h>
 #include <asm/trampoline.h>
+#include <asm/efi.h>
 
 static struct file __initdata ucode;
 static multiboot_info_t __initdata mbi = {
@@ -816,9 +817,9 @@ static const char *__init get_option(const char *cmd, const char *opt)
     return o;
 }
 
-void asmlinkage __init efi_multiboot2(EFI_HANDLE ImageHandle,
-                                      EFI_SYSTEM_TABLE *SystemTable,
-                                      const char *cmdline)
+void __init efi_multiboot2(EFI_HANDLE ImageHandle,
+                           EFI_SYSTEM_TABLE *SystemTable,
+                           const char *cmdline)
 {
     EFI_GRAPHICS_OUTPUT_PROTOCOL *gop;
     EFI_HANDLE gop_handle;
diff --git a/xen/arch/x86/efi/mbi2.c b/xen/arch/x86/efi/mbi2.c
new file mode 100644
index 0000000000..55a1777483
--- /dev/null
+++ b/xen/arch/x86/efi/mbi2.c
@@ -0,0 +1,63 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <xen/efi.h>
+#include <xen/init.h>
+#include <xen/multiboot2.h>
+#include <asm/asm_defns.h>
+#include <asm/efi.h>
+
+const char * asmlinkage __init
+efi_multiboot2_prelude(uint32_t magic, const multiboot2_fixed_t *mbi)
+{
+    const multiboot2_tag_t *tag;
+    EFI_HANDLE ImageHandle = NULL;
+    EFI_SYSTEM_TABLE *SystemTable = NULL;
+    const char *cmdline = NULL;
+    bool have_bs = false;
+
+    if ( magic != MULTIBOOT2_BOOTLOADER_MAGIC )
+        return "ERR: Not a Multiboot2 bootloader!";
+
+    /* Skip Multiboot2 information fixed part. */
+    tag = _p(ROUNDUP((unsigned long)(mbi + 1), MULTIBOOT2_TAG_ALIGN));
+
+    for ( ; (const void *)tag - (const void *)mbi < mbi->total_size &&
+            tag->type != MULTIBOOT2_TAG_TYPE_END;
+          tag = _p(ROUNDUP((unsigned long)tag + tag->size,
+                   MULTIBOOT2_TAG_ALIGN)) )
+    {
+        switch ( tag->type )
+        {
+        case MULTIBOOT2_TAG_TYPE_EFI_BS:
+            have_bs = true;
+            break;
+
+        case MULTIBOOT2_TAG_TYPE_EFI64:
+            SystemTable = _p(((const multiboot2_tag_efi64_t *)tag)->pointer);
+            break;
+
+        case MULTIBOOT2_TAG_TYPE_EFI64_IH:
+            ImageHandle = _p(((const multiboot2_tag_efi64_ih_t *)tag)->pointer);
+            break;
+
+        case MULTIBOOT2_TAG_TYPE_CMDLINE:
+            cmdline = ((const multiboot2_tag_string_t *)tag)->string;
+            break;
+
+        default:
+            /* Satisfy MISRA requirement. */
+            break;
+        }
+    }
+
+    if ( !have_bs )
+        return "ERR: Bootloader shutdown EFI x64 boot services!";
+    if ( !SystemTable )
+        return "ERR: EFI SystemTable is not provided by bootloader!";
+    if ( !ImageHandle )
+        return "ERR: EFI ImageHandle is not provided by bootloader!";
+
+    efi_multiboot2(ImageHandle, SystemTable, cmdline);
+
+    return NULL;
+}
diff --git a/xen/arch/x86/efi/stub.c b/xen/arch/x86/efi/stub.c
index 2cd5c8d4dc..7d824151a7 100644
--- a/xen/arch/x86/efi/stub.c
+++ b/xen/arch/x86/efi/stub.c
@@ -1,13 +1,8 @@
 #include <xen/efi.h>
 #include <xen/init.h>
 #include <asm/asm_defns.h>
-#include <asm/efibind.h>
+#include <asm/efi.h>
 #include <asm/page.h>
-#include <efi/efidef.h>
-#include <efi/eficapsule.h>
-#include <efi/eficon.h>
-#include <efi/efidevp.h>
-#include <efi/efiapi.h>
 
 /*
  * Here we are in EFI stub. EFI calls are not supported due to lack
@@ -17,7 +12,8 @@
  */
 
 void __init noreturn efi_multiboot2(EFI_HANDLE ImageHandle,
-                                    EFI_SYSTEM_TABLE *SystemTable)
+                                    EFI_SYSTEM_TABLE *SystemTable,
+                                    const char *cmdline)
 {
     static const CHAR16 __initconst err[] =
         L"Xen does not have EFI code build in!\r\nSystem halted!\r\n";
diff --git a/xen/arch/x86/include/asm/efi.h b/xen/arch/x86/include/asm/efi.h
new file mode 100644
index 0000000000..575a33e302
--- /dev/null
+++ b/xen/arch/x86/include/asm/efi.h
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef X86_ASM_EFI_H
+#define X86_ASM_EFI_H
+
+#include <xen/types.h>
+#include <asm/x86_64/efibind.h>
+#include <efi/efidef.h>
+#include <efi/eficapsule.h>
+#include <efi/eficon.h>
+#include <efi/efidevp.h>
+#include <efi/efiapi.h>
+
+void efi_multiboot2(EFI_HANDLE ImageHandle,
+                    EFI_SYSTEM_TABLE *SystemTable,
+                    const char *cmdline);
+
+#endif /* X86_ASM_EFI_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Oct 05 05:55:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 05 Oct 2024 05:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.810761.1223509 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swxl4-0003vk-10; Sat, 05 Oct 2024 05:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 810761.1223509; Sat, 05 Oct 2024 05:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swxl3-0003vV-UK; Sat, 05 Oct 2024 05:55:13 +0000
Received: by outflank-mailman (input) for mailman id 810761;
 Sat, 05 Oct 2024 05: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 1swxl2-0003vP-Ih
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 05: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 1swxl2-0006Ve-Hs
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 05:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swxl2-0002Q8-FR
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 05:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pmSh9AZSVDGJTP+HrS/WmhwnPtbJFv2YPj5BzWihDQU=; b=D6kw4R3UENYeFU03eI6M093g2S
	MRjkHqA3xaNL0ED8Vdcc+6wC2++DGvw9nEKtGyZx+7NfHUAEWuhduSPPAdS/U5LE3TIAThkDiDVYT
	H/eb0HJCZ58IAhX2sj7w0vL4CfteHN0kTAOEQLCv4smCn87KS+7a0/S8HaD766c+gmr0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: move per-cpu area management into common code
Message-Id: <E1swxl2-0002Q8-FR@xenbits.xenproject.org>
Date: Sat, 05 Oct 2024 05:55:12 +0000

commit f75780d26b2f0e66bb1f3b3c82c50d46f11fda19
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Oct 3 16:08:55 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 3 18:07:36 2024 +0100

    xen: move per-cpu area management into common code
    
    Centralize per-cpu area management to reduce code duplication and
    enhance maintainability across architectures.
    
    The per-cpu area management code, which is largely common among
    architectures, is moved to a shared implementation in
    xen/common/percpu.c. This change includes:
     * Remove percpu.c from the X86 and Arm architectures.
     * For x86, define INVALID_PERCPU_AREAS and PARK_OFFLINE_CPUS_VAR.
     * Drop the declaration of __per_cpu_offset[] from stubs.c in
       PPC and RISC-V to facilitate the build of the common per-cpu code.
    
    No functional changes for x86.
    
    For Arm add support of CPU_RESUME_FAILED, CPU_REMOVE and freeing of
    percpu in the case when system_state != SYS_STATE_suspend, however,
    there is no change in behavior for Arm at this time.
    
    Move the asm-generic/percpu.h definitions to xen/percpu.h, except for
    __per_cpu_start[] and __per_cpu_data_end[], which are moved to
    common/percpu.c as they are only used in common/percpu.c.
    
    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/Makefile             |   1 -
 xen/arch/arm/include/asm/smp.h    |   7 +--
 xen/arch/arm/percpu.c             |  85 ---------------------------
 xen/arch/ppc/include/asm/smp.h    |   6 --
 xen/arch/ppc/stubs.c              |   1 -
 xen/arch/riscv/include/asm/smp.h  |   6 --
 xen/arch/riscv/stubs.c            |   1 -
 xen/arch/x86/Makefile             |   1 -
 xen/arch/x86/include/asm/Makefile |   1 -
 xen/arch/x86/include/asm/percpu.h |  14 +++++
 xen/arch/x86/percpu.c             | 112 -----------------------------------
 xen/common/Makefile               |   1 +
 xen/common/percpu.c               | 119 ++++++++++++++++++++++++++++++++++++++
 xen/include/asm-generic/percpu.h  |  23 --------
 xen/include/xen/percpu.h          |  30 ++++++++++
 15 files changed, 165 insertions(+), 243 deletions(-)

diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 7792bff597..e4ad1ce851 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -39,7 +39,6 @@ obj-$(CONFIG_MEM_ACCESS) += mem_access.o
 obj-y += mm.o
 obj-y += monitor.o
 obj-y += p2m.o
-obj-y += percpu.o
 obj-y += platform.o
 obj-y += platform_hypercall.o
 obj-y += physdev.o
diff --git a/xen/arch/arm/include/asm/smp.h b/xen/arch/arm/include/asm/smp.h
index e99a3a3f53..8f765ed12a 100644
--- a/xen/arch/arm/include/asm/smp.h
+++ b/xen/arch/arm/include/asm/smp.h
@@ -2,6 +2,7 @@
 #define __ASM_SMP_H
 
 #ifndef __ASSEMBLY__
+#include <xen/percpu.h>
 #include <xen/cpumask.h>
 #include <asm/current.h>
 #endif
@@ -12,12 +13,6 @@ extern unsigned long smp_up_cpu;
 DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_mask);
 DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
 
-/*
- * Do we, for platform reasons, need to actually keep CPUs online when we
- * would otherwise prefer them to be off?
- */
-#define park_offline_cpus false
-
 extern void noreturn stop_cpu(void);
 
 extern int arch_smp_init(void);
diff --git a/xen/arch/arm/percpu.c b/xen/arch/arm/percpu.c
deleted file mode 100644
index 87fe960330..0000000000
--- a/xen/arch/arm/percpu.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#include <xen/percpu.h>
-#include <xen/cpu.h>
-#include <xen/init.h>
-#include <xen/mm.h>
-#include <xen/rcupdate.h>
-
-unsigned long __per_cpu_offset[NR_CPUS];
-#define INVALID_PERCPU_AREA (-(long)__per_cpu_start)
-#define PERCPU_ORDER (get_order_from_bytes(__per_cpu_data_end-__per_cpu_start))
-
-void __init percpu_init_areas(void)
-{
-    unsigned int cpu;
-    for ( cpu = 1; cpu < NR_CPUS; cpu++ )
-        __per_cpu_offset[cpu] = INVALID_PERCPU_AREA;
-}
-
-static int init_percpu_area(unsigned int cpu)
-{
-    char *p;
-    if ( __per_cpu_offset[cpu] != INVALID_PERCPU_AREA )
-        return -EBUSY;
-    if ( (p = alloc_xenheap_pages(PERCPU_ORDER, 0)) == NULL )
-        return -ENOMEM;
-    memset(p, 0, __per_cpu_data_end - __per_cpu_start);
-    __per_cpu_offset[cpu] = p - __per_cpu_start;
-    return 0;
-}
-
-struct free_info {
-    unsigned int cpu;
-    struct rcu_head rcu;
-};
-static DEFINE_PER_CPU(struct free_info, free_info);
-
-static void _free_percpu_area(struct rcu_head *head)
-{
-    struct free_info *info = container_of(head, struct free_info, rcu);
-    unsigned int cpu = info->cpu;
-    char *p = __per_cpu_start + __per_cpu_offset[cpu];
-    free_xenheap_pages(p, PERCPU_ORDER);
-    __per_cpu_offset[cpu] = INVALID_PERCPU_AREA;
-}
-
-static void free_percpu_area(unsigned int cpu)
-{
-    struct free_info *info = &per_cpu(free_info, cpu);
-    info->cpu = cpu;
-    call_rcu(&info->rcu, _free_percpu_area);
-}
-
-static int cpu_percpu_callback(
-    struct notifier_block *nfb, unsigned long action, void *hcpu)
-{
-    unsigned int cpu = (unsigned long)hcpu;
-    int rc = 0;
-
-    switch ( action )
-    {
-    case CPU_UP_PREPARE:
-        rc = init_percpu_area(cpu);
-        break;
-    case CPU_UP_CANCELED:
-    case CPU_DEAD:
-        free_percpu_area(cpu);
-        break;
-    default:
-        break;
-    }
-
-    return notifier_from_errno(rc);
-}
-
-static struct notifier_block cpu_percpu_nfb = {
-    .notifier_call = cpu_percpu_callback,
-    .priority = 100 /* highest priority */
-};
-
-static int __init percpu_presmp_init(void)
-{
-    register_cpu_notifier(&cpu_percpu_nfb);
-    return 0;
-}
-presmp_initcall(percpu_presmp_init);
diff --git a/xen/arch/ppc/include/asm/smp.h b/xen/arch/ppc/include/asm/smp.h
index 7b1517ce18..2b872218be 100644
--- a/xen/arch/ppc/include/asm/smp.h
+++ b/xen/arch/ppc/include/asm/smp.h
@@ -7,10 +7,4 @@
 DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_mask);
 DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
 
-/*
- * Do we, for platform reasons, need to actually keep CPUs online when we
- * would otherwise prefer them to be off?
- */
-#define park_offline_cpus false
-
 #endif
diff --git a/xen/arch/ppc/stubs.c b/xen/arch/ppc/stubs.c
index bdb5f8c66d..fff82f5cf3 100644
--- a/xen/arch/ppc/stubs.c
+++ b/xen/arch/ppc/stubs.c
@@ -141,7 +141,6 @@ void smp_send_state_dump(unsigned int cpu)
 /* 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)
 {
diff --git a/xen/arch/riscv/include/asm/smp.h b/xen/arch/riscv/include/asm/smp.h
index a824be8e78..092b101ff4 100644
--- a/xen/arch/riscv/include/asm/smp.h
+++ b/xen/arch/riscv/include/asm/smp.h
@@ -10,12 +10,6 @@
 DECLARE_PER_CPU(cpumask_var_t, cpu_sibling_mask);
 DECLARE_PER_CPU(cpumask_var_t, cpu_core_mask);
 
-/*
- * Do we, for platform reasons, need to actually keep CPUs online when we
- * would otherwise prefer them to be off?
- */
-#define park_offline_cpus false
-
 /*
  * Mapping between Xen logical cpu index and hartid.
  */
diff --git a/xen/arch/riscv/stubs.c b/xen/arch/riscv/stubs.c
index 2aa245f272..5951b0ce91 100644
--- a/xen/arch/riscv/stubs.c
+++ b/xen/arch/riscv/stubs.c
@@ -133,7 +133,6 @@ void smp_send_state_dump(unsigned int cpu)
 /* 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)
 {
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index 1fa12ed4aa..b35fd5196c 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -54,7 +54,6 @@ obj-y += mpparse.o
 obj-y += nmi.o
 obj-y += numa.o
 obj-y += pci.o
-obj-y += percpu.o
 obj-y += physdev.o
 obj-$(CONFIG_COMPAT) += x86_64/physdev.o
 obj-$(CONFIG_X86_PSR) += psr.o
diff --git a/xen/arch/x86/include/asm/Makefile b/xen/arch/x86/include/asm/Makefile
index daab34ff0a..2c27787d31 100644
--- a/xen/arch/x86/include/asm/Makefile
+++ b/xen/arch/x86/include/asm/Makefile
@@ -1,3 +1,2 @@
 # SPDX-License-Identifier: GPL-2.0-only
 generic-y += div64.h
-generic-y += percpu.h
diff --git a/xen/arch/x86/include/asm/percpu.h b/xen/arch/x86/include/asm/percpu.h
new file mode 100644
index 0000000000..34f589f990
--- /dev/null
+++ b/xen/arch/x86/include/asm/percpu.h
@@ -0,0 +1,14 @@
+#ifndef __X86_PERCPU_H__
+#define __X86_PERCPU_H__
+
+#define PARK_OFFLINE_CPUS_VAR
+
+/*
+ * Force uses of per_cpu() with an invalid area to attempt to access the
+ * middle of the non-canonical address space resulting in a #GP, rather than a
+ * possible #PF at (NULL + a little) which has security implications in the
+ * context of PV guests.
+ */
+#define INVALID_PERCPU_AREA (0x8000000000000000UL - (unsigned long)__per_cpu_start)
+
+#endif /* __X86_PERCPU_H__ */
diff --git a/xen/arch/x86/percpu.c b/xen/arch/x86/percpu.c
deleted file mode 100644
index 3205eacea6..0000000000
--- a/xen/arch/x86/percpu.c
+++ /dev/null
@@ -1,112 +0,0 @@
-#include <xen/percpu.h>
-#include <xen/cpu.h>
-#include <xen/init.h>
-#include <xen/mm.h>
-#include <xen/rcupdate.h>
-
-unsigned long __per_cpu_offset[NR_CPUS];
-
-/*
- * Force uses of per_cpu() with an invalid area to attempt to access the
- * middle of the non-canonical address space resulting in a #GP, rather than a
- * possible #PF at (NULL + a little) which has security implications in the
- * context of PV guests.
- */
-#define INVALID_PERCPU_AREA (0x8000000000000000UL - (unsigned long)__per_cpu_start)
-#define PERCPU_ORDER get_order_from_bytes(__per_cpu_data_end - __per_cpu_start)
-
-void __init percpu_init_areas(void)
-{
-    unsigned int cpu;
-
-    for ( cpu = 1; cpu < NR_CPUS; cpu++ )
-        __per_cpu_offset[cpu] = INVALID_PERCPU_AREA;
-}
-
-static int init_percpu_area(unsigned int cpu)
-{
-    char *p;
-
-    if ( __per_cpu_offset[cpu] != INVALID_PERCPU_AREA )
-        return 0;
-
-    if ( (p = alloc_xenheap_pages(PERCPU_ORDER, 0)) == NULL )
-        return -ENOMEM;
-
-    memset(p, 0, __per_cpu_data_end - __per_cpu_start);
-    __per_cpu_offset[cpu] = p - __per_cpu_start;
-
-    return 0;
-}
-
-struct free_info {
-    unsigned int cpu;
-    struct rcu_head rcu;
-};
-static DEFINE_PER_CPU(struct free_info, free_info);
-
-static void cf_check _free_percpu_area(struct rcu_head *head)
-{
-    struct free_info *info = container_of(head, struct free_info, rcu);
-    unsigned int cpu = info->cpu;
-    char *p = __per_cpu_start + __per_cpu_offset[cpu];
-
-    free_xenheap_pages(p, PERCPU_ORDER);
-    __per_cpu_offset[cpu] = INVALID_PERCPU_AREA;
-}
-
-static void free_percpu_area(unsigned int cpu)
-{
-    struct free_info *info = &per_cpu(free_info, cpu);
-
-    info->cpu = cpu;
-    call_rcu(&info->rcu, _free_percpu_area);
-}
-
-static int cf_check cpu_percpu_callback(
-    struct notifier_block *nfb, unsigned long action, void *hcpu)
-{
-    unsigned int cpu = (unsigned long)hcpu;
-    int rc = 0;
-
-    switch ( action )
-    {
-    case CPU_UP_PREPARE:
-        rc = init_percpu_area(cpu);
-        break;
-    case CPU_UP_CANCELED:
-    case CPU_DEAD:
-    case CPU_RESUME_FAILED:
-        if ( !park_offline_cpus && system_state != SYS_STATE_suspend )
-            free_percpu_area(cpu);
-        break;
-    case CPU_REMOVE:
-        if ( park_offline_cpus )
-            free_percpu_area(cpu);
-        break;
-    }
-
-    return notifier_from_errno(rc);
-}
-
-static struct notifier_block cpu_percpu_nfb = {
-    .notifier_call = cpu_percpu_callback,
-    .priority = 100 /* highest priority */
-};
-
-static int __init cf_check percpu_presmp_init(void)
-{
-    register_cpu_notifier(&cpu_percpu_nfb);
-
-    return 0;
-}
-presmp_initcall(percpu_presmp_init);
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/xen/common/Makefile b/xen/common/Makefile
index fc52e0857d..f90bb00d23 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -31,6 +31,7 @@ obj-y += notifier.o
 obj-$(CONFIG_NUMA) += numa.o
 obj-y += page_alloc.o
 obj-y += pdx.o
+obj-y += percpu.o
 obj-$(CONFIG_PERF_COUNTERS) += perfc.o
 obj-bin-$(CONFIG_HAS_PMAP) += pmap.init.o
 obj-y += preempt.o
diff --git a/xen/common/percpu.c b/xen/common/percpu.c
new file mode 100644
index 0000000000..e4e8b7bcab
--- /dev/null
+++ b/xen/common/percpu.c
@@ -0,0 +1,119 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#include <xen/percpu.h>
+#include <xen/cpu.h>
+#include <xen/init.h>
+#include <xen/mm.h>
+#include <xen/rcupdate.h>
+#include <xen/sections.h>
+
+#ifndef INVALID_PERCPU_AREA
+#define INVALID_PERCPU_AREA (-(long)__per_cpu_start)
+#endif
+
+#define PERCPU_ORDER get_order_from_bytes(__per_cpu_data_end - __per_cpu_start)
+
+extern char __per_cpu_start[];
+extern const char __per_cpu_data_end[];
+
+unsigned long __read_mostly __per_cpu_offset[NR_CPUS];
+
+void __init percpu_init_areas(void)
+{
+    unsigned int cpu;
+
+    for ( cpu = 1; cpu < NR_CPUS; cpu++ )
+        __per_cpu_offset[cpu] = INVALID_PERCPU_AREA;
+}
+
+static int init_percpu_area(unsigned int cpu)
+{
+    char *p;
+
+    if ( __per_cpu_offset[cpu] != INVALID_PERCPU_AREA )
+        return park_offline_cpus ? 0 : -EBUSY;
+
+    if ( (p = alloc_xenheap_pages(PERCPU_ORDER, 0)) == NULL )
+        return -ENOMEM;
+
+    memset(p, 0, __per_cpu_data_end - __per_cpu_start);
+    __per_cpu_offset[cpu] = p - __per_cpu_start;
+
+    return 0;
+}
+
+struct free_info {
+    unsigned int cpu;
+    struct rcu_head rcu;
+};
+static DEFINE_PER_CPU(struct free_info, free_info);
+
+static void cf_check _free_percpu_area(struct rcu_head *head)
+{
+    struct free_info *info = container_of(head, struct free_info, rcu);
+    unsigned int cpu = info->cpu;
+    char *p = __per_cpu_start + __per_cpu_offset[cpu];
+
+    free_xenheap_pages(p, PERCPU_ORDER);
+    __per_cpu_offset[cpu] = INVALID_PERCPU_AREA;
+}
+
+static void free_percpu_area(unsigned int cpu)
+{
+    struct free_info *info = &per_cpu(free_info, cpu);
+
+    info->cpu = cpu;
+    call_rcu(&info->rcu, _free_percpu_area);
+}
+
+static int cf_check cpu_percpu_callback(
+    struct notifier_block *nfb, unsigned long action, void *hcpu)
+{
+    unsigned int cpu = (unsigned long)hcpu;
+    int rc = 0;
+
+    switch ( action )
+    {
+    case CPU_UP_PREPARE:
+        rc = init_percpu_area(cpu);
+        break;
+
+    case CPU_UP_CANCELED:
+    case CPU_DEAD:
+    case CPU_RESUME_FAILED:
+        if ( !park_offline_cpus && system_state != SYS_STATE_suspend )
+            free_percpu_area(cpu);
+        break;
+
+    case CPU_REMOVE:
+        if ( park_offline_cpus )
+            free_percpu_area(cpu);
+        break;
+
+    default:
+        break;
+    }
+
+    return notifier_from_errno(rc);
+}
+
+static struct notifier_block cpu_percpu_nfb = {
+    .notifier_call = cpu_percpu_callback,
+    .priority = 100 /* highest priority */
+};
+
+static int __init cf_check percpu_presmp_init(void)
+{
+    register_cpu_notifier(&cpu_percpu_nfb);
+
+    return 0;
+}
+presmp_initcall(percpu_presmp_init);
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/include/asm-generic/percpu.h b/xen/include/asm-generic/percpu.h
index 60af4f9ff9..3fdb3a2a02 100644
--- a/xen/include/asm-generic/percpu.h
+++ b/xen/include/asm-generic/percpu.h
@@ -2,29 +2,6 @@
 #ifndef __ASM_GENERIC_PERCPU_H__
 #define __ASM_GENERIC_PERCPU_H__
 
-#ifndef __ASSEMBLY__
-
-#include <xen/types.h>
-#include <asm/current.h>
-
-extern char __per_cpu_start[];
-extern const char __per_cpu_data_end[];
-extern unsigned long __per_cpu_offset[NR_CPUS];
-void percpu_init_areas(void);
-
-#define per_cpu(var, cpu)  \
-    (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
-
-#define this_cpu(var) \
-    (*RELOC_HIDE(&per_cpu__##var, get_per_cpu_offset()))
-
-#define per_cpu_ptr(var, cpu)  \
-    (*RELOC_HIDE(var, __per_cpu_offset[cpu]))
-#define this_cpu_ptr(var) \
-    (*RELOC_HIDE(var, get_per_cpu_offset()))
-
-#endif
-
 #endif /* __ASM_GENERIC_PERCPU_H__ */
 
 /*
diff --git a/xen/include/xen/percpu.h b/xen/include/xen/percpu.h
index 57522f346b..e7f585c7ed 100644
--- a/xen/include/xen/percpu.h
+++ b/xen/include/xen/percpu.h
@@ -29,6 +29,36 @@
 
 #include <asm/percpu.h>
 
+#ifndef __ASSEMBLY__
+
+#include <xen/types.h>
+#include <asm/current.h>
+
+#ifndef PARK_OFFLINE_CPUS_VAR
+/*
+ * Do we, for platform reasons, need to actually keep CPUs online when we
+ * would otherwise prefer them to be off?
+ */
+#define park_offline_cpus false
+#endif
+
+extern unsigned long __per_cpu_offset[];
+
+#define per_cpu(var, cpu)  \
+    (*RELOC_HIDE(&per_cpu__##var, __per_cpu_offset[cpu]))
+
+#define this_cpu(var) \
+    (*RELOC_HIDE(&per_cpu__##var, get_per_cpu_offset()))
+
+#define per_cpu_ptr(var, cpu)  \
+    (*RELOC_HIDE(var, __per_cpu_offset[cpu]))
+#define this_cpu_ptr(var) \
+    (*RELOC_HIDE(var, get_per_cpu_offset()))
+
+void percpu_init_areas(void);
+
+#endif /* __ASSEMBLY__ */
+
 /* Linux compatibility. */
 #define get_cpu_var(var) this_cpu(var)
 #define put_cpu_var(var)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Oct 05 05:55:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 05 Oct 2024 05:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.810762.1223513 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swxlE-0003yF-2j; Sat, 05 Oct 2024 05:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 810762.1223513; Sat, 05 Oct 2024 05:55:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swxlD-0003y8-Vz; Sat, 05 Oct 2024 05:55:23 +0000
Received: by outflank-mailman (input) for mailman id 810762;
 Sat, 05 Oct 2024 05: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 1swxlC-0003xl-Mz
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 05: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 1swxlC-0006Vs-L6
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 05:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swxlC-0002Qj-Jx
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 05:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=03rWgBLc1dX7OOfrQzHA8YLZ2ntrzyQNuShuVAyiW9Y=; b=FRKZxhHhrzz0Rk1FdBrHp0jJ0n
	16jgmeyAOkeKAHT2cICHydXRvStQPMh0/yCfetDOzpy8S2itcVbpF0a5YSE/H9iajZ+G5HZJ38VQR
	UJ6UG36ryvvWEo9Ed8rX2PzqaMvQlnjbd8nV8CgrvzvxgxxOkx8xsAtBG/ShkoWhsqVs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Don't use INC to set defaults
Message-Id: <E1swxlC-0002Qj-Jx@xenbits.xenproject.org>
Date: Sat, 05 Oct 2024 05:55:22 +0000

commit 163338e6fbec2c549d55782e1ae4cf238b793f4a
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Oct 3 15:03:38 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 3 18:07:36 2024 +0100

    x86/boot: Don't use INC to set defaults
    
    __efi64_mb2_start() makes some bold assumptions about the efi_platform and
    skip_realmode booleans.  Set them to 1 explicitly, which is more robust.
    
    Make the comment a little more concise.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/boot/head.S | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index d1856d8012..af776c201a 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -279,14 +279,12 @@ __efi64_mb2_start:
         pop     %rbx
         pop     %rax
 
-        /* We are on EFI platform and EFI boot services are available. */
-        incb    efi_platform(%rip)
-
         /*
-         * Disable real mode and other legacy stuff which should not
-         * be run on EFI platforms.
+         * efi_multiboot2_prelude() is happy that we're on EFI platform.  Skip
+         * the BIOS initialisation path.
          */
-        incb    skip_realmode(%rip)
+        movb    $1, efi_platform(%rip)
+        movb    $1, skip_realmode(%rip)
 
         /* Jump to trampoline_setup after switching CPU to x86_32 mode. */
         lea     trampoline_setup(%rip),%r15
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Oct 05 05:55:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 05 Oct 2024 05:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.810763.1223516 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swxlO-000412-46; Sat, 05 Oct 2024 05:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 810763.1223516; Sat, 05 Oct 2024 05:55:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1swxlO-00040v-1b; Sat, 05 Oct 2024 05:55:34 +0000
Received: by outflank-mailman (input) for mailman id 810763;
 Sat, 05 Oct 2024 05: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 1swxlM-00040l-QH
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 05: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 1swxlM-0006WF-PU
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 05:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1swxlM-0002RU-NL
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 05:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gSb6diMCbChih/vsnq7qa8i5Kqu1DXcPSD3Ikyj73HU=; b=LXE9LXpUnoiuYgqkNweIrYdxsj
	tp/NoPSjY+ujcUO/8t/8BY2njMY8IsDUQXWQDPFSoy68+w1kYC7CXvMKl0CQ0DXN6/ZBq1encEV8+
	R9sQQGjqy2Ea+q8mbdbYHQMxBkyQlCm6wTgXRsKI8Fil84wMTOO9Xueae+3TAD2NiqDM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: introduce TEST_TIMEOUT_OVERRIDE
Message-Id: <E1swxlM-0002RU-NL@xenbits.xenproject.org>
Date: Sat, 05 Oct 2024 05:55:32 +0000

commit d82e0e094e7a07353ba0fb35732724316c2ec2f6
Author:     Stefano Stabellini <sstabellini@kernel.org>
AuthorDate: Thu Oct 3 13:22:51 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Thu Oct 3 17:32:58 2024 -0700

    automation: introduce TEST_TIMEOUT_OVERRIDE
    
    TEST_TIMEOUT is set as a CI/CD project variable, as it should be, to
    match the capability and speed of the testing infrastructure.
    
    As it turns out, TEST_TIMEOUT defined in test.yaml cannot override
    TEST_TIMEOUT defined as CI/CD project variable. As a consequence, today
    the TEST_TIMEOUT setting in test.yaml for the Xilinx jobs is ignored.
    
    Instead, rename TEST_TIMEOUT to TEST_TIMEOUT_OVERRIDE in test.yaml and
    check for TEST_TIMEOUT_OVERRIDE first in console.exp.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 automation/gitlab-ci/test.yaml | 4 ++--
 automation/scripts/console.exp | 4 +++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 8675016b6a..e947736195 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -84,7 +84,7 @@
   variables:
     CONTAINER: ubuntu:xenial-xilinx
     LOGFILE: qemu-smoke-xilinx.log
-    TEST_TIMEOUT: 120
+    TEST_TIMEOUT_OVERRIDE: 120
   artifacts:
     paths:
       - smoke.serial
@@ -104,7 +104,7 @@
     LOGFILE: xilinx-smoke-x86_64.log
     XEN_CMD_CONSOLE: "console=com2 com2=57600,8n1,0x2F8,4"
     TEST_BOARD: "crater"
-    TEST_TIMEOUT: 1000
+    TEST_TIMEOUT_OVERRIDE: 1000
   artifacts:
     paths:
       - smoke.serial
diff --git a/automation/scripts/console.exp b/automation/scripts/console.exp
index f538aa6bd0..310543c33e 100755
--- a/automation/scripts/console.exp
+++ b/automation/scripts/console.exp
@@ -1,6 +1,8 @@
 #!/usr/bin/expect -f
 
-if {[info exists env(TEST_TIMEOUT)]} {
+if {[info exists env(TEST_TIMEOUT_OVERRIDE)]} {
+    set timeout $env(TEST_TIMEOUT_OVERRIDE)
+} elseif {[info exists env(TEST_TIMEOUT)]} {
     set timeout $env(TEST_TIMEOUT)
 } else {
     set timeout 1500
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Oct 05 20:44:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 05 Oct 2024 20:44:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.811062.1223711 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sxBdD-0002Dz-57; Sat, 05 Oct 2024 20:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 811062.1223711; Sat, 05 Oct 2024 20: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 1sxBdD-0002Dr-2L; Sat, 05 Oct 2024 20:44:03 +0000
Received: by outflank-mailman (input) for mailman id 811062;
 Sat, 05 Oct 2024 20: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 1sxBdB-0002Dl-UK
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20: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 1sxBdB-00062n-T0
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sxBdB-0001OC-RL
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20: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=QrfM0hrWXiGf5vJGx2CtvWp0HHE82S10JnTJPB3eNkk=; b=e08oqQlYRrEgTUMKJbzrh95x21
	LiOMOE4dHQPXiaj+QzPZnSh/QQdZF3zyQUZDtnGgiUoR+OUhVDR1WuvozZD7jrabdgiAVags4an2W
	wzJSnk/sho4LWUqiENnLqj1kMnvwXQ3tlD51GNz3TfKbpL9+kCGSDnGwMlh3bgNOeO4U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Convert remaining uses of the legacy ALIGN
Message-Id: <E1sxBdB-0001OC-RL@xenbits.xenproject.org>
Date: Sat, 05 Oct 2024 20:44:01 +0000

commit 7fd80df2bf4a255ef7efbfb165f9e3aee09374c9
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Oct 2 20:59:19 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 4 12:13:32 2024 +0100

    x86/boot: Convert remaining uses of the legacy ALIGN
    
    There are only two remaining standalone uses the legacy ALIGN macro.
    
    Drop these by switching the .incbin's over to using FUNC()/END() which has
    alignment handled internally.  While the incbin's aren't technically one
    single function, they behave as if they are.
    
    Finally, expand ALIGN inside the legacy ENTRY() macro in order to remove ALIGN
    itself.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/boot/head.S | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index af776c201a..c4de1dfab5 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -10,9 +10,8 @@
 #include <asm/cpufeature.h>
 #include <public/elfnote.h>
 
-#define ALIGN .align CONFIG_FUNCTION_ALIGNMENT, CODE_FILL
 #define ENTRY(name)                             \
-  ALIGN;                                        \
+  .align CONFIG_FUNCTION_ALIGNMENT, CODE_FILL;  \
   GLOBAL(name)
 #define GLOBAL(name)                            \
   .globl name;                                  \
@@ -764,13 +763,13 @@ trampoline_setup:
          * cmdline and reloc are written in C, and linked to be 32bit PIC with
          * entrypoints at 0 and using the fastcall convention.
          */
-        ALIGN
-cmdline_parse_early:
+FUNC_LOCAL(cmdline_parse_early)
         .incbin "cmdline.bin"
+END(cmdline_parse_early)
 
-        ALIGN
-reloc:
+FUNC_LOCAL(reloc)
         .incbin "reloc.bin"
+END(reloc)
 
 ENTRY(trampoline_start)
 #include "trampoline.S"
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Oct 05 20:44:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 05 Oct 2024 20:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.811063.1223715 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sxBdN-0002Fn-6n; Sat, 05 Oct 2024 20:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 811063.1223715; Sat, 05 Oct 2024 20: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 1sxBdN-0002Ff-3z; Sat, 05 Oct 2024 20:44:13 +0000
Received: by outflank-mailman (input) for mailman id 811063;
 Sat, 05 Oct 2024 20: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 1sxBdM-0002FZ-3l
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20: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 1sxBdM-00062t-2Z
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sxBdM-0001PP-0d
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20:44:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XeWipRBB92UhJCPHZZ76HWSl1uCa1FpUqKLrArlV+k8=; b=4efFg0xlRPiXxhxWpOJzoErdEB
	yJqIZieu3SJSoLhD0F6QK1W4ug1XR8Nu/Gf+bK/4t2jQl2vtIeO5jdMrm857i+vXFy4OC4gjkqg7/
	htU1Fiifr1pK2V7z9ktzkhzfA+BOhIOEJL+rHo7BgayOT3iRSOKgkHwE1lg+OSlLVe64=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: Introduce X86_ET_* constants in x86-defns.h
Message-Id: <E1sxBdM-0001PP-0d@xenbits.xenproject.org>
Date: Sat, 05 Oct 2024 20:44:12 +0000

commit 1eeb7c337905c0c602d5924696c86b0436489e84
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Sep 18 16:50:15 2020 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 4 12:13:32 2024 +0100

    x86: Introduce X86_ET_* constants in x86-defns.h
    
    The FRED spec architecturalises the Event Type encoding, previously exposed
    only in VMCB/VMCS fields.
    
    Introduce the constants in x86-defns.h, making them a bit more concise, and
    retire enum x86_event_type.
    
    Take the opportunity to introduce X86_ET_OTHER.  It's absence appears to be a
    bug in Introspection's Monitor Trap Flag support, when considering VECTORING
    events during another VMExit.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 tools/include/xendevicemodel.h         |  2 +-
 xen/arch/x86/hvm/hvm.c                 |  8 +++---
 xen/arch/x86/hvm/svm/intr.c            |  4 +--
 xen/arch/x86/hvm/svm/svm.c             | 47 +++++++++++++++++-----------------
 xen/arch/x86/hvm/vmx/vmx.c             | 42 ++++++++++++++----------------
 xen/arch/x86/hvm/vmx/vvmx.c            | 12 ++++-----
 xen/arch/x86/include/asm/domain.h      |  8 +++---
 xen/arch/x86/include/asm/hvm/hvm.h     |  4 +--
 xen/arch/x86/include/asm/x86-defns.h   | 14 ++++++++++
 xen/arch/x86/mm/shadow/multi.c         |  2 +-
 xen/arch/x86/pv/ro-page-fault.c        |  2 +-
 xen/arch/x86/pv/traps.c                |  6 ++---
 xen/arch/x86/x86_emulate/x86_emulate.c | 26 +++++++++----------
 xen/arch/x86/x86_emulate/x86_emulate.h | 19 +++-----------
 xen/include/public/hvm/dm_op.h         |  2 +-
 15 files changed, 96 insertions(+), 102 deletions(-)

diff --git a/tools/include/xendevicemodel.h b/tools/include/xendevicemodel.h
index 797e0c6b29..227e7fd810 100644
--- a/tools/include/xendevicemodel.h
+++ b/tools/include/xendevicemodel.h
@@ -308,7 +308,7 @@ int xendevicemodel_set_mem_type(
  * @parm domid the domain id to be serviced
  * @parm vcpu the vcpu id
  * @parm vector the interrupt vector
- * @parm type the event type (see the definition of enum x86_event_type)
+ * @parm type the event type (see x86-defns.h:X86_ET_*)
  * @parm error_code the error code or ~0 to skip
  * @parm insn_len the instruction length
  * @parm extra type-specific extra data (%cr2 for #PF, pending_dbg for #DB)
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index b2e782d596..7b2e1c9813 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -219,10 +219,10 @@ int hvm_event_needs_reinjection(uint8_t type, uint8_t vector)
 {
     switch ( type )
     {
-    case X86_EVENTTYPE_EXT_INTR:
-    case X86_EVENTTYPE_NMI:
+    case X86_ET_EXT_INTR:
+    case X86_ET_NMI:
         return 1;
-    case X86_EVENTTYPE_HW_EXCEPTION:
+    case X86_ET_HW_EXC:
         /*
          * SVM uses type 3 ("HW Exception") for #OF and #BP. We explicitly
          * check for these vectors, as they are really SW Exceptions. SVM has
@@ -1738,7 +1738,7 @@ void hvm_inject_event(const struct x86_event *event)
 {
     struct vcpu *curr = current;
     const uint8_t vector = event->vector;
-    const bool has_ec = ((event->type == X86_EVENTTYPE_HW_EXCEPTION) &&
+    const bool has_ec = ((event->type == X86_ET_HW_EXC) &&
                          (vector < 32) && ((X86_EXC_HAVE_EC & (1u << vector))));
 
     ASSERT(vector == event->vector); /* Confirm no truncation. */
diff --git a/xen/arch/x86/hvm/svm/intr.c b/xen/arch/x86/hvm/svm/intr.c
index 780c7e178a..46186a1102 100644
--- a/xen/arch/x86/hvm/svm/intr.c
+++ b/xen/arch/x86/hvm/svm/intr.c
@@ -35,7 +35,7 @@ static void svm_inject_nmi(struct vcpu *v)
 
     event.raw = 0;
     event.v = true;
-    event.type = X86_EVENTTYPE_NMI;
+    event.type = X86_ET_NMI;
     event.vector = X86_EXC_NMI;
 
     ASSERT(!vmcb->event_inj.v);
@@ -56,7 +56,7 @@ static void svm_inject_extint(struct vcpu *v, int vector)
 
     event.raw = 0;
     event.v = true;
-    event.type = X86_EVENTTYPE_EXT_INTR;
+    event.type = X86_ET_EXT_INTR;
     event.vector = vector;
 
     ASSERT(!vmcb->event_inj.v);
diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
index e0793b26db..b8f87aa1ed 100644
--- a/xen/arch/x86/hvm/svm/svm.c
+++ b/xen/arch/x86/hvm/svm/svm.c
@@ -1185,7 +1185,7 @@ static void svm_emul_swint_injection(struct x86_event *event)
 
     /* ICEBP sets the External Event bit despite being an instruction. */
     ec = (trap << 3) | X86_XEC_IDT |
-        (type == X86_EVENTTYPE_PRI_SW_EXCEPTION ? X86_XEC_EXT : 0);
+         (type == X86_ET_PRIV_SW_EXC ? X86_XEC_EXT : 0);
 
     /*
      * TODO: This does not cover the v8086 mode with CR4.VME case
@@ -1243,7 +1243,7 @@ static void svm_emul_swint_injection(struct x86_event *event)
         goto raise_exception;
 
     /* ICEBP counts as a hardware event, and bypasses the dpl check. */
-    if ( type != X86_EVENTTYPE_PRI_SW_EXCEPTION &&
+    if ( type != X86_ET_PRIV_SW_EXC &&
          vmcb_get_cpl(vmcb) > ((idte.b >> 13) & 3) )
         goto raise_exception;
 
@@ -1264,7 +1264,7 @@ static void svm_emul_swint_injection(struct x86_event *event)
 
  raise_exception:
     event->vector = fault;
-    event->type = X86_EVENTTYPE_HW_EXCEPTION;
+    event->type = X86_ET_HW_EXC;
     event->insn_len = 0;
     event->error_code = ec;
 }
@@ -1285,11 +1285,11 @@ static void cf_check svm_inject_event(const struct x86_event *event)
      * further fault shouldn't occur during delivery.  This covers the fact
      * that hardware doesn't perform DPL checking on injection.
      */
-    if ( event->type == X86_EVENTTYPE_PRI_SW_EXCEPTION ||
-         (!cpu_has_svm_nrips && (event->type >= X86_EVENTTYPE_SW_INTERRUPT)) )
+    if ( event->type == X86_ET_PRIV_SW_EXC ||
+         (!cpu_has_svm_nrips && (event->type >= X86_ET_SW_INT)) )
         svm_emul_swint_injection(&_event);
 
-    switch ( _event.vector | -(_event.type == X86_EVENTTYPE_SW_INTERRUPT) )
+    switch ( _event.vector | -(_event.type == X86_ET_SW_INT) )
     {
     case X86_EXC_DB:
         if ( regs->eflags & X86_EFLAGS_TF )
@@ -1308,13 +1308,13 @@ static void cf_check svm_inject_event(const struct x86_event *event)
         break;
 
     case X86_EXC_PF:
-        ASSERT(_event.type == X86_EVENTTYPE_HW_EXCEPTION);
+        ASSERT(_event.type == X86_ET_HW_EXC);
         curr->arch.hvm.guest_cr[2] = _event.cr2;
         vmcb_set_cr2(vmcb, _event.cr2);
         break;
     }
 
-    if ( eventinj.v && (eventinj.type == X86_EVENTTYPE_HW_EXCEPTION) )
+    if ( eventinj.v && (eventinj.type == X86_ET_HW_EXC) )
     {
         _event.vector = hvm_combine_hw_exceptions(
             eventinj.vector, _event.vector);
@@ -1339,15 +1339,15 @@ static void cf_check svm_inject_event(const struct x86_event *event)
      */
     switch ( _event.type )
     {
-    case X86_EVENTTYPE_SW_INTERRUPT: /* int $n */
+    case X86_ET_SW_INT: /* int $n */
         if ( cpu_has_svm_nrips )
             vmcb->nextrip = regs->rip + _event.insn_len;
         else
             regs->rip += _event.insn_len;
-        eventinj.type = X86_EVENTTYPE_SW_INTERRUPT;
+        eventinj.type = X86_ET_SW_INT;
         break;
 
-    case X86_EVENTTYPE_PRI_SW_EXCEPTION: /* icebp */
+    case X86_ET_PRIV_SW_EXC: /* icebp */
         /*
          * icebp's injection must always be emulated, as hardware does not
          * special case HW_EXCEPTION with vector 1 (#DB) as having trap
@@ -1356,10 +1356,10 @@ static void cf_check svm_inject_event(const struct x86_event *event)
         regs->rip += _event.insn_len;
         if ( cpu_has_svm_nrips )
             vmcb->nextrip = regs->rip;
-        eventinj.type = X86_EVENTTYPE_HW_EXCEPTION;
+        eventinj.type = X86_ET_HW_EXC;
         break;
 
-    case X86_EVENTTYPE_SW_EXCEPTION: /* int3, into */
+    case X86_ET_SW_EXC: /* int3, into */
         /*
          * Hardware special cases HW_EXCEPTION with vectors 3 and 4 as having
          * trap semantics, and will perform DPL checks.
@@ -1368,11 +1368,11 @@ static void cf_check svm_inject_event(const struct x86_event *event)
             vmcb->nextrip = regs->rip + _event.insn_len;
         else
             regs->rip += _event.insn_len;
-        eventinj.type = X86_EVENTTYPE_HW_EXCEPTION;
+        eventinj.type = X86_ET_HW_EXC;
         break;
 
     default:
-        eventinj.type = X86_EVENTTYPE_HW_EXCEPTION;
+        eventinj.type = X86_ET_HW_EXC;
         eventinj.ev = (_event.error_code != X86_EVENT_NO_EC);
         eventinj.ec = _event.error_code;
         break;
@@ -1391,8 +1391,7 @@ static void cf_check svm_inject_event(const struct x86_event *event)
     ASSERT(!eventinj.ev || eventinj.ec == (uint16_t)eventinj.ec);
     vmcb->event_inj = eventinj;
 
-    if ( _event.vector == X86_EXC_PF &&
-         _event.type == X86_EVENTTYPE_HW_EXCEPTION )
+    if ( _event.vector == X86_EXC_PF && _event.type == X86_ET_HW_EXC )
         TRACE(TRC_HVM_PF_INJECT64, _event.error_code,
               _event.cr2, _event.cr2 >> 32);
     else
@@ -2694,12 +2693,12 @@ void asmlinkage svm_vmexit_handler(void)
 
             if ( likely(exit_reason != VMEXIT_ICEBP) )
             {
-                trap_type = X86_EVENTTYPE_HW_EXCEPTION;
+                trap_type = X86_ET_HW_EXC;
                 insn_len = 0;
             }
             else
             {
-                trap_type = X86_EVENTTYPE_PRI_SW_EXCEPTION;
+                trap_type = X86_ET_PRIV_SW_EXC;
                 insn_len = svm_get_insn_len(v, INSTR_ICEBP);
 
                 if ( !insn_len )
@@ -2736,13 +2735,13 @@ void asmlinkage svm_vmexit_handler(void)
         {
            rc = hvm_monitor_debug(regs->rip,
                                   HVM_MONITOR_SOFTWARE_BREAKPOINT,
-                                  X86_EVENTTYPE_SW_EXCEPTION,
+                                  X86_ET_SW_EXC,
                                   insn_len, 0);
            if ( rc < 0 )
                goto unexpected_exit_type;
            if ( !rc )
                hvm_inject_exception(X86_EXC_BP,
-                                    X86_EVENTTYPE_SW_EXCEPTION,
+                                    X86_ET_SW_EXC,
                                     insn_len, X86_EVENT_NO_EC);
         }
         break;
@@ -2835,13 +2834,13 @@ void asmlinkage svm_vmexit_handler(void)
                  * ICEBP is handled specially, and already has fault
                  * semantics.
                  */
-            case X86_EVENTTYPE_HW_EXCEPTION:
+            case X86_ET_HW_EXC:
                 if ( vmcb->exit_int_info.vector == X86_EXC_BP ||
                      vmcb->exit_int_info.vector == X86_EXC_OF )
                     break;
                 /* Fallthrough */
-            case X86_EVENTTYPE_EXT_INTR:
-            case X86_EVENTTYPE_NMI:
+            case X86_ET_EXT_INTR:
+            case X86_ET_NMI:
                 insn_len = 0;
                 break;
             }
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 12f8a66458..b6885d0e27 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1994,14 +1994,13 @@ void vmx_inject_extint(int trap, uint8_t source)
         if ( pin_based_cntrl & PIN_BASED_EXT_INTR_MASK ) {
             nvmx_enqueue_n2_exceptions (v, 
                INTR_INFO_VALID_MASK |
-               MASK_INSR(X86_EVENTTYPE_EXT_INTR, INTR_INFO_INTR_TYPE_MASK) |
+               MASK_INSR(X86_ET_EXT_INTR, INTR_INFO_INTR_TYPE_MASK) |
                MASK_INSR(trap, INTR_INFO_VECTOR_MASK),
                X86_EVENT_NO_EC, source);
             return;
         }
     }
-    __vmx_inject_exception(trap, X86_EVENTTYPE_EXT_INTR,
-                           X86_EVENT_NO_EC);
+    __vmx_inject_exception(trap, X86_ET_EXT_INTR, X86_EVENT_NO_EC);
 }
 
 void vmx_inject_nmi(void)
@@ -2014,23 +2013,22 @@ void vmx_inject_nmi(void)
         if ( pin_based_cntrl & PIN_BASED_NMI_EXITING ) {
             nvmx_enqueue_n2_exceptions (v, 
                INTR_INFO_VALID_MASK |
-               MASK_INSR(X86_EVENTTYPE_NMI, INTR_INFO_INTR_TYPE_MASK) |
+               MASK_INSR(X86_ET_NMI, INTR_INFO_INTR_TYPE_MASK) |
                MASK_INSR(X86_EXC_NMI, INTR_INFO_VECTOR_MASK),
                X86_EVENT_NO_EC, hvm_intsrc_nmi);
             return;
         }
     }
-    __vmx_inject_exception(2, X86_EVENTTYPE_NMI,
-                           X86_EVENT_NO_EC);
+    __vmx_inject_exception(2, X86_ET_NMI, X86_EVENT_NO_EC);
 }
 
 /*
  * Generate a virtual event in the guest.
  * NOTES:
- *  - INT 3 (CC) and INTO (CE) are X86_EVENTTYPE_SW_EXCEPTION;
- *  - INT nn (CD nn) is X86_EVENTTYPE_SW_INTERRUPT;
- *  - #DB is X86_EVENTTYPE_HW_EXCEPTION, except when generated by
- *    opcode 0xf1 (which is X86_EVENTTYPE_PRI_SW_EXCEPTION)
+ *  - INT3 (CC) and INTO (CE) are X86_ET_SW_EXC;
+ *  - INT $n (CD nn) is X86_ET_SW_INT;
+ *  - #DB is X86_ET_HW_EXC, except when generated by
+ *    ICEBP/INT1 (which is X86_ET_PRIV_SW_EXC)
  */
 static void cf_check vmx_inject_event(const struct x86_event *event)
 {
@@ -2038,7 +2036,7 @@ static void cf_check vmx_inject_event(const struct x86_event *event)
     struct vcpu *curr = current;
     struct x86_event _event = *event;
 
-    switch ( _event.vector | -(_event.type == X86_EVENTTYPE_SW_INTERRUPT) )
+    switch ( _event.vector | -(_event.type == X86_ET_SW_INT) )
     {
     case X86_EXC_DB:
         if ( guest_cpu_user_regs()->eflags & X86_EFLAGS_TF )
@@ -2069,7 +2067,7 @@ static void cf_check vmx_inject_event(const struct x86_event *event)
         break;
 
     case X86_EXC_PF:
-        ASSERT(_event.type == X86_EVENTTYPE_HW_EXCEPTION);
+        ASSERT(_event.type == X86_ET_HW_EXC);
         curr->arch.hvm.guest_cr[2] = _event.cr2;
         break;
     }
@@ -2080,8 +2078,7 @@ static void cf_check vmx_inject_event(const struct x86_event *event)
         __vmread(VM_ENTRY_INTR_INFO, &intr_info);
 
     if ( unlikely(intr_info & INTR_INFO_VALID_MASK) &&
-         (MASK_EXTR(intr_info, INTR_INFO_INTR_TYPE_MASK) ==
-          X86_EVENTTYPE_HW_EXCEPTION) )
+         (MASK_EXTR(intr_info, INTR_INFO_INTR_TYPE_MASK) == X86_ET_HW_EXC) )
     {
         _event.vector = hvm_combine_hw_exceptions(
             (uint8_t)intr_info, _event.vector);
@@ -2089,7 +2086,7 @@ static void cf_check vmx_inject_event(const struct x86_event *event)
             _event.error_code = 0;
     }
 
-    if ( _event.type >= X86_EVENTTYPE_SW_INTERRUPT )
+    if ( _event.type >= X86_ET_SW_INT )
         __vmwrite(VM_ENTRY_INSTRUCTION_LEN, _event.insn_len);
 
     if ( nestedhvm_vcpu_in_guestmode(curr) &&
@@ -2105,8 +2102,7 @@ static void cf_check vmx_inject_event(const struct x86_event *event)
     else
         __vmx_inject_exception(_event.vector, _event.type, _event.error_code);
 
-    if ( (_event.vector == X86_EXC_PF) &&
-         (_event.type == X86_EVENTTYPE_HW_EXCEPTION) )
+    if ( (_event.vector == X86_EXC_PF) && (_event.type == X86_ET_HW_EXC) )
         TRACE(TRC_HVM_PF_INJECT64, _event.error_code,
               curr->arch.hvm.guest_cr[2], curr->arch.hvm.guest_cr[2] >> 32);
     else
@@ -3951,7 +3947,7 @@ static void vmx_propagate_intr(unsigned long intr)
     else
         event.error_code = X86_EVENT_NO_EC;
 
-    if ( event.type >= X86_EVENTTYPE_SW_INTERRUPT )
+    if ( event.type >= X86_ET_SW_INT )
     {
         __vmread(VM_EXIT_INSTRUCTION_LEN, &tmp);
         event.insn_len = tmp;
@@ -3990,7 +3986,7 @@ static void vmx_idtv_reinject(unsigned long idtv_info)
          */
         if ( cpu_has_vmx_vnmi &&
              ((idtv_info & INTR_INFO_INTR_TYPE_MASK) ==
-              MASK_INSR(X86_EVENTTYPE_NMI, INTR_INFO_INTR_TYPE_MASK)) )
+              MASK_INSR(X86_ET_NMI, INTR_INFO_INTR_TYPE_MASK)) )
         {
             unsigned long intr_info;
 
@@ -4115,7 +4111,7 @@ void asmlinkage vmx_vmexit_handler(struct cpu_user_regs *regs)
             do_machine_check(regs);
         if ( (vector == X86_EXC_NMI) &&
              ((intr_info & INTR_INFO_INTR_TYPE_MASK) ==
-              MASK_INSR(X86_EVENTTYPE_NMI, INTR_INFO_INTR_TYPE_MASK)) )
+              MASK_INSR(X86_ET_NMI, INTR_INFO_INTR_TYPE_MASK)) )
         {
             do_nmi(regs);
             enable_nmis();
@@ -4317,7 +4313,7 @@ void asmlinkage vmx_vmexit_handler(struct cpu_user_regs *regs)
                 unsigned long trap_type = MASK_EXTR(intr_info,
                                                     INTR_INFO_INTR_TYPE_MASK);
 
-                if ( trap_type >= X86_EVENTTYPE_SW_INTERRUPT )
+                if ( trap_type >= X86_ET_SW_INT )
                     __vmread(VM_EXIT_INSTRUCTION_LEN, &insn_len);
 
                 rc = hvm_monitor_debug(regs->rip,
@@ -4342,7 +4338,7 @@ void asmlinkage vmx_vmexit_handler(struct cpu_user_regs *regs)
                 __vmread(VM_EXIT_INSTRUCTION_LEN, &insn_len);
                 rc = hvm_monitor_debug(regs->rip,
                                        HVM_MONITOR_SOFTWARE_BREAKPOINT,
-                                       X86_EVENTTYPE_SW_EXCEPTION,
+                                       X86_ET_SW_EXC,
                                        insn_len, 0);
 
                 if ( rc < 0 )
@@ -4391,7 +4387,7 @@ void asmlinkage vmx_vmexit_handler(struct cpu_user_regs *regs)
             break;
         case X86_EXC_NMI:
             if ( MASK_EXTR(intr_info, INTR_INFO_INTR_TYPE_MASK) !=
-                 X86_EVENTTYPE_NMI )
+                 X86_ET_NMI )
                 goto exit_and_crash;
             TRACE(TRC_HVM_NMI);
             /* Already handled above. */
diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index c05e0e9326..78135ca23b 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -1346,7 +1346,7 @@ static void sync_exception_state(struct vcpu *v)
 
     switch ( MASK_EXTR(nvmx->intr.intr_info, INTR_INFO_INTR_TYPE_MASK) )
     {
-    case X86_EVENTTYPE_EXT_INTR:
+    case X86_ET_EXT_INTR:
         /* rename exit_reason to EXTERNAL_INTERRUPT */
         set_vvmcs(v, VM_EXIT_REASON, EXIT_REASON_EXTERNAL_INTERRUPT);
         set_vvmcs(v, EXIT_QUALIFICATION, 0);
@@ -1355,14 +1355,14 @@ static void sync_exception_state(struct vcpu *v)
                                                          : 0);
         break;
 
-    case X86_EVENTTYPE_HW_EXCEPTION:
-    case X86_EVENTTYPE_SW_INTERRUPT:
-    case X86_EVENTTYPE_SW_EXCEPTION:
+    case X86_ET_HW_EXC:
+    case X86_ET_SW_INT:
+    case X86_ET_SW_EXC:
         /* throw to L1 */
         set_vvmcs(v, VM_EXIT_INTR_INFO, nvmx->intr.intr_info);
         set_vvmcs(v, VM_EXIT_INTR_ERROR_CODE, nvmx->intr.error_code);
         break;
-    case X86_EVENTTYPE_NMI:
+    case X86_ET_NMI:
         set_vvmcs(v, VM_EXIT_REASON, EXIT_REASON_EXCEPTION_NMI);
         set_vvmcs(v, EXIT_QUALIFICATION, 0);
         set_vvmcs(v, VM_EXIT_INTR_INFO, nvmx->intr.intr_info);
@@ -2445,7 +2445,7 @@ int nvmx_n2_vmexit_handler(struct cpu_user_regs *regs,
     case EXIT_REASON_EXCEPTION_NMI:
     {
         unsigned long intr_info;
-        u32 valid_mask = MASK_INSR(X86_EVENTTYPE_HW_EXCEPTION,
+        u32 valid_mask = MASK_INSR(X86_ET_HW_EXC,
                                   INTR_INFO_INTR_TYPE_MASK) |
                          INTR_INFO_VALID_MASK;
         u64 exec_bitmap;
diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index bdcdb8de09..5219c4fb0f 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -724,7 +724,7 @@ static inline void pv_inject_hw_exception(unsigned int vector, int errcode)
 {
     const struct x86_event event = {
         .vector = vector,
-        .type = X86_EVENTTYPE_HW_EXCEPTION,
+        .type = X86_ET_HW_EXC,
         .error_code = errcode,
     };
 
@@ -735,7 +735,7 @@ static inline void pv_inject_DB(unsigned long pending_dbg)
 {
     struct x86_event event = {
         .vector      = X86_EXC_DB,
-        .type        = X86_EVENTTYPE_HW_EXCEPTION,
+        .type        = X86_ET_HW_EXC,
         .error_code  = X86_EVENT_NO_EC,
     };
 
@@ -748,7 +748,7 @@ static inline void pv_inject_page_fault(int errcode, unsigned long cr2)
 {
     struct x86_event event = {
         .vector = X86_EXC_PF,
-        .type = X86_EVENTTYPE_HW_EXCEPTION,
+        .type = X86_ET_HW_EXC,
         .error_code = errcode,
     };
 
@@ -761,7 +761,7 @@ static inline void pv_inject_sw_interrupt(unsigned int vector)
 {
     const struct x86_event event = {
         .vector = vector,
-        .type = X86_EVENTTYPE_SW_INTERRUPT,
+        .type = X86_ET_SW_INT,
         .error_code = X86_EVENT_NO_EC,
     };
 
diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/hvm/hvm.h
index dd7d4872b5..02de18c7d4 100644
--- a/xen/arch/x86/include/asm/hvm/hvm.h
+++ b/xen/arch/x86/include/asm/hvm/hvm.h
@@ -522,7 +522,7 @@ static inline void hvm_inject_hw_exception(unsigned int vector, int errcode)
 {
     struct x86_event event = {
         .vector = vector,
-        .type = X86_EVENTTYPE_HW_EXCEPTION,
+        .type = X86_ET_HW_EXC,
         .error_code = errcode,
     };
 
@@ -533,7 +533,7 @@ static inline void hvm_inject_page_fault(int errcode, unsigned long cr2)
 {
     struct x86_event event = {
         .vector = X86_EXC_PF,
-        .type = X86_EVENTTYPE_HW_EXCEPTION,
+        .type = X86_ET_HW_EXC,
         .error_code = errcode,
     };
 
diff --git a/xen/arch/x86/include/asm/x86-defns.h b/xen/arch/x86/include/asm/x86-defns.h
index 7abc5bcd42..2493ec277f 100644
--- a/xen/arch/x86/include/asm/x86-defns.h
+++ b/xen/arch/x86/include/asm/x86-defns.h
@@ -204,4 +204,18 @@
 #define X86_MT_UCM    0x07 /* UC- */
 #define X86_NUM_MT    0x08
 
+/*
+ * Event Types.
+ *
+ * These encodings were first used in VMCB/VMCS fields, but have become
+ * architectural in the FRED spec.
+ */
+#define X86_ET_EXT_INTR    0 /* External Interrupt */
+#define X86_ET_NMI         2 /* NMI */
+#define X86_ET_HW_EXC      3 /* Hardware Exception (#PF/#GP/etc) */
+#define X86_ET_SW_INT      4 /* Software Interrupt (INT $n) */
+#define X86_ET_PRIV_SW_EXC 5 /* Privileged Software Exception (ICEBP/INT1) */
+#define X86_ET_SW_EXC      6 /* Software Exception (INT3, INTO) */
+#define X86_ET_OTHER       7 /* Misc event: MTF=0, SYSCALL=1, SYSENTER=2 */
+
 #endif	/* __XEN_X86_DEFNS_H__ */
diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c
index 376f6823cd..10ddc408ff 100644
--- a/xen/arch/x86/mm/shadow/multi.c
+++ b/xen/arch/x86/mm/shadow/multi.c
@@ -2701,7 +2701,7 @@ static int cf_check sh_page_fault(
          * else is an emulation bug, or a guest playing with the instruction
          * stream under Xen's feet.
          */
-        if ( emul_ctxt.ctxt.event.type == X86_EVENTTYPE_HW_EXCEPTION &&
+        if ( emul_ctxt.ctxt.event.type == X86_ET_HW_EXC &&
              ((emul_ctxt.ctxt.event.vector == X86_EXC_PF) ||
               (((emul_ctxt.ctxt.event.vector == X86_EXC_GP) ||
                 (emul_ctxt.ctxt.event.vector == X86_EXC_SS)) &&
diff --git a/xen/arch/x86/pv/ro-page-fault.c b/xen/arch/x86/pv/ro-page-fault.c
index d0fe07e3a1..6a739f9e9a 100644
--- a/xen/arch/x86/pv/ro-page-fault.c
+++ b/xen/arch/x86/pv/ro-page-fault.c
@@ -379,7 +379,7 @@ int pv_ro_page_fault(unsigned long addr, struct cpu_user_regs *regs)
          * concurrent pagetable update).  Anything else is an emulation bug,
          * or a guest playing with the instruction stream under Xen's feet.
          */
-        if ( ctxt.event.type == X86_EVENTTYPE_HW_EXCEPTION &&
+        if ( ctxt.event.type == X86_ET_HW_EXC &&
              ctxt.event.vector == X86_EXC_PF )
             pv_inject_event(&ctxt.event);
         else
diff --git a/xen/arch/x86/pv/traps.c b/xen/arch/x86/pv/traps.c
index 5a7341abf0..ed8aa97382 100644
--- a/xen/arch/x86/pv/traps.c
+++ b/xen/arch/x86/pv/traps.c
@@ -29,14 +29,14 @@ void pv_inject_event(const struct x86_event *event)
     bool use_error_code;
 
     ASSERT(vector == event->vector); /* Confirm no truncation. */
-    if ( event->type == X86_EVENTTYPE_HW_EXCEPTION )
+    if ( event->type == X86_ET_HW_EXC )
     {
         ASSERT(vector < 32);
         use_error_code = X86_EXC_HAVE_EC & (1u << vector);
     }
     else
     {
-        ASSERT(event->type == X86_EVENTTYPE_SW_INTERRUPT);
+        ASSERT(event->type == X86_ET_SW_INT);
         use_error_code = false;
     }
     if ( use_error_code )
@@ -51,7 +51,7 @@ void pv_inject_event(const struct x86_event *event)
     tb->cs    = ti->cs;
     tb->eip   = ti->address;
 
-    switch ( vector | -(event->type == X86_EVENTTYPE_SW_INTERRUPT) )
+    switch ( vector | -(event->type == X86_ET_SW_INT) )
     {
     case X86_EXC_PF:
         curr->arch.pv.ctrlreg[2] = event->cr2;
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index bbda0ffc2f..0ea0d5e67e 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -2372,19 +2372,19 @@ x86_emulate(
         {
         case 0xcc: /* int3 */
             ctxt->event.vector = X86_EXC_BP;
-            ctxt->event.type = X86_EVENTTYPE_SW_EXCEPTION;
+            ctxt->event.type = X86_ET_SW_EXC;
             break;
         case 0xcd: /* int imm8 */
             ctxt->event.vector = imm1;
-            ctxt->event.type = X86_EVENTTYPE_SW_INTERRUPT;
+            ctxt->event.type = X86_ET_SW_INT;
             break;
         case 0xce: /* into */
             ctxt->event.vector = X86_EXC_OF;
-            ctxt->event.type = X86_EVENTTYPE_SW_EXCEPTION;
+            ctxt->event.type = X86_ET_SW_EXC;
             break;
         case 0xf1: /* icebp */
             ctxt->event.vector = X86_EXC_DB;
-            ctxt->event.type = X86_EVENTTYPE_PRI_SW_EXCEPTION;
+            ctxt->event.type = X86_ET_PRIV_SW_EXC;
             break;
         }
         ctxt->event.error_code = X86_EVENT_NO_EC;
@@ -8597,16 +8597,14 @@ static void __init __maybe_unused build_assertions(void)
     BUILD_BUG_ON(x86_seg_fs != 4);
     BUILD_BUG_ON(x86_seg_gs != 5);
 
-    /*
-     * Check X86_EVENTTYPE_* against VMCB EVENTINJ and VMCS INTR_INFO type
-     * fields.
-     */
-    BUILD_BUG_ON(X86_EVENTTYPE_EXT_INTR != 0);
-    BUILD_BUG_ON(X86_EVENTTYPE_NMI != 2);
-    BUILD_BUG_ON(X86_EVENTTYPE_HW_EXCEPTION != 3);
-    BUILD_BUG_ON(X86_EVENTTYPE_SW_INTERRUPT != 4);
-    BUILD_BUG_ON(X86_EVENTTYPE_PRI_SW_EXCEPTION != 5);
-    BUILD_BUG_ON(X86_EVENTTYPE_SW_EXCEPTION != 6);
+    /* Check X86_ET_* against VMCB EVENTINJ and VMCS INTR_INFO type fields. */
+    BUILD_BUG_ON(X86_ET_EXT_INTR    != 0);
+    BUILD_BUG_ON(X86_ET_NMI         != 2);
+    BUILD_BUG_ON(X86_ET_HW_EXC      != 3);
+    BUILD_BUG_ON(X86_ET_SW_INT      != 4);
+    BUILD_BUG_ON(X86_ET_PRIV_SW_EXC != 5);
+    BUILD_BUG_ON(X86_ET_SW_EXC      != 6);
+    BUILD_BUG_ON(X86_ET_OTHER       != 7);
 }
 
 #ifndef NDEBUG
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.h b/xen/arch/x86/x86_emulate/x86_emulate.h
index 3e819d4174..d75658eba0 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.h
+++ b/xen/arch/x86/x86_emulate/x86_emulate.h
@@ -59,24 +59,11 @@ static inline bool is_x86_system_segment(enum x86_segment seg)
     return seg >= x86_seg_tr && seg < x86_seg_none;
 }
 
-/*
- * x86 event types. This enumeration is valid for:
- *  Intel VMX: {VM_ENTRY,VM_EXIT,IDT_VECTORING}_INTR_INFO[10:8]
- *  AMD SVM: eventinj[10:8] and exitintinfo[10:8] (types 0-4 only)
- */
-enum x86_event_type {
-    X86_EVENTTYPE_EXT_INTR,         /* External interrupt */
-    X86_EVENTTYPE_NMI = 2,          /* NMI */
-    X86_EVENTTYPE_HW_EXCEPTION,     /* Hardware exception */
-    X86_EVENTTYPE_SW_INTERRUPT,     /* Software interrupt (CD nn) */
-    X86_EVENTTYPE_PRI_SW_EXCEPTION, /* ICEBP (F1) */
-    X86_EVENTTYPE_SW_EXCEPTION,     /* INT3 (CC), INTO (CE) */
-};
 #define X86_EVENT_NO_EC (-1)        /* No error code. */
 
 struct x86_event {
     int16_t       vector;
-    uint8_t       type;         /* X86_EVENTTYPE_* */
+    uint8_t       type;         /* X86_ET_* */
     uint8_t       insn_len;     /* Instruction length */
     int32_t       error_code;   /* X86_EVENT_NO_EC if n/a */
     union {
@@ -821,7 +808,7 @@ static inline void x86_emul_hw_exception(
     ASSERT(!ctxt->event_pending);
 
     ctxt->event.vector = vector;
-    ctxt->event.type = X86_EVENTTYPE_HW_EXCEPTION;
+    ctxt->event.type = X86_ET_HW_EXC;
     ctxt->event.error_code = error_code;
 
     ctxt->event_pending = true;
@@ -833,7 +820,7 @@ static inline void x86_emul_pagefault(
     ASSERT(!ctxt->event_pending);
 
     ctxt->event.vector = X86_EXC_PF;
-    ctxt->event.type = X86_EVENTTYPE_HW_EXCEPTION;
+    ctxt->event.type = X86_ET_HW_EXC;
     ctxt->event.error_code = error_code;
     ctxt->event.cr2 = cr2;
 
diff --git a/xen/include/public/hvm/dm_op.h b/xen/include/public/hvm/dm_op.h
index fa98551914..2bf0fdc1ae 100644
--- a/xen/include/public/hvm/dm_op.h
+++ b/xen/include/public/hvm/dm_op.h
@@ -302,7 +302,7 @@ struct xen_dm_op_inject_event {
     uint8_t vector;
     /* IN - event type (DMOP_EVENT_* ) */
     uint8_t type;
-/* NB. This enumeration precisely matches hvm.h:X86_EVENTTYPE_* */
+/* NB. This enumeration precisely matches x86-defns.h:X86_ET_* */
 # define XEN_DMOP_EVENT_ext_int    0 /* external interrupt */
 # define XEN_DMOP_EVENT_nmi        2 /* nmi */
 # define XEN_DMOP_EVENT_hw_exc     3 /* hardware exception */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Oct 05 20:44:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 05 Oct 2024 20:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.811065.1223719 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sxBdX-0002JG-9l; Sat, 05 Oct 2024 20:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 811065.1223719; Sat, 05 Oct 2024 20: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 1sxBdX-0002J8-6r; Sat, 05 Oct 2024 20:44:23 +0000
Received: by outflank-mailman (input) for mailman id 811065;
 Sat, 05 Oct 2024 20: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 1sxBdW-0002Iy-6y
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20: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 1sxBdW-000635-5m
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sxBdW-0001QB-4e
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20:44:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Imi0npGqe94GcRR7ZgkqWC319DqKvvqu+b4a3QhIARI=; b=jHezhbWHv8nOje0Vcqi+3ha6TA
	gcIbQDdNGZLP69VL/7MeK/SJuNypGARDh5AQCzAQiVetA59KmMylSqDr662JrDo60jSaXMgvPKpJk
	sg9/ORHFvE5ocGb3CpdKBBqKVmhV64TzvkbSACtwbyGn+WOmHXsUZkRo27VNuykaQ5Es=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: preserve built xen.efi
Message-Id: <E1sxBdW-0001QB-4e@xenbits.xenproject.org>
Date: Sat, 05 Oct 2024 20:44:22 +0000

commit 636e66b143ac1aad2f6a9c2e7166d8ba88f4559a
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Fri Oct 4 04:29:37 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 4 12:13:32 2024 +0100

    automation: preserve built xen.efi
    
    It will be useful for further tests.  Deuplicate the collection.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/scripts/build | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/automation/scripts/build b/automation/scripts/build
index b3c71fb6fb..1879c1db6d 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -41,19 +41,30 @@ cp xen/.config xen-config
 # Directory for the artefacts to be dumped into
 mkdir -p binaries
 
+collect_xen_artefacts()
+{
+    local f
+
+    for f in xen/xen xen/xen.efi; do
+        if [[ -f $f ]]; then
+            cp $f binaries/
+        fi
+    done
+}
+
 if [[ "${CPPCHECK}" == "y" ]] && [[ "${HYPERVISOR_ONLY}" == "y" ]]; then
     # Cppcheck analysis invokes Xen-only build
     xen/scripts/xen-analysis.py --run-cppcheck --cppcheck-misra -- -j$(nproc)
 
     # Preserve artefacts
-    cp xen/xen binaries/xen
+    collect_xen_artefacts
     cp xen/cppcheck-report/xen-cppcheck.txt xen-cppcheck.txt
 elif [[ "${HYPERVISOR_ONLY}" == "y" ]]; then
     # Xen-only build
     make -j$(nproc) xen
 
     # Preserve artefacts
-    cp xen/xen binaries/xen
+    collect_xen_artefacts
 else
     # Full build.  Figure out our ./configure options
     cfgargs=()
@@ -101,5 +112,5 @@ else
     # even though dist/ contains everything, while some containers don't even
     # build Xen
     cp -r dist binaries/
-    if [[ -f xen/xen ]] ; then cp xen/xen binaries/xen; fi
+    collect_xen_artefacts
 fi
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Oct 05 20:44:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 05 Oct 2024 20:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.811066.1223723 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sxBdh-0002MO-Ar; Sat, 05 Oct 2024 20:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 811066.1223723; Sat, 05 Oct 2024 20:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sxBdh-0002MG-8H; Sat, 05 Oct 2024 20:44:33 +0000
Received: by outflank-mailman (input) for mailman id 811066;
 Sat, 05 Oct 2024 20:44: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 1sxBdg-0002M0-9t
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20:44: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 1sxBdg-00063M-9F
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sxBdg-0001Qn-7t
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=F40pKar3gleVDzewygiBmfdpiOTFeMRMOR9CsuVfL00=; b=LE9DDBvZtaUhe1TPjEaasHRI0c
	t972cmcxWhWA6RngwGlJKktrF0ZbKewVCG8FexAHlLZ6Hh+ynO9w22DGbR/JlMMQFA5pxnVxx54kw
	cKykJKym7SaWSRUr27+6Du8pbKbfI8M7GWfzYjG02Nkd2MFoRITpi5eHfr68mvFVa8c4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: add a smoke test for xen.efi on X86
Message-Id: <E1sxBdg-0001Qn-7t@xenbits.xenproject.org>
Date: Sat, 05 Oct 2024 20:44:32 +0000

commit 2d1c673baea563bb1af00b1e977b4ff7c213cf7f
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Fri Oct 4 04:29:38 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 4 12:13:32 2024 +0100

    automation: add a smoke test for xen.efi on X86
    
    Check if xen.efi is bootable with an XTF dom0.
    The multiboot2+EFI path is tested on hardware tests already.
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/build/debian/bookworm.dockerfile |  2 ++
 automation/gitlab-ci/test.yaml              |  7 +++++
 automation/scripts/qemu-smoke-x86-64-efi.sh | 43 +++++++++++++++++++++++++++++
 3 files changed, 52 insertions(+)

diff --git a/automation/build/debian/bookworm.dockerfile b/automation/build/debian/bookworm.dockerfile
index 3dd70cb6b2..72e01aa58b 100644
--- a/automation/build/debian/bookworm.dockerfile
+++ b/automation/build/debian/bookworm.dockerfile
@@ -46,6 +46,8 @@ RUN apt-get update && \
         # for test phase, qemu-smoke-* jobs
         qemu-system-x86 \
         expect \
+        # For *-efi jobs
+        ovmf \
         # for test phase, qemu-alpine-* jobs
         cpio \
         busybox-static \
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index e947736195..5687eaf914 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -463,6 +463,13 @@ qemu-smoke-x86-64-clang-pvh:
   needs:
     - debian-bookworm-clang-debug
 
+qemu-smoke-x86-64-gcc-efi:
+  extends: .qemu-x86-64
+  script:
+    - ./automation/scripts/qemu-smoke-x86-64-efi.sh pv 2>&1 | tee ${LOGFILE}
+  needs:
+    - debian-bookworm-gcc-debug
+
 qemu-smoke-riscv64-gcc:
   extends: .qemu-riscv64
   script:
diff --git a/automation/scripts/qemu-smoke-x86-64-efi.sh b/automation/scripts/qemu-smoke-x86-64-efi.sh
new file mode 100755
index 0000000000..7572722be6
--- /dev/null
+++ b/automation/scripts/qemu-smoke-x86-64-efi.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+set -ex -o pipefail
+
+# variant should be either pv or pvh
+variant=$1
+
+# Clone and build XTF
+git clone https://xenbits.xen.org/git-http/xtf.git
+cd xtf && make -j$(nproc) && cd -
+
+case $variant in
+    pvh) k=test-hvm64-example    extra="dom0-iommu=none dom0=pvh" ;;
+    *)   k=test-pv64-example     extra= ;;
+esac
+
+mkdir -p boot-esp/EFI/BOOT
+cp binaries/xen.efi boot-esp/EFI/BOOT/BOOTX64.EFI
+cp xtf/tests/example/$k boot-esp/EFI/BOOT/kernel
+
+cat > boot-esp/EFI/BOOT/BOOTX64.cfg <<EOF
+[global]
+default=test
+
+[test]
+options=loglvl=all console=com1 noreboot console_timestamps=boot $extra
+kernel=kernel
+EOF
+
+cp /usr/share/OVMF/OVMF_CODE.fd OVMF_CODE.fd
+cp /usr/share/OVMF/OVMF_VARS.fd OVMF_VARS.fd
+
+rm -f smoke.serial
+export TEST_CMD="qemu-system-x86_64 -nographic -M q35,kernel-irqchip=split \
+        -drive if=pflash,format=raw,readonly=on,file=OVMF_CODE.fd \
+        -drive if=pflash,format=raw,file=OVMF_VARS.fd \
+        -drive file=fat:rw:boot-esp,media=disk,index=0,format=raw \
+        -m 512 -monitor none -serial stdio"
+
+export TEST_LOG="smoke.serial"
+export PASSED="Test result: SUCCESS"
+
+./automation/scripts/console.exp | sed 's/\r\+$//'
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Oct 05 20:44:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 05 Oct 2024 20:44:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.811067.1223727 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sxBdr-0002P5-CV; Sat, 05 Oct 2024 20:44:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 811067.1223727; Sat, 05 Oct 2024 20:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sxBdr-0002Oy-9e; Sat, 05 Oct 2024 20:44:43 +0000
Received: by outflank-mailman (input) for mailman id 811067;
 Sat, 05 Oct 2024 20:44: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 1sxBdq-0002Om-Cv
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20:44: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 1sxBdq-00063t-C5
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sxBdq-0001Rh-BF
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uS8/hgb2dXmmW0yJ7ijc6esE6Vkl0lr0/6kH47QhESQ=; b=RVOIJQD8j/bzliC5bc1nx2A6eZ
	qCuI+DdNq+lNXIP8LWAyWgUT9DfPOvEOURUDxu4abPWXhxgVD/dVrA4hzhCKeltYdqVKNVAv7GTbA
	M6TEG5ZIo7uXO9J1btNcNDgpgkjgde/lpTZapydLuUOTSZ+UJ0xbDlQ2v0xQzxZExlwU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: shorten the timeout for smoke tests
Message-Id: <E1sxBdq-0001Rh-BF@xenbits.xenproject.org>
Date: Sat, 05 Oct 2024 20:44:42 +0000

commit bcce5a6b62761c8b678aebce33c55ea66f879f66
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Fri Oct 4 04:29:39 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 4 12:13:32 2024 +0100

    automation: shorten the timeout for smoke tests
    
    The smoke tests when successful complete in about 5s. Don't waste
    20min+ on failure, shorten the timeout to 120s
    
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 automation/gitlab-ci/test.yaml | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index 5687eaf914..b27c2be174 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -53,6 +53,11 @@
   tags:
     - x86_64
 
+.qemu-smoke-x86-64:
+  extends: .qemu-x86-64
+  variables:
+    TEST_TIMEOUT_OVERRIDE: 120
+
 .qemu-riscv64:
   extends: .test-jobs-common
   variables:
@@ -436,35 +441,35 @@ qemu-alpine-x86_64-gcc:
     - alpine-3.18-gcc
 
 qemu-smoke-x86-64-gcc:
-  extends: .qemu-x86-64
+  extends: .qemu-smoke-x86-64
   script:
     - ./automation/scripts/qemu-smoke-x86-64.sh pv 2>&1 | tee ${LOGFILE}
   needs:
     - debian-bookworm-gcc-debug
 
 qemu-smoke-x86-64-clang:
-  extends: .qemu-x86-64
+  extends: .qemu-smoke-x86-64
   script:
     - ./automation/scripts/qemu-smoke-x86-64.sh pv 2>&1 | tee ${LOGFILE}
   needs:
     - debian-bookworm-clang-debug
 
 qemu-smoke-x86-64-gcc-pvh:
-  extends: .qemu-x86-64
+  extends: .qemu-smoke-x86-64
   script:
     - ./automation/scripts/qemu-smoke-x86-64.sh pvh 2>&1 | tee ${LOGFILE}
   needs:
     - debian-bookworm-gcc-debug
 
 qemu-smoke-x86-64-clang-pvh:
-  extends: .qemu-x86-64
+  extends: .qemu-smoke-x86-64
   script:
     - ./automation/scripts/qemu-smoke-x86-64.sh pvh 2>&1 | tee ${LOGFILE}
   needs:
     - debian-bookworm-clang-debug
 
 qemu-smoke-x86-64-gcc-efi:
-  extends: .qemu-x86-64
+  extends: .qemu-smoke-x86-64
   script:
     - ./automation/scripts/qemu-smoke-x86-64-efi.sh pv 2>&1 | tee ${LOGFILE}
   needs:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Oct 05 20:44:53 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 05 Oct 2024 20:44:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.811068.1223730 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sxBe1-0002Rp-Dl; Sat, 05 Oct 2024 20:44:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 811068.1223730; Sat, 05 Oct 2024 20:44:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sxBe1-0002Ri-BD; Sat, 05 Oct 2024 20:44:53 +0000
Received: by outflank-mailman (input) for mailman id 811068;
 Sat, 05 Oct 2024 20:44: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 1sxBe0-0002Ra-G7
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20:44: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 1sxBe0-000642-FT
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sxBe0-0001SQ-ED
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=L5vcyIfnxTFf9qUCEO6Un5IxwrORg8vxH7akliI/Hjo=; b=E2Fgp3qSw8aKZYaJmo4dm6bHF+
	0e85Q5JxAyOyOKNJRnFDdIHdbgViWb8B5apE4yvnJe2pzpZka6Pw5Ua3p/LeQSMb77uBO+TSGopMI
	bkB6Gn8YCRLBtCcfkXgmbnXkHLCn9YJ18/NCZbqBL6aLI8IkUfW6QnVjlICAwKvUeFB8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Fix builds following qemu-xen update
Message-Id: <E1sxBe0-0001SQ-ED@xenbits.xenproject.org>
Date: Sat, 05 Oct 2024 20:44:52 +0000

commit 1223375d8b7faf0eab642834292bf4924e40f425
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Oct 4 14:27:02 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 4 19:27:40 2024 +0100

    CI: Fix builds following qemu-xen update
    
    A recent update to qemu-xen has bumped the build requirements, with Python 3.8
    being the new baseline but also needing the 'ensurepip' and 'tomllib/tomli'
    packages.
    
     * Ubuntu/Debian package 'ensurepip' separately, but it can be obtained by
       installing the python3-venv package.
    
     * 'tomllib' was added to the python standard library in Python 3.11, but
       previously it was a separate package named 'tomli'.
    
    In terms of changes required to build QEMU:
    
     * Ubuntu 24.04 (Noble) has Python 3.12 so only needs python3-venv
    
     * Ubuntu 22.04 (Jammy) has Python 3.10 but does have a python3-tomli package
       that QEMU is happy with.
    
     * FreeBSD has Python 3.9, but Python 3.11 is available.
    
    In terms of exclusions:
    
     * Ubuntu 20.04 (Focal) has Python 3.8, but lacks any kind of tomli package.
    
     * Fedora 29 (Python 3.7), OpenSUSE Leap 15.6 (Python 3.6), and Ubuntu
       18.04/Bionic (Python 3.6) are now too old.
    
    Detecting tomllib/tomli is more than can fit in build's one-liner, so break it
    out into a proper script.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 .cirrus.yml                                     |  3 ++-
 automation/build/ubuntu/22.04-x86_64.dockerfile |  2 ++
 automation/build/ubuntu/24.04-x86_64.dockerfile |  1 +
 automation/scripts/build                        |  4 ++--
 automation/scripts/qemu-deps-check.py           | 19 +++++++++++++++++++
 5 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/.cirrus.yml b/.cirrus.yml
index 1c2a6cb812..00e4c57678 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -7,10 +7,11 @@ freebsd_template: &FREEBSD_TEMPLATE
   install_script: pkg install -y seabios gmake ninja bash
                                  pkgconf python bison perl5
                                  yajl lzo2 pixman argp-standalone
-                                 libxml2 glib git
+                                 libxml2 glib git python311
 
   build_script:
     - cc --version
+    - export PYTHON=/usr/local/bin/python3.11
     - ./configure --with-system-seabios=/usr/local/share/seabios/bios.bin
     - gmake -j`sysctl -n hw.ncpu` clang=y
 
diff --git a/automation/build/ubuntu/22.04-x86_64.dockerfile b/automation/build/ubuntu/22.04-x86_64.dockerfile
index 230903f624..6aa3c4d188 100644
--- a/automation/build/ubuntu/22.04-x86_64.dockerfile
+++ b/automation/build/ubuntu/22.04-x86_64.dockerfile
@@ -62,6 +62,8 @@ RUN <<EOF
         meson
         ninja-build
         python3-packaging
+        python3-tomli
+        python3-venv
     )
 
     apt-get -y --no-install-recommends install "${DEPS[@]}"
diff --git a/automation/build/ubuntu/24.04-x86_64.dockerfile b/automation/build/ubuntu/24.04-x86_64.dockerfile
index 277f92facf..c46d152abf 100644
--- a/automation/build/ubuntu/24.04-x86_64.dockerfile
+++ b/automation/build/ubuntu/24.04-x86_64.dockerfile
@@ -62,6 +62,7 @@ RUN <<EOF
         meson
         ninja-build
         python3-packaging
+        python3-venv
     )
 
     apt-get -y --no-install-recommends install "${DEPS[@]}"
diff --git a/automation/scripts/build b/automation/scripts/build
index 1879c1db6d..34416297a4 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -91,9 +91,9 @@ else
         cfgargs+=("--with-extra-qemuu-configure-args=\"--disable-werror\"")
     fi
 
-    # Qemu requires Python 3.5 or later, and ninja
+    # Qemu requires Python 3.8 or later, and ninja
     # and Clang 10 or later
-    if ! type python3 || python3 -c "import sys; res = sys.version_info < (3, 5); exit(not(res))" \
+    if ! type python3 || ! python3 automation/scripts/qemu-deps-check.py \
             || [[ "$cc_is_clang" == y && "$cc_ver" -lt 0x0a0000 ]] \
             || ! type ninja; then
         cfgargs+=("--with-system-qemu=/bin/false")
diff --git a/automation/scripts/qemu-deps-check.py b/automation/scripts/qemu-deps-check.py
new file mode 100755
index 0000000000..f6188afb3e
--- /dev/null
+++ b/automation/scripts/qemu-deps-check.py
@@ -0,0 +1,19 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+import sys
+
+if sys.version_info < (3, 8):
+    print("Python %d.%d.%d too old" %
+          (sys.version_info.major,
+           sys.version_info.minor,
+           sys.version_info.micro))
+    exit(1)
+
+try:
+    import tomllib
+except ImportError:
+    try:
+        import tomli
+    except ImportError:
+        print("No tomli")
+        exit(1)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Oct 05 20:45:03 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 05 Oct 2024 20:45:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.811069.1223734 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sxBeB-0002Ug-FD; Sat, 05 Oct 2024 20:45:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 811069.1223734; Sat, 05 Oct 2024 20:45:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sxBeB-0002UY-Cj; Sat, 05 Oct 2024 20:45:03 +0000
Received: by outflank-mailman (input) for mailman id 811069;
 Sat, 05 Oct 2024 20:45: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 1sxBeA-0002UO-JT
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20:45: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 1sxBeA-00064g-Ik
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20:45:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sxBeA-0001TT-Hd
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20:45:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZBHbDLAxMm6rjuYO2hMR39BtyDjkzye4GNL0qR2EyQ0=; b=pMlyEQFPuehn5fBDxKG96Ho9ET
	XL14fdsCoYS+2/4mpczOY0Qrm0BFLXDKGmhNUBYSJfyjo0Rxq4SpN6tImBRuz4DHHLtrCwlHOlCXo
	bgjQd5h5zBEzvqtPHYIanZTOX+kjcZMQLIPD8Ct+g2Z0tYOCfcGUVE3/6ekspaSEjihA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] EFI: address a violation of MISRA C Rule 13.6
Message-Id: <E1sxBeA-0001TT-Hd@xenbits.xenproject.org>
Date: Sat, 05 Oct 2024 20:45:02 +0000

commit 6f621f23bc3eb76fd8440d69ef4ed6bec0fb2eff
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Mon Sep 30 14:49:15 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Oct 4 14:23:15 2024 -0700

    EFI: address a violation of MISRA C Rule 13.6
    
    guest_handle_ok()'s expansion contains a sizeof() involving its
    first argument which is guest_handle_cast().
    The expansion of the latter, in turn, contains a variable
    initialization.
    
    Since MISRA considers the initialization (even of a local variable)
    a side effect, the chain of expansions mentioned above violates
    MISRA C:2012 Rule 13.6 (The operand of the `sizeof' operator shall not
    contain any expression which has potential side effect).
    
    Refactor the code to address the rule violation.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/common/efi/runtime.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c
index d03e5c90ce..acf08dcaa3 100644
--- a/xen/common/efi/runtime.c
+++ b/xen/common/efi/runtime.c
@@ -250,14 +250,20 @@ int efi_get_info(uint32_t idx, union xenpf_efi_info *info)
         info->cfg.addr = __pa(efi_ct);
         info->cfg.nent = efi_num_ct;
         break;
+
     case XEN_FW_EFI_VENDOR:
+    {
+        XEN_GUEST_HANDLE_PARAM(CHAR16) vendor_name =
+            guest_handle_cast(info->vendor.name, CHAR16);
+
         if ( !efi_fw_vendor )
             return -EOPNOTSUPP;
+
         info->vendor.revision = efi_fw_revision;
         n = info->vendor.bufsz / sizeof(*efi_fw_vendor);
-        if ( !guest_handle_okay(guest_handle_cast(info->vendor.name,
-                                                  CHAR16), n) )
+        if ( !guest_handle_okay(vendor_name, n) )
             return -EFAULT;
+
         for ( i = 0; i < n; ++i )
         {
             if ( __copy_to_guest_offset(info->vendor.name, i,
@@ -267,6 +273,8 @@ int efi_get_info(uint32_t idx, union xenpf_efi_info *info)
                 break;
         }
         break;
+    }
+
     case XEN_FW_EFI_MEM_INFO:
         for ( i = 0; i < efi_memmap_size; i += efi_mdesc_size )
         {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Oct 05 20:45:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 05 Oct 2024 20:45:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.811070.1223738 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sxBeL-0002XW-Gv; Sat, 05 Oct 2024 20:45:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 811070.1223738; Sat, 05 Oct 2024 20:45:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sxBeL-0002XL-EA; Sat, 05 Oct 2024 20:45:13 +0000
Received: by outflank-mailman (input) for mailman id 811070;
 Sat, 05 Oct 2024 20:45: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 1sxBeK-0002X8-MX
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20:45: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 1sxBeK-00064r-Lp
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20:45:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sxBeK-0001Vt-L0
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20:45:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nG/GKTpIfpq4TeXCIQGXe4CAnriAG1zoxg3B+jIkLbM=; b=g6nXWETU835mO/WgxXJ25h6C3o
	O4thwQDyiWsn8GgZiwBWHwshoNR7IwjLoW4cA/HV6Wr669Kz0LaZ9Y6S47lS+vmRDMJmWv5qkArO+
	1ABN0AamFLaVxiAegNCOzoImwYHg70rh7fX/jxIBFlFDf3FMpoMAUsMxnRPvauK8q9R4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/gnttab: address a violation of MISRA C Rule 13.6
Message-Id: <E1sxBeK-0001Vt-L0@xenbits.xenproject.org>
Date: Sat, 05 Oct 2024 20:45:12 +0000

commit a0094dc136c35e8602f5a01a34904e4e5e2e6b19
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Mon Sep 30 14:49:16 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Oct 4 14:24:05 2024 -0700

    xen/gnttab: address a violation of MISRA C Rule 13.6
    
    guest_handle_ok()'s expansion contains a sizeof() involving its
    first argument guest_handle_cast().
    The expansion of the latter, in turn, contains a variable
    initialization.
    
    Since MISRA considers the initialization (even of a local variable)
    a side effect, the chain of expansions mentioned above violates
    MISRA C:2012 Rule 13.6 (The operand of the `sizeof' operator shall not
    contain any expression which has potential side effect).
    
    Refactor the code to address the rule violation.
    
    Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/compat/grant_table.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/xen/common/compat/grant_table.c b/xen/common/compat/grant_table.c
index 5ad0debf96..bbb717bf64 100644
--- a/xen/common/compat/grant_table.c
+++ b/xen/common/compat/grant_table.c
@@ -78,12 +78,15 @@ int compat_grant_table_op(
         cmd_op = cmd;
     switch ( cmd_op )
     {
-#define CASE(name) \
-    case GNTTABOP_##name: \
-        if ( unlikely(!guest_handle_okay(guest_handle_cast(uop, \
-                                                           gnttab_##name##_compat_t), \
-                                         count)) ) \
-            rc = -EFAULT; \
+#define CASE(name)                                                  \
+    case GNTTABOP_ ## name:                                         \
+    {                                                               \
+        XEN_GUEST_HANDLE_PARAM(gnttab_ ## name ## _compat_t) h =    \
+            guest_handle_cast(uop, gnttab_ ## name ## _compat_t);   \
+                                                                    \
+        if ( unlikely(!guest_handle_okay(h, count)) )               \
+            rc = -EFAULT;                                           \
+    }                                                               \
         break
 
 #ifndef CHECK_gnttab_map_grant_ref
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Oct 05 20:45:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 05 Oct 2024 20:45:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.811071.1223742 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sxBeV-0002aW-IM; Sat, 05 Oct 2024 20:45:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 811071.1223742; Sat, 05 Oct 2024 20:45:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sxBeV-0002aO-Fc; Sat, 05 Oct 2024 20:45:23 +0000
Received: by outflank-mailman (input) for mailman id 811071;
 Sat, 05 Oct 2024 20:45: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 1sxBeU-0002aI-PI
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20:45: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 1sxBeU-00064z-Oc
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20:45:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sxBeU-0001Wd-Nq
 for xen-changelog@lists.xenproject.org; Sat, 05 Oct 2024 20:45:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5eOJeZcOQhd25dbMi4oFxErGDxHx7FJDTK63XuAUEjE=; b=cfPKPrRSA9/Rb6BZVQvizZluV0
	N+8Aap//V6T8bswGhnz45Z9RM1f4VIzICpyzvo+6Y8Mtx6f8Bz1UGpvXQ224y5N4Q+J7P+GmmjNqp
	jhheCzsvUfyLgJRz+0pAaT/Le8YTRfkr9kbOeAyeeRv1HsOEOSvCLwO6z5MPmnSeZd2E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation/eclair: tag Rule 13.6 as clean
Message-Id: <E1sxBeU-0001Wd-Nq@xenbits.xenproject.org>
Date: Sat, 05 Oct 2024 20:45:22 +0000

commit 6b20755c24ccd69d2482b45dfb9193940cdc346e
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Mon Sep 30 14:49:17 2024 +0200
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Fri Oct 4 14:24:58 2024 -0700

    automation/eclair: tag Rule 13.6 as clean
    
    Update ECLAIR configuration to consider Rule 13.6 as clean:
    new violations of this rule will cause a failure of the CI pipeline.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/tagging.ecl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index b8448938e6..76032b1fe1 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -60,6 +60,7 @@ MC3R1.R11.6||
 MC3R1.R11.7||
 MC3R1.R11.9||
 MC3R1.R12.5||
+MC3R1.R13.6||
 MC3R1.R14.1||
 MC3R1.R14.3||
 MC3R1.R14.4||
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Oct 07 09:22:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 07 Oct 2024 09:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.811793.1224446 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sxjwL-0002Sv-Q7; Mon, 07 Oct 2024 09:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 811793.1224446; Mon, 07 Oct 2024 09: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 1sxjwL-0002Sn-NV; Mon, 07 Oct 2024 09:22:05 +0000
Received: by outflank-mailman (input) for mailman id 811793;
 Mon, 07 Oct 2024 09: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 1sxjwJ-0002Sb-U1
 for xen-changelog@lists.xenproject.org; Mon, 07 Oct 2024 09: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 1sxjwJ-0004ue-QX
 for xen-changelog@lists.xenproject.org; Mon, 07 Oct 2024 09:22:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sxjwJ-0001bN-Oh
 for xen-changelog@lists.xenproject.org; Mon, 07 Oct 2024 09: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=sai0BZRUOxFfbKoBgecnN0TybWpTgRUKirybqIPhyxM=; b=lobCNV2ybliRxN/X2tL8THCqB4
	gZlZMbEtwhrxiMQ8dtm2whHwlJWqSc2iKzYAiEjYExYX98eTID5UK3b6De62mkT98NVcQKqRiUST4
	eeQ4HBxmTpPP6WEqddgqeF8QbkQfLVWVekqMZcJ+Nq76HmA1/pWfqzGRdjJQcpwvNpVg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] efi: address violation of MISRA C Rule 16.3
Message-Id: <E1sxjwJ-0001bN-Oh@xenbits.xenproject.org>
Date: Mon, 07 Oct 2024 09:22:03 +0000

commit ceefa8c0391c39c07ff642b3ae989240d82a04a3
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Mon Oct 7 11:08:18 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Oct 7 11:08:18 2024 +0200

    efi: address violation of MISRA C Rule 16.3
    
    Use agreed syntax for pseudo-keyword fallthrough to meet the
    requirements to deviate a violation of MISRA C:2012 Rule 16.3:
    "An unconditional `break' statement shall terminate every
    switch-clause".
    
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/common/efi/runtime.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c
index acf08dcaa3..7e1fce291d 100644
--- a/xen/common/efi/runtime.c
+++ b/xen/common/efi/runtime.c
@@ -699,7 +699,7 @@ int efi_runtime_call(struct xenpf_efi_runtime_call *op)
 
         if ( !efi_enabled(EFI_RS) || (efi_rs->Hdr.Revision >> 16) < 2 )
             return -EOPNOTSUPP;
-        /* XXX fall through for now */
+        fallthrough; /* XXX fall through for now */
     default:
         return -ENOSYS;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Oct 07 09:22:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 07 Oct 2024 09:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.811794.1224451 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sxjwV-0002dF-S8; Mon, 07 Oct 2024 09:22:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 811794.1224451; Mon, 07 Oct 2024 09: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 1sxjwV-0002d7-PB; Mon, 07 Oct 2024 09:22:15 +0000
Received: by outflank-mailman (input) for mailman id 811794;
 Mon, 07 Oct 2024 09: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 1sxjwT-0002aM-V8
 for xen-changelog@lists.xenproject.org; Mon, 07 Oct 2024 09: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 1sxjwT-0004uk-TY
 for xen-changelog@lists.xenproject.org; Mon, 07 Oct 2024 09:22:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sxjwT-0001cK-Se
 for xen-changelog@lists.xenproject.org; Mon, 07 Oct 2024 09: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=7N7YuqROXTrk9ujN8g7e215JvW2zWi+TOeyNH/yaNoo=; b=Ufd15nXlt9B2lK9qfNWkkQPgLz
	4Yv1ORxlO/DoUdwCMVvOEqxYXLsKNM5jV85zaysLksTbbhgceks9c6iiivDquOZR85auiqwYzID84
	YhiM5+xixV4x3Wt0yhhquPsWBwYCnA14eg5+tmB4NrWQZzoTGg5ZBgv3n3DKPPk9D0/E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CODING_STYLE: header file guard naming rules
Message-Id: <E1sxjwT-0001cK-Se@xenbits.xenproject.org>
Date: Mon, 07 Oct 2024 09:22:13 +0000

commit a7201c021174efc908d939079db5bb2f89962a0d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Oct 7 11:10:05 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Oct 7 11:10:05 2024 +0200

    CODING_STYLE: header file guard naming rules
    
    Provide a (small) set of rules on how header guard identifiers ought to
    be spelled and what precautions ought to be taken to avoid name
    collisions.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 CODING_STYLE | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/CODING_STYLE b/CODING_STYLE
index 7f6e9ad065..554c69a16a 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -153,6 +153,48 @@ E.g. timer-works.
 Note that some of the options and filenames are using '_'. This is now
 deprecated.
 
+Header inclusion guards
+-----------------------
+
+Unless otherwise specified, all header files should include proper
+guards to prevent multiple inclusions. The following naming conventions
+apply:
+
+- Guard names are derived from directory path underneath xen/ and the
+  actual file name.  Path components are separated by double
+  underscores.  Alphabetic characters are converted to upper case.  Non-
+  alphanumeric characters are replaced by single underscores.
+- Certain directory components are omitted, to keep identifier length
+  bounded:
+  - the top level include/,
+  - architecture-specific private files' arch/,
+  - any architecture's arch/<arch>/include/asm/ collapses to
+    ASM__<ARCH>__.
+
+For example:
+
+- Xen headers: XEN__<filename>_H
+  - include/xen/something.h -> XEN__SOMETHING_H
+
+- asm-generic headers: ASM_GENERIC__<filename>_H
+  - include/asm-generic/something.h -> ASM_GENERIC__SOMETHING_H
+
+- arch-specific headers: ASM__<architecture>__<subdir>__<filename>_H
+  - arch/x86/include/asm/something.h -> ASM__X86__SOMETHING_H
+
+- Private headers: <dir>__<filename>_H
+  - arch/arm/arm64/lib/something.h -> ARM__ARM64__LIB__SOMETHING_H
+  - arch/x86/lib/something.h -> X86__LIB__SOMETHING_H
+  - common/something.h -> COMMON__SOMETHING_H
+
+Note that this requires some discipline on the naming of future new
+sub-directories: There shouldn't be any other asm/ one anywhere, for
+example.  Nor should any new ports be named the same as top-level
+(within xen/) directories.  Which may in turn require some care if any
+new top-level directories were to be added.  Rule of thumb: Whenever
+adding a new subdirectory, check the rules to prevent any potential
+collisions.
+
 Emacs local variables
 ---------------------
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Oct 07 09:22:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 07 Oct 2024 09:22:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.811795.1224454 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sxjwf-0002mM-TG; Mon, 07 Oct 2024 09:22:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 811795.1224454; Mon, 07 Oct 2024 09: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 1sxjwf-0002mF-Qe; Mon, 07 Oct 2024 09:22:25 +0000
Received: by outflank-mailman (input) for mailman id 811795;
 Mon, 07 Oct 2024 09:22: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 1sxjwe-0002ka-1E
 for xen-changelog@lists.xenproject.org; Mon, 07 Oct 2024 09:22: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 1sxjwe-0004wS-0O
 for xen-changelog@lists.xenproject.org; Mon, 07 Oct 2024 09:22:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sxjwd-0001dO-Vi
 for xen-changelog@lists.xenproject.org; Mon, 07 Oct 2024 09: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=lfAlGTwdmkxLut3Ws55pkBHeIRR4NcaTbrNMBqIyIk8=; b=DTRBj6zFKnYgVDTpwvNsFDPEMi
	J2mr2D2Ki70PrJgX9VY1qnKATJKLMMErx4RBDozxUuICImFz2rCOY3uGJbOvHQVtDz0b+ScHaN3jj
	nOU73I26f7QRqMPdF0SR463Iu9lvs5mQQQ5FDXfR0zY/WMY1KdgtZ+8Ea4siMj4Qb6Ow=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/dpci: do not leak pending interrupts on CPU offline
Message-Id: <E1sxjwd-0001dO-Vi@xenbits.xenproject.org>
Date: Mon, 07 Oct 2024 09:22:23 +0000

commit 29555668b5725b9d5393b72bfe7ff9a3fa606714
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Oct 7 11:10:21 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Oct 7 11:10:21 2024 +0200

    x86/dpci: do not leak pending interrupts on CPU offline
    
    The current dpci logic relies on a softirq being executed as a side effect of
    the cpu_notifier_call_chain() call in the code path that offlines the target
    CPU.  However the call to cpu_notifier_call_chain() won't trigger any softirq
    processing, and even if it did, such processing should be done after all
    interrupts have been migrated off the current CPU, otherwise new pending dpci
    interrupts could still appear.
    
    Currently the ASSERT() in the cpu callback notifier is fairly easy to trigger
    by doing CPU offline from a PVH dom0.
    
    Solve this by instead moving out any dpci interrupts pending processing once
    the CPU is dead.  This might introduce more latency than attempting to drain
    before the CPU is put offline, but it's less complex, and CPU online/offline is
    not a common action.  Any extra introduced latency should be tolerable.
    
    Fixes: f6dd295381f4 ('dpci: replace tasklet with softirq')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/drivers/passthrough/x86/hvm.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index d3627e4af7..f5faff7a49 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -1105,23 +1105,27 @@ static int cf_check cpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;
+    unsigned long flags;
 
     switch ( action )
     {
     case CPU_UP_PREPARE:
         INIT_LIST_HEAD(&per_cpu(dpci_list, cpu));
         break;
+
     case CPU_UP_CANCELED:
-    case CPU_DEAD:
-        /*
-         * On CPU_DYING this callback is called (on the CPU that is dying)
-         * with an possible HVM_DPIC_SOFTIRQ pending - at which point we can
-         * clear out any outstanding domains (by the virtue of the idle loop
-         * calling the softirq later). In CPU_DEAD case the CPU is deaf and
-         * there are no pending softirqs for us to handle so we can chill.
-         */
         ASSERT(list_empty(&per_cpu(dpci_list, cpu)));
         break;
+
+    case CPU_DEAD:
+        if ( list_empty(&per_cpu(dpci_list, cpu)) )
+            break;
+        /* Take whatever dpci interrupts are pending on the dead CPU. */
+        local_irq_save(flags);
+        list_splice_init(&per_cpu(dpci_list, cpu), &this_cpu(dpci_list));
+        local_irq_restore(flags);
+        raise_softirq(HVM_DPCI_SOFTIRQ);
+        break;
     }
 
     return NOTIFY_DONE;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 08 04:55:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 08 Oct 2024 04:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.812608.1225375 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sy2FS-0000fN-BJ; Tue, 08 Oct 2024 04:55:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 812608.1225375; Tue, 08 Oct 2024 04: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 1sy2FS-0000fF-7c; Tue, 08 Oct 2024 04:55:02 +0000
Received: by outflank-mailman (input) for mailman id 812608;
 Tue, 08 Oct 2024 04: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 1sy2FR-0000f9-Oq
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 04: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 1sy2FR-0000yM-O5
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 04:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sy2FR-0002zh-LV
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 04: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=BLthCovO3saNg7+wGD/vV4hkeUkjOE199h0VIIgT9F8=; b=enTjyiohZcYTp0ymc4RU1LJjxP
	VVZJwriH/PSr2a8mdDMyIHVw3e+Zuj6DyuhdTffSwuK2TT1D6GDifFwYMJJGYJHUso9/oqAgkZsn7
	dhCCy0hj+lDyuuqfyWax3KJ32FdhjbIsdDklD40MitBrKAIETHf+xw3ZsiDLLQl8KA70=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] efi: address violation of MISRA C Rule 16.3
Message-Id: <E1sy2FR-0002zh-LV@xenbits.xenproject.org>
Date: Tue, 08 Oct 2024 04:55:01 +0000

commit ceefa8c0391c39c07ff642b3ae989240d82a04a3
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Mon Oct 7 11:08:18 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Oct 7 11:08:18 2024 +0200

    efi: address violation of MISRA C Rule 16.3
    
    Use agreed syntax for pseudo-keyword fallthrough to meet the
    requirements to deviate a violation of MISRA C:2012 Rule 16.3:
    "An unconditional `break' statement shall terminate every
    switch-clause".
    
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/common/efi/runtime.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/efi/runtime.c b/xen/common/efi/runtime.c
index acf08dcaa3..7e1fce291d 100644
--- a/xen/common/efi/runtime.c
+++ b/xen/common/efi/runtime.c
@@ -699,7 +699,7 @@ int efi_runtime_call(struct xenpf_efi_runtime_call *op)
 
         if ( !efi_enabled(EFI_RS) || (efi_rs->Hdr.Revision >> 16) < 2 )
             return -EOPNOTSUPP;
-        /* XXX fall through for now */
+        fallthrough; /* XXX fall through for now */
     default:
         return -ENOSYS;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Oct 08 04:55:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 08 Oct 2024 04:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.812609.1225379 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sy2Fc-0000hB-Bz; Tue, 08 Oct 2024 04:55:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 812609.1225379; Tue, 08 Oct 2024 04: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 1sy2Fc-0000h3-96; Tue, 08 Oct 2024 04:55:12 +0000
Received: by outflank-mailman (input) for mailman id 812609;
 Tue, 08 Oct 2024 04: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 1sy2Fb-0000gv-Rw
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 04: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 1sy2Fb-0000yV-RD
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 04:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sy2Fb-00030k-QC
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 04: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=dtltuyxHWuz6vBQRtFzwScalBRquAXpRupU9XgFGM6M=; b=D9vYWbsQ5r4qnBdcSf/AATS9tW
	xal1bnwL93O4EMrnVGR/v7tbYLDRdoisS8IPlM6FxSeaGWdrpyqBUiyI6bwtqvBXJ57f1guabFAuJ
	pbc162ITd0bMpXBwMegtMNaxCDxilV7ahQZOtnxpj6+l1LE+ZtklNtXnwQULRWY3iuXQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CODING_STYLE: header file guard naming rules
Message-Id: <E1sy2Fb-00030k-QC@xenbits.xenproject.org>
Date: Tue, 08 Oct 2024 04:55:11 +0000

commit a7201c021174efc908d939079db5bb2f89962a0d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Mon Oct 7 11:10:05 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Oct 7 11:10:05 2024 +0200

    CODING_STYLE: header file guard naming rules
    
    Provide a (small) set of rules on how header guard identifiers ought to
    be spelled and what precautions ought to be taken to avoid name
    collisions.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 CODING_STYLE | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/CODING_STYLE b/CODING_STYLE
index 7f6e9ad065..554c69a16a 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -153,6 +153,48 @@ E.g. timer-works.
 Note that some of the options and filenames are using '_'. This is now
 deprecated.
 
+Header inclusion guards
+-----------------------
+
+Unless otherwise specified, all header files should include proper
+guards to prevent multiple inclusions. The following naming conventions
+apply:
+
+- Guard names are derived from directory path underneath xen/ and the
+  actual file name.  Path components are separated by double
+  underscores.  Alphabetic characters are converted to upper case.  Non-
+  alphanumeric characters are replaced by single underscores.
+- Certain directory components are omitted, to keep identifier length
+  bounded:
+  - the top level include/,
+  - architecture-specific private files' arch/,
+  - any architecture's arch/<arch>/include/asm/ collapses to
+    ASM__<ARCH>__.
+
+For example:
+
+- Xen headers: XEN__<filename>_H
+  - include/xen/something.h -> XEN__SOMETHING_H
+
+- asm-generic headers: ASM_GENERIC__<filename>_H
+  - include/asm-generic/something.h -> ASM_GENERIC__SOMETHING_H
+
+- arch-specific headers: ASM__<architecture>__<subdir>__<filename>_H
+  - arch/x86/include/asm/something.h -> ASM__X86__SOMETHING_H
+
+- Private headers: <dir>__<filename>_H
+  - arch/arm/arm64/lib/something.h -> ARM__ARM64__LIB__SOMETHING_H
+  - arch/x86/lib/something.h -> X86__LIB__SOMETHING_H
+  - common/something.h -> COMMON__SOMETHING_H
+
+Note that this requires some discipline on the naming of future new
+sub-directories: There shouldn't be any other asm/ one anywhere, for
+example.  Nor should any new ports be named the same as top-level
+(within xen/) directories.  Which may in turn require some care if any
+new top-level directories were to be added.  Rule of thumb: Whenever
+adding a new subdirectory, check the rules to prevent any potential
+collisions.
+
 Emacs local variables
 ---------------------
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Oct 08 04:55:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 08 Oct 2024 04:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.812610.1225382 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sy2Fn-0000k6-D3; Tue, 08 Oct 2024 04:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 812610.1225382; Tue, 08 Oct 2024 04: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 1sy2Fn-0000jy-Ad; Tue, 08 Oct 2024 04:55:23 +0000
Received: by outflank-mailman (input) for mailman id 812610;
 Tue, 08 Oct 2024 04: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 1sy2Fl-0000jn-VT
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 04:55: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 1sy2Fl-0000z0-UI
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 04:55:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sy2Fl-00031V-TJ
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 04:55:21 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=UZKw+RiYVpdde0UTr8Wf1dnF0zNm7JkNUbvUvj1GuiI=; b=jQlLHrnqo0rYuEaUag+6DruzmF
	iJaRFfVk1oLHQlpugHm6U0vqQ8M5HCISZfFpbLiIQug15G6KOVFSH9RbTwPn5IAgeI5nPKMIxlFEw
	mGa9M7YdC6fuCnsORWuA+OrvO+CVkSQkmXDeWeRNxEn6TTKH+X6UWF2JC1DNaZ/bK/X8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/dpci: do not leak pending interrupts on CPU offline
Message-Id: <E1sy2Fl-00031V-TJ@xenbits.xenproject.org>
Date: Tue, 08 Oct 2024 04:55:21 +0000

commit 29555668b5725b9d5393b72bfe7ff9a3fa606714
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Mon Oct 7 11:10:21 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Mon Oct 7 11:10:21 2024 +0200

    x86/dpci: do not leak pending interrupts on CPU offline
    
    The current dpci logic relies on a softirq being executed as a side effect of
    the cpu_notifier_call_chain() call in the code path that offlines the target
    CPU.  However the call to cpu_notifier_call_chain() won't trigger any softirq
    processing, and even if it did, such processing should be done after all
    interrupts have been migrated off the current CPU, otherwise new pending dpci
    interrupts could still appear.
    
    Currently the ASSERT() in the cpu callback notifier is fairly easy to trigger
    by doing CPU offline from a PVH dom0.
    
    Solve this by instead moving out any dpci interrupts pending processing once
    the CPU is dead.  This might introduce more latency than attempting to drain
    before the CPU is put offline, but it's less complex, and CPU online/offline is
    not a common action.  Any extra introduced latency should be tolerable.
    
    Fixes: f6dd295381f4 ('dpci: replace tasklet with softirq')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/drivers/passthrough/x86/hvm.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index d3627e4af7..f5faff7a49 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -1105,23 +1105,27 @@ static int cf_check cpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;
+    unsigned long flags;
 
     switch ( action )
     {
     case CPU_UP_PREPARE:
         INIT_LIST_HEAD(&per_cpu(dpci_list, cpu));
         break;
+
     case CPU_UP_CANCELED:
-    case CPU_DEAD:
-        /*
-         * On CPU_DYING this callback is called (on the CPU that is dying)
-         * with an possible HVM_DPIC_SOFTIRQ pending - at which point we can
-         * clear out any outstanding domains (by the virtue of the idle loop
-         * calling the softirq later). In CPU_DEAD case the CPU is deaf and
-         * there are no pending softirqs for us to handle so we can chill.
-         */
         ASSERT(list_empty(&per_cpu(dpci_list, cpu)));
         break;
+
+    case CPU_DEAD:
+        if ( list_empty(&per_cpu(dpci_list, cpu)) )
+            break;
+        /* Take whatever dpci interrupts are pending on the dead CPU. */
+        local_irq_save(flags);
+        list_splice_init(&per_cpu(dpci_list, cpu), &this_cpu(dpci_list));
+        local_irq_restore(flags);
+        raise_softirq(HVM_DPCI_SOFTIRQ);
+        break;
     }
 
     return NOTIFY_DONE;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Oct 08 11:22:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 08 Oct 2024 11:22:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.813013.1225774 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sy8I1-0006Ql-NY; Tue, 08 Oct 2024 11:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 813013.1225774; Tue, 08 Oct 2024 11: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 1sy8I1-0006Qe-L2; Tue, 08 Oct 2024 11:22:05 +0000
Received: by outflank-mailman (input) for mailman id 813013;
 Tue, 08 Oct 2024 11: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 1sy8I0-0006QQ-22
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 11: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 1sy8Hz-00009K-UY
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 11:22:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sy8Hz-0000Bu-T1
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 11: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=j8x73CkOHRU3bkm1qKFtChSAKuMDYOHvsa14O5bVbGQ=; b=JphyGB/f+i71zVvcG+ppmJkmLy
	ZyjFITWLaMuskuMy1dYIibCPLlaXQbBniwo1+NqmSxLkTtTGTiHOAoSwcO1bfNCPzwzWGQGtUgppB
	YkM8Pb1UFhMPFXwKzyUo0zTDCQy+DZwH9v1vZoJtTgqgU/9Ksd3QKJB7OakrnqH9cO5I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] stubdom: swtich to local .gitignore file
Message-Id: <E1sy8Hz-0000Bu-T1@xenbits.xenproject.org>
Date: Tue, 08 Oct 2024 11:22:03 +0000

commit e07ae82853121f0434608d8aee1d467736afe6b1
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sat Oct 5 17:15:45 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 8 11:15:08 2024 +0100

    stubdom: swtich to local .gitignore file
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 .gitignore         | 37 +------------------------------------
 stubdom/.gitignore | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 36 deletions(-)

diff --git a/.gitignore b/.gitignore
index d88be80b28..5c13fb5878 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,7 +39,6 @@ cscope.po.out
 .vscode
 
 dist
-stubdom/*.tar.gz
 
 autom4te.cache/
 automation/build/yocto/*.dockerfile
@@ -66,41 +65,7 @@ docs/pdf/
 docs/txt/
 extras/
 install/*
-stubdom/*-minios-config.mk
-stubdom/autom4te.cache/
-stubdom/binutils-*
-stubdom/config.cache
-stubdom/config.log
-stubdom/config.status
-stubdom/cross-root-*
-stubdom/gcc-*
-stubdom/gmp-*
-stubdom/grub-*
-stubdom/include
-stubdom/ioemu
-stubdom/ioemu/
-stubdom/libs-*
-stubdom/libxencall-*
-stubdom/libxenevtchn-*
-stubdom/libxenforeignmemory-*
-stubdom/libxengnttab-*
-stubdom/libxentoolcore-*
-stubdom/libxentoollog-*
-stubdom/lwip-*
-stubdom/lwip/
-stubdom/mini-os-*
-stubdom/mk-headers-*
-stubdom/newlib-1.*
-stubdom/newlib-x86*
-stubdom/pciutils-*
-stubdom/pkg-config/*
-stubdom/polarssl-*
-stubdom/stubdompath.sh
-stubdom/tpm_emulator-*
-stubdom/vtpm/vtpm_manager.h
-stubdom/xenstore
-stubdom/xenstorepvh
-stubdom/zlib-*
+
 tools/*/build/lib*/*.py
 tools/autom4te.cache/
 tools/config.h
diff --git a/stubdom/.gitignore b/stubdom/.gitignore
new file mode 100644
index 0000000000..10e2547a22
--- /dev/null
+++ b/stubdom/.gitignore
@@ -0,0 +1,36 @@
+/*.tar.gz
+/*-minios-config.mk
+/autom4te.cache/
+/binutils-*
+/config.cache
+/config.log
+/config.status
+/cross-root-*
+/gcc-*
+/gmp-*
+/grub-*
+/include
+/ioemu
+/ioemu/
+/libs-*
+/libxencall-*
+/libxenevtchn-*
+/libxenforeignmemory-*
+/libxengnttab-*
+/libxentoolcore-*
+/libxentoollog-*
+/lwip-*
+/lwip/
+/mini-os-*
+/mk-headers-*
+/newlib-1.*
+/newlib-x86*
+/pciutils-*
+/pkg-config/*
+/polarssl-*
+/stubdompath.sh
+/tpm_emulator-*
+/vtpm/vtpm_manager.h
+/xenstore
+/xenstorepvh
+/zlib-*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 08 11:22:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 08 Oct 2024 11:22:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.813014.1225779 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sy8IA-0006SR-PE; Tue, 08 Oct 2024 11:22:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 813014.1225779; Tue, 08 Oct 2024 11: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 1sy8IA-0006SK-Mb; Tue, 08 Oct 2024 11:22:14 +0000
Received: by outflank-mailman (input) for mailman id 813014;
 Tue, 08 Oct 2024 11: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 1sy8IA-0006S8-2H
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 11: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 1sy8IA-00009R-1a
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 11:22:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sy8IA-0000Cj-0Y
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 11: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=zqEPPEQ0pTSgUMCWGwBfaRixaOi5l5MYjszSLwPZfyI=; b=0x2S2f0Q+QjKk/HwTBor2FWER6
	YcDLQVZ5oseEt689GKJ3hkR7nVkb+jHi6Ru21fFXQx/Ipo29bVzy9RZgLYoOqNF47TILbNZXDjaN6
	WX/api/o1wNzdTkD86p/9HTtac0CFvozqZqmO1pDke+cicmyjwLix99x6zwJQ9uPzLIg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] stubdom: explcitly add libc and lwip Mini-OS config options
Message-Id: <E1sy8IA-0000Cj-0Y@xenbits.xenproject.org>
Date: Tue, 08 Oct 2024 11:22:14 +0000

commit c66c1341750beb6aa32cc2aeb4f80fddd2bcd490
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sat Oct 5 17:15:46 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 8 11:15:08 2024 +0100

    stubdom: explcitly add libc and lwip Mini-OS config options
    
    Today the Mini-OS build systems derives libc and lwip config options
    from the stubdom and LWIPDIR make variables supplied by the Xen build
    system.
    
    In order to prepare those being explicit Mini-OS config options, add
    them to the related stubdom Mini-OS config files.
    
    While at it remove the CONFIG_START_NETWORK setting from config files
    disabling lwip, as CONFIG_START_NETWORK requires lwip for becoming
    effective.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 stubdom/c/minios.cfg           | 2 ++
 stubdom/grub/minios.cfg        | 3 ++-
 stubdom/ioemu-minios.cfg       | 2 ++
 stubdom/vtpm/minios.cfg        | 3 ++-
 stubdom/vtpmmgr/minios.cfg     | 3 ++-
 stubdom/xenstore-minios.cfg    | 1 +
 stubdom/xenstorepvh-minios.cfg | 1 +
 7 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/stubdom/c/minios.cfg b/stubdom/c/minios.cfg
index e69de29bb2..56d65510cd 100644
--- a/stubdom/c/minios.cfg
+++ b/stubdom/c/minios.cfg
@@ -0,0 +1,2 @@
+CONFIG_LIBC=y
+CONFIG_LWIP=y
diff --git a/stubdom/grub/minios.cfg b/stubdom/grub/minios.cfg
index 8df49092cd..5145b357e0 100644
--- a/stubdom/grub/minios.cfg
+++ b/stubdom/grub/minios.cfg
@@ -1,3 +1,4 @@
-CONFIG_START_NETWORK=n
+CONFIG_LIBC=y
+CONFIG_LWIP=n
 CONFIG_SPARSE_BSS=n
 CONFIG_TPMFRONT=y
diff --git a/stubdom/ioemu-minios.cfg b/stubdom/ioemu-minios.cfg
index a65baa3765..6153ae05f8 100644
--- a/stubdom/ioemu-minios.cfg
+++ b/stubdom/ioemu-minios.cfg
@@ -1,3 +1,5 @@
+CONFIG_LIBC=y
+CONFIG_LWIP=y
 CONFIG_START_NETWORK=n
 CONFIG_QEMU_XS_ARGS=y
 CONFIG_PCIFRONT=y
diff --git a/stubdom/vtpm/minios.cfg b/stubdom/vtpm/minios.cfg
index 31652ee4f2..22f66f1351 100644
--- a/stubdom/vtpm/minios.cfg
+++ b/stubdom/vtpm/minios.cfg
@@ -1,7 +1,8 @@
+CONFIG_LIBC=y
+CONFIG_LWIP=n
 CONFIG_TPMFRONT=y
 CONFIG_TPM_TIS=n
 CONFIG_TPMBACK=y
-CONFIG_START_NETWORK=n
 CONFIG_TEST=n
 CONFIG_PCIFRONT=n
 CONFIG_BLKFRONT=y
diff --git a/stubdom/vtpmmgr/minios.cfg b/stubdom/vtpmmgr/minios.cfg
index 3fb383d30f..a9f13a2fd2 100644
--- a/stubdom/vtpmmgr/minios.cfg
+++ b/stubdom/vtpmmgr/minios.cfg
@@ -1,7 +1,8 @@
+CONFIG_LIBC=y
+CONFIG_LWIP=n
 CONFIG_TPMFRONT=y
 CONFIG_TPM_TIS=y
 CONFIG_TPMBACK=y
-CONFIG_START_NETWORK=n
 CONFIG_TEST=n
 CONFIG_PCIFRONT=n
 CONFIG_BLKFRONT=y
diff --git a/stubdom/xenstore-minios.cfg b/stubdom/xenstore-minios.cfg
index 239da519b9..0252b59432 100644
--- a/stubdom/xenstore-minios.cfg
+++ b/stubdom/xenstore-minios.cfg
@@ -1,3 +1,4 @@
+CONFIG_LIBC=y
 CONFIG_BLKFRONT=n
 CONFIG_NETFRONT=n
 CONFIG_FBFRONT=n
diff --git a/stubdom/xenstorepvh-minios.cfg b/stubdom/xenstorepvh-minios.cfg
index 752b90d7d3..62a228f33d 100644
--- a/stubdom/xenstorepvh-minios.cfg
+++ b/stubdom/xenstorepvh-minios.cfg
@@ -1,3 +1,4 @@
+CONFIG_LIBC=y
 CONFIG_PARAVIRT=n
 CONFIG_BLKFRONT=n
 CONFIG_NETFRONT=n
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 08 11:22:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 08 Oct 2024 11:22:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.813015.1225783 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sy8IL-0006V7-Qj; Tue, 08 Oct 2024 11:22:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 813015.1225783; Tue, 08 Oct 2024 11: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 1sy8IL-0006Uz-O5; Tue, 08 Oct 2024 11:22:25 +0000
Received: by outflank-mailman (input) for mailman id 813015;
 Tue, 08 Oct 2024 11:22: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 1sy8IK-0006Ud-5M
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 11:22: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 1sy8IK-0000Bp-4e
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 11:22:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sy8IK-0000DZ-3f
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 11:22: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=uFY7iTUapg5U7ldXl1ubKFlCYKtVbUAdDroksVOl2NI=; b=fy9MYcMy2Dfz0kyeBwNKQeuzq2
	lkS5TIpnds5/ZDnKt7QwwkrVmKKdzC6gpzTldyyFe5ZzDsHzevARQOGLFoV7xwsD1F1ByXGprxjAS
	yumhQu/SrfaEgKMi6gMWUrAg2CKnLPYDFF5SNEVpxhManU9VGbRjdu02VU2ZTTyOOgAo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] build: move xenlibs-dependencies make definition to uselibs.mk
Message-Id: <E1sy8IK-0000DZ-3f@xenbits.xenproject.org>
Date: Tue, 08 Oct 2024 11:22:24 +0000

commit 2d6a835b0559d0476f2a124338644ffd474966ce
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sat Oct 5 17:15:47 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 8 11:15:08 2024 +0100

    build: move xenlibs-dependencies make definition to uselibs.mk
    
    In order to be able to use the xenlibs-dependencies macro from stubdom
    build, move it to tools/libs/uselibs.mk, which is included from
    current users and stubdom/Makefile.
    
    No functional change intended.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/Rules.mk        | 7 -------
 tools/libs/uselibs.mk | 7 +++++++
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/Rules.mk b/tools/Rules.mk
index e2289c25b4..6bd636709f 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -81,13 +81,6 @@ endif
 # include any CFLAGS or LDLIBS relating to libbar or libbaz unless
 # they use those libraries directly (not via libfoo) too.
 
-# Give the list of Xen library that the libraries in $(1) are linked against,
-# directly or indirectly.
-define xenlibs-dependencies
-    $(sort $(foreach lib,$(1), \
-        $(USELIBS_$(lib)) $(call xenlibs-dependencies,$(USELIBS_$(lib)))))
-endef
-
 # Flags for linking recursive dependencies of Xen libraries in $(1)
 define xenlibs-rpath
     $(addprefix -Wl$(comma)-rpath-link=$(XEN_ROOT)/tools/libs/,$(call xenlibs-dependencies,$(1)))
diff --git a/tools/libs/uselibs.mk b/tools/libs/uselibs.mk
index efd7a475ba..7aa8d83e06 100644
--- a/tools/libs/uselibs.mk
+++ b/tools/libs/uselibs.mk
@@ -31,3 +31,10 @@ USELIBS_light := toollog evtchn toolcore ctrl store hypfs guest
 LIBS_LIBS += util
 USELIBS_util := light
 FILENAME_util := xlutil
+
+# Give the list of Xen library that the libraries in $(1) are linked against,
+# directly or indirectly.
+define xenlibs-dependencies
+    $(sort $(foreach lib,$(1), \
+        $(USELIBS_$(lib)) $(call xenlibs-dependencies,$(USELIBS_$(lib)))))
+endef
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 08 11:22:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 08 Oct 2024 11:22:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.813016.1225788 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sy8IV-0006Xv-SO; Tue, 08 Oct 2024 11:22:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 813016.1225788; Tue, 08 Oct 2024 11:22: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 1sy8IV-0006Xn-PV; Tue, 08 Oct 2024 11:22:35 +0000
Received: by outflank-mailman (input) for mailman id 813016;
 Tue, 08 Oct 2024 11:22: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 1sy8IU-0006XZ-8N
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 11:22: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 1sy8IU-0000Bw-7b
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 11:22:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sy8IU-0000EI-6h
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 11:22: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=X+u2QktWIiOlr4mHRMDxzjHrrLelCdFnGU28Jnd+Fis=; b=J4cWF9ywRjgDQRmgUwYFyJQ9yr
	KP5r4409+eT0+dH/p2JbFa8vD93ZiKPR16QqAXRnHXgbPeUf+LLCGb1J+U+gYKr5u+KzXptaA9CxB
	XZAD4ZWGHzpHxOLbIVUBY/XnUAkEo0uISDjPRX3FJ+qcGkCPQimQx/+WQcQ6q/P/B+GY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: Use standard C types in multiboot2.h header
Message-Id: <E1sy8IU-0000EI-6h@xenbits.xenproject.org>
Date: Tue, 08 Oct 2024 11:22:34 +0000

commit 79ade905b9b1875e5552946a8975615368ef7c8f
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Tue Oct 8 09:41:57 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 8 11:15:08 2024 +0100

    x86: Use standard C types in multiboot2.h header
    
    The header already uses standard types for many fields, extend
    their usage.
    No functional change.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/multiboot2.h | 62 ++++++++++++++++++++++----------------------
 1 file changed, 31 insertions(+), 31 deletions(-)

diff --git a/xen/include/xen/multiboot2.h b/xen/include/xen/multiboot2.h
index f792040205..7cda620eec 100644
--- a/xen/include/xen/multiboot2.h
+++ b/xen/include/xen/multiboot2.h
@@ -115,46 +115,46 @@
 
 #ifndef __ASSEMBLY__
 typedef struct {
-    u32 total_size;
-    u32 reserved;
+    uint32_t total_size;
+    uint32_t reserved;
 } multiboot2_fixed_t;
 
 typedef struct {
-    u32 type;
-    u32 size;
+    uint32_t type;
+    uint32_t size;
 } multiboot2_tag_t;
 
 typedef struct {
-    u32 type;
-    u32 size;
-    u32 load_base_addr;
+    uint32_t type;
+    uint32_t size;
+    uint32_t load_base_addr;
 } multiboot2_tag_load_base_addr_t;
 
 typedef struct {
-    u32 type;
-    u32 size;
+    uint32_t type;
+    uint32_t size;
     char string[];
 } multiboot2_tag_string_t;
 
 typedef struct {
-    u32 type;
-    u32 size;
-    u32 mem_lower;
-    u32 mem_upper;
+    uint32_t type;
+    uint32_t size;
+    uint32_t mem_lower;
+    uint32_t mem_upper;
 } multiboot2_tag_basic_meminfo_t;
 
 typedef struct {
-    u64 addr;
-    u64 len;
-    u32 type;
-    u32 zero;
+    uint64_t addr;
+    uint64_t len;
+    uint32_t type;
+    uint32_t zero;
 } multiboot2_memory_map_t;
 
 typedef struct {
-    u32 type;
-    u32 size;
-    u32 entry_size;
-    u32 entry_version;
+    uint32_t type;
+    uint32_t size;
+    uint32_t entry_size;
+    uint32_t entry_version;
     multiboot2_memory_map_t entries[];
 } multiboot2_tag_mmap_t;
 
@@ -212,22 +212,22 @@ typedef struct
 } multiboot2_tag_framebuffer_t;
 
 typedef struct {
-    u32 type;
-    u32 size;
-    u64 pointer;
+    uint32_t type;
+    uint32_t size;
+    uint64_t pointer;
 } multiboot2_tag_efi64_t;
 
 typedef struct {
-    u32 type;
-    u32 size;
-    u64 pointer;
+    uint32_t type;
+    uint32_t size;
+    uint64_t pointer;
 } multiboot2_tag_efi64_ih_t;
 
 typedef struct {
-    u32 type;
-    u32 size;
-    u32 mod_start;
-    u32 mod_end;
+    uint32_t type;
+    uint32_t size;
+    uint32_t mod_start;
+    uint32_t mod_end;
     char cmdline[];
 } multiboot2_tag_module_t;
 #endif /* __ASSEMBLY__ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 08 11:22:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 08 Oct 2024 11:22:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.813017.1225791 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sy8If-0006bO-VQ; Tue, 08 Oct 2024 11:22:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 813017.1225791; Tue, 08 Oct 2024 11:22: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 1sy8If-0006bG-ST; Tue, 08 Oct 2024 11:22:45 +0000
Received: by outflank-mailman (input) for mailman id 813017;
 Tue, 08 Oct 2024 11:22: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 1sy8Ie-0006b3-BA
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 11:22: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 1sy8Ie-0000C3-AQ
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 11:22:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sy8Ie-0000H9-9d
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 11:22: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=qgdbrX9T/wQz2WtV/2KWQ091e9aYkW44PF7fZ8ShMJ4=; b=EOi8P2SUDhCYmn7+Y+3jF7/LT5
	3qHG83GiBSuBpdjzyx15WIbvjmUWAERYMcLZMKEvSUviYNtAxiA7nmbymwGuX3F3x4yjbFjaSYmiE
	zeNmX4zR6hzydUbLFjmGpOJyQVUkrI8o1al21jwfX/QBu9J1pax3/U+J8kuirGIBy9GM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CI: Drop bin86/dev86 from archlinux container
Message-Id: <E1sy8Ie-0000H9-9d@xenbits.xenproject.org>
Date: Tue, 08 Oct 2024 11:22:44 +0000

commit c1035b0463b73ff62e80b1e8f37aa5ba5348f779
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jul 2 17:40:11 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 8 11:15:08 2024 +0100

    CI: Drop bin86/dev86 from archlinux container
    
    These packages have moved out of main to AUR, and are not easily accessible
    any more.  Drop them, because they're only needed for RomBIOS which is very
    legacy these days.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/archlinux/current.dockerfile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/automation/build/archlinux/current.dockerfile b/automation/build/archlinux/current.dockerfile
index 8929e9b5f0..657ddd77a8 100644
--- a/automation/build/archlinux/current.dockerfile
+++ b/automation/build/archlinux/current.dockerfile
@@ -6,10 +6,8 @@ LABEL maintainer.name="The Xen Project" \
 RUN pacman-key --init
 
 RUN pacman -S --refresh --sysupgrade --noconfirm --noprogressbar --needed \
-        bin86 \
         bridge-utils \
         bzip2 \
-        dev86 \
         discount \
         dtc \
         e2fsprogs \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 08 11:22:56 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 08 Oct 2024 11:22:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.813018.1225795 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sy8Iq-0006eV-0g; Tue, 08 Oct 2024 11:22:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 813018.1225795; Tue, 08 Oct 2024 11:22: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 1sy8Ip-0006eN-Tw; Tue, 08 Oct 2024 11:22:55 +0000
Received: by outflank-mailman (input) for mailman id 813018;
 Tue, 08 Oct 2024 11:22: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 1sy8Io-0006dz-EA
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 11:22: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 1sy8Io-0000CA-DP
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 11:22:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sy8Io-0000IP-CY
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 11:22: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=A9rFLSyHGodSVFD6VorPaNYn9ESU2zpdXKE3DDXd5YY=; b=Rn+0Xh0th44Jeme6eER0akp8Dz
	JwS6S1MdE9rFwOmfNb7ISlQbHF8f/pifAmCfUxTjbvUjVDk1Pgd3N79QD7IC2OYyyz9rTLlXPqdIb
	wRLQT4j4u71XkupqKZmzU7g4lV8L8gFvtNw6Vc1pQVJ4f3E0JU78K5EGIjL7zD3Lir5c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: use python-3.11 in Leap container
Message-Id: <E1sy8Io-0000IP-CY@xenbits.xenproject.org>
Date: Tue, 08 Oct 2024 11:22:54 +0000

commit 16a81486c4cdafa8d881dec529a99e2441109872
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Mon Oct 7 17:25:09 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 8 12:15:31 2024 +0100

    automation: use python-3.11 in Leap container
    
    python311 is available since Leap 15.4 as additional Python variant.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/opensuse/leap-15.6-x86_64.dockerfile | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/automation/build/opensuse/leap-15.6-x86_64.dockerfile b/automation/build/opensuse/leap-15.6-x86_64.dockerfile
index ea70dffe2a..97890dfc00 100644
--- a/automation/build/opensuse/leap-15.6-x86_64.dockerfile
+++ b/automation/build/opensuse/leap-15.6-x86_64.dockerfile
@@ -3,6 +3,7 @@ FROM --platform=linux/amd64 opensuse/leap:15.6
 LABEL maintainer.name="The Xen Project"
 LABEL maintainer.email="xen-devel@lists.xenproject.org"
 
+ENV PYTHON=python3.11
 ENV XEN_TARGET_ARCH=x86_64
 
 RUN <<EOF
@@ -25,7 +26,7 @@ RUN <<EOF
         gawk
         gcc
         make
-        python3
+        python311
 
         # Tools (general)
         git-core
@@ -53,8 +54,8 @@ RUN <<EOF
         # xentop
         'pkgconfig(ncurses)'
         # Python bindings
-        python3-devel
-        python3-setuptools
+        python311-devel
+        python311-setuptools
         # Ocaml bindings/oxenstored
         ocaml
         ocaml-findlib
@@ -68,7 +69,7 @@ RUN <<EOF
         ninja
         'pkgconfig(glib-2.0)'
         'pkgconfig(pixman-1)'
-        python3-packaging
+        python311-packaging
     )
 
     zypper install -y --no-recommends "${DEPS[@]}"
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 08 12:11:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 08 Oct 2024 12:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.813066.1225849 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sy93R-0005F0-NU; Tue, 08 Oct 2024 12:11:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 813066.1225849; Tue, 08 Oct 2024 12: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 1sy93R-0005Es-Kd; Tue, 08 Oct 2024 12:11:05 +0000
Received: by outflank-mailman (input) for mailman id 813066;
 Tue, 08 Oct 2024 12: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 1sy93P-0005Em-Nb
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 12: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 1sy93P-0000yR-Ig
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 12:11:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sy93P-00058Z-Ha
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 12: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=tpVRcMCGGuS5OCNfYMOcreUGxqjqbipa6GsRpIqinLY=; b=0Y3+bSyl/YSgEz8NsI3NxT6Z4b
	bRrJK4MGeKwuGixp3OalP9On4pZD1xFzcj9xmp05ndTeiGjo36j7fUkpiQUOCvIZQ+/NAdg4PxlYS
	imNpYNBu4G7eLGeCwcjWVTlJt4/UZQjDqaXa/nODkc0CYKb9JmCiah9zCemsfc5X4Djw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] .gitignore: Remove not generated files
Message-Id: <E1sy93P-00058Z-Ha@xenbits.xenproject.org>
Date: Tue, 08 Oct 2024 12:11:03 +0000

commit 9ab0496350e6d8ea35465e7a5fadf94ff0838c0a
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Mon Oct 7 15:15:34 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 8 13:06:13 2024 +0100

    .gitignore: Remove not generated files
    
    Both reloc.S and cmdline.S are not generated since commit
    1ab7c128d9d1 ("x86/build: Don't convert boot/{cmdline,head}.bin back to .S")
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 .gitignore | 2 --
 1 file changed, 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index 5c13fb5878..5d65bcd7bc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -213,8 +213,6 @@ xen/.config.old
 xen/.xen.elf32
 xen/System.map
 xen/arch/x86/boot/mkelf32
-xen/arch/x86/boot/cmdline.S
-xen/arch/x86/boot/reloc.S
 xen/arch/x86/boot/*.bin
 xen/arch/x86/boot/*.lnk
 xen/arch/x86/efi.lds
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 08 12:11:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 08 Oct 2024 12:11:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.813067.1225852 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sy93b-0005Gk-OY; Tue, 08 Oct 2024 12:11:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 813067.1225852; Tue, 08 Oct 2024 12: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 1sy93b-0005Gc-Lx; Tue, 08 Oct 2024 12:11:15 +0000
Received: by outflank-mailman (input) for mailman id 813067;
 Tue, 08 Oct 2024 12: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 1sy93Z-0005GQ-Md
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 12: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 1sy93Z-0000yb-Ls
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 12:11:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sy93Z-00059d-Kq
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 12: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=20ZsT0ko86LcdIw56FwTqv1zZY9Ci2I0bpXhNVmTorE=; b=kBQOyX8bPM6JUIjQRWy0WoJsvB
	Gf0Dyafzcilip+zP4AhGUxEUhL3JkbmnEI99xMGMRGbyP3+vLSvCBQHEoSsgEFGgrrlL90fsd5HHo
	gIe3YMFLa0npOSCAe1ZVXONgnvtOu1cTN3XDDYvJPZPh930kUblx6zjq8Mf4rXQcfI2w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Rationalise .gitignore
Message-Id: <E1sy93Z-00059d-Kq@xenbits.xenproject.org>
Date: Tue, 08 Oct 2024 12:11:13 +0000

commit 011814bd45c42720c9212dd61b65668c33c216d6
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Mon Oct 7 15:15:35 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 8 13:06:13 2024 +0100

    x86/boot: Rationalise .gitignore
    
    Strip all related content out of the root .gitignore, and provide a
    more local .gitignore's with up-to-date patterns.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 .gitignore                   | 3 ---
 xen/arch/x86/boot/.gitignore | 3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.gitignore b/.gitignore
index 5d65bcd7bc..25484a8fd8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -212,9 +212,6 @@ xen/.config
 xen/.config.old
 xen/.xen.elf32
 xen/System.map
-xen/arch/x86/boot/mkelf32
-xen/arch/x86/boot/*.bin
-xen/arch/x86/boot/*.lnk
 xen/arch/x86/efi.lds
 xen/arch/x86/efi/check.efi
 xen/arch/x86/efi/mkreloc
diff --git a/xen/arch/x86/boot/.gitignore b/xen/arch/x86/boot/.gitignore
new file mode 100644
index 0000000000..a379db7988
--- /dev/null
+++ b/xen/arch/x86/boot/.gitignore
@@ -0,0 +1,3 @@
+/mkelf32
+/*.bin
+/*.lnk
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 08 12:44:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 08 Oct 2024 12:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.813082.1225866 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sy9ZN-0001Ju-5n; Tue, 08 Oct 2024 12:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 813082.1225866; Tue, 08 Oct 2024 12: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 1sy9ZN-0001Jm-3J; Tue, 08 Oct 2024 12:44:05 +0000
Received: by outflank-mailman (input) for mailman id 813082;
 Tue, 08 Oct 2024 12: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 1sy9ZM-0001Jg-7K
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 12: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 1sy9ZM-0001Ut-4O
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 12:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sy9ZM-0008UB-2J
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 12: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=Sw3zOT+zZ+nLFxg+sXSGmCJsK444hyD09mg16YEEFmY=; b=FlNO+/uhenvf9t3/lYKSrlqzDk
	dWOBgcD/JLuNccdbu5ZSfC+Y7QVA/3yLiMl4CgKdin09Tbb4tANg3Tm2W06MzoG76HjytakMmNLn8
	uZcDOVqeAiaokV5fZ1QupYYKNBGuwIQQREiMeVSF8GqkyzLaj5J/5FfgwH9QE2FEONOU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ioreq: don't wrongly claim "success" in ioreq_send_buffered()
Message-Id: <E1sy9ZM-0008UB-2J@xenbits.xenproject.org>
Date: Tue, 08 Oct 2024 12:44:04 +0000

commit 2e0b545b847df7d4feb07308d50bad708bd35a66
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Oct 8 14:36:27 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 8 14:36:27 2024 +0200

    ioreq: don't wrongly claim "success" in ioreq_send_buffered()
    
    Returning a literal number is a bad idea anyway when all other returns
    use IOREQ_STATUS_* values. The function is dead on Arm, and mapping to
    X86EMUL_OKAY is surely wrong on x86.
    
    Fixes: f6bf39f84f82 ("x86/hvm: add support for broadcast of buffered ioreqs...")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/ioreq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/common/ioreq.c b/xen/common/ioreq.c
index 1257a3d972..f5fd30ce12 100644
--- a/xen/common/ioreq.c
+++ b/xen/common/ioreq.c
@@ -1175,7 +1175,7 @@ static int ioreq_send_buffered(struct ioreq_server *s, ioreq_t *p)
         return IOREQ_STATUS_UNHANDLED;
 
     /*
-     * Return 0 for the cases we can't deal with:
+     * Return UNHANDLED for the cases we can't deal with:
      *  - 'addr' is only a 20-bit field, so we cannot address beyond 1MB
      *  - we cannot buffer accesses to guest memory buffers, as the guest
      *    may expect the memory buffer to be synchronously accessed
@@ -1183,7 +1183,7 @@ static int ioreq_send_buffered(struct ioreq_server *s, ioreq_t *p)
      *    support data_is_ptr we do not waste space for the count field either
      */
     if ( (p->addr > 0xfffffUL) || p->data_is_ptr || (p->count != 1) )
-        return 0;
+        return IOREQ_STATUS_UNHANDLED;
 
     switch ( p->size )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 08 12:44:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 08 Oct 2024 12:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.813083.1225871 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sy9ZX-0001Lf-7a; Tue, 08 Oct 2024 12:44:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 813083.1225871; Tue, 08 Oct 2024 12: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 1sy9ZX-0001LX-4n; Tue, 08 Oct 2024 12:44:15 +0000
Received: by outflank-mailman (input) for mailman id 813083;
 Tue, 08 Oct 2024 12: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 1sy9ZW-0001LR-9a
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 12: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 1sy9ZW-0001Uz-8x
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 12:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sy9ZW-0008Vc-6p
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 12: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=E97Me5A//Sw8V3eusLmFPXmvEl38NOTohw+TgZ4w+JQ=; b=tmoIlK8+wdOw0iiJONaGkd6oXp
	OwlgP5hJc2kQg2S4cVmYVGrgS9WKhjeHztVRZu6bPJMqKhbUiY85i1syrHEAN64SJZ71fFdONSOv7
	G/+oh/VPBkCJNUmIJi/HAp9fIN0fhfVVVBD562rZoIqIjcYWEKpWc3OUAwFqbiE1+c+k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/emul: add defensive code
Message-Id: <E1sy9ZW-0008Vc-6p@xenbits.xenproject.org>
Date: Tue, 08 Oct 2024 12:44:14 +0000

commit 7f743fac946bc6ebfbddf714827cca352edd7ace
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Tue Oct 8 14:36:59 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 8 14:36:59 2024 +0200

    x86/emul: add defensive code
    
    Add defensive code after unreachable program points.
    This also meets the requirements to deviate violations of MISRA C:2012
    Rule 16.3: "An unconditional `break' statement shall terminate every
    switch-clause".
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 0ea0d5e67e..6b6b8c8fe4 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6840,6 +6840,7 @@ x86_emulate(
             break;
         default:
             ASSERT_UNREACHABLE();
+            goto unhandleable;
         }
         break;
 #ifdef HAVE_AS_SSE4_2
@@ -6868,6 +6869,7 @@ x86_emulate(
 # endif
         default:
             ASSERT_UNREACHABLE();
+            goto unhandleable;
         }
         break;
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 08 12:44:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 08 Oct 2024 12:44:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.813084.1225875 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sy9Zh-0001OE-8r; Tue, 08 Oct 2024 12:44:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 813084.1225875; Tue, 08 Oct 2024 12: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 1sy9Zh-0001O6-6M; Tue, 08 Oct 2024 12:44:25 +0000
Received: by outflank-mailman (input) for mailman id 813084;
 Tue, 08 Oct 2024 12: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 1sy9Zg-0001Ny-EH
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 12: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 1sy9Zg-0001VQ-Dc
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 12:44:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sy9Zg-0008WS-B5
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 12: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=DyXfVeDSadlxMnC3tvVvw4pf3prwT3yeBLkxWazETLU=; b=PQo26w8WNpYMPtCQcXAz6seqp+
	e5VN4FAns4a/vUp7cXGvdR15IHpKauxNLKC7KkSwc8M/ejbOv2QLEOnq81MNGBW1Z53YfOvoa4ouJ
	wA+jnB6WmzQze1ZRRbNrSi4R0oX73CRMQTp/oL4P/OhUX8sfoxzMqpwiWbeS3WjyXLHw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/pci: address a violation of MISRA C Rule 16.3
Message-Id: <E1sy9Zg-0008WS-B5@xenbits.xenproject.org>
Date: Tue, 08 Oct 2024 12:44:24 +0000

commit 7d83c392c7bfecdfcb7a91166cc75edd79e49a05
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Tue Oct 8 14:37:16 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 8 14:37:16 2024 +0200

    xen/pci: address a violation of MISRA C Rule 16.3
    
    Refactor the code to avoid an implicit fallthrough and address
    a violation of MISRA C:2012 Rule 16.3: "An unconditional `break'
    statement shall terminate every switch-clause".
    
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/drivers/passthrough/pci.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 5a446d3dce..74d3895e1e 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -170,8 +170,11 @@ static int __init cf_check parse_phantom_dev(const char *str)
     {
     case 1: case 2: case 4:
         if ( *s )
-    default:
             return -EINVAL;
+        break;
+
+    default:
+        return -EINVAL;
     }
 
     phantom_devs[nr_phantom_devs++] = phantom;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 08 12:44:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 08 Oct 2024 12:44:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.813085.1225879 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sy9Zr-0001R8-AL; Tue, 08 Oct 2024 12:44:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 813085.1225879; Tue, 08 Oct 2024 12: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 1sy9Zr-0001R0-7l; Tue, 08 Oct 2024 12:44:35 +0000
Received: by outflank-mailman (input) for mailman id 813085;
 Tue, 08 Oct 2024 12: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 1sy9Zq-0001Qk-IC
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 12: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 1sy9Zq-0001Vf-HU
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 12:44:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sy9Zq-00005W-Fg
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 12: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=dAML8yCT2+H/RlgRT+EinK/m/4j5OXc7Sr/hwiDzCys=; b=EzMe9Q9OFOs5DKghnk7Xn1TSbY
	Fzqbv9sC8NB3G0D+AjZbBHHuLNSTKwuJFzy//k64mXHkW8evEVYSSuczRRGeCoN851h2ppBSyPhww
	ineEFePwtEkYIt+YnrJkbaymzvxmJ7wStxysD7F0+7bxzUWuEmKn2XjVppG4c8Nh1O50=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: fusa: Replace VM with domain
Message-Id: <E1sy9Zq-00005W-Fg@xenbits.xenproject.org>
Date: Tue, 08 Oct 2024 12:44:34 +0000

commit 908c1b5efaa4c645728f4b885a008ef12da11476
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Tue Oct 8 14:37:37 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 8 14:37:37 2024 +0200

    docs: fusa: Replace VM with domain
    
    We should use the word domain everywhere (instead of VM or guest).
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/fusa/reqs/market-reqs/reqs.rst        | 26 +++++++++++++-------------
 docs/fusa/reqs/product-reqs/arm64/reqs.rst | 10 +++++-----
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/docs/fusa/reqs/market-reqs/reqs.rst b/docs/fusa/reqs/market-reqs/reqs.rst
index e98f348cf4..f456788d96 100644
--- a/docs/fusa/reqs/market-reqs/reqs.rst
+++ b/docs/fusa/reqs/market-reqs/reqs.rst
@@ -3,13 +3,13 @@
 Functional Requirements
 =======================
 
-Run Arm64 VMs
--------------
+Run Arm64 domains
+-----------------
 
-`XenMkt~run_arm64_vms~1`
+`XenMkt~run_arm64_domains~1`
 
 Description:
-Xen shall run Arm64 VMs.
+Xen shall run Arm64 domains.
 
 Rationale:
 
@@ -18,13 +18,13 @@ Comments:
 Needs:
  - XenProd
 
-Provide timer to the VMs
-------------------------
+Provide timer to the domains
+----------------------------
 
-`XenMkt~provide_timer_vms~1`
+`XenMkt~provide_timer_domains~1`
 
 Description:
-Xen shall provide a timer to a VM.
+Xen shall provide a timer to a domain.
 
 Rationale:
 
@@ -33,17 +33,17 @@ Comments:
 Needs:
  - XenProd
 
-Provide console to the VMs
---------------------------
+Provide console to the domains
+------------------------------
 
-`XenMkt~provide_console_vms~1`
+`XenMkt~provide_console_domains~1`
 
 Description:
-Xen shall provide a console to a VM.
+Xen shall provide a console to a domain.
 
 Rationale:
 
 Comments:
 
 Needs:
- - XenProd
\ No newline at end of file
+ - XenProd
diff --git a/docs/fusa/reqs/product-reqs/arm64/reqs.rst b/docs/fusa/reqs/product-reqs/arm64/reqs.rst
index 97e90813ec..db91c47a02 100644
--- a/docs/fusa/reqs/product-reqs/arm64/reqs.rst
+++ b/docs/fusa/reqs/product-reqs/arm64/reqs.rst
@@ -16,8 +16,8 @@ Rationale:
 Comments:
 
 Covers:
- - `XenMkt~run_arm64_vms~1`
- - `XenMkt~provide_timer_vms~1`
+ - `XenMkt~run_arm64_domains~1`
+ - `XenMkt~provide_timer_domains~1`
 
 Needs:
  - XenSwdgn
@@ -35,8 +35,8 @@ Rationale:
 Comments:
 
 Covers:
- - `XenMkt~run_arm64_vms~1`
- - `XenMkt~provide_console_vms~1`
+ - `XenMkt~run_arm64_domains~1`
+ - `XenMkt~provide_console_domains~1`
 
 Needs:
- - XenSwdgn
\ No newline at end of file
+ - XenSwdgn
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 08 12:44:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 08 Oct 2024 12:44:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.813086.1225883 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sy9a1-0001UG-Br; Tue, 08 Oct 2024 12:44:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 813086.1225883; Tue, 08 Oct 2024 12: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 1sy9a1-0001U8-9D; Tue, 08 Oct 2024 12:44:45 +0000
Received: by outflank-mailman (input) for mailman id 813086;
 Tue, 08 Oct 2024 12: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 1sy9a0-0001Tu-Lp
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 12: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 1sy9a0-0001Vs-L9
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 12:44:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sy9a0-00006G-Jb
 for xen-changelog@lists.xenproject.org; Tue, 08 Oct 2024 12: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=KDHZxW+MmwuBvOamIo0gr9Lul56N6Uc64/y9Cs4uvZs=; b=4+6YFhHhw/XENmPUTK478goCwA
	uXzhPA044dFSbnDsQiUUQUBGqJ5IoLFx+UKMlSywgrCIWAe8lfZNdeCEOgBKd5+4vhjq1lRJzyAX3
	EUwdCGOdX9ubnuW9RPgI5hmlCbhyEBNMI++N3WF0VoG29Fu0w18NDDnwtJCqBEZUlK70=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/domctl: fix maximum number of MSRs in XEN_DOMCTL_{get,set}_vcpu_msrs
Message-Id: <E1sy9a0-00006G-Jb@xenbits.xenproject.org>
Date: Tue, 08 Oct 2024 12:44:44 +0000

commit c95cd5f9c5a8c1c6ab1b0b366d829fa8561958fd
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Oct 8 14:37:53 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 8 14:37:53 2024 +0200

    x86/domctl: fix maximum number of MSRs in XEN_DOMCTL_{get,set}_vcpu_msrs
    
    Since the addition of the MSR_AMD64_DR{1-4}_ADDRESS_MASK MSRs to the
    msrs_to_send array, the calculations for the maximum number of MSRs that
    the hypercall can handle is off by 4.
    
    Remove the addition of 4 to the maximum number of MSRs that
    XEN_DOMCTL_{set,get}_vcpu_msrs supports, as those are already part of the
    array.
    
    A further adjustment could be to subtract 4 from the maximum size if the DBEXT
    CPUID feature is not exposed to the guest, but guest_{rd,wr}msr() will already
    perform that check when fetching or loading the MSRs.  The maximum array is
    used to indicate the caller of the buffer it needs to allocate in the get case,
    and as an early input sanitation in the set case, using a buffer size slightly
    lager than required is not an issue.
    
    Fixes: 86d47adcd3c4 ('x86/msr: Handle MSR_AMD64_DR{0-3}_ADDRESS_MASK in the new MSR infrastructure')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domctl.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 96d816cf1a..27d5b3f3d6 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1088,10 +1088,6 @@ long arch_do_domctl(
              !is_pv_domain(d) )
             break;
 
-        /* Count maximum number of optional msrs. */
-        if ( boot_cpu_has(X86_FEATURE_DBEXT) )
-            nr_msrs += 4;
-
         if ( domctl->cmd == XEN_DOMCTL_get_vcpu_msrs )
         {
             ret = 0; copyback = true;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 08:00:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 08:00:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.813794.1226812 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syRc4-0002gX-GY; Wed, 09 Oct 2024 08:00:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 813794.1226812; Wed, 09 Oct 2024 08: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 1syRc4-0002g9-Dk; Wed, 09 Oct 2024 08:00:04 +0000
Received: by outflank-mailman (input) for mailman id 813794;
 Wed, 09 Oct 2024 08: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 1syRc3-0002Uq-Hw
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 08: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 1syRc3-0003fV-E8
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 08:00:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syRc3-0001po-Bu
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 08: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=0EkOATC6sUmRQ+iEvIZ4KrtwEpyKppKGVFnsGZE3MAk=; b=BWe5NSXQZNQpLSwaJ4HJ2NFqi2
	K6cxsIWfpcxyWlE/K7YJqa2WhMlkgUle/5NCVRJ51gdpO6p/H2PlFTZry+56p2iQ5iXSmJquA4ipB
	4c1fStFI/p7O+XkRQ8X1TqSuFjEgLA1cP3PfUumdjSVt5S2iEWYgfBuHpDYVqNeN93u4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: Update header guards - Intel TXT
Message-Id: <E1syRc3-0001po-Bu@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 08:00:03 +0000

commit 964c9568eaa58f621384f58e0d275f3b060d781d
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Wed Oct 9 09:53:05 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 9 09:53:05 2024 +0200

    xen: Update header guards - Intel TXT
    
    Update the header related to Intel trusted execution technology.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/tboot.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/tboot.h b/xen/arch/x86/include/asm/tboot.h
index 818d5fa451..15479fe80e 100644
--- a/xen/arch/x86/include/asm/tboot.h
+++ b/xen/arch/x86/include/asm/tboot.h
@@ -34,8 +34,8 @@
  *
  */
 
-#ifndef __TBOOT_H__
-#define __TBOOT_H__
+#ifndef ASM__X86__TBOOT_H
+#define ASM__X86__TBOOT_H
 
 #include <xen/acpi.h>
 
@@ -147,7 +147,7 @@ static inline int tboot_wake_ap(int apicid, unsigned long sipi_vec)
 }
 #endif /* CONFIG_TBOOT */
 
-#endif /* __TBOOT_H__ */
+#endif /* ASM__X86__TBOOT_H */
 
 /*
  * Local variables:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 08:00:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 08:00:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.813795.1226816 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syRcE-00039a-IJ; Wed, 09 Oct 2024 08:00:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 813795.1226816; Wed, 09 Oct 2024 08: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 1syRcE-00039T-FC; Wed, 09 Oct 2024 08:00:14 +0000
Received: by outflank-mailman (input) for mailman id 813795;
 Wed, 09 Oct 2024 08: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 1syRcD-00039L-IN
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 08: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 1syRcD-0003kx-HX
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 08:00:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syRcD-0001sM-GV
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 08: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=sn6Sy++cg+eY0c5495sqYv8U/xwrfM8gg9O6wl6xlCQ=; b=sNcNu2no62o+44ThZ5QQ71OQp9
	4DqhY+f/coLA4kGiFLkL7MMHgfAmR4lE2SgxOmYzSxYVRdhLvGZVmAAYYAeSnvumjU3ztUFst1os/
	9LXfRJcVCUKOQdFYvWfLBwSgB9rdRNtwtKTuK3YsFBqLaHm5YSGJXrtZr1sSDVJGMlRg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: Update header guards - I/O MMU
Message-Id: <E1syRcD-0001sM-GV@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 08:00:13 +0000

commit 6bbcb97ba45ecdcac9d7359fdecf298bc4c1be1c
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Wed Oct 9 09:53:25 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 9 09:53:25 2024 +0200

    xen: Update header guards - I/O MMU
    
    Update headers related to I/O MMU.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/amd/iommu-defs.h | 6 +++---
 xen/drivers/passthrough/amd/iommu.h      | 6 +++---
 xen/drivers/passthrough/ats.h            | 6 +++---
 xen/drivers/passthrough/vtd/dmar.h       | 6 +++---
 xen/drivers/passthrough/vtd/extern.h     | 6 +++---
 xen/drivers/passthrough/vtd/iommu.h      | 4 ++--
 xen/drivers/passthrough/vtd/vtd.h        | 6 +++---
 xen/include/xen/iommu.h                  | 6 +++---
 8 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu-defs.h b/xen/drivers/passthrough/amd/iommu-defs.h
index c145248f9a..30b094f187 100644
--- a/xen/drivers/passthrough/amd/iommu-defs.h
+++ b/xen/drivers/passthrough/amd/iommu-defs.h
@@ -17,8 +17,8 @@
  * along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef AMD_IOMMU_DEFS_H
-#define AMD_IOMMU_DEFS_H
+#ifndef DRIVERS__PASSTHROUGH__AMD__IOMMU_DEFS_H
+#define DRIVERS__PASSTHROUGH__AMD__IOMMU_DEFS_H
 
 /* IOMMU Event Log entries: in power of 2 increments, minimum of 256 */
 #define IOMMU_EVENT_LOG_DEFAULT_ENTRIES     512
@@ -486,7 +486,7 @@ union amd_iommu_pte {
 #define IOMMU_REG_BASE_ADDR_HIGH_MASK               0x000FFFFFU
 #define IOMMU_REG_BASE_ADDR_HIGH_SHIFT              0
 
-#endif /* AMD_IOMMU_DEFS_H */
+#endif /* DRIVERS__PASSTHROUGH__AMD__IOMMU_DEFS_H */
 
 /*
  * Local variables:
diff --git a/xen/drivers/passthrough/amd/iommu.h b/xen/drivers/passthrough/amd/iommu.h
index 8d6f63d87f..c32e9e9a16 100644
--- a/xen/drivers/passthrough/amd/iommu.h
+++ b/xen/drivers/passthrough/amd/iommu.h
@@ -16,8 +16,8 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
-#ifndef AMD_IOMMU_H
-#define AMD_IOMMU_H
+#ifndef DRIVERS__PASSTHROUGH__AMD__IOMMU_H
+#define DRIVERS__PASSTHROUGH__AMD__IOMMU_H
 
 #include <xen/init.h>
 #include <xen/types.h>
@@ -372,4 +372,4 @@ static inline void iommu_set_addr_hi_to_reg(uint32_t *reg, uint32_t addr)
                          IOMMU_REG_BASE_ADDR_HIGH_SHIFT, reg);
 }
 
-#endif /* AMD_IOMMU_H */
+#endif /* DRIVERS__PASSTHROUGH__AMD__IOMMU_H */
diff --git a/xen/drivers/passthrough/ats.h b/xen/drivers/passthrough/ats.h
index f5e1d254e0..68b1c600eb 100644
--- a/xen/drivers/passthrough/ats.h
+++ b/xen/drivers/passthrough/ats.h
@@ -12,8 +12,8 @@
  * this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _ATS_H_
-#define _ATS_H_
+#ifndef DRIVERS__PASSTHROUGH__ATS_H
+#define DRIVERS__PASSTHROUGH__ATS_H
 
 #include <xen/pci_regs.h>
 
@@ -50,5 +50,5 @@ static inline int pci_ats_device(int seg, int bus, int devfn)
                                    PCI_EXT_CAP_ID_ATS);
 }
 
-#endif /* _ATS_H_ */
+#endif /* DRIVERS__PASSTHROUGH__ATS_H */
 
diff --git a/xen/drivers/passthrough/vtd/dmar.h b/xen/drivers/passthrough/vtd/dmar.h
index 61f71ca5e6..0ff4f36535 100644
--- a/xen/drivers/passthrough/vtd/dmar.h
+++ b/xen/drivers/passthrough/vtd/dmar.h
@@ -17,8 +17,8 @@
  * Copyright (C) Shaohua Li <shaohua.li@intel.com>
  */
 
-#ifndef _DMAR_H_
-#define _DMAR_H_
+#ifndef DRIVERS__PASSTHROUGH__VTD__DMAR_H
+#define DRIVERS__PASSTHROUGH__VTD__DMAR_H
 
 #include <xen/list.h>
 #include <xen/iommu.h>
@@ -171,4 +171,4 @@ int vtd_hw_check(void);
 void disable_pmr(struct vtd_iommu *iommu);
 int is_igd_drhd(struct acpi_drhd_unit *drhd);
 
-#endif /* _DMAR_H_ */
+#endif /* DRIVERS__PASSTHROUGH__VTD__DMAR_H */
diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 667590ee52..c16583c951 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -17,8 +17,8 @@
  * Copyright (C) Weidong Han <weidong.han@intel.com>
  */
 
-#ifndef _VTD_EXTERN_H_
-#define _VTD_EXTERN_H_
+#ifndef DRIVERS__PASSTHROUGH__VTD__EXTERN_H
+#define DRIVERS__PASSTHROUGH__VTD__EXTERN_H
 
 #include "dmar.h"
 #include <xen/keyhandler.h>
@@ -114,4 +114,4 @@ void quirk_iommu_caps(struct vtd_iommu *iommu);
 bool platform_supports_intremap(void);
 bool platform_supports_x2apic(void);
 
-#endif // _VTD_EXTERN_H_
+#endif // DRIVERS__PASSTHROUGH__VTD__EXTERN_H
diff --git a/xen/drivers/passthrough/vtd/iommu.h b/xen/drivers/passthrough/vtd/iommu.h
index 78aa8a96f5..29d350b23d 100644
--- a/xen/drivers/passthrough/vtd/iommu.h
+++ b/xen/drivers/passthrough/vtd/iommu.h
@@ -16,8 +16,8 @@
  * Copyright (C) Ashok Raj <ashok.raj@intel.com>
  */
 
-#ifndef _INTEL_IOMMU_H_
-#define _INTEL_IOMMU_H_
+#ifndef DRIVERS__PASSTHROUGH__VTD__IOMMU_H
+#define DRIVERS__PASSTHROUGH__VTD__IOMMU_H
 
 #include <xen/iommu.h>
 #include <asm/msi.h>
diff --git a/xen/drivers/passthrough/vtd/vtd.h b/xen/drivers/passthrough/vtd/vtd.h
index cb2df76eed..8aeff8c1f2 100644
--- a/xen/drivers/passthrough/vtd/vtd.h
+++ b/xen/drivers/passthrough/vtd/vtd.h
@@ -17,8 +17,8 @@
  * Copyright (C) Weidong Han <weidong.han@intel.com>
  */
 
-#ifndef _VTD_H_
-#define _VTD_H_
+#ifndef DRIVERS__PASSTHROUGH__VTD__VTD_H
+#define DRIVERS__PASSTHROUGH__VTD__VTD_H
 
 #include <xen/iommu.h>
 
@@ -72,4 +72,4 @@ struct msi_msg_remap_entry {
     u32	data;		/* msi message data */
 };
 
-#endif // _VTD_H_
+#endif // DRIVERS__PASSTHROUGH__VTD__VTD_H
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 442ae5322d..b928c67e19 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -16,8 +16,8 @@
  * Copyright (C) Allen Kay <allen.m.kay@intel.com>
  */
 
-#ifndef _IOMMU_H_
-#define _IOMMU_H_
+#ifndef XEN__IOMMU_H
+#define XEN__IOMMU_H
 
 #include <xen/mm-frame.h>
 #include <xen/init.h>
@@ -440,7 +440,7 @@ static inline int iommu_update_ire_from_msi(
 }
 #endif
 
-#endif /* _IOMMU_H_ */
+#endif /* XEN__IOMMU_H */
 
 /*
  * Local variables:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 08:00:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 08:00:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.813796.1226821 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syRcO-0003HB-LE; Wed, 09 Oct 2024 08:00:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 813796.1226821; Wed, 09 Oct 2024 08: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 1syRcO-0003H4-IE; Wed, 09 Oct 2024 08:00:24 +0000
Received: by outflank-mailman (input) for mailman id 813796;
 Wed, 09 Oct 2024 08: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 1syRcN-0003Gs-N4
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 08: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 1syRcN-0003l4-M9
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 08:00:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syRcN-0001tq-K7
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 08: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=mlljWEpbjzTnZRF+Iwz5mOjtRMkFYC0LqSEF7pmA5wU=; b=3tGKZIDCBVGW39Orzvw2hhzFz3
	ViKTfQwNaZmobmAiYGjNs8KS5Hy+WKpPMo5D0Gb0r9QCWhxT0n5/7cDrrNs1Qsq9P+ahCNz4TxNxm
	36ShoKEvkbM2Iyhw365OXdDhQg6yXH67Mr9BWiWKljSHw49QH/n8y43G1nsPB+JyEM9U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: Update header guards - RISC-V
Message-Id: <E1syRcN-0001tq-K7@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 08:00:23 +0000

commit b3152931302c9415eecd4f5bc4236bbfee9194a6
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Wed Oct 9 09:53:49 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 9 09:53:49 2024 +0200

    xen: Update header guards - RISC-V
    
    Update headers related to RISC-V.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/acpi.h           | 6 +++---
 xen/arch/riscv/include/asm/asm.h            | 6 +++---
 xen/arch/riscv/include/asm/atomic.h         | 6 +++---
 xen/arch/riscv/include/asm/bitops.h         | 6 +++---
 xen/arch/riscv/include/asm/bug.h            | 6 +++---
 xen/arch/riscv/include/asm/byteorder.h      | 6 +++---
 xen/arch/riscv/include/asm/cache.h          | 6 +++---
 xen/arch/riscv/include/asm/cmpxchg.h        | 6 +++---
 xen/arch/riscv/include/asm/config.h         | 6 +++---
 xen/arch/riscv/include/asm/cpufeature.h     | 6 +++---
 xen/arch/riscv/include/asm/csr.h            | 6 +++---
 xen/arch/riscv/include/asm/current.h        | 6 +++---
 xen/arch/riscv/include/asm/domain.h         | 6 +++---
 xen/arch/riscv/include/asm/early_printk.h   | 6 +++---
 xen/arch/riscv/include/asm/event.h          | 6 +++---
 xen/arch/riscv/include/asm/fence.h          | 6 +++---
 xen/arch/riscv/include/asm/fixmap.h         | 6 +++---
 xen/arch/riscv/include/asm/flushtlb.h       | 6 +++---
 xen/arch/riscv/include/asm/guest_access.h   | 6 +++---
 xen/arch/riscv/include/asm/guest_atomics.h  | 6 +++---
 xen/arch/riscv/include/asm/io.h             | 6 +++---
 xen/arch/riscv/include/asm/irq.h            | 6 +++---
 xen/arch/riscv/include/asm/mm.h             | 6 +++---
 xen/arch/riscv/include/asm/monitor.h        | 6 +++---
 xen/arch/riscv/include/asm/nospec.h         | 6 +++---
 xen/arch/riscv/include/asm/p2m.h            | 6 +++---
 xen/arch/riscv/include/asm/page-bits.h      | 6 +++---
 xen/arch/riscv/include/asm/page.h           | 6 +++---
 xen/arch/riscv/include/asm/pmap.h           | 6 +++---
 xen/arch/riscv/include/asm/processor.h      | 6 +++---
 xen/arch/riscv/include/asm/regs.h           | 6 +++---
 xen/arch/riscv/include/asm/riscv_encoding.h | 4 ++--
 xen/arch/riscv/include/asm/sbi.h            | 6 +++---
 xen/arch/riscv/include/asm/setup.h          | 6 +++---
 xen/arch/riscv/include/asm/smp.h            | 4 ++--
 xen/arch/riscv/include/asm/spinlock.h       | 6 +++---
 xen/arch/riscv/include/asm/string.h         | 6 +++---
 xen/arch/riscv/include/asm/system.h         | 6 +++---
 xen/arch/riscv/include/asm/time.h           | 6 +++---
 xen/arch/riscv/include/asm/traps.h          | 6 +++---
 xen/arch/riscv/include/asm/types.h          | 6 +++---
 41 files changed, 121 insertions(+), 121 deletions(-)

diff --git a/xen/arch/riscv/include/asm/acpi.h b/xen/arch/riscv/include/asm/acpi.h
index 3aef993d81..f0b5e90969 100644
--- a/xen/arch/riscv/include/asm/acpi.h
+++ b/xen/arch/riscv/include/asm/acpi.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 
-#ifndef __ASM_RISCV_ACPI_H
-#define __ASM_RISCV_ACPI_H
+#ifndef ASM__RISCV__ACPI_H
+#define ASM__RISCV__ACPI_H
 
-#endif /* __ASM_RISCV_ACPI_H */
+#endif /* ASM__RISCV__ACPI_H */
diff --git a/xen/arch/riscv/include/asm/asm.h b/xen/arch/riscv/include/asm/asm.h
index 87a3fd250b..8b0403e2e4 100644
--- a/xen/arch/riscv/include/asm/asm.h
+++ b/xen/arch/riscv/include/asm/asm.h
@@ -3,8 +3,8 @@
  * Copyright (C) 2015 Regents of the University of California
  */
 
-#ifndef _ASM_RISCV_ASM_H
-#define _ASM_RISCV_ASM_H
+#ifndef ASM__RISCV__ASM_H
+#define ASM__RISCV__ASM_H
 
 #ifdef __ASSEMBLY__
 #include <xen/linkage.h>
@@ -52,4 +52,4 @@
 #error "Unexpected __SIZEOF_SHORT__"
 #endif
 
-#endif /* _ASM_RISCV_ASM_H */
+#endif /* ASM__RISCV__ASM_H */
diff --git a/xen/arch/riscv/include/asm/atomic.h b/xen/arch/riscv/include/asm/atomic.h
index 9669a3286d..8e0425cea0 100644
--- a/xen/arch/riscv/include/asm/atomic.h
+++ b/xen/arch/riscv/include/asm/atomic.h
@@ -19,8 +19,8 @@
  * Copyright (C) 2024 Vates SAS
  */
 
-#ifndef _ASM_RISCV_ATOMIC_H
-#define _ASM_RISCV_ATOMIC_H
+#ifndef ASM__RISCV__ATOMIC_H
+#define ASM__RISCV__ATOMIC_H
 
 #include <xen/atomic.h>
 
@@ -266,7 +266,7 @@ ATOMIC_OPS()
 #undef ATOMIC_OPS
 #undef ATOMIC_OP
 
-#endif /* _ASM_RISCV_ATOMIC_H */
+#endif /* ASM__RISCV__ATOMIC_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/bitops.h b/xen/arch/riscv/include/asm/bitops.h
index 7f7af3fda1..9a6f576187 100644
--- a/xen/arch/riscv/include/asm/bitops.h
+++ b/xen/arch/riscv/include/asm/bitops.h
@@ -1,8 +1,8 @@
 /* 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
+#ifndef ASM__RISCV__BITOPS_H
+#define ASM__RISCV__BITOPS_H
 
 #include <asm/system.h>
 
@@ -125,7 +125,7 @@ static inline void clear_bit(int nr, volatile void *p)
 #undef NOT
 #undef __AMO
 
-#endif /* _ASM_RISCV_BITOPS_H */
+#endif /* ASM__RISCV__BITOPS_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/bug.h b/xen/arch/riscv/include/asm/bug.h
index e3d41f411a..fa18dba20e 100644
--- a/xen/arch/riscv/include/asm/bug.h
+++ b/xen/arch/riscv/include/asm/bug.h
@@ -4,8 +4,8 @@
  * Copyright (C) 2021-2023 Vates
  *
  */
-#ifndef _ASM_RISCV_BUG_H
-#define _ASM_RISCV_BUG_H
+#ifndef ASM__RISCV__BUG_H
+#define ASM__RISCV__BUG_H
 
 #ifndef __ASSEMBLY__
 
@@ -32,4 +32,4 @@
 
 #endif /* !__ASSEMBLY__ */
 
-#endif /* _ASM_RISCV_BUG_H */
+#endif /* ASM__RISCV__BUG_H */
diff --git a/xen/arch/riscv/include/asm/byteorder.h b/xen/arch/riscv/include/asm/byteorder.h
index 320a03c88f..8ca65e1b33 100644
--- a/xen/arch/riscv/include/asm/byteorder.h
+++ b/xen/arch/riscv/include/asm/byteorder.h
@@ -1,11 +1,11 @@
-#ifndef __ASM_RISCV_BYTEORDER_H__
-#define __ASM_RISCV_BYTEORDER_H__
+#ifndef ASM__RISCV__BYTEORDER_H
+#define ASM__RISCV__BYTEORDER_H
 
 #define __BYTEORDER_HAS_U64__
 
 #include <xen/byteorder/little_endian.h>
 
-#endif /* __ASM_RISCV_BYTEORDER_H__ */
+#endif /* ASM__RISCV__BYTEORDER_H */
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/riscv/include/asm/cache.h b/xen/arch/riscv/include/asm/cache.h
index 69573eb051..9a9e5162ab 100644
--- a/xen/arch/riscv/include/asm/cache.h
+++ b/xen/arch/riscv/include/asm/cache.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 
-#ifndef _ASM_RISCV_CACHE_H
-#define _ASM_RISCV_CACHE_H
+#ifndef ASM__RISCV__CACHE_H
+#define ASM__RISCV__CACHE_H
 
-#endif /* _ASM_RISCV_CACHE_H */
+#endif /* ASM__RISCV__CACHE_H */
diff --git a/xen/arch/riscv/include/asm/cmpxchg.h b/xen/arch/riscv/include/asm/cmpxchg.h
index 47d5299e62..662d3fd5d4 100644
--- a/xen/arch/riscv/include/asm/cmpxchg.h
+++ b/xen/arch/riscv/include/asm/cmpxchg.h
@@ -1,8 +1,8 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /* Copyright (C) 2014 Regents of the University of California */
 
-#ifndef _ASM_RISCV_CMPXCHG_H
-#define _ASM_RISCV_CMPXCHG_H
+#ifndef ASM__RISCV__CMPXCHG_H
+#define ASM__RISCV__CMPXCHG_H
 
 #include <xen/compiler.h>
 #include <xen/lib.h>
@@ -242,7 +242,7 @@ static always_inline unsigned long __cmpxchg(volatile void *ptr,
               sizeof(*(ptr))); \
 })
 
-#endif /* _ASM_RISCV_CMPXCHG_H */
+#endif /* ASM__RISCV__CMPXCHG_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/config.h b/xen/arch/riscv/include/asm/config.h
index 7dbb235685..ef68281653 100644
--- a/xen/arch/riscv/include/asm/config.h
+++ b/xen/arch/riscv/include/asm/config.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
-#ifndef __RISCV_CONFIG_H__
-#define __RISCV_CONFIG_H__
+#ifndef ASM__RISCV__CONFIG_H
+#define ASM__RISCV__CONFIG_H
 
 #include <xen/const.h>
 #include <xen/page-size.h>
@@ -155,7 +155,7 @@
 
 #define IDENT_AREA_SIZE 64
 
-#endif /* __RISCV_CONFIG_H__ */
+#endif /* ASM__RISCV__CONFIG_H */
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/riscv/include/asm/cpufeature.h b/xen/arch/riscv/include/asm/cpufeature.h
index c08b7d67ad..41a792b0b2 100644
--- a/xen/arch/riscv/include/asm/cpufeature.h
+++ b/xen/arch/riscv/include/asm/cpufeature.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_RISCV_CPUFEATURE_H
-#define __ASM_RISCV_CPUFEATURE_H
+#ifndef ASM__RISCV__CPUFEATURE_H
+#define ASM__RISCV__CPUFEATURE_H
 
 #ifndef __ASSEMBLY__
 
@@ -11,7 +11,7 @@ static inline unsigned int cpu_nr_siblings(unsigned int cpu)
 
 #endif /* __ASSEMBLY__ */
 
-#endif /* __ASM_RISCV_CPUFEATURE_H */
+#endif /* ASM__RISCV__CPUFEATURE_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/csr.h b/xen/arch/riscv/include/asm/csr.h
index be57dcce1c..775f1f170f 100644
--- a/xen/arch/riscv/include/asm/csr.h
+++ b/xen/arch/riscv/include/asm/csr.h
@@ -3,8 +3,8 @@
  * Copyright (C) 2015 Regents of the University of California
  */
 
-#ifndef _ASM_RISCV_CSR_H
-#define _ASM_RISCV_CSR_H
+#ifndef ASM__RISCV__CSR_H
+#define ASM__RISCV__CSR_H
 
 #include <asm/asm.h>
 #include <xen/const.h>
@@ -80,4 +80,4 @@
 
 #endif /* __ASSEMBLY__ */
 
-#endif /* _ASM_RISCV_CSR_H */
+#endif /* ASM__RISCV__CSR_H */
diff --git a/xen/arch/riscv/include/asm/current.h b/xen/arch/riscv/include/asm/current.h
index 6f1ec4e190..1485bceea4 100644
--- a/xen/arch/riscv/include/asm/current.h
+++ b/xen/arch/riscv/include/asm/current.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
-#ifndef __ASM_CURRENT_H
-#define __ASM_CURRENT_H
+#ifndef ASM__RISCV__CURRENT_H
+#define ASM__RISCV__CURRENT_H
 
 #include <xen/bug.h>
 #include <xen/cache.h>
@@ -54,4 +54,4 @@ DECLARE_PER_CPU(struct vcpu *, curr_vcpu);
 
 #endif /* __ASSEMBLY__ */
 
-#endif /* __ASM_CURRENT_H */
+#endif /* ASM__RISCV__CURRENT_H */
diff --git a/xen/arch/riscv/include/asm/domain.h b/xen/arch/riscv/include/asm/domain.h
index 027bfa8a93..c3d965a559 100644
--- a/xen/arch/riscv/include/asm/domain.h
+++ b/xen/arch/riscv/include/asm/domain.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_RISCV_DOMAIN_H__
-#define __ASM_RISCV_DOMAIN_H__
+#ifndef ASM__RISCV__DOMAIN_H
+#define ASM__RISCV__DOMAIN_H
 
 #include <xen/xmalloc.h>
 #include <public/hvm/params.h>
@@ -39,7 +39,7 @@ static inline void update_guest_memory_policy(struct vcpu *v,
 
 static inline void arch_vcpu_block(struct vcpu *v) {}
 
-#endif /* __ASM_RISCV_DOMAIN_H__ */
+#endif /* ASM__RISCV__DOMAIN_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/early_printk.h b/xen/arch/riscv/include/asm/early_printk.h
index 85e60df33a..2750045bdd 100644
--- a/xen/arch/riscv/include/asm/early_printk.h
+++ b/xen/arch/riscv/include/asm/early_printk.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
-#ifndef __EARLY_PRINTK_H__
-#define __EARLY_PRINTK_H__
+#ifndef ASM__RISCV__EARLY_PRINTK_H
+#define ASM__RISCV__EARLY_PRINTK_H
 
 #include <xen/early_printk.h>
 
@@ -11,4 +11,4 @@ void early_printk(const char *str);
 static inline void early_printk(const char *s) {};
 #endif
 
-#endif /* __EARLY_PRINTK_H__ */
+#endif /* ASM__RISCV__EARLY_PRINTK_H */
diff --git a/xen/arch/riscv/include/asm/event.h b/xen/arch/riscv/include/asm/event.h
index fbad8543fa..c7bb8c0fa6 100644
--- a/xen/arch/riscv/include/asm/event.h
+++ b/xen/arch/riscv/include/asm/event.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_RISCV_EVENT_H__
-#define __ASM_RISCV_EVENT_H__
+#ifndef ASM__RISCV__EVENT_H
+#define ASM__RISCV__EVENT_H
 
 #include <xen/lib.h>
 
@@ -29,7 +29,7 @@ static inline bool arch_virq_is_global(unsigned int virq)
     return true;
 }
 
-#endif /* __ASM_RISCV_EVENT_H__ */
+#endif /* ASM__RISCV__EVENT_H */
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/riscv/include/asm/fence.h b/xen/arch/riscv/include/asm/fence.h
index 27f46fa897..edfaac49cd 100644
--- a/xen/arch/riscv/include/asm/fence.h
+++ b/xen/arch/riscv/include/asm/fence.h
@@ -1,9 +1,9 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
-#ifndef _ASM_RISCV_FENCE_H
-#define _ASM_RISCV_FENCE_H
+#ifndef ASM__RISCV__FENCE_H
+#define ASM__RISCV__FENCE_H
 
 #define RISCV_ACQUIRE_BARRIER   "\tfence r , rw\n"
 #define RISCV_RELEASE_BARRIER   "\tfence rw, w\n"
 #define RISCV_FULL_BARRIER      "\tfence rw, rw\n"
 
-#endif	/* _ASM_RISCV_FENCE_H */
+#endif	/* ASM__RISCV__FENCE_H */
diff --git a/xen/arch/riscv/include/asm/fixmap.h b/xen/arch/riscv/include/asm/fixmap.h
index 63732df36c..818c8ce07b 100644
--- a/xen/arch/riscv/include/asm/fixmap.h
+++ b/xen/arch/riscv/include/asm/fixmap.h
@@ -2,8 +2,8 @@
 /*
  * fixmap.h: compile-time virtual memory allocation
  */
-#ifndef ASM_FIXMAP_H
-#define ASM_FIXMAP_H
+#ifndef ASM__RISCV__FIXMAP_H
+#define ASM__RISCV__FIXMAP_H
 
 #include <xen/bug.h>
 #include <xen/page-size.h>
@@ -43,4 +43,4 @@ static inline unsigned int virt_to_fix(vaddr_t vaddr)
 
 #endif /* __ASSEMBLY__ */
 
-#endif /* ASM_FIXMAP_H */
+#endif /* ASM__RISCV__FIXMAP_H */
diff --git a/xen/arch/riscv/include/asm/flushtlb.h b/xen/arch/riscv/include/asm/flushtlb.h
index 43214f5e95..51c8f753c5 100644
--- a/xen/arch/riscv/include/asm/flushtlb.h
+++ b/xen/arch/riscv/include/asm/flushtlb.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_RISCV_FLUSHTLB_H__
-#define __ASM_RISCV_FLUSHTLB_H__
+#ifndef ASM__RISCV__FLUSHTLB_H
+#define ASM__RISCV__FLUSHTLB_H
 
 #include <xen/bug.h>
 #include <xen/cpumask.h>
@@ -37,7 +37,7 @@ static inline void page_set_tlbflush_timestamp(struct page_info *page)
 /* Flush specified CPUs' TLBs */
 void arch_flush_tlb_mask(const cpumask_t *mask);
 
-#endif /* __ASM_RISCV_FLUSHTLB_H__ */
+#endif /* ASM__RISCV__FLUSHTLB_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/guest_access.h b/xen/arch/riscv/include/asm/guest_access.h
index c55951f538..7cd51fbbde 100644
--- a/xen/arch/riscv/include/asm/guest_access.h
+++ b/xen/arch/riscv/include/asm/guest_access.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_RISCV_GUEST_ACCESS_H__
-#define __ASM_RISCV_GUEST_ACCESS_H__
+#ifndef ASM__RISCV__GUEST_ACCESS_H
+#define ASM__RISCV__GUEST_ACCESS_H
 
 unsigned long raw_copy_to_guest(void *to, const void *from, unsigned len);
 unsigned long raw_copy_from_guest(void *to, const void *from, unsigned len);
@@ -18,7 +18,7 @@ unsigned long raw_clear_guest(void *to, unsigned int len);
 #define guest_handle_okay(hnd, nr) (1)
 #define guest_handle_subrange_okay(hnd, first, last) (1)
 
-#endif /* __ASM_RISCV_GUEST_ACCESS_H__ */
+#endif /* ASM__RISCV__GUEST_ACCESS_H */
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/riscv/include/asm/guest_atomics.h b/xen/arch/riscv/include/asm/guest_atomics.h
index de54914454..22a7551804 100644
--- a/xen/arch/riscv/include/asm/guest_atomics.h
+++ b/xen/arch/riscv/include/asm/guest_atomics.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_RISCV_GUEST_ATOMICS_H
-#define __ASM_RISCV_GUEST_ATOMICS_H
+#ifndef ASM__RISCV__GUEST_ATOMICS_H
+#define ASM__RISCV__GUEST_ATOMICS_H
 
 #include <xen/bug.h>
 
@@ -32,7 +32,7 @@ guest_testop(test_and_change_bit)
 
 #define guest_test_bit(d, nr, p) ((void)(d), test_bit(nr, p))
 
-#endif /* __ASM_RISCV_GUEST_ATOMICS_H */
+#endif /* ASM__RISCV__GUEST_ATOMICS_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/io.h b/xen/arch/riscv/include/asm/io.h
index 8d9535e973..55f329dde3 100644
--- a/xen/arch/riscv/include/asm/io.h
+++ b/xen/arch/riscv/include/asm/io.h
@@ -35,8 +35,8 @@
  * Copyright (C) 2024 Vates
  */
 
-#ifndef _ASM_RISCV_IO_H
-#define _ASM_RISCV_IO_H
+#ifndef ASM__RISCV__IO_H
+#define ASM__RISCV__IO_H
 
 #include <asm/byteorder.h>
 
@@ -156,7 +156,7 @@ static inline uint64_t __raw_readq(const volatile void __iomem *addr)
 #define writel(v, c)    ({ __io_bw(); writel_cpu(v, c); __io_aw(); })
 #define writeq(v, c)    ({ __io_bw(); writeq_cpu(v, c); __io_aw(); })
 
-#endif /* _ASM_RISCV_IO_H */
+#endif /* ASM__RISCV__IO_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/irq.h b/xen/arch/riscv/include/asm/irq.h
index 0dfd4d6e8a..2a48da2651 100644
--- a/xen/arch/riscv/include/asm/irq.h
+++ b/xen/arch/riscv/include/asm/irq.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_RISCV_IRQ_H__
-#define __ASM_RISCV_IRQ_H__
+#ifndef ASM__RISCV__IRQ_H
+#define ASM__RISCV__IRQ_H
 
 #include <xen/bug.h>
 
@@ -25,7 +25,7 @@ static inline void arch_move_irqs(struct vcpu *v)
     BUG_ON("unimplemented");
 }
 
-#endif /* __ASM_RISCV_IRQ_H__ */
+#endif /* ASM__RISCV__IRQ_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/mm.h
index 4b7b00b850..5c79f3def3 100644
--- a/xen/arch/riscv/include/asm/mm.h
+++ b/xen/arch/riscv/include/asm/mm.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
-#ifndef _ASM_RISCV_MM_H
-#define _ASM_RISCV_MM_H
+#ifndef ASM__RISCV__MM_H
+#define ASM__RISCV__MM_H
 
 #include <public/xen.h>
 #include <xen/bug.h>
@@ -261,4 +261,4 @@ void setup_fixmap_mappings(void);
 
 void *early_fdt_map(paddr_t fdt_paddr);
 
-#endif /* _ASM_RISCV_MM_H */
+#endif /* ASM__RISCV__MM_H */
diff --git a/xen/arch/riscv/include/asm/monitor.h b/xen/arch/riscv/include/asm/monitor.h
index f4fe2c0690..fb3d3e8e3a 100644
--- a/xen/arch/riscv/include/asm/monitor.h
+++ b/xen/arch/riscv/include/asm/monitor.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_RISCV_MONITOR_H__
-#define __ASM_RISCV_MONITOR_H__
+#ifndef ASM__RISCV__MONITOR_H
+#define ASM__RISCV__MONITOR_H
 
 #include <xen/bug.h>
 
@@ -14,7 +14,7 @@ static inline uint32_t arch_monitor_get_capabilities(struct domain *d)
     return 0;
 }
 
-#endif /* __ASM_RISCV_MONITOR_H__ */
+#endif /* ASM__RISCV__MONITOR_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/nospec.h b/xen/arch/riscv/include/asm/nospec.h
index e30f0a781b..f9b0241c98 100644
--- a/xen/arch/riscv/include/asm/nospec.h
+++ b/xen/arch/riscv/include/asm/nospec.h
@@ -1,8 +1,8 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /* Copyright (C) 2024 Vates */
 
-#ifndef _ASM_RISCV_NOSPEC_H
-#define _ASM_RISCV_NOSPEC_H
+#ifndef ASM__RISCV__NOSPEC_H
+#define ASM__RISCV__NOSPEC_H
 
 static inline bool evaluate_nospec(bool condition)
 {
@@ -13,7 +13,7 @@ static inline void block_speculation(void)
 {
 }
 
-#endif /* _ASM_RISCV_NOSPEC_H */
+#endif /* ASM__RISCV__NOSPEC_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/p2m.h b/xen/arch/riscv/include/asm/p2m.h
index 26860c0ae7..28f57a74f2 100644
--- a/xen/arch/riscv/include/asm/p2m.h
+++ b/xen/arch/riscv/include/asm/p2m.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_RISCV_P2M_H__
-#define __ASM_RISCV_P2M_H__
+#ifndef ASM__RISCV__P2M_H
+#define ASM__RISCV__P2M_H
 
 #include <xen/errno.h>
 
@@ -93,7 +93,7 @@ static inline void p2m_altp2m_check(struct vcpu *v, uint16_t idx)
     /* Not supported on RISCV. */
 }
 
-#endif /* __ASM_RISCV_P2M_H__ */
+#endif /* ASM__RISCV__P2M_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/page-bits.h b/xen/arch/riscv/include/asm/page-bits.h
index 8f1f474371..788c7d9518 100644
--- a/xen/arch/riscv/include/asm/page-bits.h
+++ b/xen/arch/riscv/include/asm/page-bits.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
-#ifndef __RISCV_PAGE_BITS_H__
-#define __RISCV_PAGE_BITS_H__
+#ifndef ASM__RISCV__PAGE_BITS_H
+#define ASM__RISCV__PAGE_BITS_H
 
 #define PAGE_SHIFT              12 /* 4 KiB Pages */
 #define PADDR_BITS              56 /* 44-bit PPN */
@@ -16,4 +16,4 @@
 
 #define PTE_PPN_SHIFT           10
 
-#endif /* __RISCV_PAGE_BITS_H__ */
+#endif /* ASM__RISCV__PAGE_BITS_H */
diff --git a/xen/arch/riscv/include/asm/page.h b/xen/arch/riscv/include/asm/page.h
index 89fa290697..91b1194b55 100644
--- a/xen/arch/riscv/include/asm/page.h
+++ b/xen/arch/riscv/include/asm/page.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
-#ifndef _ASM_RISCV_PAGE_H
-#define _ASM_RISCV_PAGE_H
+#ifndef ASM__RISCV__PAGE_H
+#define ASM__RISCV__PAGE_H
 
 #ifndef __ASSEMBLY__
 
@@ -182,4 +182,4 @@ static inline pte_t pte_from_mfn(mfn_t mfn, unsigned int flags)
 
 #endif /* __ASSEMBLY__ */
 
-#endif /* _ASM_RISCV_PAGE_H */
+#endif /* ASM__RISCV__PAGE_H */
diff --git a/xen/arch/riscv/include/asm/pmap.h b/xen/arch/riscv/include/asm/pmap.h
index 60065c996f..146dd29f95 100644
--- a/xen/arch/riscv/include/asm/pmap.h
+++ b/xen/arch/riscv/include/asm/pmap.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
-#ifndef ASM_PMAP_H
-#define ASM_PMAP_H
+#ifndef ASM__RISCV__PMAP_H
+#define ASM__RISCV__PMAP_H
 
 #include <xen/bug.h>
 #include <xen/init.h>
@@ -33,4 +33,4 @@ static inline void __init arch_pmap_unmap(unsigned int slot)
     flush_tlb_one_local(FIXMAP_ADDR(slot));
 }
 
-#endif /* ASM_PMAP_H */
+#endif /* ASM__RISCV__PMAP_H */
diff --git a/xen/arch/riscv/include/asm/processor.h b/xen/arch/riscv/include/asm/processor.h
index e42b353b4c..90b8009563 100644
--- a/xen/arch/riscv/include/asm/processor.h
+++ b/xen/arch/riscv/include/asm/processor.h
@@ -7,8 +7,8 @@
  *
  */
 
-#ifndef _ASM_RISCV_PROCESSOR_H
-#define _ASM_RISCV_PROCESSOR_H
+#ifndef ASM__RISCV__PROCESSOR_H
+#define ASM__RISCV__PROCESSOR_H
 
 #ifndef __ASSEMBLY__
 
@@ -93,7 +93,7 @@ static inline void sfence_vma(void)
 
 #endif /* __ASSEMBLY__ */
 
-#endif /* _ASM_RISCV_PROCESSOR_H */
+#endif /* ASM__RISCV__PROCESSOR_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/regs.h b/xen/arch/riscv/include/asm/regs.h
index c70ea2aa0c..218b9455bd 100644
--- a/xen/arch/riscv/include/asm/regs.h
+++ b/xen/arch/riscv/include/asm/regs.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ARM_RISCV_REGS_H__
-#define __ARM_RISCV_REGS_H__
+#ifndef ASM__RISCV__REGS_H
+#define ASM__RISCV__REGS_H
 
 #ifndef __ASSEMBLY__
 
@@ -17,7 +17,7 @@ static inline bool guest_mode(const struct cpu_user_regs *r)
 
 #endif /* __ASSEMBLY__ */
 
-#endif /* __ARM_RISCV_REGS_H__ */
+#endif /* ASM__RISCV__REGS_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/riscv_encoding.h b/xen/arch/riscv/include/asm/riscv_encoding.h
index e31e94e77e..6cc8f4eb45 100644
--- a/xen/arch/riscv/include/asm/riscv_encoding.h
+++ b/xen/arch/riscv/include/asm/riscv_encoding.h
@@ -6,8 +6,8 @@
  *   Anup Patel <anup.patel@wdc.com>
  */
 
-#ifndef __RISCV_ENCODING_H__
-#define __RISCV_ENCODING_H__
+#ifndef ASM__RISCV__RISCV_ENCODING_H
+#define ASM__RISCV__RISCV_ENCODING_H
 
 #define _UL(X) _AC(X, UL)
 #define _ULL(X) _AC(X, ULL)
diff --git a/xen/arch/riscv/include/asm/sbi.h b/xen/arch/riscv/include/asm/sbi.h
index 5947fed779..527d773277 100644
--- a/xen/arch/riscv/include/asm/sbi.h
+++ b/xen/arch/riscv/include/asm/sbi.h
@@ -9,8 +9,8 @@
  * Copyright (c) 2019 Western Digital Corporation or its affiliates.
  */
 
-#ifndef __ASM_RISCV_SBI_H__
-#define __ASM_RISCV_SBI_H__
+#ifndef ASM__RISCV__SBI_H
+#define ASM__RISCV__SBI_H
 
 #include <xen/cpumask.h>
 
@@ -96,4 +96,4 @@ int sbi_remote_sfence_vma(const cpumask_t *cpu_mask, vaddr_t start,
  */
 int sbi_init(void);
 
-#endif /* __ASM_RISCV_SBI_H__ */
+#endif /* ASM__RISCV__SBI_H */
diff --git a/xen/arch/riscv/include/asm/setup.h b/xen/arch/riscv/include/asm/setup.h
index 7613a5dbd0..c0214a9bf2 100644
--- a/xen/arch/riscv/include/asm/setup.h
+++ b/xen/arch/riscv/include/asm/setup.h
@@ -1,11 +1,11 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
-#ifndef __ASM_RISCV_SETUP_H__
-#define __ASM_RISCV_SETUP_H__
+#ifndef ASM__RISCV__SETUP_H
+#define ASM__RISCV__SETUP_H
 
 #define max_init_domid (0)
 
-#endif /* __ASM_RISCV_SETUP_H__ */
+#endif /* ASM__RISCV__SETUP_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/smp.h b/xen/arch/riscv/include/asm/smp.h
index 092b101ff4..5e170b57b3 100644
--- a/xen/arch/riscv/include/asm/smp.h
+++ b/xen/arch/riscv/include/asm/smp.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_RISCV_SMP_H
-#define __ASM_RISCV_SMP_H
+#ifndef ASM__RISCV__SMP_H
+#define ASM__RISCV__SMP_H
 
 #include <xen/cpumask.h>
 #include <xen/percpu.h>
diff --git a/xen/arch/riscv/include/asm/spinlock.h b/xen/arch/riscv/include/asm/spinlock.h
index bf45a7f005..4a607eba52 100644
--- a/xen/arch/riscv/include/asm/spinlock.h
+++ b/xen/arch/riscv/include/asm/spinlock.h
@@ -1,5 +1,5 @@
-#ifndef __ASM_RISCV_SPINLOCK_H
-#define __ASM_RISCV_SPINLOCK_H
+#ifndef ASM__RISCV__SPINLOCK_H
+#define ASM__RISCV__SPINLOCK_H
 
 #define arch_lock_acquire_barrier() smp_mb()
 #define arch_lock_release_barrier() smp_mb()
@@ -12,4 +12,4 @@
     arch_lock_signal();             \
 })
 
-#endif /* __ASM_RISCV_SPINLOCK_H */
+#endif /* ASM__RISCV__SPINLOCK_H */
diff --git a/xen/arch/riscv/include/asm/string.h b/xen/arch/riscv/include/asm/string.h
index a26ba8f5c6..75a2048fb1 100644
--- a/xen/arch/riscv/include/asm/string.h
+++ b/xen/arch/riscv/include/asm/string.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 
-#ifndef _ASM_RISCV_STRING_H
-#define _ASM_RISCV_STRING_H
+#ifndef ASM__RISCV__STRING_H
+#define ASM__RISCV__STRING_H
 
-#endif /* _ASM_RISCV_STRING_H */
+#endif /* ASM__RISCV__STRING_H */
diff --git a/xen/arch/riscv/include/asm/system.h b/xen/arch/riscv/include/asm/system.h
index f76bafd168..7b78d11e04 100644
--- a/xen/arch/riscv/include/asm/system.h
+++ b/xen/arch/riscv/include/asm/system.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
-#ifndef _ASM_RISCV_SYSTEM_H
-#define _ASM_RISCV_SYSTEM_H
+#ifndef ASM__RISCV__SYSTEM_H
+#define ASM__RISCV__SYSTEM_H
 
 #include <xen/stdbool.h>
 
@@ -78,7 +78,7 @@ static inline bool local_irq_is_enabled(void)
 
 #endif /* __ASSEMBLY__ */
 
-#endif /* _ASM_RISCV_SYSTEM_H */
+#endif /* ASM__RISCV__SYSTEM_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/time.h b/xen/arch/riscv/include/asm/time.h
index affeb0506a..fc1572e9b4 100644
--- a/xen/arch/riscv/include/asm/time.h
+++ b/xen/arch/riscv/include/asm/time.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_RISCV_TIME_H__
-#define __ASM_RISCV_TIME_H__
+#ifndef ASM__RISCV__TIME_H
+#define ASM__RISCV__TIME_H
 
 #include <xen/bug.h>
 #include <asm/csr.h>
@@ -19,7 +19,7 @@ static inline cycles_t get_cycles(void)
     return csr_read(CSR_TIME);
 }
 
-#endif /* __ASM_RISCV_TIME_H__ */
+#endif /* ASM__RISCV__TIME_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/traps.h b/xen/arch/riscv/include/asm/traps.h
index c30118e095..72b8f6c475 100644
--- a/xen/arch/riscv/include/asm/traps.h
+++ b/xen/arch/riscv/include/asm/traps.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
-#ifndef __ASM_TRAPS_H__
-#define __ASM_TRAPS_H__
+#ifndef ASM__RISCV__TRAPS_H
+#define ASM__RISCV__TRAPS_H
 
 #include <asm/processor.h>
 
@@ -13,4 +13,4 @@ void trap_init(void);
 
 #endif /* __ASSEMBLY__ */
 
-#endif /* __ASM_TRAPS_H__ */
+#endif /* ASM__RISCV__TRAPS_H */
diff --git a/xen/arch/riscv/include/asm/types.h b/xen/arch/riscv/include/asm/types.h
index 59358fd698..d801596a20 100644
--- a/xen/arch/riscv/include/asm/types.h
+++ b/xen/arch/riscv/include/asm/types.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
-#ifndef __RISCV_TYPES_H__
-#define __RISCV_TYPES_H__
+#ifndef ASM__RISCV__TYPES_H
+#define ASM__RISCV__TYPES_H
 
 #if defined(CONFIG_RISCV_32)
 
@@ -25,7 +25,7 @@ typedef u64 register_t;
 
 #endif
 
-#endif /* __RISCV_TYPES_H__ */
+#endif /* ASM__RISCV__TYPES_H */
 /*
  * Local variables:
  * mode: C
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 08:00:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 08:00:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.813797.1226825 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syRcY-0003Jx-MZ; Wed, 09 Oct 2024 08:00:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 813797.1226825; Wed, 09 Oct 2024 08: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 1syRcY-0003Jq-Jx; Wed, 09 Oct 2024 08:00:34 +0000
Received: by outflank-mailman (input) for mailman id 813797;
 Wed, 09 Oct 2024 08: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 1syRcX-0003Ji-QU
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 08: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 1syRcX-0003lR-PF
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 08:00:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syRcX-0001v4-OM
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 08: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=QBP3TCI5SW2X5IqRMn6a/VwZue5M5dk2ScbSBDTOwno=; b=1EonaphoVKI3FKW6FfZvby/B1x
	Q3FZFmJhBGXhB0engMwW8Bo+7z26RIrndooePm6JzvLU0kog7cQlNhm4KTtVpnYBX7FDeoOYqeqg1
	zIcUKRTuExtUowZz4M0a/+LHpnHtvpZHUUPG3ydOczrrIu2LKuU17t6yPobyavoeC/uU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/APIC: Switch flat driver to use phys dst for ext ints
Message-Id: <E1syRcX-0001v4-OM@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 08:00:33 +0000

commit dcbf8210f3f3a49626341355308010eb92194b85
Author:     Matthew Barnes <matthew.barnes@cloud.com>
AuthorDate: Wed Oct 9 09:54:48 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 9 09:54:48 2024 +0200

    x86/APIC: Switch flat driver to use phys dst for ext ints
    
    External interrupts via logical delivery mode in xAPIC do not benefit
    from targeting multiple CPUs and instead simply bloat up the vector
    space.
    
    However the xAPIC flat driver currently uses logical delivery for
    external interrupts.
    
    This patch switches the xAPIC flat driver to use physical destination
    mode for external interrupts, instead of logical destination mode.
    
    This patch also applies the following non-functional changes:
    - Remove now unused logical flat functions
    - Expand GENAPIC_FLAT and GENAPIC_PHYS macros, and delete them.
    
    Resolves: https://gitlab.com/xen-project/xen/-/issues/194
    Signed-off-by: Matthew Barnes <matthew.barnes@cloud.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/genapic/bigsmp.c      |  8 +++++++-
 xen/arch/x86/genapic/default.c     |  8 +++++++-
 xen/arch/x86/genapic/delivery.c    | 10 ----------
 xen/arch/x86/include/asm/genapic.h | 18 ------------------
 4 files changed, 14 insertions(+), 30 deletions(-)

diff --git a/xen/arch/x86/genapic/bigsmp.c b/xen/arch/x86/genapic/bigsmp.c
index e97e4453a0..b2e7218452 100644
--- a/xen/arch/x86/genapic/bigsmp.c
+++ b/xen/arch/x86/genapic/bigsmp.c
@@ -46,5 +46,11 @@ static int __init cf_check probe_bigsmp(void)
 
 const struct genapic __initconst_cf_clobber apic_bigsmp = {
 	APIC_INIT("bigsmp", probe_bigsmp),
-	GENAPIC_PHYS
+	.int_delivery_mode = dest_Fixed,
+	.int_dest_mode = 0, /* physical delivery */
+	.init_apic_ldr = init_apic_ldr_phys,
+	.vector_allocation_cpumask = vector_allocation_cpumask_phys,
+	.cpu_mask_to_apicid = cpu_mask_to_apicid_phys,
+	.send_IPI_mask = send_IPI_mask_phys,
+	.send_IPI_self = send_IPI_self_legacy
 };
diff --git a/xen/arch/x86/genapic/default.c b/xen/arch/x86/genapic/default.c
index a968836a18..59c79afdb8 100644
--- a/xen/arch/x86/genapic/default.c
+++ b/xen/arch/x86/genapic/default.c
@@ -16,5 +16,11 @@
 /* should be called last. */
 const struct genapic __initconst_cf_clobber apic_default = {
 	APIC_INIT("default", NULL),
-	GENAPIC_FLAT
+	.int_delivery_mode = dest_Fixed,
+	.int_dest_mode = 0, /* physical delivery */
+	.init_apic_ldr = init_apic_ldr_flat,
+	.vector_allocation_cpumask = vector_allocation_cpumask_phys,
+	.cpu_mask_to_apicid = cpu_mask_to_apicid_phys,
+	.send_IPI_mask = send_IPI_mask_flat,
+	.send_IPI_self = send_IPI_self_legacy
 };
diff --git a/xen/arch/x86/genapic/delivery.c b/xen/arch/x86/genapic/delivery.c
index d1f99bf683..3def78f380 100644
--- a/xen/arch/x86/genapic/delivery.c
+++ b/xen/arch/x86/genapic/delivery.c
@@ -19,16 +19,6 @@ void cf_check init_apic_ldr_flat(void)
 	apic_write(APIC_LDR, val);
 }
 
-const cpumask_t *cf_check vector_allocation_cpumask_flat(int cpu)
-{
-	return &cpu_online_map;
-} 
-
-unsigned int cf_check cpu_mask_to_apicid_flat(const cpumask_t *cpumask)
-{
-	return cpumask_bits(cpumask)[0]&0xFF;
-}
-
 /*
  * PHYSICAL DELIVERY MODE (unicast to physical APIC IDs).
  */
diff --git a/xen/arch/x86/include/asm/genapic.h b/xen/arch/x86/include/asm/genapic.h
index a694371c6d..4d39fb9a24 100644
--- a/xen/arch/x86/include/asm/genapic.h
+++ b/xen/arch/x86/include/asm/genapic.h
@@ -44,29 +44,11 @@ extern const struct genapic apic_bigsmp;
 void cf_check send_IPI_self_legacy(uint8_t vector);
 
 void cf_check init_apic_ldr_flat(void);
-unsigned int cf_check cpu_mask_to_apicid_flat(const cpumask_t *cpumask);
 void cf_check send_IPI_mask_flat(const cpumask_t *cpumask, int vector);
-const cpumask_t *cf_check vector_allocation_cpumask_flat(int cpu);
-#define GENAPIC_FLAT \
-	.int_delivery_mode = dest_LowestPrio, \
-	.int_dest_mode = 1 /* logical delivery */, \
-	.init_apic_ldr = init_apic_ldr_flat, \
-	.vector_allocation_cpumask = vector_allocation_cpumask_flat, \
-	.cpu_mask_to_apicid = cpu_mask_to_apicid_flat, \
-	.send_IPI_mask = send_IPI_mask_flat, \
-	.send_IPI_self = send_IPI_self_legacy
 
 void cf_check init_apic_ldr_phys(void);
 unsigned int cf_check cpu_mask_to_apicid_phys(const cpumask_t *cpumask);
 void cf_check send_IPI_mask_phys(const cpumask_t *mask, int vector);
 const cpumask_t *cf_check vector_allocation_cpumask_phys(int cpu);
-#define GENAPIC_PHYS \
-	.int_delivery_mode = dest_Fixed, \
-	.int_dest_mode = 0 /* physical delivery */, \
-	.init_apic_ldr = init_apic_ldr_phys, \
-	.vector_allocation_cpumask = vector_allocation_cpumask_phys, \
-	.cpu_mask_to_apicid = cpu_mask_to_apicid_phys, \
-	.send_IPI_mask = send_IPI_mask_phys, \
-	.send_IPI_self = send_IPI_self_legacy
 
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 08:00:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 08:00:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.813798.1226828 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syRci-0003NF-PS; Wed, 09 Oct 2024 08:00:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 813798.1226828; Wed, 09 Oct 2024 08: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 1syRci-0003N8-Mx; Wed, 09 Oct 2024 08:00:44 +0000
Received: by outflank-mailman (input) for mailman id 813798;
 Wed, 09 Oct 2024 08:00: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 1syRch-0003Mv-T5
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 08:00: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 1syRch-0003lY-SN
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 08:00:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syRch-0001wG-RW
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 08: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=+dVX9gJ+ys1zqFFmFU3c2T/2WmqRghxgUbqOlkeswOw=; b=QECmQ7FJlPk+MPYh//c4yY94ds
	95Bld6I/k9xkqMrbvIjtcczoXwhp2Ja+gNI4cv5aJvSZHZ701uFqC/gQs9GvTXpP7oW+TMMqZkbe2
	G7jASp8S5fgdOZ7sRDOwPzriP7TmRIqqVQEBBQzxxZExMkfR7nHB+XXusokbZ2RYN3Yw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/msr: add log messages to MSR state load error paths
Message-Id: <E1syRch-0001wG-RW@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 08:00:43 +0000

commit 2f413e22fa5eb1c6b8ec04ef1529807a2fbf6c79
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Oct 9 09:55:38 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 9 09:55:38 2024 +0200

    x86/msr: add log messages to MSR state load error paths
    
    Some error paths in the MSR state loading logic don't contain error messages,
    which makes debugging them quite hard without adding extra patches to print the
    information.
    
    Add two new log messages to the MSR state load path that print information
    about the entry that failed to load, for both PV and HVM.
    
    While there also adjust XEN_DOMCTL_set_vcpu_msrs to return -ENXIO in case the
    MSR is unhandled or can't be loaded, so it matches the error code used by HVM
    MSR loading (and it's less ambiguous than -EINVAL).
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domctl.c  | 8 ++++++++
 xen/arch/x86/hvm/hvm.c | 7 +++++++
 2 files changed, 15 insertions(+)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 27d5b3f3d6..37ebcb3abb 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1162,6 +1162,7 @@ long arch_do_domctl(
                 if ( msr.reserved )
                     break;
 
+                ret = -ENXIO;
                 switch ( msr.index )
                 {
                 case MSR_SPEC_CTRL:
@@ -1170,9 +1171,16 @@ long arch_do_domctl(
                 case MSR_AMD64_DR0_ADDRESS_MASK:
                 case MSR_AMD64_DR1_ADDRESS_MASK ... MSR_AMD64_DR3_ADDRESS_MASK:
                     if ( guest_wrmsr(v, msr.index, msr.value) != X86EMUL_OKAY )
+                    {
+                        printk(XENLOG_G_ERR
+                               "%pv load MSR %#x with value %#lx failed\n",
+                               v, msr.index, msr.value);
                         break;
+                    }
                     continue;
                 }
+                printk(XENLOG_G_ERR "%pv attempted load of unhandled MSR %#x\n",
+                       v, msr.index);
                 break;
             }
 
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 7b2e1c9813..3b803e15e0 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1535,10 +1535,17 @@ static int cf_check hvm_load_cpu_msrs(struct domain *d, hvm_domain_context_t *h)
             rc = guest_wrmsr(v, ctxt->msr[i].index, ctxt->msr[i].val);
 
             if ( rc != X86EMUL_OKAY )
+            {
+                printk(XENLOG_G_ERR
+                       "HVM %pv load MSR %#x with value %#lx failed\n",
+                       v, ctxt->msr[i].index, ctxt->msr[i].val);
                 return -ENXIO;
+            }
             break;
 
         default:
+            printk(XENLOG_G_ERR "HVM %pv attempted load of unhandled MSR %#x\n",
+                   v, ctxt->msr[i].index);
             return -ENXIO;
         }
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 08:00:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 08:00:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.813799.1226834 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syRcs-0003QS-S0; Wed, 09 Oct 2024 08:00:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 813799.1226834; Wed, 09 Oct 2024 08: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 1syRcs-0003QG-Ol; Wed, 09 Oct 2024 08:00:54 +0000
Received: by outflank-mailman (input) for mailman id 813799;
 Wed, 09 Oct 2024 08: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 1syRcs-0003Q2-0Y
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 08: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 1syRcr-0003lf-VX
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 08:00:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syRcr-0001xS-UU
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 08:00: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=PwMO4NYPUF3H42dBXB+zc32U0pmisUNnpPD3yHAJpk8=; b=dhpS6QbZQGXB+ZVUOiJMXniNVS
	JZdsFvTvVWGUfwq2Tve6m6AwWG3cbE2V7fVQIoCnYnnGyZB9DLP4Mkc+A2uyeCvxdKdznjBhfTkoj
	ydP0W7S6WqeEfqvhLDxAiPil44EZvn8AvyEOGZt8T2mCtjEiP0XUQTNVKDAyrW7iv2KU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] MAINTAINERS: add myself as maintainer for arm tee
Message-Id: <E1syRcr-0001xS-UU@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 08:00:53 +0000

commit 9d278c8c6cd5f8375c913ed8f4d1ce2b50f0ea06
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Oct 9 09:56:16 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 9 09:56:16 2024 +0200

    MAINTAINERS: add myself as maintainer for arm tee
    
    With Tee mediators now containing Optee and FF-A implementations, add
    myself as maintainers to have someone handling the FF-A side.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index fb0ebf0939..2450b0f9ff 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -516,6 +516,7 @@ F:	stubdom/
 
 TEE MEDIATORS
 M:	Volodymyr Babchuk <volodymyr_babchuk@epam.com>
+M:	Bertrand Marquis <bertrand.marquis@arm.com>
 S:	Supported
 F:	xen/arch/arm/include/asm/tee
 F:	xen/arch/arm/tee/
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 08:01:05 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 08:01:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.813800.1226837 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syRd3-0003TE-Ul; Wed, 09 Oct 2024 08:01:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 813800.1226837; Wed, 09 Oct 2024 08: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 1syRd3-0003T6-Rs; Wed, 09 Oct 2024 08:01:05 +0000
Received: by outflank-mailman (input) for mailman id 813800;
 Wed, 09 Oct 2024 08: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 1syRd2-0003Sp-3W
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 08: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 1syRd2-0003mG-2q
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 08:01:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syRd2-0001zM-1o
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 08: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=1Aed1LrgDjm9S9LsSCjlaU9VrvvvmIGnW1CfK+0QbR4=; b=I/jtOONdC7LJ/uYrZs0jqXZi/2
	QtlSCr4lXFQ/BfQ2g8bDgyeJidkyAWDdWGwTkxyk5TX7Un5MV5Bx53DaGqEtSh+JsE2q6vzwIfwTD
	a7InwHWysiq/tSUO14HqDbzeh+z5HxHcO/qQ0y2Oh35l3JNuG+iBeIiyYpMnkpsUV4lc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] types: replace remaining uses of s64
Message-Id: <E1syRd2-0001zM-1o@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 08:01:04 +0000

commit 6b80ec957c64fc3ca7a32adc504fefd226d7dad0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Oct 9 09:56:43 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 9 09:56:43 2024 +0200

    types: replace remaining uses of s64
    
    ... and move the type itself to linux-compat.h. An exception being
    arch/arm/arm64/cpufeature.c and arch/arm/include/asm/arm64/cpufeature.h,
    which are to use linux-compat.h instead (the former by including the
    latter).
    
    While doing so
    - correct the type of union uu's uq field in lib/divmod.c,
    - switch a few adjacent types as well, for (a little bit of)
      consistency.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/arm64/livepatch.c              | 18 +++++++++---------
 xen/arch/arm/include/asm/arm64/cpufeature.h |  2 ++
 xen/arch/x86/hvm/vlapic.c                   |  2 +-
 xen/arch/x86/include/asm/hvm/vcpu.h         |  4 ++--
 xen/arch/x86/time.c                         | 22 +++++++++++-----------
 xen/drivers/acpi/apei/erst.c                |  2 +-
 xen/include/acpi/actypes.h                  |  4 ++--
 xen/include/xen/linux-compat.h              |  2 +-
 xen/include/xen/time.h                      |  2 +-
 xen/include/xen/types.h                     |  1 -
 xen/lib/divmod.c                            | 12 ++++++------
 11 files changed, 36 insertions(+), 35 deletions(-)

diff --git a/xen/arch/arm/arm64/livepatch.c b/xen/arch/arm/arm64/livepatch.c
index d80051f9dc..6efe4ec770 100644
--- a/xen/arch/arm/arm64/livepatch.c
+++ b/xen/arch/arm/arm64/livepatch.c
@@ -119,7 +119,7 @@ static u64 do_reloc(enum aarch64_reloc_op reloc_op, void *place, u64 val)
 
 static int reloc_data(enum aarch64_reloc_op op, void *place, u64 val, int len)
 {
-    s64 sval = do_reloc(op, place, val);
+    int64_t sval = do_reloc(op, place, val);
 
     switch ( len )
     {
@@ -136,7 +136,7 @@ static int reloc_data(enum aarch64_reloc_op op, void *place, u64 val, int len)
         break;
 
     case 64:
-        *(s64 *)place = sval;
+        *(int64_t *)place = sval;
         break;
 
     default:
@@ -155,9 +155,9 @@ enum aarch64_insn_movw_imm_type {
 static int reloc_insn_movw(enum aarch64_reloc_op op, void *dest, u64 val,
                            int lsb, enum aarch64_insn_movw_imm_type imm_type)
 {
-    u64 imm;
-    s64 sval;
-    u32 insn = *(u32 *)dest;
+    uint64_t imm;
+    int64_t sval;
+    uint32_t insn = *(uint32_t *)dest;
 
     sval = do_reloc(op, dest, val);
     imm = sval >> lsb;
@@ -200,9 +200,9 @@ static int reloc_insn_movw(enum aarch64_reloc_op op, void *dest, u64 val,
 static int reloc_insn_imm(enum aarch64_reloc_op op, void *dest, u64 val,
                           int lsb, int len, enum aarch64_insn_imm_type imm_type)
 {
-    u64 imm, imm_mask;
-    s64 sval;
-    u32 insn = *(u32 *)dest;
+    uint64_t imm, imm_mask;
+    int64_t sval;
+    uint32_t insn = *(uint32_t *)dest;
 
     /* Calculate the relocation value. */
     sval = do_reloc(op, dest, val);
@@ -220,7 +220,7 @@ static int reloc_insn_imm(enum aarch64_reloc_op op, void *dest, u64 val,
      * Extract the upper value bits (including the sign bit) and
      * shift them to bit 0.
      */
-    sval = (s64)(sval & ~(imm_mask >> 1)) >> (len - 1);
+    sval = (int64_t)(sval & ~(imm_mask >> 1)) >> (len - 1);
 
     /*
      * Overflow has occurred if the upper bits are not all equal to
diff --git a/xen/arch/arm/include/asm/arm64/cpufeature.h b/xen/arch/arm/include/asm/arm64/cpufeature.h
index 1bb503e857..8d5100a557 100644
--- a/xen/arch/arm/include/asm/arm64/cpufeature.h
+++ b/xen/arch/arm/include/asm/arm64/cpufeature.h
@@ -1,6 +1,8 @@
 #ifndef __ASM_ARM_ARM64_CPUFEATURES_H
 #define __ASM_ARM_ARM64_CPUFEATURES_H
 
+#include <xen/linux-compat.h>
+
 /*
  * CPU feature register tracking
  *
diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 992355e511..9a16dd0d77 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -1223,7 +1223,7 @@ void vlapic_tdt_msr_set(struct vlapic *vlapic, uint64_t value)
     if ( value > guest_tsc )
     {
         uint64_t delta = gtsc_to_gtime(v->domain, value - guest_tsc);
-        delta = max_t(s64, delta, 0);
+        delta = max_t(int64_t, delta, 0);
 
         HVM_DBG_LOG(DBG_LEVEL_VLAPIC_TIMER, "delta[0x%016"PRIx64"]", delta);
 
diff --git a/xen/arch/x86/include/asm/hvm/vcpu.h b/xen/arch/x86/include/asm/hvm/vcpu.h
index 64c7a6fede..6d5845780d 100644
--- a/xen/arch/x86/include/asm/hvm/vcpu.h
+++ b/xen/arch/x86/include/asm/hvm/vcpu.h
@@ -134,8 +134,8 @@ struct hvm_vcpu {
     unsigned long       hw_cr[5];
 
     struct vlapic       vlapic;
-    s64                 cache_tsc_offset;
-    u64                 guest_time;
+    int64_t             cache_tsc_offset;
+    uint64_t            guest_time;
 
     /* Lock and list for virtual platform timers. */
     spinlock_t          tm_lock;
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 29b026735e..bc9f265941 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -66,10 +66,10 @@ struct cpu_time {
 struct platform_timesource {
     const char *id;
     const char *name;
-    u64 frequency;
+    uint64_t frequency;
     /* Post-init this hook may only be invoked via the read_counter() wrapper! */
-    u64 (*read_counter)(void);
-    s64 (*init)(struct platform_timesource *);
+    uint64_t (*read_counter)(void);
+    int64_t (*init)(struct platform_timesource *);
     void (*resume)(struct platform_timesource *);
     int counter_bits;
 };
@@ -368,7 +368,7 @@ static u64 cf_check read_pit_count(void)
     return count32;
 }
 
-static s64 __init cf_check init_pit(struct platform_timesource *pts)
+static int64_t __init cf_check init_pit(struct platform_timesource *pts)
 {
     u8 portb = inb(0x61);
     u64 start, end;
@@ -610,7 +610,7 @@ static u64 cf_check read_pmtimer_count(void)
     return inl(pmtmr_ioport);
 }
 
-static s64 __init cf_check init_pmtimer(struct platform_timesource *pts)
+static int64_t __init cf_check init_pmtimer(struct platform_timesource *pts)
 {
     if ( !pmtmr_ioport || (pmtmr_width != 24 && pmtmr_width != 32) )
         return 0;
@@ -655,7 +655,7 @@ static unsigned int __initdata tsc_flags;
  * Called in verify_tsc_reliability() under reliable TSC conditions
  * thus reusing all the checks already performed there.
  */
-static s64 __init cf_check init_tsc(struct platform_timesource *pts)
+static int64_t __init cf_check init_tsc(struct platform_timesource *pts)
 {
     u64 ret = pts->frequency;
 
@@ -1034,9 +1034,9 @@ static void __init reset_platform_timer(void)
     spin_unlock_irq(&platform_timer_lock);
 }
 
-static s64 __init try_platform_timer(struct platform_timesource *pts)
+static int64_t __init try_platform_timer(struct platform_timesource *pts)
 {
-    s64 rc = pts->init(pts);
+    int64_t rc = pts->init(pts);
 
     if ( rc <= 0 )
         return rc;
@@ -1070,7 +1070,7 @@ static u64 __init init_platform_timer(void)
 
     struct platform_timesource *pts = NULL;
     unsigned int i;
-    s64 rc = -1;
+    int64_t rc = -1;
 
     /* clocksource=tsc is initialized via __initcalls (when CPUs are up). */
     if ( (opt_clocksource[0] != '\0') && strcmp(opt_clocksource, "tsc") )
@@ -1923,7 +1923,7 @@ static void cf_check local_time_calibration(void)
      * Weirdness can happen if we lose sync with the platform timer.
      * We could be smarter here: resync platform timer with local timer?
      */
-    if ( ((s64)stime_elapsed64 < (EPOCH / 2)) )
+    if ( ((int64_t)stime_elapsed64 < (EPOCH / 2)) )
         goto out;
 
     /*
@@ -2398,7 +2398,7 @@ static void __init tsc_check_writability(void)
 
         write_tsc(tsc | (1ULL << 32));
         tmp = rdtsc();
-        if ( ABS((s64)tmp - (s64)tmp2) < (1LL << 31) )
+        if ( ABS((int64_t)tmp - (int64_t)tmp2) < (1LL << 31) )
             what = "only partially";
     }
     else
diff --git a/xen/drivers/acpi/apei/erst.c b/xen/drivers/acpi/apei/erst.c
index e006b3def2..76f799c0ab 100644
--- a/xen/drivers/acpi/apei/erst.c
+++ b/xen/drivers/acpi/apei/erst.c
@@ -105,7 +105,7 @@ static inline int erst_errno(int command_status)
 
 static int erst_timedout(u64 *t, u64 spin_unit)
 {
-	if ((s64)*t < spin_unit) {
+	if ((int64_t)*t < spin_unit) {
 		printk(XENLOG_WARNING "Firmware does not respond in time\n");
 		return 1;
 	}
diff --git a/xen/include/acpi/actypes.h b/xen/include/acpi/actypes.h
index 49e0ab9bb4..a3983423bd 100644
--- a/xen/include/acpi/actypes.h
+++ b/xen/include/acpi/actypes.h
@@ -147,8 +147,8 @@ typedef int INT32;
 
 /*! [End] no source code translation !*/
 
-typedef u64 acpi_native_uint;
-typedef s64 acpi_native_int;
+typedef uint64_t acpi_native_uint;
+typedef int64_t acpi_native_int;
 
 typedef u64 acpi_io_address;
 typedef u64 acpi_physical_address;
diff --git a/xen/include/xen/linux-compat.h b/xen/include/xen/linux-compat.h
index 1f4186102a..656fff883e 100644
--- a/xen/include/xen/linux-compat.h
+++ b/xen/include/xen/linux-compat.h
@@ -15,7 +15,7 @@ typedef int8_t  s8, __s8;
 typedef uint8_t __u8;
 typedef int16_t s16, __s16;
 typedef int32_t s32, __s32;
-typedef int64_t __s64;
+typedef int64_t s64, __s64;
 
 typedef paddr_t phys_addr_t;
 
diff --git a/xen/include/xen/time.h b/xen/include/xen/time.h
index 67c586b736..21e479aac8 100644
--- a/xen/include/xen/time.h
+++ b/xen/include/xen/time.h
@@ -29,7 +29,7 @@ struct vcpu;
  * of real time into system time 
  */
 
-typedef s64 s_time_t;
+typedef int64_t s_time_t;
 #define PRI_stime PRId64
 
 s_time_t get_s_time_fixed(u64 at_tick);
diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h
index 1bcc5a474f..7cb8d2388d 100644
--- a/xen/include/xen/types.h
+++ b/xen/include/xen/types.h
@@ -8,7 +8,6 @@
 typedef uint8_t u8;
 typedef uint16_t u16, __u16;
 typedef uint32_t u32, __u32;
-typedef int64_t s64;
 typedef uint64_t u64, __u64;
 
 #include <asm/types.h>
diff --git a/xen/lib/divmod.c b/xen/lib/divmod.c
index 0be6ccc700..0377d62130 100644
--- a/xen/lib/divmod.c
+++ b/xen/lib/divmod.c
@@ -46,8 +46,8 @@
  * one or more of the following formats.
  */
 union uu {
-    s64            q;              /* as a (signed) quad */
-    s64            uq;             /* as an unsigned quad */
+    int64_t        q;              /* as a (signed) quad */
+    uint64_t       uq;             /* as an unsigned quad */
     long           sl[2];          /* as two signed longs */
     unsigned long  ul[2];          /* as two unsigned longs */
 };
@@ -72,7 +72,7 @@ union uu {
  * and assembly.
  */
 #define CHAR_BIT        8               /* number of bits in a char */
-#define QUAD_BITS       (sizeof(s64) * CHAR_BIT)
+#define QUAD_BITS       (sizeof(int64_t) * CHAR_BIT)
 #define LONG_BITS       (sizeof(long) * CHAR_BIT)
 #define HALF_BITS       (sizeof(long) * CHAR_BIT / 2)
 
@@ -324,7 +324,7 @@ u64 __qdivrem(u64 uq, u64 vq, u64 *arq)
  * Divide two signed quads.
  * Truncates towards zero, as required by C99.
  */
-s64 __divdi3(s64 a, s64 b)
+int64_t __divdi3(int64_t a, int64_t b)
 {
     u64 ua, ub, uq;
     int neg = (a < 0) ^ (b < 0);
@@ -361,7 +361,7 @@ u64 __umoddi3(u64 a, u64 b)
  *  11 % -5 =  1
  * -11 % -5 = -1
  */
-s64 __moddi3(s64 a, s64 b)
+int64_t __moddi3(int64_t a, int64_t b)
 {
     u64 ua, ub, urem;
     int neg = (a < 0);
@@ -374,7 +374,7 @@ s64 __moddi3(s64 a, s64 b)
 /*
  * Quotient and remainder of unsigned long long division
  */
-s64 __ldivmod_helper(s64 a, s64 b, s64 *r)
+int64_t __ldivmod_helper(int64_t a, int64_t b, int64_t *r)
 {
     u64 ua, ub, rem, quot;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 08:01:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 08:01:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.813804.1226841 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syRdE-0003WM-02; Wed, 09 Oct 2024 08:01:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 813804.1226841; Wed, 09 Oct 2024 08: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 1syRdD-0003WE-TK; Wed, 09 Oct 2024 08:01:15 +0000
Received: by outflank-mailman (input) for mailman id 813804;
 Wed, 09 Oct 2024 08: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 1syRdC-0003Vz-6V
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 08: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 1syRdC-0003nr-5l
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 08:01:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syRdC-00022D-4t
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 08: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=+eXoAoeRzqNY2C+aky1X/vHZ2Q1VzkvvSW1Jen+4Zms=; b=WfNZN9mWTPDBUEg/s7dUTD3hg0
	JcCrokuL/BME3vT8ZMY08Oh6/NCz6sJE4ymSKBw07V1CTvTPDYy7RorUFhD15ko/whm7eeZRF5Kp5
	iitxJaopzYZ6KCKe0sQSA7kwO0J79WP3Wrrix60va7R8fNfCnFhe7ypTAnQk8TPUQkJo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] MAINTAINERS: Add myself as a reviewer for RISC-V
Message-Id: <E1syRdC-00022D-4t@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 08:01:14 +0000

commit 3b79d825b5719f6654e4c95cdc17d65bb204213a
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Oct 9 09:57:37 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 9 09:57:37 2024 +0200

    MAINTAINERS: Add myself as a reviewer for RISC-V
    
    As an active contributor to Xen's RISC-V port, so add myself
    to the list of reviewers.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 2450b0f9ff..f68ddd7f84 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -485,6 +485,7 @@ RISCV
 R:	Alistair Francis <alistair.francis@wdc.com>
 R:	Bob Eshleman <bobbyeshleman@gmail.com>
 R:	Connor Davis <connojdavis@gmail.com>
+R:	Oleksii Kurochko <oleksii.kurochko@gmail.com>
 S:	Supported
 F:	config/riscv64.mk
 F:	xen/arch/riscv/
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:55:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814114.1227214 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTPO-0004n0-Ps; Wed, 09 Oct 2024 09:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814114.1227214; Wed, 09 Oct 2024 09:55: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 1syTPO-0004ms-Mm; Wed, 09 Oct 2024 09:55:06 +0000
Received: by outflank-mailman (input) for mailman id 814114;
 Wed, 09 Oct 2024 09: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 1syTPM-0004ml-SP
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09: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 1syTPM-0005wW-Pg
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTPM-0005pw-Nc
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09: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=awfSiSa24pholtoz8VNCvy8xMgwoATMzvHRgZtqQoB8=; b=RGOUhXwapnbbkTI+aGpANdI9iN
	4fW2J6lcVJap6LTGAGRB64W5QZE3t9TimBumAS1DDVZBgRsOPkcaFPpj/Ef7JgInHwfmG/tkJb6T1
	qwtbQ924BKxhMGoVeToI4q9NBys26NRBRYusOihyYlWclf0/IiqjTazBp7X0rq3W8vLg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] memory: prevent dma-reentracy issues
Message-Id: <E1syTPM-0005pw-Nc@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:55:04 +0000

commit a08c78dda7e018fbbe33bc7979f7a53f89a488b5
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:06 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:01:33 2023 +0300

    memory: prevent dma-reentracy issues
    
    Add a flag to the DeviceState, when a device is engaged in PIO/MMIO/DMA.
    This flag is set/checked prior to calling a device's MemoryRegion
    handlers, and set when device code initiates DMA.  The purpose of this
    flag is to prevent two types of DMA-based reentrancy issues:
    
    1.) mmio -> dma -> mmio case
    2.) bh -> dma write -> mmio case
    
    These issues have led to problems such as stack-exhaustion and
    use-after-frees.
    
    Summary of the problem from Peter Maydell:
    https://lore.kernel.org/qemu-devel/CAFEAcA_23vc7hE3iaM-JVA6W38LK4hJoWae5KcknhPRD5fPBZA@mail.gmail.com
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/62
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/540
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/541
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/556
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/557
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/827
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1282
    Resolves: CVE-2023-0330
    
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Message-Id: <20230427211013.2994127-2-alxndr@bu.edu>
    [thuth: Replace warn_report() with warn_report_once()]
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit a2e1753b8054344f32cf94f31c6399a58794a380)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 include/exec/memory.h  |  5 +++++
 include/hw/qdev-core.h |  7 +++++++
 softmmu/memory.c       | 16 ++++++++++++++++
 3 files changed, 28 insertions(+)

diff --git a/include/exec/memory.h b/include/exec/memory.h
index 15ade918ba..e45ce6061f 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -767,6 +767,8 @@ struct MemoryRegion {
     bool is_iommu;
     RAMBlock *ram_block;
     Object *owner;
+    /* owner as TYPE_DEVICE. Used for re-entrancy checks in MR access hotpath */
+    DeviceState *dev;
 
     const MemoryRegionOps *ops;
     void *opaque;
@@ -791,6 +793,9 @@ struct MemoryRegion {
     unsigned ioeventfd_nb;
     MemoryRegionIoeventfd *ioeventfds;
     RamDiscardManager *rdm; /* Only for RAM */
+
+    /* For devices designed to perform re-entrant IO into their own IO MRs */
+    bool disable_reentrancy_guard;
 };
 
 struct IOMMUMemoryRegion {
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index bd50ad5ee1..7623703943 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -162,6 +162,10 @@ struct NamedClockList {
     QLIST_ENTRY(NamedClockList) node;
 };
 
+typedef struct {
+    bool engaged_in_io;
+} MemReentrancyGuard;
+
 /**
  * DeviceState:
  * @realized: Indicates whether the device has been fully constructed.
@@ -194,6 +198,9 @@ struct DeviceState {
     int alias_required_for_version;
     ResettableState reset;
     GSList *unplug_blockers;
+
+    /* Is the device currently in mmio/pio/dma? Used to prevent re-entrancy */
+    MemReentrancyGuard mem_reentrancy_guard;
 };
 
 struct DeviceListener {
diff --git a/softmmu/memory.c b/softmmu/memory.c
index b1a6cae6f5..b7b3386e9d 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -542,6 +542,18 @@ static MemTxResult access_with_adjusted_size(hwaddr addr,
         access_size_max = 4;
     }
 
+    /* Do not allow more than one simultaneous access to a device's IO Regions */
+    if (mr->dev && !mr->disable_reentrancy_guard &&
+        !mr->ram_device && !mr->ram && !mr->rom_device && !mr->readonly) {
+        if (mr->dev->mem_reentrancy_guard.engaged_in_io) {
+            warn_report_once("Blocked re-entrant IO on MemoryRegion: "
+                             "%s at addr: 0x%" HWADDR_PRIX,
+                             memory_region_name(mr), addr);
+            return MEMTX_ACCESS_ERROR;
+        }
+        mr->dev->mem_reentrancy_guard.engaged_in_io = true;
+    }
+
     /* FIXME: support unaligned access? */
     access_size = MAX(MIN(size, access_size_max), access_size_min);
     access_mask = MAKE_64BIT_MASK(0, access_size * 8);
@@ -556,6 +568,9 @@ static MemTxResult access_with_adjusted_size(hwaddr addr,
                         access_mask, attrs);
         }
     }
+    if (mr->dev) {
+        mr->dev->mem_reentrancy_guard.engaged_in_io = false;
+    }
     return r;
 }
 
@@ -1170,6 +1185,7 @@ static void memory_region_do_init(MemoryRegion *mr,
     }
     mr->name = g_strdup(name);
     mr->owner = owner;
+    mr->dev = (DeviceState *) object_dynamic_cast(mr->owner, TYPE_DEVICE);
     mr->ram_block = NULL;
 
     if (name) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:55:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814115.1227218 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTPY-0004pZ-SH; Wed, 09 Oct 2024 09:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814115.1227218; Wed, 09 Oct 2024 09: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 1syTPY-0004pS-Ps; Wed, 09 Oct 2024 09:55:16 +0000
Received: by outflank-mailman (input) for mailman id 814115;
 Wed, 09 Oct 2024 09: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 1syTPW-0004pF-Tu
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09: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 1syTPW-0005wd-TF
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTPW-0005sM-SD
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09: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=zdJ8fJzRmxLNXG+9WLtXOV8xy5BvZRKJWu6Wp4arPIA=; b=QPDZt0oNRps4LCapG+oBLN0yPG
	NaC7VenWaox1cG7y971C5BcD5DSaRUhdvh4m9wkt01ZVPBTYBnK+7eMeXrOZhK5Y8UhSKx03cQXvv
	/NpUlZCeopxx6kfrrJryZ4aamHMPq4n/J67THfyuMXfuX9rO5ujCeYpJTOYq0Qbbc8Sk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] async: Add an optional reentrancy guard to the BH API
Message-Id: <E1syTPW-0005sM-SD@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:55:14 +0000

commit 932cf49f0620544d1fb37f1d8dd02219a3636ee9
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:07 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:01:33 2023 +0300

    async: Add an optional reentrancy guard to the BH API
    
    Devices can pass their MemoryReentrancyGuard (from their DeviceState),
    when creating new BHes. Then, the async API will toggle the guard
    before/after calling the BH call-back. This prevents bh->mmio reentrancy
    issues.
    
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Message-Id: <20230427211013.2994127-3-alxndr@bu.edu>
    [thuth: Fix "line over 90 characters" checkpatch.pl error]
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 9c86c97f12c060bf7484dd931f38634e166a81f0)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 docs/devel/multiple-iothreads.txt |  7 +++++++
 include/block/aio.h               | 18 ++++++++++++++++--
 include/qemu/main-loop.h          |  7 +++++--
 tests/unit/ptimer-test-stubs.c    |  3 ++-
 util/async.c                      | 18 +++++++++++++++++-
 util/main-loop.c                  |  6 ++++--
 util/trace-events                 |  1 +
 7 files changed, 52 insertions(+), 8 deletions(-)

diff --git a/docs/devel/multiple-iothreads.txt b/docs/devel/multiple-iothreads.txt
index 343120f2ef..a3e949f6b3 100644
--- a/docs/devel/multiple-iothreads.txt
+++ b/docs/devel/multiple-iothreads.txt
@@ -61,6 +61,7 @@ There are several old APIs that use the main loop AioContext:
  * LEGACY qemu_aio_set_event_notifier() - monitor an event notifier
  * LEGACY timer_new_ms() - create a timer
  * LEGACY qemu_bh_new() - create a BH
+ * LEGACY qemu_bh_new_guarded() - create a BH with a device re-entrancy guard
  * LEGACY qemu_aio_wait() - run an event loop iteration
 
 Since they implicitly work on the main loop they cannot be used in code that
@@ -72,8 +73,14 @@ Instead, use the AioContext functions directly (see include/block/aio.h):
  * aio_set_event_notifier() - monitor an event notifier
  * aio_timer_new() - create a timer
  * aio_bh_new() - create a BH
+ * aio_bh_new_guarded() - create a BH with a device re-entrancy guard
  * aio_poll() - run an event loop iteration
 
+The qemu_bh_new_guarded/aio_bh_new_guarded APIs accept a "MemReentrancyGuard"
+argument, which is used to check for and prevent re-entrancy problems. For
+BHs associated with devices, the reentrancy-guard is contained in the
+corresponding DeviceState and named "mem_reentrancy_guard".
+
 The AioContext can be obtained from the IOThread using
 iothread_get_aio_context() or for the main loop using qemu_get_aio_context().
 Code that takes an AioContext argument works both in IOThreads or the main
diff --git a/include/block/aio.h b/include/block/aio.h
index 543717f294..db6f23c619 100644
--- a/include/block/aio.h
+++ b/include/block/aio.h
@@ -23,6 +23,8 @@
 #include "qemu/thread.h"
 #include "qemu/timer.h"
 #include "block/graph-lock.h"
+#include "hw/qdev-core.h"
+
 
 typedef struct BlockAIOCB BlockAIOCB;
 typedef void BlockCompletionFunc(void *opaque, int ret);
@@ -331,9 +333,11 @@ void aio_bh_schedule_oneshot_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
  * is opaque and must be allocated prior to its use.
  *
  * @name: A human-readable identifier for debugging purposes.
+ * @reentrancy_guard: A guard set when entering a cb to prevent
+ * device-reentrancy issues
  */
 QEMUBH *aio_bh_new_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
-                        const char *name);
+                        const char *name, MemReentrancyGuard *reentrancy_guard);
 
 /**
  * aio_bh_new: Allocate a new bottom half structure
@@ -342,7 +346,17 @@ QEMUBH *aio_bh_new_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
  * string.
  */
 #define aio_bh_new(ctx, cb, opaque) \
-    aio_bh_new_full((ctx), (cb), (opaque), (stringify(cb)))
+    aio_bh_new_full((ctx), (cb), (opaque), (stringify(cb)), NULL)
+
+/**
+ * aio_bh_new_guarded: Allocate a new bottom half structure with a
+ * reentrancy_guard
+ *
+ * A convenience wrapper for aio_bh_new_full() that uses the cb as the name
+ * string.
+ */
+#define aio_bh_new_guarded(ctx, cb, opaque, guard) \
+    aio_bh_new_full((ctx), (cb), (opaque), (stringify(cb)), guard)
 
 /**
  * aio_notify: Force processing of pending events.
diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h
index b3e54e00bc..68e70e61aa 100644
--- a/include/qemu/main-loop.h
+++ b/include/qemu/main-loop.h
@@ -387,9 +387,12 @@ void qemu_cond_timedwait_iothread(QemuCond *cond, int ms);
 
 /* internal interfaces */
 
+#define qemu_bh_new_guarded(cb, opaque, guard) \
+    qemu_bh_new_full((cb), (opaque), (stringify(cb)), guard)
 #define qemu_bh_new(cb, opaque) \
-    qemu_bh_new_full((cb), (opaque), (stringify(cb)))
-QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name);
+    qemu_bh_new_full((cb), (opaque), (stringify(cb)), NULL)
+QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name,
+                         MemReentrancyGuard *reentrancy_guard);
 void qemu_bh_schedule_idle(QEMUBH *bh);
 
 enum {
diff --git a/tests/unit/ptimer-test-stubs.c b/tests/unit/ptimer-test-stubs.c
index f2bfcede93..8c9407c560 100644
--- a/tests/unit/ptimer-test-stubs.c
+++ b/tests/unit/ptimer-test-stubs.c
@@ -107,7 +107,8 @@ int64_t qemu_clock_deadline_ns_all(QEMUClockType type, int attr_mask)
     return deadline;
 }
 
-QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name)
+QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name,
+                         MemReentrancyGuard *reentrancy_guard)
 {
     QEMUBH *bh = g_new(QEMUBH, 1);
 
diff --git a/util/async.c b/util/async.c
index 856e1a8a33..9df7674b4e 100644
--- a/util/async.c
+++ b/util/async.c
@@ -65,6 +65,7 @@ struct QEMUBH {
     void *opaque;
     QSLIST_ENTRY(QEMUBH) next;
     unsigned flags;
+    MemReentrancyGuard *reentrancy_guard;
 };
 
 /* Called concurrently from any thread */
@@ -137,7 +138,7 @@ void aio_bh_schedule_oneshot_full(AioContext *ctx, QEMUBHFunc *cb,
 }
 
 QEMUBH *aio_bh_new_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
-                        const char *name)
+                        const char *name, MemReentrancyGuard *reentrancy_guard)
 {
     QEMUBH *bh;
     bh = g_new(QEMUBH, 1);
@@ -146,13 +147,28 @@ QEMUBH *aio_bh_new_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
         .cb = cb,
         .opaque = opaque,
         .name = name,
+        .reentrancy_guard = reentrancy_guard,
     };
     return bh;
 }
 
 void aio_bh_call(QEMUBH *bh)
 {
+    bool last_engaged_in_io = false;
+
+    if (bh->reentrancy_guard) {
+        last_engaged_in_io = bh->reentrancy_guard->engaged_in_io;
+        if (bh->reentrancy_guard->engaged_in_io) {
+            trace_reentrant_aio(bh->ctx, bh->name);
+        }
+        bh->reentrancy_guard->engaged_in_io = true;
+    }
+
     bh->cb(bh->opaque);
+
+    if (bh->reentrancy_guard) {
+        bh->reentrancy_guard->engaged_in_io = last_engaged_in_io;
+    }
 }
 
 /* Multiple occurrences of aio_bh_poll cannot be called concurrently. */
diff --git a/util/main-loop.c b/util/main-loop.c
index e180c85145..7022f02ef8 100644
--- a/util/main-loop.c
+++ b/util/main-loop.c
@@ -605,9 +605,11 @@ void main_loop_wait(int nonblocking)
 
 /* Functions to operate on the main QEMU AioContext.  */
 
-QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name)
+QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name,
+                         MemReentrancyGuard *reentrancy_guard)
 {
-    return aio_bh_new_full(qemu_aio_context, cb, opaque, name);
+    return aio_bh_new_full(qemu_aio_context, cb, opaque, name,
+                           reentrancy_guard);
 }
 
 /*
diff --git a/util/trace-events b/util/trace-events
index 16f78d8fe5..3f7e766683 100644
--- a/util/trace-events
+++ b/util/trace-events
@@ -11,6 +11,7 @@ poll_remove(void *ctx, void *node, int fd) "ctx %p node %p fd %d"
 # async.c
 aio_co_schedule(void *ctx, void *co) "ctx %p co %p"
 aio_co_schedule_bh_cb(void *ctx, void *co) "ctx %p co %p"
+reentrant_aio(void *ctx, const char *name) "ctx %p name %s"
 
 # thread-pool.c
 thread_pool_submit(void *pool, void *req, void *opaque) "pool %p req %p opaque %p"
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:55:26 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:55:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814116.1227223 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTPi-0004s7-UY; Wed, 09 Oct 2024 09:55:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814116.1227223; Wed, 09 Oct 2024 09:55: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 1syTPi-0004rz-RP; Wed, 09 Oct 2024 09:55:26 +0000
Received: by outflank-mailman (input) for mailman id 814116;
 Wed, 09 Oct 2024 09:55: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 1syTPh-0004rm-44
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:55: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 1syTPh-0005wm-2G
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:55:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTPg-0005t6-Va
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09: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=JuynZHqUaLFn3O36JxQPl9MBRtWJAYadphUx5TJPGRw=; b=eh6vmjbSXVuB8t2n8Bn2FpE7kp
	Hmf0uahRFhWVTF+bXMSE1ZC+8BPrN3FOIPc731bXqvGpnRUtG78H7Wra59BKsHx9UzwQKfsxDmtQ3
	huhXkQ252heHxIf0JxAlj4Q3C5x01gTQo+ZFQYSnUwQjfwjyMwH4SpVQLvZwXgqShJLc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] async: avoid use-after-free on re-entrancy guard
Message-Id: <E1syTPg-0005t6-Va@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:55:24 +0000

commit 6a33d4b3453b46ee3fd432d80374f45919985b00
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Mon May 1 10:19:56 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    async: avoid use-after-free on re-entrancy guard
    
    A BH callback can free the BH, causing a use-after-free in aio_bh_call.
    Fix that by keeping a local copy of the re-entrancy guard pointer.
    
    Buglink: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58513
    Fixes: 9c86c97f12 ("async: Add an optional reentrancy guard to the BH API")
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Message-Id: <20230501141956.3444868-1-alxndr@bu.edu>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 7915bd06f25e1803778081161bf6fa10c42dc7cd)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 util/async.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/util/async.c b/util/async.c
index 9df7674b4e..055070ffbd 100644
--- a/util/async.c
+++ b/util/async.c
@@ -156,18 +156,20 @@ void aio_bh_call(QEMUBH *bh)
 {
     bool last_engaged_in_io = false;
 
-    if (bh->reentrancy_guard) {
-        last_engaged_in_io = bh->reentrancy_guard->engaged_in_io;
-        if (bh->reentrancy_guard->engaged_in_io) {
+    /* Make a copy of the guard-pointer as cb may free the bh */
+    MemReentrancyGuard *reentrancy_guard = bh->reentrancy_guard;
+    if (reentrancy_guard) {
+        last_engaged_in_io = reentrancy_guard->engaged_in_io;
+        if (reentrancy_guard->engaged_in_io) {
             trace_reentrant_aio(bh->ctx, bh->name);
         }
-        bh->reentrancy_guard->engaged_in_io = true;
+        reentrancy_guard->engaged_in_io = true;
     }
 
     bh->cb(bh->opaque);
 
-    if (bh->reentrancy_guard) {
-        bh->reentrancy_guard->engaged_in_io = last_engaged_in_io;
+    if (reentrancy_guard) {
+        reentrancy_guard->engaged_in_io = last_engaged_in_io;
     }
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:55:37 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:55:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814117.1227226 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTPs-0004uq-VJ; Wed, 09 Oct 2024 09:55:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814117.1227226; Wed, 09 Oct 2024 09:55: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 1syTPs-0004uj-Sp; Wed, 09 Oct 2024 09:55:36 +0000
Received: by outflank-mailman (input) for mailman id 814117;
 Wed, 09 Oct 2024 09:55: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 1syTPr-0004uW-6I
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:55: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 1syTPr-0005xC-5b
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:55:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTPr-0005to-4j
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:55: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=S9KBhIY1D6uI48gsnNZOEsWAcW6KVQ6X4IW2JRrcewo=; b=6plwLCl++BqKIog5QlH/mFjZ6d
	rr8XVBfjuqUNd5Y7/QluhNa3xDGiR/ByntmSnkUGEsCTybXcheho7niEXT0PEYfedKH7AE3sFAiGV
	/LnUGqddOtlKEjKbxP3O3sZsiy+raVdMb/rrvixLRji3afJAsKt25kJb1hLqYp5HgzxM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] checkpatch: add qemu_bh_new/aio_bh_new checks
Message-Id: <E1syTPr-0005to-4j@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:55:35 +0000

commit db56206f785909aa830e2a19336bb12abca50e82
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:08 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    checkpatch: add qemu_bh_new/aio_bh_new checks
    
    Advise authors to use the _guarded versions of the APIs, instead.
    
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Message-Id: <20230427211013.2994127-4-alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit ef56ffbdd6b0605dc1e305611287b948c970e236)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 scripts/checkpatch.pl | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d768171dcf..eeaec436eb 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2865,6 +2865,14 @@ sub process {
 		if ($line =~ /\bsignal\s*\(/ && !($line =~ /SIG_(?:IGN|DFL)/)) {
 			ERROR("use sigaction to establish signal handlers; signal is not portable\n" . $herecurr);
 		}
+# recommend qemu_bh_new_guarded instead of qemu_bh_new
+        if ($realfile =~ /.*\/hw\/.*/ && $line =~ /\bqemu_bh_new\s*\(/) {
+			ERROR("use qemu_bh_new_guarded() instead of qemu_bh_new() to avoid reentrancy problems\n" . $herecurr);
+		}
+# recommend aio_bh_new_guarded instead of aio_bh_new
+        if ($realfile =~ /.*\/hw\/.*/ && $line =~ /\baio_bh_new\s*\(/) {
+			ERROR("use aio_bh_new_guarded() instead of aio_bh_new() to avoid reentrancy problems\n" . $herecurr);
+		}
 # check for module_init(), use category-specific init macros explicitly please
 		if ($line =~ /^module_init\s*\(/) {
 			ERROR("please use block_init(), type_init() etc. instead of module_init()\n" . $herecurr);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:55:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:55:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814118.1227230 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTQ2-0004x9-0W; Wed, 09 Oct 2024 09:55:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814118.1227230; Wed, 09 Oct 2024 09: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 1syTQ1-0004x1-UI; Wed, 09 Oct 2024 09:55:45 +0000
Received: by outflank-mailman (input) for mailman id 814118;
 Wed, 09 Oct 2024 09:55: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 1syTQ1-0004wr-Bm
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:55: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 1syTQ1-0005xJ-B5
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:55:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTQ1-0005uV-9i
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:55: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=pH4qeEW8TPcVfB0wjOFXRCJG5SYBjaS3iWrj1XwJ42c=; b=jmIWMvjtmjvNtjqYwRtJMdZEyv
	kXxBt/VK/S0eVyZHLGvFHr6dvZMMmttqCTHnEwDxo1aRJltF26/QH6lHxuwWpuVIviu0GfqzCy7Lg
	DaxTJA9/9H5o2L2vzNTnfecWSlZmp+4seADDWxKxwJSE913Wbi/ryDRXf6u9sZKfc5TA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw: replace most qemu_bh_new calls with qemu_bh_new_guarded
Message-Id: <E1syTQ1-0005uV-9i@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:55:45 +0000

commit fd9de51ea3f109d427bced84d80815a97bb7faa0
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:09 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    hw: replace most qemu_bh_new calls with qemu_bh_new_guarded
    
    This protects devices from bh->mmio reentrancy issues.
    
    Thanks: Thomas Huth <thuth@redhat.com> for diagnosing OS X test failure.
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Message-Id: <20230427211013.2994127-5-alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit f63192b0544af5d3e4d5edfd85ab520fcf671377)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/9pfs/xen-9p-backend.c        | 5 ++++-
 hw/block/dataplane/virtio-blk.c | 3 ++-
 hw/block/dataplane/xen-block.c  | 5 +++--
 hw/char/virtio-serial-bus.c     | 3 ++-
 hw/display/qxl.c                | 9 ++++++---
 hw/display/virtio-gpu.c         | 6 ++++--
 hw/ide/ahci.c                   | 3 ++-
 hw/ide/ahci_internal.h          | 1 +
 hw/ide/core.c                   | 4 +++-
 hw/misc/imx_rngc.c              | 6 ++++--
 hw/misc/macio/mac_dbdma.c       | 2 +-
 hw/net/virtio-net.c             | 3 ++-
 hw/nvme/ctrl.c                  | 6 ++++--
 hw/scsi/mptsas.c                | 3 ++-
 hw/scsi/scsi-bus.c              | 3 ++-
 hw/scsi/vmw_pvscsi.c            | 3 ++-
 hw/usb/dev-uas.c                | 3 ++-
 hw/usb/hcd-dwc2.c               | 3 ++-
 hw/usb/hcd-ehci.c               | 3 ++-
 hw/usb/hcd-uhci.c               | 2 +-
 hw/usb/host-libusb.c            | 6 ++++--
 hw/usb/redirect.c               | 6 ++++--
 hw/usb/xen-usb.c                | 3 ++-
 hw/virtio/virtio-balloon.c      | 5 +++--
 hw/virtio/virtio-crypto.c       | 3 ++-
 25 files changed, 66 insertions(+), 33 deletions(-)

diff --git a/hw/9pfs/xen-9p-backend.c b/hw/9pfs/xen-9p-backend.c
index 382be1ab11..4aa9c8c736 100644
--- a/hw/9pfs/xen-9p-backend.c
+++ b/hw/9pfs/xen-9p-backend.c
@@ -63,6 +63,7 @@ typedef struct Xen9pfsDev {
 
     int num_rings;
     Xen9pfsRing *rings;
+    MemReentrancyGuard mem_reentrancy_guard;
 } Xen9pfsDev;
 
 static void xen_9pfs_disconnect(struct XenLegacyDevice *xendev);
@@ -450,7 +451,9 @@ static int xen_9pfs_connect(struct XenLegacyDevice *xendev)
         xen_9pdev->rings[i].ring.out = xen_9pdev->rings[i].data +
                                        XEN_FLEX_RING_SIZE(ring_order);
 
-        xen_9pdev->rings[i].bh = qemu_bh_new(xen_9pfs_bh, &xen_9pdev->rings[i]);
+        xen_9pdev->rings[i].bh = qemu_bh_new_guarded(xen_9pfs_bh,
+                                                     &xen_9pdev->rings[i],
+                                                     &xen_9pdev->mem_reentrancy_guard);
         xen_9pdev->rings[i].out_cons = 0;
         xen_9pdev->rings[i].out_size = 0;
         xen_9pdev->rings[i].inprogress = false;
diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
index b28d81737e..a6202997ee 100644
--- a/hw/block/dataplane/virtio-blk.c
+++ b/hw/block/dataplane/virtio-blk.c
@@ -127,7 +127,8 @@ bool virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *conf,
     } else {
         s->ctx = qemu_get_aio_context();
     }
-    s->bh = aio_bh_new(s->ctx, notify_guest_bh, s);
+    s->bh = aio_bh_new_guarded(s->ctx, notify_guest_bh, s,
+                               &DEVICE(vdev)->mem_reentrancy_guard);
     s->batch_notify_vqs = bitmap_new(conf->num_queues);
 
     *dataplane = s;
diff --git a/hw/block/dataplane/xen-block.c b/hw/block/dataplane/xen-block.c
index 734da42ea7..d8bc39d359 100644
--- a/hw/block/dataplane/xen-block.c
+++ b/hw/block/dataplane/xen-block.c
@@ -633,8 +633,9 @@ XenBlockDataPlane *xen_block_dataplane_create(XenDevice *xendev,
     } else {
         dataplane->ctx = qemu_get_aio_context();
     }
-    dataplane->bh = aio_bh_new(dataplane->ctx, xen_block_dataplane_bh,
-                               dataplane);
+    dataplane->bh = aio_bh_new_guarded(dataplane->ctx, xen_block_dataplane_bh,
+                                       dataplane,
+                                       &DEVICE(xendev)->mem_reentrancy_guard);
 
     return dataplane;
 }
diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
index 7d4601cb5d..dd619f0731 100644
--- a/hw/char/virtio-serial-bus.c
+++ b/hw/char/virtio-serial-bus.c
@@ -985,7 +985,8 @@ static void virtser_port_device_realize(DeviceState *dev, Error **errp)
         return;
     }
 
-    port->bh = qemu_bh_new(flush_queued_data_bh, port);
+    port->bh = qemu_bh_new_guarded(flush_queued_data_bh, port,
+                                   &dev->mem_reentrancy_guard);
     port->elem = NULL;
 }
 
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 80ce1e9a93..f1c0eb7dfc 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -2201,11 +2201,14 @@ static void qxl_realize_common(PCIQXLDevice *qxl, Error **errp)
 
     qemu_add_vm_change_state_handler(qxl_vm_change_state_handler, qxl);
 
-    qxl->update_irq = qemu_bh_new(qxl_update_irq_bh, qxl);
+    qxl->update_irq = qemu_bh_new_guarded(qxl_update_irq_bh, qxl,
+                                          &DEVICE(qxl)->mem_reentrancy_guard);
     qxl_reset_state(qxl);
 
-    qxl->update_area_bh = qemu_bh_new(qxl_render_update_area_bh, qxl);
-    qxl->ssd.cursor_bh = qemu_bh_new(qemu_spice_cursor_refresh_bh, &qxl->ssd);
+    qxl->update_area_bh = qemu_bh_new_guarded(qxl_render_update_area_bh, qxl,
+                                              &DEVICE(qxl)->mem_reentrancy_guard);
+    qxl->ssd.cursor_bh = qemu_bh_new_guarded(qemu_spice_cursor_refresh_bh, &qxl->ssd,
+                                             &DEVICE(qxl)->mem_reentrancy_guard);
 }
 
 static void qxl_realize_primary(PCIDevice *dev, Error **errp)
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 4e2e0dd53a..7c13b056b9 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -1356,8 +1356,10 @@ void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
 
     g->ctrl_vq = virtio_get_queue(vdev, 0);
     g->cursor_vq = virtio_get_queue(vdev, 1);
-    g->ctrl_bh = qemu_bh_new(virtio_gpu_ctrl_bh, g);
-    g->cursor_bh = qemu_bh_new(virtio_gpu_cursor_bh, g);
+    g->ctrl_bh = qemu_bh_new_guarded(virtio_gpu_ctrl_bh, g,
+                                     &qdev->mem_reentrancy_guard);
+    g->cursor_bh = qemu_bh_new_guarded(virtio_gpu_cursor_bh, g,
+                                       &qdev->mem_reentrancy_guard);
     QTAILQ_INIT(&g->reslist);
     QTAILQ_INIT(&g->cmdq);
     QTAILQ_INIT(&g->fenceq);
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 55902e1df7..4e76d6b191 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1509,7 +1509,8 @@ static void ahci_cmd_done(const IDEDMA *dma)
     ahci_write_fis_d2h(ad);
 
     if (ad->port_regs.cmd_issue && !ad->check_bh) {
-        ad->check_bh = qemu_bh_new(ahci_check_cmd_bh, ad);
+        ad->check_bh = qemu_bh_new_guarded(ahci_check_cmd_bh, ad,
+                                           &ad->mem_reentrancy_guard);
         qemu_bh_schedule(ad->check_bh);
     }
 }
diff --git a/hw/ide/ahci_internal.h b/hw/ide/ahci_internal.h
index 303fcd7235..2480455372 100644
--- a/hw/ide/ahci_internal.h
+++ b/hw/ide/ahci_internal.h
@@ -321,6 +321,7 @@ struct AHCIDevice {
     bool init_d2h_sent;
     AHCICmdHdr *cur_cmd;
     NCQTransferState ncq_tfs[AHCI_MAX_CMDS];
+    MemReentrancyGuard mem_reentrancy_guard;
 };
 
 struct AHCIPCIState {
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 45d14a25e9..de48ff9f86 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -513,6 +513,7 @@ BlockAIOCB *ide_issue_trim(
         BlockCompletionFunc *cb, void *cb_opaque, void *opaque)
 {
     IDEState *s = opaque;
+    IDEDevice *dev = s->unit ? s->bus->slave : s->bus->master;
     TrimAIOCB *iocb;
 
     /* Paired with a decrement in ide_trim_bh_cb() */
@@ -520,7 +521,8 @@ BlockAIOCB *ide_issue_trim(
 
     iocb = blk_aio_get(&trim_aiocb_info, s->blk, cb, cb_opaque);
     iocb->s = s;
-    iocb->bh = qemu_bh_new(ide_trim_bh_cb, iocb);
+    iocb->bh = qemu_bh_new_guarded(ide_trim_bh_cb, iocb,
+                                   &DEVICE(dev)->mem_reentrancy_guard);
     iocb->ret = 0;
     iocb->qiov = qiov;
     iocb->i = -1;
diff --git a/hw/misc/imx_rngc.c b/hw/misc/imx_rngc.c
index 632c03779c..082c6980ad 100644
--- a/hw/misc/imx_rngc.c
+++ b/hw/misc/imx_rngc.c
@@ -228,8 +228,10 @@ static void imx_rngc_realize(DeviceState *dev, Error **errp)
     sysbus_init_mmio(sbd, &s->iomem);
 
     sysbus_init_irq(sbd, &s->irq);
-    s->self_test_bh = qemu_bh_new(imx_rngc_self_test, s);
-    s->seed_bh = qemu_bh_new(imx_rngc_seed, s);
+    s->self_test_bh = qemu_bh_new_guarded(imx_rngc_self_test, s,
+                                          &dev->mem_reentrancy_guard);
+    s->seed_bh = qemu_bh_new_guarded(imx_rngc_seed, s,
+                                     &dev->mem_reentrancy_guard);
 }
 
 static void imx_rngc_reset(DeviceState *dev)
diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c
index 43bb1f56ba..80a789f32b 100644
--- a/hw/misc/macio/mac_dbdma.c
+++ b/hw/misc/macio/mac_dbdma.c
@@ -914,7 +914,7 @@ static void mac_dbdma_realize(DeviceState *dev, Error **errp)
 {
     DBDMAState *s = MAC_DBDMA(dev);
 
-    s->bh = qemu_bh_new(DBDMA_run_bh, s);
+    s->bh = qemu_bh_new_guarded(DBDMA_run_bh, s, &dev->mem_reentrancy_guard);
 }
 
 static void mac_dbdma_class_init(ObjectClass *oc, void *data)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 3b66c97e3d..c9ba367c1b 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -2919,7 +2919,8 @@ static void virtio_net_add_queue(VirtIONet *n, int index)
         n->vqs[index].tx_vq =
             virtio_add_queue(vdev, n->net_conf.tx_queue_size,
                              virtio_net_handle_tx_bh);
-        n->vqs[index].tx_bh = qemu_bh_new(virtio_net_tx_bh, &n->vqs[index]);
+        n->vqs[index].tx_bh = qemu_bh_new_guarded(virtio_net_tx_bh, &n->vqs[index],
+                                                  &DEVICE(vdev)->mem_reentrancy_guard);
     }
 
     n->vqs[index].tx_waiting = 0;
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 2097fb1310..812246689c 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -4607,7 +4607,8 @@ static void nvme_init_sq(NvmeSQueue *sq, NvmeCtrl *n, uint64_t dma_addr,
         QTAILQ_INSERT_TAIL(&(sq->req_list), &sq->io_req[i], entry);
     }
 
-    sq->bh = qemu_bh_new(nvme_process_sq, sq);
+    sq->bh = qemu_bh_new_guarded(nvme_process_sq, sq,
+                                 &DEVICE(sq->ctrl)->mem_reentrancy_guard);
 
     if (n->dbbuf_enabled) {
         sq->db_addr = n->dbbuf_dbs + (sqid << 3);
@@ -5253,7 +5254,8 @@ static void nvme_init_cq(NvmeCQueue *cq, NvmeCtrl *n, uint64_t dma_addr,
         }
     }
     n->cq[cqid] = cq;
-    cq->bh = qemu_bh_new(nvme_post_cqes, cq);
+    cq->bh = qemu_bh_new_guarded(nvme_post_cqes, cq,
+                                 &DEVICE(cq->ctrl)->mem_reentrancy_guard);
 }
 
 static uint16_t nvme_create_cq(NvmeCtrl *n, NvmeRequest *req)
diff --git a/hw/scsi/mptsas.c b/hw/scsi/mptsas.c
index c485da792c..3de288b454 100644
--- a/hw/scsi/mptsas.c
+++ b/hw/scsi/mptsas.c
@@ -1322,7 +1322,8 @@ static void mptsas_scsi_realize(PCIDevice *dev, Error **errp)
     }
     s->max_devices = MPTSAS_NUM_PORTS;
 
-    s->request_bh = qemu_bh_new(mptsas_fetch_requests, s);
+    s->request_bh = qemu_bh_new_guarded(mptsas_fetch_requests, s,
+                                        &DEVICE(dev)->mem_reentrancy_guard);
 
     scsi_bus_init(&s->bus, sizeof(s->bus), &dev->qdev, &mptsas_scsi_info);
 }
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index c97176110c..3c20b47ad0 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -193,7 +193,8 @@ static void scsi_dma_restart_cb(void *opaque, bool running, RunState state)
         AioContext *ctx = blk_get_aio_context(s->conf.blk);
         /* The reference is dropped in scsi_dma_restart_bh.*/
         object_ref(OBJECT(s));
-        s->bh = aio_bh_new(ctx, scsi_dma_restart_bh, s);
+        s->bh = aio_bh_new_guarded(ctx, scsi_dma_restart_bh, s,
+                                   &DEVICE(s)->mem_reentrancy_guard);
         qemu_bh_schedule(s->bh);
     }
 }
diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
index fa76696855..4de34536e9 100644
--- a/hw/scsi/vmw_pvscsi.c
+++ b/hw/scsi/vmw_pvscsi.c
@@ -1184,7 +1184,8 @@ pvscsi_realizefn(PCIDevice *pci_dev, Error **errp)
         pcie_endpoint_cap_init(pci_dev, PVSCSI_EXP_EP_OFFSET);
     }
 
-    s->completion_worker = qemu_bh_new(pvscsi_process_completion_queue, s);
+    s->completion_worker = qemu_bh_new_guarded(pvscsi_process_completion_queue, s,
+                                               &DEVICE(pci_dev)->mem_reentrancy_guard);
 
     scsi_bus_init(&s->bus, sizeof(s->bus), DEVICE(pci_dev), &pvscsi_scsi_info);
     /* override default SCSI bus hotplug-handler, with pvscsi's one */
diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c
index 88f99c05d5..f013ded91e 100644
--- a/hw/usb/dev-uas.c
+++ b/hw/usb/dev-uas.c
@@ -937,7 +937,8 @@ static void usb_uas_realize(USBDevice *dev, Error **errp)
 
     QTAILQ_INIT(&uas->results);
     QTAILQ_INIT(&uas->requests);
-    uas->status_bh = qemu_bh_new(usb_uas_send_status_bh, uas);
+    uas->status_bh = qemu_bh_new_guarded(usb_uas_send_status_bh, uas,
+                                         &d->mem_reentrancy_guard);
 
     dev->flags |= (1 << USB_DEV_FLAG_IS_SCSI_STORAGE);
     scsi_bus_init(&uas->bus, sizeof(uas->bus), DEVICE(dev), &usb_uas_scsi_info);
diff --git a/hw/usb/hcd-dwc2.c b/hw/usb/hcd-dwc2.c
index 8755e9cbb0..a0c4e782b2 100644
--- a/hw/usb/hcd-dwc2.c
+++ b/hw/usb/hcd-dwc2.c
@@ -1364,7 +1364,8 @@ static void dwc2_realize(DeviceState *dev, Error **errp)
     s->fi = USB_FRMINTVL - 1;
     s->eof_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, dwc2_frame_boundary, s);
     s->frame_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, dwc2_work_timer, s);
-    s->async_bh = qemu_bh_new(dwc2_work_bh, s);
+    s->async_bh = qemu_bh_new_guarded(dwc2_work_bh, s,
+                                      &dev->mem_reentrancy_guard);
 
     sysbus_init_irq(sbd, &s->irq);
 }
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index d4da8dcb8d..c930c60921 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -2533,7 +2533,8 @@ void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp)
     }
 
     s->frame_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, ehci_work_timer, s);
-    s->async_bh = qemu_bh_new(ehci_work_bh, s);
+    s->async_bh = qemu_bh_new_guarded(ehci_work_bh, s,
+                                      &dev->mem_reentrancy_guard);
     s->device = dev;
 
     s->vmstate = qemu_add_vm_change_state_handler(usb_ehci_vm_state_change, s);
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index 8ac1175ad2..77baaa7a6b 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -1190,7 +1190,7 @@ void usb_uhci_common_realize(PCIDevice *dev, Error **errp)
                               USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
         }
     }
-    s->bh = qemu_bh_new(uhci_bh, s);
+    s->bh = qemu_bh_new_guarded(uhci_bh, s, &DEVICE(dev)->mem_reentrancy_guard);
     s->frame_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, uhci_frame_timer, s);
     s->num_ports_vmstate = NB_PORTS;
     QTAILQ_INIT(&s->queues);
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index 176868d345..f500db85ab 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -1141,7 +1141,8 @@ static void usb_host_nodev_bh(void *opaque)
 static void usb_host_nodev(USBHostDevice *s)
 {
     if (!s->bh_nodev) {
-        s->bh_nodev = qemu_bh_new(usb_host_nodev_bh, s);
+        s->bh_nodev = qemu_bh_new_guarded(usb_host_nodev_bh, s,
+                                          &DEVICE(s)->mem_reentrancy_guard);
     }
     qemu_bh_schedule(s->bh_nodev);
 }
@@ -1739,7 +1740,8 @@ static int usb_host_post_load(void *opaque, int version_id)
     USBHostDevice *dev = opaque;
 
     if (!dev->bh_postld) {
-        dev->bh_postld = qemu_bh_new(usb_host_post_load_bh, dev);
+        dev->bh_postld = qemu_bh_new_guarded(usb_host_post_load_bh, dev,
+                                             &DEVICE(dev)->mem_reentrancy_guard);
     }
     qemu_bh_schedule(dev->bh_postld);
     dev->bh_postld_pending = true;
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index fd7df599bc..39fbaaab16 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -1441,8 +1441,10 @@ static void usbredir_realize(USBDevice *udev, Error **errp)
         }
     }
 
-    dev->chardev_close_bh = qemu_bh_new(usbredir_chardev_close_bh, dev);
-    dev->device_reject_bh = qemu_bh_new(usbredir_device_reject_bh, dev);
+    dev->chardev_close_bh = qemu_bh_new_guarded(usbredir_chardev_close_bh, dev,
+                                                &DEVICE(dev)->mem_reentrancy_guard);
+    dev->device_reject_bh = qemu_bh_new_guarded(usbredir_device_reject_bh, dev,
+                                                &DEVICE(dev)->mem_reentrancy_guard);
     dev->attach_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, usbredir_do_attach, dev);
 
     packet_id_queue_init(&dev->cancelled, dev, "cancelled");
diff --git a/hw/usb/xen-usb.c b/hw/usb/xen-usb.c
index 66cb3f7c24..38ee660a30 100644
--- a/hw/usb/xen-usb.c
+++ b/hw/usb/xen-usb.c
@@ -1032,7 +1032,8 @@ static void usbback_alloc(struct XenLegacyDevice *xendev)
 
     QTAILQ_INIT(&usbif->req_free_q);
     QSIMPLEQ_INIT(&usbif->hotplug_q);
-    usbif->bh = qemu_bh_new(usbback_bh, usbif);
+    usbif->bh = qemu_bh_new_guarded(usbback_bh, usbif,
+                                    &DEVICE(xendev)->mem_reentrancy_guard);
 }
 
 static int usbback_free(struct XenLegacyDevice *xendev)
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index 746f07c4d2..d60dd1f61e 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -908,8 +908,9 @@ static void virtio_balloon_device_realize(DeviceState *dev, Error **errp)
         precopy_add_notifier(&s->free_page_hint_notify);
 
         object_ref(OBJECT(s->iothread));
-        s->free_page_bh = aio_bh_new(iothread_get_aio_context(s->iothread),
-                                     virtio_ballloon_get_free_page_hints, s);
+        s->free_page_bh = aio_bh_new_guarded(iothread_get_aio_context(s->iothread),
+                                             virtio_ballloon_get_free_page_hints, s,
+                                             &dev->mem_reentrancy_guard);
     }
 
     if (virtio_has_feature(s->host_features, VIRTIO_BALLOON_F_REPORTING)) {
diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c
index ccaa704530..f4a25de5ac 100644
--- a/hw/virtio/virtio-crypto.c
+++ b/hw/virtio/virtio-crypto.c
@@ -1081,7 +1081,8 @@ static void virtio_crypto_device_realize(DeviceState *dev, Error **errp)
         vcrypto->vqs[i].dataq =
                  virtio_add_queue(vdev, 1024, virtio_crypto_handle_dataq_bh);
         vcrypto->vqs[i].dataq_bh =
-                 qemu_bh_new(virtio_crypto_dataq_bh, &vcrypto->vqs[i]);
+                 qemu_bh_new_guarded(virtio_crypto_dataq_bh, &vcrypto->vqs[i],
+                                     &dev->mem_reentrancy_guard);
         vcrypto->vqs[i].vcrypto = vcrypto;
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:55:56 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:55:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814119.1227235 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTQC-00050e-3k; Wed, 09 Oct 2024 09:55:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814119.1227235; Wed, 09 Oct 2024 09:55: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 1syTQC-00050W-0y; Wed, 09 Oct 2024 09:55:56 +0000
Received: by outflank-mailman (input) for mailman id 814119;
 Wed, 09 Oct 2024 09:55: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 1syTQB-00050N-FM
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:55: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 1syTQB-0005xQ-EP
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:55:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTQB-0005vR-DS
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:55: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=WmLUW71C9iawqll6dJkogp17N3dtOzB2uU3BB3p32mE=; b=ztAs1qYIl6XXfw1AFdcL8WlhMl
	Tpl3BiKe9B9BXKhKca3XAGl7bQHngjFcvNTDcF0JhXUiHeZPPD+vCAeJ/hHHKtPuKXfBWKjpV/Stx
	L/Hgd93kBA7Jhs0vfZ2GUp7xBOMzNd7gCIzEaHW3/aZp6EwCevzCw0endlosZ2P+AXiQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] lsi53c895a: disable reentrancy detection for script RAM
Message-Id: <E1syTQB-0005vR-DS@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:55:55 +0000

commit db43c7db206427ff5f6cbc7116c66d6cc6e81385
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:10 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    lsi53c895a: disable reentrancy detection for script RAM
    
    As the code is designed to use the memory APIs to access the script ram,
    disable reentrancy checks for the pseudo-RAM ram_io MemoryRegion.
    
    In the future, ram_io may be converted from an IO to a proper RAM MemoryRegion.
    
    Reported-by: Fiona Ebner <f.ebner@proxmox.com>
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Message-Id: <20230427211013.2994127-6-alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit bfd6e7ae6a72b84e2eb9574f56e6ec037f05182c)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/scsi/lsi53c895a.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index bbf32d3f73..17af67935f 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -2313,6 +2313,12 @@ static void lsi_scsi_realize(PCIDevice *dev, Error **errp)
     memory_region_init_io(&s->io_io, OBJECT(s), &lsi_io_ops, s,
                           "lsi-io", 256);
 
+    /*
+     * Since we use the address-space API to interact with ram_io, disable the
+     * re-entrancy guard.
+     */
+    s->ram_io.disable_reentrancy_guard = true;
+
     address_space_init(&s->pci_io_as, pci_address_space_io(dev), "lsi-pci-io");
     qdev_init_gpio_out(d, &s->ext_irq, 1);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:56:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:56:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814120.1227239 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTQM-00053U-59; Wed, 09 Oct 2024 09:56:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814120.1227239; Wed, 09 Oct 2024 09:56: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 1syTQM-00053M-2R; Wed, 09 Oct 2024 09:56:06 +0000
Received: by outflank-mailman (input) for mailman id 814120;
 Wed, 09 Oct 2024 09:56: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 1syTQL-00053E-IL
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:56: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 1syTQL-0005xl-HZ
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:56:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTQL-0005wp-Gm
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:56: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=/oOLvD8joQvurKSo4qKq7mwga07/Mfufv/6FuzeK9Jc=; b=Lhw2iyRqaihOdLuw69Yi9b7T86
	doFHf+X3GOWzdx59SrZykANjjTHdVpUq/0cXGGqYgOXWaHwEoOTO+ZeAfBjEhLY/ZJXMaVtG8u4yw
	UhQD7NowffenwhtnyR1k6XrMJzVGcWiY9XGrRyufCKe93p65Dg020sQBbqjCgH4JRNYo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] lsi53c895a: disable reentrancy detection for MMIO region, too
Message-Id: <E1syTQL-0005wp-Gm@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:56:05 +0000

commit 0f0fb19d2bae3a5184fdbfcaa5de24f6ce759042
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Tue May 16 11:05:56 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    lsi53c895a: disable reentrancy detection for MMIO region, too
    
    While trying to use a SCSI disk on the LSI controller with an
    older version of Fedora (25), I'm getting:
    
     qemu: warning: Blocked re-entrant IO on MemoryRegion: lsi-mmio at addr: 0x34
    
    and the SCSI controller is not usable. Seems like we have to
    disable the reentrancy checker for the MMIO region, too, to
    get this working again.
    
    The problem could be reproduced it like this:
    
    ./qemu-system-x86_64 -accel kvm -m 2G -machine q35 \
     -device lsi53c810,id=lsi1 -device scsi-hd,drive=d0 \
     -drive if=none,id=d0,file=.../somedisk.qcow2 \
     -cdrom Fedora-Everything-netinst-i386-25-1.3.iso
    
    Where somedisk.qcow2 is an image that contains already some partitions
    and file systems.
    
    In the boot menu of Fedora, go to
    "Troubleshooting" -> "Rescue a Fedora system" -> "3) Skip to shell"
    
    Then check "dmesg | grep -i 53c" for failure messages, and try to mount
    a partition from somedisk.qcow2.
    
    Message-Id: <20230516090556.553813-1-thuth@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit d139fe9ad8a27bcc50b4ead77d2f97d191a0e95e)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/scsi/lsi53c895a.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index 17af67935f..f7d45b0b20 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -2318,6 +2318,7 @@ static void lsi_scsi_realize(PCIDevice *dev, Error **errp)
      * re-entrancy guard.
      */
     s->ram_io.disable_reentrancy_guard = true;
+    s->mmio_io.disable_reentrancy_guard = true;
 
     address_space_init(&s->pci_io_as, pci_address_space_io(dev), "lsi-pci-io");
     qdev_init_gpio_out(d, &s->ext_irq, 1);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:56:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:56:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814121.1227243 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTQW-00056X-6Y; Wed, 09 Oct 2024 09:56:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814121.1227243; Wed, 09 Oct 2024 09:56: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 1syTQW-00056P-3r; Wed, 09 Oct 2024 09:56:16 +0000
Received: by outflank-mailman (input) for mailman id 814121;
 Wed, 09 Oct 2024 09: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 1syTQV-00056J-Ll
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09: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 1syTQV-0005xy-Ke
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:56:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTQV-0005xf-Ju
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:56: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=JlnBeKnDY+h+zlbjMgE4Phx7csEV50vVQKkFNuj3LEg=; b=S1cMh48DYA07wtxMrMrDNquxlB
	ygNsxWCAriDDGRcogLE+7sjowKyFkYBsR5Nm3Bj6GVm/5Z/2+MrSwEDsiBKUGE/mbu+xExJxJvWy0
	6IPsn6LsAC08SyNigm1lLPyKD1xPZjWcJEbWf5TkeQmpqDYP2j5T9nOj1wPm05PAsOrA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] bcm2835_property: disable reentrancy detection for iomem
Message-Id: <E1syTQV-0005xf-Ju@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:56:15 +0000

commit 83d080e85ae769dddf67118b420ec39bfcc3323f
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:11 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    bcm2835_property: disable reentrancy detection for iomem
    
    As the code is designed for re-entrant calls from bcm2835_property to
    bcm2835_mbox and back into bcm2835_property, mark iomem as
    reentrancy-safe.
    
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Message-Id: <20230427211013.2994127-7-alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 985c4a4e547afb9573b6bd6843d20eb2c3d1d1cd)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/misc/bcm2835_property.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c
index 890ae7bae5..de056ea2df 100644
--- a/hw/misc/bcm2835_property.c
+++ b/hw/misc/bcm2835_property.c
@@ -382,6 +382,13 @@ static void bcm2835_property_init(Object *obj)
 
     memory_region_init_io(&s->iomem, OBJECT(s), &bcm2835_property_ops, s,
                           TYPE_BCM2835_PROPERTY, 0x10);
+
+    /*
+     * bcm2835_property_ops call into bcm2835_mbox, which in-turn reads from
+     * iomem. As such, mark iomem as re-entracy safe.
+     */
+    s->iomem.disable_reentrancy_guard = true;
+
     sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->iomem);
     sysbus_init_irq(SYS_BUS_DEVICE(s), &s->mbox_irq);
 }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:56:26 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:56:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814122.1227247 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTQg-00059J-85; Wed, 09 Oct 2024 09:56:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814122.1227247; Wed, 09 Oct 2024 09:56: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 1syTQg-00059B-5H; Wed, 09 Oct 2024 09:56:26 +0000
Received: by outflank-mailman (input) for mailman id 814122;
 Wed, 09 Oct 2024 09: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 1syTQf-000593-Pd
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09: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 1syTQf-0005y6-Nm
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:56:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTQf-0005yO-Mr
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09: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=PDt6rXBTwwl758k/6qkfYSZ6PcMHMhmGHz7Gg5SycB8=; b=nnKQFmR4Zxfd/tVuWFJ8As59GM
	Kpzy1u+zsZSSHSyqoBZ8U0UwRV3vHkmL7sa0Hs6948NacYwU9Nw0jMMLDFz4wi6doOu8w2qMPFWy+
	4CikCRVxxonOPJU9/PZ9FKdHG0qRogThQy/0ESgMS8ZKNo8G+6Hm/nO7ymF5uhTGzjqU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] raven: disable reentrancy detection for iomem
Message-Id: <E1syTQf-0005yO-Mr@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:56:25 +0000

commit 151649da1b821809d016c03287301ee0f81596c4
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:12 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    raven: disable reentrancy detection for iomem
    
    As the code is designed for re-entrant calls from raven_io_ops to
    pci-conf, mark raven_io_ops as reentrancy-safe.
    
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Message-Id: <20230427211013.2994127-8-alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 6dad5a6810d9c60ca320d01276f6133bbcfa1fc7)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/pci-host/raven.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c
index 072ffe3c5e..9a11ac4b2b 100644
--- a/hw/pci-host/raven.c
+++ b/hw/pci-host/raven.c
@@ -294,6 +294,13 @@ static void raven_pcihost_initfn(Object *obj)
     memory_region_init(&s->pci_memory, obj, "pci-memory", 0x3f000000);
     address_space_init(&s->pci_io_as, &s->pci_io, "raven-io");
 
+    /*
+     * Raven's raven_io_ops use the address-space API to access pci-conf-idx
+     * (which is also owned by the raven device). As such, mark the
+     * pci_io_non_contiguous as re-entrancy safe.
+     */
+    s->pci_io_non_contiguous.disable_reentrancy_guard = true;
+
     /* CPU address space */
     memory_region_add_subregion(address_space_mem, PCI_IO_BASE_ADDR,
                                 &s->pci_io);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:56:36 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:56:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814123.1227251 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTQq-0005HZ-9Q; Wed, 09 Oct 2024 09:56:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814123.1227251; Wed, 09 Oct 2024 09:56: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 1syTQq-0005HN-6j; Wed, 09 Oct 2024 09:56:36 +0000
Received: by outflank-mailman (input) for mailman id 814123;
 Wed, 09 Oct 2024 09: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 1syTQp-0005Fp-RZ
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09: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 1syTQp-0005yT-Qs
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:56:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTQp-0005zJ-Q5
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09: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=DCFm2H/Zg1HQvHoIp6eCLZM9jYiPLskkrbxpCdwi40k=; b=x816h+IZkWGmZBAUou3mfAirnr
	bOUSYZ/4VbylNv6/tKya7Y/RuFSmEMI0gDH/ow8BDO7VlQ+68ws38atm7C9LJ7nqtQb/WzQdR7gkF
	B27ZKfA1ANYIE1wA6OPQKdlLpoVW6IFrFoYtwBiyU3Ma1EzkYg157aVmn4zEC6EiubPg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] apic: disable reentrancy detection for apic-msi
Message-Id: <E1syTQp-0005zJ-Q5@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:56:35 +0000

commit 305ffdeca8d134e5982e18137fc369eb929b2059
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:13 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    apic: disable reentrancy detection for apic-msi
    
    As the code is designed for re-entrant calls to apic-msi, mark apic-msi
    as reentrancy-safe.
    
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Message-Id: <20230427211013.2994127-9-alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 50795ee051a342c681a9b45671c552fbd6274db8)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/intc/apic.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/intc/apic.c b/hw/intc/apic.c
index 20b5a94073..ac3d47d231 100644
--- a/hw/intc/apic.c
+++ b/hw/intc/apic.c
@@ -885,6 +885,13 @@ static void apic_realize(DeviceState *dev, Error **errp)
     memory_region_init_io(&s->io_memory, OBJECT(s), &apic_io_ops, s, "apic-msi",
                           APIC_SPACE_SIZE);
 
+    /*
+     * apic-msi's apic_mem_write can call into ioapic_eoi_broadcast, which can
+     * write back to apic-msi. As such mark the apic-msi region re-entrancy
+     * safe.
+     */
+    s->io_memory.disable_reentrancy_guard = true;
+
     s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, apic_timer, s);
     local_apics[s->id] = s;
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:56:47 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:56:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814124.1227254 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTR1-0005Nx-Au; Wed, 09 Oct 2024 09:56:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814124.1227254; Wed, 09 Oct 2024 09:56: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 1syTR1-0005Np-8R; Wed, 09 Oct 2024 09:56:47 +0000
Received: by outflank-mailman (input) for mailman id 814124;
 Wed, 09 Oct 2024 09: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 1syTQz-0005Na-Uf
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09: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 1syTQz-0005yb-U0
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:56:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTQz-000605-TE
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09: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=7A5ziyji8V7AW8gWQliWs5KrESqDdR+WASUZk8CahSI=; b=JTWdKdpTYHimOHps4NMPYHHXJ1
	OqUI2fb7KwE49NIq5AtQVIcJAds9jQjfB2W8eSy8+FXQxc6P17tlCP7/tZIy8rfcrawz3yAm8Goyt
	88uz4zIIbliQCiGx1dK70IcMPVhdukp9h0n0u/3YoxFZkH8PHKDoA67sA0LyPKSccxwM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] loongarch: mark loongarch_ipi_iocsr re-entrnacy safe
Message-Id: <E1syTQz-000605-TE@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:56:45 +0000

commit 48c04e42f033bf2e717052d99192fada589d62b3
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Sat May 6 07:21:45 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    loongarch: mark loongarch_ipi_iocsr re-entrnacy safe
    
    loongarch_ipi_iocsr MRs rely on re-entrant IO through the ipi_send
    function. As such, mark these MRs re-entrancy-safe.
    
    Fixes: a2e1753b80 ("memory: prevent dma-reentracy issues")
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Song Gao <gaosong@loongson.cn>
    Message-Id: <20230506112145.3563708-1-alxndr@bu.edu>
    Signed-off-by: Song Gao <gaosong@loongson.cn>
    (cherry picked from commit 6d0589e0e6c64b888864a2bf980537be20389264)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/intc/loongarch_ipi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/intc/loongarch_ipi.c b/hw/intc/loongarch_ipi.c
index aa4bf9eb74..40e98af2ce 100644
--- a/hw/intc/loongarch_ipi.c
+++ b/hw/intc/loongarch_ipi.c
@@ -215,6 +215,10 @@ static void loongarch_ipi_init(Object *obj)
     for (cpu = 0; cpu < MAX_IPI_CORE_NUM; cpu++) {
         memory_region_init_io(&s->ipi_iocsr_mem[cpu], obj, &loongarch_ipi_ops,
                             &lams->ipi_core[cpu], "loongarch_ipi_iocsr", 0x48);
+
+        /* loongarch_ipi_iocsr performs re-entrant IO through ipi_send */
+        s->ipi_iocsr_mem[cpu].disable_reentrancy_guard = true;
+
         sysbus_init_mmio(sbd, &s->ipi_iocsr_mem[cpu]);
 
         memory_region_init_io(&s->ipi64_iocsr_mem[cpu], obj, &loongarch_ipi64_ops,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:56:57 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:56:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814125.1227259 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTRB-0005UH-Cn; Wed, 09 Oct 2024 09:56:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814125.1227259; Wed, 09 Oct 2024 09:56: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 1syTRB-0005UA-9y; Wed, 09 Oct 2024 09:56:57 +0000
Received: by outflank-mailman (input) for mailman id 814125;
 Wed, 09 Oct 2024 09:56: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 1syTRA-0005Tw-1M
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:56: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 1syTRA-0005yi-0j
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:56:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTR9-00060z-WF
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:56: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=a2X+70/cE+IhetH3FQY6eHSaXSJYZtck/zS8L0F8OMs=; b=CZz9ZDMgd+aSjinnRlG65Ax12q
	L8chcpScSHGgCcpzW71F6RgV89owEeyET/s+rblwrIns/lIeYgl28YIcEZYrDeKnvQJf9AnxGg1Hj
	GzUYT0afnVb5VmlDHBEhMPk+56Jd7Q3xzTzee0iRptd9oSP5IJzGLh0NXOsv/cFB6ATI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] pnv_lpc: disable reentrancy detection for lpc-hc
Message-Id: <E1syTR9-00060z-WF@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:56:55 +0000

commit e7f12ce43d9fc6016c1f12d49bcb5e024663d7ad
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Fri May 26 09:38:50 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    pnv_lpc: disable reentrancy detection for lpc-hc
    
    As lpc-hc is designed for re-entrant calls from xscom, mark it
    re-entrancy safe.
    
    Reported-by: Thomas Huth <thuth@redhat.com>
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    [clg: mark opb_master_regs as re-entrancy safe also ]
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
    Tested-by: Thomas Huth <thuth@redhat.com>
    Message-Id: <20230526073850.2772197-1-clg@kaod.org>
    Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
    (cherry picked from commit 76f9ebffcd41b62ae9ec26a1c25676f2ae1d9cc3)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ppc/pnv_lpc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/ppc/pnv_lpc.c b/hw/ppc/pnv_lpc.c
index 01f44c19eb..605d390861 100644
--- a/hw/ppc/pnv_lpc.c
+++ b/hw/ppc/pnv_lpc.c
@@ -734,10 +734,13 @@ static void pnv_lpc_realize(DeviceState *dev, Error **errp)
     /* Create MMIO regions for LPC HC and OPB registers */
     memory_region_init_io(&lpc->opb_master_regs, OBJECT(dev), &opb_master_ops,
                           lpc, "lpc-opb-master", LPC_OPB_REGS_OPB_SIZE);
+    lpc->opb_master_regs.disable_reentrancy_guard = true;
     memory_region_add_subregion(&lpc->opb_mr, LPC_OPB_REGS_OPB_ADDR,
                                 &lpc->opb_master_regs);
     memory_region_init_io(&lpc->lpc_hc_regs, OBJECT(dev), &lpc_hc_ops, lpc,
                           "lpc-hc", LPC_HC_REGS_OPB_SIZE);
+    /* xscom writes to lpc-hc. As such mark lpc-hc re-entrancy safe */
+    lpc->lpc_hc_regs.disable_reentrancy_guard = true;
     memory_region_add_subregion(&lpc->opb_mr, LPC_HC_REGS_OPB_ADDR,
                                 &lpc->lpc_hc_regs);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:57:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:57:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814126.1227262 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTRL-0005b2-Dw; Wed, 09 Oct 2024 09:57:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814126.1227262; Wed, 09 Oct 2024 09:57: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 1syTRL-0005av-BY; Wed, 09 Oct 2024 09:57:07 +0000
Received: by outflank-mailman (input) for mailman id 814126;
 Wed, 09 Oct 2024 09:57: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 1syTRK-0005ag-4S
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:57: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 1syTRK-0005z2-3k
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:57:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTRK-000620-34
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:57: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=2hyQauqZ2bsxnRfqtF3H+4t7uslfRswIn7MWnaCT/Vw=; b=MxyWKEJ2MFn1HRDXTXKz2ZZncV
	GnYa2mudtguUJlkED2R94aV1lkc3AInrnE0N79Z/ReTmLQYX3CIDDEK2cz5x/I5KMuPFU1VQEKVOx
	wjgS/UU8s7hTI8xmOVcepzQCVHmBBaJtRs2/5of/4ohmUXjsNWLvocPWdGLq4gG/Urw0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] machine: Add helpers to get cores/threads per socket
Message-Id: <E1syTRK-000620-34@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:57:06 +0000

commit cfff72b21ebd8bb893181bb1107848cf8903ebaa
Author:     Zhao Liu <zhao1.liu@intel.com>
AuthorDate: Wed Jun 28 21:54:34 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    machine: Add helpers to get cores/threads per socket
    
    The number of cores/threads per socket are needed for smbios, and are
    also useful for other modules.
    
    Provide the helpers to wrap the calculation of cores/threads per socket
    so that we can avoid calculation errors caused by other modules miss
    topology changes.
    
    Suggested-by: Igor Mammedov <imammedo@redhat.com>
    Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
    Message-Id: <20230628135437.1145805-2-zhao1.liu@linux.intel.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit a1d027be95bc375238e5b9292c6aa661a8ddef4c)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/core/machine-smp.c | 10 ++++++++++
 include/hw/boards.h   |  2 ++
 2 files changed, 12 insertions(+)

diff --git a/hw/core/machine-smp.c b/hw/core/machine-smp.c
index 89fe0cda42..0f4d9b6f7a 100644
--- a/hw/core/machine-smp.c
+++ b/hw/core/machine-smp.c
@@ -197,3 +197,13 @@ void machine_parse_smp_config(MachineState *ms,
         return;
     }
 }
+
+unsigned int machine_topo_get_cores_per_socket(const MachineState *ms)
+{
+    return ms->smp.cores * ms->smp.clusters * ms->smp.dies;
+}
+
+unsigned int machine_topo_get_threads_per_socket(const MachineState *ms)
+{
+    return ms->smp.threads * machine_topo_get_cores_per_socket(ms);
+}
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 6fbbfd56c8..75c0b195af 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -35,6 +35,8 @@ void machine_set_cpu_numa_node(MachineState *machine,
                                Error **errp);
 void machine_parse_smp_config(MachineState *ms,
                               const SMPConfiguration *config, Error **errp);
+unsigned int machine_topo_get_cores_per_socket(const MachineState *ms);
+unsigned int machine_topo_get_threads_per_socket(const MachineState *ms);
 
 /**
  * machine_class_allow_dynamic_sysbus_dev: Add type to list of valid devices
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:57:17 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:57:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814127.1227267 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTRV-0005h1-Gn; Wed, 09 Oct 2024 09:57:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814127.1227267; Wed, 09 Oct 2024 09:57: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 1syTRV-0005gt-EF; Wed, 09 Oct 2024 09:57:17 +0000
Received: by outflank-mailman (input) for mailman id 814127;
 Wed, 09 Oct 2024 09:57: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 1syTRU-0005gj-7H
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:57: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 1syTRU-0005zD-6b
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:57:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTRU-00062y-5w
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:57: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=niIhu7ltjBepU4aPCcGEWTseMXm74iEpuWDYlF++zdI=; b=Thyjyh0rx57RQVFMGYX4GW8rF9
	ScJsahDQJtybqlyXcktgSVi4d3Ns141g0eTqPyU3b7nrpBoNX6HO4PG3pzyQxCANAYqnBNIQOVqmX
	O20hXKtIs3G2zYmnVhPaZREoK44DysBCQe1j2RZ0ryFWDk8MmwOau/hG8Kh2yMFy1BjI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/smbios: Fix smbios_smp_sockets caculation
Message-Id: <E1syTRU-00062y-5w@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:57:16 +0000

commit c107dab4940d19760560ded7651550de9441db28
Author:     Zhao Liu <zhao1.liu@intel.com>
AuthorDate: Wed Jun 28 21:54:35 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/smbios: Fix smbios_smp_sockets caculation
    
    smp.sockets is the number of sockets which is configured by "-smp" (
    otherwise, the default is 1). Trying to recalculate it here with another
    rules leads to errors, such as:
    
    1. 003f230e37d7 ("machine: Tweak the order of topology members in struct
       CpuTopology") changes the meaning of smp.cores but doesn't fix
       original smp.cores uses.
    
       With the introduction of cluster, now smp.cores means the number of
       cores in one cluster. So smp.cores * smp.threads just means the
       threads in a cluster not in a socket.
    
    2. On the other hand, we shouldn't use smp.cpus here because it
       indicates the initial number of online CPUs at the boot time, and is
       not mathematically related to smp.sockets.
    
    So stop reinventing the another wheel and use the topo values that
    has been calculated.
    
    Fixes: 003f230e37d7 ("machine: Tweak the order of topology members in struct CpuTopology")
    Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
    Message-Id: <20230628135437.1145805-3-zhao1.liu@linux.intel.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit d79a284a44bb7d88b233fb6bb12ea3723f43469d)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/smbios/smbios.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index d2007e70fb..d67415d44d 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -1088,8 +1088,7 @@ void smbios_get_tables(MachineState *ms,
         smbios_build_type_2_table();
         smbios_build_type_3_table();
 
-        smbios_smp_sockets = DIV_ROUND_UP(ms->smp.cpus,
-                                          ms->smp.cores * ms->smp.threads);
+        smbios_smp_sockets = ms->smp.sockets;
         assert(smbios_smp_sockets >= 1);
 
         for (i = 0; i < smbios_smp_sockets; i++) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:57:27 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:57:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814128.1227271 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTRf-0005qL-IC; Wed, 09 Oct 2024 09:57:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814128.1227271; Wed, 09 Oct 2024 09:57: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 1syTRf-0005qD-Fg; Wed, 09 Oct 2024 09:57:27 +0000
Received: by outflank-mailman (input) for mailman id 814128;
 Wed, 09 Oct 2024 09:57: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 1syTRe-0005nU-AF
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:57: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 1syTRe-00060r-9X
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:57:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTRe-00063o-8r
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:57: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=Q2tPGSd1+DiwsgIcHV7U7qifPaG/30vEv7W1ZU3pp5w=; b=Z6T6MJ74l4eHcuoqhtSDOy02VD
	CR7O5Yqro+Z1OCJRZ+jQiMQuptwcD+on2ki+vo8k9IUQvrgsQ6Pl6NK8CRV2Vr+T6gBkTVq7sVAn1
	Wpccy6g3agee5Ss45NCb4svjgAL0K5hAqhs/o1TzbdGEZIBigKHENkhktGPLbUbSBXTg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/smbios: Fix thread count in type4
Message-Id: <E1syTRe-00063o-8r@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:57:26 +0000

commit ce2e3879a4a55317febdc42a0bc22b4a89e80824
Author:     Zhao Liu <zhao1.liu@intel.com>
AuthorDate: Wed Jun 28 21:54:36 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/smbios: Fix thread count in type4
    
    >From SMBIOS 3.0 specification, thread count field means:
    
    Thread Count is the total number of threads detected by the BIOS for
    this processor socket. It is a processor-wide count, not a
    thread-per-core count. [1]
    
    So here we should use threads per socket other than threads per core.
    
    [1] SMBIOS 3.0.0, section 7.5.8, Processor Information - Thread Count
    
    Fixes: c97294ec1b9e ("SMBIOS: Build aggregate smbios tables and entry point")
    Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
    Message-Id: <20230628135437.1145805-4-zhao1.liu@linux.intel.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 7298fd7de5551c4501f54381228458e3c21cab4b)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/smbios/smbios.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index d67415d44d..3aae9328c0 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -713,6 +713,7 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
 {
     char sock_str[128];
     size_t tbl_len = SMBIOS_TYPE_4_LEN_V28;
+    unsigned threads_per_socket;
 
     if (smbios_ep_type == SMBIOS_ENTRY_POINT_TYPE_64) {
         tbl_len = SMBIOS_TYPE_4_LEN_V30;
@@ -747,17 +748,19 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
     SMBIOS_TABLE_SET_STR(4, asset_tag_number_str, type4.asset);
     SMBIOS_TABLE_SET_STR(4, part_number_str, type4.part);
 
+    threads_per_socket = machine_topo_get_threads_per_socket(ms);
+
     t->core_count = (ms->smp.cores > 255) ? 0xFF : ms->smp.cores;
     t->core_enabled = t->core_count;
 
-    t->thread_count = (ms->smp.threads > 255) ? 0xFF : ms->smp.threads;
+    t->thread_count = (threads_per_socket > 255) ? 0xFF : threads_per_socket;
 
     t->processor_characteristics = cpu_to_le16(0x02); /* Unknown */
     t->processor_family2 = cpu_to_le16(0x01); /* Other */
 
     if (tbl_len == SMBIOS_TYPE_4_LEN_V30) {
         t->core_count2 = t->core_enabled2 = cpu_to_le16(ms->smp.cores);
-        t->thread_count2 = cpu_to_le16(ms->smp.threads);
+        t->thread_count2 = cpu_to_le16(threads_per_socket);
     }
 
     SMBIOS_BUILD_TABLE_POST;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:57:37 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:57:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814129.1227274 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTRp-0005su-Ji; Wed, 09 Oct 2024 09:57:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814129.1227274; Wed, 09 Oct 2024 09:57: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 1syTRp-0005sn-H4; Wed, 09 Oct 2024 09:57:37 +0000
Received: by outflank-mailman (input) for mailman id 814129;
 Wed, 09 Oct 2024 09:57: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 1syTRo-0005sc-Cz
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:57: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 1syTRo-00061H-CM
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:57:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTRo-00064W-Bj
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:57: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=mOKzNBDq/wPUMagRjfEV/IE1k1OjG/FafpOIK9qwIFM=; b=OOt6Jz4OIu5CL8VX8FOAE8pGoF
	iIj1DyWv2yVOl2B/sewM0tO3p0VzPfCfszs/aQ4/UxnM+TCDcVmOoZNudy3QiVtDLrZXkBg+Njc3n
	qrcAY5LR1t4ayBcG4Lgnq+1kV4OeW2fGjdokrlV5fjsGkXTzfWFrSlXai2oxK31pwYR0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/smbios: Fix core count in type4
Message-Id: <E1syTRo-00064W-Bj@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:57:36 +0000

commit abb4828d5d5cd0fba82e958779a7c14d3b44e2df
Author:     Zhao Liu <zhao1.liu@intel.com>
AuthorDate: Wed Jun 28 21:54:37 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/smbios: Fix core count in type4
    
    >From SMBIOS 3.0 specification, core count field means:
    
    Core Count is the number of cores detected by the BIOS for this
    processor socket. [1]
    
    Before 003f230e37d7 ("machine: Tweak the order of topology members in
    struct CpuTopology"), MachineState.smp.cores means "the number of cores
    in one package", and it's correct to use smp.cores for core count.
    
    But 003f230e37d7 changes the smp.cores' meaning to "the number of cores
    in one die" and doesn't change the original smp.cores' use in smbios as
    well, which makes core count in type4 go wrong.
    
    Fix this issue with the correct "cores per socket" caculation.
    
    [1] SMBIOS 3.0.0, section 7.5.6, Processor Information - Core Count
    
    Fixes: 003f230e37d7 ("machine: Tweak the order of topology members in struct CpuTopology")
    Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
    Message-Id: <20230628135437.1145805-5-zhao1.liu@linux.intel.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 196ea60a734c346d7d75f1d89aa37703d4d854e7)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/smbios/smbios.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index 3aae9328c0..10cd22f610 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -714,6 +714,7 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
     char sock_str[128];
     size_t tbl_len = SMBIOS_TYPE_4_LEN_V28;
     unsigned threads_per_socket;
+    unsigned cores_per_socket;
 
     if (smbios_ep_type == SMBIOS_ENTRY_POINT_TYPE_64) {
         tbl_len = SMBIOS_TYPE_4_LEN_V30;
@@ -749,8 +750,9 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
     SMBIOS_TABLE_SET_STR(4, part_number_str, type4.part);
 
     threads_per_socket = machine_topo_get_threads_per_socket(ms);
+    cores_per_socket = machine_topo_get_cores_per_socket(ms);
 
-    t->core_count = (ms->smp.cores > 255) ? 0xFF : ms->smp.cores;
+    t->core_count = (cores_per_socket > 255) ? 0xFF : cores_per_socket;
     t->core_enabled = t->core_count;
 
     t->thread_count = (threads_per_socket > 255) ? 0xFF : threads_per_socket;
@@ -759,7 +761,7 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
     t->processor_family2 = cpu_to_le16(0x01); /* Other */
 
     if (tbl_len == SMBIOS_TYPE_4_LEN_V30) {
-        t->core_count2 = t->core_enabled2 = cpu_to_le16(ms->smp.cores);
+        t->core_count2 = t->core_enabled2 = cpu_to_le16(cores_per_socket);
         t->thread_count2 = cpu_to_le16(threads_per_socket);
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:57:47 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:57:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814130.1227278 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTRz-0005zu-LR; Wed, 09 Oct 2024 09:57:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814130.1227278; Wed, 09 Oct 2024 09:57: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 1syTRz-0005zm-Im; Wed, 09 Oct 2024 09:57:47 +0000
Received: by outflank-mailman (input) for mailman id 814130;
 Wed, 09 Oct 2024 09:57: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 1syTRy-0005xX-G3
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:57: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 1syTRy-00061P-FO
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:57:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTRy-00065F-Ec
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:57: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=G+Eqr4X1HecP6Id/wgItaj9Q6D5wLDfIB275tZanuiE=; b=BTwdVMSCc8/WFUgoI6Gz0biD9x
	Fve05gaUDi6dbSCMyAI2THROhH5aAL6yTSDe7B7vn9Q9REN+21Elxoz/GWhXZptfDg7Y4y+h5dMYr
	4MYNZ3rvbRf5JysFpDDXkvEiPjUUpGUgKkfQ2E/qRsDApldpGl31TvW+aIf/OoR1Q35s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/i2c: Fix bitbang_i2c_data trace event
Message-Id: <E1syTRy-00065F-Ec@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:57:46 +0000

commit 07b7ec0af04711f62c7c274d1440d10efb936ede
Author:     BALATON Zoltan <balaton@eik.bme.hu>
AuthorDate: Fri Jul 28 02:45:24 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/i2c: Fix bitbang_i2c_data trace event
    
    The clock and data values were logged swapped. Correct the trace event
    text to match what is logged. Also fix a typo in a comment nearby.
    
    Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (cherry picked from commit 8ada214a902225c90583b644cabd85bc89bf188c)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/i2c/bitbang_i2c.c | 2 +-
 hw/i2c/trace-events  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c
index bb18954765..de5f5aacf5 100644
--- a/hw/i2c/bitbang_i2c.c
+++ b/hw/i2c/bitbang_i2c.c
@@ -70,7 +70,7 @@ static int bitbang_i2c_ret(bitbang_i2c_interface *i2c, int level)
     return level & i2c->last_data;
 }
 
-/* Leave device data pin unodified.  */
+/* Leave device data pin unmodified.  */
 static int bitbang_i2c_nop(bitbang_i2c_interface *i2c)
 {
     return bitbang_i2c_ret(i2c, i2c->device_out);
diff --git a/hw/i2c/trace-events b/hw/i2c/trace-events
index 8e88aa24c1..d7b1e25858 100644
--- a/hw/i2c/trace-events
+++ b/hw/i2c/trace-events
@@ -5,7 +5,7 @@ bitbang_i2c_state(const char *old_state, const char *new_state) "state %s -> %s"
 bitbang_i2c_addr(uint8_t addr) "Address 0x%02x"
 bitbang_i2c_send(uint8_t byte) "TX byte 0x%02x"
 bitbang_i2c_recv(uint8_t byte) "RX byte 0x%02x"
-bitbang_i2c_data(unsigned dat, unsigned clk, unsigned old_out, unsigned new_out) "dat %u clk %u out %u -> %u"
+bitbang_i2c_data(unsigned clk, unsigned dat, unsigned old_out, unsigned new_out) "clk %u dat %u out %u -> %u"
 
 # core.c
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:57:57 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:57:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814131.1227284 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTS9-00066h-OG; Wed, 09 Oct 2024 09:57:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814131.1227284; Wed, 09 Oct 2024 09:57: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 1syTS9-00066Z-KD; Wed, 09 Oct 2024 09:57:57 +0000
Received: by outflank-mailman (input) for mailman id 814131;
 Wed, 09 Oct 2024 09:57: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 1syTS8-00066I-J0
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:57: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 1syTS8-00061W-IL
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:57:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTS8-00065s-Hf
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:57: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=5FhmTxs2X4I3WYzmS+HioS10uT9AC+Vhn1C5H6rMLLI=; b=ihTZ8Aj0Wn95FP0xIQ71G5OLRd
	RPabW+B5IVPlLzyUfjYQMDFqXyWrp/G8yOIn7wVK5BKVa3UZtDm837Wm3l9EgSmpP3Ay3mdgtEn91
	zmv1dFHh5LukS+d/8CawZeXWghsMqdH9qlfksNDzi45yOpCfHIDFfb8NxeDVYVmSy5JA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] dump: kdump-zlib data pages not dumped with pvtime/aarch64
Message-Id: <E1syTS8-00065s-Hf@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:57:56 +0000

commit a11a2007a50d6d2b8e57605fc2ec40b9f962df13
Author:     Dongli Zhang <dongli.zhang@oracle.com>
AuthorDate: Wed Jul 12 22:58:19 2023 -0700
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    dump: kdump-zlib data pages not dumped with pvtime/aarch64
    
    The kdump-zlib data pages are not dumped from aarch64 host when the
    'pvtime' is involved, that is, when the block->target_end is not aligned to
    page_size. In the below example, it is expected to dump two blocks.
    
    (qemu) info mtree -f
    ... ...
      00000000090a0000-00000000090a0fff (prio 0, ram): pvtime KVM
    ... ...
      0000000040000000-00000001bfffffff (prio 0, ram): mach-virt.ram KVM
    ... ...
    
    However, there is an issue with get_next_page() so that the pages for
    "mach-virt.ram" will not be dumped.
    
    At line 1296, although we have reached at the end of the 'pvtime' block,
    since it is not aligned to the page_size (e.g., 0x10000), it will not break
    at line 1298.
    
    1255 static bool get_next_page(GuestPhysBlock **blockptr, uint64_t *pfnptr,
    1256                           uint8_t **bufptr, DumpState *s)
    ... ...
    1294             memcpy(buf + addr % page_size, hbuf, n);
    1295             addr += n;
    1296             if (addr % page_size == 0) {
    1297                 /* we filled up the page */
    1298                 break;
    1299             }
    
    As a result, get_next_page() will continue to the next
    block ("mach-virt.ram"). Finally, when get_next_page() returns to the
    caller:
    
    - 'pfnptr' is referring to the 'pvtime'
    - but 'blockptr' is referring to the "mach-virt.ram"
    
    When get_next_page() is called the next time, "*pfnptr += 1" still refers
    to the prior 'pvtime'. It will exit immediately because it is out of the
    range of the current "mach-virt.ram".
    
    The fix is to break when it is time to come to the next block, so that both
    'pfnptr' and 'blockptr' refer to the same block.
    
    Fixes: 94d788408d2d ("dump: fix kdump to work over non-aligned blocks")
    Cc: Joe Jin <joe.jin@oracle.com>
    Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Message-ID: <20230713055819.30497-1-dongli.zhang@oracle.com>
    (cherry picked from commit 8a64609eea8cb2bac015968c4b62da5bce266e22)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 dump/dump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dump/dump.c b/dump/dump.c
index 1f1a6edcab..d4ef713cd0 100644
--- a/dump/dump.c
+++ b/dump/dump.c
@@ -1293,8 +1293,8 @@ static bool get_next_page(GuestPhysBlock **blockptr, uint64_t *pfnptr,
 
             memcpy(buf + addr % page_size, hbuf, n);
             addr += n;
-            if (addr % page_size == 0) {
-                /* we filled up the page */
+            if (addr % page_size == 0 || addr >= block->target_end) {
+                /* we filled up the page or the current block is finished */
                 break;
             }
         } else {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:58:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:58:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814132.1227288 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTSJ-0006Ej-Oi; Wed, 09 Oct 2024 09:58:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814132.1227288; Wed, 09 Oct 2024 09:58: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 1syTSJ-0006Eb-Lf; Wed, 09 Oct 2024 09:58:07 +0000
Received: by outflank-mailman (input) for mailman id 814132;
 Wed, 09 Oct 2024 09:58: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 1syTSI-0006A5-MC
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:58: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 1syTSI-00061q-Ld
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:58:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTSI-000679-Kv
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:58: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=GYX9f7PtWaJCF65gef8arC239ZlUjuina8AvTgchJ3U=; b=qB+c7q2jCoL0/0+eChNRApRZ7W
	/dPn+wGffeqtVMbbAk3e7fePRzJCsXaCM5RMBKscRho8uuW974rAl0/+c181s+xwQDUWYkmTE44+8
	Yq+9lqmj034sMF1W7Ed1E1tJuYsfej+9tmkGgbztPHhvMSwtivWOxDxjxCR3WlWP3wMU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/nvme: fix oob memory read in fdp events log
Message-Id: <E1syTSI-000679-Kv@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:58:06 +0000

commit dd496f92b97a9a2d36f83a91d8adae90ba65465a
Author:     Klaus Jensen <k.jensen@samsung.com>
AuthorDate: Thu Aug 3 20:44:23 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/nvme: fix oob memory read in fdp events log
    
    As reported by Trend Micro's Zero Day Initiative, an oob memory read
    vulnerability exists in nvme_fdp_events(). The host-provided offset is
    not verified.
    
    Fix this.
    
    This is only exploitable when Flexible Data Placement mode (fdp=on) is
    enabled.
    
    Fixes: CVE-2023-4135
    Fixes: 73064edfb864 ("hw/nvme: flexible data placement emulation")
    Reported-by: Trend Micro's Zero Day Initiative
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
    (cherry picked from commit ecb1b7b082d3b7dceff0e486a114502fc52c0fdf)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/nvme/ctrl.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 812246689c..e16e19ead8 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -5092,6 +5092,11 @@ static uint16_t nvme_fdp_events(NvmeCtrl *n, uint32_t endgrpid,
     }
 
     log_size = sizeof(NvmeFdpEventsLog) + ebuf->nelems * sizeof(NvmeFdpEvent);
+
+    if (off >= log_size) {
+        return NVME_INVALID_FIELD | NVME_DNR;
+    }
+
     trans_len = MIN(log_size - off, buf_len);
     elog = g_malloc0(log_size);
     elog->num_events = cpu_to_le32(ebuf->nelems);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:58:17 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:58:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814133.1227291 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTST-0006KJ-Q1; Wed, 09 Oct 2024 09:58:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814133.1227291; Wed, 09 Oct 2024 09:58: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 1syTST-0006K9-N7; Wed, 09 Oct 2024 09:58:17 +0000
Received: by outflank-mailman (input) for mailman id 814133;
 Wed, 09 Oct 2024 09:58: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 1syTSS-0006K0-Pd
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:58: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 1syTSS-00061y-Oz
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:58:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTSS-00067v-OH
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:58: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=wS4I5NctIIO9QQ+EMZJzq9958c+pK8ST9/1CoKtp+R0=; b=qhAnrIpgt7M+Y76VZhuxH5RN3P
	e1dNwYO0JNHuCP9KrwYFWvpJ8vjJtMxw6lpxmDGC6UUXEfmUJn0/lNqF0iZwGbGZcPFg94Jeodxpc
	EvlOT+4qeqN7JmFy+tAykFZN8jSFa267RzPOC2De0EuynJqfKFQq1DXm1JeZzmulb/dc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/nvme: fix compliance issue wrt. iosqes/iocqes
Message-Id: <E1syTSS-00067v-OH@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:58:16 +0000

commit cbd3c5db76f0c91ec092692b3ace2727403e4954
Author:     Klaus Jensen <k.jensen@samsung.com>
AuthorDate: Wed Jul 19 20:21:58 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/nvme: fix compliance issue wrt. iosqes/iocqes
    
    As of prior to this patch, the controller checks the value of CC.IOCQES
    and CC.IOSQES prior to enabling the controller. As reported by Ben in
    GitLab issue #1691, this is not spec compliant. The controller should
    only check these values when queues are created.
    
    This patch moves these checks to nvme_create_cq(). We do not need to
    check it in nvme_create_sq() since that will error out if the completion
    queue is not already created.
    
    Also, since the controller exclusively supports SQEs of size 64 bytes
    and CQEs of size 16 bytes, hard code that.
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1691
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
    (cherry picked from commit 6a33f2e920ec0b489a77200888e3692664077f2d)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/nvme/ctrl.c       | 46 ++++++++++++----------------------------------
 hw/nvme/nvme.h       |  9 +++++++--
 hw/nvme/trace-events |  1 +
 3 files changed, 20 insertions(+), 36 deletions(-)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index e16e19ead8..00b910ca9e 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -1504,7 +1504,7 @@ static void nvme_post_cqes(void *opaque)
         req->cqe.status = cpu_to_le16((req->status << 1) | cq->phase);
         req->cqe.sq_id = cpu_to_le16(sq->sqid);
         req->cqe.sq_head = cpu_to_le16(sq->head);
-        addr = cq->dma_addr + cq->tail * n->cqe_size;
+        addr = cq->dma_addr + (cq->tail << NVME_CQES);
         ret = pci_dma_write(PCI_DEVICE(n), addr, (void *)&req->cqe,
                             sizeof(req->cqe));
         if (ret) {
@@ -5272,10 +5272,18 @@ static uint16_t nvme_create_cq(NvmeCtrl *n, NvmeRequest *req)
     uint16_t qsize = le16_to_cpu(c->qsize);
     uint16_t qflags = le16_to_cpu(c->cq_flags);
     uint64_t prp1 = le64_to_cpu(c->prp1);
+    uint32_t cc = ldq_le_p(&n->bar.cc);
+    uint8_t iocqes = NVME_CC_IOCQES(cc);
+    uint8_t iosqes = NVME_CC_IOSQES(cc);
 
     trace_pci_nvme_create_cq(prp1, cqid, vector, qsize, qflags,
                              NVME_CQ_FLAGS_IEN(qflags) != 0);
 
+    if (iosqes != NVME_SQES || iocqes != NVME_CQES) {
+        trace_pci_nvme_err_invalid_create_cq_entry_size(iosqes, iocqes);
+        return NVME_MAX_QSIZE_EXCEEDED | NVME_DNR;
+    }
+
     if (unlikely(!cqid || cqid > n->conf_ioqpairs || n->cq[cqid] != NULL)) {
         trace_pci_nvme_err_invalid_create_cq_cqid(cqid);
         return NVME_INVALID_QID | NVME_DNR;
@@ -6981,7 +6989,7 @@ static void nvme_process_sq(void *opaque)
     }
 
     while (!(nvme_sq_empty(sq) || QTAILQ_EMPTY(&sq->req_list))) {
-        addr = sq->dma_addr + sq->head * n->sqe_size;
+        addr = sq->dma_addr + (sq->head << NVME_SQES);
         if (nvme_addr_read(n, addr, (void *)&cmd, sizeof(cmd))) {
             trace_pci_nvme_err_addr_read(addr);
             trace_pci_nvme_err_cfs();
@@ -7208,34 +7216,6 @@ static int nvme_start_ctrl(NvmeCtrl *n)
                     NVME_CAP_MPSMAX(cap));
         return -1;
     }
-    if (unlikely(NVME_CC_IOCQES(cc) <
-                 NVME_CTRL_CQES_MIN(n->id_ctrl.cqes))) {
-        trace_pci_nvme_err_startfail_cqent_too_small(
-                    NVME_CC_IOCQES(cc),
-                    NVME_CTRL_CQES_MIN(cap));
-        return -1;
-    }
-    if (unlikely(NVME_CC_IOCQES(cc) >
-                 NVME_CTRL_CQES_MAX(n->id_ctrl.cqes))) {
-        trace_pci_nvme_err_startfail_cqent_too_large(
-                    NVME_CC_IOCQES(cc),
-                    NVME_CTRL_CQES_MAX(cap));
-        return -1;
-    }
-    if (unlikely(NVME_CC_IOSQES(cc) <
-                 NVME_CTRL_SQES_MIN(n->id_ctrl.sqes))) {
-        trace_pci_nvme_err_startfail_sqent_too_small(
-                    NVME_CC_IOSQES(cc),
-                    NVME_CTRL_SQES_MIN(cap));
-        return -1;
-    }
-    if (unlikely(NVME_CC_IOSQES(cc) >
-                 NVME_CTRL_SQES_MAX(n->id_ctrl.sqes))) {
-        trace_pci_nvme_err_startfail_sqent_too_large(
-                    NVME_CC_IOSQES(cc),
-                    NVME_CTRL_SQES_MAX(cap));
-        return -1;
-    }
     if (unlikely(!NVME_AQA_ASQS(aqa))) {
         trace_pci_nvme_err_startfail_asqent_sz_zero();
         return -1;
@@ -7248,8 +7228,6 @@ static int nvme_start_ctrl(NvmeCtrl *n)
     n->page_bits = page_bits;
     n->page_size = page_size;
     n->max_prp_ents = n->page_size / sizeof(uint64_t);
-    n->cqe_size = 1 << NVME_CC_IOCQES(cc);
-    n->sqe_size = 1 << NVME_CC_IOSQES(cc);
     nvme_init_cq(&n->admin_cq, n, acq, 0, 0, NVME_AQA_ACQS(aqa) + 1, 1);
     nvme_init_sq(&n->admin_sq, n, asq, 0, 0, NVME_AQA_ASQS(aqa) + 1);
 
@@ -8221,8 +8199,8 @@ static void nvme_init_ctrl(NvmeCtrl *n, PCIDevice *pci_dev)
     id->wctemp = cpu_to_le16(NVME_TEMPERATURE_WARNING);
     id->cctemp = cpu_to_le16(NVME_TEMPERATURE_CRITICAL);
 
-    id->sqes = (0x6 << 4) | 0x6;
-    id->cqes = (0x4 << 4) | 0x4;
+    id->sqes = (NVME_SQES << 4) | NVME_SQES;
+    id->cqes = (NVME_CQES << 4) | NVME_CQES;
     id->nn = cpu_to_le32(NVME_MAX_NAMESPACES);
     id->oncs = cpu_to_le16(NVME_ONCS_WRITE_ZEROES | NVME_ONCS_TIMESTAMP |
                            NVME_ONCS_FEATURES | NVME_ONCS_DSM |
diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h
index 209e8f5b4c..5f2ae7b28b 100644
--- a/hw/nvme/nvme.h
+++ b/hw/nvme/nvme.h
@@ -30,6 +30,13 @@
 #define NVME_FDP_MAX_EVENTS 63
 #define NVME_FDP_MAXPIDS 128
 
+/*
+ * The controller only supports Submission and Completion Queue Entry Sizes of
+ * 64 and 16 bytes respectively.
+ */
+#define NVME_SQES 6
+#define NVME_CQES 4
+
 QEMU_BUILD_BUG_ON(NVME_MAX_NAMESPACES > NVME_NSID_BROADCAST - 1);
 
 typedef struct NvmeCtrl NvmeCtrl;
@@ -530,8 +537,6 @@ typedef struct NvmeCtrl {
     uint32_t    page_size;
     uint16_t    page_bits;
     uint16_t    max_prp_ents;
-    uint16_t    cqe_size;
-    uint16_t    sqe_size;
     uint32_t    max_q_ents;
     uint8_t     outstanding_aers;
     uint32_t    irq_status;
diff --git a/hw/nvme/trace-events b/hw/nvme/trace-events
index 7f7837e1a2..75083e992d 100644
--- a/hw/nvme/trace-events
+++ b/hw/nvme/trace-events
@@ -168,6 +168,7 @@ pci_nvme_err_invalid_create_cq_size(uint16_t size) "failed creating completion q
 pci_nvme_err_invalid_create_cq_addr(uint64_t addr) "failed creating completion queue, addr=0x%"PRIx64""
 pci_nvme_err_invalid_create_cq_vector(uint16_t vector) "failed creating completion queue, vector=%"PRIu16""
 pci_nvme_err_invalid_create_cq_qflags(uint16_t qflags) "failed creating completion queue, qflags=%"PRIu16""
+pci_nvme_err_invalid_create_cq_entry_size(uint8_t iosqes, uint8_t iocqes) "iosqes %"PRIu8" iocqes %"PRIu8""
 pci_nvme_err_invalid_identify_cns(uint16_t cns) "identify, invalid cns=0x%"PRIx16""
 pci_nvme_err_invalid_getfeat(int dw10) "invalid get features, dw10=0x%"PRIx32""
 pci_nvme_err_invalid_setfeat(uint32_t dw10) "invalid set features, dw10=0x%"PRIx32""
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:58:27 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:58:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814134.1227294 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTSd-0006Oy-SJ; Wed, 09 Oct 2024 09:58:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814134.1227294; Wed, 09 Oct 2024 09:58: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 1syTSd-0006Oq-Ps; Wed, 09 Oct 2024 09:58:27 +0000
Received: by outflank-mailman (input) for mailman id 814134;
 Wed, 09 Oct 2024 09:58: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 1syTSc-0006Od-Sd
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:58: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 1syTSc-000626-S5
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:58:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTSc-00069V-RC
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:58: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=L2R4mJm6Dcig7z8R3wvoecz2L7GhLZHlEYh6K/5iWHg=; b=O41HbENQgKO+yPsL9z0bxz9Vqu
	1tNVMZfVjpUAWMFYo2d0h9C7CwL0GVPcW7vLtVWoLZCDp08QJlsAPfp3X7ulYBceu74j4pJo6deG7
	VHZwDYFKGMa3ayEQjQbg3sIV165ZvJ+s17LrN4NS4tlqLurio4y2oo9MhyIu65I+Pff0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/nvme: fix CRC64 for guard tag
Message-Id: <E1syTSc-00069V-RC@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:58:26 +0000

commit f47369c3d114ddd2021d9ca2cdde9fe138675bcb
Author:     Ankit Kumar <ankit.kumar@samsung.com>
AuthorDate: Tue Aug 8 02:57:43 2023 +0530
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/nvme: fix CRC64 for guard tag
    
    The nvme CRC64 generator expects the caller to pass inverted seed value.
    Pass inverted crc value for metadata buffer.
    
    Cc: qemu-stable@nongnu.org
    Fixes: 44219b6029fc ("hw/nvme: 64-bit pi support")
    Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
    (cherry picked from commit dbdb13f931d7cf2d3c3ca662e751bb1551e9eab6)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/nvme/dif.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/nvme/dif.c b/hw/nvme/dif.c
index 63c44c86ab..01b19c3373 100644
--- a/hw/nvme/dif.c
+++ b/hw/nvme/dif.c
@@ -115,7 +115,7 @@ static void nvme_dif_pract_generate_dif_crc64(NvmeNamespace *ns, uint8_t *buf,
         uint64_t crc = crc64_nvme(~0ULL, buf, ns->lbasz);
 
         if (pil) {
-            crc = crc64_nvme(crc, mbuf, pil);
+            crc = crc64_nvme(~crc, mbuf, pil);
         }
 
         dif->g64.guard = cpu_to_be64(crc);
@@ -246,7 +246,7 @@ static uint16_t nvme_dif_prchk_crc64(NvmeNamespace *ns, NvmeDifTuple *dif,
         uint64_t crc = crc64_nvme(~0ULL, buf, ns->lbasz);
 
         if (pil) {
-            crc = crc64_nvme(crc, mbuf, pil);
+            crc = crc64_nvme(~crc, mbuf, pil);
         }
 
         trace_pci_nvme_dif_prchk_guard_crc64(be64_to_cpu(dif->g64.guard), crc);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:58:37 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:58:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814135.1227299 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTSn-0006Wc-Tp; Wed, 09 Oct 2024 09:58:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814135.1227299; Wed, 09 Oct 2024 09:58: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 1syTSn-0006WU-RG; Wed, 09 Oct 2024 09:58:37 +0000
Received: by outflank-mailman (input) for mailman id 814135;
 Wed, 09 Oct 2024 09:58:37 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTSm-0006WF-Vz
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:58: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 1syTSm-00062U-VK
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:58:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTSm-0006B0-Ud
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:58: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=g8SUNC1B5pG80mDIhPIJySsH7MGX6NUxvz71IE7erjw=; b=v7LwktCTyucvFNzEkVZqCUtMo6
	PtzvyhA3WHsmlbx/bHi55z2IIPDvpoByDc3ChWbOEi0v5r4CKJhdyqTwoaXKFa5F4jCeAneoSXo8a
	6Hoob2xm/HiL6fk1I5X6zUNgMgg9SqmrYOd/FENs4TGUfbn6jMiKFySOfMeCohTe5bLg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/nvme: fix null pointer access in directive receive
Message-Id: <E1syTSm-0006B0-Ud@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:58:36 +0000

commit 43328764f7a0c4371f0142a8cee6dcdbeecfa633
Author:     Klaus Jensen <k.jensen@samsung.com>
AuthorDate: Tue Aug 8 17:16:13 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/nvme: fix null pointer access in directive receive
    
    nvme_directive_receive() does not check if an endurance group has been
    configured (set) prior to testing if flexible data placement is enabled
    or not.
    
    Fix this.
    
    Cc: qemu-stable@nongnu.org
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1815
    Fixes: 73064edfb864 ("hw/nvme: flexible data placement emulation")
    Reviewed-by: Jesper Wendel Devantier <j.devantier@samsung.com>
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
    (cherry picked from commit 6c8f8456cb0b239812dee5211881426496da7b98)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/nvme/ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 00b910ca9e..ac505727e5 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -6877,7 +6877,7 @@ static uint16_t nvme_directive_receive(NvmeCtrl *n, NvmeRequest *req)
     case NVME_DIRECTIVE_IDENTIFY:
         switch (doper) {
         case NVME_DIRECTIVE_RETURN_PARAMS:
-            if (ns->endgrp->fdp.enabled) {
+            if (ns->endgrp && ns->endgrp->fdp.enabled) {
                 id.supported |= 1 << NVME_DIRECTIVE_DATA_PLACEMENT;
                 id.enabled |= 1 << NVME_DIRECTIVE_DATA_PLACEMENT;
                 id.persistent |= 1 << NVME_DIRECTIVE_DATA_PLACEMENT;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:58:48 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:58:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814136.1227303 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTSx-0006eJ-VH; Wed, 09 Oct 2024 09:58:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814136.1227303; Wed, 09 Oct 2024 09:58: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 1syTSx-0006eC-Sg; Wed, 09 Oct 2024 09:58:47 +0000
Received: by outflank-mailman (input) for mailman id 814136;
 Wed, 09 Oct 2024 09:58:47 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTSx-0006e3-2y
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:58:47 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTSx-00062b-2O
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:58:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTSx-0006Bo-1d
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:58:47 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mNz7SHkju6r3Gz8AfuQ3izmGzqpTu6v0cB3ku152ib8=; b=k4JYWUa8nr1xATuvfR+qFZ2SoO
	POT3QjkkxbZmpBN9sId52VBzfNsfe8/HdDLXjIkookTHpq71RbohqL21RDwbY9QFcUsHkCYNRrbu7
	tzSFCc7yPPlDE5q3RUAKBjBMRoD4YwLOm2urHwzmUEv3sTDqbUw2wBkzOdpv+1inkfrA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/nvme: fix null pointer access in ruh update
Message-Id: <E1syTSx-0006Bo-1d@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:58:47 +0000

commit bb5f9036d5f6914215c75e19048444b2ce06b190
Author:     Klaus Jensen <k.jensen@samsung.com>
AuthorDate: Tue Aug 8 17:16:14 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/nvme: fix null pointer access in ruh update
    
    The Reclaim Unit Update operation in I/O Management Receive does not
    verify the presence of a configured endurance group prior to accessing
    it.
    
    Fix this.
    
    Cc: qemu-stable@nongnu.org
    Fixes: 73064edfb864 ("hw/nvme: flexible data placement emulation")
    Reviewed-by: Jesper Wendel Devantier <j.devantier@samsung.com>
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
    (cherry picked from commit 3439ba9c5da943d96f7a3c86e0a7eb2ff48de41c)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/nvme/ctrl.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index ac505727e5..c71d57d17a 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -4333,7 +4333,13 @@ static uint16_t nvme_io_mgmt_send_ruh_update(NvmeCtrl *n, NvmeRequest *req)
     uint32_t npid = (cdw10 >> 1) + 1;
     unsigned int i = 0;
     g_autofree uint16_t *pids = NULL;
-    uint32_t maxnpid = n->subsys->endgrp.fdp.nrg * n->subsys->endgrp.fdp.nruh;
+    uint32_t maxnpid;
+
+    if (!ns->endgrp || !ns->endgrp->fdp.enabled) {
+        return NVME_FDP_DISABLED | NVME_DNR;
+    }
+
+    maxnpid = n->subsys->endgrp.fdp.nrg * n->subsys->endgrp.fdp.nruh;
 
     if (unlikely(npid >= MIN(NVME_FDP_MAXPIDS, maxnpid))) {
         return NVME_INVALID_FIELD | NVME_DNR;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:58:59 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:58:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814137.1227307 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTT9-0006iK-0e; Wed, 09 Oct 2024 09:58:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814137.1227307; Wed, 09 Oct 2024 09:58:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTT8-0006iC-UE; Wed, 09 Oct 2024 09:58:58 +0000
Received: by outflank-mailman (input) for mailman id 814137;
 Wed, 09 Oct 2024 09:58:57 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTT7-0006hw-6A
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:58:57 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTT7-00062i-5V
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:58:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTT7-0006Cd-4n
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:58:57 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jsx7b3Re/q/rbC7rBOE//IjndgMKuaOOMyM+P5bJA5g=; b=Tl9a7ajtMjQfEov2qA5Gh6aTNV
	oHtsH0UJJ7jvfn2PCfwjjCfjRSNuf8An3qWNxqVRfKUbqninKV6712cr+hu8rukiAc3pWRKmCHFd8
	fArzz13MPyOwbpOs1gfSJwbMOpbdboDrKfznWquEUkdyKPWkV2JFZro3ZcBRQhNXFaa0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] linux-user/elfload: Set V in ELF_HWCAP for RISC-V
Message-Id: <E1syTT7-0006Cd-4n@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:58:57 +0000

commit ee638bc5b53cff87768b0b7c6d2c4a4e275994f6
Author:     Nathan Egge <negge@xiph.org>
AuthorDate: Thu Aug 3 09:14:24 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    linux-user/elfload: Set V in ELF_HWCAP for RISC-V
    
    Set V bit for hwcap if misa is set.
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1793
    Signed-off-by: Nathan Egge <negge@xiph.org>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Message-Id: <20230803131424.40744-1-negge@xiph.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    (cherry picked from commit 4333f0924c2f2ca8efaebaed8c24f55f77d8b013)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 linux-user/elfload.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 88ef26dc03..a3e78a7e18 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -1679,7 +1679,8 @@ static uint32_t get_elf_hwcap(void)
 #define MISA_BIT(EXT) (1 << (EXT - 'A'))
     RISCVCPU *cpu = RISCV_CPU(thread_cpu);
     uint32_t mask = MISA_BIT('I') | MISA_BIT('M') | MISA_BIT('A')
-                    | MISA_BIT('F') | MISA_BIT('D') | MISA_BIT('C');
+                    | MISA_BIT('F') | MISA_BIT('D') | MISA_BIT('C')
+                    | MISA_BIT('V');
 
     return cpu->env.misa_ext & mask;
 #undef MISA_BIT
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:59:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:59:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814138.1227310 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTTJ-0006uB-1r; Wed, 09 Oct 2024 09:59:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814138.1227310; Wed, 09 Oct 2024 09:59:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTTI-0006u4-Vk; Wed, 09 Oct 2024 09:59:08 +0000
Received: by outflank-mailman (input) for mailman id 814138;
 Wed, 09 Oct 2024 09:59:07 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTTH-0006tw-94
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:59:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTTH-000634-8P
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:59:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTTH-0006Dm-7i
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:59:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XExg/hlqigXOfS7HyNlOaFxx9fkAQBwrDxm9dwxK/ME=; b=5e8GInWFpkINHTBF2FGXG+RGzV
	nVdWo29s6CJsOaKibGTTL0Qj6GdXFPgxqUh8TdY3LTPBCcup3SQkgWRyMrv6Pxaeh6/ruLGvrmn32
	NWZOV3T1M6wCNbWT30zgb+/jf9Ice9JfH+1840zUgaKjNkKcR06rnhPYg37ukIxF2I8s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for microblaze
Message-Id: <E1syTTH-0006Dm-7i@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:59:07 +0000

commit 43d2db492878f7931457d6d4d9097f9573917c6d
Author:     Richard Henderson <richard.henderson@linaro.org>
AuthorDate: Sat Jun 3 14:55:03 2023 -0700
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for microblaze
    
    Based on gcc's microblaze.h setting BIGGEST_ALIGNMENT to 32 bits.
    
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    (cherry picked from commit e73f27003e777fd9b77d13e71c5268015b8ed2b6)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 include/exec/user/abitypes.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/exec/user/abitypes.h b/include/exec/user/abitypes.h
index 743b8bb9ea..beba0a48c7 100644
--- a/include/exec/user/abitypes.h
+++ b/include/exec/user/abitypes.h
@@ -15,7 +15,9 @@
 #define ABI_LLONG_ALIGNMENT 2
 #endif
 
-#if (defined(TARGET_I386) && !defined(TARGET_X86_64)) || defined(TARGET_SH4)
+#if (defined(TARGET_I386) && !defined(TARGET_X86_64)) \
+    || defined(TARGET_SH4) \
+    || defined(TARGET_MICROBLAZE)
 #define ABI_LLONG_ALIGNMENT 4
 #endif
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:59:19 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:59:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814139.1227315 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTTT-0006zS-3G; Wed, 09 Oct 2024 09:59:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814139.1227315; Wed, 09 Oct 2024 09:59:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTTT-0006zK-0p; Wed, 09 Oct 2024 09:59:19 +0000
Received: by outflank-mailman (input) for mailman id 814139;
 Wed, 09 Oct 2024 09:59:17 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTTR-0006yv-Bz
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:59:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTTR-00063C-BN
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:59:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTTR-0006Ej-Ae
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:59:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VV1+WcEjmgd+ZrSTRFTr1t5IOj6gGccVV3EJeS+JVWg=; b=2UjFAsAmlTpE5gZ9IQNKR4Kiwh
	M7JSWKv0Ny6/RoEfMebM24WAS4R9S+X3gvdZq+gd1uG7TASq/14AL1fYj85HSmrMybsWAukt6/n12
	pTwggnGs4JuAf5/4+bfP1JfIYaq37jjb1Q/zANBfuu3NjX16l1JbIiRW3HS41VHXJBzs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for nios2
Message-Id: <E1syTTR-0006Ej-Ae@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:59:17 +0000

commit 40cfe12cb6f8b9d3a1172af2e65540773ad17be1
Author:     Richard Henderson <richard.henderson@linaro.org>
AuthorDate: Sat Jun 3 14:58:46 2023 -0700
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for nios2
    
    Based on gcc's nios2.h setting BIGGEST_ALIGNMENT to 32 bits.
    
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    (cherry picked from commit ea9812d93f9c3e1a308ac33097021c50d581d10e)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 include/exec/user/abitypes.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/exec/user/abitypes.h b/include/exec/user/abitypes.h
index beba0a48c7..6191ce9f74 100644
--- a/include/exec/user/abitypes.h
+++ b/include/exec/user/abitypes.h
@@ -17,7 +17,8 @@
 
 #if (defined(TARGET_I386) && !defined(TARGET_X86_64)) \
     || defined(TARGET_SH4) \
-    || defined(TARGET_MICROBLAZE)
+    || defined(TARGET_MICROBLAZE) \
+    || defined(TARGET_NIOS2)
 #define ABI_LLONG_ALIGNMENT 4
 #endif
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:59:29 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:59:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814140.1227320 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTTd-00073F-5T; Wed, 09 Oct 2024 09:59:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814140.1227320; Wed, 09 Oct 2024 09:59:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTTd-000737-2O; Wed, 09 Oct 2024 09:59:29 +0000
Received: by outflank-mailman (input) for mailman id 814140;
 Wed, 09 Oct 2024 09:59:27 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTTb-00072x-Ey
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:59:27 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTTb-00063M-EK
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:59:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTTb-0006FR-Da
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:59:27 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NeSFzKbgUTPv/7/FAnEBhSqdN/lI0VoGoJImUUm3IfQ=; b=3KZ8Qk8lawfWthl9YzyzBHajpX
	tPFxZRLqlaw/hBamtmZerZgR68bpXujEzI+zmtg9QD4YFbaJkaCI8AN5Cw1EoM2tjI+5/op0OMjis
	7H4PPfc20yutvNppp5Nbr+UhaFv71zKJ4wNZNAOI3BxLW/aZAFgMwSICxmk6Ic2Yd5Wk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] Fixed incorrect LLONG alignment for openrisc and cris
Message-Id: <E1syTTb-0006FR-Da@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:59:27 +0000

commit af0c16fae9532033453f8c208ad1e2e78701de5c
Author:     Luca Bonissi <qemu@bonslack.org>
AuthorDate: Thu Aug 3 02:15:57 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    Fixed incorrect LLONG alignment for openrisc and cris
    
    OpenRISC (or1k) has long long alignment to 4 bytes, but currently not
    defined in abitypes.h. This lead to incorrect packing of /epoll_event/
    structure and eventually infinite loop while waiting for file
    descriptor[s] event[s].
    
    Fixed also CRIS alignments (1 byte for all types).
    
    Signed-off-by: Luca Bonissi <qemu@bonslack.org>
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1770
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (cherry picked from commit 6ee960823da8fd780ae9912c4327b7e85e80d846)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 include/exec/user/abitypes.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/exec/user/abitypes.h b/include/exec/user/abitypes.h
index 6191ce9f74..6178453d94 100644
--- a/include/exec/user/abitypes.h
+++ b/include/exec/user/abitypes.h
@@ -15,8 +15,16 @@
 #define ABI_LLONG_ALIGNMENT 2
 #endif
 
+#ifdef TARGET_CRIS
+#define ABI_SHORT_ALIGNMENT 1
+#define ABI_INT_ALIGNMENT 1
+#define ABI_LONG_ALIGNMENT 1
+#define ABI_LLONG_ALIGNMENT 1
+#endif
+
 #if (defined(TARGET_I386) && !defined(TARGET_X86_64)) \
     || defined(TARGET_SH4) \
+    || defined(TARGET_OPENRISC) \
     || defined(TARGET_MICROBLAZE) \
     || defined(TARGET_NIOS2)
 #define ABI_LLONG_ALIGNMENT 4
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:59:39 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:59:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814141.1227323 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTTn-00077t-6K; Wed, 09 Oct 2024 09:59:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814141.1227323; Wed, 09 Oct 2024 09:59:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTTn-00077m-3k; Wed, 09 Oct 2024 09:59:39 +0000
Received: by outflank-mailman (input) for mailman id 814141;
 Wed, 09 Oct 2024 09:59:37 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTTl-00077Z-Hv
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:59:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTTl-00063r-HM
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:59:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTTl-0006GR-Gf
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:59:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZTWQFcFS6G3KK+ICgWF3tcadjAC7JDIyfeAhwZjFB28=; b=EMF00mTyQSELMOIGLrcfWLeH0v
	QQ015YqpE1LESv2ljjawncMy4iTEYU6T6vlgsGNNCKzFLW3r0vVcdgg3gYreP0rwBWlFArLhFKF5w
	r4jXHcFfGsF/I6vf+6JWCi/0oLy8qK+NLncJx3RHadXGMgXquk9ObhMVBLmOJ68rPMFY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/sd/sdhci: Do not force sdhci_mmio_*_ops onto all SD controllers
Message-Id: <E1syTTl-0006GR-Gf@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:59:37 +0000

commit b4b3aac5b542557c63bc24049b61c2640ad90dd9
Author:     Bernhard Beschow <shentey@gmail.com>
AuthorDate: Sun Jul 9 10:09:50 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/sd/sdhci: Do not force sdhci_mmio_*_ops onto all SD controllers
    
    Since commit c0a55a0c9da2 "hw/sd/sdhci: Support big endian SD host controller
    interfaces" sdhci_common_realize() forces all SD card controllers to use either
    sdhci_mmio_le_ops or sdhci_mmio_be_ops, depending on the "endianness" property.
    However, there are device models which use different MMIO ops: TYPE_IMX_USDHC
    uses usdhc_mmio_ops and TYPE_S3C_SDHCI uses sdhci_s3c_mmio_ops.
    
    Forcing sdhci_mmio_le_ops breaks SD card handling on the "sabrelite" board, for
    example. Fix this by defaulting the io_ops to little endian and switch to big
    endian in sdhci_common_realize() only if there is a matchig big endian variant
    available.
    
    Fixes: c0a55a0c9da2 ("hw/sd/sdhci: Support big endian SD host controller
    interfaces")
    
    Signed-off-by: Bernhard Beschow <shentey@gmail.com>
    Tested-by: Guenter Roeck <linux@roeck-us.net>
    Message-Id: <20230709080950.92489-1-shentey@gmail.com>
    (cherry picked from commit 3b830790151ff231531ef2595793e387dd154efb)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/sd/sdhci.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index 6811f0f1a8..362c2c86aa 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -1382,6 +1382,8 @@ void sdhci_initfn(SDHCIState *s)
 
     s->insert_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, sdhci_raise_insertion_irq, s);
     s->transfer_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, sdhci_data_transfer, s);
+
+    s->io_ops = &sdhci_mmio_le_ops;
 }
 
 void sdhci_uninitfn(SDHCIState *s)
@@ -1399,9 +1401,13 @@ void sdhci_common_realize(SDHCIState *s, Error **errp)
 
     switch (s->endianness) {
     case DEVICE_LITTLE_ENDIAN:
-        s->io_ops = &sdhci_mmio_le_ops;
+        /* s->io_ops is little endian by default */
         break;
     case DEVICE_BIG_ENDIAN:
+        if (s->io_ops != &sdhci_mmio_le_ops) {
+            error_setg(errp, "SD controller doesn't support big endianness");
+            return;
+        }
         s->io_ops = &sdhci_mmio_be_ops;
         break;
     default:
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:59:49 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:59:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814142.1227328 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTTx-0007Fu-8n; Wed, 09 Oct 2024 09:59:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814142.1227328; Wed, 09 Oct 2024 09:59:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTTx-0007Fm-5R; Wed, 09 Oct 2024 09:59:49 +0000
Received: by outflank-mailman (input) for mailman id 814142;
 Wed, 09 Oct 2024 09:59:47 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTTv-0007E7-Ko
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:59:47 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTTv-000644-KB
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:59:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTTv-0006HM-JY
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:59:47 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XSVyHmYPSy+/eV8o7jgOrtBHzJHolTIP0QThHg6rTsE=; b=0+bT5qJ3LGPzGulNbg9Dsq+nKH
	8kR/q2iJhPB0D52gbXSqUXmq6jgcy0PdY7Ml1jlt6yfEYtccXQpYwakXtz6ogWL8JTkvPzHj2wuXA
	J6jvCePL4O2T8TmXc1Vnp1BX73tTQll8AEcTZ/waJ2//+DM7FYJcsRJIJ4x02zVQQPzM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] target/s390x: Fix the "ignored match" case in VSTRS
Message-Id: <E1syTTv-0006HM-JY@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:59:47 +0000

commit 179a37924d55e645e660731f0e389d70a277a1c2
Author:     Ilya Leoshkevich <iii@linux.ibm.com>
AuthorDate: Sat Aug 5 01:03:18 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/s390x: Fix the "ignored match" case in VSTRS
    
    Currently the emulation of VSTRS recognizes partial matches in presence
    of \0 in the haystack, which, according to PoP, is not correct:
    
        If the ZS flag is one and a zero byte was detected
        in the second operand, then there can not be a
        partial match ...
    
    Add a check for this. While at it, fold a number of explicitly handled
    special cases into the generic logic.
    
    Cc: qemu-stable@nongnu.org
    Reported-by: Claudio Fontana <cfontana@suse.de>
    Closes: https://lists.gnu.org/archive/html/qemu-devel/2023-08/msg00633.html
    Fixes: 1d706f314191 ("target/s390x: vxeh2: vector string search")
    Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
    Message-Id: <20230804233748.218935-3-iii@linux.ibm.com>
    Tested-by: Claudio Fontana <cfontana@suse.de>
    Acked-by: David Hildenbrand <david@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 791b2b6a930273db694b9ba48bbb406e78715927)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/s390x/tcg/vec_string_helper.c | 54 ++++++++++++------------------------
 1 file changed, 17 insertions(+), 37 deletions(-)

diff --git a/target/s390x/tcg/vec_string_helper.c b/target/s390x/tcg/vec_string_helper.c
index 9b85becdfb..a19f429768 100644
--- a/target/s390x/tcg/vec_string_helper.c
+++ b/target/s390x/tcg/vec_string_helper.c
@@ -474,9 +474,9 @@ DEF_VSTRC_CC_RT_HELPER(32)
 static int vstrs(S390Vector *v1, const S390Vector *v2, const S390Vector *v3,
                  const S390Vector *v4, uint8_t es, bool zs)
 {
-    int substr_elen, substr_0, str_elen, i, j, k, cc;
+    int substr_elen, i, j, k, cc;
     int nelem = 16 >> es;
-    bool eos = false;
+    int str_leftmost_0;
 
     substr_elen = s390_vec_read_element8(v4, 7) >> es;
 
@@ -498,47 +498,20 @@ static int vstrs(S390Vector *v1, const S390Vector *v2, const S390Vector *v3,
     }
 
     /* If ZS, look for eos in the searched string. */
+    str_leftmost_0 = nelem;
     if (zs) {
         for (k = 0; k < nelem; k++) {
             if (s390_vec_read_element(v2, k, es) == 0) {
-                eos = true;
+                str_leftmost_0 = k;
                 break;
             }
         }
-        str_elen = k;
-    } else {
-        str_elen = nelem;
     }
 
-    substr_0 = s390_vec_read_element(v3, 0, es);
-
-    for (k = 0; ; k++) {
-        for (; k < str_elen; k++) {
-            if (s390_vec_read_element(v2, k, es) == substr_0) {
-                break;
-            }
-        }
-
-        /* If we reached the end of the string, no match. */
-        if (k == str_elen) {
-            cc = eos; /* no match (with or without zero char) */
-            goto done;
-        }
-
-        /* If the substring is only one char, match. */
-        if (substr_elen == 1) {
-            cc = 2; /* full match */
-            goto done;
-        }
-
-        /* If the match begins at the last char, we have a partial match. */
-        if (k == str_elen - 1) {
-            cc = 3; /* partial match */
-            goto done;
-        }
-
+    cc = str_leftmost_0 == nelem ? 0 : 1;  /* No match. */
+    for (k = 0; k < nelem; k++) {
         i = MIN(nelem, k + substr_elen);
-        for (j = k + 1; j < i; j++) {
+        for (j = k; j < i; j++) {
             uint32_t e2 = s390_vec_read_element(v2, j, es);
             uint32_t e3 = s390_vec_read_element(v3, j - k, es);
             if (e2 != e3) {
@@ -546,9 +519,16 @@ static int vstrs(S390Vector *v1, const S390Vector *v2, const S390Vector *v3,
             }
         }
         if (j == i) {
-            /* Matched up until "end". */
-            cc = i - k == substr_elen ? 2 : 3; /* full or partial match */
-            goto done;
+            /* All elements matched. */
+            if (k > str_leftmost_0) {
+                cc = 1;  /* Ignored match. */
+                k = nelem;
+            } else if (i - k == substr_elen) {
+                cc = 2;  /* Full match. */
+            } else {
+                cc = 3;  /* Partial match. */
+            }
+            break;
         }
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 09:59:59 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 09:59:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814143.1227330 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTU7-0007MG-BN; Wed, 09 Oct 2024 09:59:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814143.1227330; Wed, 09 Oct 2024 09:59:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTU7-0007M9-8q; Wed, 09 Oct 2024 09:59:59 +0000
Received: by outflank-mailman (input) for mailman id 814143;
 Wed, 09 Oct 2024 09:59:57 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTU5-0007Lt-Nc
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:59:57 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTU5-00064B-N4
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:59:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTU5-0006IK-MP
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 09:59:57 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=DzM42sPtdfqn6tEIsWHwLpeW/uvuaKHbfLsKH3tPRLA=; b=0kT3wLiuWm/+BQQemHIeUms6xh
	I13wOSZ+QuDin0EL4fMguFT1Ee8g5w+pb/lldn/YBzd37RgBHcXTsqlGeTlIPBPm3G6TVO71gshn5
	nGo2oPIk+gbl6mwHjs/URqcyNpdbub2zC+xwuKdxV8u8h9DkPq6NHNCGHPttFeg0hKy0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] target/s390x: Use a 16-bit immediate in VREP
Message-Id: <E1syTU5-0006IK-MP@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 09:59:57 +0000

commit 14f78932e02c15e59f3a0894a08159cd00712765
Author:     Ilya Leoshkevich <iii@linux.ibm.com>
AuthorDate: Mon Aug 7 18:34:31 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/s390x: Use a 16-bit immediate in VREP
    
    Unlike most other instructions that contain an immediate element index,
    VREP's one is 16-bit, and not 4-bit. The code uses only 8 bits, so
    using, e.g., 0x101 does not lead to a specification exception.
    
    Fix by checking all 16 bits.
    
    Cc: qemu-stable@nongnu.org
    Fixes: 28d08731b1d8 ("s390x/tcg: Implement VECTOR REPLICATE")
    Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
    Message-Id: <20230807163459.849766-1-iii@linux.ibm.com>
    Reviewed-by: David Hildenbrand <david@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 23e87d419f347b6b5f4da3bf70d222acc24cdb64)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/s390x/tcg/translate_vx.c.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/s390x/tcg/translate_vx.c.inc b/target/s390x/tcg/translate_vx.c.inc
index f8df121d3d..a6d840d406 100644
--- a/target/s390x/tcg/translate_vx.c.inc
+++ b/target/s390x/tcg/translate_vx.c.inc
@@ -57,7 +57,7 @@
 #define FPF_LONG        3
 #define FPF_EXT         4
 
-static inline bool valid_vec_element(uint8_t enr, MemOp es)
+static inline bool valid_vec_element(uint16_t enr, MemOp es)
 {
     return !(enr & ~(NUM_VEC_ELEMENTS(es) - 1));
 }
@@ -964,7 +964,7 @@ static DisasJumpType op_vpdi(DisasContext *s, DisasOps *o)
 
 static DisasJumpType op_vrep(DisasContext *s, DisasOps *o)
 {
-    const uint8_t enr = get_field(s, i2);
+    const uint16_t enr = get_field(s, i2);
     const uint8_t es = get_field(s, m4);
 
     if (es > ES_64 || !valid_vec_element(enr, es)) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:00:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:00:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814144.1227335 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTUH-0008OP-DK; Wed, 09 Oct 2024 10:00:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814144.1227335; Wed, 09 Oct 2024 10:00:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTUH-0008OI-AW; Wed, 09 Oct 2024 10:00:09 +0000
Received: by outflank-mailman (input) for mailman id 814144;
 Wed, 09 Oct 2024 10:00:07 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTUF-0008O8-SM
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:00:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTUF-0006Av-R7
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:00:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTUF-0006KO-PJ
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:00:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SKAqSUg7h26qjBX1B+ZkKI8/wOSO//3h7oUipbqWfYk=; b=eKyf7xpcvALV+K3jnIxyfMLNsb
	uZ96VMfKaXB6TJzABNWFDSW29gm+jdeIrOK4L2LGoZDLOEKj4A5iJLIUncICrnmZMG4MjQBgFesSN
	Si6NCYRoc2xVXpuDhi9mDVBG/w4rYk92sAxFHC53ifCxtSeoxtGXeuMDM2qYyMfG+zOs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] target/s390x: Fix VSTL with a large length
Message-Id: <E1syTUF-0006KO-PJ@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:00:07 +0000

commit 62ac9cbb6fe2d088dd56cd258c61b033f610fe6f
Author:     Ilya Leoshkevich <iii@linux.ibm.com>
AuthorDate: Sat Aug 5 01:55:33 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/s390x: Fix VSTL with a large length
    
    The length is always truncated to 16 bytes. Do not probe more than
    that.
    
    Cc: qemu-stable@nongnu.org
    Fixes: 0e0a5b49ad58 ("s390x/tcg: Implement VECTOR STORE WITH LENGTH")
    Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
    Message-Id: <20230804235624.263260-1-iii@linux.ibm.com>
    Reviewed-by: David Hildenbrand <david@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 6db3518ba4fcddd71049718f138552999f0d97b4)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/s390x/tcg/vec_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/s390x/tcg/vec_helper.c b/target/s390x/tcg/vec_helper.c
index 48d86722b2..dafc4c3582 100644
--- a/target/s390x/tcg/vec_helper.c
+++ b/target/s390x/tcg/vec_helper.c
@@ -193,7 +193,7 @@ void HELPER(vstl)(CPUS390XState *env, const void *v1, uint64_t addr,
                   uint64_t bytes)
 {
     /* Probe write access before actually modifying memory */
-    probe_write_access(env, addr, bytes, GETPC());
+    probe_write_access(env, addr, MIN(bytes, 16), GETPC());
 
     if (likely(bytes >= 16)) {
         cpu_stq_data_ra(env, addr, s390_vec_read_element64(v1, 0), GETPC());
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:00:21 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:00:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814145.1227339 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTUR-0008R6-Er; Wed, 09 Oct 2024 10:00:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814145.1227339; Wed, 09 Oct 2024 10:00:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTUR-0008Qy-CE; Wed, 09 Oct 2024 10:00:19 +0000
Received: by outflank-mailman (input) for mailman id 814145;
 Wed, 09 Oct 2024 10:00:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTUP-0008Qq-VC
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:00:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTUP-0006B2-UT
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:00:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTUP-0006Lu-Tf
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:00:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6h19Oi/WZblPMXSGDdLvaenr4pmAWZ5BOvODa4R8vW0=; b=iLwOAEWNOqvQKueTjZX6JOEmva
	h6Ec3UfrJz4znb09301sBq2hmqWZTBQd2fkFZyfiD0ZyEc0VdaJx9fL2nxnOz+r8BCSi+gWW7XlY4
	15fAgSs3GfYiTJKD82SIF+lSx/xQwGdFBsmH8ktYlQ241H6GVBmREX1LH1C8Hymxrxbg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] target/s390x: Check reserved bits of VFMIN/VFMAX's M5
Message-Id: <E1syTUP-0006Lu-Tf@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:00:17 +0000

commit 96fd3b85081a119353b9ef3f783c2bc8c63758a2
Author:     Ilya Leoshkevich <iii@linux.ibm.com>
AuthorDate: Sat Aug 5 01:46:10 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/s390x: Check reserved bits of VFMIN/VFMAX's M5
    
    VFMIN and VFMAX should raise a specification exceptions when bits 1-3
    of M5 are set.
    
    Cc: qemu-stable@nongnu.org
    Fixes: da4807527f3b ("s390x/tcg: Implement VECTOR FP (MAXIMUM|MINIMUM)")
    Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
    Message-Id: <20230804234621.252522-1-iii@linux.ibm.com>
    Reviewed-by: David Hildenbrand <david@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 6a2ea6151835aa4f5fee29382a421c13b0e6619f)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/s390x/tcg/translate_vx.c.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/s390x/tcg/translate_vx.c.inc b/target/s390x/tcg/translate_vx.c.inc
index a6d840d406..ec94d39df0 100644
--- a/target/s390x/tcg/translate_vx.c.inc
+++ b/target/s390x/tcg/translate_vx.c.inc
@@ -3047,7 +3047,7 @@ static DisasJumpType op_vfmax(DisasContext *s, DisasOps *o)
     const uint8_t m5 = get_field(s, m5);
     gen_helper_gvec_3_ptr *fn;
 
-    if (m6 == 5 || m6 == 6 || m6 == 7 || m6 >= 13) {
+    if (m6 == 5 || m6 == 6 || m6 == 7 || m6 >= 13 || (m5 & 7)) {
         gen_program_exception(s, PGM_SPECIFICATION);
         return DISAS_NORETURN;
     }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:00:29 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:00:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814146.1227342 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTUb-00007T-G4; Wed, 09 Oct 2024 10:00:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814146.1227342; Wed, 09 Oct 2024 10:00:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTUb-00007M-Db; Wed, 09 Oct 2024 10:00:29 +0000
Received: by outflank-mailman (input) for mailman id 814146;
 Wed, 09 Oct 2024 10:00:28 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTUa-000073-1j
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:00:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTUa-0006B9-19
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:00:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTUa-0006N8-0U
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:00:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=znxm/hOyv32svIWoh1HE8aZs6u39zspXTdEK37Qlr9M=; b=vQGJ71y1ITgutQcMYK7s6+pxIo
	D23BIHzvlmrNJ8rfFIBQVC3UiJtyBSJHOILUr8mFOxaxe68gL+NQD2kre7OD8dVIpCfHYGjKYttN0
	JARA/SOaf7ihG24AWiuiP33gyV3smcYoLaGeVAJcCbpBsWsgLt+D70G4tWbyQxtlGmUc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] include/hw/virtio/virtio-gpu: Fix virtio-gpu with blob on big endian hosts
Message-Id: <E1syTUa-0006N8-0U@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:00:28 +0000

commit f2f8e74ff4eeca352981be4c5fdb03f19e58be7d
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Tue Aug 15 14:20:07 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    include/hw/virtio/virtio-gpu: Fix virtio-gpu with blob on big endian hosts
    
    Using "-device virtio-gpu,blob=true" currently does not work on big
    endian hosts (like s390x). The guest kernel prints an error message
    like:
    
     [drm:virtio_gpu_dequeue_ctrl_func [virtio_gpu]] *ERROR* response 0x1200 (command 0x10c)
    
    and the display stays black. When running QEMU with "-d guest_errors",
    it shows an error message like this:
    
     virtio_gpu_create_mapping_iov: nr_entries is too big (83886080 > 16384)
    
    which indicates that this value has not been properly byte-swapped.
    And indeed, the virtio_gpu_create_blob_bswap() function (that should
    swap the fields in the related structure) fails to swap some of the
    entries. After correctly swapping all missing values here, too, the
    virtio-gpu device is now also working with blob=true on s390x hosts.
    
    Fixes: e0933d91b1 ("virtio-gpu: Add virtio_gpu_resource_create_blob")
    Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=2230469
    Message-Id: <20230815122007.928049-1-thuth@redhat.com>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit d194362910138776e8abd6bb3c9fb3693254e95f)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 include/hw/virtio/virtio-gpu-bswap.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/hw/virtio/virtio-gpu-bswap.h b/include/hw/virtio/virtio-gpu-bswap.h
index 9124108485..637a0585d0 100644
--- a/include/hw/virtio/virtio-gpu-bswap.h
+++ b/include/hw/virtio/virtio-gpu-bswap.h
@@ -63,7 +63,10 @@ virtio_gpu_create_blob_bswap(struct virtio_gpu_resource_create_blob *cblob)
 {
     virtio_gpu_ctrl_hdr_bswap(&cblob->hdr);
     le32_to_cpus(&cblob->resource_id);
+    le32_to_cpus(&cblob->blob_mem);
     le32_to_cpus(&cblob->blob_flags);
+    le32_to_cpus(&cblob->nr_entries);
+    le64_to_cpus(&cblob->blob_id);
     le64_to_cpus(&cblob->size);
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:00:39 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:00:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814147.1227347 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTUl-0000Cj-Hk; Wed, 09 Oct 2024 10:00:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814147.1227347; Wed, 09 Oct 2024 10:00:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTUl-0000Cb-F2; Wed, 09 Oct 2024 10:00:39 +0000
Received: by outflank-mailman (input) for mailman id 814147;
 Wed, 09 Oct 2024 10:00:38 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTUk-0000CT-5u
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:00:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTUk-0006BW-5J
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:00:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTUk-0006OK-4W
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:00:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ZpOk/PvG8vRLnysaOa/+ImxCPKgb2Fv5fscU+aVSNzc=; b=1OeDeQGsAcKK170xTcYG0hx3Ua
	uZ1lM6kVqUyaZpNVFPN0rw3IXKHN8qJXZT1Z6zwlP1WSzgVflhsz/o9E9Cc6a7ArLTMRLC0nSJbID
	n2Ip62otggU33DkITf+kq4vkHn1RpzPw6DGIEeBkvV6uxtRgVMYr7Ih9hHFLvPISXeJw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] kvm: Introduce kvm_arch_get_default_type hook
Message-Id: <E1syTUk-0006OK-4W@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:00:38 +0000

commit aa152711dbed973d7a4ecc725819d3eb280906f1
Author:     Akihiko Odaki <akihiko.odaki@daynix.com>
AuthorDate: Tue Aug 22 17:31:02 2023 +0100
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    kvm: Introduce kvm_arch_get_default_type hook
    
    kvm_arch_get_default_type() returns the default KVM type. This hook is
    particularly useful to derive a KVM type that is valid for "none"
    machine model, which is used by libvirt to probe the availability of
    KVM.
    
    For MIPS, the existing mips_kvm_type() is reused. This function ensures
    the availability of VZ which is mandatory to use KVM on the current
    QEMU.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
    Message-id: 20230727073134.134102-2-akihiko.odaki@daynix.com
    Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
    [PMM: added doc comment for new function]
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    (cherry picked from commit 5e0d65909c6f335d578b90491e165440c99adf81)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 accel/kvm/kvm-all.c      | 4 +++-
 hw/mips/loongson3_virt.c | 2 --
 include/sysemu/kvm.h     | 2 ++
 target/arm/kvm.c         | 5 +++++
 target/i386/kvm/kvm.c    | 5 +++++
 target/mips/kvm.c        | 2 +-
 target/mips/kvm_mips.h   | 9 ---------
 target/ppc/kvm.c         | 5 +++++
 target/riscv/kvm.c       | 5 +++++
 target/s390x/kvm/kvm.c   | 5 +++++
 10 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index cf3a88d90e..4c3ad74a6d 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -2382,7 +2382,7 @@ static int kvm_init(MachineState *ms)
     KVMState *s;
     const KVMCapabilityInfo *missing_cap;
     int ret;
-    int type = 0;
+    int type;
     uint64_t dirty_log_manual_caps;
 
     qemu_mutex_init(&kml_slots_lock);
@@ -2447,6 +2447,8 @@ static int kvm_init(MachineState *ms)
         type = mc->kvm_type(ms, kvm_type);
     } else if (mc->kvm_type) {
         type = mc->kvm_type(ms, NULL);
+    } else {
+        type = kvm_arch_get_default_type(ms);
     }
 
     do {
diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c
index 25534288dd..b4f6bff1b8 100644
--- a/hw/mips/loongson3_virt.c
+++ b/hw/mips/loongson3_virt.c
@@ -29,7 +29,6 @@
 #include "qemu/datadir.h"
 #include "qapi/error.h"
 #include "elf.h"
-#include "kvm_mips.h"
 #include "hw/char/serial.h"
 #include "hw/intc/loongson_liointc.h"
 #include "hw/mips/mips.h"
@@ -617,7 +616,6 @@ static void loongson3v_machine_class_init(ObjectClass *oc, void *data)
     mc->max_cpus = LOONGSON_MAX_VCPUS;
     mc->default_ram_id = "loongson3.highram";
     mc->default_ram_size = 1600 * MiB;
-    mc->kvm_type = mips_kvm_type;
     mc->minimum_page_bits = 14;
 }
 
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index c8281c07a7..e97ea915a2 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -369,6 +369,8 @@ int kvm_arch_get_registers(CPUState *cpu);
 
 int kvm_arch_put_registers(CPUState *cpu, int level);
 
+int kvm_arch_get_default_type(MachineState *ms);
+
 int kvm_arch_init(MachineState *ms, KVMState *s);
 
 int kvm_arch_init_vcpu(CPUState *cpu);
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 84da49332c..34bc329b5b 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -247,6 +247,11 @@ int kvm_arm_get_max_vm_ipa_size(MachineState *ms, bool *fixed_ipa)
     return ret > 0 ? ret : 40;
 }
 
+int kvm_arch_get_default_type(MachineState *ms)
+{
+    return 0;
+}
+
 int kvm_arch_init(MachineState *ms, KVMState *s)
 {
     int ret = 0;
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index de531842f6..eb2f4e3238 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -2552,6 +2552,11 @@ static void register_smram_listener(Notifier *n, void *unused)
                                  &smram_address_space, 1, "kvm-smram");
 }
 
+int kvm_arch_get_default_type(MachineState *ms)
+{
+    return 0;
+}
+
 int kvm_arch_init(MachineState *ms, KVMState *s)
 {
     uint64_t identity_base = 0xfffbc000;
diff --git a/target/mips/kvm.c b/target/mips/kvm.c
index c14e8f550f..e98aad01bd 100644
--- a/target/mips/kvm.c
+++ b/target/mips/kvm.c
@@ -1266,7 +1266,7 @@ int kvm_arch_msi_data_to_gsi(uint32_t data)
     abort();
 }
 
-int mips_kvm_type(MachineState *machine, const char *vm_type)
+int kvm_arch_get_default_type(MachineState *machine)
 {
 #if defined(KVM_CAP_MIPS_VZ)
     int r;
diff --git a/target/mips/kvm_mips.h b/target/mips/kvm_mips.h
index 171d53dbe1..c711269d0a 100644
--- a/target/mips/kvm_mips.h
+++ b/target/mips/kvm_mips.h
@@ -25,13 +25,4 @@ void kvm_mips_reset_vcpu(MIPSCPU *cpu);
 int kvm_mips_set_interrupt(MIPSCPU *cpu, int irq, int level);
 int kvm_mips_set_ipi_interrupt(MIPSCPU *cpu, int irq, int level);
 
-#ifdef CONFIG_KVM
-int mips_kvm_type(MachineState *machine, const char *vm_type);
-#else
-static inline int mips_kvm_type(MachineState *machine, const char *vm_type)
-{
-    return 0;
-}
-#endif
-
 #endif /* KVM_MIPS_H */
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 78f6fc50cd..90a69af926 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -107,6 +107,11 @@ static int kvm_ppc_register_host_cpu_type(void);
 static void kvmppc_get_cpu_characteristics(KVMState *s);
 static int kvmppc_get_dec_bits(void);
 
+int kvm_arch_get_default_type(MachineState *ms)
+{
+    return 0;
+}
+
 int kvm_arch_init(MachineState *ms, KVMState *s)
 {
     cap_interrupt_unset = kvm_check_extension(s, KVM_CAP_PPC_UNSET_IRQ);
diff --git a/target/riscv/kvm.c b/target/riscv/kvm.c
index 0f932a5b96..ee0b381400 100644
--- a/target/riscv/kvm.c
+++ b/target/riscv/kvm.c
@@ -426,6 +426,11 @@ int kvm_arch_add_msi_route_post(struct kvm_irq_routing_entry *route,
     return 0;
 }
 
+int kvm_arch_get_default_type(MachineState *ms)
+{
+    return 0;
+}
+
 int kvm_arch_init(MachineState *ms, KVMState *s)
 {
     return 0;
diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c
index 3ac7ec9acf..8ffe140513 100644
--- a/target/s390x/kvm/kvm.c
+++ b/target/s390x/kvm/kvm.c
@@ -340,6 +340,11 @@ static void ccw_machine_class_foreach(ObjectClass *oc, void *opaque)
     mc->default_cpu_type = S390_CPU_TYPE_NAME("host");
 }
 
+int kvm_arch_get_default_type(MachineState *ms)
+{
+    return 0;
+}
+
 int kvm_arch_init(MachineState *ms, KVMState *s)
 {
     object_class_foreach(ccw_machine_class_foreach, TYPE_S390_CCW_MACHINE,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:00:49 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:00:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814148.1227351 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTUv-0000GU-Ir; Wed, 09 Oct 2024 10:00:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814148.1227351; Wed, 09 Oct 2024 10:00:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTUv-0000GN-GV; Wed, 09 Oct 2024 10:00:49 +0000
Received: by outflank-mailman (input) for mailman id 814148;
 Wed, 09 Oct 2024 10:00:48 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTUu-0000GH-9E
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:00:48 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTUu-0006Be-8Z
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:00:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTUu-0006PW-7h
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:00:48 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5DYK8mQt+qjdj/ugpxh9nF8m6t/CdVPQf1AXJ42vXQY=; b=EEpAuGEV1iWDF1Coa9lr7/YlOZ
	pd1CLaXyhNWhRv+9m3ysdu4x7sV9r05XhTP0AumxsXnoEAAYOwDu2DQg7On2ceGwuSCQHiVjONkcs
	imzyxFfbHI1XijW2mY17+DJ3vtuRgeYdoKjFsGqiBkduEd9rRkOrFVj6RmSNszFxUnJk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] accel/kvm: Specify default IPA size for arm64
Message-Id: <E1syTUu-0006PW-7h@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:00:48 +0000

commit f5cb21416e6fc6a3e2d58f4bb557c929ffe01818
Author:     Akihiko Odaki <akihiko.odaki@daynix.com>
AuthorDate: Tue Aug 22 17:31:02 2023 +0100
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    accel/kvm: Specify default IPA size for arm64
    
    Before this change, the default KVM type, which is used for non-virt
    machine models, was 0.
    
    The kernel documentation says:
    > On arm64, the physical address size for a VM (IPA Size limit) is
    > limited to 40bits by default. The limit can be configured if the host
    > supports the extension KVM_CAP_ARM_VM_IPA_SIZE. When supported, use
    > KVM_VM_TYPE_ARM_IPA_SIZE(IPA_Bits) to set the size in the machine type
    > identifier, where IPA_Bits is the maximum width of any physical
    > address used by the VM. The IPA_Bits is encoded in bits[7-0] of the
    > machine type identifier.
    >
    > e.g, to configure a guest to use 48bit physical address size::
    >
    >     vm_fd = ioctl(dev_fd, KVM_CREATE_VM, KVM_VM_TYPE_ARM_IPA_SIZE(48));
    >
    > The requested size (IPA_Bits) must be:
    >
    >  ==   =========================================================
    >   0   Implies default size, 40bits (for backward compatibility)
    >   N   Implies N bits, where N is a positive integer such that,
    >       32 <= N <= Host_IPA_Limit
    >  ==   =========================================================
    
    > Host_IPA_Limit is the maximum possible value for IPA_Bits on the host
    > and is dependent on the CPU capability and the kernel configuration.
    > The limit can be retrieved using KVM_CAP_ARM_VM_IPA_SIZE of the
    > KVM_CHECK_EXTENSION ioctl() at run-time.
    >
    > Creation of the VM will fail if the requested IPA size (whether it is
    > implicit or explicit) is unsupported on the host.
    https://docs.kernel.org/virt/kvm/api.html#kvm-create-vm
    
    So if Host_IPA_Limit < 40, specifying 0 as the type will fail. This
    actually confused libvirt, which uses "none" machine model to probe the
    KVM availability, on M2 MacBook Air.
    
    Fix this by using Host_IPA_Limit as the default type when
    KVM_CAP_ARM_VM_IPA_SIZE is available.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
    Message-id: 20230727073134.134102-3-akihiko.odaki@daynix.com
    Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    (cherry picked from commit 1ab445af8cd99343f29032b5944023ad7d8edebf)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/arm/kvm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 34bc329b5b..e219f78535 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -249,7 +249,9 @@ int kvm_arm_get_max_vm_ipa_size(MachineState *ms, bool *fixed_ipa)
 
 int kvm_arch_get_default_type(MachineState *ms)
 {
-    return 0;
+    bool fixed_ipa;
+    int size = kvm_arm_get_max_vm_ipa_size(ms, &fixed_ipa);
+    return fixed_ipa ? 0 : size;
 }
 
 int kvm_arch_init(MachineState *ms, KVMState *s)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:01:00 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:01:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814149.1227354 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTV6-0000Mv-Kn; Wed, 09 Oct 2024 10:01:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814149.1227354; Wed, 09 Oct 2024 10:01:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTV6-0000Mn-I0; Wed, 09 Oct 2024 10:01:00 +0000
Received: by outflank-mailman (input) for mailman id 814149;
 Wed, 09 Oct 2024 10:00:58 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTV4-0000MQ-FF
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:00:58 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTV4-0006Bm-Bm
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:00:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTV4-0006Qj-At
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:00:58 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dNnc4eDB5oP8t8a2NKEWTMOglOFQLLiCXytR9M18eBs=; b=K8gqWBlPbJLN1ZpDl7Ez6cc5Tr
	Zx/OEAVsWsD35OIjwfrzpd4s+3s6Vx3EHrq/TmarwVhwHbnKus3LrTIb3SPv0xiA1QbfWEs2FMLoV
	AMG8FULaRdHWIn/NIdMmMXd+dsXmJm0yljV+I8FTMn25mKx/lbcwhzvF4SGSJqyqtnNI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] target/arm: Fix SME ST1Q
Message-Id: <E1syTV4-0006Qj-At@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:00:58 +0000

commit 09640031edd4314b8b2b05235f3da8114b4d5d36
Author:     Richard Henderson <richard.henderson@linaro.org>
AuthorDate: Tue Aug 22 17:31:13 2023 +0100
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/arm: Fix SME ST1Q
    
    A typo, noted in the bug report, resulting in an
    incorrect write offset.
    
    Cc: qemu-stable@nongnu.org
    Fixes: 7390e0e9ab8 ("target/arm: Implement SME LD1, ST1")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1833
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20230818214255.146905-1-richard.henderson@linaro.org
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    (cherry picked from commit 4b3520fd93cd49cc56dfcab45d90735cc2e35af7)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/arm/tcg/sme_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/arm/tcg/sme_helper.c b/target/arm/tcg/sme_helper.c
index 1e67fcac30..296826ffe6 100644
--- a/target/arm/tcg/sme_helper.c
+++ b/target/arm/tcg/sme_helper.c
@@ -379,7 +379,7 @@ static inline void HNAME##_host(void *za, intptr_t off, void *host)         \
 {                                                                           \
     uint64_t *ptr = za + off;                                               \
     HOST(host, ptr[BE]);                                                    \
-    HOST(host + 1, ptr[!BE]);                                               \
+    HOST(host + 8, ptr[!BE]);                                               \
 }                                                                           \
 static inline void VNAME##_v_host(void *za, intptr_t off, void *host)       \
 {                                                                           \
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:01:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:01:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814150.1227359 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTVF-0000QT-Nm; Wed, 09 Oct 2024 10:01:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814150.1227359; Wed, 09 Oct 2024 10:01:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTVF-0000QL-LH; Wed, 09 Oct 2024 10:01:09 +0000
Received: by outflank-mailman (input) for mailman id 814150;
 Wed, 09 Oct 2024 10:01:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTVE-0000Pv-GY
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:01:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTVE-0006C9-Fz
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:01:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTVE-0006SL-EU
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:01:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TdJDWIZ7Pa7sEMipiEh3TPP2Lqmx/VgZGDn8naV8++Y=; b=z7X5fDNWve1Q5FqhnjSp68JROf
	qjy99lcGYz62lUvCbFJhQhcVO3JZvxw4RkwbxFlB2j01XuoBz75vM8Ut9cx5x3qSwJ0xR5fAv3hzR
	J6HXnaOkh75FYbrV7TvUYDPzKScWRYoM3hHur3cWY9vIUzbBV93ONW+z8iaI++JHM7Y8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] target/arm: Fix 64-bit SSRA
Message-Id: <E1syTVE-0006SL-EU@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:01:08 +0000

commit d4c0ac705d720e19d9ec5b9fe1c6c7bb22b6913a
Author:     Richard Henderson <richard.henderson@linaro.org>
AuthorDate: Tue Aug 22 17:31:14 2023 +0100
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/arm: Fix 64-bit SSRA
    
    Typo applied byte-wise shift instead of double-word shift.
    
    Cc: qemu-stable@nongnu.org
    Fixes: 631e565450c ("target/arm: Create gen_gvec_[us]sra")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1737
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20230821022025.397682-1-richard.henderson@linaro.org
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    (cherry picked from commit cd1e4db73646006039f25879af3bff55b2295ff3)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/arm/tcg/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c
index 1e4d94e58a..e1fe68f73a 100644
--- a/target/arm/tcg/translate.c
+++ b/target/arm/tcg/translate.c
@@ -3063,7 +3063,7 @@ void gen_gvec_ssra(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs,
           .vece = MO_32 },
         { .fni8 = gen_ssra64_i64,
           .fniv = gen_ssra_vec,
-          .fno = gen_helper_gvec_ssra_b,
+          .fno = gen_helper_gvec_ssra_d,
           .prefer_i64 = TCG_TARGET_REG_BITS == 64,
           .opt_opc = vecop_list,
           .load_dest = true,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:01:19 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:01:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814152.1227362 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTVP-0000U7-PC; Wed, 09 Oct 2024 10:01:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814152.1227362; Wed, 09 Oct 2024 10:01:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTVP-0000Tz-Mf; Wed, 09 Oct 2024 10:01:19 +0000
Received: by outflank-mailman (input) for mailman id 814152;
 Wed, 09 Oct 2024 10:01:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTVO-0000Tn-Jy
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:01:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTVO-0006CG-JG
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:01:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTVO-0006TN-IK
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:01:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Foh3CtsbeHbbY3FgQoRVAwysA3NSUHNY7eS/i7O9Lm0=; b=5YmznNEfWEj+OjAJlR6xyHtvRK
	I9cIGdch7P330AD0UQ9w1WJfpLj0lUAcOAxjetPnIIVL2mGeKhSKmpkLD5vWmOoTwEMPk6ZmgrEIy
	HimiAGOt/6cfDesSWqMgavhowoqMfwQtx7S2Ztj48S4wY6nQQklgdGy1068Z637mxLls=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] docs/about/license: Update LICENSE URL
Message-Id: <E1syTVO-0006TN-IK@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:01:18 +0000

commit 3c934310ffdfef69a085b8061d884d222b1d201b
Author:     Philippe Mathieu-Daudé <philmd@linaro.org>
AuthorDate: Tue Aug 22 14:57:16 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    docs/about/license: Update LICENSE URL
    
    In early 2021 (see commit 2ad784339e "docs: update README to use
    GitLab repo URLs") almost all of the code base was converted to
    point to GitLab instead of git.qemu.org. During 2023, git.qemu.org
    switched from a git mirror to a http redirect to GitLab (see [1]).
    
    Update the LICENSE URL to match its previous content, displaying
    the file raw content similarly to gitweb 'blob_plain' format ([2]).
    
    [1] https://lore.kernel.org/qemu-devel/CABgObfZu3mFc8tM20K-yXdt7F-7eV-uKZN4sKDarSeu7DYoRbA@mail.gmail.com/
    [2] https://git-scm.com/docs/gitweb#Documentation/gitweb.txt-blobplain
    
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Message-ID: <20230822125716.55295-1-philmd@linaro.org>
    (cherry picked from commit 09a3fffae00b042bed8ad9c351b1a58c505fde37)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 docs/about/license.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/about/license.rst b/docs/about/license.rst
index cde3d2d25d..303c55d61b 100644
--- a/docs/about/license.rst
+++ b/docs/about/license.rst
@@ -8,4 +8,4 @@ QEMU is a trademark of Fabrice Bellard.
 QEMU is released under the `GNU General Public
 License <https://www.gnu.org/licenses/gpl-2.0.txt>`__, version 2. Parts
 of QEMU have specific licenses, see file
-`LICENSE <https://git.qemu.org/?p=qemu.git;a=blob_plain;f=LICENSE>`__.
+`LICENSE <https://gitlab.com/qemu-project/qemu/-/raw/master/LICENSE>`__.
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:01:29 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:01:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814153.1227367 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTVZ-0000bs-R6; Wed, 09 Oct 2024 10:01:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814153.1227367; Wed, 09 Oct 2024 10:01:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTVZ-0000bk-O3; Wed, 09 Oct 2024 10:01:29 +0000
Received: by outflank-mailman (input) for mailman id 814153;
 Wed, 09 Oct 2024 10:01:28 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTVY-0000bU-NP
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:01:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTVY-0006CR-Mk
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:01:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTVY-0006Uh-Lq
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:01:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ATVAW3tG2OZAiCeOwMiJYzmCOyehD32AAIaWGk2t+Hg=; b=bMGkOPsM4V2iJVI4EurLDA32QX
	lFLIEdGYB+zRMI/8sqLJ4+H+vM6Og2TqNhbLl7yFIq0ZOxcQkGAqNhoLeZ5ywr62R/XLiZLDWpUnW
	lNlZ5nsMqxkeg0fQ/W2O9me3Udb9UjTCCqkHZ9cKOOgDUHrWo6OrSbekI9NcS30rF8w0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] block-migration: Ensure we don't crash during migration cleanup
Message-Id: <E1syTVY-0006Uh-Lq@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:01:28 +0000

commit e8bb4dc55a9a8e52f55c17ee9b50d7436a672881
Author:     Fabiano Rosas <farosas@suse.de>
AuthorDate: Mon Jul 31 17:33:38 2023 -0300
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    block-migration: Ensure we don't crash during migration cleanup
    
    We can fail the blk_insert_bs() at init_blk_migration(), leaving the
    BlkMigDevState without a dirty_bitmap and BlockDriverState. Account
    for the possibly missing elements when doing cleanup.
    
    Fix the following crashes:
    
    Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
    0x0000555555ec83ef in bdrv_release_dirty_bitmap (bitmap=0x0) at ../block/dirty-bitmap.c:359
    359         BlockDriverState *bs = bitmap->bs;
     #0  0x0000555555ec83ef in bdrv_release_dirty_bitmap (bitmap=0x0) at ../block/dirty-bitmap.c:359
     #1  0x0000555555bba331 in unset_dirty_tracking () at ../migration/block.c:371
     #2  0x0000555555bbad98 in block_migration_cleanup_bmds () at ../migration/block.c:681
    
    Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
    0x0000555555e971ff in bdrv_op_unblock (bs=0x0, op=BLOCK_OP_TYPE_BACKUP_SOURCE, reason=0x0) at ../block.c:7073
    7073        QLIST_FOREACH_SAFE(blocker, &bs->op_blockers[op], list, next) {
     #0  0x0000555555e971ff in bdrv_op_unblock (bs=0x0, op=BLOCK_OP_TYPE_BACKUP_SOURCE, reason=0x0) at ../block.c:7073
     #1  0x0000555555e9734a in bdrv_op_unblock_all (bs=0x0, reason=0x0) at ../block.c:7095
     #2  0x0000555555bbae13 in block_migration_cleanup_bmds () at ../migration/block.c:690
    
    Signed-off-by: Fabiano Rosas <farosas@suse.de>
    Message-id: 20230731203338.27581-1-farosas@suse.de
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    (cherry picked from commit f187609f27b261702a17f79d20bf252ee0d4f9cd)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 migration/block.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/migration/block.c b/migration/block.c
index b2497bbd32..ece746e788 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -366,7 +366,9 @@ static void unset_dirty_tracking(void)
     BlkMigDevState *bmds;
 
     QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
-        bdrv_release_dirty_bitmap(bmds->dirty_bitmap);
+        if (bmds->dirty_bitmap) {
+            bdrv_release_dirty_bitmap(bmds->dirty_bitmap);
+        }
     }
 }
 
@@ -674,13 +676,18 @@ static int64_t get_remaining_dirty(void)
 static void block_migration_cleanup_bmds(void)
 {
     BlkMigDevState *bmds;
+    BlockDriverState *bs;
     AioContext *ctx;
 
     unset_dirty_tracking();
 
     while ((bmds = QSIMPLEQ_FIRST(&block_mig_state.bmds_list)) != NULL) {
         QSIMPLEQ_REMOVE_HEAD(&block_mig_state.bmds_list, entry);
-        bdrv_op_unblock_all(blk_bs(bmds->blk), bmds->blocker);
+
+        bs = blk_bs(bmds->blk);
+        if (bs) {
+            bdrv_op_unblock_all(bs, bmds->blocker);
+        }
         error_free(bmds->blocker);
 
         /* Save ctx, because bmds->blk can disappear during blk_unref.  */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:01:39 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:01:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814154.1227370 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTVj-0000eM-S6; Wed, 09 Oct 2024 10:01:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814154.1227370; Wed, 09 Oct 2024 10:01:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTVj-0000eE-PV; Wed, 09 Oct 2024 10:01:39 +0000
Received: by outflank-mailman (input) for mailman id 814154;
 Wed, 09 Oct 2024 10:01:38 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTVi-0000e6-QH
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:01:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTVi-0006Cr-PY
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:01:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTVi-0006W4-Ov
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:01:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5teZFMYcvzEyy7lVsxXDuaiXxyEI0oOji/CjiDO52Hk=; b=TWOOpD/pE/navo17I5xvFCdWnF
	BrZe3E0wFGzJ6tTjrV5EKO1ucCjlHH61AH4nBujKG9D9sjXhxzZAHUFSJQACzCDBYAMCbL+wXISCN
	j/mPHdYQl4a6+0jsIkZApJTCj3rx86FcjdBTR+kNNMNqYZFwb/nLeadBHPm5frvWzEl8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/ppc/e500: fix broken snapshot replay
Message-Id: <E1syTVi-0006W4-Ov@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:01:38 +0000

commit fcb49ea23c39dd93b8e1d4e0edae67967d28e001
Author:     Maksim Kostin <maksim.kostin@ispras.ru>
AuthorDate: Wed Aug 9 13:07:33 2023 +0300
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/ppc/e500: fix broken snapshot replay
    
    ppce500_reset_device_tree is registered for system reset, but after
    c4b075318eb1 this function rerandomizes rng-seed via
    qemu_guest_getrandom_nofail. And when loading a snapshot, it tries to read
    EVENT_RANDOM that doesn't exist, so we have an error:
    
      qemu-system-ppc: Missing random event in the replay log
    
    To fix this, use qemu_register_reset_nosnapshotload instead of
    qemu_register_reset.
    
    Reported-by: Vitaly Cheptsov <cheptsov@ispras.ru>
    Fixes: c4b075318eb1 ("hw/ppc: pass random seed to fdt ")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1634
    Signed-off-by: Maksim Kostin <maksim.kostin@ispras.ru>
    Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    (cherry picked from commit 6ec65b69ba17c954414fa23a397fb8a3fcfb4a43)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ppc/e500.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index 117c9c08ed..27d83a4bf6 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -712,7 +712,7 @@ static int ppce500_prep_device_tree(PPCE500MachineState *machine,
     p->kernel_base = kernel_base;
     p->kernel_size = kernel_size;
 
-    qemu_register_reset(ppce500_reset_device_tree, p);
+    qemu_register_reset_nosnapshotload(ppce500_reset_device_tree, p);
     p->notifier.notify = ppce500_init_notify;
     qemu_add_machine_init_done_notifier(&p->notifier);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:01:49 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:01:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814155.1227375 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTVt-0000i0-TQ; Wed, 09 Oct 2024 10:01:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814155.1227375; Wed, 09 Oct 2024 10:01:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTVt-0000ht-Qw; Wed, 09 Oct 2024 10:01:49 +0000
Received: by outflank-mailman (input) for mailman id 814155;
 Wed, 09 Oct 2024 10:01:48 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTVs-0000gM-TP
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:01:48 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTVs-0006DD-Sf
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:01:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTVs-0006XJ-Rn
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:01:48 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xsl/rXjk3XYdLV1662ZCahnuMu2lh4UWRhnPni7T2pU=; b=D0A7EUv2MzgvB4VBe0JD3ZB0XJ
	lvbtCVPIium3sok0Ke2q1nipbHXb7B7pOJBFnZQgy/QM5PwkH8CKbXLlx1w85rLTyACJegFwcA2d5
	1hfPfSIe3kU3TmSHAWtgCARla6bbLS8sL70GbUAE0hNdr8F4mLRXNql2Lfp//vJK02L0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] ppc/vof: Fix missed fields in VOF cleanup
Message-Id: <E1syTVs-0006XJ-Rn@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:01:48 +0000

commit ea25506b5d6439c76a3a6b7b55dd3f861e98eb85
Author:     Nicholas Piggin <npiggin@gmail.com>
AuthorDate: Tue Aug 8 14:19:44 2023 +1000
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    ppc/vof: Fix missed fields in VOF cleanup
    
    Failing to reset the of_instance_last makes ihandle allocation continue
    to increase, which causes record-replay replay fail to match the
    recorded trace.
    
    Not resetting claimed_base makes VOF eventually run out of memory after
    some resets.
    
    Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
    Fixes: fc8c745d501 ("spapr: Implement Open Firmware client interface")
    Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
    Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    (cherry picked from commit 7b8589d7ce7e23f26ff53338d575a5cbd7818e28)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ppc/vof.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/ppc/vof.c b/hw/ppc/vof.c
index 18c3f92317..e3b430a81f 100644
--- a/hw/ppc/vof.c
+++ b/hw/ppc/vof.c
@@ -1024,6 +1024,8 @@ void vof_cleanup(Vof *vof)
     }
     vof->claimed = NULL;
     vof->of_instances = NULL;
+    vof->of_instance_last = 0;
+    vof->claimed_base = 0;
 }
 
 void vof_build_dt(void *fdt, Vof *vof)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:01:59 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:01:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814156.1227379 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTW3-0000n9-V5; Wed, 09 Oct 2024 10:01:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814156.1227379; Wed, 09 Oct 2024 10:01:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTW3-0000n1-SN; Wed, 09 Oct 2024 10:01:59 +0000
Received: by outflank-mailman (input) for mailman id 814156;
 Wed, 09 Oct 2024 10:01:59 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTW3-0000mp-07
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:01:59 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTW2-0006DK-Vj
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:01:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTW2-0006YH-Uv
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:01:58 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=O+M8y07u7DwiHpUN9SszPyU0p1cF3p/Jsm95iv/pgVE=; b=1DrFqZkFLgRXhJAQEB/r3JZGkY
	xcmORrFh4oB2Hyx408n8HsxYYSZ30w8zMfW5sTsTOsBwyHt31YceTcVZhGBRDUVp3Qz4p25zDR7tj
	RkMJ8zdkLV3zHvHd29mIZPO4eWkzWzbXjNc8l9C28PEOGB68qNXmA4mf17Aa9fmuo0Hs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] target/ppc: Flush inputs to zero with NJ in ppc_store_vscr
Message-Id: <E1syTW2-0006YH-Uv@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:01:58 +0000

commit 956b96f9e25f22a1e66d0dcacfb3621ef8a671b4
Author:     Richard Henderson <richard.henderson@linaro.org>
AuthorDate: Sun Aug 20 19:59:35 2023 -0700
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/ppc: Flush inputs to zero with NJ in ppc_store_vscr
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1779
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    (cherry picked from commit af03aeb631eeb81a44d2c0ff5b429cd4b5dc2799)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/ppc/cpu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c
index 1a97b41c6b..6e597680fb 100644
--- a/target/ppc/cpu.c
+++ b/target/ppc/cpu.c
@@ -59,6 +59,7 @@ void ppc_store_vscr(CPUPPCState *env, uint32_t vscr)
     env->vscr_sat.u64[0] = vscr & (1u << VSCR_SAT);
     env->vscr_sat.u64[1] = 0;
     set_flush_to_zero((vscr >> VSCR_NJ) & 1, &env->vec_status);
+    set_flush_inputs_to_zero((vscr >> VSCR_NJ) & 1, &env->vec_status);
 }
 
 uint32_t ppc_get_vscr(CPUPPCState *env)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:02:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:02:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814157.1227382 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTWE-0000q8-01; Wed, 09 Oct 2024 10:02:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814157.1227382; Wed, 09 Oct 2024 10:02:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTWD-0000q1-Tm; Wed, 09 Oct 2024 10:02:09 +0000
Received: by outflank-mailman (input) for mailman id 814157;
 Wed, 09 Oct 2024 10:02:09 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTWD-0000pa-3O
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:02:09 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTWD-0006Dh-2h
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:02:09 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTWD-0006Zr-1o
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:02:09 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=lZlPG8HR5igEvDQkuHU1yoNBO5Tj7QfnnReZdmm4so8=; b=1bzJWUJzkibpAfapZ2ZTDzmkT6
	M3LHMtKWLc/3gUboFNF7c+rBoCLXsyUUMbuIUrO1dS1a90pK8wcl3gwkfQOw/7BNvyJtugvmds46Z
	nS008gjPl5pVZ5+ZIciS831l6SWYnGcYZr748egwmGmDkVZ/g5oU32XMscJ7TMxfCBoM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/ide/core: set ERR_STAT in unsupported command completion
Message-Id: <E1syTWD-0006Zr-1o@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:02:09 +0000

commit 67894ec9fd512db33a883bd8df01ddac7f9f9780
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:38 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/ide/core: set ERR_STAT in unsupported command completion
    
    Currently, the first time sending an unsupported command
    (e.g. READ LOG DMA EXT) will not have ERR_STAT set in the completion.
    Sending the unsupported command again, will correctly have ERR_STAT set.
    
    When ide_cmd_permitted() returns false, it calls ide_abort_command().
    ide_abort_command() first calls ide_transfer_stop(), which will call
    ide_transfer_halt() and ide_cmd_done(), after that ide_abort_command()
    sets ERR_STAT in status.
    
    ide_cmd_done() for AHCI will call ahci_write_fis_d2h() which writes the
    current status in the FIS, and raises an IRQ. (The status here will not
    have ERR_STAT set!).
    
    Thus, we cannot call ide_transfer_stop() before setting ERR_STAT, as
    ide_transfer_stop() will result in the FIS being written and an IRQ
    being raised.
    
    The reason why it works the second time, is that ERR_STAT will still
    be set from the previous command, so when writing the FIS, the
    completion will correctly have ERR_STAT set.
    
    Set ERR_STAT before writing the FIS (calling cmd_done), so that we will
    raise an error IRQ correctly when receiving an unsupported command.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20230609140844.202795-3-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit c3461c6264a7c8ca15b117e91fe5da786924a784)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/ide/core.c b/hw/ide/core.c
index de48ff9f86..07971c0218 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -533,9 +533,9 @@ BlockAIOCB *ide_issue_trim(
 
 void ide_abort_command(IDEState *s)
 {
-    ide_transfer_stop(s);
     s->status = READY_STAT | ERR_STAT;
     s->error = ABRT_ERR;
+    ide_transfer_stop(s);
 }
 
 static void ide_set_retry(IDEState *s)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:02:20 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:02:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814158.1227386 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTWO-0000vi-1W; Wed, 09 Oct 2024 10:02:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814158.1227386; Wed, 09 Oct 2024 10:02:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTWN-0000vb-VE; Wed, 09 Oct 2024 10:02:19 +0000
Received: by outflank-mailman (input) for mailman id 814158;
 Wed, 09 Oct 2024 10:02:19 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTWN-0000tp-6N
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:02:19 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTWN-0006Dp-5f
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:02:19 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTWN-0006aV-4w
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:02:19 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=rHi1OjQUS3Ofy5LI7TtJIyNboufUUe0CZuVRYbS+79o=; b=OgPN0kcK/RYA7Djl/Sm9f4uBP4
	0qeUqx/a3TALJeFHEL9PWnsk8zPQaOF+WVRJzr74OlmUXxs2EabmisC3dW5HIwBwefuRr9Qmi7wIj
	ylx5R7Qhzq2+xTCKot6uYn696IH2btuDu3GkAQlFfGYUr+qldaqQEijcgJsxg7HN93bs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/ide/ahci: write D2H FIS when processing NCQ command
Message-Id: <E1syTWN-0006aV-4w@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:02:19 +0000

commit 362a4d8658c9370a071b5e598c158d522a3fa60d
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:39 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/ide/ahci: write D2H FIS when processing NCQ command
    
    The way that BUSY + PxCI is cleared for NCQ (FPDMA QUEUED) commands is
    described in SATA 3.5a Gold:
    
    11.15 FPDMA QUEUED command protocol
    DFPDMAQ2: ClearInterfaceBsy
    "Transmit Register Device to Host FIS with the BSY bit cleared to zero
    and the DRQ bit cleared to zero and Interrupt bit cleared to zero to
    mark interface ready for the next command."
    
    PxCI is currently cleared by handle_cmd(), but we don't write the D2H
    FIS to the FIS Receive Area that actually caused PxCI to be cleared.
    
    Similar to how ahci_pio_transfer() calls ahci_write_fis_pio() with an
    additional parameter to write a PIO Setup FIS without raising an IRQ,
    add a parameter to ahci_write_fis_d2h() so that ahci_write_fis_d2h()
    also can write the FIS to the FIS Receive Area without raising an IRQ.
    
    Change process_ncq_command() to call ahci_write_fis_d2h() without
    raising an IRQ (similar to ahci_pio_transfer()), such that the FIS
    Receive Area is in sync with the PxTFD shadow register.
    
    E.g. Linux reads status and error fields from the FIS Receive Area
    directly, so it is wise to keep the FIS Receive Area and the PxTFD
    shadow register in sync.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Message-id: 20230609140844.202795-4-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit 2967dc8209dd27b61a6ab7bad78cf7c6ec58ddb4)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/ahci.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 4e76d6b191..b81da46e3e 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -43,7 +43,7 @@
 static void check_cmd(AHCIState *s, int port);
 static int handle_cmd(AHCIState *s, int port, uint8_t slot);
 static void ahci_reset_port(AHCIState *s, int port);
-static bool ahci_write_fis_d2h(AHCIDevice *ad);
+static bool ahci_write_fis_d2h(AHCIDevice *ad, bool d2h_fis_i);
 static void ahci_init_d2h(AHCIDevice *ad);
 static int ahci_dma_prepare_buf(const IDEDMA *dma, int32_t limit);
 static bool ahci_map_clb_address(AHCIDevice *ad);
@@ -618,7 +618,7 @@ static void ahci_init_d2h(AHCIDevice *ad)
         return;
     }
 
-    if (ahci_write_fis_d2h(ad)) {
+    if (ahci_write_fis_d2h(ad, true)) {
         ad->init_d2h_sent = true;
         /* We're emulating receiving the first Reg H2D Fis from the device;
          * Update the SIG register, but otherwise proceed as normal. */
@@ -850,7 +850,7 @@ static void ahci_write_fis_pio(AHCIDevice *ad, uint16_t len, bool pio_fis_i)
     }
 }
 
-static bool ahci_write_fis_d2h(AHCIDevice *ad)
+static bool ahci_write_fis_d2h(AHCIDevice *ad, bool d2h_fis_i)
 {
     AHCIPortRegs *pr = &ad->port_regs;
     uint8_t *d2h_fis;
@@ -864,7 +864,7 @@ static bool ahci_write_fis_d2h(AHCIDevice *ad)
     d2h_fis = &ad->res_fis[RES_FIS_RFIS];
 
     d2h_fis[0] = SATA_FIS_TYPE_REGISTER_D2H;
-    d2h_fis[1] = (1 << 6); /* interrupt bit */
+    d2h_fis[1] = d2h_fis_i ? (1 << 6) : 0; /* interrupt bit */
     d2h_fis[2] = s->status;
     d2h_fis[3] = s->error;
 
@@ -890,7 +890,10 @@ static bool ahci_write_fis_d2h(AHCIDevice *ad)
         ahci_trigger_irq(ad->hba, ad, AHCI_PORT_IRQ_BIT_TFES);
     }
 
-    ahci_trigger_irq(ad->hba, ad, AHCI_PORT_IRQ_BIT_DHRS);
+    if (d2h_fis_i) {
+        ahci_trigger_irq(ad->hba, ad, AHCI_PORT_IRQ_BIT_DHRS);
+    }
+
     return true;
 }
 
@@ -1120,6 +1123,8 @@ static void process_ncq_command(AHCIState *s, int port, const uint8_t *cmd_fis,
         return;
     }
 
+    ahci_write_fis_d2h(ad, false);
+
     ncq_tfs->used = 1;
     ncq_tfs->drive = ad;
     ncq_tfs->slot = slot;
@@ -1506,7 +1511,7 @@ static void ahci_cmd_done(const IDEDMA *dma)
     }
 
     /* update d2h status */
-    ahci_write_fis_d2h(ad);
+    ahci_write_fis_d2h(ad, true);
 
     if (ad->port_regs.cmd_issue && !ad->check_bh) {
         ad->check_bh = qemu_bh_new_guarded(ahci_check_cmd_bh, ad,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:02:30 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:02:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814159.1227391 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTWY-00011f-4g; Wed, 09 Oct 2024 10:02:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814159.1227391; Wed, 09 Oct 2024 10:02:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTWY-00011Y-1x; Wed, 09 Oct 2024 10:02:30 +0000
Received: by outflank-mailman (input) for mailman id 814159;
 Wed, 09 Oct 2024 10:02:29 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTWX-00011N-9G
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:02:29 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTWX-0006FT-8Y
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:02:29 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTWX-0006bH-7s
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:02:29 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=CbU7M73PJ9vFzUyZmqqQOtuuR20hg6XLSdWf174l3rU=; b=eQgIH/fjnMol996IW1xb1H5LBg
	G8n/eGfbKa7hMpSiRxq19YAg/vjoSM6juRMGznfI6jvOXRiAcxv9vq5bRVOU1I6ylC1oplJFNhtvE
	WHozYr7HJX6L9v1x2SVNUzPas9gjexgmK0FDyhmIgADSYV+lKFj5137okbv9EVJIbsag=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/ide/ahci: simplify and document PxCI handling
Message-Id: <E1syTWX-0006bH-7s@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:02:29 +0000

commit 7bcd32128b227cee1fb39ff242d486ed9fff7648
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:40 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/ide/ahci: simplify and document PxCI handling
    
    The AHCI spec states that:
    For NCQ, PxCI is cleared on command queued successfully.
    
    For non-NCQ, PxCI is cleared on command completed successfully.
    (A non-NCQ command that completes with error does not clear PxCI.)
    
    The current QEMU implementation either clears PxCI in check_cmd(),
    or in ahci_cmd_done().
    
    check_cmd() will clear PxCI for a command if handle_cmd() returns 0.
    handle_cmd() will return -1 if BUSY or DRQ is set.
    
    The QEMU implementation for NCQ commands will currently not set BUSY
    or DRQ, so they will always have PxCI cleared by handle_cmd().
    ahci_cmd_done() will never even get called for NCQ commands.
    
    Non-NCQ commands are executed by ide_bus_exec_cmd().
    Non-NCQ commands in QEMU are implemented either in a sync or in an async
    way.
    
    For non-NCQ commands implemented in a sync way, the command handler will
    return true, and when ide_bus_exec_cmd() sees that a command handler
    returns true, it will call ide_cmd_done() (which will call
    ahci_cmd_done()). For a command implemented in a sync way,
    ahci_cmd_done() will do nothing (since busy_slot is not set). Instead,
    after ide_bus_exec_cmd() has finished, check_cmd() will clear PxCI for
    these commands.
    
    For non-NCQ commands implemented in an async way (using either aiocb or
    pio_aiocb), the command handler will return false, ide_bus_exec_cmd()
    will not call ide_cmd_done(), instead it is expected that the async
    callback function will call ide_cmd_done() once the async command is
    done. handle_cmd() will set busy_slot, if and only if BUSY or DRQ is
    set, and this is checked _after_ ide_bus_exec_cmd() has returned.
    handle_cmd() will return -1, so check_cmd() will not clear PxCI.
    When the async callback calls ide_cmd_done() (which will call
    ahci_cmd_done()), it will see that busy_slot is set, and
    ahci_cmd_done() will clear PxCI.
    
    This seems racy, since busy_slot is set _after_ ide_bus_exec_cmd() has
    returned. The callback might come before busy_slot gets set. And it is
    quite confusing that ahci_cmd_done() will be called for all non-NCQ
    commands when the command is done, but will only clear PxCI in certain
    cases, even though it will always write a D2H FIS and raise an IRQ.
    
    Even worse, in the case where ahci_cmd_done() does not clear PxCI, it
    still raises an IRQ. Host software might thus read an old PxCI value,
    since PxCI is cleared (by check_cmd()) after the IRQ has been raised.
    
    Try to simplify this by always setting busy_slot for non-NCQ commands,
    such that ahci_cmd_done() will always be responsible for clearing PxCI
    for non-NCQ commands.
    
    For NCQ commands, clear PxCI when we receive the D2H FIS, but before
    raising the IRQ, see AHCI 1.3.1, section 5.3.8, states RegFIS:Entry and
    RegFIS:ClearCI.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Message-id: 20230609140844.202795-5-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit e2a5d9b3d9c3d311618160603cc9bc04fbd98796)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/ahci.c | 70 ++++++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 50 insertions(+), 20 deletions(-)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index b81da46e3e..6299320ffb 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -41,9 +41,10 @@
 #include "trace.h"
 
 static void check_cmd(AHCIState *s, int port);
-static int handle_cmd(AHCIState *s, int port, uint8_t slot);
+static void handle_cmd(AHCIState *s, int port, uint8_t slot);
 static void ahci_reset_port(AHCIState *s, int port);
 static bool ahci_write_fis_d2h(AHCIDevice *ad, bool d2h_fis_i);
+static void ahci_clear_cmd_issue(AHCIDevice *ad, uint8_t slot);
 static void ahci_init_d2h(AHCIDevice *ad);
 static int ahci_dma_prepare_buf(const IDEDMA *dma, int32_t limit);
 static bool ahci_map_clb_address(AHCIDevice *ad);
@@ -591,9 +592,8 @@ static void check_cmd(AHCIState *s, int port)
 
     if ((pr->cmd & PORT_CMD_START) && pr->cmd_issue) {
         for (slot = 0; (slot < 32) && pr->cmd_issue; slot++) {
-            if ((pr->cmd_issue & (1U << slot)) &&
-                !handle_cmd(s, port, slot)) {
-                pr->cmd_issue &= ~(1U << slot);
+            if (pr->cmd_issue & (1U << slot)) {
+                handle_cmd(s, port, slot);
             }
         }
     }
@@ -1123,6 +1123,22 @@ static void process_ncq_command(AHCIState *s, int port, const uint8_t *cmd_fis,
         return;
     }
 
+    /*
+     * A NCQ command clears the bit in PxCI after the command has been QUEUED
+     * successfully (ERROR not set, BUSY and DRQ cleared).
+     *
+     * For NCQ commands, PxCI will always be cleared here.
+     *
+     * (Once the NCQ command is COMPLETED, the device will send a SDB FIS with
+     * the interrupt bit set, which will clear PxSACT and raise an interrupt.)
+     */
+    ahci_clear_cmd_issue(ad, slot);
+
+    /*
+     * In reality, for NCQ commands, PxCI is cleared after receiving a D2H FIS
+     * without the interrupt bit set, but since ahci_write_fis_d2h() can raise
+     * an IRQ on error, we need to call them in reverse order.
+     */
     ahci_write_fis_d2h(ad, false);
 
     ncq_tfs->used = 1;
@@ -1197,6 +1213,7 @@ static void handle_reg_h2d_fis(AHCIState *s, int port,
 {
     IDEState *ide_state = &s->dev[port].port.ifs[0];
     AHCICmdHdr *cmd = get_cmd_header(s, port, slot);
+    AHCIDevice *ad = &s->dev[port];
     uint16_t opts = le16_to_cpu(cmd->opts);
 
     if (cmd_fis[1] & 0x0F) {
@@ -1273,11 +1290,19 @@ static void handle_reg_h2d_fis(AHCIState *s, int port,
     /* Reset transferred byte counter */
     cmd->status = 0;
 
+    /*
+     * A non-NCQ command clears the bit in PxCI after the command has COMPLETED
+     * successfully (ERROR not set, BUSY and DRQ cleared).
+     *
+     * For non-NCQ commands, PxCI will always be cleared by ahci_cmd_done().
+     */
+    ad->busy_slot = slot;
+
     /* We're ready to process the command in FIS byte 2. */
     ide_bus_exec_cmd(&s->dev[port].port, cmd_fis[2]);
 }
 
-static int handle_cmd(AHCIState *s, int port, uint8_t slot)
+static void handle_cmd(AHCIState *s, int port, uint8_t slot)
 {
     IDEState *ide_state;
     uint64_t tbl_addr;
@@ -1288,12 +1313,12 @@ static int handle_cmd(AHCIState *s, int port, uint8_t slot)
     if (s->dev[port].port.ifs[0].status & (BUSY_STAT|DRQ_STAT)) {
         /* Engine currently busy, try again later */
         trace_handle_cmd_busy(s, port);
-        return -1;
+        return;
     }
 
     if (!s->dev[port].lst) {
         trace_handle_cmd_nolist(s, port);
-        return -1;
+        return;
     }
     cmd = get_cmd_header(s, port, slot);
     /* remember current slot handle for later */
@@ -1303,7 +1328,7 @@ static int handle_cmd(AHCIState *s, int port, uint8_t slot)
     ide_state = &s->dev[port].port.ifs[0];
     if (!ide_state->blk) {
         trace_handle_cmd_badport(s, port);
-        return -1;
+        return;
     }
 
     tbl_addr = le64_to_cpu(cmd->tbl_addr);
@@ -1312,7 +1337,7 @@ static int handle_cmd(AHCIState *s, int port, uint8_t slot)
                              DMA_DIRECTION_TO_DEVICE, MEMTXATTRS_UNSPECIFIED);
     if (!cmd_fis) {
         trace_handle_cmd_badfis(s, port);
-        return -1;
+        return;
     } else if (cmd_len != 0x80) {
         ahci_trigger_irq(s, &s->dev[port], AHCI_PORT_IRQ_BIT_HBFS);
         trace_handle_cmd_badmap(s, port, cmd_len);
@@ -1336,15 +1361,6 @@ static int handle_cmd(AHCIState *s, int port, uint8_t slot)
 out:
     dma_memory_unmap(s->as, cmd_fis, cmd_len, DMA_DIRECTION_TO_DEVICE,
                      cmd_len);
-
-    if (s->dev[port].port.ifs[0].status & (BUSY_STAT|DRQ_STAT)) {
-        /* async command, complete later */
-        s->dev[port].busy_slot = slot;
-        return -1;
-    }
-
-    /* done handling the command */
-    return 0;
 }
 
 /* Transfer PIO data between RAM and device */
@@ -1498,6 +1514,16 @@ static int ahci_dma_rw_buf(const IDEDMA *dma, bool is_write)
     return 1;
 }
 
+static void ahci_clear_cmd_issue(AHCIDevice *ad, uint8_t slot)
+{
+    IDEState *ide_state = &ad->port.ifs[0];
+
+    if (!(ide_state->status & (BUSY_STAT | DRQ_STAT))) {
+        ad->port_regs.cmd_issue &= ~(1 << slot);
+    }
+}
+
+/* Non-NCQ command is done - This function is never called for NCQ commands. */
 static void ahci_cmd_done(const IDEDMA *dma)
 {
     AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma);
@@ -1506,11 +1532,15 @@ static void ahci_cmd_done(const IDEDMA *dma)
 
     /* no longer busy */
     if (ad->busy_slot != -1) {
-        ad->port_regs.cmd_issue &= ~(1 << ad->busy_slot);
+        ahci_clear_cmd_issue(ad, ad->busy_slot);
         ad->busy_slot = -1;
     }
 
-    /* update d2h status */
+    /*
+     * In reality, for non-NCQ commands, PxCI is cleared after receiving a D2H
+     * FIS with the interrupt bit set, but since ahci_write_fis_d2h() will raise
+     * an IRQ, we need to call them in reverse order.
+     */
     ahci_write_fis_d2h(ad, true);
 
     if (ad->port_regs.cmd_issue && !ad->check_bh) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:02:40 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:02:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814160.1227396 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTWi-00019o-7I; Wed, 09 Oct 2024 10:02:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814160.1227396; Wed, 09 Oct 2024 10:02:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTWi-00019g-3a; Wed, 09 Oct 2024 10:02:40 +0000
Received: by outflank-mailman (input) for mailman id 814160;
 Wed, 09 Oct 2024 10:02:39 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTWh-00018C-CA
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:02:39 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTWh-0006Fr-BU
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:02:39 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTWh-0006bx-Aq
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:02:39 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yKdxL7FCrPYi1I8Xot6UPLF6tMCG7vplFi3CrjY7Zjc=; b=KaDhmJQW9ogKqE5wDmED0RB5ps
	8gy54wlu4Bk1wiZNoDgGLWgZffBHYN8UUYYa2EfPdjHtR2OII3M0390/BbtHtN45Eqx+hAC3s6j0h
	xHS8ugcRcE9eOTOCIcLcn09DrWY+/SNcKKKRdXrixZbl9u8r3H5uoUXuhwYamqnM9lFk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/ide/ahci: PxSACT and PxCI is cleared when PxCMD.ST is cleared
Message-Id: <E1syTWh-0006bx-Aq@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:02:39 +0000

commit 2eaf7775fc05d65c9254530ea0fdbbcf910c92cd
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:41 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/ide/ahci: PxSACT and PxCI is cleared when PxCMD.ST is cleared
    
    According to AHCI 1.3.1 definition of PxSACT:
    This field is cleared when PxCMD.ST is written from a '1' to a '0' by
    software. This field is not cleared by a COMRESET or a software reset.
    
    According to AHCI 1.3.1 definition of PxCI:
    This field is also cleared when PxCMD.ST is written from a '1' to a '0'
    by software.
    
    Clearing PxCMD.ST is part of the error recovery procedure, see
    AHCI 1.3.1, section "6.2 Error Recovery".
    
    If we don't clear PxCI on error recovery, the previous command will
    incorrectly still be marked as pending after error recovery.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20230609140844.202795-6-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit d73b84d0b664e60fffb66f46e84d0db4a8e1c713)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/ahci.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 6299320ffb..a93a1878de 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -329,6 +329,11 @@ static void ahci_port_write(AHCIState *s, int port, int offset, uint32_t val)
         ahci_check_irq(s);
         break;
     case AHCI_PORT_REG_CMD:
+        if ((pr->cmd & PORT_CMD_START) && !(val & PORT_CMD_START)) {
+            pr->scr_act = 0;
+            pr->cmd_issue = 0;
+        }
+
         /* Block any Read-only fields from being set;
          * including LIST_ON and FIS_ON.
          * The spec requires to set ICC bits to zero after the ICC change
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:02:50 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:02:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814161.1227399 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTWs-0001GD-7m; Wed, 09 Oct 2024 10:02:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814161.1227399; Wed, 09 Oct 2024 10:02:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTWs-0001G3-55; Wed, 09 Oct 2024 10:02:50 +0000
Received: by outflank-mailman (input) for mailman id 814161;
 Wed, 09 Oct 2024 10:02:49 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTWr-0001Fx-FE
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:02:49 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTWr-0006Fy-EY
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:02:49 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTWr-0006cf-Du
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:02:49 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YoQSkGNbYKN9P34apWeQsBBy8OsT0IqWQJSumVQnsD4=; b=7Nip36FoKHrsbRktlmFRUQmo3k
	byCJ7M8zCBFDQifWN981WAF6J+GjJmPPaXgu3Y9IIHRvNV9v6aG2mxGgOVdE1YCQ5PDWPvnNL5vNB
	Zi4Yt2FIkRcKcB1fR1Ud/q5vdEV28Wrhi8WLrZxY0MgwW7h33hEYRtvaDHuzE174eZzg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/ide/ahci: PxCI should not get cleared when ERR_STAT is set
Message-Id: <E1syTWr-0006cf-Du@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:02:49 +0000

commit f7cca09987983644d054fc4f4feb8414dcd624c5
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:42 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:58 2023 +0300

    hw/ide/ahci: PxCI should not get cleared when ERR_STAT is set
    
    For NCQ, PxCI is cleared on command queued successfully.
    For non-NCQ, PxCI is cleared on command completed successfully.
    Successfully means ERR_STAT, BUSY and DRQ are all cleared.
    
    A command that has ERR_STAT set, does not get to clear PxCI.
    See AHCI 1.3.1, section 5.3.8, states RegFIS:Entry and RegFIS:ClearCI,
    and 5.3.16.5 ERR:FatalTaskfile.
    
    In the case of non-NCQ commands, not clearing PxCI is needed in order
    for host software to be able to see which command slot that failed.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Message-id: 20230609140844.202795-7-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit 1a16ce64fda11bdf50f0c4ab5d9fdde72c1383a2)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/ahci.c             |   7 ++-
 tests/qtest/libqos/ahci.c | 106 ++++++++++++++++++++++++++++++++++------------
 tests/qtest/libqos/ahci.h |   8 ++--
 3 files changed, 88 insertions(+), 33 deletions(-)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index a93a1878de..a7b487ff33 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1523,7 +1523,8 @@ static void ahci_clear_cmd_issue(AHCIDevice *ad, uint8_t slot)
 {
     IDEState *ide_state = &ad->port.ifs[0];
 
-    if (!(ide_state->status & (BUSY_STAT | DRQ_STAT))) {
+    if (!(ide_state->status & ERR_STAT) &&
+        !(ide_state->status & (BUSY_STAT | DRQ_STAT))) {
         ad->port_regs.cmd_issue &= ~(1 << slot);
     }
 }
@@ -1532,6 +1533,7 @@ static void ahci_clear_cmd_issue(AHCIDevice *ad, uint8_t slot)
 static void ahci_cmd_done(const IDEDMA *dma)
 {
     AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma);
+    IDEState *ide_state = &ad->port.ifs[0];
 
     trace_ahci_cmd_done(ad->hba, ad->port_no);
 
@@ -1548,7 +1550,8 @@ static void ahci_cmd_done(const IDEDMA *dma)
      */
     ahci_write_fis_d2h(ad, true);
 
-    if (ad->port_regs.cmd_issue && !ad->check_bh) {
+    if (!(ide_state->status & ERR_STAT) &&
+        ad->port_regs.cmd_issue && !ad->check_bh) {
         ad->check_bh = qemu_bh_new_guarded(ahci_check_cmd_bh, ad,
                                            &ad->mem_reentrancy_guard);
         qemu_bh_schedule(ad->check_bh);
diff --git a/tests/qtest/libqos/ahci.c b/tests/qtest/libqos/ahci.c
index f53f12aa99..a2c94c6e06 100644
--- a/tests/qtest/libqos/ahci.c
+++ b/tests/qtest/libqos/ahci.c
@@ -404,57 +404,110 @@ void ahci_port_clear(AHCIQState *ahci, uint8_t port)
 /**
  * Check a port for errors.
  */
-void ahci_port_check_error(AHCIQState *ahci, uint8_t port,
-                           uint32_t imask, uint8_t emask)
+void ahci_port_check_error(AHCIQState *ahci, AHCICommand *cmd)
 {
+    uint8_t port = cmd->port;
     uint32_t reg;
 
-    /* The upper 9 bits of the IS register all indicate errors. */
-    reg = ahci_px_rreg(ahci, port, AHCI_PX_IS);
-    reg &= ~imask;
-    reg >>= 23;
-    g_assert_cmphex(reg, ==, 0);
+    /* If expecting TF error, ensure that TFES is set. */
+    if (cmd->errors) {
+        reg = ahci_px_rreg(ahci, port, AHCI_PX_IS);
+        ASSERT_BIT_SET(reg, AHCI_PX_IS_TFES);
+    } else {
+        /* The upper 9 bits of the IS register all indicate errors. */
+        reg = ahci_px_rreg(ahci, port, AHCI_PX_IS);
+        reg &= ~cmd->interrupts;
+        reg >>= 23;
+        g_assert_cmphex(reg, ==, 0);
+    }
 
-    /* The Sata Error Register should be empty. */
+    /* The Sata Error Register should be empty, even when expecting TF error. */
     reg = ahci_px_rreg(ahci, port, AHCI_PX_SERR);
     g_assert_cmphex(reg, ==, 0);
 
+    /* If expecting TF error, and TFES was set, perform error recovery
+     * (see AHCI 1.3 section 6.2.2.1) such that we can send new commands. */
+    if (cmd->errors) {
+        /* This will clear PxCI. */
+        ahci_px_clr(ahci, port, AHCI_PX_CMD, AHCI_PX_CMD_ST);
+
+        /* The port has 500ms to disengage. */
+        usleep(500000);
+        reg = ahci_px_rreg(ahci, port, AHCI_PX_CMD);
+        ASSERT_BIT_CLEAR(reg, AHCI_PX_CMD_CR);
+
+        /* Clear PxIS. */
+        reg = ahci_px_rreg(ahci, port, AHCI_PX_IS);
+        ahci_px_wreg(ahci, port, AHCI_PX_IS, reg);
+
+        /* Check if we need to perform a COMRESET.
+         * Not implemented right now, as there is no reason why our QEMU model
+         * should need a COMRESET when expecting TF error. */
+        reg = ahci_px_rreg(ahci, port, AHCI_PX_TFD);
+        ASSERT_BIT_CLEAR(reg, AHCI_PX_TFD_STS_BSY | AHCI_PX_TFD_STS_DRQ);
+
+        /* Enable issuing new commands. */
+        ahci_px_set(ahci, port, AHCI_PX_CMD, AHCI_PX_CMD_ST);
+    }
+
     /* The TFD also has two error sections. */
     reg = ahci_px_rreg(ahci, port, AHCI_PX_TFD);
-    if (!emask) {
+    if (!cmd->errors) {
         ASSERT_BIT_CLEAR(reg, AHCI_PX_TFD_STS_ERR);
     } else {
         ASSERT_BIT_SET(reg, AHCI_PX_TFD_STS_ERR);
     }
-    ASSERT_BIT_CLEAR(reg, AHCI_PX_TFD_ERR & (~emask << 8));
-    ASSERT_BIT_SET(reg, AHCI_PX_TFD_ERR & (emask << 8));
+    ASSERT_BIT_CLEAR(reg, AHCI_PX_TFD_ERR & (~cmd->errors << 8));
+    ASSERT_BIT_SET(reg, AHCI_PX_TFD_ERR & (cmd->errors << 8));
 }
 
-void ahci_port_check_interrupts(AHCIQState *ahci, uint8_t port,
-                                uint32_t intr_mask)
+void ahci_port_check_interrupts(AHCIQState *ahci, AHCICommand *cmd)
 {
+    uint8_t port = cmd->port;
     uint32_t reg;
 
+    /* If we expect errors, error handling in ahci_port_check_error() will
+     * already have cleared PxIS, so in that case this function cannot verify
+     * and clear expected interrupts. */
+    if (cmd->errors) {
+        return;
+    }
+
     /* Check for expected interrupts */
     reg = ahci_px_rreg(ahci, port, AHCI_PX_IS);
-    ASSERT_BIT_SET(reg, intr_mask);
+    ASSERT_BIT_SET(reg, cmd->interrupts);
 
     /* Clear expected interrupts and assert all interrupts now cleared. */
-    ahci_px_wreg(ahci, port, AHCI_PX_IS, intr_mask);
+    ahci_px_wreg(ahci, port, AHCI_PX_IS, cmd->interrupts);
     g_assert_cmphex(ahci_px_rreg(ahci, port, AHCI_PX_IS), ==, 0);
 }
 
-void ahci_port_check_nonbusy(AHCIQState *ahci, uint8_t port, uint8_t slot)
+void ahci_port_check_nonbusy(AHCIQState *ahci, AHCICommand *cmd)
 {
+    uint8_t slot = cmd->slot;
+    uint8_t port = cmd->port;
     uint32_t reg;
 
-    /* Assert that the command slot is no longer busy (NCQ) */
+    /* For NCQ command with error PxSACT bit should still be set.
+     * For NCQ command without error, PxSACT bit should be cleared.
+     * For non-NCQ command, PxSACT bit should always be cleared. */
     reg = ahci_px_rreg(ahci, port, AHCI_PX_SACT);
-    ASSERT_BIT_CLEAR(reg, (1 << slot));
+    if (cmd->props->ncq && cmd->errors) {
+        ASSERT_BIT_SET(reg, (1 << slot));
+    } else {
+        ASSERT_BIT_CLEAR(reg, (1 << slot));
+    }
 
-    /* Non-NCQ */
+    /* For non-NCQ command with error, PxCI bit should still be set.
+     * For non-NCQ command without error, PxCI bit should be cleared.
+     * For NCQ command without error, PxCI bit should be cleared.
+     * For NCQ command with error, PxCI bit may or may not be cleared. */
     reg = ahci_px_rreg(ahci, port, AHCI_PX_CI);
-    ASSERT_BIT_CLEAR(reg, (1 << slot));
+    if (!cmd->props->ncq && cmd->errors) {
+        ASSERT_BIT_SET(reg, (1 << slot));
+    } else if (!cmd->errors) {
+        ASSERT_BIT_CLEAR(reg, (1 << slot));
+    }
 
     /* And assert that we are generally not busy. */
     reg = ahci_px_rreg(ahci, port, AHCI_PX_TFD);
@@ -1207,9 +1260,10 @@ void ahci_command_wait(AHCIQState *ahci, AHCICommand *cmd)
 
 #define RSET(REG, MASK) (BITSET(ahci_px_rreg(ahci, cmd->port, (REG)), (MASK)))
 
-    while (RSET(AHCI_PX_TFD, AHCI_PX_TFD_STS_BSY) ||
-           RSET(AHCI_PX_CI, 1 << cmd->slot) ||
-           (cmd->props->ncq && RSET(AHCI_PX_SACT, 1 << cmd->slot))) {
+    while (!RSET(AHCI_PX_TFD, AHCI_PX_TFD_STS_ERR) &&
+           (RSET(AHCI_PX_TFD, AHCI_PX_TFD_STS_BSY) ||
+            RSET(AHCI_PX_CI, 1 << cmd->slot) ||
+            (cmd->props->ncq && RSET(AHCI_PX_SACT, 1 << cmd->slot)))) {
         usleep(50);
     }
 
@@ -1226,9 +1280,9 @@ void ahci_command_verify(AHCIQState *ahci, AHCICommand *cmd)
     uint8_t slot = cmd->slot;
     uint8_t port = cmd->port;
 
-    ahci_port_check_error(ahci, port, cmd->interrupts, cmd->errors);
-    ahci_port_check_interrupts(ahci, port, cmd->interrupts);
-    ahci_port_check_nonbusy(ahci, port, slot);
+    ahci_port_check_nonbusy(ahci, cmd);
+    ahci_port_check_error(ahci, cmd);
+    ahci_port_check_interrupts(ahci, cmd);
     ahci_port_check_cmd_sanity(ahci, cmd);
     if (cmd->interrupts & AHCI_PX_IS_DHRS) {
         ahci_port_check_d2h_sanity(ahci, port, slot);
diff --git a/tests/qtest/libqos/ahci.h b/tests/qtest/libqos/ahci.h
index 88835b6228..48017864bf 100644
--- a/tests/qtest/libqos/ahci.h
+++ b/tests/qtest/libqos/ahci.h
@@ -590,11 +590,9 @@ void ahci_set_command_header(AHCIQState *ahci, uint8_t port,
 void ahci_destroy_command(AHCIQState *ahci, uint8_t port, uint8_t slot);
 
 /* AHCI sanity check routines */
-void ahci_port_check_error(AHCIQState *ahci, uint8_t port,
-                           uint32_t imask, uint8_t emask);
-void ahci_port_check_interrupts(AHCIQState *ahci, uint8_t port,
-                                uint32_t intr_mask);
-void ahci_port_check_nonbusy(AHCIQState *ahci, uint8_t port, uint8_t slot);
+void ahci_port_check_error(AHCIQState *ahci, AHCICommand *cmd);
+void ahci_port_check_interrupts(AHCIQState *ahci, AHCICommand *cmd);
+void ahci_port_check_nonbusy(AHCIQState *ahci, AHCICommand *cmd);
 void ahci_port_check_d2h_sanity(AHCIQState *ahci, uint8_t port, uint8_t slot);
 void ahci_port_check_pio_sanity(AHCIQState *ahci, AHCICommand *cmd);
 void ahci_port_check_cmd_sanity(AHCIQState *ahci, AHCICommand *cmd);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:03:00 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:03:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814162.1227403 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTX2-0001LF-9K; Wed, 09 Oct 2024 10:03:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814162.1227403; Wed, 09 Oct 2024 10:03:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTX2-0001L8-6X; Wed, 09 Oct 2024 10:03:00 +0000
Received: by outflank-mailman (input) for mailman id 814162;
 Wed, 09 Oct 2024 10:02:59 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTX1-0001L2-II
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:02:59 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTX1-0006G6-He
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:02:59 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTX1-0006dV-Gq
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:02:59 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=z8ZCBoC8bCsLvD10ihX2r5WFZSTULgNZoDWRtJCz32k=; b=x4YNAbuyiVCSiMzpp2mSBPU9bx
	5bIXqA7U5NwtPeEpTAk1CCCgZnL6Gm3U5elRwIdC5K9+kTzQ3FgBoi9KKY0BtDUb3F2yBJLk97rAT
	LZ5bWbNvpA7w3EWjmyPKVHNemD0LWYYgsPf4yMIlDtMFxcbUsUDLlhuaw8pbqt1kuVy8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/ide/ahci: fix ahci_write_fis_sdb()
Message-Id: <E1syTX1-0006dV-Gq@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:02:59 +0000

commit 9c7e2253eba2e057f11377beb64dd78d12a1e27d
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:43 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    hw/ide/ahci: fix ahci_write_fis_sdb()
    
    When there is an error, we need to raise a TFES error irq, see AHCI 1.3.1,
    5.3.13.1 SDB:Entry.
    
    If ERR_STAT is set, we jump to state ERR:FatalTaskfile, which will raise
    a TFES IRQ unconditionally, regardless if the I bit is set in the FIS or
    not.
    
    Thus, we should never raise a normal IRQ after having sent an error IRQ.
    
    It is valid to signal successfully completed commands as finished in the
    same SDB FIS that generates the error IRQ. The important thing is that
    commands that did not complete successfully (e.g. commands that were
    aborted, do not get the finished bit set).
    
    Before this commit, there was never a TFES IRQ raised on NCQ error.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20230609140844.202795-8-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit 7e85cb0db4c693b4e084a00e66fe73a22ed1688a)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/ahci.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index a7b487ff33..8ce3dd796e 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -806,8 +806,14 @@ static void ahci_write_fis_sdb(AHCIState *s, NCQTransferState *ncq_tfs)
     pr->scr_act &= ~ad->finished;
     ad->finished = 0;
 
-    /* Trigger IRQ if interrupt bit is set (which currently, it always is) */
-    if (sdb_fis->flags & 0x40) {
+    /*
+     * TFES IRQ is always raised if ERR_STAT is set, regardless of I bit.
+     * If ERR_STAT is not set, trigger SDBS IRQ if interrupt bit is set
+     * (which currently, it always is).
+     */
+    if (sdb_fis->status & ERR_STAT) {
+        ahci_trigger_irq(s, ad, AHCI_PORT_IRQ_BIT_TFES);
+    } else if (sdb_fis->flags & 0x40) {
         ahci_trigger_irq(s, ad, AHCI_PORT_IRQ_BIT_SDBS);
     }
 }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:03:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:03:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814163.1227408 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTXC-0001Qz-CO; Wed, 09 Oct 2024 10:03:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814163.1227408; Wed, 09 Oct 2024 10:03:10 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTXC-0001Qr-9D; Wed, 09 Oct 2024 10:03:10 +0000
Received: by outflank-mailman (input) for mailman id 814163;
 Wed, 09 Oct 2024 10:03:09 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTXB-0001Qe-LH
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:03:09 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTXB-0006GQ-Kg
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:03:09 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTXB-0006fH-Js
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:03:09 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LDgFwncW8O/LlK2LCeeWGVqGKTbIgw7LEI2YcsSRI8U=; b=H7UQRtzM6t0I+eZqBCzQn5p0lb
	yn+qHoRkllxtZFhTZfU/idGmOlcbTI8jn7xmEy/jSZ8XAYVz96/uUTBWKgoOJIwjdmctVcHyf3cG5
	HHHNueXOi5Acw1OXwKhnFuIkXTyCVOSJfIIV6VmKh7BJ+jOAKABhg9ZHWAtLEZmki4B4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/ide/ahci: fix broken SError handling
Message-Id: <E1syTXB-0006fH-Js@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:03:09 +0000

commit 4f6c55371743ba9d6512fcf4a88a5b5b8936037e
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:44 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    hw/ide/ahci: fix broken SError handling
    
    When encountering an NCQ error, you should not write the NCQ tag to the
    SError register. This is completely wrong.
    
    The SError register has a clear definition, where each bit represents a
    different error, see PxSERR definition in AHCI 1.3.1.
    
    If we write a random value (like the NCQ tag) in SError, e.g. Linux will
    read SError, and will trigger arbitrary error handling depending on the
    NCQ tag that happened to be executing.
    
    In case of success, ncq_cb() will call ncq_finish().
    In case of error, ncq_cb() will call ncq_err() (which will clear
    ncq_tfs->used), and then call ncq_finish(), thus using ncq_tfs->used is
    sufficient to tell if finished should get set or not.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20230609140844.202795-9-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit 9f89423537653de07ca40c18b5ff5b70b104cc93)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/ahci.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 8ce3dd796e..29ddd4b6c4 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1012,7 +1012,6 @@ static void ncq_err(NCQTransferState *ncq_tfs)
 
     ide_state->error = ABRT_ERR;
     ide_state->status = READY_STAT | ERR_STAT;
-    ncq_tfs->drive->port_regs.scr_err |= (1 << ncq_tfs->tag);
     qemu_sglist_destroy(&ncq_tfs->sglist);
     ncq_tfs->used = 0;
 }
@@ -1022,7 +1021,7 @@ static void ncq_finish(NCQTransferState *ncq_tfs)
     /* If we didn't error out, set our finished bit. Errored commands
      * do not get a bit set for the SDB FIS ACT register, nor do they
      * clear the outstanding bit in scr_act (PxSACT). */
-    if (!(ncq_tfs->drive->port_regs.scr_err & (1 << ncq_tfs->tag))) {
+    if (ncq_tfs->used) {
         ncq_tfs->drive->finished |= (1 << ncq_tfs->tag);
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:03:21 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:03:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814164.1227411 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTXN-0001V5-DK; Wed, 09 Oct 2024 10:03:21 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814164.1227411; Wed, 09 Oct 2024 10:03:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTXN-0001Ux-Ag; Wed, 09 Oct 2024 10:03:21 +0000
Received: by outflank-mailman (input) for mailman id 814164;
 Wed, 09 Oct 2024 10:03:19 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTXL-0001Uo-Q0
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:03:19 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTXL-0006GZ-OB
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:03:19 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTXL-0006gJ-NA
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:03:19 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=d11QKoOsDlGGcTPUfGYet2NKkWx5p9QHqTE141wRlH0=; b=OPnaNxqRZJBvOCNEIXJS3M/3j2
	Nt/XLJy7k/pL4h9xYvhpvcdMMEbakyK/cvnUhKio0cb39Ou+KT6iw8V66Lzt6ANaQ5JXi32FzC0Bm
	Mx5he3h/ovlZ03UnG5VHvDoICsACJ1U26eHTeHaGS6+6E1/QaEHwLYn339rrcp10o2pY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/i2c/aspeed: Fix Tx count and Rx size error in buffer pool mode
Message-Id: <E1syTXL-0006gJ-NA@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:03:19 +0000

commit 4a398e64ba8e9c1eced75217d856668c0d17e62e
Author:     Hang Yu <francis_yuu@stu.pku.edu.cn>
AuthorDate: Sat Aug 12 14:52:28 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    hw/i2c/aspeed: Fix Tx count and Rx size error in buffer pool mode
    
    Fixed inconsistency between the regisiter bit field definition header file
    and the ast2600 datasheet. The reg name is I2CD1C:Pool Buffer Control
    Register in old register mode and  I2CC0C: Master/Slave Pool Buffer Control
    Register in new register mode. They share bit field
    [12:8]:Transmit Data Byte Count and bit field
    [29:24]:Actual Received Pool Buffer Size according to the datasheet.
    According to the ast2600 datasheet,the actual Tx count is
    Transmit Data Byte Count plus 1, and the max Rx size is
    Receive Pool Buffer Size plus 1, both in Pool Buffer Control Register.
    The version before forgot to plus 1, and mistake Rx count for Rx size.
    
    Signed-off-by: Hang Yu <francis_yuu@stu.pku.edu.cn>
    Fixes: 3be3d6ccf2ad ("aspeed: i2c: Migrate to registerfields API")
    Reviewed-by: Cédric Le Goater <clg@kaod.org>
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    (cherry picked from commit 97b8aa5ae9ff197394395eda5062ea3681e09c28)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/i2c/aspeed_i2c.c         | 8 ++++----
 include/hw/i2c/aspeed_i2c.h | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/i2c/aspeed_i2c.c b/hw/i2c/aspeed_i2c.c
index 1f071a3811..e485d8bfb8 100644
--- a/hw/i2c/aspeed_i2c.c
+++ b/hw/i2c/aspeed_i2c.c
@@ -236,7 +236,7 @@ static int aspeed_i2c_bus_send(AspeedI2CBus *bus, uint8_t pool_start)
     uint32_t reg_byte_buf = aspeed_i2c_bus_byte_buf_offset(bus);
     uint32_t reg_dma_len = aspeed_i2c_bus_dma_len_offset(bus);
     int pool_tx_count = SHARED_ARRAY_FIELD_EX32(bus->regs, reg_pool_ctrl,
-                                                TX_COUNT);
+                                                TX_COUNT) + 1;
 
     if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_BUFF_EN)) {
         for (i = pool_start; i < pool_tx_count; i++) {
@@ -293,7 +293,7 @@ static void aspeed_i2c_bus_recv(AspeedI2CBus *bus)
     uint32_t reg_dma_len = aspeed_i2c_bus_dma_len_offset(bus);
     uint32_t reg_dma_addr = aspeed_i2c_bus_dma_addr_offset(bus);
     int pool_rx_count = SHARED_ARRAY_FIELD_EX32(bus->regs, reg_pool_ctrl,
-                                                RX_COUNT);
+                                                RX_SIZE) + 1;
 
     if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, RX_BUFF_EN)) {
         uint8_t *pool_base = aic->bus_pool_base(bus);
@@ -418,7 +418,7 @@ static void aspeed_i2c_bus_cmd_dump(AspeedI2CBus *bus)
     uint32_t reg_intr_sts = aspeed_i2c_bus_intr_sts_offset(bus);
     uint32_t reg_dma_len = aspeed_i2c_bus_dma_len_offset(bus);
     if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, RX_BUFF_EN)) {
-        count = SHARED_ARRAY_FIELD_EX32(bus->regs, reg_pool_ctrl, TX_COUNT);
+        count = SHARED_ARRAY_FIELD_EX32(bus->regs, reg_pool_ctrl, TX_COUNT) + 1;
     } else if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, RX_DMA_EN)) {
         count = bus->regs[reg_dma_len];
     } else { /* BYTE mode */
@@ -490,7 +490,7 @@ static void aspeed_i2c_bus_handle_cmd(AspeedI2CBus *bus, uint64_t value)
          */
         if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_BUFF_EN)) {
             if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_pool_ctrl, TX_COUNT)
-                == 1) {
+                == 0) {
                 SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, M_TX_CMD, 0);
             } else {
                 /*
diff --git a/include/hw/i2c/aspeed_i2c.h b/include/hw/i2c/aspeed_i2c.h
index adc904d6c1..91d0e7157c 100644
--- a/include/hw/i2c/aspeed_i2c.h
+++ b/include/hw/i2c/aspeed_i2c.h
@@ -132,9 +132,9 @@ REG32(I2CD_CMD, 0x14) /* I2CD Command/Status */
 REG32(I2CD_DEV_ADDR, 0x18) /* Slave Device Address */
     SHARED_FIELD(SLAVE_DEV_ADDR1, 0, 7)
 REG32(I2CD_POOL_CTRL, 0x1C) /* Pool Buffer Control */
-    SHARED_FIELD(RX_COUNT, 24, 5)
+    SHARED_FIELD(RX_COUNT, 24, 6)
     SHARED_FIELD(RX_SIZE, 16, 5)
-    SHARED_FIELD(TX_COUNT, 9, 5)
+    SHARED_FIELD(TX_COUNT, 8, 5)
     FIELD(I2CD_POOL_CTRL, OFFSET, 2, 6) /* AST2400 */
 REG32(I2CD_BYTE_BUF, 0x20) /* Transmit/Receive Byte Buffer */
     SHARED_FIELD(RX_BUF, 8, 8)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:03:31 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:03:31 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814165.1227414 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTXX-0001aQ-Eh; Wed, 09 Oct 2024 10:03:31 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814165.1227414; Wed, 09 Oct 2024 10:03:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTXX-0001aI-C5; Wed, 09 Oct 2024 10:03:31 +0000
Received: by outflank-mailman (input) for mailman id 814165;
 Wed, 09 Oct 2024 10:03:29 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTXV-0001a5-Rw
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:03:29 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTXV-0006Gg-RG
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:03:29 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTXV-0006ia-QZ
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:03:29 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SS2EXpHLeyQDwcK2R2lfc1OhqOr9AFZ7YuPp9mq/9uQ=; b=NUCLOG4VPEqEVRbYHUDRe+gNyG
	GSJOyERjeCD06Kh2lY8937GP/HLnBxZzaMbnAsywz8tkZ6TKNwsLuEjo+0+vBtzw7+BeKb4lK7Pas
	O+ZUazGJD91cBNPiS5iiI/x7lAlsh1RZSbZSFe1wEALppNcsgF1F0EVlBXrKo6zjuO9I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/i2c/aspeed: Fix TXBUF transmission start position error
Message-Id: <E1syTXV-0006ia-QZ@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:03:29 +0000

commit c2ec46c694a176a2ced6d8b62f0ec40569f4a83d
Author:     Hang Yu <francis_yuu@stu.pku.edu.cn>
AuthorDate: Sat Aug 12 14:52:29 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    hw/i2c/aspeed: Fix TXBUF transmission start position error
    
    According to the ast2600 datasheet and the linux aspeed i2c driver,
    the TXBUF transmission start position should be TXBUF[0] instead
    of TXBUF[1],so the arg pool_start is useless,and the address is not
    included in TXBUF.So even if Tx Count equals zero,there is at least
    1 byte data needs to be transmitted,and M_TX_CMD should not be cleared
    at this condition.The driver url is:
    https://github.com/AspeedTech-BMC/linux/blob/aspeed-master-v5.15/drivers/i2c/busses/i2c-ast2600.c
    
    Signed-off-by: Hang Yu <francis_yuu@stu.pku.edu.cn>
    Fixes: 6054fc73e8f4 ("aspeed/i2c: Add support for pool buffer transfers")
    Reviewed-by: Cédric Le Goater <clg@kaod.org>
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    (cherry picked from commit 961faf3ddbd8ffcdf776bbcf88af0bc97218114a)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/i2c/aspeed_i2c.c | 30 ++++++------------------------
 1 file changed, 6 insertions(+), 24 deletions(-)

diff --git a/hw/i2c/aspeed_i2c.c b/hw/i2c/aspeed_i2c.c
index e485d8bfb8..44905d7899 100644
--- a/hw/i2c/aspeed_i2c.c
+++ b/hw/i2c/aspeed_i2c.c
@@ -226,7 +226,7 @@ static int aspeed_i2c_dma_read(AspeedI2CBus *bus, uint8_t *data)
     return 0;
 }
 
-static int aspeed_i2c_bus_send(AspeedI2CBus *bus, uint8_t pool_start)
+static int aspeed_i2c_bus_send(AspeedI2CBus *bus)
 {
     AspeedI2CClass *aic = ASPEED_I2C_GET_CLASS(bus->controller);
     int ret = -1;
@@ -239,7 +239,7 @@ static int aspeed_i2c_bus_send(AspeedI2CBus *bus, uint8_t pool_start)
                                                 TX_COUNT) + 1;
 
     if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_BUFF_EN)) {
-        for (i = pool_start; i < pool_tx_count; i++) {
+        for (i = 0; i < pool_tx_count; i++) {
             uint8_t *pool_base = aic->bus_pool_base(bus);
 
             trace_aspeed_i2c_bus_send("BUF", i + 1, pool_tx_count,
@@ -273,7 +273,7 @@ static int aspeed_i2c_bus_send(AspeedI2CBus *bus, uint8_t pool_start)
         }
         SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, TX_DMA_EN, 0);
     } else {
-        trace_aspeed_i2c_bus_send("BYTE", pool_start, 1,
+        trace_aspeed_i2c_bus_send("BYTE", 0, 1,
                                   bus->regs[reg_byte_buf]);
         ret = i2c_send(bus->bus, bus->regs[reg_byte_buf]);
     }
@@ -446,10 +446,8 @@ static void aspeed_i2c_bus_cmd_dump(AspeedI2CBus *bus)
  */
 static void aspeed_i2c_bus_handle_cmd(AspeedI2CBus *bus, uint64_t value)
 {
-    uint8_t pool_start = 0;
     uint32_t reg_intr_sts = aspeed_i2c_bus_intr_sts_offset(bus);
     uint32_t reg_cmd = aspeed_i2c_bus_cmd_offset(bus);
-    uint32_t reg_pool_ctrl = aspeed_i2c_bus_pool_ctrl_offset(bus);
     uint32_t reg_dma_len = aspeed_i2c_bus_dma_len_offset(bus);
 
     if (!aspeed_i2c_check_sram(bus)) {
@@ -483,27 +481,11 @@ static void aspeed_i2c_bus_handle_cmd(AspeedI2CBus *bus, uint64_t value)
 
         SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, M_START_CMD, 0);
 
-        /*
-         * The START command is also a TX command, as the slave
-         * address is sent on the bus. Drop the TX flag if nothing
-         * else needs to be sent in this sequence.
-         */
-        if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_BUFF_EN)) {
-            if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_pool_ctrl, TX_COUNT)
-                == 0) {
-                SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, M_TX_CMD, 0);
-            } else {
-                /*
-                 * Increase the start index in the TX pool buffer to
-                 * skip the address byte.
-                 */
-                pool_start++;
-            }
-        } else if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_DMA_EN)) {
+        if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_DMA_EN)) {
             if (bus->regs[reg_dma_len] == 0) {
                 SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, M_TX_CMD, 0);
             }
-        } else {
+        } else if (!SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_BUFF_EN)) {
             SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, M_TX_CMD, 0);
         }
 
@@ -520,7 +502,7 @@ static void aspeed_i2c_bus_handle_cmd(AspeedI2CBus *bus, uint64_t value)
 
     if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, M_TX_CMD)) {
         aspeed_i2c_set_state(bus, I2CD_MTXD);
-        if (aspeed_i2c_bus_send(bus, pool_start)) {
+        if (aspeed_i2c_bus_send(bus)) {
             SHARED_ARRAY_FIELD_DP32(bus->regs, reg_intr_sts, TX_NAK, 1);
             i2c_end_transfer(bus->bus);
         } else {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:03:41 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:03:41 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814166.1227420 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTXh-0001jY-GS; Wed, 09 Oct 2024 10:03:41 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814166.1227420; Wed, 09 Oct 2024 10:03:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTXh-0001jP-Db; Wed, 09 Oct 2024 10:03:41 +0000
Received: by outflank-mailman (input) for mailman id 814166;
 Wed, 09 Oct 2024 10:03:40 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTXf-0001fQ-VA
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:03:39 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTXf-0006H7-UV
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:03:39 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTXf-0006jJ-Tn
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:03:39 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=AkiYdKmEKR67rN/A7vGZfxgbYwbiO1RQ+THobL3Jt+w=; b=Eo0wX9BBo6iOQar0OURV16f+K2
	YJhf8vjDKBHYy8tkLd6A/btTxaJ69C9IRnplWJE6Xtvj7L5MQNx3A5vD77qWcml/dmp7FH0x1JT2s
	iiroV5rll/nmGb34tdyc5kDIPqCFx5idiP0Hrh4i3WTjXtSsN+rIEFnKZpvsPOfCavZo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] qemu-options.hx: Rephrase the descriptions of the -hd* and -cdrom options
Message-Id: <E1syTXf-0006jJ-Tn@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:03:39 +0000

commit 45b61f730d953b713dc2bb8b695d6555a5b8adb6
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Tue Aug 29 15:29:48 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    qemu-options.hx: Rephrase the descriptions of the -hd* and -cdrom options
    
    The current description says that these options will create a device
    on the IDE bus, which is only true on x86. So rephrase these sentences
    a little bit to speak of "default bus" instead.
    
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (cherry picked from commit bcd8e243083c878884e52d609deddbe6be17c730)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 qemu-options.hx | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/qemu-options.hx b/qemu-options.hx
index fdddfab6ff..af8156d2f8 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1174,10 +1174,10 @@ SRST
 ERST
 
 DEF("hda", HAS_ARG, QEMU_OPTION_hda,
-    "-hda/-hdb file  use 'file' as IDE hard disk 0/1 image\n", QEMU_ARCH_ALL)
+    "-hda/-hdb file  use 'file' as hard disk 0/1 image\n", QEMU_ARCH_ALL)
 DEF("hdb", HAS_ARG, QEMU_OPTION_hdb, "", QEMU_ARCH_ALL)
 DEF("hdc", HAS_ARG, QEMU_OPTION_hdc,
-    "-hdc/-hdd file  use 'file' as IDE hard disk 2/3 image\n", QEMU_ARCH_ALL)
+    "-hdc/-hdd file  use 'file' as hard disk 2/3 image\n", QEMU_ARCH_ALL)
 DEF("hdd", HAS_ARG, QEMU_OPTION_hdd, "", QEMU_ARCH_ALL)
 SRST
 ``-hda file``
@@ -1187,18 +1187,22 @@ SRST
 ``-hdc file``
   \ 
 ``-hdd file``
-    Use file as hard disk 0, 1, 2 or 3 image (see the :ref:`disk images`
-    chapter in the System Emulation Users Guide).
+    Use file as hard disk 0, 1, 2 or 3 image on the default bus of the
+    emulated machine (this is for example the IDE bus on most x86 machines,
+    but it can also be SCSI, virtio or something else on other target
+    architectures). See also the :ref:`disk images` chapter in the System
+    Emulation Users Guide.
 ERST
 
 DEF("cdrom", HAS_ARG, QEMU_OPTION_cdrom,
-    "-cdrom file     use 'file' as IDE cdrom image (cdrom is ide1 master)\n",
+    "-cdrom file     use 'file' as CD-ROM image\n",
     QEMU_ARCH_ALL)
 SRST
 ``-cdrom file``
-    Use file as CD-ROM image (you cannot use ``-hdc`` and ``-cdrom`` at
-    the same time). You can use the host CD-ROM by using ``/dev/cdrom``
-    as filename.
+    Use file as CD-ROM image on the default bus of the emulated machine
+    (which is IDE1 master on x86, so you cannot use ``-hdc`` and ``-cdrom``
+    at the same time there). On systems that support it, you can use the
+    host CD-ROM by using ``/dev/cdrom`` as filename.
 ERST
 
 DEF("blockdev", HAS_ARG, QEMU_OPTION_blockdev,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:03:51 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:03:51 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814167.1227422 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTXr-0001nQ-HR; Wed, 09 Oct 2024 10:03:51 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814167.1227422; Wed, 09 Oct 2024 10:03:51 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTXr-0001nJ-Ey; Wed, 09 Oct 2024 10:03:51 +0000
Received: by outflank-mailman (input) for mailman id 814167;
 Wed, 09 Oct 2024 10:03:50 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTXq-0001n8-1x
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:03:50 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTXq-0006HE-1J
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:03:50 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTXq-0006k7-0c
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:03:50 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=th0S693xJ4SrhfbqqHFXLD/pomvyo9c8OAoIu43Yobw=; b=5vhoeiv/i80lOur7s5Zp9PN75u
	Gq3DH5/ry6+lF2RSy7xBfmvaUkIfz1CPbEObdJGAZRfbj+3gHGrudN5HL5fPn6+8q+5z4pxkPfqkG
	LV24hXbufEVxopq2DP738peJ5whBVMq56n6cHf+2Ouelv4Xkv0u73mUBxs2nzhXFyRU0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] docs tests: Fix use of migrate_set_parameter
Message-Id: <E1syTXq-0006k7-0c@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:03:50 +0000

commit 42edb4723afe4a94a7c8011fa7fe02c3846cdc7e
Author:     Markus Armbruster <armbru@redhat.com>
AuthorDate: Fri Aug 25 17:59:22 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    docs tests: Fix use of migrate_set_parameter
    
    docs/multi-thread-compression.txt uses parameter names with
    underscores instead of dashes.  Wrong since day one.
    
    docs/rdma.txt, tests/qemu-iotests/181, and tests/qtest/test-hmp.c are
    wrong the same way since commit cbde7be900d2 (v6.0.0).  Hard to see,
    as test-hmp doesn't check whether the commands work, and iotest 181
    appears to be unaffected.
    
    Fixes: 263170e679df (docs: Add a doc about multiple thread compression)
    Fixes: cbde7be900d2 (migrate: remove QMP/HMP commands for speed, downtime and cache size)
    Signed-off-by: Markus Armbruster <armbru@redhat.com>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (cherry picked from commit b21a6e31a182a5ae7436a444f840d49aac07c94f)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 docs/multi-thread-compression.txt | 12 ++++++------
 docs/rdma.txt                     |  2 +-
 tests/qemu-iotests/181            |  2 +-
 tests/qtest/test-hmp.c            |  6 +++---
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/docs/multi-thread-compression.txt b/docs/multi-thread-compression.txt
index bb88c6bdf1..95b1556f67 100644
--- a/docs/multi-thread-compression.txt
+++ b/docs/multi-thread-compression.txt
@@ -117,13 +117,13 @@ to support the multiple thread compression migration:
     {qemu} migrate_set_capability compress on
 
 3. Set the compression thread count on source:
-    {qemu} migrate_set_parameter compress_threads 12
+    {qemu} migrate_set_parameter compress-threads 12
 
 4. Set the compression level on the source:
-    {qemu} migrate_set_parameter compress_level 1
+    {qemu} migrate_set_parameter compress-level 1
 
 5. Set the decompression thread count on destination:
-    {qemu} migrate_set_parameter decompress_threads 3
+    {qemu} migrate_set_parameter decompress-threads 3
 
 6. Start outgoing migration:
     {qemu} migrate -d tcp:destination.host:4444
@@ -133,9 +133,9 @@ to support the multiple thread compression migration:
 
 The following are the default settings:
     compress: off
-    compress_threads: 8
-    decompress_threads: 2
-    compress_level: 1 (which means best speed)
+    compress-threads: 8
+    decompress-threads: 2
+    compress-level: 1 (which means best speed)
 
 So, only the first two steps are required to use the multiple
 thread compression in migration. You can do more if the default
diff --git a/docs/rdma.txt b/docs/rdma.txt
index 2b4cdea1d8..bd8dd799a9 100644
--- a/docs/rdma.txt
+++ b/docs/rdma.txt
@@ -89,7 +89,7 @@ RUNNING:
 First, set the migration speed to match your hardware's capabilities:
 
 QEMU Monitor Command:
-$ migrate_set_parameter max_bandwidth 40g # or whatever is the MAX of your RDMA device
+$ migrate_set_parameter max-bandwidth 40g # or whatever is the MAX of your RDMA device
 
 Next, on the destination machine, add the following to the QEMU command line:
 
diff --git a/tests/qemu-iotests/181 b/tests/qemu-iotests/181
index cb96d09ae5..dc90a10757 100755
--- a/tests/qemu-iotests/181
+++ b/tests/qemu-iotests/181
@@ -109,7 +109,7 @@ if [ ${QEMU_STATUS[$dest]} -lt 0 ]; then
     _notrun 'Postcopy is not supported'
 fi
 
-_send_qemu_cmd $src 'migrate_set_parameter max_bandwidth 4k' "(qemu)"
+_send_qemu_cmd $src 'migrate_set_parameter max-bandwidth 4k' "(qemu)"
 _send_qemu_cmd $src 'migrate_set_capability postcopy-ram on' "(qemu)"
 _send_qemu_cmd $src "migrate -d unix:${MIG_SOCKET}" "(qemu)"
 _send_qemu_cmd $src 'migrate_start_postcopy' "(qemu)"
diff --git a/tests/qtest/test-hmp.c b/tests/qtest/test-hmp.c
index b4a920df89..e75523f882 100644
--- a/tests/qtest/test-hmp.c
+++ b/tests/qtest/test-hmp.c
@@ -45,9 +45,9 @@ static const char *hmp_cmds[] = {
     "log all",
     "log none",
     "memsave 0 4096 \"/dev/null\"",
-    "migrate_set_parameter xbzrle_cache_size 1",
-    "migrate_set_parameter downtime_limit 1",
-    "migrate_set_parameter max_bandwidth 1",
+    "migrate_set_parameter xbzrle-cache-size 1",
+    "migrate_set_parameter downtime-limit 1",
+    "migrate_set_parameter max-bandwidth 1",
     "netdev_add user,id=net1",
     "set_link net1 off",
     "set_link net1 on",
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:04:01 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:04:01 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814168.1227427 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTY1-0001sm-JC; Wed, 09 Oct 2024 10:04:01 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814168.1227427; Wed, 09 Oct 2024 10:04:01 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTY1-0001se-GN; Wed, 09 Oct 2024 10:04:01 +0000
Received: by outflank-mailman (input) for mailman id 814168;
 Wed, 09 Oct 2024 10:04:00 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTY0-0001r0-54
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:04:00 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTY0-0006HL-4P
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:04:00 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTY0-0006lY-3X
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:04:00 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kYkiK8lSQcodb82Rjw5gq+chwZT/mW/vih6dU6Qshv0=; b=WeoXRbjJ8wwNvhY4TkIMfhQByi
	K3Eb3+UZ67XXvBccnZmgHw+Z+yKB7Uh9ohV97J0UxUKuVCVGRZz6IYka3OnI+0cUAIMLCitLNEDZJ
	mFgAr9HiltgX4M3v3ja/03DYlBcPIn6lG9glc+CTFu6YSbjJVxYp7LFBJsxg10Y+WTD8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/net/vmxnet3: Fix guest-triggerable assert()
Message-Id: <E1syTY0-0006lY-3X@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:04:00 +0000

commit c68b844d3376764240afdb3c55d451e4dac11004
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Thu Aug 17 14:56:00 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    hw/net/vmxnet3: Fix guest-triggerable assert()
    
    The assert() that checks for valid MTU sizes can be triggered by
    the guest (e.g. with the reproducer code from the bug ticket
    https://gitlab.com/qemu-project/qemu/-/issues/517 ). Let's avoid
    this problem by simply logging the error and refusing to activate
    the device instead.
    
    Fixes: d05dcd94ae ("net: vmxnet3: validate configuration values during activate")
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    Cc: qemu-stable@nongnu.org
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    [Mjt: change format specifier from %d to %u for uint32_t argument]
    (cherry picked from commit 90a0778421acdf4ca903be64c8ed19378183c944)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/net/vmxnet3.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
index cb52db96a2..fd3b9aff5b 100644
--- a/hw/net/vmxnet3.c
+++ b/hw/net/vmxnet3.c
@@ -1439,7 +1439,10 @@ static void vmxnet3_activate_device(VMXNET3State *s)
     vmxnet3_setup_rx_filtering(s);
     /* Cache fields from shared memory */
     s->mtu = VMXNET3_READ_DRV_SHARED32(d, s->drv_shmem, devRead.misc.mtu);
-    assert(VMXNET3_MIN_MTU <= s->mtu && s->mtu <= VMXNET3_MAX_MTU);
+    if (s->mtu < VMXNET3_MIN_MTU || s->mtu > VMXNET3_MAX_MTU) {
+        qemu_log_mask(LOG_GUEST_ERROR, "vmxnet3: Bad MTU size: %u\n", s->mtu);
+        return;
+    }
     VMW_CFPRN("MTU is %u", s->mtu);
 
     s->max_rx_frags =
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:04:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:04:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814169.1227431 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTYB-0001xa-NC; Wed, 09 Oct 2024 10:04:11 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814169.1227431; Wed, 09 Oct 2024 10:04:11 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTYB-0001xS-KO; Wed, 09 Oct 2024 10:04:11 +0000
Received: by outflank-mailman (input) for mailman id 814169;
 Wed, 09 Oct 2024 10:04:10 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTYA-0001xK-88
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:04:10 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTYA-0006Hh-7R
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:04:10 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTYA-0006nJ-6l
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:04:10 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/bCIB3iMiRtZ3pJ1yeI1CswGfU54OkQ6zUxB9wOQedk=; b=QX+/h24nKaBh7mj36F/8L0UGit
	wVQXRDIwlsNfXux6Gh3Gx+94cZz3Ke622aPWYKoELxp+Mf6PvojwGEhJy2zcSHI0iFSXp1BhwPaQ0
	KwZPhWDnhhGrlsZTsNhph8tEXrxp/i+Y6IQcjiaLHCmErw8nSzh7/oJO11Eqkyj4iGD0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] qxl: don't assert() if device isn't yet initialized
Message-Id: <E1syTYA-0006nJ-6l@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:04:10 +0000

commit 5929f5309194e46f40b20aa07797f531663e323f
Author:     Marc-André Lureau <marcandre.lureau@redhat.com>
AuthorDate: Mon Aug 14 23:33:30 2023 +0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    qxl: don't assert() if device isn't yet initialized
    
    If the PCI BAR isn't yet mapped or was unmapped, QXL_IO_SET_MODE will
    assert(). Instead, report a guest bug and keep going.
    
    This can be reproduced with:
    
    cat << EOF | ./qemu-system-x86_64 -vga qxl -m 2048 -nodefaults -qtest stdio
    outl 0xcf8 0x8000101c
    outl 0xcfc 0xc000
    outl 0xcf8 0x80001001
    outl 0xcfc 0x01000000
    outl 0xc006 0x00
    EOF
    
    Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1829
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (cherry picked from commit 95bef686e490bc3afc3f51f5fc6e20bf260b938c)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/display/qxl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index f1c0eb7dfc..70b73820b2 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -1591,7 +1591,10 @@ static void qxl_set_mode(PCIQXLDevice *d, unsigned int modenr, int loadvm)
     }
 
     d->guest_slots[0].slot = slot;
-    assert(qxl_add_memslot(d, 0, devmem, QXL_SYNC) == 0);
+    if (qxl_add_memslot(d, 0, devmem, QXL_SYNC) != 0) {
+        qxl_set_guest_bug(d, "device isn't initialized yet");
+        return;
+    }
 
     d->guest_primary.surface = surface;
     qxl_create_guest_primary(d, 0, QXL_SYNC);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:04:21 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:04:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814170.1227435 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTYL-00024K-OV; Wed, 09 Oct 2024 10:04:21 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814170.1227435; Wed, 09 Oct 2024 10:04:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTYL-00024D-Lv; Wed, 09 Oct 2024 10:04:21 +0000
Received: by outflank-mailman (input) for mailman id 814170;
 Wed, 09 Oct 2024 10:04:20 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTYK-00023z-B6
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:04:20 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTYK-0006Hp-AV
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:04:20 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTYK-0006ov-9p
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:04:20 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=B5mKr7/ZAqJ7ln9nNaHuplJ16BRAAApkq7XGHtxvxsI=; b=DNkzhW9byZv9fU8ASwCb+oxiD9
	FyUCPofq1v49wmW/ywUdw9030aHaMcCMrilVl1+K8IMg6pHq1O9+giHi0Jh52m2i3w2hVFvGHv0qc
	gUs9HSdMOIf/t3oEJEA3K3SkGGkE+ZU+X/N7lY/geZbPnKO4d5q/bBeRmPeJhu3phFHQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] virtio: Drop out of coroutine context in virtio_load()
Message-Id: <E1syTYK-0006ov-9p@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:04:20 +0000

commit 41af7a9bc41c15460a4dbf4d35879d69c460d02a
Author:     Kevin Wolf <kwolf@redhat.com>
AuthorDate: Tue Sep 5 16:50:02 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Mon Sep 11 22:31:56 2023 +0300

    virtio: Drop out of coroutine context in virtio_load()
    
    virtio_load() as a whole should run in coroutine context because it
    reads from the migration stream and we don't want this to block.
    
    However, it calls virtio_set_features_nocheck() and devices don't
    expect their .set_features callback to run in a coroutine and therefore
    call functions that may not be called in coroutine context. To fix this,
    drop out of coroutine context for calling virtio_set_features_nocheck().
    
    Without this fix, the following crash was reported:
    
      #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
      #1  0x00007efc738c05d3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
      #2  0x00007efc73873d26 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
      #3  0x00007efc738477f3 in __GI_abort () at abort.c:79
      #4  0x00007efc7384771b in __assert_fail_base (fmt=0x7efc739dbcb8 "", assertion=assertion@entry=0x560aebfbf5cf "!qemu_in_coroutine()",
         file=file@entry=0x560aebfcd2d4 "../block/graph-lock.c", line=line@entry=275, function=function@entry=0x560aebfcd34d "void bdrv_graph_rdlock_main_loop(void)") at assert.c:92
      #5  0x00007efc7386ccc6 in __assert_fail (assertion=0x560aebfbf5cf "!qemu_in_coroutine()", file=0x560aebfcd2d4 "../block/graph-lock.c", line=275,
         function=0x560aebfcd34d "void bdrv_graph_rdlock_main_loop(void)") at assert.c:101
      #6  0x0000560aebcd8dd6 in bdrv_register_buf ()
      #7  0x0000560aeb97ed97 in ram_block_added.llvm ()
      #8  0x0000560aebb8303f in ram_block_add.llvm ()
      #9  0x0000560aebb834fa in qemu_ram_alloc_internal.llvm ()
      #10 0x0000560aebb2ac98 in vfio_region_mmap ()
      #11 0x0000560aebb3ea0f in vfio_bars_register ()
      #12 0x0000560aebb3c628 in vfio_realize ()
      #13 0x0000560aeb90f0c2 in pci_qdev_realize ()
      #14 0x0000560aebc40305 in device_set_realized ()
      #15 0x0000560aebc48e07 in property_set_bool.llvm ()
      #16 0x0000560aebc46582 in object_property_set ()
      #17 0x0000560aebc4cd58 in object_property_set_qobject ()
      #18 0x0000560aebc46ba7 in object_property_set_bool ()
      #19 0x0000560aeb98b3ca in qdev_device_add_from_qdict ()
      #20 0x0000560aebb1fbaf in virtio_net_set_features ()
      #21 0x0000560aebb46b51 in virtio_set_features_nocheck ()
      #22 0x0000560aebb47107 in virtio_load ()
      #23 0x0000560aeb9ae7ce in vmstate_load_state ()
      #24 0x0000560aeb9d2ee9 in qemu_loadvm_state_main ()
      #25 0x0000560aeb9d45e1 in qemu_loadvm_state ()
      #26 0x0000560aeb9bc32c in process_incoming_migration_co.llvm ()
      #27 0x0000560aebeace56 in coroutine_trampoline.llvm ()
    
    Cc: qemu-stable@nongnu.org
    Buglink: https://issues.redhat.com/browse/RHEL-832
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>
    Message-ID: <20230905145002.46391-3-kwolf@redhat.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>
    (cherry picked from commit 92e2e6a867334a990f8d29f07ca34e3162fdd6ec)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/virtio/virtio.c | 45 ++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 40 insertions(+), 5 deletions(-)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 98c4819fcc..0010a9a5f1 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2825,8 +2825,9 @@ static int virtio_device_put(QEMUFile *f, void *opaque, size_t size,
 }
 
 /* A wrapper for use as a VMState .get function */
-static int virtio_device_get(QEMUFile *f, void *opaque, size_t size,
-                             const VMStateField *field)
+static int coroutine_mixed_fn
+virtio_device_get(QEMUFile *f, void *opaque, size_t size,
+                  const VMStateField *field)
 {
     VirtIODevice *vdev = VIRTIO_DEVICE(opaque);
     DeviceClass *dc = DEVICE_CLASS(VIRTIO_DEVICE_GET_CLASS(vdev));
@@ -2853,6 +2854,39 @@ static int virtio_set_features_nocheck(VirtIODevice *vdev, uint64_t val)
     return bad ? -1 : 0;
 }
 
+typedef struct VirtioSetFeaturesNocheckData {
+    Coroutine *co;
+    VirtIODevice *vdev;
+    uint64_t val;
+    int ret;
+} VirtioSetFeaturesNocheckData;
+
+static void virtio_set_features_nocheck_bh(void *opaque)
+{
+    VirtioSetFeaturesNocheckData *data = opaque;
+
+    data->ret = virtio_set_features_nocheck(data->vdev, data->val);
+    aio_co_wake(data->co);
+}
+
+static int coroutine_mixed_fn
+virtio_set_features_nocheck_maybe_co(VirtIODevice *vdev, uint64_t val)
+{
+    if (qemu_in_coroutine()) {
+        VirtioSetFeaturesNocheckData data = {
+            .co = qemu_coroutine_self(),
+            .vdev = vdev,
+            .val = val,
+        };
+        aio_bh_schedule_oneshot(qemu_get_current_aio_context(),
+                                virtio_set_features_nocheck_bh, &data);
+        qemu_coroutine_yield();
+        return data.ret;
+    } else {
+        return virtio_set_features_nocheck(vdev, val);
+    }
+}
+
 int virtio_set_features(VirtIODevice *vdev, uint64_t val)
 {
     int ret;
@@ -2906,7 +2940,8 @@ size_t virtio_get_config_size(const VirtIOConfigSizeParams *params,
     return config_size;
 }
 
-int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
+int coroutine_mixed_fn
+virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
 {
     int i, ret;
     int32_t config_len;
@@ -3023,14 +3058,14 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
          * host_features.
          */
         uint64_t features64 = vdev->guest_features;
-        if (virtio_set_features_nocheck(vdev, features64) < 0) {
+        if (virtio_set_features_nocheck_maybe_co(vdev, features64) < 0) {
             error_report("Features 0x%" PRIx64 " unsupported. "
                          "Allowed features: 0x%" PRIx64,
                          features64, vdev->host_features);
             return -1;
         }
     } else {
-        if (virtio_set_features_nocheck(vdev, features) < 0) {
+        if (virtio_set_features_nocheck_maybe_co(vdev, features) < 0) {
             error_report("Features 0x%x unsupported. "
                          "Allowed features: 0x%" PRIx64,
                          features, vdev->host_features);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:04:31 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:04:31 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814171.1227438 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTYV-00028H-QE; Wed, 09 Oct 2024 10:04:31 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814171.1227438; Wed, 09 Oct 2024 10:04:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTYV-000289-Nf; Wed, 09 Oct 2024 10:04:31 +0000
Received: by outflank-mailman (input) for mailman id 814171;
 Wed, 09 Oct 2024 10:04:30 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTYU-000281-Dz
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:04:30 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTYU-0006Hz-DK
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:04:30 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTYU-0006pv-Cg
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:04:30 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bQFyoXTTcpFwYryoMg2OwqXR+0759zE0OHzcN5yOtd8=; b=HHdgl5lGRxzdzvg2kOI5+Otbhy
	B2Du3s32nRvWDF5EXMAcxAOGCpW7e2e4vN2zZgAszqQKmZ2/YRvSTQwHJFg0gF4jhEg8Ejz6/0BQ2
	kMfKVmCcdhnfOcdJhWSfNGbuwWF3ZSgSzst+uSZZxXkhWSyAsSUDtd6w/HP6LETc12N8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] arm64: Restore trapless ptimer access
Message-Id: <E1syTYU-0006pv-Cg@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:04:30 +0000

commit 53a4e7ef420a2e272907b98fd8ffc199bcdc0e06
Author:     Colton Lewis <coltonlewis@google.com>
AuthorDate: Thu Aug 31 19:00:52 2023 +0000
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Mon Sep 11 22:33:58 2023 +0300

    arm64: Restore trapless ptimer access
    
    Due to recent KVM changes, QEMU is setting a ptimer offset resulting
    in unintended trap and emulate access and a consequent performance
    hit. Filter out the PTIMER_CNT register to restore trapless ptimer
    access.
    
    Quoting Andrew Jones:
    
    Simply reading the CNT register and writing back the same value is
    enough to set an offset, since the timer will have certainly moved
    past whatever value was read by the time it's written.  QEMU
    frequently saves and restores all registers in the get-reg-list array,
    unless they've been explicitly filtered out (with Linux commit
    680232a94c12, KVM_REG_ARM_PTIMER_CNT is now in the array). So, to
    restore trapless ptimer accesses, we need a QEMU patch to filter out
    the register.
    
    See
    https://lore.kernel.org/kvmarm/gsntttsonus5.fsf@coltonlewis-kvm.c.googlers.com/T/#m0770023762a821db2a3f0dd0a7dc6aa54e0d0da9
    for additional context.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Andrew Jones <andrew.jones@linux.dev>
    Signed-off-by: Colton Lewis <coltonlewis@google.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Tested-by: Colton Lewis <coltonlewis@google.com>
    Message-id: 20230831190052.129045-1-coltonlewis@google.com
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    (cherry picked from commit 682814e2a3c883b27f24b9e7cab47313c49acbd4)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/arm/kvm64.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
index 810db33ccb..ed85bcfb5c 100644
--- a/target/arm/kvm64.c
+++ b/target/arm/kvm64.c
@@ -950,6 +950,7 @@ typedef struct CPRegStateLevel {
  */
 static const CPRegStateLevel non_runtime_cpregs[] = {
     { KVM_REG_ARM_TIMER_CNT, KVM_PUT_FULL_STATE },
+    { KVM_REG_ARM_PTIMER_CNT, KVM_PUT_FULL_STATE },
 };
 
 int kvm_arm_cpreg_level(uint64_t regidx)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:04:41 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:04:41 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814172.1227442 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTYf-0002Do-Re; Wed, 09 Oct 2024 10:04:41 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814172.1227442; Wed, 09 Oct 2024 10:04:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTYf-0002Dg-P4; Wed, 09 Oct 2024 10:04:41 +0000
Received: by outflank-mailman (input) for mailman id 814172;
 Wed, 09 Oct 2024 10:04:40 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTYe-0002DR-Go
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:04:40 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTYe-0006IX-G9
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:04:40 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTYe-0006qz-FV
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:04:40 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=olKHTxouRhVJ0Kj0H9Je86ng+Dk8F6z42q7tWoJVtNc=; b=Mrqvv8jumeT9/m85sOSTqFpbOt
	e9QlLsAplpVNZuPCUu3fQ8flHUdtmUtvud769kw5SPvTYtaj2fotgrrhzqS2DJj2Du/hgTV8oLRkH
	Ws27+zqenwYPzijsvAzgaryVasALq7P6RjARwMNqBUYd3TjPd0nUFk+d1n0eH1/JV+j8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/char/riscv_htif: Fix printing of console characters on big endian hosts
Message-Id: <E1syTYe-0006qz-FV@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:04:40 +0000

commit 3af03de983108bc8c60a1a274b3e81a9553d4ce1
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Fri Jul 21 11:47:19 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Tue Sep 12 13:37:02 2023 +0300

    hw/char/riscv_htif: Fix printing of console characters on big endian hosts
    
    The character that should be printed is stored in the 64 bit "payload"
    variable. The code currently tries to print it by taking the address
    of the variable and passing this pointer to qemu_chr_fe_write(). However,
    this only works on little endian hosts where the least significant bits
    are stored on the lowest address. To do this in a portable way, we have
    to store the value in an uint8_t variable instead.
    
    Fixes: 5033606780 ("RISC-V HTIF Console")
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Reviewed-by: Bin Meng <bmeng@tinylab.org>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-Id: <20230721094720.902454-2-thuth@redhat.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit c255946e3df4d9660e4f468a456633c24393d468)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/char/riscv_htif.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/char/riscv_htif.c b/hw/char/riscv_htif.c
index 098de50e35..e6e0fa3015 100644
--- a/hw/char/riscv_htif.c
+++ b/hw/char/riscv_htif.c
@@ -190,7 +190,8 @@ static void htif_handle_tohost_write(HTIFState *s, uint64_t val_written)
             s->tohost = 0; /* clear to indicate we read */
             return;
         } else if (cmd == HTIF_CONSOLE_CMD_PUTC) {
-            qemu_chr_fe_write(&s->chr, (uint8_t *)&payload, 1);
+            uint8_t ch = (uint8_t)payload;
+            qemu_chr_fe_write(&s->chr, &ch, 1);
             resp = 0x100 | (uint8_t)payload;
         } else {
             qemu_log("HTIF device %d: unknown command\n", device);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:04:51 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:04:51 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814173.1227447 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTYp-0002Kg-TP; Wed, 09 Oct 2024 10:04:51 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814173.1227447; Wed, 09 Oct 2024 10:04:51 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTYp-0002KY-Qf; Wed, 09 Oct 2024 10:04:51 +0000
Received: by outflank-mailman (input) for mailman id 814173;
 Wed, 09 Oct 2024 10:04:50 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTYo-0002Iz-Jr
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:04:50 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTYo-0006Ie-JD
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:04:50 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTYo-0006sN-IT
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:04:50 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ETO9ctR1v3MgxlBZ5WS3dXZpxqTnAvoEu5v+FUGy7Dc=; b=0GrJsKN+0GgvJ8TBZsA9+IyAPL
	yaH19CNfshqGA5ijswRy6fi//9/jaST47VHHTCKT3l4eP828CRYbp21k48bl9yJSlybldikMvxW+I
	HEMFUVuDCPbE9ZYc+V1QeHLfZWiJJYe/T8iCEBGQyfQM96N2LD20z/6lDbtQeJT34XFE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] include/exec: Provide the tswap() functions for target independent code, too
Message-Id: <E1syTYo-0006sN-IT@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:04:50 +0000

commit aeb931d82b13c50587268f462dcd46b23d2086ff
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Tue Apr 11 20:34:17 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:17:02 2023 +0300

    include/exec: Provide the tswap() functions for target independent code, too
    
    In some cases of target independent code, it would be useful to have access
    to the functions that swap endianess in case it differs between guest and
    host. Thus re-implement the tswapXX() functions in a new header that can be
    included separately. The check whether the swapping is needed continues to
    be done at compile-time for target specific code, while it is done at
    run-time in target-independent code.
    
    Message-Id: <20230411183418.1640500-3-thuth@redhat.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Reviewed-by: Cédric Le Goater <clg@kaod.org>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 24be3369ad63c3882be42dd510a45bad52816fd1)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (trivial change needed for the next commit 058096f1c5
     "hw/char/riscv_htif: Fix the console syscall on big endian hosts")
---
 include/exec/cpu-all.h | 64 +-------------------------------------------
 include/exec/tswap.h   | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+), 63 deletions(-)

diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index 090922e4a8..ad824fee52 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -21,6 +21,7 @@
 
 #include "exec/cpu-common.h"
 #include "exec/memory.h"
+#include "exec/tswap.h"
 #include "qemu/thread.h"
 #include "hw/core/cpu.h"
 #include "qemu/rcu.h"
@@ -44,69 +45,6 @@
 #define BSWAP_NEEDED
 #endif
 
-#ifdef BSWAP_NEEDED
-
-static inline uint16_t tswap16(uint16_t s)
-{
-    return bswap16(s);
-}
-
-static inline uint32_t tswap32(uint32_t s)
-{
-    return bswap32(s);
-}
-
-static inline uint64_t tswap64(uint64_t s)
-{
-    return bswap64(s);
-}
-
-static inline void tswap16s(uint16_t *s)
-{
-    *s = bswap16(*s);
-}
-
-static inline void tswap32s(uint32_t *s)
-{
-    *s = bswap32(*s);
-}
-
-static inline void tswap64s(uint64_t *s)
-{
-    *s = bswap64(*s);
-}
-
-#else
-
-static inline uint16_t tswap16(uint16_t s)
-{
-    return s;
-}
-
-static inline uint32_t tswap32(uint32_t s)
-{
-    return s;
-}
-
-static inline uint64_t tswap64(uint64_t s)
-{
-    return s;
-}
-
-static inline void tswap16s(uint16_t *s)
-{
-}
-
-static inline void tswap32s(uint32_t *s)
-{
-}
-
-static inline void tswap64s(uint64_t *s)
-{
-}
-
-#endif
-
 #if TARGET_LONG_SIZE == 4
 #define tswapl(s) tswap32(s)
 #define tswapls(s) tswap32s((uint32_t *)(s))
diff --git a/include/exec/tswap.h b/include/exec/tswap.h
new file mode 100644
index 0000000000..68944a880b
--- /dev/null
+++ b/include/exec/tswap.h
@@ -0,0 +1,72 @@
+/*
+ * Macros for swapping a value if the endianness is different
+ * between the target and the host.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef TSWAP_H
+#define TSWAP_H
+
+#include "hw/core/cpu.h"
+#include "qemu/bswap.h"
+
+/*
+ * If we're in target-specific code, we can hard-code the swapping
+ * condition, otherwise we have to do (slower) run-time checks.
+ */
+#ifdef NEED_CPU_H
+#define target_needs_bswap()  (HOST_BIG_ENDIAN != TARGET_BIG_ENDIAN)
+#else
+#define target_needs_bswap()  (target_words_bigendian() != HOST_BIG_ENDIAN)
+#endif
+
+static inline uint16_t tswap16(uint16_t s)
+{
+    if (target_needs_bswap()) {
+        return bswap16(s);
+    } else {
+        return s;
+    }
+}
+
+static inline uint32_t tswap32(uint32_t s)
+{
+    if (target_needs_bswap()) {
+        return bswap32(s);
+    } else {
+        return s;
+    }
+}
+
+static inline uint64_t tswap64(uint64_t s)
+{
+    if (target_needs_bswap()) {
+        return bswap64(s);
+    } else {
+        return s;
+    }
+}
+
+static inline void tswap16s(uint16_t *s)
+{
+    if (target_needs_bswap()) {
+        *s = bswap16(*s);
+    }
+}
+
+static inline void tswap32s(uint32_t *s)
+{
+    if (target_needs_bswap()) {
+        *s = bswap32(*s);
+    }
+}
+
+static inline void tswap64s(uint64_t *s)
+{
+    if (target_needs_bswap()) {
+        *s = bswap64(*s);
+    }
+}
+
+#endif  /* TSWAP_H */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:05:01 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:05:01 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814174.1227450 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTYz-0002Q6-V0; Wed, 09 Oct 2024 10:05:01 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814174.1227450; Wed, 09 Oct 2024 10:05:01 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTYz-0002Px-SO; Wed, 09 Oct 2024 10:05:01 +0000
Received: by outflank-mailman (input) for mailman id 814174;
 Wed, 09 Oct 2024 10:05:00 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTYy-0002Pp-Mq
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:05:00 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTYy-0006Il-M5
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:05:00 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTYy-0006tU-LL
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:05:00 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dSdu1B6ALxKvqyam478qiYpbnAb56Mq2gPV7kDyS7Fw=; b=T5bEh3PnBt2Y14i/FMLhBVALOl
	wG8GMuRiFoNx1/1z1CGx95xOlruqf+L/ylE3JZZsQ9Su0Dt4yEvlQ/dbswG/Rs9F6MeF2q8SnpVZV
	zzE+rmpOpGyAyixeSUbo+Ou5IFCD8nPXqI4UPcuEBqFVfPTxcyYoJAwpBHXMkQgirDtY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/char/riscv_htif: Fix the console syscall on big endian hosts
Message-Id: <E1syTYy-0006tU-LL@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:05:00 +0000

commit a57e4cc6fe81a0b2ca8a32db91ca45df205c4a8f
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Fri Jul 21 11:47:20 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    hw/char/riscv_htif: Fix the console syscall on big endian hosts
    
    Values that have been read via cpu_physical_memory_read() from the
    guest's memory have to be swapped in case the host endianess differs
    from the guest.
    
    Fixes: a6e13e31d5 ("riscv_htif: Support console output via proxy syscall")
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Reviewed-by: Bin Meng <bmeng@tinylab.org>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Message-Id: <20230721094720.902454-3-thuth@redhat.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 058096f1c55ab688db7e1d6814aaefc1bcd87f7a)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (Mjt: context fix in hw/char/riscv_htif.c for #include)
---
 hw/char/riscv_htif.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/hw/char/riscv_htif.c b/hw/char/riscv_htif.c
index e6e0fa3015..198175e232 100644
--- a/hw/char/riscv_htif.c
+++ b/hw/char/riscv_htif.c
@@ -29,6 +29,7 @@
 #include "chardev/char-fe.h"
 #include "qemu/timer.h"
 #include "qemu/error-report.h"
+#include "exec/tswap.h"
 
 #define RISCV_DEBUG_HTIF 0
 #define HTIF_DEBUG(fmt, ...)                                                   \
@@ -167,11 +168,11 @@ static void htif_handle_tohost_write(HTIFState *s, uint64_t val_written)
             } else {
                 uint64_t syscall[8];
                 cpu_physical_memory_read(payload, syscall, sizeof(syscall));
-                if (syscall[0] == PK_SYS_WRITE &&
-                    syscall[1] == HTIF_DEV_CONSOLE &&
-                    syscall[3] == HTIF_CONSOLE_CMD_PUTC) {
+                if (tswap64(syscall[0]) == PK_SYS_WRITE &&
+                    tswap64(syscall[1]) == HTIF_DEV_CONSOLE &&
+                    tswap64(syscall[3]) == HTIF_CONSOLE_CMD_PUTC) {
                     uint8_t ch;
-                    cpu_physical_memory_read(syscall[2], &ch, 1);
+                    cpu_physical_memory_read(tswap64(syscall[2]), &ch, 1);
                     qemu_chr_fe_write(&s->chr, &ch, 1);
                     resp = 0x100 | (uint8_t)payload;
                 } else {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:05:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:05:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814175.1227455 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTZA-0002Tn-1m; Wed, 09 Oct 2024 10:05:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814175.1227455; Wed, 09 Oct 2024 10:05: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 1syTZ9-0002Tf-VV; Wed, 09 Oct 2024 10:05:11 +0000
Received: by outflank-mailman (input) for mailman id 814175;
 Wed, 09 Oct 2024 10:05:10 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTZ8-0002TR-RQ
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:05:10 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTZ8-0006JF-Ot
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:05:10 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTZ8-0006uu-OG
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:05:10 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ukDOsi5ETxdutaMibV5aD/7u8sQX+Ni145QhUXGNpbs=; b=r+MRDrqN4bWnePNnESRMXCg8cy
	EhmVPsVihcogCHtgjZBMLl8muSAFy/EHjRjB0QTwbbBJR596sjC1YWVhKLPtJV2XbpoI+KLECtl7Q
	3jbKDbDqDKvIebGGkvQO6vvyURzOEHFQCyphKA6dOeBU/xFMr/E/z/CvJ4U7pv6Qwn/s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/intc: Fix upper/lower mtime write calculation
Message-Id: <E1syTZ8-0006uu-OG@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:05:10 +0000

commit fd1a0c89c66c9e03b6cc7a1283856bb2112a9bde
Author:     Jason Chien <jason.chien@sifive.com>
AuthorDate: Fri Jul 28 08:24:38 2023 +0000
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    hw/intc: Fix upper/lower mtime write calculation
    
    When writing the upper mtime, we should keep the original lower mtime
    whose value is given by cpu_riscv_read_rtc() instead of
    cpu_riscv_read_rtc_raw(). The same logic applies to writes to lower mtime.
    
    Signed-off-by: Jason Chien <jason.chien@sifive.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Message-ID: <20230728082502.26439-1-jason.chien@sifive.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit e0922b73baf00c4c19d4ad30d09bb94f7ffea0f4)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/intc/riscv_aclint.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/intc/riscv_aclint.c b/hw/intc/riscv_aclint.c
index b466a6abaf..bf77e29a70 100644
--- a/hw/intc/riscv_aclint.c
+++ b/hw/intc/riscv_aclint.c
@@ -208,11 +208,12 @@ static void riscv_aclint_mtimer_write(void *opaque, hwaddr addr,
         return;
     } else if (addr == mtimer->time_base || addr == mtimer->time_base + 4) {
         uint64_t rtc_r = cpu_riscv_read_rtc_raw(mtimer->timebase_freq);
+        uint64_t rtc = cpu_riscv_read_rtc(mtimer);
 
         if (addr == mtimer->time_base) {
             if (size == 4) {
                 /* time_lo for RV32/RV64 */
-                mtimer->time_delta = ((rtc_r & ~0xFFFFFFFFULL) | value) - rtc_r;
+                mtimer->time_delta = ((rtc & ~0xFFFFFFFFULL) | value) - rtc_r;
             } else {
                 /* time for RV64 */
                 mtimer->time_delta = value - rtc_r;
@@ -220,7 +221,7 @@ static void riscv_aclint_mtimer_write(void *opaque, hwaddr addr,
         } else {
             if (size == 4) {
                 /* time_hi for RV32/RV64 */
-                mtimer->time_delta = (value << 32 | (rtc_r & 0xFFFFFFFF)) - rtc_r;
+                mtimer->time_delta = (value << 32 | (rtc & 0xFFFFFFFF)) - rtc_r;
             } else {
                 qemu_log_mask(LOG_GUEST_ERROR,
                               "aclint-mtimer: invalid time_hi write: %08x",
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:05:22 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:05:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814176.1227458 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTZK-0002W7-30; Wed, 09 Oct 2024 10:05:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814176.1227458; Wed, 09 Oct 2024 10:05: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 1syTZK-0002W0-0Z; Wed, 09 Oct 2024 10:05:22 +0000
Received: by outflank-mailman (input) for mailman id 814176;
 Wed, 09 Oct 2024 10:05:20 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTZI-0002Vl-SO
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:05:20 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTZI-0006JN-Rn
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:05:20 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTZI-0006wT-R8
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:05:20 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zcKoRG3KhNuotDLJeuNFEPaCp4GXFEXAAuUMFmGA+l0=; b=J+Nj4olA9pLHPPWndBZEgbVbki
	jNwVNxRuePp+SWBf2/wqwlAzcHN9/RPkC5dJYvAzvBQR8zQbtMhRAVP9llooKrJhUk9qYGjrLwOy8
	mxL3DvNvhNKC/B150XwRUkmiS55VpP2zhK5p2gppBD5Ky6DRKhaFWx7UNi6Frb4eR6Lw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/intc: Make rtc variable names consistent
Message-Id: <E1syTZI-0006wT-R8@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:05:20 +0000

commit c00a9ec0613ca428abaedaf8b7be7b1cbb97d37f
Author:     Jason Chien <jason.chien@sifive.com>
AuthorDate: Fri Jul 28 08:24:39 2023 +0000
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    hw/intc: Make rtc variable names consistent
    
    The variables whose values are given by cpu_riscv_read_rtc() should be named
    "rtc". The variables whose value are given by cpu_riscv_read_rtc_raw()
    should be named "rtc_r".
    
    Signed-off-by: Jason Chien <jason.chien@sifive.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Message-ID: <20230728082502.26439-2-jason.chien@sifive.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 9382a9eafccad8dc6a487ea3a8d2bed03dc35db9)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/intc/riscv_aclint.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/intc/riscv_aclint.c b/hw/intc/riscv_aclint.c
index bf77e29a70..25cf7a5d9d 100644
--- a/hw/intc/riscv_aclint.c
+++ b/hw/intc/riscv_aclint.c
@@ -64,13 +64,13 @@ static void riscv_aclint_mtimer_write_timecmp(RISCVAclintMTimerState *mtimer,
     uint64_t next;
     uint64_t diff;
 
-    uint64_t rtc_r = cpu_riscv_read_rtc(mtimer);
+    uint64_t rtc = cpu_riscv_read_rtc(mtimer);
 
     /* Compute the relative hartid w.r.t the socket */
     hartid = hartid - mtimer->hartid_base;
 
     mtimer->timecmp[hartid] = value;
-    if (mtimer->timecmp[hartid] <= rtc_r) {
+    if (mtimer->timecmp[hartid] <= rtc) {
         /*
          * If we're setting an MTIMECMP value in the "past",
          * immediately raise the timer interrupt
@@ -81,7 +81,7 @@ static void riscv_aclint_mtimer_write_timecmp(RISCVAclintMTimerState *mtimer,
 
     /* otherwise, set up the future timer interrupt */
     qemu_irq_lower(mtimer->timer_irqs[hartid]);
-    diff = mtimer->timecmp[hartid] - rtc_r;
+    diff = mtimer->timecmp[hartid] - rtc;
     /* back to ns (note args switched in muldiv64) */
     uint64_t ns_diff = muldiv64(diff, NANOSECONDS_PER_SECOND, timebase_freq);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:05:32 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:05:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814177.1227462 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTZU-0002Yi-4e; Wed, 09 Oct 2024 10:05:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814177.1227462; Wed, 09 Oct 2024 10:05: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 1syTZU-0002Ya-1z; Wed, 09 Oct 2024 10:05:32 +0000
Received: by outflank-mailman (input) for mailman id 814177;
 Wed, 09 Oct 2024 10:05: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 1syTZS-0002YS-VP
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:05:30 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTZS-0006JU-Ui
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:05:30 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTZS-0006xd-U1
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:05:30 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pyOZdFLfVGp3tFiDpNLw9nMd1PG/+ShkeraJWo8pYG0=; b=FazWdLAxwv8q89atw+GqWNsbPd
	c3BPtXuAzbEwh2Y/ymBwD3hPbJZJt2NzjnjLp9jnGvUmXtO8mdZF5r791PiPhpevECQIpf6ohBRgH
	AZ9qTY7TOLG7z/5/lLT2nVAFytKvLq6hkZ0ZiXE8PuMDG4d3Qw6J3YEW1k2X1jKuGiI0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] linux-user/riscv: Use abi type for target_ucontext
Message-Id: <E1syTZS-0006xd-U1@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:05:30 +0000

commit 9bac2bcf10e25506cc1fc7b69b027399afeb3768
Author:     LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
AuthorDate: Fri Aug 11 13:54:38 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    linux-user/riscv: Use abi type for target_ucontext
    
    We should not use types dependend on host arch for target_ucontext.
    This bug is found when run rv32 applications.
    
    Signed-off-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-ID: <20230811055438.1945-1-zhiwei_liu@linux.alibaba.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit ae7d4d625cab49657b9fc2be09d895afb9bcdaf0)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 linux-user/riscv/signal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/linux-user/riscv/signal.c b/linux-user/riscv/signal.c
index eaa168199a..f989f7f51f 100644
--- a/linux-user/riscv/signal.c
+++ b/linux-user/riscv/signal.c
@@ -38,8 +38,8 @@ struct target_sigcontext {
 }; /* cf. riscv-linux:arch/riscv/include/uapi/asm/ptrace.h */
 
 struct target_ucontext {
-    unsigned long uc_flags;
-    struct target_ucontext *uc_link;
+    abi_ulong uc_flags;
+    abi_ptr uc_link;
     target_stack_t uc_stack;
     target_sigset_t uc_sigmask;
     uint8_t   __unused[1024 / 8 - sizeof(target_sigset_t)];
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:05:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:05:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814178.1227466 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTZf-0002bZ-5s; Wed, 09 Oct 2024 10:05:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814178.1227466; Wed, 09 Oct 2024 10:05: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 1syTZf-0002bS-3T; Wed, 09 Oct 2024 10:05:43 +0000
Received: by outflank-mailman (input) for mailman id 814178;
 Wed, 09 Oct 2024 10:05:41 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTZd-0002b9-2A
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:05:41 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTZd-0006Ju-1X
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:05:41 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTZd-0006ym-0i
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:05: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=Zfw3PmkG0ClFxv2+NaziKIxktojtS6cAdzR9h+hFO9c=; b=eUQU81TPTSlcaqpEZnQhMTcacb
	TsHFWzOKvK8QUBxgG3LBLgRzEIrw+GvPqi5DDv4PVZxepSQeJV1HxaMbrp61U+wjofQFTJgCsvvxi
	SbEnQxxgwyD61NSbZhm91dUvwrYE6275XzdhlZzmKgP01x7mqGOe7xPfRXUggJKlR30s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/riscv: virt: Fix riscv,pmu DT node path
Message-Id: <E1syTZd-0006ym-0i@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:05:41 +0000

commit e94ea3c6dbd48d70edca6de0079d5690a82ec35b
Author:     Conor Dooley <conor.dooley@microchip.com>
AuthorDate: Thu Jul 27 15:24:17 2023 +0100
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    hw/riscv: virt: Fix riscv,pmu DT node path
    
    On a dtb dumped from the virt machine, dt-validate complains:
    soc: pmu: {'riscv,event-to-mhpmcounters': [[1, 1, 524281], [2, 2, 524284], [65561, 65561, 524280], [65563, 65563, 524280], [65569, 65569, 524280]], 'compatible': ['riscv,pmu']} should not be valid under {'type': 'object'}
            from schema $id: http://devicetree.org/schemas/simple-bus.yaml#
    That's pretty cryptic, but running the dtb back through dtc produces
    something a lot more reasonable:
    Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property
    
    Moving the riscv,pmu node out of the soc bus solves the problem.
    
    Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
    Acked-by: Alistair Francis <alistair.francis@wdc.com>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Message-ID: <20230727-groom-decline-2c57ce42841c@spud>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 9ff31406312500053ecb5f92df01dd9ce52e635d)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/riscv/virt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index 4e3efbee16..be8f0cb26e 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -731,7 +731,7 @@ static void create_fdt_pmu(RISCVVirtState *s)
     MachineState *ms = MACHINE(s);
     RISCVCPU hart = s->soc[0].harts[0];
 
-    pmu_name = g_strdup_printf("/soc/pmu");
+    pmu_name = g_strdup_printf("/pmu");
     qemu_fdt_add_subnode(ms->fdt, pmu_name);
     qemu_fdt_setprop_string(ms->fdt, pmu_name, "compatible", "riscv,pmu");
     riscv_pmu_generate_fdt_node(ms->fdt, hart.cfg.pmu_num, pmu_name);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:05:53 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:05:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814179.1227470 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTZp-0002e3-7b; Wed, 09 Oct 2024 10:05:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814179.1227470; Wed, 09 Oct 2024 10:05: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 1syTZp-0002dv-4u; Wed, 09 Oct 2024 10:05:53 +0000
Received: by outflank-mailman (input) for mailman id 814179;
 Wed, 09 Oct 2024 10:05:51 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTZn-0002dh-54
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:05:51 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTZn-0006K1-4S
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:05:51 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTZn-0006zx-3o
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:05:51 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TjFsNGbHCVICWLFHfEBsdqZdjzQ5fWXwi1XB2T0Ca4c=; b=cw83RiEr2BRoZlj5pvHevqjX+O
	EDGWqU1j0ckO2KvRylRI0p6B83A/MZq0xGxITvksf7LDhrEAfYLpxhW5u0U/PVz8qHI/y8umFJxAU
	8/LAYUkjQFNSqJZthevFC4wGpZrUUdJetyA9cDyAuo/PNs+UOpUnPaaFZXxVn+PD7x9A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] target/riscv: fix satp_mode_finalize() when satp_mode.supported = 0
Message-Id: <E1syTZn-0006zx-3o@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:05:51 +0000

commit 1805e05db3c6d92c750427b1c1371f44fa8e4893
Author:     Daniel Henrique Barboza <dbarboza@ventanamicro.com>
AuthorDate: Thu Aug 17 12:29:03 2023 -0300
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    target/riscv: fix satp_mode_finalize() when satp_mode.supported = 0
    
    In the same emulated RISC-V host, the 'host' KVM CPU takes 4 times
    longer to boot than the 'rv64' KVM CPU.
    
    The reason is an unintended behavior of riscv_cpu_satp_mode_finalize()
    when satp_mode.supported = 0, i.e. when cpu_init() does not set
    satp_mode_max_supported(). satp_mode_max_from_map(map) does:
    
    31 - __builtin_clz(map)
    
    This means that, if satp_mode.supported = 0, satp_mode_supported_max
    wil be '31 - 32'. But this is C, so satp_mode_supported_max will gladly
    set it to UINT_MAX (4294967295). After that, if the user didn't set a
    satp_mode, set_satp_mode_default_map(cpu) will make
    
    cfg.satp_mode.map = cfg.satp_mode.supported
    
    So satp_mode.map = 0. And then satp_mode_map_max will be set to
    satp_mode_max_from_map(cpu->cfg.satp_mode.map), i.e. also UINT_MAX. The
    guard "satp_mode_map_max > satp_mode_supported_max" doesn't protect us
    here since both are UINT_MAX.
    
    And finally we have 2 loops:
    
            for (int i = satp_mode_map_max - 1; i >= 0; --i) {
    
    Which are, in fact, 2 loops from UINT_MAX -1 to -1. This is where the
    extra delay when booting the 'host' CPU is coming from.
    
    Commit 43d1de32f8 already set a precedence for satp_mode.supported = 0
    in a different manner. We're doing the same here. If supported == 0,
    interpret as 'the CPU wants the OS to handle satp mode alone' and skip
    satp_mode_finalize().
    
    We'll also put a guard in satp_mode_max_from_map() to assert out if map
    is 0 since the function is not ready to deal with it.
    
    Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
    Fixes: 6f23aaeb9b ("riscv: Allow user to set the satp mode")
    Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
    Message-ID: <20230817152903.694926-1-dbarboza@ventanamicro.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 3a2fc23563885c219c73c8f24318921daf02f3f2)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/riscv/cpu.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index 1e97473af2..8c0721c715 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -282,6 +282,17 @@ static uint8_t satp_mode_from_str(const char *satp_mode_str)
 
 uint8_t satp_mode_max_from_map(uint32_t map)
 {
+    /*
+     * 'map = 0' will make us return (31 - 32), which C will
+     * happily overflow to UINT_MAX. There's no good result to
+     * return if 'map = 0' (e.g. returning 0 will be ambiguous
+     * with the result for 'map = 1').
+     *
+     * Assert out if map = 0. Callers will have to deal with
+     * it outside of this function.
+     */
+    g_assert(map > 0);
+
     /* map here has at least one bit set, so no problem with clz */
     return 31 - __builtin_clz(map);
 }
@@ -1043,9 +1054,15 @@ static void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)
 static void riscv_cpu_satp_mode_finalize(RISCVCPU *cpu, Error **errp)
 {
     bool rv32 = riscv_cpu_mxl(&cpu->env) == MXL_RV32;
-    uint8_t satp_mode_map_max;
-    uint8_t satp_mode_supported_max =
-                        satp_mode_max_from_map(cpu->cfg.satp_mode.supported);
+    uint8_t satp_mode_map_max, satp_mode_supported_max;
+
+    /* The CPU wants the OS to decide which satp mode to use */
+    if (cpu->cfg.satp_mode.supported == 0) {
+        return;
+    }
+
+    satp_mode_supported_max =
+                    satp_mode_max_from_map(cpu->cfg.satp_mode.supported);
 
     if (cpu->cfg.satp_mode.map == 0) {
         if (cpu->cfg.satp_mode.init == 0) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:06:03 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:06:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814180.1227476 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTZz-0002ge-9P; Wed, 09 Oct 2024 10:06:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814180.1227476; Wed, 09 Oct 2024 10:06: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 1syTZz-0002gU-6M; Wed, 09 Oct 2024 10:06:03 +0000
Received: by outflank-mailman (input) for mailman id 814180;
 Wed, 09 Oct 2024 10:06: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 1syTZx-0002gG-7z
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:06: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 1syTZx-0006K9-7D
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:06:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTZx-00071m-6d
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:06: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=uUc9E39zd94LbtnMCwbyhJu8pfze1m98T/U2oUjcAjI=; b=XZWX8vrPQGNgoOM/eUA4gNP9G5
	PzBGAv5AP6T7jDlDFBvdUGTxJQpK1AL7l9xAqjEs35LbhuAeC286TWHQ8VGsOJ1MIxsvrBz15R9Bp
	QA4ZLTLc5oV+tLYbAGLCy8Rd1MjLkSeuMmfGo7ASqnFbRjWeZdWrQ52Sz2YZuVrNTTVY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] target/riscv/pmp.c: respect mseccfg.RLB for pmpaddrX changes
Message-Id: <E1syTZx-00071m-6d@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:06:01 +0000

commit 70c97e75d709eadf80845259ea0a0409475102c3
Author:     Leon Schuermann <leons@opentitan.org>
AuthorDate: Tue Aug 29 17:50:46 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    target/riscv/pmp.c: respect mseccfg.RLB for pmpaddrX changes
    
    When the rule-lock bypass (RLB) bit is set in the mseccfg CSR, the PMP
    configuration lock bits must not apply. While this behavior is
    implemented for the pmpcfgX CSRs, this bit is not respected for
    changes to the pmpaddrX CSRs. This patch ensures that pmpaddrX CSR
    writes work even on locked regions when the global rule-lock bypass is
    enabled.
    
    Signed-off-by: Leon Schuermann <leons@opentitan.org>
    Reviewed-by: Mayuresh Chitale <mchitale@ventanamicro.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Message-ID: <20230829215046.1430463-1-leon@is.currently.online>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 4e3adce1244e1ca30ec05874c3eca14911dc0825)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/riscv/pmp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c
index a08cd95658..bcb4baa0a2 100644
--- a/target/riscv/pmp.c
+++ b/target/riscv/pmp.c
@@ -45,6 +45,10 @@ static inline uint8_t pmp_get_a_field(uint8_t cfg)
  */
 static inline int pmp_is_locked(CPURISCVState *env, uint32_t pmp_index)
 {
+    /* mseccfg.RLB is set */
+    if (MSECCFG_RLB_ISSET(env)) {
+        return 0;
+    }
 
     if (env->pmp_state.pmp[pmp_index].cfg_reg & PMP_LOCK) {
         return 1;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:06:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:06:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814181.1227478 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTa9-0002jY-Ac; Wed, 09 Oct 2024 10:06:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814181.1227478; Wed, 09 Oct 2024 10:06: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 1syTa9-0002jQ-7l; Wed, 09 Oct 2024 10:06:13 +0000
Received: by outflank-mailman (input) for mailman id 814181;
 Wed, 09 Oct 2024 10:06: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 1syTa7-0002j9-Az
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:06: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 1syTa7-0006KW-AC
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:06:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTa7-00073l-9T
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:06: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=sdVhrY8NC5G1QoQ2LGNXsHvCk2zcu9Kfz4A6kVWxBSY=; b=WkpF8V8MifGg8B+XReW4q3N4J1
	+7+03vn03zUR388Cf41Tawvu0C2dVt8dDQoJ8QGFY4Vrgv/QtQOv63HCVfiWxpFNibiq40fFADBkh
	v5PgZUeS6YzDNZrwJI6WEH9eTbplTxJOyLzyb/ykVoSIWUi0+Jjakgcr1jHw9wxW4mdA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] hw/tpm: TIS on sysbus: Remove unsupport ppi command line option
Message-Id: <E1syTa7-00073l-9T@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:06:11 +0000

commit 36540b367eb80f1d6a646f691e6a2b75bf57ad61
Author:     Stefan Berger <stefanb@linux.ibm.com>
AuthorDate: Thu Jul 13 13:19:55 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    hw/tpm: TIS on sysbus: Remove unsupport ppi command line option
    
    The ppi command line option for the TIS device on sysbus never worked
    and caused an immediate segfault. Remove support for it since it also
    needs support in the firmware and needs testing inside the VM.
    
    Reproducer with the ppi=on option passed:
    
    qemu-system-aarch64 \
       -machine virt,gic-version=3 \
       -m 4G  \
       -nographic -no-acpi \
       -chardev socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
       -tpmdev emulator,id=tpm0,chardev=chrtpm \
       -device tpm-tis-device,tpmdev=tpm0,ppi=on
    [...]
    Segmentation fault (core dumped)
    
    Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
    Reviewed-by: Eric Auger <eric.auger@redhat.com>
    Message-id: 20230713171955.149236-1-stefanb@linux.ibm.com
    (cherry picked from commit 4c46fe2ed492f35f411632c8b5a8442f322bc3f0)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/tpm/tpm_tis_sysbus.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/hw/tpm/tpm_tis_sysbus.c b/hw/tpm/tpm_tis_sysbus.c
index 45e63efd63..6724b3d4f6 100644
--- a/hw/tpm/tpm_tis_sysbus.c
+++ b/hw/tpm/tpm_tis_sysbus.c
@@ -93,7 +93,6 @@ static void tpm_tis_sysbus_reset(DeviceState *dev)
 static Property tpm_tis_sysbus_properties[] = {
     DEFINE_PROP_UINT32("irq", TPMStateSysBus, state.irq_num, TPM_TIS_IRQ),
     DEFINE_PROP_TPMBE("tpmdev", TPMStateSysBus, state.be_driver),
-    DEFINE_PROP_BOOL("ppi", TPMStateSysBus, state.ppi_enabled, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:06:22 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:06:22 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814182.1227483 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTaI-0002mM-Ds; Wed, 09 Oct 2024 10:06:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814182.1227483; Wed, 09 Oct 2024 10:06: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 1syTaI-0002mE-B3; Wed, 09 Oct 2024 10:06:22 +0000
Received: by outflank-mailman (input) for mailman id 814182;
 Wed, 09 Oct 2024 10:06: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 1syTaH-0002m8-Dz
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:06: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 1syTaH-0006Kg-DF
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:06:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTaH-00075O-CU
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:06: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=w/qWD1JI7+XxshuxfpmZ7nZwfzZqGh3gHKdymf57klg=; b=lzveV9ri2IGjgZiIgt3I9BstY0
	di5m5y9MtLZgqSQifY9N4YWQ69ONQl+ySWJW5nzwToXX/edz1Bj1wOru0ogHIzWLkQsH7Ez2s4HKv
	IDwf56VU3ZptFKZNLv4yifbxPnteJXC25UQcZZov+DkFQ1qzKNi+sZsp1w4PTM/dqDC8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] ui: fix crash when there are no active_console
Message-Id: <E1syTaH-00075O-CU@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:06:21 +0000

commit 6c575436cd3e692079fc3e2fe4f54efe77211549
Author:     Marc-André Lureau <marcandre.lureau@redhat.com>
AuthorDate: Mon Sep 11 18:04:47 2023 +0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    ui: fix crash when there are no active_console
    
    Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
    0x0000555555888630 in dpy_ui_info_supported (con=0x0) at ../ui/console.c:812
    812         return con->hw_ops->ui_info != NULL;
    (gdb) bt
    #0  0x0000555555888630 in dpy_ui_info_supported (con=0x0) at ../ui/console.c:812
    #1  0x00005555558a44b1 in protocol_client_msg (vs=0x5555578c76c0, data=0x5555581e93f0 <incomplete sequence \373>, len=24) at ../ui/vnc.c:2585
    #2  0x00005555558a19ac in vnc_client_read (vs=0x5555578c76c0) at ../ui/vnc.c:1607
    #3  0x00005555558a1ac2 in vnc_client_io (ioc=0x5555581eb0e0, condition=G_IO_IN, opaque=0x5555578c76c0) at ../ui/vnc.c:1635
    
    Fixes:
    https://issues.redhat.com/browse/RHEL-2600
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Reviewed-by: Albert Esteve <aesteve@redhat.com>
    (cherry picked from commit 48a35e12faf90a896c5aa4755812201e00d60316)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 ui/console.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ui/console.c b/ui/console.c
index 7461446e71..a327c9f94a 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1707,6 +1707,9 @@ bool dpy_ui_info_supported(QemuConsole *con)
     if (con == NULL) {
         con = active_console;
     }
+    if (con == NULL) {
+        return false;
+    }
 
     return con->hw_ops->ui_info != NULL;
 }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:06:32 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:06:32 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814183.1227487 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTaS-0002qC-FJ; Wed, 09 Oct 2024 10:06:32 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814183.1227487; Wed, 09 Oct 2024 10:06: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 1syTaS-0002q4-Ca; Wed, 09 Oct 2024 10:06:32 +0000
Received: by outflank-mailman (input) for mailman id 814183;
 Wed, 09 Oct 2024 10:06: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 1syTaR-0002pu-HB
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:06: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 1syTaR-0006Kk-Ga
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:06:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTaR-00076T-FW
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:06: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=ZIV0FN3HKB2vmQgH3C3+FWKJeJauzGcENqxVs3lAXJU=; b=gt6ZOYxsUC1vbVP2e2r66QCCSS
	Eo6xUYpslXqiWmSqL4jwW54KcZE0YeheBITLdvtNbsiDR2sgGJ0Vpfxq1HCuqN9vaqhDgwCkaN27e
	EqTRAoisFLMN5U0ZIgT0eUXM1TMCr6O57+6TzYQyZEy63nQp5oPAWdGWqis42014nijI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] s390x/ap: fix missing subsystem reset registration
Message-Id: <E1syTaR-00076T-FW@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:06:31 +0000

commit 0ef930a29f432320d979e227a305f927bb15eb09
Author:     Janosch Frank <frankja@linux.ibm.com>
AuthorDate: Wed Aug 23 16:22:15 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    s390x/ap: fix missing subsystem reset registration
    
    A subsystem reset contains a reset of AP resources which has been
    missing.  Adding the AP bridge to the list of device types that need
    reset fixes this issue.
    
    Reviewed-by: Jason J. Herne <jjherne@linux.ibm.com>
    Reviewed-by: Tony Krowiak <akrowiak@linux.ibm.com>
    Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
    Fixes: a51b3153 ("s390x/ap: base Adjunct Processor (AP) object model")
    Message-ID: <20230823142219.1046522-2-seiden@linux.ibm.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 297ec01f0b9864ea8209ca0ddc6643b4c0574bdb)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/s390x/s390-virtio-ccw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 0daf445d60..ea048e4667 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -109,6 +109,7 @@ static const char *const reset_dev_types[] = {
     "s390-flic",
     "diag288",
     TYPE_S390_PCI_HOST_BRIDGE,
+    TYPE_AP_BRIDGE,
 };
 
 static void subsystem_reset(void)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:06:42 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:06:42 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814184.1227492 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTac-0002vb-Gs; Wed, 09 Oct 2024 10:06:42 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814184.1227492; Wed, 09 Oct 2024 10:06: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 1syTac-0002vT-Dy; Wed, 09 Oct 2024 10:06:42 +0000
Received: by outflank-mailman (input) for mailman id 814184;
 Wed, 09 Oct 2024 10:06:41 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTab-0002vI-KA
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:06:41 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTab-0006LA-JY
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:06:41 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTab-00077c-Io
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:06: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=tAZbQeKYOq8UqiUAsAfmEqem7V9MFZlydsxLSPPgPzQ=; b=vqdbmimhzQeaJQxT38Q08aK3R9
	X74mHCESDpioOjZDlotv/syht+Ej9aHwksGjJ3R0acQ07FWH8+GPBcbUB/tz7p4Mq2wQyWhmM3NIc
	dDbKfmZqwY+Vd5b6XTwgo51a2nftcvJQHG70Xnmp2wPQTi6wmMEoo3lPqspdetXSENEQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] tpm: fix crash when FD >= 1024 and unnecessary errors due to EINTR
Message-Id: <E1syTab-00077c-Io@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:06:41 +0000

commit fcf58d6f20d29ee250f542ac8de968700c957134
Author:     Marc-André Lureau <marcandre.lureau@redhat.com>
AuthorDate: Mon Sep 11 17:25:51 2023 +0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    tpm: fix crash when FD >= 1024 and unnecessary errors due to EINTR
    
    Replace select() with poll() to fix a crash when QEMU has a large number
    of FDs. Also use RETRY_ON_EINTR to avoid unnecessary errors due to EINTR.
    
    Cc: qemu-stable@nongnu.org
    Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2020133
    Fixes: 56a3c24ffc ("tpm: Probe for connected TPM 1.2 or TPM 2")
    Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
    Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
    Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
    (cherry picked from commit 8e32ddff69b6b4547cc00592ad816484e160817a)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 backends/tpm/tpm_util.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/backends/tpm/tpm_util.c b/backends/tpm/tpm_util.c
index a6e6d3e72f..1856589c3b 100644
--- a/backends/tpm/tpm_util.c
+++ b/backends/tpm/tpm_util.c
@@ -112,12 +112,8 @@ static int tpm_util_request(int fd,
                             void *response,
                             size_t responselen)
 {
-    fd_set readfds;
+    GPollFD fds[1] = { {.fd = fd, .events = G_IO_IN } };
     int n;
-    struct timeval tv = {
-        .tv_sec = 1,
-        .tv_usec = 0,
-    };
 
     n = write(fd, request, requestlen);
     if (n < 0) {
@@ -127,11 +123,8 @@ static int tpm_util_request(int fd,
         return -EFAULT;
     }
 
-    FD_ZERO(&readfds);
-    FD_SET(fd, &readfds);
-
     /* wait for a second */
-    n = select(fd + 1, &readfds, NULL, NULL, &tv);
+    n = RETRY_ON_EINTR(g_poll(fds, 1, 1000));
     if (n != 1) {
         return -errno;
     }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:06:52 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:06:52 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814185.1227495 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTam-00031R-IL; Wed, 09 Oct 2024 10:06:52 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814185.1227495; Wed, 09 Oct 2024 10:06: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 1syTam-00031J-FZ; Wed, 09 Oct 2024 10:06:52 +0000
Received: by outflank-mailman (input) for mailman id 814185;
 Wed, 09 Oct 2024 10:06:51 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTal-000317-N6
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:06:51 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTal-0006LJ-MR
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:06:51 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTal-00078o-Le
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:06:51 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=JJ774whxR6Pc+rMAthPzCmtpeoTVu0ya6PBeIKom/3I=; b=nsRKaK31Ya7HlFpKIwFXsoyn/Q
	WOhnZWIcMWBfzkdEaOionP4H0M7LNhnPdcpLPkbsT7Ix0xO20mnPuIe0rDJ/Uftnpkif4zKDwOAhl
	ZkKRXwlGN9cRg7NBW0gd2A6KfeWw83lD5z+sbT0bLdxXxY6R11fY2Ri1SdntcPzfndGk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] Update version for 8.0.5 release
Message-Id: <E1syTal-00078o-Le@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:06:51 +0000

commit 6bbce8b464206e6622216b62841cb3e953d56eb8
Author:     Michael Tokarev <mjt@tls.msk.ru>
AuthorDate: Thu Sep 21 19:23:20 2023 +0300
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Thu Sep 21 19:23:20 2023 +0300

    Update version for 8.0.5 release
    
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 VERSION | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/VERSION b/VERSION
index 50c496d20c..904be6d4e4 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-8.0.4
+8.0.5
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:07:02 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:07:02 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814186.1227499 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTaw-000385-Jf; Wed, 09 Oct 2024 10:07:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814186.1227499; Wed, 09 Oct 2024 10:07: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 1syTaw-00037x-Gz; Wed, 09 Oct 2024 10:07:02 +0000
Received: by outflank-mailman (input) for mailman id 814186;
 Wed, 09 Oct 2024 10:07: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 1syTav-00037p-Q3
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:07: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 1syTav-0006LN-PP
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:07:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTav-0007A2-Oi
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:07: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=yQzI8phls7QvAij4J/tYty+Yc+VkOhgW5wOdoTRPzok=; b=pjUmWdOKpjn/5kxWfMxAbWxNzR
	SsquDFvXxyESPfPZt57oJflyg48QnjAqhU3ml3bDxxS1axgIjn0wP1R3Eo+4VJKJWZ4/vSEwJ9ace
	OH1QYr6FcJLq889ATTdoZ4hmz5zy6I9IfSzvq2n1kewaPMJYZHH6mtL2ZSZUQk0PkRUg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.19] Merge tag 'v8.0.5' into 'staging-4.18'
Message-Id: <E1syTav-0007A2-Oi@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:07:01 +0000

commit bdf719c4c535cf14ec4fe8e9cb7a798a5a73fb23
Merge: 6bbce8b464206e6622216b62841cb3e953d56eb8 0df9387c8983e1b1e72d8c574356f572342c03e6
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Wed Oct 9 11:40:12 2024 +0200
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Wed Oct 9 11:40:12 2024 +0200

    Merge tag 'v8.0.5' into 'staging-4.18'

--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:07:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:07:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814187.1227502 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTb7-0003F5-Ku; Wed, 09 Oct 2024 10:07:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814187.1227502; Wed, 09 Oct 2024 10:07: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 1syTb7-0003Ey-IU; Wed, 09 Oct 2024 10:07:13 +0000
Received: by outflank-mailman (input) for mailman id 814187;
 Wed, 09 Oct 2024 10:07: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 1syTb6-0003Eq-UT
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:07: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 1syTb6-0006Lj-Tp
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:07:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTb6-0007LO-SY
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:07: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=LtZNlJ2zx2mkAujoQVii3wvxQL1Zypsr/3Oukg8G/ww=; b=TrMkZdGFcKMCEIJ8oHKirNslnj
	2kboL6mBO3UTntcyhF/toKudj15ep2WTe6LpmG7S+Z6wDNzArbnehv1nmfOedKBZLT+FxeNGA5uIB
	vQu5qx2KdXFXz2PLjazDP6XZJu6aR0QvGFOieIiiWLEXt0E69dK6TLkhh9rVwDLOoVgk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] memory: prevent dma-reentracy issues
Message-Id: <E1syTb6-0007LO-SY@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:07:12 +0000

commit a08c78dda7e018fbbe33bc7979f7a53f89a488b5
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:06 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:01:33 2023 +0300

    memory: prevent dma-reentracy issues
    
    Add a flag to the DeviceState, when a device is engaged in PIO/MMIO/DMA.
    This flag is set/checked prior to calling a device's MemoryRegion
    handlers, and set when device code initiates DMA.  The purpose of this
    flag is to prevent two types of DMA-based reentrancy issues:
    
    1.) mmio -> dma -> mmio case
    2.) bh -> dma write -> mmio case
    
    These issues have led to problems such as stack-exhaustion and
    use-after-frees.
    
    Summary of the problem from Peter Maydell:
    https://lore.kernel.org/qemu-devel/CAFEAcA_23vc7hE3iaM-JVA6W38LK4hJoWae5KcknhPRD5fPBZA@mail.gmail.com
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/62
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/540
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/541
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/556
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/557
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/827
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1282
    Resolves: CVE-2023-0330
    
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Message-Id: <20230427211013.2994127-2-alxndr@bu.edu>
    [thuth: Replace warn_report() with warn_report_once()]
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit a2e1753b8054344f32cf94f31c6399a58794a380)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 include/exec/memory.h  |  5 +++++
 include/hw/qdev-core.h |  7 +++++++
 softmmu/memory.c       | 16 ++++++++++++++++
 3 files changed, 28 insertions(+)

diff --git a/include/exec/memory.h b/include/exec/memory.h
index 15ade918ba..e45ce6061f 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -767,6 +767,8 @@ struct MemoryRegion {
     bool is_iommu;
     RAMBlock *ram_block;
     Object *owner;
+    /* owner as TYPE_DEVICE. Used for re-entrancy checks in MR access hotpath */
+    DeviceState *dev;
 
     const MemoryRegionOps *ops;
     void *opaque;
@@ -791,6 +793,9 @@ struct MemoryRegion {
     unsigned ioeventfd_nb;
     MemoryRegionIoeventfd *ioeventfds;
     RamDiscardManager *rdm; /* Only for RAM */
+
+    /* For devices designed to perform re-entrant IO into their own IO MRs */
+    bool disable_reentrancy_guard;
 };
 
 struct IOMMUMemoryRegion {
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index bd50ad5ee1..7623703943 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -162,6 +162,10 @@ struct NamedClockList {
     QLIST_ENTRY(NamedClockList) node;
 };
 
+typedef struct {
+    bool engaged_in_io;
+} MemReentrancyGuard;
+
 /**
  * DeviceState:
  * @realized: Indicates whether the device has been fully constructed.
@@ -194,6 +198,9 @@ struct DeviceState {
     int alias_required_for_version;
     ResettableState reset;
     GSList *unplug_blockers;
+
+    /* Is the device currently in mmio/pio/dma? Used to prevent re-entrancy */
+    MemReentrancyGuard mem_reentrancy_guard;
 };
 
 struct DeviceListener {
diff --git a/softmmu/memory.c b/softmmu/memory.c
index b1a6cae6f5..b7b3386e9d 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -542,6 +542,18 @@ static MemTxResult access_with_adjusted_size(hwaddr addr,
         access_size_max = 4;
     }
 
+    /* Do not allow more than one simultaneous access to a device's IO Regions */
+    if (mr->dev && !mr->disable_reentrancy_guard &&
+        !mr->ram_device && !mr->ram && !mr->rom_device && !mr->readonly) {
+        if (mr->dev->mem_reentrancy_guard.engaged_in_io) {
+            warn_report_once("Blocked re-entrant IO on MemoryRegion: "
+                             "%s at addr: 0x%" HWADDR_PRIX,
+                             memory_region_name(mr), addr);
+            return MEMTX_ACCESS_ERROR;
+        }
+        mr->dev->mem_reentrancy_guard.engaged_in_io = true;
+    }
+
     /* FIXME: support unaligned access? */
     access_size = MAX(MIN(size, access_size_max), access_size_min);
     access_mask = MAKE_64BIT_MASK(0, access_size * 8);
@@ -556,6 +568,9 @@ static MemTxResult access_with_adjusted_size(hwaddr addr,
                         access_mask, attrs);
         }
     }
+    if (mr->dev) {
+        mr->dev->mem_reentrancy_guard.engaged_in_io = false;
+    }
     return r;
 }
 
@@ -1170,6 +1185,7 @@ static void memory_region_do_init(MemoryRegion *mr,
     }
     mr->name = g_strdup(name);
     mr->owner = owner;
+    mr->dev = (DeviceState *) object_dynamic_cast(mr->owner, TYPE_DEVICE);
     mr->ram_block = NULL;
 
     if (name) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:07:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:07:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814188.1227506 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTbH-0003LZ-Mi; Wed, 09 Oct 2024 10:07:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814188.1227506; Wed, 09 Oct 2024 10:07: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 1syTbH-0003LS-K3; Wed, 09 Oct 2024 10:07:23 +0000
Received: by outflank-mailman (input) for mailman id 814188;
 Wed, 09 Oct 2024 10:07: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 1syTbH-0003LE-1V
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:07: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 1syTbH-0006Ms-0j
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:07:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTbG-0007My-WC
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:07: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=0s/UxIKNvm35kCfBxLMFX16Q+hAkeogaSl8e9b/174c=; b=5w/vNvNOoAUlPJmo0x84/LOnER
	1Fh8XpgSAthAbu4Vf+14EmcTynDLy8ZWku4KATu9rVOLpyo2wTk7kB6BcKYwzR4HbDyTB3EZxo9Tm
	2IMT+hX37tQNMMWKJ9DynzO/q4SI+B3394IJuQ+jwGKXOKNf52Qva+0m/HLXE+8+Ti9c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] async: Add an optional reentrancy guard to the BH API
Message-Id: <E1syTbG-0007My-WC@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:07:22 +0000

commit 932cf49f0620544d1fb37f1d8dd02219a3636ee9
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:07 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:01:33 2023 +0300

    async: Add an optional reentrancy guard to the BH API
    
    Devices can pass their MemoryReentrancyGuard (from their DeviceState),
    when creating new BHes. Then, the async API will toggle the guard
    before/after calling the BH call-back. This prevents bh->mmio reentrancy
    issues.
    
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Message-Id: <20230427211013.2994127-3-alxndr@bu.edu>
    [thuth: Fix "line over 90 characters" checkpatch.pl error]
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 9c86c97f12c060bf7484dd931f38634e166a81f0)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 docs/devel/multiple-iothreads.txt |  7 +++++++
 include/block/aio.h               | 18 ++++++++++++++++--
 include/qemu/main-loop.h          |  7 +++++--
 tests/unit/ptimer-test-stubs.c    |  3 ++-
 util/async.c                      | 18 +++++++++++++++++-
 util/main-loop.c                  |  6 ++++--
 util/trace-events                 |  1 +
 7 files changed, 52 insertions(+), 8 deletions(-)

diff --git a/docs/devel/multiple-iothreads.txt b/docs/devel/multiple-iothreads.txt
index 343120f2ef..a3e949f6b3 100644
--- a/docs/devel/multiple-iothreads.txt
+++ b/docs/devel/multiple-iothreads.txt
@@ -61,6 +61,7 @@ There are several old APIs that use the main loop AioContext:
  * LEGACY qemu_aio_set_event_notifier() - monitor an event notifier
  * LEGACY timer_new_ms() - create a timer
  * LEGACY qemu_bh_new() - create a BH
+ * LEGACY qemu_bh_new_guarded() - create a BH with a device re-entrancy guard
  * LEGACY qemu_aio_wait() - run an event loop iteration
 
 Since they implicitly work on the main loop they cannot be used in code that
@@ -72,8 +73,14 @@ Instead, use the AioContext functions directly (see include/block/aio.h):
  * aio_set_event_notifier() - monitor an event notifier
  * aio_timer_new() - create a timer
  * aio_bh_new() - create a BH
+ * aio_bh_new_guarded() - create a BH with a device re-entrancy guard
  * aio_poll() - run an event loop iteration
 
+The qemu_bh_new_guarded/aio_bh_new_guarded APIs accept a "MemReentrancyGuard"
+argument, which is used to check for and prevent re-entrancy problems. For
+BHs associated with devices, the reentrancy-guard is contained in the
+corresponding DeviceState and named "mem_reentrancy_guard".
+
 The AioContext can be obtained from the IOThread using
 iothread_get_aio_context() or for the main loop using qemu_get_aio_context().
 Code that takes an AioContext argument works both in IOThreads or the main
diff --git a/include/block/aio.h b/include/block/aio.h
index 543717f294..db6f23c619 100644
--- a/include/block/aio.h
+++ b/include/block/aio.h
@@ -23,6 +23,8 @@
 #include "qemu/thread.h"
 #include "qemu/timer.h"
 #include "block/graph-lock.h"
+#include "hw/qdev-core.h"
+
 
 typedef struct BlockAIOCB BlockAIOCB;
 typedef void BlockCompletionFunc(void *opaque, int ret);
@@ -331,9 +333,11 @@ void aio_bh_schedule_oneshot_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
  * is opaque and must be allocated prior to its use.
  *
  * @name: A human-readable identifier for debugging purposes.
+ * @reentrancy_guard: A guard set when entering a cb to prevent
+ * device-reentrancy issues
  */
 QEMUBH *aio_bh_new_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
-                        const char *name);
+                        const char *name, MemReentrancyGuard *reentrancy_guard);
 
 /**
  * aio_bh_new: Allocate a new bottom half structure
@@ -342,7 +346,17 @@ QEMUBH *aio_bh_new_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
  * string.
  */
 #define aio_bh_new(ctx, cb, opaque) \
-    aio_bh_new_full((ctx), (cb), (opaque), (stringify(cb)))
+    aio_bh_new_full((ctx), (cb), (opaque), (stringify(cb)), NULL)
+
+/**
+ * aio_bh_new_guarded: Allocate a new bottom half structure with a
+ * reentrancy_guard
+ *
+ * A convenience wrapper for aio_bh_new_full() that uses the cb as the name
+ * string.
+ */
+#define aio_bh_new_guarded(ctx, cb, opaque, guard) \
+    aio_bh_new_full((ctx), (cb), (opaque), (stringify(cb)), guard)
 
 /**
  * aio_notify: Force processing of pending events.
diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h
index b3e54e00bc..68e70e61aa 100644
--- a/include/qemu/main-loop.h
+++ b/include/qemu/main-loop.h
@@ -387,9 +387,12 @@ void qemu_cond_timedwait_iothread(QemuCond *cond, int ms);
 
 /* internal interfaces */
 
+#define qemu_bh_new_guarded(cb, opaque, guard) \
+    qemu_bh_new_full((cb), (opaque), (stringify(cb)), guard)
 #define qemu_bh_new(cb, opaque) \
-    qemu_bh_new_full((cb), (opaque), (stringify(cb)))
-QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name);
+    qemu_bh_new_full((cb), (opaque), (stringify(cb)), NULL)
+QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name,
+                         MemReentrancyGuard *reentrancy_guard);
 void qemu_bh_schedule_idle(QEMUBH *bh);
 
 enum {
diff --git a/tests/unit/ptimer-test-stubs.c b/tests/unit/ptimer-test-stubs.c
index f2bfcede93..8c9407c560 100644
--- a/tests/unit/ptimer-test-stubs.c
+++ b/tests/unit/ptimer-test-stubs.c
@@ -107,7 +107,8 @@ int64_t qemu_clock_deadline_ns_all(QEMUClockType type, int attr_mask)
     return deadline;
 }
 
-QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name)
+QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name,
+                         MemReentrancyGuard *reentrancy_guard)
 {
     QEMUBH *bh = g_new(QEMUBH, 1);
 
diff --git a/util/async.c b/util/async.c
index 856e1a8a33..9df7674b4e 100644
--- a/util/async.c
+++ b/util/async.c
@@ -65,6 +65,7 @@ struct QEMUBH {
     void *opaque;
     QSLIST_ENTRY(QEMUBH) next;
     unsigned flags;
+    MemReentrancyGuard *reentrancy_guard;
 };
 
 /* Called concurrently from any thread */
@@ -137,7 +138,7 @@ void aio_bh_schedule_oneshot_full(AioContext *ctx, QEMUBHFunc *cb,
 }
 
 QEMUBH *aio_bh_new_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
-                        const char *name)
+                        const char *name, MemReentrancyGuard *reentrancy_guard)
 {
     QEMUBH *bh;
     bh = g_new(QEMUBH, 1);
@@ -146,13 +147,28 @@ QEMUBH *aio_bh_new_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
         .cb = cb,
         .opaque = opaque,
         .name = name,
+        .reentrancy_guard = reentrancy_guard,
     };
     return bh;
 }
 
 void aio_bh_call(QEMUBH *bh)
 {
+    bool last_engaged_in_io = false;
+
+    if (bh->reentrancy_guard) {
+        last_engaged_in_io = bh->reentrancy_guard->engaged_in_io;
+        if (bh->reentrancy_guard->engaged_in_io) {
+            trace_reentrant_aio(bh->ctx, bh->name);
+        }
+        bh->reentrancy_guard->engaged_in_io = true;
+    }
+
     bh->cb(bh->opaque);
+
+    if (bh->reentrancy_guard) {
+        bh->reentrancy_guard->engaged_in_io = last_engaged_in_io;
+    }
 }
 
 /* Multiple occurrences of aio_bh_poll cannot be called concurrently. */
diff --git a/util/main-loop.c b/util/main-loop.c
index e180c85145..7022f02ef8 100644
--- a/util/main-loop.c
+++ b/util/main-loop.c
@@ -605,9 +605,11 @@ void main_loop_wait(int nonblocking)
 
 /* Functions to operate on the main QEMU AioContext.  */
 
-QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name)
+QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name,
+                         MemReentrancyGuard *reentrancy_guard)
 {
-    return aio_bh_new_full(qemu_aio_context, cb, opaque, name);
+    return aio_bh_new_full(qemu_aio_context, cb, opaque, name,
+                           reentrancy_guard);
 }
 
 /*
diff --git a/util/trace-events b/util/trace-events
index 16f78d8fe5..3f7e766683 100644
--- a/util/trace-events
+++ b/util/trace-events
@@ -11,6 +11,7 @@ poll_remove(void *ctx, void *node, int fd) "ctx %p node %p fd %d"
 # async.c
 aio_co_schedule(void *ctx, void *co) "ctx %p co %p"
 aio_co_schedule_bh_cb(void *ctx, void *co) "ctx %p co %p"
+reentrant_aio(void *ctx, const char *name) "ctx %p name %s"
 
 # thread-pool.c
 thread_pool_submit(void *pool, void *req, void *opaque) "pool %p req %p opaque %p"
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:07:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:07:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814189.1227512 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTbR-0003Rc-R3; Wed, 09 Oct 2024 10:07:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814189.1227512; Wed, 09 Oct 2024 10:07: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 1syTbR-0003RU-Nu; Wed, 09 Oct 2024 10:07:33 +0000
Received: by outflank-mailman (input) for mailman id 814189;
 Wed, 09 Oct 2024 10:07: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 1syTbR-0003RO-4S
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:07: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 1syTbR-0006No-3m
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:07:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTbR-0007O2-2r
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:07: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=cBNpw/TTmw45pKLsuHxoDrmevfjjtBZ2qEU2kSojbFo=; b=IXFmCdVbKzbXzmhHVYWJPzguz3
	EqY0CDZT95oL6QXG/o/3N4W2d35Wgc57AlN3pBLctuISf/Z4jUDTmBBtaALC7VJeEOh2soCPVDh7s
	r5Wcmu2o6k97+CCuEr+3yMZ+YtnDgpK2EoG2WET1O8fkMMmiwrLDFB7rIvdZZ6iQ6ke0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] async: avoid use-after-free on re-entrancy guard
Message-Id: <E1syTbR-0007O2-2r@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:07:33 +0000

commit 6a33d4b3453b46ee3fd432d80374f45919985b00
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Mon May 1 10:19:56 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    async: avoid use-after-free on re-entrancy guard
    
    A BH callback can free the BH, causing a use-after-free in aio_bh_call.
    Fix that by keeping a local copy of the re-entrancy guard pointer.
    
    Buglink: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58513
    Fixes: 9c86c97f12 ("async: Add an optional reentrancy guard to the BH API")
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Message-Id: <20230501141956.3444868-1-alxndr@bu.edu>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 7915bd06f25e1803778081161bf6fa10c42dc7cd)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 util/async.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/util/async.c b/util/async.c
index 9df7674b4e..055070ffbd 100644
--- a/util/async.c
+++ b/util/async.c
@@ -156,18 +156,20 @@ void aio_bh_call(QEMUBH *bh)
 {
     bool last_engaged_in_io = false;
 
-    if (bh->reentrancy_guard) {
-        last_engaged_in_io = bh->reentrancy_guard->engaged_in_io;
-        if (bh->reentrancy_guard->engaged_in_io) {
+    /* Make a copy of the guard-pointer as cb may free the bh */
+    MemReentrancyGuard *reentrancy_guard = bh->reentrancy_guard;
+    if (reentrancy_guard) {
+        last_engaged_in_io = reentrancy_guard->engaged_in_io;
+        if (reentrancy_guard->engaged_in_io) {
             trace_reentrant_aio(bh->ctx, bh->name);
         }
-        bh->reentrancy_guard->engaged_in_io = true;
+        reentrancy_guard->engaged_in_io = true;
     }
 
     bh->cb(bh->opaque);
 
-    if (bh->reentrancy_guard) {
-        bh->reentrancy_guard->engaged_in_io = last_engaged_in_io;
+    if (reentrancy_guard) {
+        reentrancy_guard->engaged_in_io = last_engaged_in_io;
     }
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:07:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:07:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814190.1227516 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTbb-0003c5-SM; Wed, 09 Oct 2024 10:07:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814190.1227516; Wed, 09 Oct 2024 10:07: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 1syTbb-0003bx-PH; Wed, 09 Oct 2024 10:07:43 +0000
Received: by outflank-mailman (input) for mailman id 814190;
 Wed, 09 Oct 2024 10:07: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 1syTbb-0003bF-7W
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:07: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 1syTbb-0006Nw-6r
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:07:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTbb-0007PR-67
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:07: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=qmquAjvHBuOBwZOjI76MsF2qU5IYBxtUaJPdFpYUWfg=; b=rcVtuHUjXodMIc9XEl14RdO/uT
	Sh38aS9fyRNeEbJ/7nK+Fk7MCmG+8Gds3se9ZJBHQxfZtld015gpVDljmCZuoeTzm3l4y6kqa6KX+
	bJgGWmqReIpJ5KfMiy98WFGbXlH/R7qWyXZlwn6SQIYG4JQv4+71XE7B1fkWvPnFVS08=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] checkpatch: add qemu_bh_new/aio_bh_new checks
Message-Id: <E1syTbb-0007PR-67@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:07:43 +0000

commit db56206f785909aa830e2a19336bb12abca50e82
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:08 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    checkpatch: add qemu_bh_new/aio_bh_new checks
    
    Advise authors to use the _guarded versions of the APIs, instead.
    
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Message-Id: <20230427211013.2994127-4-alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit ef56ffbdd6b0605dc1e305611287b948c970e236)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 scripts/checkpatch.pl | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d768171dcf..eeaec436eb 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2865,6 +2865,14 @@ sub process {
 		if ($line =~ /\bsignal\s*\(/ && !($line =~ /SIG_(?:IGN|DFL)/)) {
 			ERROR("use sigaction to establish signal handlers; signal is not portable\n" . $herecurr);
 		}
+# recommend qemu_bh_new_guarded instead of qemu_bh_new
+        if ($realfile =~ /.*\/hw\/.*/ && $line =~ /\bqemu_bh_new\s*\(/) {
+			ERROR("use qemu_bh_new_guarded() instead of qemu_bh_new() to avoid reentrancy problems\n" . $herecurr);
+		}
+# recommend aio_bh_new_guarded instead of aio_bh_new
+        if ($realfile =~ /.*\/hw\/.*/ && $line =~ /\baio_bh_new\s*\(/) {
+			ERROR("use aio_bh_new_guarded() instead of aio_bh_new() to avoid reentrancy problems\n" . $herecurr);
+		}
 # check for module_init(), use category-specific init macros explicitly please
 		if ($line =~ /^module_init\s*\(/) {
 			ERROR("please use block_init(), type_init() etc. instead of module_init()\n" . $herecurr);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:07:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:07:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814191.1227519 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTbm-0003lo-Tj; Wed, 09 Oct 2024 10:07:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814191.1227519; Wed, 09 Oct 2024 10:07: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 1syTbm-0003lh-Ql; Wed, 09 Oct 2024 10:07:54 +0000
Received: by outflank-mailman (input) for mailman id 814191;
 Wed, 09 Oct 2024 10:07: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 1syTbl-0003lO-C3
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:07: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 1syTbl-0006O4-BK
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:07:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTbl-0007QY-AX
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:07: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=rvxnUaef7tY+2V5XZhXySg1r+J0QBUz/Yl+0VdzN71Y=; b=PCwQjVfkmcpbjjtfDnjMIGF1oW
	wGVLzEE49FCqrCZhHuvFSqAU77RRkLz8mZZGmnWkKZymRsoLNK4o3+EKLpBT41CFPc5JpgvR1/Rw0
	u2Z1WOQx6mybXqITzw5wZeAvWlww99uOwkYAUkmPhXZiuG5izK327YvYK1MIZIaot7B4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw: replace most qemu_bh_new calls with qemu_bh_new_guarded
Message-Id: <E1syTbl-0007QY-AX@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:07:53 +0000

commit fd9de51ea3f109d427bced84d80815a97bb7faa0
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:09 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    hw: replace most qemu_bh_new calls with qemu_bh_new_guarded
    
    This protects devices from bh->mmio reentrancy issues.
    
    Thanks: Thomas Huth <thuth@redhat.com> for diagnosing OS X test failure.
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Message-Id: <20230427211013.2994127-5-alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit f63192b0544af5d3e4d5edfd85ab520fcf671377)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/9pfs/xen-9p-backend.c        | 5 ++++-
 hw/block/dataplane/virtio-blk.c | 3 ++-
 hw/block/dataplane/xen-block.c  | 5 +++--
 hw/char/virtio-serial-bus.c     | 3 ++-
 hw/display/qxl.c                | 9 ++++++---
 hw/display/virtio-gpu.c         | 6 ++++--
 hw/ide/ahci.c                   | 3 ++-
 hw/ide/ahci_internal.h          | 1 +
 hw/ide/core.c                   | 4 +++-
 hw/misc/imx_rngc.c              | 6 ++++--
 hw/misc/macio/mac_dbdma.c       | 2 +-
 hw/net/virtio-net.c             | 3 ++-
 hw/nvme/ctrl.c                  | 6 ++++--
 hw/scsi/mptsas.c                | 3 ++-
 hw/scsi/scsi-bus.c              | 3 ++-
 hw/scsi/vmw_pvscsi.c            | 3 ++-
 hw/usb/dev-uas.c                | 3 ++-
 hw/usb/hcd-dwc2.c               | 3 ++-
 hw/usb/hcd-ehci.c               | 3 ++-
 hw/usb/hcd-uhci.c               | 2 +-
 hw/usb/host-libusb.c            | 6 ++++--
 hw/usb/redirect.c               | 6 ++++--
 hw/usb/xen-usb.c                | 3 ++-
 hw/virtio/virtio-balloon.c      | 5 +++--
 hw/virtio/virtio-crypto.c       | 3 ++-
 25 files changed, 66 insertions(+), 33 deletions(-)

diff --git a/hw/9pfs/xen-9p-backend.c b/hw/9pfs/xen-9p-backend.c
index 382be1ab11..4aa9c8c736 100644
--- a/hw/9pfs/xen-9p-backend.c
+++ b/hw/9pfs/xen-9p-backend.c
@@ -63,6 +63,7 @@ typedef struct Xen9pfsDev {
 
     int num_rings;
     Xen9pfsRing *rings;
+    MemReentrancyGuard mem_reentrancy_guard;
 } Xen9pfsDev;
 
 static void xen_9pfs_disconnect(struct XenLegacyDevice *xendev);
@@ -450,7 +451,9 @@ static int xen_9pfs_connect(struct XenLegacyDevice *xendev)
         xen_9pdev->rings[i].ring.out = xen_9pdev->rings[i].data +
                                        XEN_FLEX_RING_SIZE(ring_order);
 
-        xen_9pdev->rings[i].bh = qemu_bh_new(xen_9pfs_bh, &xen_9pdev->rings[i]);
+        xen_9pdev->rings[i].bh = qemu_bh_new_guarded(xen_9pfs_bh,
+                                                     &xen_9pdev->rings[i],
+                                                     &xen_9pdev->mem_reentrancy_guard);
         xen_9pdev->rings[i].out_cons = 0;
         xen_9pdev->rings[i].out_size = 0;
         xen_9pdev->rings[i].inprogress = false;
diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
index b28d81737e..a6202997ee 100644
--- a/hw/block/dataplane/virtio-blk.c
+++ b/hw/block/dataplane/virtio-blk.c
@@ -127,7 +127,8 @@ bool virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *conf,
     } else {
         s->ctx = qemu_get_aio_context();
     }
-    s->bh = aio_bh_new(s->ctx, notify_guest_bh, s);
+    s->bh = aio_bh_new_guarded(s->ctx, notify_guest_bh, s,
+                               &DEVICE(vdev)->mem_reentrancy_guard);
     s->batch_notify_vqs = bitmap_new(conf->num_queues);
 
     *dataplane = s;
diff --git a/hw/block/dataplane/xen-block.c b/hw/block/dataplane/xen-block.c
index 734da42ea7..d8bc39d359 100644
--- a/hw/block/dataplane/xen-block.c
+++ b/hw/block/dataplane/xen-block.c
@@ -633,8 +633,9 @@ XenBlockDataPlane *xen_block_dataplane_create(XenDevice *xendev,
     } else {
         dataplane->ctx = qemu_get_aio_context();
     }
-    dataplane->bh = aio_bh_new(dataplane->ctx, xen_block_dataplane_bh,
-                               dataplane);
+    dataplane->bh = aio_bh_new_guarded(dataplane->ctx, xen_block_dataplane_bh,
+                                       dataplane,
+                                       &DEVICE(xendev)->mem_reentrancy_guard);
 
     return dataplane;
 }
diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
index 7d4601cb5d..dd619f0731 100644
--- a/hw/char/virtio-serial-bus.c
+++ b/hw/char/virtio-serial-bus.c
@@ -985,7 +985,8 @@ static void virtser_port_device_realize(DeviceState *dev, Error **errp)
         return;
     }
 
-    port->bh = qemu_bh_new(flush_queued_data_bh, port);
+    port->bh = qemu_bh_new_guarded(flush_queued_data_bh, port,
+                                   &dev->mem_reentrancy_guard);
     port->elem = NULL;
 }
 
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 80ce1e9a93..f1c0eb7dfc 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -2201,11 +2201,14 @@ static void qxl_realize_common(PCIQXLDevice *qxl, Error **errp)
 
     qemu_add_vm_change_state_handler(qxl_vm_change_state_handler, qxl);
 
-    qxl->update_irq = qemu_bh_new(qxl_update_irq_bh, qxl);
+    qxl->update_irq = qemu_bh_new_guarded(qxl_update_irq_bh, qxl,
+                                          &DEVICE(qxl)->mem_reentrancy_guard);
     qxl_reset_state(qxl);
 
-    qxl->update_area_bh = qemu_bh_new(qxl_render_update_area_bh, qxl);
-    qxl->ssd.cursor_bh = qemu_bh_new(qemu_spice_cursor_refresh_bh, &qxl->ssd);
+    qxl->update_area_bh = qemu_bh_new_guarded(qxl_render_update_area_bh, qxl,
+                                              &DEVICE(qxl)->mem_reentrancy_guard);
+    qxl->ssd.cursor_bh = qemu_bh_new_guarded(qemu_spice_cursor_refresh_bh, &qxl->ssd,
+                                             &DEVICE(qxl)->mem_reentrancy_guard);
 }
 
 static void qxl_realize_primary(PCIDevice *dev, Error **errp)
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 4e2e0dd53a..7c13b056b9 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -1356,8 +1356,10 @@ void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
 
     g->ctrl_vq = virtio_get_queue(vdev, 0);
     g->cursor_vq = virtio_get_queue(vdev, 1);
-    g->ctrl_bh = qemu_bh_new(virtio_gpu_ctrl_bh, g);
-    g->cursor_bh = qemu_bh_new(virtio_gpu_cursor_bh, g);
+    g->ctrl_bh = qemu_bh_new_guarded(virtio_gpu_ctrl_bh, g,
+                                     &qdev->mem_reentrancy_guard);
+    g->cursor_bh = qemu_bh_new_guarded(virtio_gpu_cursor_bh, g,
+                                       &qdev->mem_reentrancy_guard);
     QTAILQ_INIT(&g->reslist);
     QTAILQ_INIT(&g->cmdq);
     QTAILQ_INIT(&g->fenceq);
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 55902e1df7..4e76d6b191 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1509,7 +1509,8 @@ static void ahci_cmd_done(const IDEDMA *dma)
     ahci_write_fis_d2h(ad);
 
     if (ad->port_regs.cmd_issue && !ad->check_bh) {
-        ad->check_bh = qemu_bh_new(ahci_check_cmd_bh, ad);
+        ad->check_bh = qemu_bh_new_guarded(ahci_check_cmd_bh, ad,
+                                           &ad->mem_reentrancy_guard);
         qemu_bh_schedule(ad->check_bh);
     }
 }
diff --git a/hw/ide/ahci_internal.h b/hw/ide/ahci_internal.h
index 303fcd7235..2480455372 100644
--- a/hw/ide/ahci_internal.h
+++ b/hw/ide/ahci_internal.h
@@ -321,6 +321,7 @@ struct AHCIDevice {
     bool init_d2h_sent;
     AHCICmdHdr *cur_cmd;
     NCQTransferState ncq_tfs[AHCI_MAX_CMDS];
+    MemReentrancyGuard mem_reentrancy_guard;
 };
 
 struct AHCIPCIState {
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 45d14a25e9..de48ff9f86 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -513,6 +513,7 @@ BlockAIOCB *ide_issue_trim(
         BlockCompletionFunc *cb, void *cb_opaque, void *opaque)
 {
     IDEState *s = opaque;
+    IDEDevice *dev = s->unit ? s->bus->slave : s->bus->master;
     TrimAIOCB *iocb;
 
     /* Paired with a decrement in ide_trim_bh_cb() */
@@ -520,7 +521,8 @@ BlockAIOCB *ide_issue_trim(
 
     iocb = blk_aio_get(&trim_aiocb_info, s->blk, cb, cb_opaque);
     iocb->s = s;
-    iocb->bh = qemu_bh_new(ide_trim_bh_cb, iocb);
+    iocb->bh = qemu_bh_new_guarded(ide_trim_bh_cb, iocb,
+                                   &DEVICE(dev)->mem_reentrancy_guard);
     iocb->ret = 0;
     iocb->qiov = qiov;
     iocb->i = -1;
diff --git a/hw/misc/imx_rngc.c b/hw/misc/imx_rngc.c
index 632c03779c..082c6980ad 100644
--- a/hw/misc/imx_rngc.c
+++ b/hw/misc/imx_rngc.c
@@ -228,8 +228,10 @@ static void imx_rngc_realize(DeviceState *dev, Error **errp)
     sysbus_init_mmio(sbd, &s->iomem);
 
     sysbus_init_irq(sbd, &s->irq);
-    s->self_test_bh = qemu_bh_new(imx_rngc_self_test, s);
-    s->seed_bh = qemu_bh_new(imx_rngc_seed, s);
+    s->self_test_bh = qemu_bh_new_guarded(imx_rngc_self_test, s,
+                                          &dev->mem_reentrancy_guard);
+    s->seed_bh = qemu_bh_new_guarded(imx_rngc_seed, s,
+                                     &dev->mem_reentrancy_guard);
 }
 
 static void imx_rngc_reset(DeviceState *dev)
diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c
index 43bb1f56ba..80a789f32b 100644
--- a/hw/misc/macio/mac_dbdma.c
+++ b/hw/misc/macio/mac_dbdma.c
@@ -914,7 +914,7 @@ static void mac_dbdma_realize(DeviceState *dev, Error **errp)
 {
     DBDMAState *s = MAC_DBDMA(dev);
 
-    s->bh = qemu_bh_new(DBDMA_run_bh, s);
+    s->bh = qemu_bh_new_guarded(DBDMA_run_bh, s, &dev->mem_reentrancy_guard);
 }
 
 static void mac_dbdma_class_init(ObjectClass *oc, void *data)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 3b66c97e3d..c9ba367c1b 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -2919,7 +2919,8 @@ static void virtio_net_add_queue(VirtIONet *n, int index)
         n->vqs[index].tx_vq =
             virtio_add_queue(vdev, n->net_conf.tx_queue_size,
                              virtio_net_handle_tx_bh);
-        n->vqs[index].tx_bh = qemu_bh_new(virtio_net_tx_bh, &n->vqs[index]);
+        n->vqs[index].tx_bh = qemu_bh_new_guarded(virtio_net_tx_bh, &n->vqs[index],
+                                                  &DEVICE(vdev)->mem_reentrancy_guard);
     }
 
     n->vqs[index].tx_waiting = 0;
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 2097fb1310..812246689c 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -4607,7 +4607,8 @@ static void nvme_init_sq(NvmeSQueue *sq, NvmeCtrl *n, uint64_t dma_addr,
         QTAILQ_INSERT_TAIL(&(sq->req_list), &sq->io_req[i], entry);
     }
 
-    sq->bh = qemu_bh_new(nvme_process_sq, sq);
+    sq->bh = qemu_bh_new_guarded(nvme_process_sq, sq,
+                                 &DEVICE(sq->ctrl)->mem_reentrancy_guard);
 
     if (n->dbbuf_enabled) {
         sq->db_addr = n->dbbuf_dbs + (sqid << 3);
@@ -5253,7 +5254,8 @@ static void nvme_init_cq(NvmeCQueue *cq, NvmeCtrl *n, uint64_t dma_addr,
         }
     }
     n->cq[cqid] = cq;
-    cq->bh = qemu_bh_new(nvme_post_cqes, cq);
+    cq->bh = qemu_bh_new_guarded(nvme_post_cqes, cq,
+                                 &DEVICE(cq->ctrl)->mem_reentrancy_guard);
 }
 
 static uint16_t nvme_create_cq(NvmeCtrl *n, NvmeRequest *req)
diff --git a/hw/scsi/mptsas.c b/hw/scsi/mptsas.c
index c485da792c..3de288b454 100644
--- a/hw/scsi/mptsas.c
+++ b/hw/scsi/mptsas.c
@@ -1322,7 +1322,8 @@ static void mptsas_scsi_realize(PCIDevice *dev, Error **errp)
     }
     s->max_devices = MPTSAS_NUM_PORTS;
 
-    s->request_bh = qemu_bh_new(mptsas_fetch_requests, s);
+    s->request_bh = qemu_bh_new_guarded(mptsas_fetch_requests, s,
+                                        &DEVICE(dev)->mem_reentrancy_guard);
 
     scsi_bus_init(&s->bus, sizeof(s->bus), &dev->qdev, &mptsas_scsi_info);
 }
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index c97176110c..3c20b47ad0 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -193,7 +193,8 @@ static void scsi_dma_restart_cb(void *opaque, bool running, RunState state)
         AioContext *ctx = blk_get_aio_context(s->conf.blk);
         /* The reference is dropped in scsi_dma_restart_bh.*/
         object_ref(OBJECT(s));
-        s->bh = aio_bh_new(ctx, scsi_dma_restart_bh, s);
+        s->bh = aio_bh_new_guarded(ctx, scsi_dma_restart_bh, s,
+                                   &DEVICE(s)->mem_reentrancy_guard);
         qemu_bh_schedule(s->bh);
     }
 }
diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
index fa76696855..4de34536e9 100644
--- a/hw/scsi/vmw_pvscsi.c
+++ b/hw/scsi/vmw_pvscsi.c
@@ -1184,7 +1184,8 @@ pvscsi_realizefn(PCIDevice *pci_dev, Error **errp)
         pcie_endpoint_cap_init(pci_dev, PVSCSI_EXP_EP_OFFSET);
     }
 
-    s->completion_worker = qemu_bh_new(pvscsi_process_completion_queue, s);
+    s->completion_worker = qemu_bh_new_guarded(pvscsi_process_completion_queue, s,
+                                               &DEVICE(pci_dev)->mem_reentrancy_guard);
 
     scsi_bus_init(&s->bus, sizeof(s->bus), DEVICE(pci_dev), &pvscsi_scsi_info);
     /* override default SCSI bus hotplug-handler, with pvscsi's one */
diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c
index 88f99c05d5..f013ded91e 100644
--- a/hw/usb/dev-uas.c
+++ b/hw/usb/dev-uas.c
@@ -937,7 +937,8 @@ static void usb_uas_realize(USBDevice *dev, Error **errp)
 
     QTAILQ_INIT(&uas->results);
     QTAILQ_INIT(&uas->requests);
-    uas->status_bh = qemu_bh_new(usb_uas_send_status_bh, uas);
+    uas->status_bh = qemu_bh_new_guarded(usb_uas_send_status_bh, uas,
+                                         &d->mem_reentrancy_guard);
 
     dev->flags |= (1 << USB_DEV_FLAG_IS_SCSI_STORAGE);
     scsi_bus_init(&uas->bus, sizeof(uas->bus), DEVICE(dev), &usb_uas_scsi_info);
diff --git a/hw/usb/hcd-dwc2.c b/hw/usb/hcd-dwc2.c
index 8755e9cbb0..a0c4e782b2 100644
--- a/hw/usb/hcd-dwc2.c
+++ b/hw/usb/hcd-dwc2.c
@@ -1364,7 +1364,8 @@ static void dwc2_realize(DeviceState *dev, Error **errp)
     s->fi = USB_FRMINTVL - 1;
     s->eof_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, dwc2_frame_boundary, s);
     s->frame_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, dwc2_work_timer, s);
-    s->async_bh = qemu_bh_new(dwc2_work_bh, s);
+    s->async_bh = qemu_bh_new_guarded(dwc2_work_bh, s,
+                                      &dev->mem_reentrancy_guard);
 
     sysbus_init_irq(sbd, &s->irq);
 }
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index d4da8dcb8d..c930c60921 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -2533,7 +2533,8 @@ void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp)
     }
 
     s->frame_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, ehci_work_timer, s);
-    s->async_bh = qemu_bh_new(ehci_work_bh, s);
+    s->async_bh = qemu_bh_new_guarded(ehci_work_bh, s,
+                                      &dev->mem_reentrancy_guard);
     s->device = dev;
 
     s->vmstate = qemu_add_vm_change_state_handler(usb_ehci_vm_state_change, s);
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index 8ac1175ad2..77baaa7a6b 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -1190,7 +1190,7 @@ void usb_uhci_common_realize(PCIDevice *dev, Error **errp)
                               USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
         }
     }
-    s->bh = qemu_bh_new(uhci_bh, s);
+    s->bh = qemu_bh_new_guarded(uhci_bh, s, &DEVICE(dev)->mem_reentrancy_guard);
     s->frame_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, uhci_frame_timer, s);
     s->num_ports_vmstate = NB_PORTS;
     QTAILQ_INIT(&s->queues);
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index 176868d345..f500db85ab 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -1141,7 +1141,8 @@ static void usb_host_nodev_bh(void *opaque)
 static void usb_host_nodev(USBHostDevice *s)
 {
     if (!s->bh_nodev) {
-        s->bh_nodev = qemu_bh_new(usb_host_nodev_bh, s);
+        s->bh_nodev = qemu_bh_new_guarded(usb_host_nodev_bh, s,
+                                          &DEVICE(s)->mem_reentrancy_guard);
     }
     qemu_bh_schedule(s->bh_nodev);
 }
@@ -1739,7 +1740,8 @@ static int usb_host_post_load(void *opaque, int version_id)
     USBHostDevice *dev = opaque;
 
     if (!dev->bh_postld) {
-        dev->bh_postld = qemu_bh_new(usb_host_post_load_bh, dev);
+        dev->bh_postld = qemu_bh_new_guarded(usb_host_post_load_bh, dev,
+                                             &DEVICE(dev)->mem_reentrancy_guard);
     }
     qemu_bh_schedule(dev->bh_postld);
     dev->bh_postld_pending = true;
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index fd7df599bc..39fbaaab16 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -1441,8 +1441,10 @@ static void usbredir_realize(USBDevice *udev, Error **errp)
         }
     }
 
-    dev->chardev_close_bh = qemu_bh_new(usbredir_chardev_close_bh, dev);
-    dev->device_reject_bh = qemu_bh_new(usbredir_device_reject_bh, dev);
+    dev->chardev_close_bh = qemu_bh_new_guarded(usbredir_chardev_close_bh, dev,
+                                                &DEVICE(dev)->mem_reentrancy_guard);
+    dev->device_reject_bh = qemu_bh_new_guarded(usbredir_device_reject_bh, dev,
+                                                &DEVICE(dev)->mem_reentrancy_guard);
     dev->attach_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, usbredir_do_attach, dev);
 
     packet_id_queue_init(&dev->cancelled, dev, "cancelled");
diff --git a/hw/usb/xen-usb.c b/hw/usb/xen-usb.c
index 66cb3f7c24..38ee660a30 100644
--- a/hw/usb/xen-usb.c
+++ b/hw/usb/xen-usb.c
@@ -1032,7 +1032,8 @@ static void usbback_alloc(struct XenLegacyDevice *xendev)
 
     QTAILQ_INIT(&usbif->req_free_q);
     QSIMPLEQ_INIT(&usbif->hotplug_q);
-    usbif->bh = qemu_bh_new(usbback_bh, usbif);
+    usbif->bh = qemu_bh_new_guarded(usbback_bh, usbif,
+                                    &DEVICE(xendev)->mem_reentrancy_guard);
 }
 
 static int usbback_free(struct XenLegacyDevice *xendev)
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index 746f07c4d2..d60dd1f61e 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -908,8 +908,9 @@ static void virtio_balloon_device_realize(DeviceState *dev, Error **errp)
         precopy_add_notifier(&s->free_page_hint_notify);
 
         object_ref(OBJECT(s->iothread));
-        s->free_page_bh = aio_bh_new(iothread_get_aio_context(s->iothread),
-                                     virtio_ballloon_get_free_page_hints, s);
+        s->free_page_bh = aio_bh_new_guarded(iothread_get_aio_context(s->iothread),
+                                             virtio_ballloon_get_free_page_hints, s,
+                                             &dev->mem_reentrancy_guard);
     }
 
     if (virtio_has_feature(s->host_features, VIRTIO_BALLOON_F_REPORTING)) {
diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c
index ccaa704530..f4a25de5ac 100644
--- a/hw/virtio/virtio-crypto.c
+++ b/hw/virtio/virtio-crypto.c
@@ -1081,7 +1081,8 @@ static void virtio_crypto_device_realize(DeviceState *dev, Error **errp)
         vcrypto->vqs[i].dataq =
                  virtio_add_queue(vdev, 1024, virtio_crypto_handle_dataq_bh);
         vcrypto->vqs[i].dataq_bh =
-                 qemu_bh_new(virtio_crypto_dataq_bh, &vcrypto->vqs[i]);
+                 qemu_bh_new_guarded(virtio_crypto_dataq_bh, &vcrypto->vqs[i],
+                                     &dev->mem_reentrancy_guard);
         vcrypto->vqs[i].vcrypto = vcrypto;
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:08:05 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:08:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814192.1227523 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTbw-0003rH-VJ; Wed, 09 Oct 2024 10:08:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814192.1227523; Wed, 09 Oct 2024 10:08: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 1syTbw-0003r9-SO; Wed, 09 Oct 2024 10:08:04 +0000
Received: by outflank-mailman (input) for mailman id 814192;
 Wed, 09 Oct 2024 10:08: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 1syTbv-0003pZ-F8
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:08: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 1syTbv-0006OO-EN
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:08:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTbv-0007SJ-Dd
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:08: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=lyQd6RSfPgtmXHGVrLvWAy7Xa1eZxfG+il/I6b9vYto=; b=O9hE/9Y60GDrJfv821sYZwNwUY
	+l3ZrGPlQPrWNCdjl07y6V4JLVV8JtmWEx1Lh2cCV/QuXTscZy53ikHcB7TcgHfYHr2oWWQBg3LNU
	WWry8T8xiBHg4Vmd+iQ8MKWvbo/MJ/I1D4BuF5yOBEpCZtry0DJieOLt5mNKqR3ej0eA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] lsi53c895a: disable reentrancy detection for script RAM
Message-Id: <E1syTbv-0007SJ-Dd@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:08:03 +0000

commit db43c7db206427ff5f6cbc7116c66d6cc6e81385
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:10 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    lsi53c895a: disable reentrancy detection for script RAM
    
    As the code is designed to use the memory APIs to access the script ram,
    disable reentrancy checks for the pseudo-RAM ram_io MemoryRegion.
    
    In the future, ram_io may be converted from an IO to a proper RAM MemoryRegion.
    
    Reported-by: Fiona Ebner <f.ebner@proxmox.com>
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Message-Id: <20230427211013.2994127-6-alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit bfd6e7ae6a72b84e2eb9574f56e6ec037f05182c)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/scsi/lsi53c895a.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index bbf32d3f73..17af67935f 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -2313,6 +2313,12 @@ static void lsi_scsi_realize(PCIDevice *dev, Error **errp)
     memory_region_init_io(&s->io_io, OBJECT(s), &lsi_io_ops, s,
                           "lsi-io", 256);
 
+    /*
+     * Since we use the address-space API to interact with ram_io, disable the
+     * re-entrancy guard.
+     */
+    s->ram_io.disable_reentrancy_guard = true;
+
     address_space_init(&s->pci_io_as, pci_address_space_io(dev), "lsi-pci-io");
     qdev_init_gpio_out(d, &s->ext_irq, 1);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:08:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:08:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814193.1227526 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTc7-0003xJ-24; Wed, 09 Oct 2024 10:08:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814193.1227526; Wed, 09 Oct 2024 10:08: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 1syTc6-0003xC-Vs; Wed, 09 Oct 2024 10:08:14 +0000
Received: by outflank-mailman (input) for mailman id 814193;
 Wed, 09 Oct 2024 10:08: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 1syTc5-0003wz-I0
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:08: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 1syTc5-0006OX-HL
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:08:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTc5-0007Tc-Ge
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:08: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=cJsJhOFjecfV6URn1x03W5CgptXbr7JsQhtL5SXq1FY=; b=Y1R7TfcS5VqLQrGXV3yYy7YcYm
	y1CDpz6uhz2DYeMlOhcuNKxVMNeotiB7HSTrpE63nfK461eHroPrc4nykVvNtaypM34EJDepUDt10
	zmH9sKhmnZIoiuG32pPh5bgMXmZP5PNw+VbvTHLwLgKN5rsEsk7chnLURR60P3LiP9VI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] lsi53c895a: disable reentrancy detection for MMIO region, too
Message-Id: <E1syTc5-0007Tc-Ge@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:08:13 +0000

commit 0f0fb19d2bae3a5184fdbfcaa5de24f6ce759042
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Tue May 16 11:05:56 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    lsi53c895a: disable reentrancy detection for MMIO region, too
    
    While trying to use a SCSI disk on the LSI controller with an
    older version of Fedora (25), I'm getting:
    
     qemu: warning: Blocked re-entrant IO on MemoryRegion: lsi-mmio at addr: 0x34
    
    and the SCSI controller is not usable. Seems like we have to
    disable the reentrancy checker for the MMIO region, too, to
    get this working again.
    
    The problem could be reproduced it like this:
    
    ./qemu-system-x86_64 -accel kvm -m 2G -machine q35 \
     -device lsi53c810,id=lsi1 -device scsi-hd,drive=d0 \
     -drive if=none,id=d0,file=.../somedisk.qcow2 \
     -cdrom Fedora-Everything-netinst-i386-25-1.3.iso
    
    Where somedisk.qcow2 is an image that contains already some partitions
    and file systems.
    
    In the boot menu of Fedora, go to
    "Troubleshooting" -> "Rescue a Fedora system" -> "3) Skip to shell"
    
    Then check "dmesg | grep -i 53c" for failure messages, and try to mount
    a partition from somedisk.qcow2.
    
    Message-Id: <20230516090556.553813-1-thuth@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit d139fe9ad8a27bcc50b4ead77d2f97d191a0e95e)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/scsi/lsi53c895a.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index 17af67935f..f7d45b0b20 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -2318,6 +2318,7 @@ static void lsi_scsi_realize(PCIDevice *dev, Error **errp)
      * re-entrancy guard.
      */
     s->ram_io.disable_reentrancy_guard = true;
+    s->mmio_io.disable_reentrancy_guard = true;
 
     address_space_init(&s->pci_io_as, pci_address_space_io(dev), "lsi-pci-io");
     qdev_init_gpio_out(d, &s->ext_irq, 1);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:08:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:08:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814194.1227531 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTcH-00041U-3m; Wed, 09 Oct 2024 10:08:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814194.1227531; Wed, 09 Oct 2024 10:08: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 1syTcH-00041M-1H; Wed, 09 Oct 2024 10:08:25 +0000
Received: by outflank-mailman (input) for mailman id 814194;
 Wed, 09 Oct 2024 10:08: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 1syTcF-00040u-L3
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:08: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 1syTcF-0006Og-KO
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:08:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTcF-0007Uo-JZ
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:08: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=hjm1+z2YWHnDCs3DVjiyxWXEIgqq4QcVjn3AKbqGrz8=; b=ZS5qpiyS2Q7TidcAzix4gyt6hf
	RnuqKk6yA5iEkfdR3MzEfHWyA1uvWKc5dNfb5HmsBjlCa+p7QBPhuKYQO10BLHmD2008SbOI57H+3
	A7tPlW2e9tccyq1ahj4QNXn5dD0W3K1m5Ip059azZjYQOqu5fU7lw1i53bsndq5rN/ao=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] bcm2835_property: disable reentrancy detection for iomem
Message-Id: <E1syTcF-0007Uo-JZ@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:08:23 +0000

commit 83d080e85ae769dddf67118b420ec39bfcc3323f
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:11 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    bcm2835_property: disable reentrancy detection for iomem
    
    As the code is designed for re-entrant calls from bcm2835_property to
    bcm2835_mbox and back into bcm2835_property, mark iomem as
    reentrancy-safe.
    
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Message-Id: <20230427211013.2994127-7-alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 985c4a4e547afb9573b6bd6843d20eb2c3d1d1cd)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/misc/bcm2835_property.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c
index 890ae7bae5..de056ea2df 100644
--- a/hw/misc/bcm2835_property.c
+++ b/hw/misc/bcm2835_property.c
@@ -382,6 +382,13 @@ static void bcm2835_property_init(Object *obj)
 
     memory_region_init_io(&s->iomem, OBJECT(s), &bcm2835_property_ops, s,
                           TYPE_BCM2835_PROPERTY, 0x10);
+
+    /*
+     * bcm2835_property_ops call into bcm2835_mbox, which in-turn reads from
+     * iomem. As such, mark iomem as re-entracy safe.
+     */
+    s->iomem.disable_reentrancy_guard = true;
+
     sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->iomem);
     sysbus_init_irq(SYS_BUS_DEVICE(s), &s->mbox_irq);
 }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:08:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:08:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814195.1227535 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTcR-00045G-5V; Wed, 09 Oct 2024 10:08:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814195.1227535; Wed, 09 Oct 2024 10:08: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 1syTcR-000458-2j; Wed, 09 Oct 2024 10:08:35 +0000
Received: by outflank-mailman (input) for mailman id 814195;
 Wed, 09 Oct 2024 10:08: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 1syTcP-00044y-Nw
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:08: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 1syTcP-0006P3-NJ
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:08:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTcP-0007XT-Me
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:08: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=sN38jTwjwxZkc7vGADERPdYEja+5GqyYXhrphmvmG2M=; b=FiLv7w6VsaLYf/CI4TqWkFc/dz
	oQBQF3F3iuowJfJYCfrpWzZqJZq/RZhyJb/LM7day7c1XCCmvhjA6QYUicJIWtRpmrDtn6gQ0iEeH
	OOQ1rFelN83ARw7PquKlqfTFt6mG/8e91R+ytK5nmcvYmT8CfEGh30rTWX5si8t3psVo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] raven: disable reentrancy detection for iomem
Message-Id: <E1syTcP-0007XT-Me@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:08:33 +0000

commit 151649da1b821809d016c03287301ee0f81596c4
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:12 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    raven: disable reentrancy detection for iomem
    
    As the code is designed for re-entrant calls from raven_io_ops to
    pci-conf, mark raven_io_ops as reentrancy-safe.
    
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Message-Id: <20230427211013.2994127-8-alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 6dad5a6810d9c60ca320d01276f6133bbcfa1fc7)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/pci-host/raven.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c
index 072ffe3c5e..9a11ac4b2b 100644
--- a/hw/pci-host/raven.c
+++ b/hw/pci-host/raven.c
@@ -294,6 +294,13 @@ static void raven_pcihost_initfn(Object *obj)
     memory_region_init(&s->pci_memory, obj, "pci-memory", 0x3f000000);
     address_space_init(&s->pci_io_as, &s->pci_io, "raven-io");
 
+    /*
+     * Raven's raven_io_ops use the address-space API to access pci-conf-idx
+     * (which is also owned by the raven device). As such, mark the
+     * pci_io_non_contiguous as re-entrancy safe.
+     */
+    s->pci_io_non_contiguous.disable_reentrancy_guard = true;
+
     /* CPU address space */
     memory_region_add_subregion(address_space_mem, PCI_IO_BASE_ADDR,
                                 &s->pci_io);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:08:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:08:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814196.1227538 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTcb-0004Dc-6j; Wed, 09 Oct 2024 10:08:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814196.1227538; Wed, 09 Oct 2024 10:08: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 1syTcb-0004DU-44; Wed, 09 Oct 2024 10:08:45 +0000
Received: by outflank-mailman (input) for mailman id 814196;
 Wed, 09 Oct 2024 10:08: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 1syTcZ-0004Br-Qy
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:08: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 1syTcZ-0006PB-QH
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:08:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTcZ-0007Yj-PY
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:08: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=hxrrz4YgziY5HNiDgE13ZiJChVIzqth544L+TDvQ8Y4=; b=1R8aTotrcLHUOICuy6LOZDknyM
	lmhWNDhfgQ/hDVu9ksK/gcx4G9njBn5s/wfjDj4+vww58ulUDEmrc0gKtB/IS83l/jUis52ey2XWz
	XUNh8FpYuwa9Oy/PinJZM8V92ZlNNOQxwyWE2SFX6q01yaQXWSIWqwscr5BqwuuThMmo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] apic: disable reentrancy detection for apic-msi
Message-Id: <E1syTcZ-0007Yj-PY@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:08:43 +0000

commit 305ffdeca8d134e5982e18137fc369eb929b2059
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:13 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    apic: disable reentrancy detection for apic-msi
    
    As the code is designed for re-entrant calls to apic-msi, mark apic-msi
    as reentrancy-safe.
    
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Message-Id: <20230427211013.2994127-9-alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 50795ee051a342c681a9b45671c552fbd6274db8)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/intc/apic.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/intc/apic.c b/hw/intc/apic.c
index 20b5a94073..ac3d47d231 100644
--- a/hw/intc/apic.c
+++ b/hw/intc/apic.c
@@ -885,6 +885,13 @@ static void apic_realize(DeviceState *dev, Error **errp)
     memory_region_init_io(&s->io_memory, OBJECT(s), &apic_io_ops, s, "apic-msi",
                           APIC_SPACE_SIZE);
 
+    /*
+     * apic-msi's apic_mem_write can call into ioapic_eoi_broadcast, which can
+     * write back to apic-msi. As such mark the apic-msi region re-entrancy
+     * safe.
+     */
+    s->io_memory.disable_reentrancy_guard = true;
+
     s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, apic_timer, s);
     local_apics[s->id] = s;
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:08:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:08:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814197.1227543 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTcl-0004KN-8D; Wed, 09 Oct 2024 10:08:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814197.1227543; Wed, 09 Oct 2024 10:08: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 1syTcl-0004KF-5T; Wed, 09 Oct 2024 10:08:55 +0000
Received: by outflank-mailman (input) for mailman id 814197;
 Wed, 09 Oct 2024 10:08: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 1syTcj-0004HP-UB
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:08: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 1syTcj-0006PK-TT
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:08:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTcj-0007Zk-Se
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:08: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=+6uGe0F7vWV3ja7LrB1B9asELxL1ozZzSIWg5Ur8pwM=; b=tBzpUZ3Yc9A/Mnz/jjXZN/cQfP
	XyUMwShF4fDztqWbWNHfKRKS0bprekc628/UkOfzUv+jMg2CUKKC1KEkAM/VunoXjpHdTOs7g/f8n
	bPu/Bf1IbCyQJVfze/mK5jxyQn9G70KD48m7yhNat9eiy9g/DHMy8ZG24jCd87C5L7CA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] loongarch: mark loongarch_ipi_iocsr re-entrnacy safe
Message-Id: <E1syTcj-0007Zk-Se@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:08:53 +0000

commit 48c04e42f033bf2e717052d99192fada589d62b3
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Sat May 6 07:21:45 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    loongarch: mark loongarch_ipi_iocsr re-entrnacy safe
    
    loongarch_ipi_iocsr MRs rely on re-entrant IO through the ipi_send
    function. As such, mark these MRs re-entrancy-safe.
    
    Fixes: a2e1753b80 ("memory: prevent dma-reentracy issues")
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Song Gao <gaosong@loongson.cn>
    Message-Id: <20230506112145.3563708-1-alxndr@bu.edu>
    Signed-off-by: Song Gao <gaosong@loongson.cn>
    (cherry picked from commit 6d0589e0e6c64b888864a2bf980537be20389264)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/intc/loongarch_ipi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/intc/loongarch_ipi.c b/hw/intc/loongarch_ipi.c
index aa4bf9eb74..40e98af2ce 100644
--- a/hw/intc/loongarch_ipi.c
+++ b/hw/intc/loongarch_ipi.c
@@ -215,6 +215,10 @@ static void loongarch_ipi_init(Object *obj)
     for (cpu = 0; cpu < MAX_IPI_CORE_NUM; cpu++) {
         memory_region_init_io(&s->ipi_iocsr_mem[cpu], obj, &loongarch_ipi_ops,
                             &lams->ipi_core[cpu], "loongarch_ipi_iocsr", 0x48);
+
+        /* loongarch_ipi_iocsr performs re-entrant IO through ipi_send */
+        s->ipi_iocsr_mem[cpu].disable_reentrancy_guard = true;
+
         sysbus_init_mmio(sbd, &s->ipi_iocsr_mem[cpu]);
 
         memory_region_init_io(&s->ipi64_iocsr_mem[cpu], obj, &loongarch_ipi64_ops,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:09:05 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:09:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814198.1227546 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTcv-0004Q8-9V; Wed, 09 Oct 2024 10:09:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814198.1227546; Wed, 09 Oct 2024 10:09: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 1syTcv-0004Q0-6t; Wed, 09 Oct 2024 10:09:05 +0000
Received: by outflank-mailman (input) for mailman id 814198;
 Wed, 09 Oct 2024 10:09: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 1syTcu-0004Po-0w
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:09: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 1syTcu-0006Pe-0H
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:09:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTct-0007b4-Vj
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:09: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=+5vwJ3wEH6BkZxfWkKI2N7cZwl+Ebfib121tu4iE3zY=; b=wwEDukkZRn0L/PipSXX60VETSJ
	mXmFJXLwfAxVv3x6Wptk06vRncgR1fy1kG8eEuffY3PA7WWSuEsdJNPSd8KoENDbPIasSfpIae9OB
	9RUrTUVPOhXoBsD1cNJQHE65EUpXkNMGELQtj5j51PJWf4TOPhl7kKtKaMwco00sVolA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] pnv_lpc: disable reentrancy detection for lpc-hc
Message-Id: <E1syTct-0007b4-Vj@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:09:03 +0000

commit e7f12ce43d9fc6016c1f12d49bcb5e024663d7ad
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Fri May 26 09:38:50 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    pnv_lpc: disable reentrancy detection for lpc-hc
    
    As lpc-hc is designed for re-entrant calls from xscom, mark it
    re-entrancy safe.
    
    Reported-by: Thomas Huth <thuth@redhat.com>
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    [clg: mark opb_master_regs as re-entrancy safe also ]
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
    Tested-by: Thomas Huth <thuth@redhat.com>
    Message-Id: <20230526073850.2772197-1-clg@kaod.org>
    Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
    (cherry picked from commit 76f9ebffcd41b62ae9ec26a1c25676f2ae1d9cc3)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ppc/pnv_lpc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/ppc/pnv_lpc.c b/hw/ppc/pnv_lpc.c
index 01f44c19eb..605d390861 100644
--- a/hw/ppc/pnv_lpc.c
+++ b/hw/ppc/pnv_lpc.c
@@ -734,10 +734,13 @@ static void pnv_lpc_realize(DeviceState *dev, Error **errp)
     /* Create MMIO regions for LPC HC and OPB registers */
     memory_region_init_io(&lpc->opb_master_regs, OBJECT(dev), &opb_master_ops,
                           lpc, "lpc-opb-master", LPC_OPB_REGS_OPB_SIZE);
+    lpc->opb_master_regs.disable_reentrancy_guard = true;
     memory_region_add_subregion(&lpc->opb_mr, LPC_OPB_REGS_OPB_ADDR,
                                 &lpc->opb_master_regs);
     memory_region_init_io(&lpc->lpc_hc_regs, OBJECT(dev), &lpc_hc_ops, lpc,
                           "lpc-hc", LPC_HC_REGS_OPB_SIZE);
+    /* xscom writes to lpc-hc. As such mark lpc-hc re-entrancy safe */
+    lpc->lpc_hc_regs.disable_reentrancy_guard = true;
     memory_region_add_subregion(&lpc->opb_mr, LPC_HC_REGS_OPB_ADDR,
                                 &lpc->lpc_hc_regs);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:09:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:09:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814199.1227551 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTd5-0004VW-B0; Wed, 09 Oct 2024 10:09:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814199.1227551; Wed, 09 Oct 2024 10:09: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 1syTd5-0004VO-8J; Wed, 09 Oct 2024 10:09:15 +0000
Received: by outflank-mailman (input) for mailman id 814199;
 Wed, 09 Oct 2024 10:09: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 1syTd4-0004VE-3q
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:09: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 1syTd4-0006Pn-3G
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:09:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTd4-0007cG-2V
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:09: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=0+GLBlWt/bH7GJTLT4kCjxP/GHrd3tuccSXP50MpisI=; b=F2iurWjigC+awvXOB7+FbLemiI
	H0Exxu6uquaJFPzEjMkLPJUgnshJlb5JBWJ2VELQsc4KIeFFqtbvK7fIVKQ9Qod96n5BqwDvEURHe
	TIf93LEj4464ITXCMe2Wxms356/+u3cYhvtJN0MtsDTVQN66vwDb2WtSmIzj+JiIlTDw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] machine: Add helpers to get cores/threads per socket
Message-Id: <E1syTd4-0007cG-2V@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:09:14 +0000

commit cfff72b21ebd8bb893181bb1107848cf8903ebaa
Author:     Zhao Liu <zhao1.liu@intel.com>
AuthorDate: Wed Jun 28 21:54:34 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    machine: Add helpers to get cores/threads per socket
    
    The number of cores/threads per socket are needed for smbios, and are
    also useful for other modules.
    
    Provide the helpers to wrap the calculation of cores/threads per socket
    so that we can avoid calculation errors caused by other modules miss
    topology changes.
    
    Suggested-by: Igor Mammedov <imammedo@redhat.com>
    Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
    Message-Id: <20230628135437.1145805-2-zhao1.liu@linux.intel.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit a1d027be95bc375238e5b9292c6aa661a8ddef4c)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/core/machine-smp.c | 10 ++++++++++
 include/hw/boards.h   |  2 ++
 2 files changed, 12 insertions(+)

diff --git a/hw/core/machine-smp.c b/hw/core/machine-smp.c
index 89fe0cda42..0f4d9b6f7a 100644
--- a/hw/core/machine-smp.c
+++ b/hw/core/machine-smp.c
@@ -197,3 +197,13 @@ void machine_parse_smp_config(MachineState *ms,
         return;
     }
 }
+
+unsigned int machine_topo_get_cores_per_socket(const MachineState *ms)
+{
+    return ms->smp.cores * ms->smp.clusters * ms->smp.dies;
+}
+
+unsigned int machine_topo_get_threads_per_socket(const MachineState *ms)
+{
+    return ms->smp.threads * machine_topo_get_cores_per_socket(ms);
+}
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 6fbbfd56c8..75c0b195af 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -35,6 +35,8 @@ void machine_set_cpu_numa_node(MachineState *machine,
                                Error **errp);
 void machine_parse_smp_config(MachineState *ms,
                               const SMPConfiguration *config, Error **errp);
+unsigned int machine_topo_get_cores_per_socket(const MachineState *ms);
+unsigned int machine_topo_get_threads_per_socket(const MachineState *ms);
 
 /**
  * machine_class_allow_dynamic_sysbus_dev: Add type to list of valid devices
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:09:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:09:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814200.1227555 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTdF-0004ht-Cr; Wed, 09 Oct 2024 10:09:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814200.1227555; Wed, 09 Oct 2024 10:09: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 1syTdF-0004hl-9q; Wed, 09 Oct 2024 10:09:25 +0000
Received: by outflank-mailman (input) for mailman id 814200;
 Wed, 09 Oct 2024 10:09: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 1syTdE-0004hZ-6q
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:09: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 1syTdE-0006QA-6B
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:09:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTdE-0007dP-5S
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:09: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=V0DH3TbaeG0B2V1I9TagW/e+sLs/miYgGCKLxpopUBM=; b=g3wokjorHM6tgHq9rgt7joYvsc
	gy8pj5AmdFfjEUx30Y5h+bPM0BAZywWqiovNd8zfTe17zkIEuP3s5bEBUVG2LEYSUTNOO8a+LGeV6
	puCvCsazuv/Fy855Mn36bOMJ1bbAUKCLvsm1EnDmmt+Up43HOiA0XtMFsdWs7JCllR/U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/smbios: Fix smbios_smp_sockets caculation
Message-Id: <E1syTdE-0007dP-5S@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:09:24 +0000

commit c107dab4940d19760560ded7651550de9441db28
Author:     Zhao Liu <zhao1.liu@intel.com>
AuthorDate: Wed Jun 28 21:54:35 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/smbios: Fix smbios_smp_sockets caculation
    
    smp.sockets is the number of sockets which is configured by "-smp" (
    otherwise, the default is 1). Trying to recalculate it here with another
    rules leads to errors, such as:
    
    1. 003f230e37d7 ("machine: Tweak the order of topology members in struct
       CpuTopology") changes the meaning of smp.cores but doesn't fix
       original smp.cores uses.
    
       With the introduction of cluster, now smp.cores means the number of
       cores in one cluster. So smp.cores * smp.threads just means the
       threads in a cluster not in a socket.
    
    2. On the other hand, we shouldn't use smp.cpus here because it
       indicates the initial number of online CPUs at the boot time, and is
       not mathematically related to smp.sockets.
    
    So stop reinventing the another wheel and use the topo values that
    has been calculated.
    
    Fixes: 003f230e37d7 ("machine: Tweak the order of topology members in struct CpuTopology")
    Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
    Message-Id: <20230628135437.1145805-3-zhao1.liu@linux.intel.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit d79a284a44bb7d88b233fb6bb12ea3723f43469d)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/smbios/smbios.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index d2007e70fb..d67415d44d 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -1088,8 +1088,7 @@ void smbios_get_tables(MachineState *ms,
         smbios_build_type_2_table();
         smbios_build_type_3_table();
 
-        smbios_smp_sockets = DIV_ROUND_UP(ms->smp.cpus,
-                                          ms->smp.cores * ms->smp.threads);
+        smbios_smp_sockets = ms->smp.sockets;
         assert(smbios_smp_sockets >= 1);
 
         for (i = 0; i < smbios_smp_sockets; i++) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:09:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:09:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814203.1227571 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTdP-00053w-N0; Wed, 09 Oct 2024 10:09:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814203.1227571; Wed, 09 Oct 2024 10:09: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 1syTdP-00053o-Jd; Wed, 09 Oct 2024 10:09:35 +0000
Received: by outflank-mailman (input) for mailman id 814203;
 Wed, 09 Oct 2024 10:09: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 1syTdO-0004pN-Ak
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:09: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 1syTdO-0006Qn-AB
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:09:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTdO-0007fO-8P
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:09: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=UsKhStpyQnHHpfDAsik+GdWu94TyEkctJ5yhJx5vOLE=; b=T5fJPPMvANY4/tCv2+L0AvCSyi
	isQhOngp+RwUXTbTDLPryv8MPZK9XAPJBrsLLVCExqsJH5uaDKrRzMvdWKj3ujREMzULs/OliycQ1
	In3/1qpCHIrxBglnYLkG+TpM4PyhV3SJtM2/nKODwL7Ar/djbV9s0z/GZgloEoyuqeKw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/smbios: Fix thread count in type4
Message-Id: <E1syTdO-0007fO-8P@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:09:34 +0000

commit ce2e3879a4a55317febdc42a0bc22b4a89e80824
Author:     Zhao Liu <zhao1.liu@intel.com>
AuthorDate: Wed Jun 28 21:54:36 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/smbios: Fix thread count in type4
    
    >From SMBIOS 3.0 specification, thread count field means:
    
    Thread Count is the total number of threads detected by the BIOS for
    this processor socket. It is a processor-wide count, not a
    thread-per-core count. [1]
    
    So here we should use threads per socket other than threads per core.
    
    [1] SMBIOS 3.0.0, section 7.5.8, Processor Information - Thread Count
    
    Fixes: c97294ec1b9e ("SMBIOS: Build aggregate smbios tables and entry point")
    Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
    Message-Id: <20230628135437.1145805-4-zhao1.liu@linux.intel.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 7298fd7de5551c4501f54381228458e3c21cab4b)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/smbios/smbios.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index d67415d44d..3aae9328c0 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -713,6 +713,7 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
 {
     char sock_str[128];
     size_t tbl_len = SMBIOS_TYPE_4_LEN_V28;
+    unsigned threads_per_socket;
 
     if (smbios_ep_type == SMBIOS_ENTRY_POINT_TYPE_64) {
         tbl_len = SMBIOS_TYPE_4_LEN_V30;
@@ -747,17 +748,19 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
     SMBIOS_TABLE_SET_STR(4, asset_tag_number_str, type4.asset);
     SMBIOS_TABLE_SET_STR(4, part_number_str, type4.part);
 
+    threads_per_socket = machine_topo_get_threads_per_socket(ms);
+
     t->core_count = (ms->smp.cores > 255) ? 0xFF : ms->smp.cores;
     t->core_enabled = t->core_count;
 
-    t->thread_count = (ms->smp.threads > 255) ? 0xFF : ms->smp.threads;
+    t->thread_count = (threads_per_socket > 255) ? 0xFF : threads_per_socket;
 
     t->processor_characteristics = cpu_to_le16(0x02); /* Unknown */
     t->processor_family2 = cpu_to_le16(0x01); /* Other */
 
     if (tbl_len == SMBIOS_TYPE_4_LEN_V30) {
         t->core_count2 = t->core_enabled2 = cpu_to_le16(ms->smp.cores);
-        t->thread_count2 = cpu_to_le16(ms->smp.threads);
+        t->thread_count2 = cpu_to_le16(threads_per_socket);
     }
 
     SMBIOS_BUILD_TABLE_POST;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:09:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:09:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814205.1227573 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTdZ-0005DW-OC; Wed, 09 Oct 2024 10:09:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814205.1227573; Wed, 09 Oct 2024 10:09: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 1syTdZ-0005DO-Lc; Wed, 09 Oct 2024 10:09:45 +0000
Received: by outflank-mailman (input) for mailman id 814205;
 Wed, 09 Oct 2024 10:09: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 1syTdY-0005C8-Dh
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:09: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 1syTdY-0006Qx-D7
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:09:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTdY-0007gQ-CR
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:09: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=AQqh3c0GoldS5bVSm9tEpQGK8TEi9jlmbLfB8HmKwwg=; b=hUOGpRM5ArWqFEK3gWPK+nc7Qq
	QEdYzwRVRLpElcUt8HRB45Sm1eUZ21lgzhpitFjiK1hvkGSjs55aQnHX0LS4CAbYql/skj6zy03Qz
	Y+ntQ8BwxrbQmh99VAG++TRNloiMmoCYxZwHS3j1mVD3bQRr92ODqGSqldtmEHqpV/jA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/smbios: Fix core count in type4
Message-Id: <E1syTdY-0007gQ-CR@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:09:44 +0000

commit abb4828d5d5cd0fba82e958779a7c14d3b44e2df
Author:     Zhao Liu <zhao1.liu@intel.com>
AuthorDate: Wed Jun 28 21:54:37 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/smbios: Fix core count in type4
    
    >From SMBIOS 3.0 specification, core count field means:
    
    Core Count is the number of cores detected by the BIOS for this
    processor socket. [1]
    
    Before 003f230e37d7 ("machine: Tweak the order of topology members in
    struct CpuTopology"), MachineState.smp.cores means "the number of cores
    in one package", and it's correct to use smp.cores for core count.
    
    But 003f230e37d7 changes the smp.cores' meaning to "the number of cores
    in one die" and doesn't change the original smp.cores' use in smbios as
    well, which makes core count in type4 go wrong.
    
    Fix this issue with the correct "cores per socket" caculation.
    
    [1] SMBIOS 3.0.0, section 7.5.6, Processor Information - Core Count
    
    Fixes: 003f230e37d7 ("machine: Tweak the order of topology members in struct CpuTopology")
    Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
    Message-Id: <20230628135437.1145805-5-zhao1.liu@linux.intel.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 196ea60a734c346d7d75f1d89aa37703d4d854e7)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/smbios/smbios.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index 3aae9328c0..10cd22f610 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -714,6 +714,7 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
     char sock_str[128];
     size_t tbl_len = SMBIOS_TYPE_4_LEN_V28;
     unsigned threads_per_socket;
+    unsigned cores_per_socket;
 
     if (smbios_ep_type == SMBIOS_ENTRY_POINT_TYPE_64) {
         tbl_len = SMBIOS_TYPE_4_LEN_V30;
@@ -749,8 +750,9 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
     SMBIOS_TABLE_SET_STR(4, part_number_str, type4.part);
 
     threads_per_socket = machine_topo_get_threads_per_socket(ms);
+    cores_per_socket = machine_topo_get_cores_per_socket(ms);
 
-    t->core_count = (ms->smp.cores > 255) ? 0xFF : ms->smp.cores;
+    t->core_count = (cores_per_socket > 255) ? 0xFF : cores_per_socket;
     t->core_enabled = t->core_count;
 
     t->thread_count = (threads_per_socket > 255) ? 0xFF : threads_per_socket;
@@ -759,7 +761,7 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
     t->processor_family2 = cpu_to_le16(0x01); /* Other */
 
     if (tbl_len == SMBIOS_TYPE_4_LEN_V30) {
-        t->core_count2 = t->core_enabled2 = cpu_to_le16(ms->smp.cores);
+        t->core_count2 = t->core_enabled2 = cpu_to_le16(cores_per_socket);
         t->thread_count2 = cpu_to_le16(threads_per_socket);
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:09:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:09:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814207.1227577 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTdj-0005PF-Pu; Wed, 09 Oct 2024 10:09:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814207.1227577; Wed, 09 Oct 2024 10:09: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 1syTdj-0005P4-N2; Wed, 09 Oct 2024 10:09:55 +0000
Received: by outflank-mailman (input) for mailman id 814207;
 Wed, 09 Oct 2024 10:09: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 1syTdi-0005Oj-GZ
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:09: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 1syTdi-0006R1-Fz
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:09:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTdi-0007hI-FJ
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:09: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=6FgSXtxRHEnMWgSus70dPeZcAVcLesf32duI69Ql2m0=; b=eoHRQmKMW62LWqcUaMw310929x
	u1HK3I+tc7sE1HB+d3Z7zRqcA/Ir05xTD3RzBDbtBFj46zABJQG4zlx9TQ3nzLsNNqCcmnXo6AK9+
	l6m8ZwppX4xGT7p5x4CvCqDyxQ12dDmhf7wcs7Ihf2AJrvWBc99fFjoWRf3clJNzIXFY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/i2c: Fix bitbang_i2c_data trace event
Message-Id: <E1syTdi-0007hI-FJ@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:09:54 +0000

commit 07b7ec0af04711f62c7c274d1440d10efb936ede
Author:     BALATON Zoltan <balaton@eik.bme.hu>
AuthorDate: Fri Jul 28 02:45:24 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/i2c: Fix bitbang_i2c_data trace event
    
    The clock and data values were logged swapped. Correct the trace event
    text to match what is logged. Also fix a typo in a comment nearby.
    
    Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (cherry picked from commit 8ada214a902225c90583b644cabd85bc89bf188c)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/i2c/bitbang_i2c.c | 2 +-
 hw/i2c/trace-events  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c
index bb18954765..de5f5aacf5 100644
--- a/hw/i2c/bitbang_i2c.c
+++ b/hw/i2c/bitbang_i2c.c
@@ -70,7 +70,7 @@ static int bitbang_i2c_ret(bitbang_i2c_interface *i2c, int level)
     return level & i2c->last_data;
 }
 
-/* Leave device data pin unodified.  */
+/* Leave device data pin unmodified.  */
 static int bitbang_i2c_nop(bitbang_i2c_interface *i2c)
 {
     return bitbang_i2c_ret(i2c, i2c->device_out);
diff --git a/hw/i2c/trace-events b/hw/i2c/trace-events
index 8e88aa24c1..d7b1e25858 100644
--- a/hw/i2c/trace-events
+++ b/hw/i2c/trace-events
@@ -5,7 +5,7 @@ bitbang_i2c_state(const char *old_state, const char *new_state) "state %s -> %s"
 bitbang_i2c_addr(uint8_t addr) "Address 0x%02x"
 bitbang_i2c_send(uint8_t byte) "TX byte 0x%02x"
 bitbang_i2c_recv(uint8_t byte) "RX byte 0x%02x"
-bitbang_i2c_data(unsigned dat, unsigned clk, unsigned old_out, unsigned new_out) "dat %u clk %u out %u -> %u"
+bitbang_i2c_data(unsigned clk, unsigned dat, unsigned old_out, unsigned new_out) "clk %u dat %u out %u -> %u"
 
 # core.c
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:10:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:10:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814211.1227581 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTdt-0006Eu-Rb; Wed, 09 Oct 2024 10:10:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814211.1227581; Wed, 09 Oct 2024 10:10: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 1syTdt-0006Em-OW; Wed, 09 Oct 2024 10:10:05 +0000
Received: by outflank-mailman (input) for mailman id 814211;
 Wed, 09 Oct 2024 10:10: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 1syTds-00063U-JZ
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:10: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 1syTds-0006RV-Ix
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:10:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTds-0007j0-IG
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:10: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=JV8DsreJVNbT4prnnjeaFOpJk4hyQQ5j+b/d2FIizog=; b=J+NLBlliOuOudj9ghvIjtrixdL
	N491L8RKLheyf69MR0KhknaQeoaslTucsx18IsmIRUE/VfPZl/sBbduUSvhQF0Pbp+VxXLDoh1YJA
	afZb/ceW5baiOnUlJGBpSx4SNwa62GGol1TJXIB8RcmlK1yqckneMp2m/tmglW6SmPAA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] dump: kdump-zlib data pages not dumped with pvtime/aarch64
Message-Id: <E1syTds-0007j0-IG@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:10:04 +0000

commit a11a2007a50d6d2b8e57605fc2ec40b9f962df13
Author:     Dongli Zhang <dongli.zhang@oracle.com>
AuthorDate: Wed Jul 12 22:58:19 2023 -0700
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    dump: kdump-zlib data pages not dumped with pvtime/aarch64
    
    The kdump-zlib data pages are not dumped from aarch64 host when the
    'pvtime' is involved, that is, when the block->target_end is not aligned to
    page_size. In the below example, it is expected to dump two blocks.
    
    (qemu) info mtree -f
    ... ...
      00000000090a0000-00000000090a0fff (prio 0, ram): pvtime KVM
    ... ...
      0000000040000000-00000001bfffffff (prio 0, ram): mach-virt.ram KVM
    ... ...
    
    However, there is an issue with get_next_page() so that the pages for
    "mach-virt.ram" will not be dumped.
    
    At line 1296, although we have reached at the end of the 'pvtime' block,
    since it is not aligned to the page_size (e.g., 0x10000), it will not break
    at line 1298.
    
    1255 static bool get_next_page(GuestPhysBlock **blockptr, uint64_t *pfnptr,
    1256                           uint8_t **bufptr, DumpState *s)
    ... ...
    1294             memcpy(buf + addr % page_size, hbuf, n);
    1295             addr += n;
    1296             if (addr % page_size == 0) {
    1297                 /* we filled up the page */
    1298                 break;
    1299             }
    
    As a result, get_next_page() will continue to the next
    block ("mach-virt.ram"). Finally, when get_next_page() returns to the
    caller:
    
    - 'pfnptr' is referring to the 'pvtime'
    - but 'blockptr' is referring to the "mach-virt.ram"
    
    When get_next_page() is called the next time, "*pfnptr += 1" still refers
    to the prior 'pvtime'. It will exit immediately because it is out of the
    range of the current "mach-virt.ram".
    
    The fix is to break when it is time to come to the next block, so that both
    'pfnptr' and 'blockptr' refer to the same block.
    
    Fixes: 94d788408d2d ("dump: fix kdump to work over non-aligned blocks")
    Cc: Joe Jin <joe.jin@oracle.com>
    Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Message-ID: <20230713055819.30497-1-dongli.zhang@oracle.com>
    (cherry picked from commit 8a64609eea8cb2bac015968c4b62da5bce266e22)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 dump/dump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dump/dump.c b/dump/dump.c
index 1f1a6edcab..d4ef713cd0 100644
--- a/dump/dump.c
+++ b/dump/dump.c
@@ -1293,8 +1293,8 @@ static bool get_next_page(GuestPhysBlock **blockptr, uint64_t *pfnptr,
 
             memcpy(buf + addr % page_size, hbuf, n);
             addr += n;
-            if (addr % page_size == 0) {
-                /* we filled up the page */
+            if (addr % page_size == 0 || addr >= block->target_end) {
+                /* we filled up the page or the current block is finished */
                 break;
             }
         } else {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:10:18 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:10:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814213.1227585 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTe4-0006Vq-St; Wed, 09 Oct 2024 10:10:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814213.1227585; Wed, 09 Oct 2024 10:10: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 1syTe4-0006Vi-QD; Wed, 09 Oct 2024 10:10:16 +0000
Received: by outflank-mailman (input) for mailman id 814213;
 Wed, 09 Oct 2024 10:10: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 1syTe2-0006VF-Nv
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:10: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 1syTe2-0006RZ-MD
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:10:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTe2-0007jf-LT
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:10: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=aEthulrcbDr/XV4HhvkkcSDe3+i2gH3yaUiXPJrb8oM=; b=eS7Qb/wPmKPoEtAvAGT85g0Kei
	TuhSYfVdK9TXO9J0hh99QbdRoFDq/hB6pvgFekqr3wLU9GwqRVeCKN/vAXeoRkbB1Jb+wsiSsau72
	GQ2Gtgr3E5GO8bbl9m01yFkUTdVW6U9jeog/X+r+Yd3OFjoSl6chqd1dWoME09+mXt54=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/nvme: fix oob memory read in fdp events log
Message-Id: <E1syTe2-0007jf-LT@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:10:14 +0000

commit dd496f92b97a9a2d36f83a91d8adae90ba65465a
Author:     Klaus Jensen <k.jensen@samsung.com>
AuthorDate: Thu Aug 3 20:44:23 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/nvme: fix oob memory read in fdp events log
    
    As reported by Trend Micro's Zero Day Initiative, an oob memory read
    vulnerability exists in nvme_fdp_events(). The host-provided offset is
    not verified.
    
    Fix this.
    
    This is only exploitable when Flexible Data Placement mode (fdp=on) is
    enabled.
    
    Fixes: CVE-2023-4135
    Fixes: 73064edfb864 ("hw/nvme: flexible data placement emulation")
    Reported-by: Trend Micro's Zero Day Initiative
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
    (cherry picked from commit ecb1b7b082d3b7dceff0e486a114502fc52c0fdf)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/nvme/ctrl.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 812246689c..e16e19ead8 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -5092,6 +5092,11 @@ static uint16_t nvme_fdp_events(NvmeCtrl *n, uint32_t endgrpid,
     }
 
     log_size = sizeof(NvmeFdpEventsLog) + ebuf->nelems * sizeof(NvmeFdpEvent);
+
+    if (off >= log_size) {
+        return NVME_INVALID_FIELD | NVME_DNR;
+    }
+
     trans_len = MIN(log_size - off, buf_len);
     elog = g_malloc0(log_size);
     elog->num_events = cpu_to_le32(ebuf->nelems);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:10:27 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:10:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814214.1227590 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTeE-0006eH-V9; Wed, 09 Oct 2024 10:10:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814214.1227590; Wed, 09 Oct 2024 10:10: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 1syTeE-0006e9-Rf; Wed, 09 Oct 2024 10:10:26 +0000
Received: by outflank-mailman (input) for mailman id 814214;
 Wed, 09 Oct 2024 10:10: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 1syTeC-0006cQ-QA
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:10: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 1syTeC-0006Rg-PX
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:10:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTeC-0007kM-Oo
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:10: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=SaVYhz7+oG5fpNUGpXQahUP6KcIC6t9YDpuJSOiFX6I=; b=PQxvYTiBra86WVKjoOBlhrjCCi
	kK/CW4uR1Py+OHDZOIresnYW+38M4ntOQdDFZ0WgbPuuSLEAmxjx+S2IzmkXn3nAsy5KdLOB5GanV
	Z/prIupA9NMZgxJ/jtxzF+tK0iuM3H23tE1f1pp3jWMBlGNRv6E4c7nJbdQnPedTIzsg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/nvme: fix compliance issue wrt. iosqes/iocqes
Message-Id: <E1syTeC-0007kM-Oo@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:10:24 +0000

commit cbd3c5db76f0c91ec092692b3ace2727403e4954
Author:     Klaus Jensen <k.jensen@samsung.com>
AuthorDate: Wed Jul 19 20:21:58 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/nvme: fix compliance issue wrt. iosqes/iocqes
    
    As of prior to this patch, the controller checks the value of CC.IOCQES
    and CC.IOSQES prior to enabling the controller. As reported by Ben in
    GitLab issue #1691, this is not spec compliant. The controller should
    only check these values when queues are created.
    
    This patch moves these checks to nvme_create_cq(). We do not need to
    check it in nvme_create_sq() since that will error out if the completion
    queue is not already created.
    
    Also, since the controller exclusively supports SQEs of size 64 bytes
    and CQEs of size 16 bytes, hard code that.
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1691
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
    (cherry picked from commit 6a33f2e920ec0b489a77200888e3692664077f2d)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/nvme/ctrl.c       | 46 ++++++++++++----------------------------------
 hw/nvme/nvme.h       |  9 +++++++--
 hw/nvme/trace-events |  1 +
 3 files changed, 20 insertions(+), 36 deletions(-)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index e16e19ead8..00b910ca9e 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -1504,7 +1504,7 @@ static void nvme_post_cqes(void *opaque)
         req->cqe.status = cpu_to_le16((req->status << 1) | cq->phase);
         req->cqe.sq_id = cpu_to_le16(sq->sqid);
         req->cqe.sq_head = cpu_to_le16(sq->head);
-        addr = cq->dma_addr + cq->tail * n->cqe_size;
+        addr = cq->dma_addr + (cq->tail << NVME_CQES);
         ret = pci_dma_write(PCI_DEVICE(n), addr, (void *)&req->cqe,
                             sizeof(req->cqe));
         if (ret) {
@@ -5272,10 +5272,18 @@ static uint16_t nvme_create_cq(NvmeCtrl *n, NvmeRequest *req)
     uint16_t qsize = le16_to_cpu(c->qsize);
     uint16_t qflags = le16_to_cpu(c->cq_flags);
     uint64_t prp1 = le64_to_cpu(c->prp1);
+    uint32_t cc = ldq_le_p(&n->bar.cc);
+    uint8_t iocqes = NVME_CC_IOCQES(cc);
+    uint8_t iosqes = NVME_CC_IOSQES(cc);
 
     trace_pci_nvme_create_cq(prp1, cqid, vector, qsize, qflags,
                              NVME_CQ_FLAGS_IEN(qflags) != 0);
 
+    if (iosqes != NVME_SQES || iocqes != NVME_CQES) {
+        trace_pci_nvme_err_invalid_create_cq_entry_size(iosqes, iocqes);
+        return NVME_MAX_QSIZE_EXCEEDED | NVME_DNR;
+    }
+
     if (unlikely(!cqid || cqid > n->conf_ioqpairs || n->cq[cqid] != NULL)) {
         trace_pci_nvme_err_invalid_create_cq_cqid(cqid);
         return NVME_INVALID_QID | NVME_DNR;
@@ -6981,7 +6989,7 @@ static void nvme_process_sq(void *opaque)
     }
 
     while (!(nvme_sq_empty(sq) || QTAILQ_EMPTY(&sq->req_list))) {
-        addr = sq->dma_addr + sq->head * n->sqe_size;
+        addr = sq->dma_addr + (sq->head << NVME_SQES);
         if (nvme_addr_read(n, addr, (void *)&cmd, sizeof(cmd))) {
             trace_pci_nvme_err_addr_read(addr);
             trace_pci_nvme_err_cfs();
@@ -7208,34 +7216,6 @@ static int nvme_start_ctrl(NvmeCtrl *n)
                     NVME_CAP_MPSMAX(cap));
         return -1;
     }
-    if (unlikely(NVME_CC_IOCQES(cc) <
-                 NVME_CTRL_CQES_MIN(n->id_ctrl.cqes))) {
-        trace_pci_nvme_err_startfail_cqent_too_small(
-                    NVME_CC_IOCQES(cc),
-                    NVME_CTRL_CQES_MIN(cap));
-        return -1;
-    }
-    if (unlikely(NVME_CC_IOCQES(cc) >
-                 NVME_CTRL_CQES_MAX(n->id_ctrl.cqes))) {
-        trace_pci_nvme_err_startfail_cqent_too_large(
-                    NVME_CC_IOCQES(cc),
-                    NVME_CTRL_CQES_MAX(cap));
-        return -1;
-    }
-    if (unlikely(NVME_CC_IOSQES(cc) <
-                 NVME_CTRL_SQES_MIN(n->id_ctrl.sqes))) {
-        trace_pci_nvme_err_startfail_sqent_too_small(
-                    NVME_CC_IOSQES(cc),
-                    NVME_CTRL_SQES_MIN(cap));
-        return -1;
-    }
-    if (unlikely(NVME_CC_IOSQES(cc) >
-                 NVME_CTRL_SQES_MAX(n->id_ctrl.sqes))) {
-        trace_pci_nvme_err_startfail_sqent_too_large(
-                    NVME_CC_IOSQES(cc),
-                    NVME_CTRL_SQES_MAX(cap));
-        return -1;
-    }
     if (unlikely(!NVME_AQA_ASQS(aqa))) {
         trace_pci_nvme_err_startfail_asqent_sz_zero();
         return -1;
@@ -7248,8 +7228,6 @@ static int nvme_start_ctrl(NvmeCtrl *n)
     n->page_bits = page_bits;
     n->page_size = page_size;
     n->max_prp_ents = n->page_size / sizeof(uint64_t);
-    n->cqe_size = 1 << NVME_CC_IOCQES(cc);
-    n->sqe_size = 1 << NVME_CC_IOSQES(cc);
     nvme_init_cq(&n->admin_cq, n, acq, 0, 0, NVME_AQA_ACQS(aqa) + 1, 1);
     nvme_init_sq(&n->admin_sq, n, asq, 0, 0, NVME_AQA_ASQS(aqa) + 1);
 
@@ -8221,8 +8199,8 @@ static void nvme_init_ctrl(NvmeCtrl *n, PCIDevice *pci_dev)
     id->wctemp = cpu_to_le16(NVME_TEMPERATURE_WARNING);
     id->cctemp = cpu_to_le16(NVME_TEMPERATURE_CRITICAL);
 
-    id->sqes = (0x6 << 4) | 0x6;
-    id->cqes = (0x4 << 4) | 0x4;
+    id->sqes = (NVME_SQES << 4) | NVME_SQES;
+    id->cqes = (NVME_CQES << 4) | NVME_CQES;
     id->nn = cpu_to_le32(NVME_MAX_NAMESPACES);
     id->oncs = cpu_to_le16(NVME_ONCS_WRITE_ZEROES | NVME_ONCS_TIMESTAMP |
                            NVME_ONCS_FEATURES | NVME_ONCS_DSM |
diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h
index 209e8f5b4c..5f2ae7b28b 100644
--- a/hw/nvme/nvme.h
+++ b/hw/nvme/nvme.h
@@ -30,6 +30,13 @@
 #define NVME_FDP_MAX_EVENTS 63
 #define NVME_FDP_MAXPIDS 128
 
+/*
+ * The controller only supports Submission and Completion Queue Entry Sizes of
+ * 64 and 16 bytes respectively.
+ */
+#define NVME_SQES 6
+#define NVME_CQES 4
+
 QEMU_BUILD_BUG_ON(NVME_MAX_NAMESPACES > NVME_NSID_BROADCAST - 1);
 
 typedef struct NvmeCtrl NvmeCtrl;
@@ -530,8 +537,6 @@ typedef struct NvmeCtrl {
     uint32_t    page_size;
     uint16_t    page_bits;
     uint16_t    max_prp_ents;
-    uint16_t    cqe_size;
-    uint16_t    sqe_size;
     uint32_t    max_q_ents;
     uint8_t     outstanding_aers;
     uint32_t    irq_status;
diff --git a/hw/nvme/trace-events b/hw/nvme/trace-events
index 7f7837e1a2..75083e992d 100644
--- a/hw/nvme/trace-events
+++ b/hw/nvme/trace-events
@@ -168,6 +168,7 @@ pci_nvme_err_invalid_create_cq_size(uint16_t size) "failed creating completion q
 pci_nvme_err_invalid_create_cq_addr(uint64_t addr) "failed creating completion queue, addr=0x%"PRIx64""
 pci_nvme_err_invalid_create_cq_vector(uint16_t vector) "failed creating completion queue, vector=%"PRIu16""
 pci_nvme_err_invalid_create_cq_qflags(uint16_t qflags) "failed creating completion queue, qflags=%"PRIu16""
+pci_nvme_err_invalid_create_cq_entry_size(uint8_t iosqes, uint8_t iocqes) "iosqes %"PRIu8" iocqes %"PRIu8""
 pci_nvme_err_invalid_identify_cns(uint16_t cns) "identify, invalid cns=0x%"PRIx16""
 pci_nvme_err_invalid_getfeat(int dw10) "invalid get features, dw10=0x%"PRIx32""
 pci_nvme_err_invalid_setfeat(uint32_t dw10) "invalid set features, dw10=0x%"PRIx32""
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:10:40 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:10:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814215.1227592 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTeO-0006nP-14; Wed, 09 Oct 2024 10:10:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814215.1227592; Wed, 09 Oct 2024 10:10: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 1syTeN-0006nI-Uq; Wed, 09 Oct 2024 10:10:35 +0000
Received: by outflank-mailman (input) for mailman id 814215;
 Wed, 09 Oct 2024 10:10: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 1syTeM-0006n4-TE
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:10: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 1syTeM-0006S3-SY
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:10:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTeM-0007lC-Ri
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:10: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=xbjzzz+5zwDFV5Q+OC7cKTlOBeQz9IsWz0AwAGjyp2Q=; b=HIIEUVpbWhHa0zmU3ZRfUxMBCD
	S+rLDNxfa0C4I6jGp787yHWmtY+FnKhr9V4aiORZYJUfU3Fzc5Fs81muusltK0SHm8zC7NMY4Oaq4
	nKTjOALvAHUP/ELUeGeBWMYnbwrmjw46zoMBhXKtFQ6QW8KjMQFq/+FQghEIvWwmR3uw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/nvme: fix CRC64 for guard tag
Message-Id: <E1syTeM-0007lC-Ri@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:10:34 +0000

commit f47369c3d114ddd2021d9ca2cdde9fe138675bcb
Author:     Ankit Kumar <ankit.kumar@samsung.com>
AuthorDate: Tue Aug 8 02:57:43 2023 +0530
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/nvme: fix CRC64 for guard tag
    
    The nvme CRC64 generator expects the caller to pass inverted seed value.
    Pass inverted crc value for metadata buffer.
    
    Cc: qemu-stable@nongnu.org
    Fixes: 44219b6029fc ("hw/nvme: 64-bit pi support")
    Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
    (cherry picked from commit dbdb13f931d7cf2d3c3ca662e751bb1551e9eab6)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/nvme/dif.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/nvme/dif.c b/hw/nvme/dif.c
index 63c44c86ab..01b19c3373 100644
--- a/hw/nvme/dif.c
+++ b/hw/nvme/dif.c
@@ -115,7 +115,7 @@ static void nvme_dif_pract_generate_dif_crc64(NvmeNamespace *ns, uint8_t *buf,
         uint64_t crc = crc64_nvme(~0ULL, buf, ns->lbasz);
 
         if (pil) {
-            crc = crc64_nvme(crc, mbuf, pil);
+            crc = crc64_nvme(~crc, mbuf, pil);
         }
 
         dif->g64.guard = cpu_to_be64(crc);
@@ -246,7 +246,7 @@ static uint16_t nvme_dif_prchk_crc64(NvmeNamespace *ns, NvmeDifTuple *dif,
         uint64_t crc = crc64_nvme(~0ULL, buf, ns->lbasz);
 
         if (pil) {
-            crc = crc64_nvme(crc, mbuf, pil);
+            crc = crc64_nvme(~crc, mbuf, pil);
         }
 
         trace_pci_nvme_dif_prchk_guard_crc64(be64_to_cpu(dif->g64.guard), crc);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:10:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:10:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814216.1227598 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTeY-0006tR-4H; Wed, 09 Oct 2024 10:10:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814216.1227598; Wed, 09 Oct 2024 10:10: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 1syTeY-0006tJ-09; Wed, 09 Oct 2024 10:10:46 +0000
Received: by outflank-mailman (input) for mailman id 814216;
 Wed, 09 Oct 2024 10:10: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 1syTeX-0006t3-0J
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:10: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 1syTeW-0006SB-Vn
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:10:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTeW-0007m0-V7
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:10: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=tfsTX3mav5LP4gMXDmwd+V0XDP7kw4Ksv8jdXkoH8Vw=; b=6VTuQ9Y5ssA0/I+bPZonjdFzbX
	W7sMEHa9QND99Y6QBf96X+jXRcE1BSggISBTXwpSoILWTVEzzsuKySLiw+90UCAdKY6IGe0ZXA0vX
	W4yoL8MBfl03j0FFuhhzfOflXCQWIx4Y+4Qvg63FspEzEIR2vFFZqSUzUlQyqZa7ztx4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/nvme: fix null pointer access in directive receive
Message-Id: <E1syTeW-0007m0-V7@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:10:44 +0000

commit 43328764f7a0c4371f0142a8cee6dcdbeecfa633
Author:     Klaus Jensen <k.jensen@samsung.com>
AuthorDate: Tue Aug 8 17:16:13 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/nvme: fix null pointer access in directive receive
    
    nvme_directive_receive() does not check if an endurance group has been
    configured (set) prior to testing if flexible data placement is enabled
    or not.
    
    Fix this.
    
    Cc: qemu-stable@nongnu.org
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1815
    Fixes: 73064edfb864 ("hw/nvme: flexible data placement emulation")
    Reviewed-by: Jesper Wendel Devantier <j.devantier@samsung.com>
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
    (cherry picked from commit 6c8f8456cb0b239812dee5211881426496da7b98)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/nvme/ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 00b910ca9e..ac505727e5 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -6877,7 +6877,7 @@ static uint16_t nvme_directive_receive(NvmeCtrl *n, NvmeRequest *req)
     case NVME_DIRECTIVE_IDENTIFY:
         switch (doper) {
         case NVME_DIRECTIVE_RETURN_PARAMS:
-            if (ns->endgrp->fdp.enabled) {
+            if (ns->endgrp && ns->endgrp->fdp.enabled) {
                 id.supported |= 1 << NVME_DIRECTIVE_DATA_PLACEMENT;
                 id.enabled |= 1 << NVME_DIRECTIVE_DATA_PLACEMENT;
                 id.persistent |= 1 << NVME_DIRECTIVE_DATA_PLACEMENT;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:10:56 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:10:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814217.1227600 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTei-00071I-4C; Wed, 09 Oct 2024 10:10:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814217.1227600; Wed, 09 Oct 2024 10:10: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 1syTei-00071A-1f; Wed, 09 Oct 2024 10:10:56 +0000
Received: by outflank-mailman (input) for mailman id 814217;
 Wed, 09 Oct 2024 10:10: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 1syTeh-0006zV-3f
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:10: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 1syTeh-0006SJ-2t
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:10:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTeh-0007mp-26
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:10: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=10FPOZ3YvSsDaqz0dScDce5ecFTCRj6HwnbGCULU+CQ=; b=LXSqyqDZpOtDWiwdUYJc43alG/
	exC13fooB3Rxs/YDI3nAlwKtjnkdL6uVjbRjx0/SyTdBR/M+1mwUK2OCIdA5C06K+lLCvIjxJWGP/
	nmloLHasEc9KCjPA/AqKnpxl/ecX6xhHxbAP6AgUhNfbEiwsXE14DCMWCXCzfju2MfU8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/nvme: fix null pointer access in ruh update
Message-Id: <E1syTeh-0007mp-26@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:10:55 +0000

commit bb5f9036d5f6914215c75e19048444b2ce06b190
Author:     Klaus Jensen <k.jensen@samsung.com>
AuthorDate: Tue Aug 8 17:16:14 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/nvme: fix null pointer access in ruh update
    
    The Reclaim Unit Update operation in I/O Management Receive does not
    verify the presence of a configured endurance group prior to accessing
    it.
    
    Fix this.
    
    Cc: qemu-stable@nongnu.org
    Fixes: 73064edfb864 ("hw/nvme: flexible data placement emulation")
    Reviewed-by: Jesper Wendel Devantier <j.devantier@samsung.com>
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
    (cherry picked from commit 3439ba9c5da943d96f7a3c86e0a7eb2ff48de41c)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/nvme/ctrl.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index ac505727e5..c71d57d17a 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -4333,7 +4333,13 @@ static uint16_t nvme_io_mgmt_send_ruh_update(NvmeCtrl *n, NvmeRequest *req)
     uint32_t npid = (cdw10 >> 1) + 1;
     unsigned int i = 0;
     g_autofree uint16_t *pids = NULL;
-    uint32_t maxnpid = n->subsys->endgrp.fdp.nrg * n->subsys->endgrp.fdp.nruh;
+    uint32_t maxnpid;
+
+    if (!ns->endgrp || !ns->endgrp->fdp.enabled) {
+        return NVME_FDP_DISABLED | NVME_DNR;
+    }
+
+    maxnpid = n->subsys->endgrp.fdp.nrg * n->subsys->endgrp.fdp.nruh;
 
     if (unlikely(npid >= MIN(NVME_FDP_MAXPIDS, maxnpid))) {
         return NVME_INVALID_FIELD | NVME_DNR;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:11:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:11:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814218.1227605 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTes-0007A0-5r; Wed, 09 Oct 2024 10:11:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814218.1227605; Wed, 09 Oct 2024 10: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 1syTes-00079p-32; Wed, 09 Oct 2024 10:11:06 +0000
Received: by outflank-mailman (input) for mailman id 814218;
 Wed, 09 Oct 2024 10:11: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 1syTer-00079b-81
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:11: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 1syTer-0006Sx-69
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:11:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTer-0007nx-5M
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:11: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=qVKRb0SX0kl37fKfD42RrGOHn8PpLeQ5G0fTOoXBZXU=; b=RalUgkRrgwcyNaig6BfLmbCnlG
	tRH9gS2E5T+p+IKUBhKQChnMdsRh3A075vpYvEls0qqiiR+XxkQ+ckU4hZzefTwgTMh7++pgvhOVf
	pKCketXySKr9GJdAwepdoA4FH7teHmT+79DwMuZCebWnc5ETrOjs3xFKNJ+hceAFIuCU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] linux-user/elfload: Set V in ELF_HWCAP for RISC-V
Message-Id: <E1syTer-0007nx-5M@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:11:05 +0000

commit ee638bc5b53cff87768b0b7c6d2c4a4e275994f6
Author:     Nathan Egge <negge@xiph.org>
AuthorDate: Thu Aug 3 09:14:24 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    linux-user/elfload: Set V in ELF_HWCAP for RISC-V
    
    Set V bit for hwcap if misa is set.
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1793
    Signed-off-by: Nathan Egge <negge@xiph.org>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Message-Id: <20230803131424.40744-1-negge@xiph.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    (cherry picked from commit 4333f0924c2f2ca8efaebaed8c24f55f77d8b013)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 linux-user/elfload.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 88ef26dc03..a3e78a7e18 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -1679,7 +1679,8 @@ static uint32_t get_elf_hwcap(void)
 #define MISA_BIT(EXT) (1 << (EXT - 'A'))
     RISCVCPU *cpu = RISCV_CPU(thread_cpu);
     uint32_t mask = MISA_BIT('I') | MISA_BIT('M') | MISA_BIT('A')
-                    | MISA_BIT('F') | MISA_BIT('D') | MISA_BIT('C');
+                    | MISA_BIT('F') | MISA_BIT('D') | MISA_BIT('C')
+                    | MISA_BIT('V');
 
     return cpu->env.misa_ext & mask;
 #undef MISA_BIT
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:11:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:11:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814219.1227609 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTf2-0007Gr-76; Wed, 09 Oct 2024 10:11:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814219.1227609; Wed, 09 Oct 2024 10: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 1syTf2-0007Gj-4R; Wed, 09 Oct 2024 10:11:16 +0000
Received: by outflank-mailman (input) for mailman id 814219;
 Wed, 09 Oct 2024 10:11: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 1syTf1-0007Gb-9Z
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:11: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 1syTf1-0006T7-8z
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:11:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTf1-0007ov-8O
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:11: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=buUyQEnPM+hJKNq4KwYGeXDXzcb5yuRisLiqFQyf9kQ=; b=lzLu9G+nSGFANL3k9nJ52QqLv4
	heF+ErYKKUSZ8cveYCOHOButL3sOZk09MYAVfE3Nihyhq/hp8OXxqMee8/QR7TEKrpijqyYhmPMWL
	/Kwy85CpteSrHtz65rcHQX9w8uKQKS8/YBvsPE8u6Mf4aiodDV1S1361wR1c79APbg3U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for microblaze
Message-Id: <E1syTf1-0007ov-8O@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:11:15 +0000

commit 43d2db492878f7931457d6d4d9097f9573917c6d
Author:     Richard Henderson <richard.henderson@linaro.org>
AuthorDate: Sat Jun 3 14:55:03 2023 -0700
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for microblaze
    
    Based on gcc's microblaze.h setting BIGGEST_ALIGNMENT to 32 bits.
    
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    (cherry picked from commit e73f27003e777fd9b77d13e71c5268015b8ed2b6)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 include/exec/user/abitypes.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/exec/user/abitypes.h b/include/exec/user/abitypes.h
index 743b8bb9ea..beba0a48c7 100644
--- a/include/exec/user/abitypes.h
+++ b/include/exec/user/abitypes.h
@@ -15,7 +15,9 @@
 #define ABI_LLONG_ALIGNMENT 2
 #endif
 
-#if (defined(TARGET_I386) && !defined(TARGET_X86_64)) || defined(TARGET_SH4)
+#if (defined(TARGET_I386) && !defined(TARGET_X86_64)) \
+    || defined(TARGET_SH4) \
+    || defined(TARGET_MICROBLAZE)
 #define ABI_LLONG_ALIGNMENT 4
 #endif
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:11:26 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:11:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814220.1227612 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTfC-0007R5-8i; Wed, 09 Oct 2024 10:11:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814220.1227612; Wed, 09 Oct 2024 10: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 1syTfC-0007Qx-5t; Wed, 09 Oct 2024 10:11:26 +0000
Received: by outflank-mailman (input) for mailman id 814220;
 Wed, 09 Oct 2024 10:11: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 1syTfB-0007Qj-Cn
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:11: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 1syTfB-0006TE-C2
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:11:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTfB-0007rM-BF
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:11: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=hjBJM2ApbH/+iYXrx6++VgBbX3ntliS4mV5nGbGpSdU=; b=xPp0H19aFljr8QhboQLKFaacjO
	UnL9NRLlN4K4Bez+wMSDrHpY1v4GTyi/C9Qxren+nVfhrzMUJAk6swYRCbVi/gwmiOyJjzPoxHPCT
	FaIa0B0e7m0kCqKOneilo4neZKFaGfy7eFeUxFYnN0CLPeUS57jKK6Puvt/9t3JYoIYg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for nios2
Message-Id: <E1syTfB-0007rM-BF@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:11:25 +0000

commit 40cfe12cb6f8b9d3a1172af2e65540773ad17be1
Author:     Richard Henderson <richard.henderson@linaro.org>
AuthorDate: Sat Jun 3 14:58:46 2023 -0700
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for nios2
    
    Based on gcc's nios2.h setting BIGGEST_ALIGNMENT to 32 bits.
    
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    (cherry picked from commit ea9812d93f9c3e1a308ac33097021c50d581d10e)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 include/exec/user/abitypes.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/exec/user/abitypes.h b/include/exec/user/abitypes.h
index beba0a48c7..6191ce9f74 100644
--- a/include/exec/user/abitypes.h
+++ b/include/exec/user/abitypes.h
@@ -17,7 +17,8 @@
 
 #if (defined(TARGET_I386) && !defined(TARGET_X86_64)) \
     || defined(TARGET_SH4) \
-    || defined(TARGET_MICROBLAZE)
+    || defined(TARGET_MICROBLAZE) \
+    || defined(TARGET_NIOS2)
 #define ABI_LLONG_ALIGNMENT 4
 #endif
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:11:36 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:11:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814222.1227617 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTfM-0007Xy-9x; Wed, 09 Oct 2024 10:11:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814222.1227617; Wed, 09 Oct 2024 10: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 1syTfM-0007Xq-7L; Wed, 09 Oct 2024 10:11:36 +0000
Received: by outflank-mailman (input) for mailman id 814222;
 Wed, 09 Oct 2024 10:11: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 1syTfL-0007WM-Fo
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:11: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 1syTfL-0006Te-Ey
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:11:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTfL-0007s7-EE
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:11: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=uGe3uw5LcUmTd/DirvNOssKDp6mMeJbcZuKw8MdTPlk=; b=tFOYrwIwwyt4zJkTPE9HwzSyQI
	IKildMiIOvliZUWeh+q59Zpn6npYdvPWeycl6aSmh7L9C3x52l+JgmzrXBgXukNUPFeUuoNK+frzT
	CTppTFw+PP52Ols0z4ixHsG76vcdlM8FnjyumZnfRE1QkcAvW//lXaO7wQHRDNIT8Ja4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] Fixed incorrect LLONG alignment for openrisc and cris
Message-Id: <E1syTfL-0007s7-EE@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:11:35 +0000

commit af0c16fae9532033453f8c208ad1e2e78701de5c
Author:     Luca Bonissi <qemu@bonslack.org>
AuthorDate: Thu Aug 3 02:15:57 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    Fixed incorrect LLONG alignment for openrisc and cris
    
    OpenRISC (or1k) has long long alignment to 4 bytes, but currently not
    defined in abitypes.h. This lead to incorrect packing of /epoll_event/
    structure and eventually infinite loop while waiting for file
    descriptor[s] event[s].
    
    Fixed also CRIS alignments (1 byte for all types).
    
    Signed-off-by: Luca Bonissi <qemu@bonslack.org>
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1770
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (cherry picked from commit 6ee960823da8fd780ae9912c4327b7e85e80d846)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 include/exec/user/abitypes.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/exec/user/abitypes.h b/include/exec/user/abitypes.h
index 6191ce9f74..6178453d94 100644
--- a/include/exec/user/abitypes.h
+++ b/include/exec/user/abitypes.h
@@ -15,8 +15,16 @@
 #define ABI_LLONG_ALIGNMENT 2
 #endif
 
+#ifdef TARGET_CRIS
+#define ABI_SHORT_ALIGNMENT 1
+#define ABI_INT_ALIGNMENT 1
+#define ABI_LONG_ALIGNMENT 1
+#define ABI_LLONG_ALIGNMENT 1
+#endif
+
 #if (defined(TARGET_I386) && !defined(TARGET_X86_64)) \
     || defined(TARGET_SH4) \
+    || defined(TARGET_OPENRISC) \
     || defined(TARGET_MICROBLAZE) \
     || defined(TARGET_NIOS2)
 #define ABI_LLONG_ALIGNMENT 4
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:11:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:11:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814223.1227621 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTfW-0007eV-BL; Wed, 09 Oct 2024 10:11:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814223.1227621; Wed, 09 Oct 2024 10: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 1syTfW-0007eN-8j; Wed, 09 Oct 2024 10:11:46 +0000
Received: by outflank-mailman (input) for mailman id 814223;
 Wed, 09 Oct 2024 10:11: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 1syTfV-0007eA-IY
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:11: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 1syTfV-0006Tl-Hu
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:11:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTfV-0007t7-HC
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:11: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=LId1dh0H/l8ZoZUv16eD3SOcoYQ8aVGjU1jmwfzl03M=; b=mS8CglxOnXTaGtG/RgBc3w0KhZ
	dA05NvdWX2EKQm0Ccvc8q4si83MoCzjiOZKgwSuBnKebMdzEdXZtz1ZuxJeJ0RA7G9Vuj8HxJX1bw
	6XgytUZ4sCxTuNkRHS8ya6FlYIALAF4G2EK5dzSJhNlSH4kiO8lRVY6KEomU/+x8aYDc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/sd/sdhci: Do not force sdhci_mmio_*_ops onto all SD controllers
Message-Id: <E1syTfV-0007t7-HC@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:11:45 +0000

commit b4b3aac5b542557c63bc24049b61c2640ad90dd9
Author:     Bernhard Beschow <shentey@gmail.com>
AuthorDate: Sun Jul 9 10:09:50 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/sd/sdhci: Do not force sdhci_mmio_*_ops onto all SD controllers
    
    Since commit c0a55a0c9da2 "hw/sd/sdhci: Support big endian SD host controller
    interfaces" sdhci_common_realize() forces all SD card controllers to use either
    sdhci_mmio_le_ops or sdhci_mmio_be_ops, depending on the "endianness" property.
    However, there are device models which use different MMIO ops: TYPE_IMX_USDHC
    uses usdhc_mmio_ops and TYPE_S3C_SDHCI uses sdhci_s3c_mmio_ops.
    
    Forcing sdhci_mmio_le_ops breaks SD card handling on the "sabrelite" board, for
    example. Fix this by defaulting the io_ops to little endian and switch to big
    endian in sdhci_common_realize() only if there is a matchig big endian variant
    available.
    
    Fixes: c0a55a0c9da2 ("hw/sd/sdhci: Support big endian SD host controller
    interfaces")
    
    Signed-off-by: Bernhard Beschow <shentey@gmail.com>
    Tested-by: Guenter Roeck <linux@roeck-us.net>
    Message-Id: <20230709080950.92489-1-shentey@gmail.com>
    (cherry picked from commit 3b830790151ff231531ef2595793e387dd154efb)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/sd/sdhci.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index 6811f0f1a8..362c2c86aa 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -1382,6 +1382,8 @@ void sdhci_initfn(SDHCIState *s)
 
     s->insert_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, sdhci_raise_insertion_irq, s);
     s->transfer_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, sdhci_data_transfer, s);
+
+    s->io_ops = &sdhci_mmio_le_ops;
 }
 
 void sdhci_uninitfn(SDHCIState *s)
@@ -1399,9 +1401,13 @@ void sdhci_common_realize(SDHCIState *s, Error **errp)
 
     switch (s->endianness) {
     case DEVICE_LITTLE_ENDIAN:
-        s->io_ops = &sdhci_mmio_le_ops;
+        /* s->io_ops is little endian by default */
         break;
     case DEVICE_BIG_ENDIAN:
+        if (s->io_ops != &sdhci_mmio_le_ops) {
+            error_setg(errp, "SD controller doesn't support big endianness");
+            return;
+        }
         s->io_ops = &sdhci_mmio_be_ops;
         break;
     default:
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:11:56 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:11:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814224.1227625 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTfg-0007jp-DM; Wed, 09 Oct 2024 10:11:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814224.1227625; Wed, 09 Oct 2024 10: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 1syTfg-0007ji-AE; Wed, 09 Oct 2024 10:11:56 +0000
Received: by outflank-mailman (input) for mailman id 814224;
 Wed, 09 Oct 2024 10:11: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 1syTff-0007jY-Lj
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:11: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 1syTff-0006Tv-Kw
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:11:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTff-0007uI-K2
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:11: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=+CPpDl1nCdVdDbIAAEnDRmKAuoaiJPDkypIeny5hhQQ=; b=fMTFyVWv2asFfns7VMWhkgSRvW
	iYSWOqa+DDiKh3sI7ffCv9o764GqlEzudYfSBtLetXaLaalfStGDwsaOgTp/Y4Hbns5uCoQ74wvOa
	kXIGgGJPGOVmS2x0TDR0Wx6GqLxN5iH42jZxD/R3dGPEM36ebawOUJSOO0OIwETgqT78=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] target/s390x: Fix the "ignored match" case in VSTRS
Message-Id: <E1syTff-0007uI-K2@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:11:55 +0000

commit 179a37924d55e645e660731f0e389d70a277a1c2
Author:     Ilya Leoshkevich <iii@linux.ibm.com>
AuthorDate: Sat Aug 5 01:03:18 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/s390x: Fix the "ignored match" case in VSTRS
    
    Currently the emulation of VSTRS recognizes partial matches in presence
    of \0 in the haystack, which, according to PoP, is not correct:
    
        If the ZS flag is one and a zero byte was detected
        in the second operand, then there can not be a
        partial match ...
    
    Add a check for this. While at it, fold a number of explicitly handled
    special cases into the generic logic.
    
    Cc: qemu-stable@nongnu.org
    Reported-by: Claudio Fontana <cfontana@suse.de>
    Closes: https://lists.gnu.org/archive/html/qemu-devel/2023-08/msg00633.html
    Fixes: 1d706f314191 ("target/s390x: vxeh2: vector string search")
    Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
    Message-Id: <20230804233748.218935-3-iii@linux.ibm.com>
    Tested-by: Claudio Fontana <cfontana@suse.de>
    Acked-by: David Hildenbrand <david@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 791b2b6a930273db694b9ba48bbb406e78715927)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/s390x/tcg/vec_string_helper.c | 54 ++++++++++++------------------------
 1 file changed, 17 insertions(+), 37 deletions(-)

diff --git a/target/s390x/tcg/vec_string_helper.c b/target/s390x/tcg/vec_string_helper.c
index 9b85becdfb..a19f429768 100644
--- a/target/s390x/tcg/vec_string_helper.c
+++ b/target/s390x/tcg/vec_string_helper.c
@@ -474,9 +474,9 @@ DEF_VSTRC_CC_RT_HELPER(32)
 static int vstrs(S390Vector *v1, const S390Vector *v2, const S390Vector *v3,
                  const S390Vector *v4, uint8_t es, bool zs)
 {
-    int substr_elen, substr_0, str_elen, i, j, k, cc;
+    int substr_elen, i, j, k, cc;
     int nelem = 16 >> es;
-    bool eos = false;
+    int str_leftmost_0;
 
     substr_elen = s390_vec_read_element8(v4, 7) >> es;
 
@@ -498,47 +498,20 @@ static int vstrs(S390Vector *v1, const S390Vector *v2, const S390Vector *v3,
     }
 
     /* If ZS, look for eos in the searched string. */
+    str_leftmost_0 = nelem;
     if (zs) {
         for (k = 0; k < nelem; k++) {
             if (s390_vec_read_element(v2, k, es) == 0) {
-                eos = true;
+                str_leftmost_0 = k;
                 break;
             }
         }
-        str_elen = k;
-    } else {
-        str_elen = nelem;
     }
 
-    substr_0 = s390_vec_read_element(v3, 0, es);
-
-    for (k = 0; ; k++) {
-        for (; k < str_elen; k++) {
-            if (s390_vec_read_element(v2, k, es) == substr_0) {
-                break;
-            }
-        }
-
-        /* If we reached the end of the string, no match. */
-        if (k == str_elen) {
-            cc = eos; /* no match (with or without zero char) */
-            goto done;
-        }
-
-        /* If the substring is only one char, match. */
-        if (substr_elen == 1) {
-            cc = 2; /* full match */
-            goto done;
-        }
-
-        /* If the match begins at the last char, we have a partial match. */
-        if (k == str_elen - 1) {
-            cc = 3; /* partial match */
-            goto done;
-        }
-
+    cc = str_leftmost_0 == nelem ? 0 : 1;  /* No match. */
+    for (k = 0; k < nelem; k++) {
         i = MIN(nelem, k + substr_elen);
-        for (j = k + 1; j < i; j++) {
+        for (j = k; j < i; j++) {
             uint32_t e2 = s390_vec_read_element(v2, j, es);
             uint32_t e3 = s390_vec_read_element(v3, j - k, es);
             if (e2 != e3) {
@@ -546,9 +519,16 @@ static int vstrs(S390Vector *v1, const S390Vector *v2, const S390Vector *v3,
             }
         }
         if (j == i) {
-            /* Matched up until "end". */
-            cc = i - k == substr_elen ? 2 : 3; /* full or partial match */
-            goto done;
+            /* All elements matched. */
+            if (k > str_leftmost_0) {
+                cc = 1;  /* Ignored match. */
+                k = nelem;
+            } else if (i - k == substr_elen) {
+                cc = 2;  /* Full match. */
+            } else {
+                cc = 3;  /* Partial match. */
+            }
+            break;
         }
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:12:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:12:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814225.1227628 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTfq-0007q1-FT; Wed, 09 Oct 2024 10:12:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814225.1227628; Wed, 09 Oct 2024 10:12: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 1syTfq-0007pt-Cx; Wed, 09 Oct 2024 10:12:06 +0000
Received: by outflank-mailman (input) for mailman id 814225;
 Wed, 09 Oct 2024 10:12: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 1syTfp-0007pk-Ob
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:12: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 1syTfp-0006UF-Nx
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:12:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTfp-0007vp-NE
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:12: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=hTZxel0Ofwo87CIksWsSiS51TxhXVwGnAv7ooVBqnDs=; b=qJ1/dowYd8c1nA+ybxEScYoyS1
	+FNQPAuQ3Jf2WVMPClQbRyk9pTU3neQju8Okz3gT+xXNMKx6PwJCYvzgwsiE6IB7WtKfcGy1R8bdW
	7pbwfZM5PlxMZtT2FSitin/b+jWmFGyMiJ5dKHUpIfxPDnesszTb4I7T+r4DslqZZX4Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] target/s390x: Use a 16-bit immediate in VREP
Message-Id: <E1syTfp-0007vp-NE@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:12:05 +0000

commit 14f78932e02c15e59f3a0894a08159cd00712765
Author:     Ilya Leoshkevich <iii@linux.ibm.com>
AuthorDate: Mon Aug 7 18:34:31 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/s390x: Use a 16-bit immediate in VREP
    
    Unlike most other instructions that contain an immediate element index,
    VREP's one is 16-bit, and not 4-bit. The code uses only 8 bits, so
    using, e.g., 0x101 does not lead to a specification exception.
    
    Fix by checking all 16 bits.
    
    Cc: qemu-stable@nongnu.org
    Fixes: 28d08731b1d8 ("s390x/tcg: Implement VECTOR REPLICATE")
    Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
    Message-Id: <20230807163459.849766-1-iii@linux.ibm.com>
    Reviewed-by: David Hildenbrand <david@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 23e87d419f347b6b5f4da3bf70d222acc24cdb64)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/s390x/tcg/translate_vx.c.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/s390x/tcg/translate_vx.c.inc b/target/s390x/tcg/translate_vx.c.inc
index f8df121d3d..a6d840d406 100644
--- a/target/s390x/tcg/translate_vx.c.inc
+++ b/target/s390x/tcg/translate_vx.c.inc
@@ -57,7 +57,7 @@
 #define FPF_LONG        3
 #define FPF_EXT         4
 
-static inline bool valid_vec_element(uint8_t enr, MemOp es)
+static inline bool valid_vec_element(uint16_t enr, MemOp es)
 {
     return !(enr & ~(NUM_VEC_ELEMENTS(es) - 1));
 }
@@ -964,7 +964,7 @@ static DisasJumpType op_vpdi(DisasContext *s, DisasOps *o)
 
 static DisasJumpType op_vrep(DisasContext *s, DisasOps *o)
 {
-    const uint8_t enr = get_field(s, i2);
+    const uint16_t enr = get_field(s, i2);
     const uint8_t es = get_field(s, m4);
 
     if (es > ES_64 || !valid_vec_element(enr, es)) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:12:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:12:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814226.1227632 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTg0-0007ve-HA; Wed, 09 Oct 2024 10:12:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814226.1227632; Wed, 09 Oct 2024 10:12: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 1syTg0-0007vX-Eb; Wed, 09 Oct 2024 10:12:16 +0000
Received: by outflank-mailman (input) for mailman id 814226;
 Wed, 09 Oct 2024 10:12: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 1syTfz-0007vP-Re
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:12: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 1syTfz-0006UO-R5
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:12:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTfz-0007wl-QJ
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:12: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=BCT1CZ9rdPBSdf3i72KnYP2DzNcF+XLZjJzrWWL/Us8=; b=zVZ3oZCv/75kEiRmG1iLxnvMTg
	uDNV2xM2Nql/E7xuEuc0R3FLZtqdSKuYdm6fJN808wFJd9Iu7Wc0xwxFgbXASNAgZWA3PpfY2E6IT
	c6hphmVG0nF0+GleWeUVpoZ6kK9ETzoxWOyQlaU4xqSN0TAKJTnxPCBFWcetLaXujtRo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] target/s390x: Fix VSTL with a large length
Message-Id: <E1syTfz-0007wl-QJ@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:12:15 +0000

commit 62ac9cbb6fe2d088dd56cd258c61b033f610fe6f
Author:     Ilya Leoshkevich <iii@linux.ibm.com>
AuthorDate: Sat Aug 5 01:55:33 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/s390x: Fix VSTL with a large length
    
    The length is always truncated to 16 bytes. Do not probe more than
    that.
    
    Cc: qemu-stable@nongnu.org
    Fixes: 0e0a5b49ad58 ("s390x/tcg: Implement VECTOR STORE WITH LENGTH")
    Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
    Message-Id: <20230804235624.263260-1-iii@linux.ibm.com>
    Reviewed-by: David Hildenbrand <david@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 6db3518ba4fcddd71049718f138552999f0d97b4)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/s390x/tcg/vec_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/s390x/tcg/vec_helper.c b/target/s390x/tcg/vec_helper.c
index 48d86722b2..dafc4c3582 100644
--- a/target/s390x/tcg/vec_helper.c
+++ b/target/s390x/tcg/vec_helper.c
@@ -193,7 +193,7 @@ void HELPER(vstl)(CPUS390XState *env, const void *v1, uint64_t addr,
                   uint64_t bytes)
 {
     /* Probe write access before actually modifying memory */
-    probe_write_access(env, addr, bytes, GETPC());
+    probe_write_access(env, addr, MIN(bytes, 16), GETPC());
 
     if (likely(bytes >= 16)) {
         cpu_stq_data_ra(env, addr, s390_vec_read_element64(v1, 0), GETPC());
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:12:26 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:12:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814227.1227636 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTgA-00082O-Iq; Wed, 09 Oct 2024 10:12:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814227.1227636; Wed, 09 Oct 2024 10:12: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 1syTgA-00082G-GI; Wed, 09 Oct 2024 10:12:26 +0000
Received: by outflank-mailman (input) for mailman id 814227;
 Wed, 09 Oct 2024 10:12: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 1syTg9-00082A-Ug
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:12: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 1syTg9-0006W2-U4
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:12:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTg9-0007xV-TM
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:12: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=vLANo5JI4I9xBXCDkSFlyMoB9m/kTGV3KMQRTOGXxow=; b=t8hKG1ai9ry/2oJ4YvQJbjOQN7
	aQKH2rucmKqQ3j0mDwb7aqW7vL3gASwzNqgISzUeAzlGvRQ3xCKOLaciGSUuWRcrpQm1gietu4fbj
	5M0bALSPB86JAYOeZSt9je5hO32zJALe6jou7MClg8Ndq2dYvVhs7KJTZRAsBv28Ln+s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] target/s390x: Check reserved bits of VFMIN/VFMAX's M5
Message-Id: <E1syTg9-0007xV-TM@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:12:25 +0000

commit 96fd3b85081a119353b9ef3f783c2bc8c63758a2
Author:     Ilya Leoshkevich <iii@linux.ibm.com>
AuthorDate: Sat Aug 5 01:46:10 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/s390x: Check reserved bits of VFMIN/VFMAX's M5
    
    VFMIN and VFMAX should raise a specification exceptions when bits 1-3
    of M5 are set.
    
    Cc: qemu-stable@nongnu.org
    Fixes: da4807527f3b ("s390x/tcg: Implement VECTOR FP (MAXIMUM|MINIMUM)")
    Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
    Message-Id: <20230804234621.252522-1-iii@linux.ibm.com>
    Reviewed-by: David Hildenbrand <david@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 6a2ea6151835aa4f5fee29382a421c13b0e6619f)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/s390x/tcg/translate_vx.c.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/s390x/tcg/translate_vx.c.inc b/target/s390x/tcg/translate_vx.c.inc
index a6d840d406..ec94d39df0 100644
--- a/target/s390x/tcg/translate_vx.c.inc
+++ b/target/s390x/tcg/translate_vx.c.inc
@@ -3047,7 +3047,7 @@ static DisasJumpType op_vfmax(DisasContext *s, DisasOps *o)
     const uint8_t m5 = get_field(s, m5);
     gen_helper_gvec_3_ptr *fn;
 
-    if (m6 == 5 || m6 == 6 || m6 == 7 || m6 >= 13) {
+    if (m6 == 5 || m6 == 6 || m6 == 7 || m6 >= 13 || (m5 & 7)) {
         gen_program_exception(s, PGM_SPECIFICATION);
         return DISAS_NORETURN;
     }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:12:37 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:12:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814228.1227641 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTgL-00087p-K7; Wed, 09 Oct 2024 10:12:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814228.1227641; Wed, 09 Oct 2024 10:12: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 1syTgL-00087h-Hb; Wed, 09 Oct 2024 10:12:37 +0000
Received: by outflank-mailman (input) for mailman id 814228;
 Wed, 09 Oct 2024 10:12: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 1syTgK-00087W-1P
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:12: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 1syTgK-0006WP-0b
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:12:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTgJ-0007yQ-WC
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:12: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=vsp3Vl+sMDumy3lD9JTW8sOkBwH/UTo/9CzWBG7YVrc=; b=ZFSbFDU3zTzWxL2kxB1v+vjM9v
	CVDpAOmvP9ORTb3GHngRkxKouBWZacVLVXeaL42zj+6Jzs4V28CLfqqW78/1NK+05ul+1pz+J1wEO
	CQu+/xyCMoHLgP0BXBcB0+/j0s5im3wn32ff9elqFdIZmjh7EM+LMMgIvwom+AIbtGEY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] include/hw/virtio/virtio-gpu: Fix virtio-gpu with blob on big endian hosts
Message-Id: <E1syTgJ-0007yQ-WC@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:12:35 +0000

commit f2f8e74ff4eeca352981be4c5fdb03f19e58be7d
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Tue Aug 15 14:20:07 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    include/hw/virtio/virtio-gpu: Fix virtio-gpu with blob on big endian hosts
    
    Using "-device virtio-gpu,blob=true" currently does not work on big
    endian hosts (like s390x). The guest kernel prints an error message
    like:
    
     [drm:virtio_gpu_dequeue_ctrl_func [virtio_gpu]] *ERROR* response 0x1200 (command 0x10c)
    
    and the display stays black. When running QEMU with "-d guest_errors",
    it shows an error message like this:
    
     virtio_gpu_create_mapping_iov: nr_entries is too big (83886080 > 16384)
    
    which indicates that this value has not been properly byte-swapped.
    And indeed, the virtio_gpu_create_blob_bswap() function (that should
    swap the fields in the related structure) fails to swap some of the
    entries. After correctly swapping all missing values here, too, the
    virtio-gpu device is now also working with blob=true on s390x hosts.
    
    Fixes: e0933d91b1 ("virtio-gpu: Add virtio_gpu_resource_create_blob")
    Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=2230469
    Message-Id: <20230815122007.928049-1-thuth@redhat.com>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit d194362910138776e8abd6bb3c9fb3693254e95f)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 include/hw/virtio/virtio-gpu-bswap.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/hw/virtio/virtio-gpu-bswap.h b/include/hw/virtio/virtio-gpu-bswap.h
index 9124108485..637a0585d0 100644
--- a/include/hw/virtio/virtio-gpu-bswap.h
+++ b/include/hw/virtio/virtio-gpu-bswap.h
@@ -63,7 +63,10 @@ virtio_gpu_create_blob_bswap(struct virtio_gpu_resource_create_blob *cblob)
 {
     virtio_gpu_ctrl_hdr_bswap(&cblob->hdr);
     le32_to_cpus(&cblob->resource_id);
+    le32_to_cpus(&cblob->blob_mem);
     le32_to_cpus(&cblob->blob_flags);
+    le32_to_cpus(&cblob->nr_entries);
+    le64_to_cpus(&cblob->blob_id);
     le64_to_cpus(&cblob->size);
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:12:47 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:12:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814229.1227645 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTgV-0008AC-Lo; Wed, 09 Oct 2024 10:12:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814229.1227645; Wed, 09 Oct 2024 10:12: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 1syTgV-0008A4-J5; Wed, 09 Oct 2024 10:12:47 +0000
Received: by outflank-mailman (input) for mailman id 814229;
 Wed, 09 Oct 2024 10:12: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 1syTgU-00089u-55
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:12: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 1syTgU-0006WW-4Q
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:12:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTgU-0007z9-3W
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:12: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=DD8Oo4IYLZp9mcDVUH6RTGepR/lfydf2jjOlIVyPwec=; b=NQrHPAvk220arb0O97CBQm8lJG
	VOwzDmdI/juUf7k4FvJTYU3zV3SIXBFMKRa9Miaeschyoqee1rAgY3HbJVVi+IxfGWk8iF4+O6Mi/
	xrdb5zWbKvP9Hj2pVUrC4tesovDcsG1YSuQXtcaMcNTk30gAsK+FqVfBDUAHjiguMvFw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] kvm: Introduce kvm_arch_get_default_type hook
Message-Id: <E1syTgU-0007z9-3W@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:12:46 +0000

commit aa152711dbed973d7a4ecc725819d3eb280906f1
Author:     Akihiko Odaki <akihiko.odaki@daynix.com>
AuthorDate: Tue Aug 22 17:31:02 2023 +0100
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    kvm: Introduce kvm_arch_get_default_type hook
    
    kvm_arch_get_default_type() returns the default KVM type. This hook is
    particularly useful to derive a KVM type that is valid for "none"
    machine model, which is used by libvirt to probe the availability of
    KVM.
    
    For MIPS, the existing mips_kvm_type() is reused. This function ensures
    the availability of VZ which is mandatory to use KVM on the current
    QEMU.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
    Message-id: 20230727073134.134102-2-akihiko.odaki@daynix.com
    Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
    [PMM: added doc comment for new function]
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    (cherry picked from commit 5e0d65909c6f335d578b90491e165440c99adf81)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 accel/kvm/kvm-all.c      | 4 +++-
 hw/mips/loongson3_virt.c | 2 --
 include/sysemu/kvm.h     | 2 ++
 target/arm/kvm.c         | 5 +++++
 target/i386/kvm/kvm.c    | 5 +++++
 target/mips/kvm.c        | 2 +-
 target/mips/kvm_mips.h   | 9 ---------
 target/ppc/kvm.c         | 5 +++++
 target/riscv/kvm.c       | 5 +++++
 target/s390x/kvm/kvm.c   | 5 +++++
 10 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index cf3a88d90e..4c3ad74a6d 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -2382,7 +2382,7 @@ static int kvm_init(MachineState *ms)
     KVMState *s;
     const KVMCapabilityInfo *missing_cap;
     int ret;
-    int type = 0;
+    int type;
     uint64_t dirty_log_manual_caps;
 
     qemu_mutex_init(&kml_slots_lock);
@@ -2447,6 +2447,8 @@ static int kvm_init(MachineState *ms)
         type = mc->kvm_type(ms, kvm_type);
     } else if (mc->kvm_type) {
         type = mc->kvm_type(ms, NULL);
+    } else {
+        type = kvm_arch_get_default_type(ms);
     }
 
     do {
diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c
index 25534288dd..b4f6bff1b8 100644
--- a/hw/mips/loongson3_virt.c
+++ b/hw/mips/loongson3_virt.c
@@ -29,7 +29,6 @@
 #include "qemu/datadir.h"
 #include "qapi/error.h"
 #include "elf.h"
-#include "kvm_mips.h"
 #include "hw/char/serial.h"
 #include "hw/intc/loongson_liointc.h"
 #include "hw/mips/mips.h"
@@ -617,7 +616,6 @@ static void loongson3v_machine_class_init(ObjectClass *oc, void *data)
     mc->max_cpus = LOONGSON_MAX_VCPUS;
     mc->default_ram_id = "loongson3.highram";
     mc->default_ram_size = 1600 * MiB;
-    mc->kvm_type = mips_kvm_type;
     mc->minimum_page_bits = 14;
 }
 
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index c8281c07a7..e97ea915a2 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -369,6 +369,8 @@ int kvm_arch_get_registers(CPUState *cpu);
 
 int kvm_arch_put_registers(CPUState *cpu, int level);
 
+int kvm_arch_get_default_type(MachineState *ms);
+
 int kvm_arch_init(MachineState *ms, KVMState *s);
 
 int kvm_arch_init_vcpu(CPUState *cpu);
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 84da49332c..34bc329b5b 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -247,6 +247,11 @@ int kvm_arm_get_max_vm_ipa_size(MachineState *ms, bool *fixed_ipa)
     return ret > 0 ? ret : 40;
 }
 
+int kvm_arch_get_default_type(MachineState *ms)
+{
+    return 0;
+}
+
 int kvm_arch_init(MachineState *ms, KVMState *s)
 {
     int ret = 0;
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index de531842f6..eb2f4e3238 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -2552,6 +2552,11 @@ static void register_smram_listener(Notifier *n, void *unused)
                                  &smram_address_space, 1, "kvm-smram");
 }
 
+int kvm_arch_get_default_type(MachineState *ms)
+{
+    return 0;
+}
+
 int kvm_arch_init(MachineState *ms, KVMState *s)
 {
     uint64_t identity_base = 0xfffbc000;
diff --git a/target/mips/kvm.c b/target/mips/kvm.c
index c14e8f550f..e98aad01bd 100644
--- a/target/mips/kvm.c
+++ b/target/mips/kvm.c
@@ -1266,7 +1266,7 @@ int kvm_arch_msi_data_to_gsi(uint32_t data)
     abort();
 }
 
-int mips_kvm_type(MachineState *machine, const char *vm_type)
+int kvm_arch_get_default_type(MachineState *machine)
 {
 #if defined(KVM_CAP_MIPS_VZ)
     int r;
diff --git a/target/mips/kvm_mips.h b/target/mips/kvm_mips.h
index 171d53dbe1..c711269d0a 100644
--- a/target/mips/kvm_mips.h
+++ b/target/mips/kvm_mips.h
@@ -25,13 +25,4 @@ void kvm_mips_reset_vcpu(MIPSCPU *cpu);
 int kvm_mips_set_interrupt(MIPSCPU *cpu, int irq, int level);
 int kvm_mips_set_ipi_interrupt(MIPSCPU *cpu, int irq, int level);
 
-#ifdef CONFIG_KVM
-int mips_kvm_type(MachineState *machine, const char *vm_type);
-#else
-static inline int mips_kvm_type(MachineState *machine, const char *vm_type)
-{
-    return 0;
-}
-#endif
-
 #endif /* KVM_MIPS_H */
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 78f6fc50cd..90a69af926 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -107,6 +107,11 @@ static int kvm_ppc_register_host_cpu_type(void);
 static void kvmppc_get_cpu_characteristics(KVMState *s);
 static int kvmppc_get_dec_bits(void);
 
+int kvm_arch_get_default_type(MachineState *ms)
+{
+    return 0;
+}
+
 int kvm_arch_init(MachineState *ms, KVMState *s)
 {
     cap_interrupt_unset = kvm_check_extension(s, KVM_CAP_PPC_UNSET_IRQ);
diff --git a/target/riscv/kvm.c b/target/riscv/kvm.c
index 0f932a5b96..ee0b381400 100644
--- a/target/riscv/kvm.c
+++ b/target/riscv/kvm.c
@@ -426,6 +426,11 @@ int kvm_arch_add_msi_route_post(struct kvm_irq_routing_entry *route,
     return 0;
 }
 
+int kvm_arch_get_default_type(MachineState *ms)
+{
+    return 0;
+}
+
 int kvm_arch_init(MachineState *ms, KVMState *s)
 {
     return 0;
diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c
index 3ac7ec9acf..8ffe140513 100644
--- a/target/s390x/kvm/kvm.c
+++ b/target/s390x/kvm/kvm.c
@@ -340,6 +340,11 @@ static void ccw_machine_class_foreach(ObjectClass *oc, void *opaque)
     mc->default_cpu_type = S390_CPU_TYPE_NAME("host");
 }
 
+int kvm_arch_get_default_type(MachineState *ms)
+{
+    return 0;
+}
+
 int kvm_arch_init(MachineState *ms, KVMState *s)
 {
     object_class_foreach(ccw_machine_class_foreach, TYPE_S390_CCW_MACHINE,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:12:57 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:12:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814230.1227649 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTgf-0008Ch-NE; Wed, 09 Oct 2024 10:12:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814230.1227649; Wed, 09 Oct 2024 10:12: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 1syTgf-0008CZ-KV; Wed, 09 Oct 2024 10:12:57 +0000
Received: by outflank-mailman (input) for mailman id 814230;
 Wed, 09 Oct 2024 10:12: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 1syTge-0008CR-83
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:12: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 1syTge-0006Wd-7I
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:12:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTge-00080O-6e
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:12: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=EFNd2QcT5A6dFQ7YrhY3tXyvRDRRRzhG17cHVIzod20=; b=mSkE0pFQ9jCv0ThWbUzaiSlhKL
	gl0Ufh0zokzz/kqAyihWghynBXFhlCwOqEyg/BV2AalE8EFDor4ER8RNYRPrHo6VZNJ0lTbB4IMOh
	cYkYkeAFbImCNBL8diPmXNwgAYTuko1FmjAwIYXIUMX+Q5E6nUfZ5WJNcSlVXH2nCfFs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] accel/kvm: Specify default IPA size for arm64
Message-Id: <E1syTge-00080O-6e@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:12:56 +0000

commit f5cb21416e6fc6a3e2d58f4bb557c929ffe01818
Author:     Akihiko Odaki <akihiko.odaki@daynix.com>
AuthorDate: Tue Aug 22 17:31:02 2023 +0100
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    accel/kvm: Specify default IPA size for arm64
    
    Before this change, the default KVM type, which is used for non-virt
    machine models, was 0.
    
    The kernel documentation says:
    > On arm64, the physical address size for a VM (IPA Size limit) is
    > limited to 40bits by default. The limit can be configured if the host
    > supports the extension KVM_CAP_ARM_VM_IPA_SIZE. When supported, use
    > KVM_VM_TYPE_ARM_IPA_SIZE(IPA_Bits) to set the size in the machine type
    > identifier, where IPA_Bits is the maximum width of any physical
    > address used by the VM. The IPA_Bits is encoded in bits[7-0] of the
    > machine type identifier.
    >
    > e.g, to configure a guest to use 48bit physical address size::
    >
    >     vm_fd = ioctl(dev_fd, KVM_CREATE_VM, KVM_VM_TYPE_ARM_IPA_SIZE(48));
    >
    > The requested size (IPA_Bits) must be:
    >
    >  ==   =========================================================
    >   0   Implies default size, 40bits (for backward compatibility)
    >   N   Implies N bits, where N is a positive integer such that,
    >       32 <= N <= Host_IPA_Limit
    >  ==   =========================================================
    
    > Host_IPA_Limit is the maximum possible value for IPA_Bits on the host
    > and is dependent on the CPU capability and the kernel configuration.
    > The limit can be retrieved using KVM_CAP_ARM_VM_IPA_SIZE of the
    > KVM_CHECK_EXTENSION ioctl() at run-time.
    >
    > Creation of the VM will fail if the requested IPA size (whether it is
    > implicit or explicit) is unsupported on the host.
    https://docs.kernel.org/virt/kvm/api.html#kvm-create-vm
    
    So if Host_IPA_Limit < 40, specifying 0 as the type will fail. This
    actually confused libvirt, which uses "none" machine model to probe the
    KVM availability, on M2 MacBook Air.
    
    Fix this by using Host_IPA_Limit as the default type when
    KVM_CAP_ARM_VM_IPA_SIZE is available.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
    Message-id: 20230727073134.134102-3-akihiko.odaki@daynix.com
    Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    (cherry picked from commit 1ab445af8cd99343f29032b5944023ad7d8edebf)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/arm/kvm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 34bc329b5b..e219f78535 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -249,7 +249,9 @@ int kvm_arm_get_max_vm_ipa_size(MachineState *ms, bool *fixed_ipa)
 
 int kvm_arch_get_default_type(MachineState *ms)
 {
-    return 0;
+    bool fixed_ipa;
+    int size = kvm_arm_get_max_vm_ipa_size(ms, &fixed_ipa);
+    return fixed_ipa ? 0 : size;
 }
 
 int kvm_arch_init(MachineState *ms, KVMState *s)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:13:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:13:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814231.1227653 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTgp-0008FQ-Oe; Wed, 09 Oct 2024 10:13:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814231.1227653; Wed, 09 Oct 2024 10:13: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 1syTgp-0008FJ-Lt; Wed, 09 Oct 2024 10:13:07 +0000
Received: by outflank-mailman (input) for mailman id 814231;
 Wed, 09 Oct 2024 10:13: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 1syTgo-0008F7-At
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:13: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 1syTgo-0006Wu-AD
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:13:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTgo-00081d-9U
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:13: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=rCcYmJJ6llyrgC3B5/5w6KXkiZwf5w04x/orKS1wyZM=; b=Z0RWpyDfbl5JLabq5qpFINAiCa
	EGi3zFCgqruZTmVZW6WPNfCq4bpJqKpqZXx2i7y88BDVgRcP/grbPG7FYsEhg4xwvzzZjFEOVrx5y
	duuGvpyu1xrEQuAoRCGRazG/cK80zKSrMoSkEOcYALdv+HBfwszooSngYIlV9c2Q57Pk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] target/arm: Fix SME ST1Q
Message-Id: <E1syTgo-00081d-9U@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:13:06 +0000

commit 09640031edd4314b8b2b05235f3da8114b4d5d36
Author:     Richard Henderson <richard.henderson@linaro.org>
AuthorDate: Tue Aug 22 17:31:13 2023 +0100
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/arm: Fix SME ST1Q
    
    A typo, noted in the bug report, resulting in an
    incorrect write offset.
    
    Cc: qemu-stable@nongnu.org
    Fixes: 7390e0e9ab8 ("target/arm: Implement SME LD1, ST1")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1833
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20230818214255.146905-1-richard.henderson@linaro.org
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    (cherry picked from commit 4b3520fd93cd49cc56dfcab45d90735cc2e35af7)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/arm/tcg/sme_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/arm/tcg/sme_helper.c b/target/arm/tcg/sme_helper.c
index 1e67fcac30..296826ffe6 100644
--- a/target/arm/tcg/sme_helper.c
+++ b/target/arm/tcg/sme_helper.c
@@ -379,7 +379,7 @@ static inline void HNAME##_host(void *za, intptr_t off, void *host)         \
 {                                                                           \
     uint64_t *ptr = za + off;                                               \
     HOST(host, ptr[BE]);                                                    \
-    HOST(host + 1, ptr[!BE]);                                               \
+    HOST(host + 8, ptr[!BE]);                                               \
 }                                                                           \
 static inline void VNAME##_v_host(void *za, intptr_t off, void *host)       \
 {                                                                           \
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:13:18 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:13:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814232.1227656 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTgz-0008JA-RM; Wed, 09 Oct 2024 10:13:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814232.1227656; Wed, 09 Oct 2024 10:13: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 1syTgz-0008J2-OZ; Wed, 09 Oct 2024 10:13:17 +0000
Received: by outflank-mailman (input) for mailman id 814232;
 Wed, 09 Oct 2024 10:13: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 1syTgy-0008Ir-ED
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:13: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 1syTgy-0006Wz-Dd
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:13:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTgy-00082W-Cn
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:13: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=Y6RY1eAeS/LlREjRiFxZdXmYHeBd8+YNmQQ0SOhorRw=; b=Bmyhee42s7NafMp+vMDGY5VuT2
	bCMOU2sXUIst3rQjdV07dNWdyaRqrIm//TN8DR1eY7sfcfNoyu9IFA30ZgSzylEh+O2BcajLLU9jN
	3iqUtjrfYgMhfKkM8OB2ZtG0BtdwUqMnanQd2ZnUv+OWPs3nkz9mnh/xzWMkeZn4plgc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] target/arm: Fix 64-bit SSRA
Message-Id: <E1syTgy-00082W-Cn@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:13:16 +0000

commit d4c0ac705d720e19d9ec5b9fe1c6c7bb22b6913a
Author:     Richard Henderson <richard.henderson@linaro.org>
AuthorDate: Tue Aug 22 17:31:14 2023 +0100
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/arm: Fix 64-bit SSRA
    
    Typo applied byte-wise shift instead of double-word shift.
    
    Cc: qemu-stable@nongnu.org
    Fixes: 631e565450c ("target/arm: Create gen_gvec_[us]sra")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1737
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20230821022025.397682-1-richard.henderson@linaro.org
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    (cherry picked from commit cd1e4db73646006039f25879af3bff55b2295ff3)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/arm/tcg/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c
index 1e4d94e58a..e1fe68f73a 100644
--- a/target/arm/tcg/translate.c
+++ b/target/arm/tcg/translate.c
@@ -3063,7 +3063,7 @@ void gen_gvec_ssra(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs,
           .vece = MO_32 },
         { .fni8 = gen_ssra64_i64,
           .fniv = gen_ssra_vec,
-          .fno = gen_helper_gvec_ssra_b,
+          .fno = gen_helper_gvec_ssra_d,
           .prefer_i64 = TCG_TARGET_REG_BITS == 64,
           .opt_opc = vecop_list,
           .load_dest = true,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:13:27 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:13:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814233.1227662 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTh9-0008LY-TL; Wed, 09 Oct 2024 10:13:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814233.1227662; Wed, 09 Oct 2024 10:13: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 1syTh9-0008LQ-Q0; Wed, 09 Oct 2024 10:13:27 +0000
Received: by outflank-mailman (input) for mailman id 814233;
 Wed, 09 Oct 2024 10:13: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 1syTh8-0008LF-HV
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:13: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 1syTh8-0006X4-GM
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:13:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTh8-00084H-Fh
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:13: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=y6e5L0rw8zy0eNr/MDNnf0H7AGCInZRnXpXBuoRmdfc=; b=aIKfuooDQIQHxfweiyJV3ZxF5P
	0fBPif/rmHAc33hf5P9mJOjtL0IwAfeC4pGWp3BVlsgDRI+XgZzhtM8nCrNrZS1FPHSVq2cHod+L+
	0iDGjmDKmWqoA2LxyTy6WnMJSQ8dSRSL8Wutn8M0IHRxN+Ihfc6DSInY0CQPTYTmnvvs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] docs/about/license: Update LICENSE URL
Message-Id: <E1syTh8-00084H-Fh@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:13:26 +0000

commit 3c934310ffdfef69a085b8061d884d222b1d201b
Author:     Philippe Mathieu-Daudé <philmd@linaro.org>
AuthorDate: Tue Aug 22 14:57:16 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    docs/about/license: Update LICENSE URL
    
    In early 2021 (see commit 2ad784339e "docs: update README to use
    GitLab repo URLs") almost all of the code base was converted to
    point to GitLab instead of git.qemu.org. During 2023, git.qemu.org
    switched from a git mirror to a http redirect to GitLab (see [1]).
    
    Update the LICENSE URL to match its previous content, displaying
    the file raw content similarly to gitweb 'blob_plain' format ([2]).
    
    [1] https://lore.kernel.org/qemu-devel/CABgObfZu3mFc8tM20K-yXdt7F-7eV-uKZN4sKDarSeu7DYoRbA@mail.gmail.com/
    [2] https://git-scm.com/docs/gitweb#Documentation/gitweb.txt-blobplain
    
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Message-ID: <20230822125716.55295-1-philmd@linaro.org>
    (cherry picked from commit 09a3fffae00b042bed8ad9c351b1a58c505fde37)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 docs/about/license.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/about/license.rst b/docs/about/license.rst
index cde3d2d25d..303c55d61b 100644
--- a/docs/about/license.rst
+++ b/docs/about/license.rst
@@ -8,4 +8,4 @@ QEMU is a trademark of Fabrice Bellard.
 QEMU is released under the `GNU General Public
 License <https://www.gnu.org/licenses/gpl-2.0.txt>`__, version 2. Parts
 of QEMU have specific licenses, see file
-`LICENSE <https://git.qemu.org/?p=qemu.git;a=blob_plain;f=LICENSE>`__.
+`LICENSE <https://gitlab.com/qemu-project/qemu/-/raw/master/LICENSE>`__.
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:13:37 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:13:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814234.1227665 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syThJ-0008OE-Ud; Wed, 09 Oct 2024 10:13:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814234.1227665; Wed, 09 Oct 2024 10:13: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 1syThJ-0008O6-Ra; Wed, 09 Oct 2024 10:13:37 +0000
Received: by outflank-mailman (input) for mailman id 814234;
 Wed, 09 Oct 2024 10:13: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 1syThI-0008Nv-K1
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:13: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 1syThI-0006XR-JK
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:13:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syThI-00085q-IX
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:13: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=E1RqWE2fLRDEsUxpU4mXLS2dL1Xg0nBUvvTtv7F8X3E=; b=Tj6TFpUhdJISPTQgDdjMU2mRLh
	y5S6+f8IZSp8yz648pD99h6MypzeFlUayyNEr4WiKeKa340cpMFLHA12XW8QjJX8TJ+dbsrjy4QIa
	Y8u8yMQZId6B67QHzXsF29tzHX+wqBmUrM8bBMzSSOkonAqh2+n3yCT2BzobgxT+6ABA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] block-migration: Ensure we don't crash during migration cleanup
Message-Id: <E1syThI-00085q-IX@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:13:36 +0000

commit e8bb4dc55a9a8e52f55c17ee9b50d7436a672881
Author:     Fabiano Rosas <farosas@suse.de>
AuthorDate: Mon Jul 31 17:33:38 2023 -0300
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    block-migration: Ensure we don't crash during migration cleanup
    
    We can fail the blk_insert_bs() at init_blk_migration(), leaving the
    BlkMigDevState without a dirty_bitmap and BlockDriverState. Account
    for the possibly missing elements when doing cleanup.
    
    Fix the following crashes:
    
    Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
    0x0000555555ec83ef in bdrv_release_dirty_bitmap (bitmap=0x0) at ../block/dirty-bitmap.c:359
    359         BlockDriverState *bs = bitmap->bs;
     #0  0x0000555555ec83ef in bdrv_release_dirty_bitmap (bitmap=0x0) at ../block/dirty-bitmap.c:359
     #1  0x0000555555bba331 in unset_dirty_tracking () at ../migration/block.c:371
     #2  0x0000555555bbad98 in block_migration_cleanup_bmds () at ../migration/block.c:681
    
    Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
    0x0000555555e971ff in bdrv_op_unblock (bs=0x0, op=BLOCK_OP_TYPE_BACKUP_SOURCE, reason=0x0) at ../block.c:7073
    7073        QLIST_FOREACH_SAFE(blocker, &bs->op_blockers[op], list, next) {
     #0  0x0000555555e971ff in bdrv_op_unblock (bs=0x0, op=BLOCK_OP_TYPE_BACKUP_SOURCE, reason=0x0) at ../block.c:7073
     #1  0x0000555555e9734a in bdrv_op_unblock_all (bs=0x0, reason=0x0) at ../block.c:7095
     #2  0x0000555555bbae13 in block_migration_cleanup_bmds () at ../migration/block.c:690
    
    Signed-off-by: Fabiano Rosas <farosas@suse.de>
    Message-id: 20230731203338.27581-1-farosas@suse.de
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    (cherry picked from commit f187609f27b261702a17f79d20bf252ee0d4f9cd)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 migration/block.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/migration/block.c b/migration/block.c
index b2497bbd32..ece746e788 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -366,7 +366,9 @@ static void unset_dirty_tracking(void)
     BlkMigDevState *bmds;
 
     QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
-        bdrv_release_dirty_bitmap(bmds->dirty_bitmap);
+        if (bmds->dirty_bitmap) {
+            bdrv_release_dirty_bitmap(bmds->dirty_bitmap);
+        }
     }
 }
 
@@ -674,13 +676,18 @@ static int64_t get_remaining_dirty(void)
 static void block_migration_cleanup_bmds(void)
 {
     BlkMigDevState *bmds;
+    BlockDriverState *bs;
     AioContext *ctx;
 
     unset_dirty_tracking();
 
     while ((bmds = QSIMPLEQ_FIRST(&block_mig_state.bmds_list)) != NULL) {
         QSIMPLEQ_REMOVE_HEAD(&block_mig_state.bmds_list, entry);
-        bdrv_op_unblock_all(blk_bs(bmds->blk), bmds->blocker);
+
+        bs = blk_bs(bmds->blk);
+        if (bs) {
+            bdrv_op_unblock_all(bs, bmds->blocker);
+        }
         error_free(bmds->blocker);
 
         /* Save ctx, because bmds->blk can disappear during blk_unref.  */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:13:48 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:13:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814235.1227669 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syThT-0008R7-W3; Wed, 09 Oct 2024 10:13:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814235.1227669; Wed, 09 Oct 2024 10:13: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 1syThT-0008Qz-T2; Wed, 09 Oct 2024 10:13:47 +0000
Received: by outflank-mailman (input) for mailman id 814235;
 Wed, 09 Oct 2024 10:13: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 1syThS-0008Qq-Mr
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:13: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 1syThS-0006XW-ME
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:13:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syThS-00086f-LX
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:13: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=yjUS3GZFpSnYY6cgJpYioMUlICDuR1a0+jWYwVEMmE4=; b=Elco0Ml0sHjSBcNqfCOMvwbITU
	KPT0YWm2L88v/I0Re+e9FmoNRQPBzIfFvJgMijAUs+23YFziyKmJqE3N0YIzZZS1a0hv9NOiUNEDf
	EUJ/ghkCWSBhNTn2A6P+NLhH0XqmjzLnI3dP91T+61s3aVfDCwj4knfOXj3Km44bI07Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/ppc/e500: fix broken snapshot replay
Message-Id: <E1syThS-00086f-LX@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:13:46 +0000

commit fcb49ea23c39dd93b8e1d4e0edae67967d28e001
Author:     Maksim Kostin <maksim.kostin@ispras.ru>
AuthorDate: Wed Aug 9 13:07:33 2023 +0300
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/ppc/e500: fix broken snapshot replay
    
    ppce500_reset_device_tree is registered for system reset, but after
    c4b075318eb1 this function rerandomizes rng-seed via
    qemu_guest_getrandom_nofail. And when loading a snapshot, it tries to read
    EVENT_RANDOM that doesn't exist, so we have an error:
    
      qemu-system-ppc: Missing random event in the replay log
    
    To fix this, use qemu_register_reset_nosnapshotload instead of
    qemu_register_reset.
    
    Reported-by: Vitaly Cheptsov <cheptsov@ispras.ru>
    Fixes: c4b075318eb1 ("hw/ppc: pass random seed to fdt ")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1634
    Signed-off-by: Maksim Kostin <maksim.kostin@ispras.ru>
    Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    (cherry picked from commit 6ec65b69ba17c954414fa23a397fb8a3fcfb4a43)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ppc/e500.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index 117c9c08ed..27d83a4bf6 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -712,7 +712,7 @@ static int ppce500_prep_device_tree(PPCE500MachineState *machine,
     p->kernel_base = kernel_base;
     p->kernel_size = kernel_size;
 
-    qemu_register_reset(ppce500_reset_device_tree, p);
+    qemu_register_reset_nosnapshotload(ppce500_reset_device_tree, p);
     p->notifier.notify = ppce500_init_notify;
     qemu_add_machine_init_done_notifier(&p->notifier);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:13:58 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:13:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814236.1227672 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syThe-0008TZ-0f; Wed, 09 Oct 2024 10:13:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814236.1227672; Wed, 09 Oct 2024 10:13: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 1syThd-0008TR-UV; Wed, 09 Oct 2024 10:13:57 +0000
Received: by outflank-mailman (input) for mailman id 814236;
 Wed, 09 Oct 2024 10:13: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 1syThc-0008TG-Pj
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:13: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 1syThc-0006Xe-P5
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:13:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syThc-00088h-OQ
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:13: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=G9SeZ9HvxWYCWLo7Oi2Ii9TiyEg6676ussLVIIVXwZ4=; b=jgkQngbKGSHRtXMo0OMNZZxEi2
	3cUOpLSSXBkKVeAaizJ8EwVftyNffzlyekgdcePFrJvk8HBkNRQ4QwwxejYZB++12GI7feCXXsE9A
	NTaMfbqlg5/0lPJgEieA4EOKPuCMtBw94tiiHzB70Jc9LJMbTceqTweCHHPrn1L3k0UQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] ppc/vof: Fix missed fields in VOF cleanup
Message-Id: <E1syThc-00088h-OQ@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:13:56 +0000

commit ea25506b5d6439c76a3a6b7b55dd3f861e98eb85
Author:     Nicholas Piggin <npiggin@gmail.com>
AuthorDate: Tue Aug 8 14:19:44 2023 +1000
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    ppc/vof: Fix missed fields in VOF cleanup
    
    Failing to reset the of_instance_last makes ihandle allocation continue
    to increase, which causes record-replay replay fail to match the
    recorded trace.
    
    Not resetting claimed_base makes VOF eventually run out of memory after
    some resets.
    
    Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
    Fixes: fc8c745d501 ("spapr: Implement Open Firmware client interface")
    Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
    Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    (cherry picked from commit 7b8589d7ce7e23f26ff53338d575a5cbd7818e28)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ppc/vof.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/ppc/vof.c b/hw/ppc/vof.c
index 18c3f92317..e3b430a81f 100644
--- a/hw/ppc/vof.c
+++ b/hw/ppc/vof.c
@@ -1024,6 +1024,8 @@ void vof_cleanup(Vof *vof)
     }
     vof->claimed = NULL;
     vof->of_instances = NULL;
+    vof->of_instance_last = 0;
+    vof->claimed_base = 0;
 }
 
 void vof_build_dt(void *fdt, Vof *vof)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:14:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:14:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814237.1227677 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTho-0008WK-2Q; Wed, 09 Oct 2024 10:14:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814237.1227677; Wed, 09 Oct 2024 10:14:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syThn-0008WC-Vy; Wed, 09 Oct 2024 10:14:07 +0000
Received: by outflank-mailman (input) for mailman id 814237;
 Wed, 09 Oct 2024 10:14: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 1syThm-0008W3-Sh
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:14: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 1syThm-0006Xy-S7
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:14:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syThm-0008AV-RJ
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:14: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=bFvqhWX5TNxEpfaSxbIZeE5eKnQifLM6FQv2s6gWFz8=; b=abm3SYr0u65HRtGL3J7VF/RfKw
	p/fHYqVWBSSzirhJNqB0IxjSpIeF3OOP3IWEPaW7c88WTM8tht0KPhtxCRyk4p9jKq0RFm0abgxR+
	pBGTQPRyEMBZnjorNkh00qS+LoSBXOhWM5zXoGhkzRg3bYrPHqs1zrjainv6wXP3R3NI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] target/ppc: Flush inputs to zero with NJ in ppc_store_vscr
Message-Id: <E1syThm-0008AV-RJ@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:14:06 +0000

commit 956b96f9e25f22a1e66d0dcacfb3621ef8a671b4
Author:     Richard Henderson <richard.henderson@linaro.org>
AuthorDate: Sun Aug 20 19:59:35 2023 -0700
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/ppc: Flush inputs to zero with NJ in ppc_store_vscr
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1779
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    (cherry picked from commit af03aeb631eeb81a44d2c0ff5b429cd4b5dc2799)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/ppc/cpu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c
index 1a97b41c6b..6e597680fb 100644
--- a/target/ppc/cpu.c
+++ b/target/ppc/cpu.c
@@ -59,6 +59,7 @@ void ppc_store_vscr(CPUPPCState *env, uint32_t vscr)
     env->vscr_sat.u64[0] = vscr & (1u << VSCR_SAT);
     env->vscr_sat.u64[1] = 0;
     set_flush_to_zero((vscr >> VSCR_NJ) & 1, &env->vec_status);
+    set_flush_inputs_to_zero((vscr >> VSCR_NJ) & 1, &env->vec_status);
 }
 
 uint32_t ppc_get_vscr(CPUPPCState *env)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:14:18 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:14:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814238.1227681 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syThy-000084-3u; Wed, 09 Oct 2024 10:14:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814238.1227681; Wed, 09 Oct 2024 10:14:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syThy-00007s-19; Wed, 09 Oct 2024 10:14:18 +0000
Received: by outflank-mailman (input) for mailman id 814238;
 Wed, 09 Oct 2024 10:14:17 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syThw-00007d-Vr
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:14: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 1syThw-0006Y7-V8
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:14:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syThw-0008BH-UM
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:14: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=2Rhq1/CA/Tng9emtNu7wkM6vsFUIJL+MNvpxiS7r0g4=; b=nyPA/4YPHjpbR8a48M6VnZoZRt
	ZugAymiOaDI24rsfMGwLfLq0ZG5zwSoUYdSitByb5jYGW9C+vDH3rrFrowK1ZphDLBZsDxmNQHufR
	V/UoWG8mRcXkHr0SASqET2T4SikYkf0yhUACtMvj5hjvWDu5IJb6JNAsN+iguiZANjtM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/ide/core: set ERR_STAT in unsupported command completion
Message-Id: <E1syThw-0008BH-UM@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:14:16 +0000

commit 67894ec9fd512db33a883bd8df01ddac7f9f9780
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:38 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/ide/core: set ERR_STAT in unsupported command completion
    
    Currently, the first time sending an unsupported command
    (e.g. READ LOG DMA EXT) will not have ERR_STAT set in the completion.
    Sending the unsupported command again, will correctly have ERR_STAT set.
    
    When ide_cmd_permitted() returns false, it calls ide_abort_command().
    ide_abort_command() first calls ide_transfer_stop(), which will call
    ide_transfer_halt() and ide_cmd_done(), after that ide_abort_command()
    sets ERR_STAT in status.
    
    ide_cmd_done() for AHCI will call ahci_write_fis_d2h() which writes the
    current status in the FIS, and raises an IRQ. (The status here will not
    have ERR_STAT set!).
    
    Thus, we cannot call ide_transfer_stop() before setting ERR_STAT, as
    ide_transfer_stop() will result in the FIS being written and an IRQ
    being raised.
    
    The reason why it works the second time, is that ERR_STAT will still
    be set from the previous command, so when writing the FIS, the
    completion will correctly have ERR_STAT set.
    
    Set ERR_STAT before writing the FIS (calling cmd_done), so that we will
    raise an error IRQ correctly when receiving an unsupported command.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20230609140844.202795-3-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit c3461c6264a7c8ca15b117e91fe5da786924a784)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/ide/core.c b/hw/ide/core.c
index de48ff9f86..07971c0218 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -533,9 +533,9 @@ BlockAIOCB *ide_issue_trim(
 
 void ide_abort_command(IDEState *s)
 {
-    ide_transfer_stop(s);
     s->status = READY_STAT | ERR_STAT;
     s->error = ABRT_ERR;
+    ide_transfer_stop(s);
 }
 
 static void ide_set_retry(IDEState *s)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:14:28 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:14:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814239.1227684 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTi8-0000Bn-5J; Wed, 09 Oct 2024 10:14:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814239.1227684; Wed, 09 Oct 2024 10:14:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTi8-0000Bf-2b; Wed, 09 Oct 2024 10:14:28 +0000
Received: by outflank-mailman (input) for mailman id 814239;
 Wed, 09 Oct 2024 10:14:27 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTi7-0000BQ-2V
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:14:27 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTi7-0006YH-1u
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:14:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTi7-0008C5-16
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:14:27 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+6q/F4zarM8F7wQS171Ow6pX3R8uXw7qlRAyC4eMYXo=; b=PoEcgFubSnTDwj9XlQ+b0UN3Cw
	CLLalXRS7hqas7nDDcSszylJ0XQ9IZ8Hb7z0eJUYlrKTZjIWUhFWjhK7HhWyY92caIUosFlemZkl+
	KQO/iToAATH3U590BQIwvS0PZctWztgVx3gVKM7Ta+gjcBOt+ImD2lZGBYxS3/nKWSE8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/ide/ahci: write D2H FIS when processing NCQ command
Message-Id: <E1syTi7-0008C5-16@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:14:27 +0000

commit 362a4d8658c9370a071b5e598c158d522a3fa60d
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:39 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/ide/ahci: write D2H FIS when processing NCQ command
    
    The way that BUSY + PxCI is cleared for NCQ (FPDMA QUEUED) commands is
    described in SATA 3.5a Gold:
    
    11.15 FPDMA QUEUED command protocol
    DFPDMAQ2: ClearInterfaceBsy
    "Transmit Register Device to Host FIS with the BSY bit cleared to zero
    and the DRQ bit cleared to zero and Interrupt bit cleared to zero to
    mark interface ready for the next command."
    
    PxCI is currently cleared by handle_cmd(), but we don't write the D2H
    FIS to the FIS Receive Area that actually caused PxCI to be cleared.
    
    Similar to how ahci_pio_transfer() calls ahci_write_fis_pio() with an
    additional parameter to write a PIO Setup FIS without raising an IRQ,
    add a parameter to ahci_write_fis_d2h() so that ahci_write_fis_d2h()
    also can write the FIS to the FIS Receive Area without raising an IRQ.
    
    Change process_ncq_command() to call ahci_write_fis_d2h() without
    raising an IRQ (similar to ahci_pio_transfer()), such that the FIS
    Receive Area is in sync with the PxTFD shadow register.
    
    E.g. Linux reads status and error fields from the FIS Receive Area
    directly, so it is wise to keep the FIS Receive Area and the PxTFD
    shadow register in sync.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Message-id: 20230609140844.202795-4-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit 2967dc8209dd27b61a6ab7bad78cf7c6ec58ddb4)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/ahci.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 4e76d6b191..b81da46e3e 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -43,7 +43,7 @@
 static void check_cmd(AHCIState *s, int port);
 static int handle_cmd(AHCIState *s, int port, uint8_t slot);
 static void ahci_reset_port(AHCIState *s, int port);
-static bool ahci_write_fis_d2h(AHCIDevice *ad);
+static bool ahci_write_fis_d2h(AHCIDevice *ad, bool d2h_fis_i);
 static void ahci_init_d2h(AHCIDevice *ad);
 static int ahci_dma_prepare_buf(const IDEDMA *dma, int32_t limit);
 static bool ahci_map_clb_address(AHCIDevice *ad);
@@ -618,7 +618,7 @@ static void ahci_init_d2h(AHCIDevice *ad)
         return;
     }
 
-    if (ahci_write_fis_d2h(ad)) {
+    if (ahci_write_fis_d2h(ad, true)) {
         ad->init_d2h_sent = true;
         /* We're emulating receiving the first Reg H2D Fis from the device;
          * Update the SIG register, but otherwise proceed as normal. */
@@ -850,7 +850,7 @@ static void ahci_write_fis_pio(AHCIDevice *ad, uint16_t len, bool pio_fis_i)
     }
 }
 
-static bool ahci_write_fis_d2h(AHCIDevice *ad)
+static bool ahci_write_fis_d2h(AHCIDevice *ad, bool d2h_fis_i)
 {
     AHCIPortRegs *pr = &ad->port_regs;
     uint8_t *d2h_fis;
@@ -864,7 +864,7 @@ static bool ahci_write_fis_d2h(AHCIDevice *ad)
     d2h_fis = &ad->res_fis[RES_FIS_RFIS];
 
     d2h_fis[0] = SATA_FIS_TYPE_REGISTER_D2H;
-    d2h_fis[1] = (1 << 6); /* interrupt bit */
+    d2h_fis[1] = d2h_fis_i ? (1 << 6) : 0; /* interrupt bit */
     d2h_fis[2] = s->status;
     d2h_fis[3] = s->error;
 
@@ -890,7 +890,10 @@ static bool ahci_write_fis_d2h(AHCIDevice *ad)
         ahci_trigger_irq(ad->hba, ad, AHCI_PORT_IRQ_BIT_TFES);
     }
 
-    ahci_trigger_irq(ad->hba, ad, AHCI_PORT_IRQ_BIT_DHRS);
+    if (d2h_fis_i) {
+        ahci_trigger_irq(ad->hba, ad, AHCI_PORT_IRQ_BIT_DHRS);
+    }
+
     return true;
 }
 
@@ -1120,6 +1123,8 @@ static void process_ncq_command(AHCIState *s, int port, const uint8_t *cmd_fis,
         return;
     }
 
+    ahci_write_fis_d2h(ad, false);
+
     ncq_tfs->used = 1;
     ncq_tfs->drive = ad;
     ncq_tfs->slot = slot;
@@ -1506,7 +1511,7 @@ static void ahci_cmd_done(const IDEDMA *dma)
     }
 
     /* update d2h status */
-    ahci_write_fis_d2h(ad);
+    ahci_write_fis_d2h(ad, true);
 
     if (ad->port_regs.cmd_issue && !ad->check_bh) {
         ad->check_bh = qemu_bh_new_guarded(ahci_check_cmd_bh, ad,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:14:38 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:14:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814240.1227689 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTiI-0000F1-8L; Wed, 09 Oct 2024 10:14:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814240.1227689; Wed, 09 Oct 2024 10:14:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTiI-0000Eu-5d; Wed, 09 Oct 2024 10:14:38 +0000
Received: by outflank-mailman (input) for mailman id 814240;
 Wed, 09 Oct 2024 10:14:37 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTiH-0000Ek-5j
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:14:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTiH-0006Yj-51
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:14:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTiH-0008DJ-4B
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:14:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=khjefLBV3KWqk7Ml08vXYbg5Zw7LrTGbKLgDwzzWjjI=; b=fIWrx3Zuzd6iBGDOBJGCSSI0Y5
	xXUpQ782s+Uj8oOSMpVfy4eeHleozGjiIvCNCZdM9vxYiZHQ4n/dubG33oAhzSmLT/bUmSn7Vehtp
	/7cQoLnQgMidTwrTuIfDQsnFE6QtTPsR8vygZpfVVbQn9Lglj4/ur1GhCR51P14UTpBE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/ide/ahci: simplify and document PxCI handling
Message-Id: <E1syTiH-0008DJ-4B@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:14:37 +0000

commit 7bcd32128b227cee1fb39ff242d486ed9fff7648
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:40 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/ide/ahci: simplify and document PxCI handling
    
    The AHCI spec states that:
    For NCQ, PxCI is cleared on command queued successfully.
    
    For non-NCQ, PxCI is cleared on command completed successfully.
    (A non-NCQ command that completes with error does not clear PxCI.)
    
    The current QEMU implementation either clears PxCI in check_cmd(),
    or in ahci_cmd_done().
    
    check_cmd() will clear PxCI for a command if handle_cmd() returns 0.
    handle_cmd() will return -1 if BUSY or DRQ is set.
    
    The QEMU implementation for NCQ commands will currently not set BUSY
    or DRQ, so they will always have PxCI cleared by handle_cmd().
    ahci_cmd_done() will never even get called for NCQ commands.
    
    Non-NCQ commands are executed by ide_bus_exec_cmd().
    Non-NCQ commands in QEMU are implemented either in a sync or in an async
    way.
    
    For non-NCQ commands implemented in a sync way, the command handler will
    return true, and when ide_bus_exec_cmd() sees that a command handler
    returns true, it will call ide_cmd_done() (which will call
    ahci_cmd_done()). For a command implemented in a sync way,
    ahci_cmd_done() will do nothing (since busy_slot is not set). Instead,
    after ide_bus_exec_cmd() has finished, check_cmd() will clear PxCI for
    these commands.
    
    For non-NCQ commands implemented in an async way (using either aiocb or
    pio_aiocb), the command handler will return false, ide_bus_exec_cmd()
    will not call ide_cmd_done(), instead it is expected that the async
    callback function will call ide_cmd_done() once the async command is
    done. handle_cmd() will set busy_slot, if and only if BUSY or DRQ is
    set, and this is checked _after_ ide_bus_exec_cmd() has returned.
    handle_cmd() will return -1, so check_cmd() will not clear PxCI.
    When the async callback calls ide_cmd_done() (which will call
    ahci_cmd_done()), it will see that busy_slot is set, and
    ahci_cmd_done() will clear PxCI.
    
    This seems racy, since busy_slot is set _after_ ide_bus_exec_cmd() has
    returned. The callback might come before busy_slot gets set. And it is
    quite confusing that ahci_cmd_done() will be called for all non-NCQ
    commands when the command is done, but will only clear PxCI in certain
    cases, even though it will always write a D2H FIS and raise an IRQ.
    
    Even worse, in the case where ahci_cmd_done() does not clear PxCI, it
    still raises an IRQ. Host software might thus read an old PxCI value,
    since PxCI is cleared (by check_cmd()) after the IRQ has been raised.
    
    Try to simplify this by always setting busy_slot for non-NCQ commands,
    such that ahci_cmd_done() will always be responsible for clearing PxCI
    for non-NCQ commands.
    
    For NCQ commands, clear PxCI when we receive the D2H FIS, but before
    raising the IRQ, see AHCI 1.3.1, section 5.3.8, states RegFIS:Entry and
    RegFIS:ClearCI.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Message-id: 20230609140844.202795-5-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit e2a5d9b3d9c3d311618160603cc9bc04fbd98796)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/ahci.c | 70 ++++++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 50 insertions(+), 20 deletions(-)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index b81da46e3e..6299320ffb 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -41,9 +41,10 @@
 #include "trace.h"
 
 static void check_cmd(AHCIState *s, int port);
-static int handle_cmd(AHCIState *s, int port, uint8_t slot);
+static void handle_cmd(AHCIState *s, int port, uint8_t slot);
 static void ahci_reset_port(AHCIState *s, int port);
 static bool ahci_write_fis_d2h(AHCIDevice *ad, bool d2h_fis_i);
+static void ahci_clear_cmd_issue(AHCIDevice *ad, uint8_t slot);
 static void ahci_init_d2h(AHCIDevice *ad);
 static int ahci_dma_prepare_buf(const IDEDMA *dma, int32_t limit);
 static bool ahci_map_clb_address(AHCIDevice *ad);
@@ -591,9 +592,8 @@ static void check_cmd(AHCIState *s, int port)
 
     if ((pr->cmd & PORT_CMD_START) && pr->cmd_issue) {
         for (slot = 0; (slot < 32) && pr->cmd_issue; slot++) {
-            if ((pr->cmd_issue & (1U << slot)) &&
-                !handle_cmd(s, port, slot)) {
-                pr->cmd_issue &= ~(1U << slot);
+            if (pr->cmd_issue & (1U << slot)) {
+                handle_cmd(s, port, slot);
             }
         }
     }
@@ -1123,6 +1123,22 @@ static void process_ncq_command(AHCIState *s, int port, const uint8_t *cmd_fis,
         return;
     }
 
+    /*
+     * A NCQ command clears the bit in PxCI after the command has been QUEUED
+     * successfully (ERROR not set, BUSY and DRQ cleared).
+     *
+     * For NCQ commands, PxCI will always be cleared here.
+     *
+     * (Once the NCQ command is COMPLETED, the device will send a SDB FIS with
+     * the interrupt bit set, which will clear PxSACT and raise an interrupt.)
+     */
+    ahci_clear_cmd_issue(ad, slot);
+
+    /*
+     * In reality, for NCQ commands, PxCI is cleared after receiving a D2H FIS
+     * without the interrupt bit set, but since ahci_write_fis_d2h() can raise
+     * an IRQ on error, we need to call them in reverse order.
+     */
     ahci_write_fis_d2h(ad, false);
 
     ncq_tfs->used = 1;
@@ -1197,6 +1213,7 @@ static void handle_reg_h2d_fis(AHCIState *s, int port,
 {
     IDEState *ide_state = &s->dev[port].port.ifs[0];
     AHCICmdHdr *cmd = get_cmd_header(s, port, slot);
+    AHCIDevice *ad = &s->dev[port];
     uint16_t opts = le16_to_cpu(cmd->opts);
 
     if (cmd_fis[1] & 0x0F) {
@@ -1273,11 +1290,19 @@ static void handle_reg_h2d_fis(AHCIState *s, int port,
     /* Reset transferred byte counter */
     cmd->status = 0;
 
+    /*
+     * A non-NCQ command clears the bit in PxCI after the command has COMPLETED
+     * successfully (ERROR not set, BUSY and DRQ cleared).
+     *
+     * For non-NCQ commands, PxCI will always be cleared by ahci_cmd_done().
+     */
+    ad->busy_slot = slot;
+
     /* We're ready to process the command in FIS byte 2. */
     ide_bus_exec_cmd(&s->dev[port].port, cmd_fis[2]);
 }
 
-static int handle_cmd(AHCIState *s, int port, uint8_t slot)
+static void handle_cmd(AHCIState *s, int port, uint8_t slot)
 {
     IDEState *ide_state;
     uint64_t tbl_addr;
@@ -1288,12 +1313,12 @@ static int handle_cmd(AHCIState *s, int port, uint8_t slot)
     if (s->dev[port].port.ifs[0].status & (BUSY_STAT|DRQ_STAT)) {
         /* Engine currently busy, try again later */
         trace_handle_cmd_busy(s, port);
-        return -1;
+        return;
     }
 
     if (!s->dev[port].lst) {
         trace_handle_cmd_nolist(s, port);
-        return -1;
+        return;
     }
     cmd = get_cmd_header(s, port, slot);
     /* remember current slot handle for later */
@@ -1303,7 +1328,7 @@ static int handle_cmd(AHCIState *s, int port, uint8_t slot)
     ide_state = &s->dev[port].port.ifs[0];
     if (!ide_state->blk) {
         trace_handle_cmd_badport(s, port);
-        return -1;
+        return;
     }
 
     tbl_addr = le64_to_cpu(cmd->tbl_addr);
@@ -1312,7 +1337,7 @@ static int handle_cmd(AHCIState *s, int port, uint8_t slot)
                              DMA_DIRECTION_TO_DEVICE, MEMTXATTRS_UNSPECIFIED);
     if (!cmd_fis) {
         trace_handle_cmd_badfis(s, port);
-        return -1;
+        return;
     } else if (cmd_len != 0x80) {
         ahci_trigger_irq(s, &s->dev[port], AHCI_PORT_IRQ_BIT_HBFS);
         trace_handle_cmd_badmap(s, port, cmd_len);
@@ -1336,15 +1361,6 @@ static int handle_cmd(AHCIState *s, int port, uint8_t slot)
 out:
     dma_memory_unmap(s->as, cmd_fis, cmd_len, DMA_DIRECTION_TO_DEVICE,
                      cmd_len);
-
-    if (s->dev[port].port.ifs[0].status & (BUSY_STAT|DRQ_STAT)) {
-        /* async command, complete later */
-        s->dev[port].busy_slot = slot;
-        return -1;
-    }
-
-    /* done handling the command */
-    return 0;
 }
 
 /* Transfer PIO data between RAM and device */
@@ -1498,6 +1514,16 @@ static int ahci_dma_rw_buf(const IDEDMA *dma, bool is_write)
     return 1;
 }
 
+static void ahci_clear_cmd_issue(AHCIDevice *ad, uint8_t slot)
+{
+    IDEState *ide_state = &ad->port.ifs[0];
+
+    if (!(ide_state->status & (BUSY_STAT | DRQ_STAT))) {
+        ad->port_regs.cmd_issue &= ~(1 << slot);
+    }
+}
+
+/* Non-NCQ command is done - This function is never called for NCQ commands. */
 static void ahci_cmd_done(const IDEDMA *dma)
 {
     AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma);
@@ -1506,11 +1532,15 @@ static void ahci_cmd_done(const IDEDMA *dma)
 
     /* no longer busy */
     if (ad->busy_slot != -1) {
-        ad->port_regs.cmd_issue &= ~(1 << ad->busy_slot);
+        ahci_clear_cmd_issue(ad, ad->busy_slot);
         ad->busy_slot = -1;
     }
 
-    /* update d2h status */
+    /*
+     * In reality, for non-NCQ commands, PxCI is cleared after receiving a D2H
+     * FIS with the interrupt bit set, but since ahci_write_fis_d2h() will raise
+     * an IRQ, we need to call them in reverse order.
+     */
     ahci_write_fis_d2h(ad, true);
 
     if (ad->port_regs.cmd_issue && !ad->check_bh) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:14:48 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:14:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814241.1227693 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTiS-0000Je-9z; Wed, 09 Oct 2024 10:14:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814241.1227693; Wed, 09 Oct 2024 10:14:48 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTiS-0000JW-7K; Wed, 09 Oct 2024 10:14:48 +0000
Received: by outflank-mailman (input) for mailman id 814241;
 Wed, 09 Oct 2024 10:14:47 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTiR-0000JL-8i
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:14:47 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTiR-0006Yx-82
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:14:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTiR-0008EK-7E
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:14:47 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6gp1S0McQkTB6maFKDq4n1He17gmA27kI+JDFYJZtyI=; b=Y28ww1iUQAL1v3GG9Q3zoK3EFK
	x+nIvAGiQL48hIaSjgLk32ZEYGaiN/GfMypN0eX66tHzK6v+lUViKF+ZbTtiSWfuos5WMQPK72vSq
	ZASLov/GlFpIki7hLhmR/WEuj5Guj4YYTHnGQuZGQm+T4+1BT3PhmQQNUrArOpGM3TpQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/ide/ahci: PxSACT and PxCI is cleared when PxCMD.ST is cleared
Message-Id: <E1syTiR-0008EK-7E@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:14:47 +0000

commit 2eaf7775fc05d65c9254530ea0fdbbcf910c92cd
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:41 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/ide/ahci: PxSACT and PxCI is cleared when PxCMD.ST is cleared
    
    According to AHCI 1.3.1 definition of PxSACT:
    This field is cleared when PxCMD.ST is written from a '1' to a '0' by
    software. This field is not cleared by a COMRESET or a software reset.
    
    According to AHCI 1.3.1 definition of PxCI:
    This field is also cleared when PxCMD.ST is written from a '1' to a '0'
    by software.
    
    Clearing PxCMD.ST is part of the error recovery procedure, see
    AHCI 1.3.1, section "6.2 Error Recovery".
    
    If we don't clear PxCI on error recovery, the previous command will
    incorrectly still be marked as pending after error recovery.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20230609140844.202795-6-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit d73b84d0b664e60fffb66f46e84d0db4a8e1c713)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/ahci.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 6299320ffb..a93a1878de 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -329,6 +329,11 @@ static void ahci_port_write(AHCIState *s, int port, int offset, uint32_t val)
         ahci_check_irq(s);
         break;
     case AHCI_PORT_REG_CMD:
+        if ((pr->cmd & PORT_CMD_START) && !(val & PORT_CMD_START)) {
+            pr->scr_act = 0;
+            pr->cmd_issue = 0;
+        }
+
         /* Block any Read-only fields from being set;
          * including LIST_ON and FIS_ON.
          * The spec requires to set ICC bits to zero after the ICC change
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:14:59 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:14:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814242.1227696 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTid-0000MQ-BM; Wed, 09 Oct 2024 10:14:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814242.1227696; Wed, 09 Oct 2024 10:14:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTid-0000MI-8o; Wed, 09 Oct 2024 10:14:59 +0000
Received: by outflank-mailman (input) for mailman id 814242;
 Wed, 09 Oct 2024 10:14:57 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTib-0000M1-Bm
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:14:57 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTib-0006Z4-B6
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:14:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTib-0008FG-AQ
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:14:57 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0vUyyXq8gS2+KJtxN1F1d+7jYwnc+o9VAjhwkjoiEf0=; b=QAFVKLhPMokL9A8Dew3ftAwmbv
	WnEXO/mY3fKiM1V1/AvmtnYv2xplfAsrfZ8J8PFVfkdv5FEFf+/6xPmxtKYsfFunnMfBH82XqqunR
	4kSF1mW+vItmjH1JcKcEdg3YpgfB75oDNkO8/4jhg5McZsYsmoOaWaeY2QcvnZmMk/yk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/ide/ahci: PxCI should not get cleared when ERR_STAT is set
Message-Id: <E1syTib-0008FG-AQ@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:14:57 +0000

commit f7cca09987983644d054fc4f4feb8414dcd624c5
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:42 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:58 2023 +0300

    hw/ide/ahci: PxCI should not get cleared when ERR_STAT is set
    
    For NCQ, PxCI is cleared on command queued successfully.
    For non-NCQ, PxCI is cleared on command completed successfully.
    Successfully means ERR_STAT, BUSY and DRQ are all cleared.
    
    A command that has ERR_STAT set, does not get to clear PxCI.
    See AHCI 1.3.1, section 5.3.8, states RegFIS:Entry and RegFIS:ClearCI,
    and 5.3.16.5 ERR:FatalTaskfile.
    
    In the case of non-NCQ commands, not clearing PxCI is needed in order
    for host software to be able to see which command slot that failed.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Message-id: 20230609140844.202795-7-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit 1a16ce64fda11bdf50f0c4ab5d9fdde72c1383a2)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/ahci.c             |   7 ++-
 tests/qtest/libqos/ahci.c | 106 ++++++++++++++++++++++++++++++++++------------
 tests/qtest/libqos/ahci.h |   8 ++--
 3 files changed, 88 insertions(+), 33 deletions(-)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index a93a1878de..a7b487ff33 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1523,7 +1523,8 @@ static void ahci_clear_cmd_issue(AHCIDevice *ad, uint8_t slot)
 {
     IDEState *ide_state = &ad->port.ifs[0];
 
-    if (!(ide_state->status & (BUSY_STAT | DRQ_STAT))) {
+    if (!(ide_state->status & ERR_STAT) &&
+        !(ide_state->status & (BUSY_STAT | DRQ_STAT))) {
         ad->port_regs.cmd_issue &= ~(1 << slot);
     }
 }
@@ -1532,6 +1533,7 @@ static void ahci_clear_cmd_issue(AHCIDevice *ad, uint8_t slot)
 static void ahci_cmd_done(const IDEDMA *dma)
 {
     AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma);
+    IDEState *ide_state = &ad->port.ifs[0];
 
     trace_ahci_cmd_done(ad->hba, ad->port_no);
 
@@ -1548,7 +1550,8 @@ static void ahci_cmd_done(const IDEDMA *dma)
      */
     ahci_write_fis_d2h(ad, true);
 
-    if (ad->port_regs.cmd_issue && !ad->check_bh) {
+    if (!(ide_state->status & ERR_STAT) &&
+        ad->port_regs.cmd_issue && !ad->check_bh) {
         ad->check_bh = qemu_bh_new_guarded(ahci_check_cmd_bh, ad,
                                            &ad->mem_reentrancy_guard);
         qemu_bh_schedule(ad->check_bh);
diff --git a/tests/qtest/libqos/ahci.c b/tests/qtest/libqos/ahci.c
index f53f12aa99..a2c94c6e06 100644
--- a/tests/qtest/libqos/ahci.c
+++ b/tests/qtest/libqos/ahci.c
@@ -404,57 +404,110 @@ void ahci_port_clear(AHCIQState *ahci, uint8_t port)
 /**
  * Check a port for errors.
  */
-void ahci_port_check_error(AHCIQState *ahci, uint8_t port,
-                           uint32_t imask, uint8_t emask)
+void ahci_port_check_error(AHCIQState *ahci, AHCICommand *cmd)
 {
+    uint8_t port = cmd->port;
     uint32_t reg;
 
-    /* The upper 9 bits of the IS register all indicate errors. */
-    reg = ahci_px_rreg(ahci, port, AHCI_PX_IS);
-    reg &= ~imask;
-    reg >>= 23;
-    g_assert_cmphex(reg, ==, 0);
+    /* If expecting TF error, ensure that TFES is set. */
+    if (cmd->errors) {
+        reg = ahci_px_rreg(ahci, port, AHCI_PX_IS);
+        ASSERT_BIT_SET(reg, AHCI_PX_IS_TFES);
+    } else {
+        /* The upper 9 bits of the IS register all indicate errors. */
+        reg = ahci_px_rreg(ahci, port, AHCI_PX_IS);
+        reg &= ~cmd->interrupts;
+        reg >>= 23;
+        g_assert_cmphex(reg, ==, 0);
+    }
 
-    /* The Sata Error Register should be empty. */
+    /* The Sata Error Register should be empty, even when expecting TF error. */
     reg = ahci_px_rreg(ahci, port, AHCI_PX_SERR);
     g_assert_cmphex(reg, ==, 0);
 
+    /* If expecting TF error, and TFES was set, perform error recovery
+     * (see AHCI 1.3 section 6.2.2.1) such that we can send new commands. */
+    if (cmd->errors) {
+        /* This will clear PxCI. */
+        ahci_px_clr(ahci, port, AHCI_PX_CMD, AHCI_PX_CMD_ST);
+
+        /* The port has 500ms to disengage. */
+        usleep(500000);
+        reg = ahci_px_rreg(ahci, port, AHCI_PX_CMD);
+        ASSERT_BIT_CLEAR(reg, AHCI_PX_CMD_CR);
+
+        /* Clear PxIS. */
+        reg = ahci_px_rreg(ahci, port, AHCI_PX_IS);
+        ahci_px_wreg(ahci, port, AHCI_PX_IS, reg);
+
+        /* Check if we need to perform a COMRESET.
+         * Not implemented right now, as there is no reason why our QEMU model
+         * should need a COMRESET when expecting TF error. */
+        reg = ahci_px_rreg(ahci, port, AHCI_PX_TFD);
+        ASSERT_BIT_CLEAR(reg, AHCI_PX_TFD_STS_BSY | AHCI_PX_TFD_STS_DRQ);
+
+        /* Enable issuing new commands. */
+        ahci_px_set(ahci, port, AHCI_PX_CMD, AHCI_PX_CMD_ST);
+    }
+
     /* The TFD also has two error sections. */
     reg = ahci_px_rreg(ahci, port, AHCI_PX_TFD);
-    if (!emask) {
+    if (!cmd->errors) {
         ASSERT_BIT_CLEAR(reg, AHCI_PX_TFD_STS_ERR);
     } else {
         ASSERT_BIT_SET(reg, AHCI_PX_TFD_STS_ERR);
     }
-    ASSERT_BIT_CLEAR(reg, AHCI_PX_TFD_ERR & (~emask << 8));
-    ASSERT_BIT_SET(reg, AHCI_PX_TFD_ERR & (emask << 8));
+    ASSERT_BIT_CLEAR(reg, AHCI_PX_TFD_ERR & (~cmd->errors << 8));
+    ASSERT_BIT_SET(reg, AHCI_PX_TFD_ERR & (cmd->errors << 8));
 }
 
-void ahci_port_check_interrupts(AHCIQState *ahci, uint8_t port,
-                                uint32_t intr_mask)
+void ahci_port_check_interrupts(AHCIQState *ahci, AHCICommand *cmd)
 {
+    uint8_t port = cmd->port;
     uint32_t reg;
 
+    /* If we expect errors, error handling in ahci_port_check_error() will
+     * already have cleared PxIS, so in that case this function cannot verify
+     * and clear expected interrupts. */
+    if (cmd->errors) {
+        return;
+    }
+
     /* Check for expected interrupts */
     reg = ahci_px_rreg(ahci, port, AHCI_PX_IS);
-    ASSERT_BIT_SET(reg, intr_mask);
+    ASSERT_BIT_SET(reg, cmd->interrupts);
 
     /* Clear expected interrupts and assert all interrupts now cleared. */
-    ahci_px_wreg(ahci, port, AHCI_PX_IS, intr_mask);
+    ahci_px_wreg(ahci, port, AHCI_PX_IS, cmd->interrupts);
     g_assert_cmphex(ahci_px_rreg(ahci, port, AHCI_PX_IS), ==, 0);
 }
 
-void ahci_port_check_nonbusy(AHCIQState *ahci, uint8_t port, uint8_t slot)
+void ahci_port_check_nonbusy(AHCIQState *ahci, AHCICommand *cmd)
 {
+    uint8_t slot = cmd->slot;
+    uint8_t port = cmd->port;
     uint32_t reg;
 
-    /* Assert that the command slot is no longer busy (NCQ) */
+    /* For NCQ command with error PxSACT bit should still be set.
+     * For NCQ command without error, PxSACT bit should be cleared.
+     * For non-NCQ command, PxSACT bit should always be cleared. */
     reg = ahci_px_rreg(ahci, port, AHCI_PX_SACT);
-    ASSERT_BIT_CLEAR(reg, (1 << slot));
+    if (cmd->props->ncq && cmd->errors) {
+        ASSERT_BIT_SET(reg, (1 << slot));
+    } else {
+        ASSERT_BIT_CLEAR(reg, (1 << slot));
+    }
 
-    /* Non-NCQ */
+    /* For non-NCQ command with error, PxCI bit should still be set.
+     * For non-NCQ command without error, PxCI bit should be cleared.
+     * For NCQ command without error, PxCI bit should be cleared.
+     * For NCQ command with error, PxCI bit may or may not be cleared. */
     reg = ahci_px_rreg(ahci, port, AHCI_PX_CI);
-    ASSERT_BIT_CLEAR(reg, (1 << slot));
+    if (!cmd->props->ncq && cmd->errors) {
+        ASSERT_BIT_SET(reg, (1 << slot));
+    } else if (!cmd->errors) {
+        ASSERT_BIT_CLEAR(reg, (1 << slot));
+    }
 
     /* And assert that we are generally not busy. */
     reg = ahci_px_rreg(ahci, port, AHCI_PX_TFD);
@@ -1207,9 +1260,10 @@ void ahci_command_wait(AHCIQState *ahci, AHCICommand *cmd)
 
 #define RSET(REG, MASK) (BITSET(ahci_px_rreg(ahci, cmd->port, (REG)), (MASK)))
 
-    while (RSET(AHCI_PX_TFD, AHCI_PX_TFD_STS_BSY) ||
-           RSET(AHCI_PX_CI, 1 << cmd->slot) ||
-           (cmd->props->ncq && RSET(AHCI_PX_SACT, 1 << cmd->slot))) {
+    while (!RSET(AHCI_PX_TFD, AHCI_PX_TFD_STS_ERR) &&
+           (RSET(AHCI_PX_TFD, AHCI_PX_TFD_STS_BSY) ||
+            RSET(AHCI_PX_CI, 1 << cmd->slot) ||
+            (cmd->props->ncq && RSET(AHCI_PX_SACT, 1 << cmd->slot)))) {
         usleep(50);
     }
 
@@ -1226,9 +1280,9 @@ void ahci_command_verify(AHCIQState *ahci, AHCICommand *cmd)
     uint8_t slot = cmd->slot;
     uint8_t port = cmd->port;
 
-    ahci_port_check_error(ahci, port, cmd->interrupts, cmd->errors);
-    ahci_port_check_interrupts(ahci, port, cmd->interrupts);
-    ahci_port_check_nonbusy(ahci, port, slot);
+    ahci_port_check_nonbusy(ahci, cmd);
+    ahci_port_check_error(ahci, cmd);
+    ahci_port_check_interrupts(ahci, cmd);
     ahci_port_check_cmd_sanity(ahci, cmd);
     if (cmd->interrupts & AHCI_PX_IS_DHRS) {
         ahci_port_check_d2h_sanity(ahci, port, slot);
diff --git a/tests/qtest/libqos/ahci.h b/tests/qtest/libqos/ahci.h
index 88835b6228..48017864bf 100644
--- a/tests/qtest/libqos/ahci.h
+++ b/tests/qtest/libqos/ahci.h
@@ -590,11 +590,9 @@ void ahci_set_command_header(AHCIQState *ahci, uint8_t port,
 void ahci_destroy_command(AHCIQState *ahci, uint8_t port, uint8_t slot);
 
 /* AHCI sanity check routines */
-void ahci_port_check_error(AHCIQState *ahci, uint8_t port,
-                           uint32_t imask, uint8_t emask);
-void ahci_port_check_interrupts(AHCIQState *ahci, uint8_t port,
-                                uint32_t intr_mask);
-void ahci_port_check_nonbusy(AHCIQState *ahci, uint8_t port, uint8_t slot);
+void ahci_port_check_error(AHCIQState *ahci, AHCICommand *cmd);
+void ahci_port_check_interrupts(AHCIQState *ahci, AHCICommand *cmd);
+void ahci_port_check_nonbusy(AHCIQState *ahci, AHCICommand *cmd);
 void ahci_port_check_d2h_sanity(AHCIQState *ahci, uint8_t port, uint8_t slot);
 void ahci_port_check_pio_sanity(AHCIQState *ahci, AHCICommand *cmd);
 void ahci_port_check_cmd_sanity(AHCIQState *ahci, AHCICommand *cmd);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:15:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:15:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814243.1227701 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTin-0000Or-DO; Wed, 09 Oct 2024 10:15:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814243.1227701; Wed, 09 Oct 2024 10:15:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTin-0000Oj-AC; Wed, 09 Oct 2024 10:15:09 +0000
Received: by outflank-mailman (input) for mailman id 814243;
 Wed, 09 Oct 2024 10:15:07 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTil-0000OR-El
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:15:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTil-0006Zk-E9
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:15:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTil-0008GN-DN
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:15:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6maFLe16p73dQGbvjc8XODlVte0ea+lIWw7am4vG55c=; b=zKN5n42/UJBU3+OJ3XC3nxtJAF
	2npbxTYFyTllPzmpHR1/H3JmKouY1vL5qAOoSXZ7le4vXyxNd+42agMi04Pj87EBj2yH7EE3SpBZC
	Idx91uLTeKivrjaSkW0rRb0aw5WP93cODQaOOmiUFkw8EW3zgnqvYCGjvivB7gzVzIXk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/ide/ahci: fix ahci_write_fis_sdb()
Message-Id: <E1syTil-0008GN-DN@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:15:07 +0000

commit 9c7e2253eba2e057f11377beb64dd78d12a1e27d
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:43 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    hw/ide/ahci: fix ahci_write_fis_sdb()
    
    When there is an error, we need to raise a TFES error irq, see AHCI 1.3.1,
    5.3.13.1 SDB:Entry.
    
    If ERR_STAT is set, we jump to state ERR:FatalTaskfile, which will raise
    a TFES IRQ unconditionally, regardless if the I bit is set in the FIS or
    not.
    
    Thus, we should never raise a normal IRQ after having sent an error IRQ.
    
    It is valid to signal successfully completed commands as finished in the
    same SDB FIS that generates the error IRQ. The important thing is that
    commands that did not complete successfully (e.g. commands that were
    aborted, do not get the finished bit set).
    
    Before this commit, there was never a TFES IRQ raised on NCQ error.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20230609140844.202795-8-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit 7e85cb0db4c693b4e084a00e66fe73a22ed1688a)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/ahci.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index a7b487ff33..8ce3dd796e 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -806,8 +806,14 @@ static void ahci_write_fis_sdb(AHCIState *s, NCQTransferState *ncq_tfs)
     pr->scr_act &= ~ad->finished;
     ad->finished = 0;
 
-    /* Trigger IRQ if interrupt bit is set (which currently, it always is) */
-    if (sdb_fis->flags & 0x40) {
+    /*
+     * TFES IRQ is always raised if ERR_STAT is set, regardless of I bit.
+     * If ERR_STAT is not set, trigger SDBS IRQ if interrupt bit is set
+     * (which currently, it always is).
+     */
+    if (sdb_fis->status & ERR_STAT) {
+        ahci_trigger_irq(s, ad, AHCI_PORT_IRQ_BIT_TFES);
+    } else if (sdb_fis->flags & 0x40) {
         ahci_trigger_irq(s, ad, AHCI_PORT_IRQ_BIT_SDBS);
     }
 }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:15:21 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:15:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814245.1227711 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTix-0000Ua-P2; Wed, 09 Oct 2024 10:15:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814245.1227711; Wed, 09 Oct 2024 10:15:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTix-0000Ts-JU; Wed, 09 Oct 2024 10:15:19 +0000
Received: by outflank-mailman (input) for mailman id 814245;
 Wed, 09 Oct 2024 10:15:17 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTiv-0000S0-K6
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:15:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTiv-0006Zs-HG
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:15:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTiv-0008HA-GL
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:15:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4rwsYnP3xNlJ8ZfINMxlDhVoq6JKJmcjQymvyXP/QxI=; b=lSdDgxCyWIIpkUwyGwnoVrkV94
	JauwH569gpR1+tBLVOeGVR7ezhTKpIlgcCFMuNgBH5Ar0kLLPZf4noXHz5CnIk8ZodfCII+BDKELa
	CamZSpvTf6RP1PMcvZf6KuWlru2mv2hjrAAeXAjZMAr8dM97wFjP8meNxYxzzR/6H9K4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/ide/ahci: fix broken SError handling
Message-Id: <E1syTiv-0008HA-GL@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:15:17 +0000

commit 4f6c55371743ba9d6512fcf4a88a5b5b8936037e
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:44 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    hw/ide/ahci: fix broken SError handling
    
    When encountering an NCQ error, you should not write the NCQ tag to the
    SError register. This is completely wrong.
    
    The SError register has a clear definition, where each bit represents a
    different error, see PxSERR definition in AHCI 1.3.1.
    
    If we write a random value (like the NCQ tag) in SError, e.g. Linux will
    read SError, and will trigger arbitrary error handling depending on the
    NCQ tag that happened to be executing.
    
    In case of success, ncq_cb() will call ncq_finish().
    In case of error, ncq_cb() will call ncq_err() (which will clear
    ncq_tfs->used), and then call ncq_finish(), thus using ncq_tfs->used is
    sufficient to tell if finished should get set or not.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20230609140844.202795-9-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit 9f89423537653de07ca40c18b5ff5b70b104cc93)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/ahci.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 8ce3dd796e..29ddd4b6c4 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1012,7 +1012,6 @@ static void ncq_err(NCQTransferState *ncq_tfs)
 
     ide_state->error = ABRT_ERR;
     ide_state->status = READY_STAT | ERR_STAT;
-    ncq_tfs->drive->port_regs.scr_err |= (1 << ncq_tfs->tag);
     qemu_sglist_destroy(&ncq_tfs->sglist);
     ncq_tfs->used = 0;
 }
@@ -1022,7 +1021,7 @@ static void ncq_finish(NCQTransferState *ncq_tfs)
     /* If we didn't error out, set our finished bit. Errored commands
      * do not get a bit set for the SDB FIS ACT register, nor do they
      * clear the outstanding bit in scr_act (PxSACT). */
-    if (!(ncq_tfs->drive->port_regs.scr_err & (1 << ncq_tfs->tag))) {
+    if (ncq_tfs->used) {
         ncq_tfs->drive->finished |= (1 << ncq_tfs->tag);
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:15:29 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:15:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814246.1227719 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTj6-0000mS-To; Wed, 09 Oct 2024 10:15:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814246.1227719; Wed, 09 Oct 2024 10:15:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTj6-0000mH-R7; Wed, 09 Oct 2024 10:15:28 +0000
Received: by outflank-mailman (input) for mailman id 814246;
 Wed, 09 Oct 2024 10:15:27 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTj5-0000lj-Kp
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:15:27 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTj5-0006a2-KA
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:15:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTj5-0008Ht-JV
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:15:27 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=GpqbMZcgFNFol/T8A+5SACT43h5S6g/T1tNkPrqkBCY=; b=Nl1w+uyEL7wx7KYG2TmLLfIz38
	MpFZR5gM2p1jQ160d4StEe/dvUqG9+FdmQ/1kHJlXGBhqp5XJHAEld4Tm9xLV0xg7jzV9yVXK1m8z
	+rB/mrpII2lUB0u44YA6yRtJi1imMdK/OZ0p0nYT46N8stJYhQ46gula+E4mL3yiCKkA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/i2c/aspeed: Fix Tx count and Rx size error in buffer pool mode
Message-Id: <E1syTj5-0008Ht-JV@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:15:27 +0000

commit 4a398e64ba8e9c1eced75217d856668c0d17e62e
Author:     Hang Yu <francis_yuu@stu.pku.edu.cn>
AuthorDate: Sat Aug 12 14:52:28 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    hw/i2c/aspeed: Fix Tx count and Rx size error in buffer pool mode
    
    Fixed inconsistency between the regisiter bit field definition header file
    and the ast2600 datasheet. The reg name is I2CD1C:Pool Buffer Control
    Register in old register mode and  I2CC0C: Master/Slave Pool Buffer Control
    Register in new register mode. They share bit field
    [12:8]:Transmit Data Byte Count and bit field
    [29:24]:Actual Received Pool Buffer Size according to the datasheet.
    According to the ast2600 datasheet,the actual Tx count is
    Transmit Data Byte Count plus 1, and the max Rx size is
    Receive Pool Buffer Size plus 1, both in Pool Buffer Control Register.
    The version before forgot to plus 1, and mistake Rx count for Rx size.
    
    Signed-off-by: Hang Yu <francis_yuu@stu.pku.edu.cn>
    Fixes: 3be3d6ccf2ad ("aspeed: i2c: Migrate to registerfields API")
    Reviewed-by: Cédric Le Goater <clg@kaod.org>
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    (cherry picked from commit 97b8aa5ae9ff197394395eda5062ea3681e09c28)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/i2c/aspeed_i2c.c         | 8 ++++----
 include/hw/i2c/aspeed_i2c.h | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/i2c/aspeed_i2c.c b/hw/i2c/aspeed_i2c.c
index 1f071a3811..e485d8bfb8 100644
--- a/hw/i2c/aspeed_i2c.c
+++ b/hw/i2c/aspeed_i2c.c
@@ -236,7 +236,7 @@ static int aspeed_i2c_bus_send(AspeedI2CBus *bus, uint8_t pool_start)
     uint32_t reg_byte_buf = aspeed_i2c_bus_byte_buf_offset(bus);
     uint32_t reg_dma_len = aspeed_i2c_bus_dma_len_offset(bus);
     int pool_tx_count = SHARED_ARRAY_FIELD_EX32(bus->regs, reg_pool_ctrl,
-                                                TX_COUNT);
+                                                TX_COUNT) + 1;
 
     if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_BUFF_EN)) {
         for (i = pool_start; i < pool_tx_count; i++) {
@@ -293,7 +293,7 @@ static void aspeed_i2c_bus_recv(AspeedI2CBus *bus)
     uint32_t reg_dma_len = aspeed_i2c_bus_dma_len_offset(bus);
     uint32_t reg_dma_addr = aspeed_i2c_bus_dma_addr_offset(bus);
     int pool_rx_count = SHARED_ARRAY_FIELD_EX32(bus->regs, reg_pool_ctrl,
-                                                RX_COUNT);
+                                                RX_SIZE) + 1;
 
     if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, RX_BUFF_EN)) {
         uint8_t *pool_base = aic->bus_pool_base(bus);
@@ -418,7 +418,7 @@ static void aspeed_i2c_bus_cmd_dump(AspeedI2CBus *bus)
     uint32_t reg_intr_sts = aspeed_i2c_bus_intr_sts_offset(bus);
     uint32_t reg_dma_len = aspeed_i2c_bus_dma_len_offset(bus);
     if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, RX_BUFF_EN)) {
-        count = SHARED_ARRAY_FIELD_EX32(bus->regs, reg_pool_ctrl, TX_COUNT);
+        count = SHARED_ARRAY_FIELD_EX32(bus->regs, reg_pool_ctrl, TX_COUNT) + 1;
     } else if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, RX_DMA_EN)) {
         count = bus->regs[reg_dma_len];
     } else { /* BYTE mode */
@@ -490,7 +490,7 @@ static void aspeed_i2c_bus_handle_cmd(AspeedI2CBus *bus, uint64_t value)
          */
         if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_BUFF_EN)) {
             if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_pool_ctrl, TX_COUNT)
-                == 1) {
+                == 0) {
                 SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, M_TX_CMD, 0);
             } else {
                 /*
diff --git a/include/hw/i2c/aspeed_i2c.h b/include/hw/i2c/aspeed_i2c.h
index adc904d6c1..91d0e7157c 100644
--- a/include/hw/i2c/aspeed_i2c.h
+++ b/include/hw/i2c/aspeed_i2c.h
@@ -132,9 +132,9 @@ REG32(I2CD_CMD, 0x14) /* I2CD Command/Status */
 REG32(I2CD_DEV_ADDR, 0x18) /* Slave Device Address */
     SHARED_FIELD(SLAVE_DEV_ADDR1, 0, 7)
 REG32(I2CD_POOL_CTRL, 0x1C) /* Pool Buffer Control */
-    SHARED_FIELD(RX_COUNT, 24, 5)
+    SHARED_FIELD(RX_COUNT, 24, 6)
     SHARED_FIELD(RX_SIZE, 16, 5)
-    SHARED_FIELD(TX_COUNT, 9, 5)
+    SHARED_FIELD(TX_COUNT, 8, 5)
     FIELD(I2CD_POOL_CTRL, OFFSET, 2, 6) /* AST2400 */
 REG32(I2CD_BYTE_BUF, 0x20) /* Transmit/Receive Byte Buffer */
     SHARED_FIELD(RX_BUF, 8, 8)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:15:39 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:15:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814247.1227723 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTjG-0000uj-Vq; Wed, 09 Oct 2024 10:15:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814247.1227723; Wed, 09 Oct 2024 10:15:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTjG-0000ub-Sf; Wed, 09 Oct 2024 10:15:38 +0000
Received: by outflank-mailman (input) for mailman id 814247;
 Wed, 09 Oct 2024 10:15:37 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTjF-0000sv-Nf
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:15:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTjF-0006aS-N1
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:15:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTjF-0008Ip-MP
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:15:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=+0mv0EfJMwsTphe/IVJU9FxL3w3ECLMLcUNs83L1Fdo=; b=J7hIN/T88GMLzLdC3tT95oUGiW
	apxN3ySyn2ystqg7bVVa+zb6qHSBQuQ4oc57mCAjhuB+5XUsOx4m+vTVnXu7RZboCAijZA3Qnw3Xe
	I3GRTzrNZ0L+PBAi9JF/1yztlaC2J4MmpOpYor7Je4GRRI/ebZZNoDEWlEf+elbg25QE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/i2c/aspeed: Fix TXBUF transmission start position error
Message-Id: <E1syTjF-0008Ip-MP@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:15:37 +0000

commit c2ec46c694a176a2ced6d8b62f0ec40569f4a83d
Author:     Hang Yu <francis_yuu@stu.pku.edu.cn>
AuthorDate: Sat Aug 12 14:52:29 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    hw/i2c/aspeed: Fix TXBUF transmission start position error
    
    According to the ast2600 datasheet and the linux aspeed i2c driver,
    the TXBUF transmission start position should be TXBUF[0] instead
    of TXBUF[1],so the arg pool_start is useless,and the address is not
    included in TXBUF.So even if Tx Count equals zero,there is at least
    1 byte data needs to be transmitted,and M_TX_CMD should not be cleared
    at this condition.The driver url is:
    https://github.com/AspeedTech-BMC/linux/blob/aspeed-master-v5.15/drivers/i2c/busses/i2c-ast2600.c
    
    Signed-off-by: Hang Yu <francis_yuu@stu.pku.edu.cn>
    Fixes: 6054fc73e8f4 ("aspeed/i2c: Add support for pool buffer transfers")
    Reviewed-by: Cédric Le Goater <clg@kaod.org>
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    (cherry picked from commit 961faf3ddbd8ffcdf776bbcf88af0bc97218114a)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/i2c/aspeed_i2c.c | 30 ++++++------------------------
 1 file changed, 6 insertions(+), 24 deletions(-)

diff --git a/hw/i2c/aspeed_i2c.c b/hw/i2c/aspeed_i2c.c
index e485d8bfb8..44905d7899 100644
--- a/hw/i2c/aspeed_i2c.c
+++ b/hw/i2c/aspeed_i2c.c
@@ -226,7 +226,7 @@ static int aspeed_i2c_dma_read(AspeedI2CBus *bus, uint8_t *data)
     return 0;
 }
 
-static int aspeed_i2c_bus_send(AspeedI2CBus *bus, uint8_t pool_start)
+static int aspeed_i2c_bus_send(AspeedI2CBus *bus)
 {
     AspeedI2CClass *aic = ASPEED_I2C_GET_CLASS(bus->controller);
     int ret = -1;
@@ -239,7 +239,7 @@ static int aspeed_i2c_bus_send(AspeedI2CBus *bus, uint8_t pool_start)
                                                 TX_COUNT) + 1;
 
     if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_BUFF_EN)) {
-        for (i = pool_start; i < pool_tx_count; i++) {
+        for (i = 0; i < pool_tx_count; i++) {
             uint8_t *pool_base = aic->bus_pool_base(bus);
 
             trace_aspeed_i2c_bus_send("BUF", i + 1, pool_tx_count,
@@ -273,7 +273,7 @@ static int aspeed_i2c_bus_send(AspeedI2CBus *bus, uint8_t pool_start)
         }
         SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, TX_DMA_EN, 0);
     } else {
-        trace_aspeed_i2c_bus_send("BYTE", pool_start, 1,
+        trace_aspeed_i2c_bus_send("BYTE", 0, 1,
                                   bus->regs[reg_byte_buf]);
         ret = i2c_send(bus->bus, bus->regs[reg_byte_buf]);
     }
@@ -446,10 +446,8 @@ static void aspeed_i2c_bus_cmd_dump(AspeedI2CBus *bus)
  */
 static void aspeed_i2c_bus_handle_cmd(AspeedI2CBus *bus, uint64_t value)
 {
-    uint8_t pool_start = 0;
     uint32_t reg_intr_sts = aspeed_i2c_bus_intr_sts_offset(bus);
     uint32_t reg_cmd = aspeed_i2c_bus_cmd_offset(bus);
-    uint32_t reg_pool_ctrl = aspeed_i2c_bus_pool_ctrl_offset(bus);
     uint32_t reg_dma_len = aspeed_i2c_bus_dma_len_offset(bus);
 
     if (!aspeed_i2c_check_sram(bus)) {
@@ -483,27 +481,11 @@ static void aspeed_i2c_bus_handle_cmd(AspeedI2CBus *bus, uint64_t value)
 
         SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, M_START_CMD, 0);
 
-        /*
-         * The START command is also a TX command, as the slave
-         * address is sent on the bus. Drop the TX flag if nothing
-         * else needs to be sent in this sequence.
-         */
-        if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_BUFF_EN)) {
-            if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_pool_ctrl, TX_COUNT)
-                == 0) {
-                SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, M_TX_CMD, 0);
-            } else {
-                /*
-                 * Increase the start index in the TX pool buffer to
-                 * skip the address byte.
-                 */
-                pool_start++;
-            }
-        } else if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_DMA_EN)) {
+        if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_DMA_EN)) {
             if (bus->regs[reg_dma_len] == 0) {
                 SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, M_TX_CMD, 0);
             }
-        } else {
+        } else if (!SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_BUFF_EN)) {
             SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, M_TX_CMD, 0);
         }
 
@@ -520,7 +502,7 @@ static void aspeed_i2c_bus_handle_cmd(AspeedI2CBus *bus, uint64_t value)
 
     if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, M_TX_CMD)) {
         aspeed_i2c_set_state(bus, I2CD_MTXD);
-        if (aspeed_i2c_bus_send(bus, pool_start)) {
+        if (aspeed_i2c_bus_send(bus)) {
             SHARED_ARRAY_FIELD_DP32(bus->regs, reg_intr_sts, TX_NAK, 1);
             i2c_end_transfer(bus->bus);
         } else {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:15:49 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:15:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814253.1227726 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTjR-00014K-07; Wed, 09 Oct 2024 10:15:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814253.1227726; Wed, 09 Oct 2024 10:15:48 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTjQ-00014D-U0; Wed, 09 Oct 2024 10:15:48 +0000
Received: by outflank-mailman (input) for mailman id 814253;
 Wed, 09 Oct 2024 10:15:47 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTjP-00013x-Qw
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:15:47 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTjP-0006aZ-QL
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:15:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTjP-0008Jl-PX
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:15:47 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ck/C/ozBHBfpyDMT8pe7OqgA+6RnqCNfX+AP9BNxEeU=; b=z44wYaF9qIteMgpNz1I5xjlJYw
	CPcrdHiWWx0Gs1cYh+D+yQTA44u50FGjDUcVGgkjakuWJVAM5sCdkLCkYeArA7jRk0Xi2AFQCfnc3
	DLzT4kKkgyjPi6/N26Az9tWPduJE+OzpESHsdQnIAN1SwH1Kg88R3WB65Ycgm7VFuei8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] qemu-options.hx: Rephrase the descriptions of the -hd* and -cdrom options
Message-Id: <E1syTjP-0008Jl-PX@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:15:47 +0000

commit 45b61f730d953b713dc2bb8b695d6555a5b8adb6
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Tue Aug 29 15:29:48 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    qemu-options.hx: Rephrase the descriptions of the -hd* and -cdrom options
    
    The current description says that these options will create a device
    on the IDE bus, which is only true on x86. So rephrase these sentences
    a little bit to speak of "default bus" instead.
    
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (cherry picked from commit bcd8e243083c878884e52d609deddbe6be17c730)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 qemu-options.hx | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/qemu-options.hx b/qemu-options.hx
index fdddfab6ff..af8156d2f8 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1174,10 +1174,10 @@ SRST
 ERST
 
 DEF("hda", HAS_ARG, QEMU_OPTION_hda,
-    "-hda/-hdb file  use 'file' as IDE hard disk 0/1 image\n", QEMU_ARCH_ALL)
+    "-hda/-hdb file  use 'file' as hard disk 0/1 image\n", QEMU_ARCH_ALL)
 DEF("hdb", HAS_ARG, QEMU_OPTION_hdb, "", QEMU_ARCH_ALL)
 DEF("hdc", HAS_ARG, QEMU_OPTION_hdc,
-    "-hdc/-hdd file  use 'file' as IDE hard disk 2/3 image\n", QEMU_ARCH_ALL)
+    "-hdc/-hdd file  use 'file' as hard disk 2/3 image\n", QEMU_ARCH_ALL)
 DEF("hdd", HAS_ARG, QEMU_OPTION_hdd, "", QEMU_ARCH_ALL)
 SRST
 ``-hda file``
@@ -1187,18 +1187,22 @@ SRST
 ``-hdc file``
   \ 
 ``-hdd file``
-    Use file as hard disk 0, 1, 2 or 3 image (see the :ref:`disk images`
-    chapter in the System Emulation Users Guide).
+    Use file as hard disk 0, 1, 2 or 3 image on the default bus of the
+    emulated machine (this is for example the IDE bus on most x86 machines,
+    but it can also be SCSI, virtio or something else on other target
+    architectures). See also the :ref:`disk images` chapter in the System
+    Emulation Users Guide.
 ERST
 
 DEF("cdrom", HAS_ARG, QEMU_OPTION_cdrom,
-    "-cdrom file     use 'file' as IDE cdrom image (cdrom is ide1 master)\n",
+    "-cdrom file     use 'file' as CD-ROM image\n",
     QEMU_ARCH_ALL)
 SRST
 ``-cdrom file``
-    Use file as CD-ROM image (you cannot use ``-hdc`` and ``-cdrom`` at
-    the same time). You can use the host CD-ROM by using ``/dev/cdrom``
-    as filename.
+    Use file as CD-ROM image on the default bus of the emulated machine
+    (which is IDE1 master on x86, so you cannot use ``-hdc`` and ``-cdrom``
+    at the same time there). On systems that support it, you can use the
+    host CD-ROM by using ``/dev/cdrom`` as filename.
 ERST
 
 DEF("blockdev", HAS_ARG, QEMU_OPTION_blockdev,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:15:59 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:15:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814256.1227730 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTjb-00018V-1r; Wed, 09 Oct 2024 10:15:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814256.1227730; Wed, 09 Oct 2024 10:15:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTja-00018M-VR; Wed, 09 Oct 2024 10:15:58 +0000
Received: by outflank-mailman (input) for mailman id 814256;
 Wed, 09 Oct 2024 10:15:57 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTjZ-000184-U1
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:15:57 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTjZ-0006ah-TO
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:15:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTjZ-0008L0-SZ
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:15:57 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FV4EthXWFkCbpEU1dy51j8SFsWDzlCz1gAcn9wvaTds=; b=cML0fCONI/uEuXgWelaijkB/VC
	lr1LLtZOOr3PRayiXT8VopWx0YXZ951cPYqBVQnN9zHrRhDyM80r2BwXiIDxCOdbpoL6suMarLP/E
	tcvaDo5fgLwBDXDQ+MvGYybqsWb4ISPKStb/Ej1THEtT+GVrKLosdLzYqTUhknCmXozs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] docs tests: Fix use of migrate_set_parameter
Message-Id: <E1syTjZ-0008L0-SZ@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:15:57 +0000

commit 42edb4723afe4a94a7c8011fa7fe02c3846cdc7e
Author:     Markus Armbruster <armbru@redhat.com>
AuthorDate: Fri Aug 25 17:59:22 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    docs tests: Fix use of migrate_set_parameter
    
    docs/multi-thread-compression.txt uses parameter names with
    underscores instead of dashes.  Wrong since day one.
    
    docs/rdma.txt, tests/qemu-iotests/181, and tests/qtest/test-hmp.c are
    wrong the same way since commit cbde7be900d2 (v6.0.0).  Hard to see,
    as test-hmp doesn't check whether the commands work, and iotest 181
    appears to be unaffected.
    
    Fixes: 263170e679df (docs: Add a doc about multiple thread compression)
    Fixes: cbde7be900d2 (migrate: remove QMP/HMP commands for speed, downtime and cache size)
    Signed-off-by: Markus Armbruster <armbru@redhat.com>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (cherry picked from commit b21a6e31a182a5ae7436a444f840d49aac07c94f)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 docs/multi-thread-compression.txt | 12 ++++++------
 docs/rdma.txt                     |  2 +-
 tests/qemu-iotests/181            |  2 +-
 tests/qtest/test-hmp.c            |  6 +++---
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/docs/multi-thread-compression.txt b/docs/multi-thread-compression.txt
index bb88c6bdf1..95b1556f67 100644
--- a/docs/multi-thread-compression.txt
+++ b/docs/multi-thread-compression.txt
@@ -117,13 +117,13 @@ to support the multiple thread compression migration:
     {qemu} migrate_set_capability compress on
 
 3. Set the compression thread count on source:
-    {qemu} migrate_set_parameter compress_threads 12
+    {qemu} migrate_set_parameter compress-threads 12
 
 4. Set the compression level on the source:
-    {qemu} migrate_set_parameter compress_level 1
+    {qemu} migrate_set_parameter compress-level 1
 
 5. Set the decompression thread count on destination:
-    {qemu} migrate_set_parameter decompress_threads 3
+    {qemu} migrate_set_parameter decompress-threads 3
 
 6. Start outgoing migration:
     {qemu} migrate -d tcp:destination.host:4444
@@ -133,9 +133,9 @@ to support the multiple thread compression migration:
 
 The following are the default settings:
     compress: off
-    compress_threads: 8
-    decompress_threads: 2
-    compress_level: 1 (which means best speed)
+    compress-threads: 8
+    decompress-threads: 2
+    compress-level: 1 (which means best speed)
 
 So, only the first two steps are required to use the multiple
 thread compression in migration. You can do more if the default
diff --git a/docs/rdma.txt b/docs/rdma.txt
index 2b4cdea1d8..bd8dd799a9 100644
--- a/docs/rdma.txt
+++ b/docs/rdma.txt
@@ -89,7 +89,7 @@ RUNNING:
 First, set the migration speed to match your hardware's capabilities:
 
 QEMU Monitor Command:
-$ migrate_set_parameter max_bandwidth 40g # or whatever is the MAX of your RDMA device
+$ migrate_set_parameter max-bandwidth 40g # or whatever is the MAX of your RDMA device
 
 Next, on the destination machine, add the following to the QEMU command line:
 
diff --git a/tests/qemu-iotests/181 b/tests/qemu-iotests/181
index cb96d09ae5..dc90a10757 100755
--- a/tests/qemu-iotests/181
+++ b/tests/qemu-iotests/181
@@ -109,7 +109,7 @@ if [ ${QEMU_STATUS[$dest]} -lt 0 ]; then
     _notrun 'Postcopy is not supported'
 fi
 
-_send_qemu_cmd $src 'migrate_set_parameter max_bandwidth 4k' "(qemu)"
+_send_qemu_cmd $src 'migrate_set_parameter max-bandwidth 4k' "(qemu)"
 _send_qemu_cmd $src 'migrate_set_capability postcopy-ram on' "(qemu)"
 _send_qemu_cmd $src "migrate -d unix:${MIG_SOCKET}" "(qemu)"
 _send_qemu_cmd $src 'migrate_start_postcopy' "(qemu)"
diff --git a/tests/qtest/test-hmp.c b/tests/qtest/test-hmp.c
index b4a920df89..e75523f882 100644
--- a/tests/qtest/test-hmp.c
+++ b/tests/qtest/test-hmp.c
@@ -45,9 +45,9 @@ static const char *hmp_cmds[] = {
     "log all",
     "log none",
     "memsave 0 4096 \"/dev/null\"",
-    "migrate_set_parameter xbzrle_cache_size 1",
-    "migrate_set_parameter downtime_limit 1",
-    "migrate_set_parameter max_bandwidth 1",
+    "migrate_set_parameter xbzrle-cache-size 1",
+    "migrate_set_parameter downtime-limit 1",
+    "migrate_set_parameter max-bandwidth 1",
     "netdev_add user,id=net1",
     "set_link net1 off",
     "set_link net1 on",
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:16:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:16:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814258.1227734 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTjl-0001Cp-36; Wed, 09 Oct 2024 10:16:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814258.1227734; Wed, 09 Oct 2024 10:16:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTjl-0001Ch-0a; Wed, 09 Oct 2024 10:16:09 +0000
Received: by outflank-mailman (input) for mailman id 814258;
 Wed, 09 Oct 2024 10:16:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTjk-0001CZ-0y
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:16:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTjk-0006b5-02
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:16:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTjj-0008N1-Vf
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:16:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MNpJ2sujRrM8jsORYMEOKn7O3gX+koB+sYk9kTIGRqQ=; b=SYJsWykWvUmuHQgNFzAGM4gFTi
	OLxOsUe2vJ1uI55b9l1pWLhDGgeTyZ2yGxGcd6sSt3IpRltlHgG0CckgZVxsv53eolybuHOu8Lf7Q
	t0yXU3ldH+K/s2xcjjkj0nm8aM1w42Sl4v0yVpnQ3gCuKHGVbISawafBvjjypcAE4FmA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/net/vmxnet3: Fix guest-triggerable assert()
Message-Id: <E1syTjj-0008N1-Vf@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:16:07 +0000

commit c68b844d3376764240afdb3c55d451e4dac11004
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Thu Aug 17 14:56:00 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    hw/net/vmxnet3: Fix guest-triggerable assert()
    
    The assert() that checks for valid MTU sizes can be triggered by
    the guest (e.g. with the reproducer code from the bug ticket
    https://gitlab.com/qemu-project/qemu/-/issues/517 ). Let's avoid
    this problem by simply logging the error and refusing to activate
    the device instead.
    
    Fixes: d05dcd94ae ("net: vmxnet3: validate configuration values during activate")
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    Cc: qemu-stable@nongnu.org
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    [Mjt: change format specifier from %d to %u for uint32_t argument]
    (cherry picked from commit 90a0778421acdf4ca903be64c8ed19378183c944)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/net/vmxnet3.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
index cb52db96a2..fd3b9aff5b 100644
--- a/hw/net/vmxnet3.c
+++ b/hw/net/vmxnet3.c
@@ -1439,7 +1439,10 @@ static void vmxnet3_activate_device(VMXNET3State *s)
     vmxnet3_setup_rx_filtering(s);
     /* Cache fields from shared memory */
     s->mtu = VMXNET3_READ_DRV_SHARED32(d, s->drv_shmem, devRead.misc.mtu);
-    assert(VMXNET3_MIN_MTU <= s->mtu && s->mtu <= VMXNET3_MAX_MTU);
+    if (s->mtu < VMXNET3_MIN_MTU || s->mtu > VMXNET3_MAX_MTU) {
+        qemu_log_mask(LOG_GUEST_ERROR, "vmxnet3: Bad MTU size: %u\n", s->mtu);
+        return;
+    }
     VMW_CFPRN("MTU is %u", s->mtu);
 
     s->max_rx_frags =
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:16:19 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:16:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814259.1227740 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTjv-0001GW-6N; Wed, 09 Oct 2024 10:16:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814259.1227740; Wed, 09 Oct 2024 10:16:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTjv-0001GO-3K; Wed, 09 Oct 2024 10:16:19 +0000
Received: by outflank-mailman (input) for mailman id 814259;
 Wed, 09 Oct 2024 10:16:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTju-0001G9-3m
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:16:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTju-0006bC-38
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:16:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTju-0008Nt-2K
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:16:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BUX6bnCvCrOzFShs0wzQx7sF7vOYm7cKlFjfMZLJV+4=; b=gQIWW9qU/3XsxCgFdTBIhLbzEM
	qate3AMe05HoFmzqHXReLyJ/ruayNz2emssdjGTbmRnPeOC4wvQ/62+eSBmV8EGjhBREOZUgkqWEa
	d+aNyKRxiJLJqrFhRj5e9whzJbK69NzASZVkEb+oNrrjg6EXienGW4VI2Qvu4YGXTjgA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] qxl: don't assert() if device isn't yet initialized
Message-Id: <E1syTju-0008Nt-2K@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:16:18 +0000

commit 5929f5309194e46f40b20aa07797f531663e323f
Author:     Marc-André Lureau <marcandre.lureau@redhat.com>
AuthorDate: Mon Aug 14 23:33:30 2023 +0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    qxl: don't assert() if device isn't yet initialized
    
    If the PCI BAR isn't yet mapped or was unmapped, QXL_IO_SET_MODE will
    assert(). Instead, report a guest bug and keep going.
    
    This can be reproduced with:
    
    cat << EOF | ./qemu-system-x86_64 -vga qxl -m 2048 -nodefaults -qtest stdio
    outl 0xcf8 0x8000101c
    outl 0xcfc 0xc000
    outl 0xcf8 0x80001001
    outl 0xcfc 0x01000000
    outl 0xc006 0x00
    EOF
    
    Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1829
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (cherry picked from commit 95bef686e490bc3afc3f51f5fc6e20bf260b938c)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/display/qxl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index f1c0eb7dfc..70b73820b2 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -1591,7 +1591,10 @@ static void qxl_set_mode(PCIQXLDevice *d, unsigned int modenr, int loadvm)
     }
 
     d->guest_slots[0].slot = slot;
-    assert(qxl_add_memslot(d, 0, devmem, QXL_SYNC) == 0);
+    if (qxl_add_memslot(d, 0, devmem, QXL_SYNC) != 0) {
+        qxl_set_guest_bug(d, "device isn't initialized yet");
+        return;
+    }
 
     d->guest_primary.surface = surface;
     qxl_create_guest_primary(d, 0, QXL_SYNC);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:16:29 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:16:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814260.1227742 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTk5-0001Kl-7T; Wed, 09 Oct 2024 10:16:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814260.1227742; Wed, 09 Oct 2024 10:16:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTk5-0001Kd-4m; Wed, 09 Oct 2024 10:16:29 +0000
Received: by outflank-mailman (input) for mailman id 814260;
 Wed, 09 Oct 2024 10:16:28 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTk4-0001KV-6n
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:16:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTk4-0006bJ-6E
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:16:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTk4-0008Om-5S
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:16:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Cj8HSE24d7D6R/9xhs3ffaRfd+VSVV99PbnZCJtZjb4=; b=lGQz/8wSsKVaKDqvNjwVo/4xzm
	X27IpvYAu/5yLV+7SRJOwsNwRhBaeisAF0Qzgx+g84AneumOkA9qoyP4oplN/DVyZflPsz6Aibs6+
	E9vQ1fdEMeOGS86LZKxj55mHu/z8pPxL/dOb4sYkrDqs8KrbRu5SW1FKd8vycuTNrJtM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] virtio: Drop out of coroutine context in virtio_load()
Message-Id: <E1syTk4-0008Om-5S@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:16:28 +0000

commit 41af7a9bc41c15460a4dbf4d35879d69c460d02a
Author:     Kevin Wolf <kwolf@redhat.com>
AuthorDate: Tue Sep 5 16:50:02 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Mon Sep 11 22:31:56 2023 +0300

    virtio: Drop out of coroutine context in virtio_load()
    
    virtio_load() as a whole should run in coroutine context because it
    reads from the migration stream and we don't want this to block.
    
    However, it calls virtio_set_features_nocheck() and devices don't
    expect their .set_features callback to run in a coroutine and therefore
    call functions that may not be called in coroutine context. To fix this,
    drop out of coroutine context for calling virtio_set_features_nocheck().
    
    Without this fix, the following crash was reported:
    
      #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
      #1  0x00007efc738c05d3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
      #2  0x00007efc73873d26 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
      #3  0x00007efc738477f3 in __GI_abort () at abort.c:79
      #4  0x00007efc7384771b in __assert_fail_base (fmt=0x7efc739dbcb8 "", assertion=assertion@entry=0x560aebfbf5cf "!qemu_in_coroutine()",
         file=file@entry=0x560aebfcd2d4 "../block/graph-lock.c", line=line@entry=275, function=function@entry=0x560aebfcd34d "void bdrv_graph_rdlock_main_loop(void)") at assert.c:92
      #5  0x00007efc7386ccc6 in __assert_fail (assertion=0x560aebfbf5cf "!qemu_in_coroutine()", file=0x560aebfcd2d4 "../block/graph-lock.c", line=275,
         function=0x560aebfcd34d "void bdrv_graph_rdlock_main_loop(void)") at assert.c:101
      #6  0x0000560aebcd8dd6 in bdrv_register_buf ()
      #7  0x0000560aeb97ed97 in ram_block_added.llvm ()
      #8  0x0000560aebb8303f in ram_block_add.llvm ()
      #9  0x0000560aebb834fa in qemu_ram_alloc_internal.llvm ()
      #10 0x0000560aebb2ac98 in vfio_region_mmap ()
      #11 0x0000560aebb3ea0f in vfio_bars_register ()
      #12 0x0000560aebb3c628 in vfio_realize ()
      #13 0x0000560aeb90f0c2 in pci_qdev_realize ()
      #14 0x0000560aebc40305 in device_set_realized ()
      #15 0x0000560aebc48e07 in property_set_bool.llvm ()
      #16 0x0000560aebc46582 in object_property_set ()
      #17 0x0000560aebc4cd58 in object_property_set_qobject ()
      #18 0x0000560aebc46ba7 in object_property_set_bool ()
      #19 0x0000560aeb98b3ca in qdev_device_add_from_qdict ()
      #20 0x0000560aebb1fbaf in virtio_net_set_features ()
      #21 0x0000560aebb46b51 in virtio_set_features_nocheck ()
      #22 0x0000560aebb47107 in virtio_load ()
      #23 0x0000560aeb9ae7ce in vmstate_load_state ()
      #24 0x0000560aeb9d2ee9 in qemu_loadvm_state_main ()
      #25 0x0000560aeb9d45e1 in qemu_loadvm_state ()
      #26 0x0000560aeb9bc32c in process_incoming_migration_co.llvm ()
      #27 0x0000560aebeace56 in coroutine_trampoline.llvm ()
    
    Cc: qemu-stable@nongnu.org
    Buglink: https://issues.redhat.com/browse/RHEL-832
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>
    Message-ID: <20230905145002.46391-3-kwolf@redhat.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>
    (cherry picked from commit 92e2e6a867334a990f8d29f07ca34e3162fdd6ec)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/virtio/virtio.c | 45 ++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 40 insertions(+), 5 deletions(-)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 98c4819fcc..0010a9a5f1 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2825,8 +2825,9 @@ static int virtio_device_put(QEMUFile *f, void *opaque, size_t size,
 }
 
 /* A wrapper for use as a VMState .get function */
-static int virtio_device_get(QEMUFile *f, void *opaque, size_t size,
-                             const VMStateField *field)
+static int coroutine_mixed_fn
+virtio_device_get(QEMUFile *f, void *opaque, size_t size,
+                  const VMStateField *field)
 {
     VirtIODevice *vdev = VIRTIO_DEVICE(opaque);
     DeviceClass *dc = DEVICE_CLASS(VIRTIO_DEVICE_GET_CLASS(vdev));
@@ -2853,6 +2854,39 @@ static int virtio_set_features_nocheck(VirtIODevice *vdev, uint64_t val)
     return bad ? -1 : 0;
 }
 
+typedef struct VirtioSetFeaturesNocheckData {
+    Coroutine *co;
+    VirtIODevice *vdev;
+    uint64_t val;
+    int ret;
+} VirtioSetFeaturesNocheckData;
+
+static void virtio_set_features_nocheck_bh(void *opaque)
+{
+    VirtioSetFeaturesNocheckData *data = opaque;
+
+    data->ret = virtio_set_features_nocheck(data->vdev, data->val);
+    aio_co_wake(data->co);
+}
+
+static int coroutine_mixed_fn
+virtio_set_features_nocheck_maybe_co(VirtIODevice *vdev, uint64_t val)
+{
+    if (qemu_in_coroutine()) {
+        VirtioSetFeaturesNocheckData data = {
+            .co = qemu_coroutine_self(),
+            .vdev = vdev,
+            .val = val,
+        };
+        aio_bh_schedule_oneshot(qemu_get_current_aio_context(),
+                                virtio_set_features_nocheck_bh, &data);
+        qemu_coroutine_yield();
+        return data.ret;
+    } else {
+        return virtio_set_features_nocheck(vdev, val);
+    }
+}
+
 int virtio_set_features(VirtIODevice *vdev, uint64_t val)
 {
     int ret;
@@ -2906,7 +2940,8 @@ size_t virtio_get_config_size(const VirtIOConfigSizeParams *params,
     return config_size;
 }
 
-int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
+int coroutine_mixed_fn
+virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
 {
     int i, ret;
     int32_t config_len;
@@ -3023,14 +3058,14 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
          * host_features.
          */
         uint64_t features64 = vdev->guest_features;
-        if (virtio_set_features_nocheck(vdev, features64) < 0) {
+        if (virtio_set_features_nocheck_maybe_co(vdev, features64) < 0) {
             error_report("Features 0x%" PRIx64 " unsupported. "
                          "Allowed features: 0x%" PRIx64,
                          features64, vdev->host_features);
             return -1;
         }
     } else {
-        if (virtio_set_features_nocheck(vdev, features) < 0) {
+        if (virtio_set_features_nocheck_maybe_co(vdev, features) < 0) {
             error_report("Features 0x%x unsupported. "
                          "Allowed features: 0x%" PRIx64,
                          features, vdev->host_features);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:16:39 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:16:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814264.1227756 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTkF-0001hU-GN; Wed, 09 Oct 2024 10:16:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814264.1227756; Wed, 09 Oct 2024 10:16:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTkF-0001hL-Dc; Wed, 09 Oct 2024 10:16:39 +0000
Received: by outflank-mailman (input) for mailman id 814264;
 Wed, 09 Oct 2024 10:16:38 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTkE-0001fM-9p
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:16:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTkE-0006br-9F
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:16:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTkE-0008PV-8S
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:16:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=APzdRrtuGtsQielKziBJqgxsg9vE/U+Dohf9uY0tmfY=; b=sPF++9L6I2QQ3zIzpLtoNhSP+1
	GGsR2d6ByhWhIkYwkMUwYAhEaZ22w4ak1xE+02bSHzW4pj/w9OiIjsQOh0A95HHBvt0MJIcV6CYbP
	F50PzZFUALZ5LHQAy5gjlPdjZ/ax9R6ZfzZMue4VIMbTCubuJgick3F+ztYRaFpLmSbE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] arm64: Restore trapless ptimer access
Message-Id: <E1syTkE-0008PV-8S@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:16:38 +0000

commit 53a4e7ef420a2e272907b98fd8ffc199bcdc0e06
Author:     Colton Lewis <coltonlewis@google.com>
AuthorDate: Thu Aug 31 19:00:52 2023 +0000
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Mon Sep 11 22:33:58 2023 +0300

    arm64: Restore trapless ptimer access
    
    Due to recent KVM changes, QEMU is setting a ptimer offset resulting
    in unintended trap and emulate access and a consequent performance
    hit. Filter out the PTIMER_CNT register to restore trapless ptimer
    access.
    
    Quoting Andrew Jones:
    
    Simply reading the CNT register and writing back the same value is
    enough to set an offset, since the timer will have certainly moved
    past whatever value was read by the time it's written.  QEMU
    frequently saves and restores all registers in the get-reg-list array,
    unless they've been explicitly filtered out (with Linux commit
    680232a94c12, KVM_REG_ARM_PTIMER_CNT is now in the array). So, to
    restore trapless ptimer accesses, we need a QEMU patch to filter out
    the register.
    
    See
    https://lore.kernel.org/kvmarm/gsntttsonus5.fsf@coltonlewis-kvm.c.googlers.com/T/#m0770023762a821db2a3f0dd0a7dc6aa54e0d0da9
    for additional context.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Andrew Jones <andrew.jones@linux.dev>
    Signed-off-by: Colton Lewis <coltonlewis@google.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Tested-by: Colton Lewis <coltonlewis@google.com>
    Message-id: 20230831190052.129045-1-coltonlewis@google.com
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    (cherry picked from commit 682814e2a3c883b27f24b9e7cab47313c49acbd4)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/arm/kvm64.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
index 810db33ccb..ed85bcfb5c 100644
--- a/target/arm/kvm64.c
+++ b/target/arm/kvm64.c
@@ -950,6 +950,7 @@ typedef struct CPRegStateLevel {
  */
 static const CPRegStateLevel non_runtime_cpregs[] = {
     { KVM_REG_ARM_TIMER_CNT, KVM_PUT_FULL_STATE },
+    { KVM_REG_ARM_PTIMER_CNT, KVM_PUT_FULL_STATE },
 };
 
 int kvm_arm_cpreg_level(uint64_t regidx)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:16:49 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:16:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814266.1227761 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTkP-0001ub-I7; Wed, 09 Oct 2024 10:16:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814266.1227761; Wed, 09 Oct 2024 10:16:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTkP-0001uT-Ew; Wed, 09 Oct 2024 10:16:49 +0000
Received: by outflank-mailman (input) for mailman id 814266;
 Wed, 09 Oct 2024 10:16:48 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTkO-0001sh-Ct
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:16:48 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTkO-0006by-CB
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:16:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTkO-0008QP-BR
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:16:48 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SK1KVTylkoOT7MyYmbQLOLXR2lSeF9hJwZgjs4p3ods=; b=aPySFMc/bixuHoY1DoEv4I1jiO
	1N2Wx2N4hERszjy4s/qJT1X1/ZN0jPenEO3Tj51V19OBtb+VGobaWZuht5ef6t0Uz945w1Ef+Nbct
	vSjzGFVcZYg8OMRo3Kl6mliM+PnDffArDYiTafXdwn2A5tSAqRwTiqd84ci8VSWC5KD4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/char/riscv_htif: Fix printing of console characters on big endian hosts
Message-Id: <E1syTkO-0008QP-BR@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:16:48 +0000

commit 3af03de983108bc8c60a1a274b3e81a9553d4ce1
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Fri Jul 21 11:47:19 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Tue Sep 12 13:37:02 2023 +0300

    hw/char/riscv_htif: Fix printing of console characters on big endian hosts
    
    The character that should be printed is stored in the 64 bit "payload"
    variable. The code currently tries to print it by taking the address
    of the variable and passing this pointer to qemu_chr_fe_write(). However,
    this only works on little endian hosts where the least significant bits
    are stored on the lowest address. To do this in a portable way, we have
    to store the value in an uint8_t variable instead.
    
    Fixes: 5033606780 ("RISC-V HTIF Console")
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Reviewed-by: Bin Meng <bmeng@tinylab.org>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-Id: <20230721094720.902454-2-thuth@redhat.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit c255946e3df4d9660e4f468a456633c24393d468)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/char/riscv_htif.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/char/riscv_htif.c b/hw/char/riscv_htif.c
index 098de50e35..e6e0fa3015 100644
--- a/hw/char/riscv_htif.c
+++ b/hw/char/riscv_htif.c
@@ -190,7 +190,8 @@ static void htif_handle_tohost_write(HTIFState *s, uint64_t val_written)
             s->tohost = 0; /* clear to indicate we read */
             return;
         } else if (cmd == HTIF_CONSOLE_CMD_PUTC) {
-            qemu_chr_fe_write(&s->chr, (uint8_t *)&payload, 1);
+            uint8_t ch = (uint8_t)payload;
+            qemu_chr_fe_write(&s->chr, &ch, 1);
             resp = 0x100 | (uint8_t)payload;
         } else {
             qemu_log("HTIF device %d: unknown command\n", device);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:16:59 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:16:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814269.1227764 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTkZ-00024A-Ip; Wed, 09 Oct 2024 10:16:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814269.1227764; Wed, 09 Oct 2024 10:16:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTkZ-000243-GK; Wed, 09 Oct 2024 10:16:59 +0000
Received: by outflank-mailman (input) for mailman id 814269;
 Wed, 09 Oct 2024 10:16:58 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTkY-00022e-Fn
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:16:58 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTkY-0006cE-F9
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:16:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTkY-0008RC-EK
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:16:58 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ss3SxOhGr74IWYVI4+LWf1QYfXOyMD8ah7MvV0AWX0Q=; b=bdRlYDi2g6E2VWZrFYA2uD65f9
	lb8A8IzA3gH82GlrG6ovBeMahTmvAVYy97BtacF7u52LTiIUiLAnpmP2QOcd1x4g6xZ+8rA92N31O
	RBmuI2iV611tJPEXivFql3/QJM8jpv/H4OiiCmaYXjAd9zG4Rf45clhQNzd7jSwoxNOQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] include/exec: Provide the tswap() functions for target independent code, too
Message-Id: <E1syTkY-0008RC-EK@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:16:58 +0000

commit aeb931d82b13c50587268f462dcd46b23d2086ff
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Tue Apr 11 20:34:17 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:17:02 2023 +0300

    include/exec: Provide the tswap() functions for target independent code, too
    
    In some cases of target independent code, it would be useful to have access
    to the functions that swap endianess in case it differs between guest and
    host. Thus re-implement the tswapXX() functions in a new header that can be
    included separately. The check whether the swapping is needed continues to
    be done at compile-time for target specific code, while it is done at
    run-time in target-independent code.
    
    Message-Id: <20230411183418.1640500-3-thuth@redhat.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Reviewed-by: Cédric Le Goater <clg@kaod.org>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 24be3369ad63c3882be42dd510a45bad52816fd1)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (trivial change needed for the next commit 058096f1c5
     "hw/char/riscv_htif: Fix the console syscall on big endian hosts")
---
 include/exec/cpu-all.h | 64 +-------------------------------------------
 include/exec/tswap.h   | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+), 63 deletions(-)

diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index 090922e4a8..ad824fee52 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -21,6 +21,7 @@
 
 #include "exec/cpu-common.h"
 #include "exec/memory.h"
+#include "exec/tswap.h"
 #include "qemu/thread.h"
 #include "hw/core/cpu.h"
 #include "qemu/rcu.h"
@@ -44,69 +45,6 @@
 #define BSWAP_NEEDED
 #endif
 
-#ifdef BSWAP_NEEDED
-
-static inline uint16_t tswap16(uint16_t s)
-{
-    return bswap16(s);
-}
-
-static inline uint32_t tswap32(uint32_t s)
-{
-    return bswap32(s);
-}
-
-static inline uint64_t tswap64(uint64_t s)
-{
-    return bswap64(s);
-}
-
-static inline void tswap16s(uint16_t *s)
-{
-    *s = bswap16(*s);
-}
-
-static inline void tswap32s(uint32_t *s)
-{
-    *s = bswap32(*s);
-}
-
-static inline void tswap64s(uint64_t *s)
-{
-    *s = bswap64(*s);
-}
-
-#else
-
-static inline uint16_t tswap16(uint16_t s)
-{
-    return s;
-}
-
-static inline uint32_t tswap32(uint32_t s)
-{
-    return s;
-}
-
-static inline uint64_t tswap64(uint64_t s)
-{
-    return s;
-}
-
-static inline void tswap16s(uint16_t *s)
-{
-}
-
-static inline void tswap32s(uint32_t *s)
-{
-}
-
-static inline void tswap64s(uint64_t *s)
-{
-}
-
-#endif
-
 #if TARGET_LONG_SIZE == 4
 #define tswapl(s) tswap32(s)
 #define tswapls(s) tswap32s((uint32_t *)(s))
diff --git a/include/exec/tswap.h b/include/exec/tswap.h
new file mode 100644
index 0000000000..68944a880b
--- /dev/null
+++ b/include/exec/tswap.h
@@ -0,0 +1,72 @@
+/*
+ * Macros for swapping a value if the endianness is different
+ * between the target and the host.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef TSWAP_H
+#define TSWAP_H
+
+#include "hw/core/cpu.h"
+#include "qemu/bswap.h"
+
+/*
+ * If we're in target-specific code, we can hard-code the swapping
+ * condition, otherwise we have to do (slower) run-time checks.
+ */
+#ifdef NEED_CPU_H
+#define target_needs_bswap()  (HOST_BIG_ENDIAN != TARGET_BIG_ENDIAN)
+#else
+#define target_needs_bswap()  (target_words_bigendian() != HOST_BIG_ENDIAN)
+#endif
+
+static inline uint16_t tswap16(uint16_t s)
+{
+    if (target_needs_bswap()) {
+        return bswap16(s);
+    } else {
+        return s;
+    }
+}
+
+static inline uint32_t tswap32(uint32_t s)
+{
+    if (target_needs_bswap()) {
+        return bswap32(s);
+    } else {
+        return s;
+    }
+}
+
+static inline uint64_t tswap64(uint64_t s)
+{
+    if (target_needs_bswap()) {
+        return bswap64(s);
+    } else {
+        return s;
+    }
+}
+
+static inline void tswap16s(uint16_t *s)
+{
+    if (target_needs_bswap()) {
+        *s = bswap16(*s);
+    }
+}
+
+static inline void tswap32s(uint32_t *s)
+{
+    if (target_needs_bswap()) {
+        *s = bswap32(*s);
+    }
+}
+
+static inline void tswap64s(uint64_t *s)
+{
+    if (target_needs_bswap()) {
+        *s = bswap64(*s);
+    }
+}
+
+#endif  /* TSWAP_H */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:17:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:17:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814272.1227768 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTkj-0002AI-Kn; Wed, 09 Oct 2024 10:17:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814272.1227768; Wed, 09 Oct 2024 10:17:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTkj-0002AA-Ho; Wed, 09 Oct 2024 10:17:09 +0000
Received: by outflank-mailman (input) for mailman id 814272;
 Wed, 09 Oct 2024 10:17:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTki-00029r-Ij
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:17:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTki-0006cd-I4
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:17:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTki-0008S7-HH
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:17:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wdvUTCGsxzzC7c9fFOMLLrKnTOJ2J6qQZNxuyxV3LjM=; b=X6mFhOed18V+l60kg40GAqsZaQ
	2GWQ0lIy9TG2GayJkU7Ja5dQZrN9XbnW9SlMneBBySqBLfV1QzRXeTqj5C2yl/ymxoKIG8aUisJwO
	xdjoJkGNN8ZIflnqm+fPCNJVhyq7R2fO5uZlchpYkrQtK+kBIQwkJ/p1OO/jvDAFoxlQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/char/riscv_htif: Fix the console syscall on big endian hosts
Message-Id: <E1syTki-0008S7-HH@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:17:08 +0000

commit a57e4cc6fe81a0b2ca8a32db91ca45df205c4a8f
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Fri Jul 21 11:47:20 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    hw/char/riscv_htif: Fix the console syscall on big endian hosts
    
    Values that have been read via cpu_physical_memory_read() from the
    guest's memory have to be swapped in case the host endianess differs
    from the guest.
    
    Fixes: a6e13e31d5 ("riscv_htif: Support console output via proxy syscall")
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Reviewed-by: Bin Meng <bmeng@tinylab.org>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Message-Id: <20230721094720.902454-3-thuth@redhat.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 058096f1c55ab688db7e1d6814aaefc1bcd87f7a)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (Mjt: context fix in hw/char/riscv_htif.c for #include)
---
 hw/char/riscv_htif.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/hw/char/riscv_htif.c b/hw/char/riscv_htif.c
index e6e0fa3015..198175e232 100644
--- a/hw/char/riscv_htif.c
+++ b/hw/char/riscv_htif.c
@@ -29,6 +29,7 @@
 #include "chardev/char-fe.h"
 #include "qemu/timer.h"
 #include "qemu/error-report.h"
+#include "exec/tswap.h"
 
 #define RISCV_DEBUG_HTIF 0
 #define HTIF_DEBUG(fmt, ...)                                                   \
@@ -167,11 +168,11 @@ static void htif_handle_tohost_write(HTIFState *s, uint64_t val_written)
             } else {
                 uint64_t syscall[8];
                 cpu_physical_memory_read(payload, syscall, sizeof(syscall));
-                if (syscall[0] == PK_SYS_WRITE &&
-                    syscall[1] == HTIF_DEV_CONSOLE &&
-                    syscall[3] == HTIF_CONSOLE_CMD_PUTC) {
+                if (tswap64(syscall[0]) == PK_SYS_WRITE &&
+                    tswap64(syscall[1]) == HTIF_DEV_CONSOLE &&
+                    tswap64(syscall[3]) == HTIF_CONSOLE_CMD_PUTC) {
                     uint8_t ch;
-                    cpu_physical_memory_read(syscall[2], &ch, 1);
+                    cpu_physical_memory_read(tswap64(syscall[2]), &ch, 1);
                     qemu_chr_fe_write(&s->chr, &ch, 1);
                     resp = 0x100 | (uint8_t)payload;
                 } else {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:17:19 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:17:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814273.1227773 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTkt-0002IQ-NU; Wed, 09 Oct 2024 10:17:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814273.1227773; Wed, 09 Oct 2024 10:17:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTkt-0002II-KY; Wed, 09 Oct 2024 10:17:19 +0000
Received: by outflank-mailman (input) for mailman id 814273;
 Wed, 09 Oct 2024 10:17:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTks-0002Hy-La
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:17:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTks-0006ck-L1
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:17:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTks-0008Sr-KH
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:17:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8d8Dd+rsDapfbH1rXFloke2Shm9PutG7a7chIC6Lz3U=; b=WilWvrep4ha0rJ2TZWoxD17/15
	zwG0UUxpNVfgmmLecT4YzuEPOcTyTegVY1Be7nYm1iEKW3ys+L5gW0LHJgcBlIdj71s4oRlFLSJ1N
	LAbNDByjbFpg1k+t94nBf7vw40FAjH9V9CiSlrrDW+AFkn4ZGScHp6CenMcHqp5epb9A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/intc: Fix upper/lower mtime write calculation
Message-Id: <E1syTks-0008Sr-KH@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:17:18 +0000

commit fd1a0c89c66c9e03b6cc7a1283856bb2112a9bde
Author:     Jason Chien <jason.chien@sifive.com>
AuthorDate: Fri Jul 28 08:24:38 2023 +0000
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    hw/intc: Fix upper/lower mtime write calculation
    
    When writing the upper mtime, we should keep the original lower mtime
    whose value is given by cpu_riscv_read_rtc() instead of
    cpu_riscv_read_rtc_raw(). The same logic applies to writes to lower mtime.
    
    Signed-off-by: Jason Chien <jason.chien@sifive.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Message-ID: <20230728082502.26439-1-jason.chien@sifive.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit e0922b73baf00c4c19d4ad30d09bb94f7ffea0f4)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/intc/riscv_aclint.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/intc/riscv_aclint.c b/hw/intc/riscv_aclint.c
index b466a6abaf..bf77e29a70 100644
--- a/hw/intc/riscv_aclint.c
+++ b/hw/intc/riscv_aclint.c
@@ -208,11 +208,12 @@ static void riscv_aclint_mtimer_write(void *opaque, hwaddr addr,
         return;
     } else if (addr == mtimer->time_base || addr == mtimer->time_base + 4) {
         uint64_t rtc_r = cpu_riscv_read_rtc_raw(mtimer->timebase_freq);
+        uint64_t rtc = cpu_riscv_read_rtc(mtimer);
 
         if (addr == mtimer->time_base) {
             if (size == 4) {
                 /* time_lo for RV32/RV64 */
-                mtimer->time_delta = ((rtc_r & ~0xFFFFFFFFULL) | value) - rtc_r;
+                mtimer->time_delta = ((rtc & ~0xFFFFFFFFULL) | value) - rtc_r;
             } else {
                 /* time for RV64 */
                 mtimer->time_delta = value - rtc_r;
@@ -220,7 +221,7 @@ static void riscv_aclint_mtimer_write(void *opaque, hwaddr addr,
         } else {
             if (size == 4) {
                 /* time_hi for RV32/RV64 */
-                mtimer->time_delta = (value << 32 | (rtc_r & 0xFFFFFFFF)) - rtc_r;
+                mtimer->time_delta = (value << 32 | (rtc & 0xFFFFFFFF)) - rtc_r;
             } else {
                 qemu_log_mask(LOG_GUEST_ERROR,
                               "aclint-mtimer: invalid time_hi write: %08x",
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:17:30 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:17:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814274.1227777 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTl4-0002T0-Os; Wed, 09 Oct 2024 10:17:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814274.1227777; Wed, 09 Oct 2024 10:17:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTl4-0002Ss-M2; Wed, 09 Oct 2024 10:17:30 +0000
Received: by outflank-mailman (input) for mailman id 814274;
 Wed, 09 Oct 2024 10:17:28 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTl2-0002Qs-Oj
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:17:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTl2-0006eU-Nz
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:17:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTl2-0008Td-NA
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:17:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mKstWdgGr/MiwZnaQv3/+1oc6/K2D3LbXeLUZqShB24=; b=o7Ty7MQdZYSlGfZxRIQBmx7HMK
	Xeu/Oii+S1vxWzjbeEY5y4mz+OvkXgwmMEbRcTROnV68FbJBfw2I9umh9F39ORPBc0SixqtxAtauX
	CmX6uxmERuvLk/VyP09lOtf0QTS9n0HZttD0p0MheeVWPp4aKaRHoAkP4JDW8QUV82w8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/intc: Make rtc variable names consistent
Message-Id: <E1syTl2-0008Td-NA@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:17:28 +0000

commit c00a9ec0613ca428abaedaf8b7be7b1cbb97d37f
Author:     Jason Chien <jason.chien@sifive.com>
AuthorDate: Fri Jul 28 08:24:39 2023 +0000
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    hw/intc: Make rtc variable names consistent
    
    The variables whose values are given by cpu_riscv_read_rtc() should be named
    "rtc". The variables whose value are given by cpu_riscv_read_rtc_raw()
    should be named "rtc_r".
    
    Signed-off-by: Jason Chien <jason.chien@sifive.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Message-ID: <20230728082502.26439-2-jason.chien@sifive.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 9382a9eafccad8dc6a487ea3a8d2bed03dc35db9)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/intc/riscv_aclint.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/intc/riscv_aclint.c b/hw/intc/riscv_aclint.c
index bf77e29a70..25cf7a5d9d 100644
--- a/hw/intc/riscv_aclint.c
+++ b/hw/intc/riscv_aclint.c
@@ -64,13 +64,13 @@ static void riscv_aclint_mtimer_write_timecmp(RISCVAclintMTimerState *mtimer,
     uint64_t next;
     uint64_t diff;
 
-    uint64_t rtc_r = cpu_riscv_read_rtc(mtimer);
+    uint64_t rtc = cpu_riscv_read_rtc(mtimer);
 
     /* Compute the relative hartid w.r.t the socket */
     hartid = hartid - mtimer->hartid_base;
 
     mtimer->timecmp[hartid] = value;
-    if (mtimer->timecmp[hartid] <= rtc_r) {
+    if (mtimer->timecmp[hartid] <= rtc) {
         /*
          * If we're setting an MTIMECMP value in the "past",
          * immediately raise the timer interrupt
@@ -81,7 +81,7 @@ static void riscv_aclint_mtimer_write_timecmp(RISCVAclintMTimerState *mtimer,
 
     /* otherwise, set up the future timer interrupt */
     qemu_irq_lower(mtimer->timer_irqs[hartid]);
-    diff = mtimer->timecmp[hartid] - rtc_r;
+    diff = mtimer->timecmp[hartid] - rtc;
     /* back to ns (note args switched in muldiv64) */
     uint64_t ns_diff = muldiv64(diff, NANOSECONDS_PER_SECOND, timebase_freq);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:17:40 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:17:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814275.1227780 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTlE-0002X8-Ps; Wed, 09 Oct 2024 10:17:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814275.1227780; Wed, 09 Oct 2024 10:17:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTlE-0002X0-NN; Wed, 09 Oct 2024 10:17:40 +0000
Received: by outflank-mailman (input) for mailman id 814275;
 Wed, 09 Oct 2024 10:17:38 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTlC-0002Wd-RP
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:17:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTlC-0006et-Qq
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:17:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTlC-0008UN-QB
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:17:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1gG/Tj0ojJda0aoKZzIulP6/lKxiMvmHgJFwCR8CzdA=; b=bpz0rosGf5bi4CiI/LMEfSAZ9d
	q41Ut719bxNVQHy4LuP/XlFTa1TnfzUL7e2UH3yOxh/S2FtSr93yMJp/FYOcE0uQ5KtY7xYx3q5uL
	69ERjicN+HxZLu8ckVrYRZb7XSoJdUM0oC32yKfJtH5cvBDFYgiDnyOXMnmq5hizxbYw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] linux-user/riscv: Use abi type for target_ucontext
Message-Id: <E1syTlC-0008UN-QB@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:17:38 +0000

commit 9bac2bcf10e25506cc1fc7b69b027399afeb3768
Author:     LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
AuthorDate: Fri Aug 11 13:54:38 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    linux-user/riscv: Use abi type for target_ucontext
    
    We should not use types dependend on host arch for target_ucontext.
    This bug is found when run rv32 applications.
    
    Signed-off-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-ID: <20230811055438.1945-1-zhiwei_liu@linux.alibaba.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit ae7d4d625cab49657b9fc2be09d895afb9bcdaf0)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 linux-user/riscv/signal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/linux-user/riscv/signal.c b/linux-user/riscv/signal.c
index eaa168199a..f989f7f51f 100644
--- a/linux-user/riscv/signal.c
+++ b/linux-user/riscv/signal.c
@@ -38,8 +38,8 @@ struct target_sigcontext {
 }; /* cf. riscv-linux:arch/riscv/include/uapi/asm/ptrace.h */
 
 struct target_ucontext {
-    unsigned long uc_flags;
-    struct target_ucontext *uc_link;
+    abi_ulong uc_flags;
+    abi_ptr uc_link;
     target_stack_t uc_stack;
     target_sigset_t uc_sigmask;
     uint8_t   __unused[1024 / 8 - sizeof(target_sigset_t)];
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:17:50 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:17:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814276.1227785 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTlO-0002fS-RV; Wed, 09 Oct 2024 10:17:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814276.1227785; Wed, 09 Oct 2024 10:17:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTlO-0002fK-On; Wed, 09 Oct 2024 10:17:50 +0000
Received: by outflank-mailman (input) for mailman id 814276;
 Wed, 09 Oct 2024 10:17:48 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTlM-0002f4-UK
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:17:48 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTlM-0006ex-Tf
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:17:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTlM-0008VK-Sv
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:17:48 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4Gyd99+kcVyIPbXzEoL7nwddfK/oqt7nltMdxkCIUOU=; b=jZXvJ9zVOqRFiNSgG8XgkdJHd7
	7CsDZ1OZIBhaTwHIqWQpbNTQP0UYVKAps+HUlKnVTLXQIk+koo8xYeFMvzCPzcmIB1t2/TWdChNOY
	UUNJ8liI3RETbQ3aB1J7AP3ZaomKnt617k+lst1oNzScUV6olmL1AVk069za0UW8hR6o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/riscv: virt: Fix riscv,pmu DT node path
Message-Id: <E1syTlM-0008VK-Sv@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:17:48 +0000

commit e94ea3c6dbd48d70edca6de0079d5690a82ec35b
Author:     Conor Dooley <conor.dooley@microchip.com>
AuthorDate: Thu Jul 27 15:24:17 2023 +0100
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    hw/riscv: virt: Fix riscv,pmu DT node path
    
    On a dtb dumped from the virt machine, dt-validate complains:
    soc: pmu: {'riscv,event-to-mhpmcounters': [[1, 1, 524281], [2, 2, 524284], [65561, 65561, 524280], [65563, 65563, 524280], [65569, 65569, 524280]], 'compatible': ['riscv,pmu']} should not be valid under {'type': 'object'}
            from schema $id: http://devicetree.org/schemas/simple-bus.yaml#
    That's pretty cryptic, but running the dtb back through dtc produces
    something a lot more reasonable:
    Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property
    
    Moving the riscv,pmu node out of the soc bus solves the problem.
    
    Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
    Acked-by: Alistair Francis <alistair.francis@wdc.com>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Message-ID: <20230727-groom-decline-2c57ce42841c@spud>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 9ff31406312500053ecb5f92df01dd9ce52e635d)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/riscv/virt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index 4e3efbee16..be8f0cb26e 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -731,7 +731,7 @@ static void create_fdt_pmu(RISCVVirtState *s)
     MachineState *ms = MACHINE(s);
     RISCVCPU hart = s->soc[0].harts[0];
 
-    pmu_name = g_strdup_printf("/soc/pmu");
+    pmu_name = g_strdup_printf("/pmu");
     qemu_fdt_add_subnode(ms->fdt, pmu_name);
     qemu_fdt_setprop_string(ms->fdt, pmu_name, "compatible", "riscv,pmu");
     riscv_pmu_generate_fdt_node(ms->fdt, hart.cfg.pmu_num, pmu_name);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:18:01 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:18:01 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814277.1227789 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTlY-0002l1-T4; Wed, 09 Oct 2024 10:18:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814277.1227789; Wed, 09 Oct 2024 10:18:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTlY-0002kr-QD; Wed, 09 Oct 2024 10:18:00 +0000
Received: by outflank-mailman (input) for mailman id 814277;
 Wed, 09 Oct 2024 10:17:59 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTlX-0002ke-12
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:17:59 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTlX-0006f1-0P
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:17:59 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTlW-0008W7-Vq
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:17:58 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yUDiP+e+U5W2M7jJd+W7lJ5KdjMtMP01pWJzvVoO6XA=; b=QE1AFimO8E3z0XxtSM4fRYLfCq
	VV5268rPmPQSHvG58rZ0/U8OzIHDuCYv62ZNHKj47KkdFPPnOx4a0Z2vCOXZH3Zwh54MNoO/JrWTx
	rDJwTPnmCJdX4O5PkolYl32ObKHNoJM9paKIUnG1ZUEKA7Y8ir6eZHuB9ckhC3fsOKgM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] target/riscv: fix satp_mode_finalize() when satp_mode.supported = 0
Message-Id: <E1syTlW-0008W7-Vq@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:17:58 +0000

commit 1805e05db3c6d92c750427b1c1371f44fa8e4893
Author:     Daniel Henrique Barboza <dbarboza@ventanamicro.com>
AuthorDate: Thu Aug 17 12:29:03 2023 -0300
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    target/riscv: fix satp_mode_finalize() when satp_mode.supported = 0
    
    In the same emulated RISC-V host, the 'host' KVM CPU takes 4 times
    longer to boot than the 'rv64' KVM CPU.
    
    The reason is an unintended behavior of riscv_cpu_satp_mode_finalize()
    when satp_mode.supported = 0, i.e. when cpu_init() does not set
    satp_mode_max_supported(). satp_mode_max_from_map(map) does:
    
    31 - __builtin_clz(map)
    
    This means that, if satp_mode.supported = 0, satp_mode_supported_max
    wil be '31 - 32'. But this is C, so satp_mode_supported_max will gladly
    set it to UINT_MAX (4294967295). After that, if the user didn't set a
    satp_mode, set_satp_mode_default_map(cpu) will make
    
    cfg.satp_mode.map = cfg.satp_mode.supported
    
    So satp_mode.map = 0. And then satp_mode_map_max will be set to
    satp_mode_max_from_map(cpu->cfg.satp_mode.map), i.e. also UINT_MAX. The
    guard "satp_mode_map_max > satp_mode_supported_max" doesn't protect us
    here since both are UINT_MAX.
    
    And finally we have 2 loops:
    
            for (int i = satp_mode_map_max - 1; i >= 0; --i) {
    
    Which are, in fact, 2 loops from UINT_MAX -1 to -1. This is where the
    extra delay when booting the 'host' CPU is coming from.
    
    Commit 43d1de32f8 already set a precedence for satp_mode.supported = 0
    in a different manner. We're doing the same here. If supported == 0,
    interpret as 'the CPU wants the OS to handle satp mode alone' and skip
    satp_mode_finalize().
    
    We'll also put a guard in satp_mode_max_from_map() to assert out if map
    is 0 since the function is not ready to deal with it.
    
    Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
    Fixes: 6f23aaeb9b ("riscv: Allow user to set the satp mode")
    Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
    Message-ID: <20230817152903.694926-1-dbarboza@ventanamicro.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 3a2fc23563885c219c73c8f24318921daf02f3f2)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/riscv/cpu.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index 1e97473af2..8c0721c715 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -282,6 +282,17 @@ static uint8_t satp_mode_from_str(const char *satp_mode_str)
 
 uint8_t satp_mode_max_from_map(uint32_t map)
 {
+    /*
+     * 'map = 0' will make us return (31 - 32), which C will
+     * happily overflow to UINT_MAX. There's no good result to
+     * return if 'map = 0' (e.g. returning 0 will be ambiguous
+     * with the result for 'map = 1').
+     *
+     * Assert out if map = 0. Callers will have to deal with
+     * it outside of this function.
+     */
+    g_assert(map > 0);
+
     /* map here has at least one bit set, so no problem with clz */
     return 31 - __builtin_clz(map);
 }
@@ -1043,9 +1054,15 @@ static void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)
 static void riscv_cpu_satp_mode_finalize(RISCVCPU *cpu, Error **errp)
 {
     bool rv32 = riscv_cpu_mxl(&cpu->env) == MXL_RV32;
-    uint8_t satp_mode_map_max;
-    uint8_t satp_mode_supported_max =
-                        satp_mode_max_from_map(cpu->cfg.satp_mode.supported);
+    uint8_t satp_mode_map_max, satp_mode_supported_max;
+
+    /* The CPU wants the OS to decide which satp mode to use */
+    if (cpu->cfg.satp_mode.supported == 0) {
+        return;
+    }
+
+    satp_mode_supported_max =
+                    satp_mode_max_from_map(cpu->cfg.satp_mode.supported);
 
     if (cpu->cfg.satp_mode.map == 0) {
         if (cpu->cfg.satp_mode.init == 0) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:18:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:18:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814278.1227792 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTli-0002v9-UH; Wed, 09 Oct 2024 10:18:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814278.1227792; Wed, 09 Oct 2024 10:18:10 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTli-0002v1-Rf; Wed, 09 Oct 2024 10:18:10 +0000
Received: by outflank-mailman (input) for mailman id 814278;
 Wed, 09 Oct 2024 10:18:09 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTlh-0002qK-3s
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:18:09 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTlh-0006fI-3E
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:18:09 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTlh-00005h-2X
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:18:09 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yI/4BxLwk1UBw4+7aVgwbL7fUsRdHIibiOU5y/tKtBE=; b=OKnNqYIuUKO6ha6JJsEzVeRvwR
	MhnXwBlVZXr5rDAgMY9CEVWEv7VYDSnJn8I/4Dz+5eXqvXOJfxpl3YoZfcjN5SqgNVVVov7cDZAf/
	O+SNIwZPHTAekp62TNKjLlLwsTVR0OwmqgdLoDh4l0UsiVwX2MXhv+oxVCJ1MDsh4ywo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] target/riscv/pmp.c: respect mseccfg.RLB for pmpaddrX changes
Message-Id: <E1syTlh-00005h-2X@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:18:09 +0000

commit 70c97e75d709eadf80845259ea0a0409475102c3
Author:     Leon Schuermann <leons@opentitan.org>
AuthorDate: Tue Aug 29 17:50:46 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    target/riscv/pmp.c: respect mseccfg.RLB for pmpaddrX changes
    
    When the rule-lock bypass (RLB) bit is set in the mseccfg CSR, the PMP
    configuration lock bits must not apply. While this behavior is
    implemented for the pmpcfgX CSRs, this bit is not respected for
    changes to the pmpaddrX CSRs. This patch ensures that pmpaddrX CSR
    writes work even on locked regions when the global rule-lock bypass is
    enabled.
    
    Signed-off-by: Leon Schuermann <leons@opentitan.org>
    Reviewed-by: Mayuresh Chitale <mchitale@ventanamicro.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Message-ID: <20230829215046.1430463-1-leon@is.currently.online>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 4e3adce1244e1ca30ec05874c3eca14911dc0825)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/riscv/pmp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c
index a08cd95658..bcb4baa0a2 100644
--- a/target/riscv/pmp.c
+++ b/target/riscv/pmp.c
@@ -45,6 +45,10 @@ static inline uint8_t pmp_get_a_field(uint8_t cfg)
  */
 static inline int pmp_is_locked(CPURISCVState *env, uint32_t pmp_index)
 {
+    /* mseccfg.RLB is set */
+    if (MSECCFG_RLB_ISSET(env)) {
+        return 0;
+    }
 
     if (env->pmp_state.pmp[pmp_index].cfg_reg & PMP_LOCK) {
         return 1;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:18:21 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:18:21 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814279.1227798 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTlt-00033H-0i; Wed, 09 Oct 2024 10:18:21 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814279.1227798; Wed, 09 Oct 2024 10:18:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTls-000339-T8; Wed, 09 Oct 2024 10:18:20 +0000
Received: by outflank-mailman (input) for mailman id 814279;
 Wed, 09 Oct 2024 10:18:19 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTlr-00032w-6l
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:18:19 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTlr-0006fS-63
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:18:19 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTlr-00006Q-5M
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:18:19 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=f8234QwEYRPiMAlsgvGFuWPGI68b3JPRYlUBRbpYFao=; b=t58Ov/YYtuCHz38hH96vIIzNUC
	lE5aoBBSq/FMhBqlU8kzH4q9OvPJCBGZjUqXx5+8JN4QNHRGIvTbvusB6eTsb5H42shprpM28zi+3
	FOjD8ba5lQmRmeSf8LaDEl5FPa/ZKHAJcMNiHyJm2X8vWo+yBfDh7je/J2EE7mnQ7EvA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] hw/tpm: TIS on sysbus: Remove unsupport ppi command line option
Message-Id: <E1syTlr-00006Q-5M@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:18:19 +0000

commit 36540b367eb80f1d6a646f691e6a2b75bf57ad61
Author:     Stefan Berger <stefanb@linux.ibm.com>
AuthorDate: Thu Jul 13 13:19:55 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    hw/tpm: TIS on sysbus: Remove unsupport ppi command line option
    
    The ppi command line option for the TIS device on sysbus never worked
    and caused an immediate segfault. Remove support for it since it also
    needs support in the firmware and needs testing inside the VM.
    
    Reproducer with the ppi=on option passed:
    
    qemu-system-aarch64 \
       -machine virt,gic-version=3 \
       -m 4G  \
       -nographic -no-acpi \
       -chardev socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
       -tpmdev emulator,id=tpm0,chardev=chrtpm \
       -device tpm-tis-device,tpmdev=tpm0,ppi=on
    [...]
    Segmentation fault (core dumped)
    
    Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
    Reviewed-by: Eric Auger <eric.auger@redhat.com>
    Message-id: 20230713171955.149236-1-stefanb@linux.ibm.com
    (cherry picked from commit 4c46fe2ed492f35f411632c8b5a8442f322bc3f0)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/tpm/tpm_tis_sysbus.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/hw/tpm/tpm_tis_sysbus.c b/hw/tpm/tpm_tis_sysbus.c
index 45e63efd63..6724b3d4f6 100644
--- a/hw/tpm/tpm_tis_sysbus.c
+++ b/hw/tpm/tpm_tis_sysbus.c
@@ -93,7 +93,6 @@ static void tpm_tis_sysbus_reset(DeviceState *dev)
 static Property tpm_tis_sysbus_properties[] = {
     DEFINE_PROP_UINT32("irq", TPMStateSysBus, state.irq_num, TPM_TIS_IRQ),
     DEFINE_PROP_TPMBE("tpmdev", TPMStateSysBus, state.be_driver),
-    DEFINE_PROP_BOOL("ppi", TPMStateSysBus, state.ppi_enabled, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:18:31 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:18:31 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814280.1227801 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTm3-00039S-2s; Wed, 09 Oct 2024 10:18:31 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814280.1227801; Wed, 09 Oct 2024 10:18:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTm3-00039K-0B; Wed, 09 Oct 2024 10:18:31 +0000
Received: by outflank-mailman (input) for mailman id 814280;
 Wed, 09 Oct 2024 10:18:29 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTm1-00038i-9W
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:18:29 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTm1-0006fZ-8u
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:18:29 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTm1-00009A-8D
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:18:29 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/fVCJE6sylIBfnl5uSsyFMH9QzvexnGrVodYFdhLdc4=; b=glsu0s+227oF7rufJesYfRgURN
	z2BErBhp0BkBNoupQskntNNmUKWOea/gC6zmjYVGaF0MUOCnqc7cvcL+n5eButId0uP4Nq2vXsPNh
	7Ir1/iX7yfChx2smBDdJfSMA/zWWT6R9LeItGSWqXvuDL/69PpEEEUxQPj4juaRmsBB8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] ui: fix crash when there are no active_console
Message-Id: <E1syTm1-00009A-8D@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:18:29 +0000

commit 6c575436cd3e692079fc3e2fe4f54efe77211549
Author:     Marc-André Lureau <marcandre.lureau@redhat.com>
AuthorDate: Mon Sep 11 18:04:47 2023 +0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    ui: fix crash when there are no active_console
    
    Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
    0x0000555555888630 in dpy_ui_info_supported (con=0x0) at ../ui/console.c:812
    812         return con->hw_ops->ui_info != NULL;
    (gdb) bt
    #0  0x0000555555888630 in dpy_ui_info_supported (con=0x0) at ../ui/console.c:812
    #1  0x00005555558a44b1 in protocol_client_msg (vs=0x5555578c76c0, data=0x5555581e93f0 <incomplete sequence \373>, len=24) at ../ui/vnc.c:2585
    #2  0x00005555558a19ac in vnc_client_read (vs=0x5555578c76c0) at ../ui/vnc.c:1607
    #3  0x00005555558a1ac2 in vnc_client_io (ioc=0x5555581eb0e0, condition=G_IO_IN, opaque=0x5555578c76c0) at ../ui/vnc.c:1635
    
    Fixes:
    https://issues.redhat.com/browse/RHEL-2600
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Reviewed-by: Albert Esteve <aesteve@redhat.com>
    (cherry picked from commit 48a35e12faf90a896c5aa4755812201e00d60316)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 ui/console.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ui/console.c b/ui/console.c
index 7461446e71..a327c9f94a 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1707,6 +1707,9 @@ bool dpy_ui_info_supported(QemuConsole *con)
     if (con == NULL) {
         con = active_console;
     }
+    if (con == NULL) {
+        return false;
+    }
 
     return con->hw_ops->ui_info != NULL;
 }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:18:41 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:18:41 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814281.1227805 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTmD-0003GN-4E; Wed, 09 Oct 2024 10:18:41 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814281.1227805; Wed, 09 Oct 2024 10:18:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTmD-0003GF-1W; Wed, 09 Oct 2024 10:18:41 +0000
Received: by outflank-mailman (input) for mailman id 814281;
 Wed, 09 Oct 2024 10:18:39 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTmB-0003Eg-CT
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:18:39 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTmB-0006ft-Bj
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:18:39 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTmB-00009w-B1
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:18:39 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=utKb00OHUITGeqX3xpruh8EBd0c6Xbqtm56JRKAOO1k=; b=2R2XhsoEIuxvVe0T3ZNOyCcAhy
	KWcAVFojvfszpcCeTXKqI72FrMLuWEC4NysuUCgTrPRwxoq1tSFNF8J1paooXK6ocUK/AsAYn/Yz6
	Y6YixEThmSzRc/zzGHxYY9ewI4Q7hpyfpdrCuQYDKZQzdKWvn5k4c57b64VC1/PuifGY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] s390x/ap: fix missing subsystem reset registration
Message-Id: <E1syTmB-00009w-B1@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:18:39 +0000

commit 0ef930a29f432320d979e227a305f927bb15eb09
Author:     Janosch Frank <frankja@linux.ibm.com>
AuthorDate: Wed Aug 23 16:22:15 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    s390x/ap: fix missing subsystem reset registration
    
    A subsystem reset contains a reset of AP resources which has been
    missing.  Adding the AP bridge to the list of device types that need
    reset fixes this issue.
    
    Reviewed-by: Jason J. Herne <jjherne@linux.ibm.com>
    Reviewed-by: Tony Krowiak <akrowiak@linux.ibm.com>
    Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
    Fixes: a51b3153 ("s390x/ap: base Adjunct Processor (AP) object model")
    Message-ID: <20230823142219.1046522-2-seiden@linux.ibm.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 297ec01f0b9864ea8209ca0ddc6643b4c0574bdb)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/s390x/s390-virtio-ccw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 0daf445d60..ea048e4667 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -109,6 +109,7 @@ static const char *const reset_dev_types[] = {
     "s390-flic",
     "diag288",
     TYPE_S390_PCI_HOST_BRIDGE,
+    TYPE_AP_BRIDGE,
 };
 
 static void subsystem_reset(void)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:18:50 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:18:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814282.1227809 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTmM-0003K7-5Z; Wed, 09 Oct 2024 10:18:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814282.1227809; Wed, 09 Oct 2024 10:18:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTmM-0003Jz-2q; Wed, 09 Oct 2024 10:18:50 +0000
Received: by outflank-mailman (input) for mailman id 814282;
 Wed, 09 Oct 2024 10:18:49 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTmL-0003Js-FC
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:18:49 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTmL-0006fx-Ea
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:18:49 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTmL-0000Al-Ds
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:18:49 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hO51UUfrlogJiLe85VLK7JaG/0yLnbRaH5T5MMU4bZg=; b=XTsIyj/zJmxOK0Ht1HUeFU2iLW
	bV7cgZHpKvwo5CMUB5LpoN8EqR1srK01GkJABMbM46+JpylTRTv7fWGGRGK++rPD9h/239H3CROjK
	ePJSFi+CwK/EPI7xOWwkcB8Zh1cr5g/W9Wzc/YMcWoQSXPqkPo6ltfUAJIS6QBBX9D+k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] tpm: fix crash when FD >= 1024 and unnecessary errors due to EINTR
Message-Id: <E1syTmL-0000Al-Ds@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:18:49 +0000

commit fcf58d6f20d29ee250f542ac8de968700c957134
Author:     Marc-André Lureau <marcandre.lureau@redhat.com>
AuthorDate: Mon Sep 11 17:25:51 2023 +0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    tpm: fix crash when FD >= 1024 and unnecessary errors due to EINTR
    
    Replace select() with poll() to fix a crash when QEMU has a large number
    of FDs. Also use RETRY_ON_EINTR to avoid unnecessary errors due to EINTR.
    
    Cc: qemu-stable@nongnu.org
    Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2020133
    Fixes: 56a3c24ffc ("tpm: Probe for connected TPM 1.2 or TPM 2")
    Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
    Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
    Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
    (cherry picked from commit 8e32ddff69b6b4547cc00592ad816484e160817a)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 backends/tpm/tpm_util.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/backends/tpm/tpm_util.c b/backends/tpm/tpm_util.c
index a6e6d3e72f..1856589c3b 100644
--- a/backends/tpm/tpm_util.c
+++ b/backends/tpm/tpm_util.c
@@ -112,12 +112,8 @@ static int tpm_util_request(int fd,
                             void *response,
                             size_t responselen)
 {
-    fd_set readfds;
+    GPollFD fds[1] = { {.fd = fd, .events = G_IO_IN } };
     int n;
-    struct timeval tv = {
-        .tv_sec = 1,
-        .tv_usec = 0,
-    };
 
     n = write(fd, request, requestlen);
     if (n < 0) {
@@ -127,11 +123,8 @@ static int tpm_util_request(int fd,
         return -EFAULT;
     }
 
-    FD_ZERO(&readfds);
-    FD_SET(fd, &readfds);
-
     /* wait for a second */
-    n = select(fd + 1, &readfds, NULL, NULL, &tv);
+    n = RETRY_ON_EINTR(g_poll(fds, 1, 1000));
     if (n != 1) {
         return -errno;
     }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:19:00 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:19:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814283.1227812 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTmW-0003Sk-6k; Wed, 09 Oct 2024 10:19:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814283.1227812; Wed, 09 Oct 2024 10:19:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTmW-0003SB-4I; Wed, 09 Oct 2024 10:19:00 +0000
Received: by outflank-mailman (input) for mailman id 814283;
 Wed, 09 Oct 2024 10:18:59 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTmV-0003RP-II
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:18:59 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTmV-0006g4-Hj
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:18:59 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTmV-0000BW-Gk
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:18:59 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=O83HANZGGuLq99wbqnNlB9I+2uEOrndEGAziHbar4T8=; b=oM/FxbBW8e36LBR2lvhGXvbEBr
	6mbE0BXg/vmCV6lagwyucB8FZefzCCJrmUNOWTlD1VdHMbJFWR3ScEqgoOpgOKR19eIxqOVoZ+avf
	gJNG5njvMZk18GqKoA9Ky+oOP3PpEdysJMLBYDQzF0zXZfA8jN4vgYahZooHqzjuv5iQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] Update version for 8.0.5 release
Message-Id: <E1syTmV-0000BW-Gk@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:18:59 +0000

commit 6bbce8b464206e6622216b62841cb3e953d56eb8
Author:     Michael Tokarev <mjt@tls.msk.ru>
AuthorDate: Thu Sep 21 19:23:20 2023 +0300
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Thu Sep 21 19:23:20 2023 +0300

    Update version for 8.0.5 release
    
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 VERSION | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/VERSION b/VERSION
index 50c496d20c..904be6d4e4 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-8.0.4
+8.0.5
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 10:19:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 10:19:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814284.1227816 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTmg-0003Y7-8E; Wed, 09 Oct 2024 10:19:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814284.1227816; Wed, 09 Oct 2024 10:19:10 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syTmg-0003Xz-5h; Wed, 09 Oct 2024 10:19:10 +0000
Received: by outflank-mailman (input) for mailman id 814284;
 Wed, 09 Oct 2024 10:19:09 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTmf-0003Xa-LY
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:19:09 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTmf-0006gS-Kt
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:19:09 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syTmf-0000DD-K6
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 10:19:09 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=EUgfitzIAahAUgG7qURLjCLj50KuESiLOivpzQ6n6B4=; b=BbHA+AK3IfIwfUUUKLsc9RQ1bE
	pqRJo2Xx91GAX+RuyLiRyXbDfOIcW3G/M8H6aanR7o7gW7M+DLDSMSNmdldY8Bv2pwzUu2EPutTda
	JG2qOCv2q2tELBLij/kutj7lVO++r+x81OeTpMR6yRUw7ySOmmBc2BFiUOYDTFDpAGZw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen staging-4.18] Merge tag 'v8.0.5' into 'staging-4.18'
Message-Id: <E1syTmf-0000DD-K6@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 10:19:09 +0000

commit bdf719c4c535cf14ec4fe8e9cb7a798a5a73fb23
Merge: 6bbce8b464206e6622216b62841cb3e953d56eb8 0df9387c8983e1b1e72d8c574356f572342c03e6
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Wed Oct 9 11:40:12 2024 +0200
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Wed Oct 9 11:40:12 2024 +0200

    Merge tag 'v8.0.5' into 'staging-4.18'

--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 14:22:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 14:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814601.1228187 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syXZl-0004Ok-C5; Wed, 09 Oct 2024 14:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814601.1228187; Wed, 09 Oct 2024 14: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 1syXZl-0004Oc-9T; Wed, 09 Oct 2024 14:22:05 +0000
Received: by outflank-mailman (input) for mailman id 814601;
 Wed, 09 Oct 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 1syXZj-0004OQ-Kc
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 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 1syXZj-0002ha-GM
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:22:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syXZj-0007hi-Ez
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14: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=ACWXFa27prMKTHMVEu8mMTMeRmGvgbgt9062NwoMf+8=; b=v+40h1p2BrfTBF6BYI8Qtewh0p
	k/zXsIvxHKfBry22XJmpC0+4iFfoiacwbFEACjwhB0bm6WTqEZSUAeCihp/0vD1NVdTFPxBd0hJrS
	Gj9FiztRYgpGoIebnKWe/NSlVKqRAl2/rFHuZb7nXuAJxfBLzz2rMQMVrzeseNHbcr4I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CI: Stop building QEMU in general
Message-Id: <E1syXZj-0007hi-Ez@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 14:22:03 +0000

commit e305256e69b1c943db3ca20173da6ded3db2d252
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sat Jul 13 17:50:30 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 9 15:14:14 2024 +0100

    CI: Stop building QEMU in general
    
    We spend an awful lot of CI time building QEMU, even though most changes don't
    touch the subset of tools/libs/ used by QEMU.  Some numbers taken at a time
    when CI was otherwise quiet:
    
                           With     Without
      Alpine:              13m38s   6m04s
      Debian 12:           10m05s   8m10s
      OpenSUSE Tumbleweed: 11m40s   7m54s
      Ubuntu 24.04:        14m56s   8m06s
    
    which is a >50% improvement in wallclock time in some cases.
    
    The only build we have that needs QEMU is alpine-3.18-gcc-debug.  This is the
    build deployed and used by the QubesOS ADL-* and Zen3p-* jobs.
    
    Xilinx-x86_64 deploys it too, but is PVH-only and doesn't use QEMU.
    
    QEMU is also built by CirrusCI for FreeBSD (fully Clang/LLVM toolchain).
    
    This should help quite a lot with Gitlab CI capacity.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/build.yaml       |  1 +
 automation/scripts/build              |  7 ++-----
 automation/scripts/qemu-deps-check.py | 19 -------------------
 3 files changed, 3 insertions(+), 24 deletions(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index c668736bdc..c2db69ecf8 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -339,6 +339,7 @@ alpine-3.18-gcc-debug:
   extends: .gcc-x86-64-build-debug
   variables:
     CONTAINER: alpine:3.18
+    BUILD_QEMU_XEN: y
 
 debian-bookworm-gcc-debug:
   extends: .gcc-x86-64-build-debug
diff --git a/automation/scripts/build b/automation/scripts/build
index 34416297a4..952599cc25 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -91,11 +91,8 @@ else
         cfgargs+=("--with-extra-qemuu-configure-args=\"--disable-werror\"")
     fi
 
-    # Qemu requires Python 3.8 or later, and ninja
-    # and Clang 10 or later
-    if ! type python3 || ! python3 automation/scripts/qemu-deps-check.py \
-            || [[ "$cc_is_clang" == y && "$cc_ver" -lt 0x0a0000 ]] \
-            || ! type ninja; then
+    # QEMU is only for those who ask
+    if [[ "$BUILD_QEMU_XEN" != "y" ]]; then
         cfgargs+=("--with-system-qemu=/bin/false")
     fi
 
diff --git a/automation/scripts/qemu-deps-check.py b/automation/scripts/qemu-deps-check.py
deleted file mode 100755
index f6188afb3e..0000000000
--- a/automation/scripts/qemu-deps-check.py
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-import sys
-
-if sys.version_info < (3, 8):
-    print("Python %d.%d.%d too old" %
-          (sys.version_info.major,
-           sys.version_info.minor,
-           sys.version_info.micro))
-    exit(1)
-
-try:
-    import tomllib
-except ImportError:
-    try:
-        import tomli
-    except ImportError:
-        print("No tomli")
-        exit(1)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 14:55:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 14:55:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814725.1228340 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syY5f-00062x-3Z; Wed, 09 Oct 2024 14:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814725.1228340; Wed, 09 Oct 2024 14:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syY5f-00062p-11; Wed, 09 Oct 2024 14:55:03 +0000
Received: by outflank-mailman (input) for mailman id 814725;
 Wed, 09 Oct 2024 14: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 1syY5e-00062j-9S
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14: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 1syY5e-0003K5-8g
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syY5e-0003Wx-7h
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:55:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fsJyv6wRYAep3KSkjAMd68cCjc+WCcpp4wcufYM4TD8=; b=wYES1MBjD+PNhTT8/oVnpDJV2Q
	eGSQB6zo7A0XZfcV5K7kGk1KEMLKXHzbKqu8WmFjfVz7hOfO+tVmUjSLaQ58G9vCC0Le4BY5a/JxO
	UvU11fdMM6ffCq9iLsWV4arEbcDoVGgXXivFkjYXHu6oKPn9CaAus90AaMiih8UZ3OYc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] stubdom: swtich to local .gitignore file
Message-Id: <E1syY5e-0003Wx-7h@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 14:55:02 +0000

commit e07ae82853121f0434608d8aee1d467736afe6b1
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sat Oct 5 17:15:45 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 8 11:15:08 2024 +0100

    stubdom: swtich to local .gitignore file
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 .gitignore         | 37 +------------------------------------
 stubdom/.gitignore | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 36 deletions(-)

diff --git a/.gitignore b/.gitignore
index d88be80b28..5c13fb5878 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,7 +39,6 @@ cscope.po.out
 .vscode
 
 dist
-stubdom/*.tar.gz
 
 autom4te.cache/
 automation/build/yocto/*.dockerfile
@@ -66,41 +65,7 @@ docs/pdf/
 docs/txt/
 extras/
 install/*
-stubdom/*-minios-config.mk
-stubdom/autom4te.cache/
-stubdom/binutils-*
-stubdom/config.cache
-stubdom/config.log
-stubdom/config.status
-stubdom/cross-root-*
-stubdom/gcc-*
-stubdom/gmp-*
-stubdom/grub-*
-stubdom/include
-stubdom/ioemu
-stubdom/ioemu/
-stubdom/libs-*
-stubdom/libxencall-*
-stubdom/libxenevtchn-*
-stubdom/libxenforeignmemory-*
-stubdom/libxengnttab-*
-stubdom/libxentoolcore-*
-stubdom/libxentoollog-*
-stubdom/lwip-*
-stubdom/lwip/
-stubdom/mini-os-*
-stubdom/mk-headers-*
-stubdom/newlib-1.*
-stubdom/newlib-x86*
-stubdom/pciutils-*
-stubdom/pkg-config/*
-stubdom/polarssl-*
-stubdom/stubdompath.sh
-stubdom/tpm_emulator-*
-stubdom/vtpm/vtpm_manager.h
-stubdom/xenstore
-stubdom/xenstorepvh
-stubdom/zlib-*
+
 tools/*/build/lib*/*.py
 tools/autom4te.cache/
 tools/config.h
diff --git a/stubdom/.gitignore b/stubdom/.gitignore
new file mode 100644
index 0000000000..10e2547a22
--- /dev/null
+++ b/stubdom/.gitignore
@@ -0,0 +1,36 @@
+/*.tar.gz
+/*-minios-config.mk
+/autom4te.cache/
+/binutils-*
+/config.cache
+/config.log
+/config.status
+/cross-root-*
+/gcc-*
+/gmp-*
+/grub-*
+/include
+/ioemu
+/ioemu/
+/libs-*
+/libxencall-*
+/libxenevtchn-*
+/libxenforeignmemory-*
+/libxengnttab-*
+/libxentoolcore-*
+/libxentoollog-*
+/lwip-*
+/lwip/
+/mini-os-*
+/mk-headers-*
+/newlib-1.*
+/newlib-x86*
+/pciutils-*
+/pkg-config/*
+/polarssl-*
+/stubdompath.sh
+/tpm_emulator-*
+/vtpm/vtpm_manager.h
+/xenstore
+/xenstorepvh
+/zlib-*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 14:55:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 14:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814726.1228344 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syY5q-00065J-4w; Wed, 09 Oct 2024 14:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814726.1228344; Wed, 09 Oct 2024 14:55:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syY5q-00065C-2W; Wed, 09 Oct 2024 14:55:14 +0000
Received: by outflank-mailman (input) for mailman id 814726;
 Wed, 09 Oct 2024 14: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 1syY5o-00064j-Ek
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14: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 1syY5o-0003KI-Cu
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syY5o-0003Y9-Ap
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=7bGtA1BQSZ++Ot7neFpqD4FgcAK55RTFs8IF2QP6Uhg=; b=PJhjwz5HQ+eYxO8hmW5um9fBcK
	VuuQDqYzd8ARQVuQsLBlBYGl8ntwcqKl3oA6qzlLjNNEEfww1+RhuG7WwLuorO8SoKyHc7w0lswOf
	LDjyuZhXrgofRNDR9BKC78zi0AvLfe7IRPJkn8IM7BBEhCzZYxsRbf8Wwqtx0kgIyHwU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] stubdom: explcitly add libc and lwip Mini-OS config options
Message-Id: <E1syY5o-0003Y9-Ap@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 14:55:12 +0000

commit c66c1341750beb6aa32cc2aeb4f80fddd2bcd490
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sat Oct 5 17:15:46 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 8 11:15:08 2024 +0100

    stubdom: explcitly add libc and lwip Mini-OS config options
    
    Today the Mini-OS build systems derives libc and lwip config options
    from the stubdom and LWIPDIR make variables supplied by the Xen build
    system.
    
    In order to prepare those being explicit Mini-OS config options, add
    them to the related stubdom Mini-OS config files.
    
    While at it remove the CONFIG_START_NETWORK setting from config files
    disabling lwip, as CONFIG_START_NETWORK requires lwip for becoming
    effective.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 stubdom/c/minios.cfg           | 2 ++
 stubdom/grub/minios.cfg        | 3 ++-
 stubdom/ioemu-minios.cfg       | 2 ++
 stubdom/vtpm/minios.cfg        | 3 ++-
 stubdom/vtpmmgr/minios.cfg     | 3 ++-
 stubdom/xenstore-minios.cfg    | 1 +
 stubdom/xenstorepvh-minios.cfg | 1 +
 7 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/stubdom/c/minios.cfg b/stubdom/c/minios.cfg
index e69de29bb2..56d65510cd 100644
--- a/stubdom/c/minios.cfg
+++ b/stubdom/c/minios.cfg
@@ -0,0 +1,2 @@
+CONFIG_LIBC=y
+CONFIG_LWIP=y
diff --git a/stubdom/grub/minios.cfg b/stubdom/grub/minios.cfg
index 8df49092cd..5145b357e0 100644
--- a/stubdom/grub/minios.cfg
+++ b/stubdom/grub/minios.cfg
@@ -1,3 +1,4 @@
-CONFIG_START_NETWORK=n
+CONFIG_LIBC=y
+CONFIG_LWIP=n
 CONFIG_SPARSE_BSS=n
 CONFIG_TPMFRONT=y
diff --git a/stubdom/ioemu-minios.cfg b/stubdom/ioemu-minios.cfg
index a65baa3765..6153ae05f8 100644
--- a/stubdom/ioemu-minios.cfg
+++ b/stubdom/ioemu-minios.cfg
@@ -1,3 +1,5 @@
+CONFIG_LIBC=y
+CONFIG_LWIP=y
 CONFIG_START_NETWORK=n
 CONFIG_QEMU_XS_ARGS=y
 CONFIG_PCIFRONT=y
diff --git a/stubdom/vtpm/minios.cfg b/stubdom/vtpm/minios.cfg
index 31652ee4f2..22f66f1351 100644
--- a/stubdom/vtpm/minios.cfg
+++ b/stubdom/vtpm/minios.cfg
@@ -1,7 +1,8 @@
+CONFIG_LIBC=y
+CONFIG_LWIP=n
 CONFIG_TPMFRONT=y
 CONFIG_TPM_TIS=n
 CONFIG_TPMBACK=y
-CONFIG_START_NETWORK=n
 CONFIG_TEST=n
 CONFIG_PCIFRONT=n
 CONFIG_BLKFRONT=y
diff --git a/stubdom/vtpmmgr/minios.cfg b/stubdom/vtpmmgr/minios.cfg
index 3fb383d30f..a9f13a2fd2 100644
--- a/stubdom/vtpmmgr/minios.cfg
+++ b/stubdom/vtpmmgr/minios.cfg
@@ -1,7 +1,8 @@
+CONFIG_LIBC=y
+CONFIG_LWIP=n
 CONFIG_TPMFRONT=y
 CONFIG_TPM_TIS=y
 CONFIG_TPMBACK=y
-CONFIG_START_NETWORK=n
 CONFIG_TEST=n
 CONFIG_PCIFRONT=n
 CONFIG_BLKFRONT=y
diff --git a/stubdom/xenstore-minios.cfg b/stubdom/xenstore-minios.cfg
index 239da519b9..0252b59432 100644
--- a/stubdom/xenstore-minios.cfg
+++ b/stubdom/xenstore-minios.cfg
@@ -1,3 +1,4 @@
+CONFIG_LIBC=y
 CONFIG_BLKFRONT=n
 CONFIG_NETFRONT=n
 CONFIG_FBFRONT=n
diff --git a/stubdom/xenstorepvh-minios.cfg b/stubdom/xenstorepvh-minios.cfg
index 752b90d7d3..62a228f33d 100644
--- a/stubdom/xenstorepvh-minios.cfg
+++ b/stubdom/xenstorepvh-minios.cfg
@@ -1,3 +1,4 @@
+CONFIG_LIBC=y
 CONFIG_PARAVIRT=n
 CONFIG_BLKFRONT=n
 CONFIG_NETFRONT=n
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 14:55:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 14:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814727.1228349 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syY60-00067w-6l; Wed, 09 Oct 2024 14:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814727.1228349; Wed, 09 Oct 2024 14:55:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syY60-00067p-40; Wed, 09 Oct 2024 14:55:24 +0000
Received: by outflank-mailman (input) for mailman id 814727;
 Wed, 09 Oct 2024 14: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 1syY5y-00067c-Jm
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14: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 1syY5y-0003KU-Fs
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syY5y-0003Yx-F2
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PIsUJ5xAsWQ1KiRpFJyeYfN+XgxDRjr+Grn0fh5cslc=; b=Asq7ewSsAhfyp0MSWjqEor+Ixd
	8C2el3xdBBv8xQhQwmexbJZLUcNcGazzJeV6LDtkTx+8VR6nITX+sGjx6yQJbuo/91LVj46nVxEo9
	tcMHgLXqWqnUvEmpKAvd1jPQEniSrnKPSlNWBiEV7Xy2J8L3E6du420vDzqbtyXZvhZ4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] build: move xenlibs-dependencies make definition to uselibs.mk
Message-Id: <E1syY5y-0003Yx-F2@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 14:55:22 +0000

commit 2d6a835b0559d0476f2a124338644ffd474966ce
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Sat Oct 5 17:15:47 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 8 11:15:08 2024 +0100

    build: move xenlibs-dependencies make definition to uselibs.mk
    
    In order to be able to use the xenlibs-dependencies macro from stubdom
    build, move it to tools/libs/uselibs.mk, which is included from
    current users and stubdom/Makefile.
    
    No functional change intended.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Anthony PERARD <anthony.perard@vates.tech>
---
 tools/Rules.mk        | 7 -------
 tools/libs/uselibs.mk | 7 +++++++
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/Rules.mk b/tools/Rules.mk
index e2289c25b4..6bd636709f 100644
--- a/tools/Rules.mk
+++ b/tools/Rules.mk
@@ -81,13 +81,6 @@ endif
 # include any CFLAGS or LDLIBS relating to libbar or libbaz unless
 # they use those libraries directly (not via libfoo) too.
 
-# Give the list of Xen library that the libraries in $(1) are linked against,
-# directly or indirectly.
-define xenlibs-dependencies
-    $(sort $(foreach lib,$(1), \
-        $(USELIBS_$(lib)) $(call xenlibs-dependencies,$(USELIBS_$(lib)))))
-endef
-
 # Flags for linking recursive dependencies of Xen libraries in $(1)
 define xenlibs-rpath
     $(addprefix -Wl$(comma)-rpath-link=$(XEN_ROOT)/tools/libs/,$(call xenlibs-dependencies,$(1)))
diff --git a/tools/libs/uselibs.mk b/tools/libs/uselibs.mk
index efd7a475ba..7aa8d83e06 100644
--- a/tools/libs/uselibs.mk
+++ b/tools/libs/uselibs.mk
@@ -31,3 +31,10 @@ USELIBS_light := toollog evtchn toolcore ctrl store hypfs guest
 LIBS_LIBS += util
 USELIBS_util := light
 FILENAME_util := xlutil
+
+# Give the list of Xen library that the libraries in $(1) are linked against,
+# directly or indirectly.
+define xenlibs-dependencies
+    $(sort $(foreach lib,$(1), \
+        $(USELIBS_$(lib)) $(call xenlibs-dependencies,$(USELIBS_$(lib)))))
+endef
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 14:55:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 14:55:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814728.1228353 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syY6A-0006AN-89; Wed, 09 Oct 2024 14:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814728.1228353; Wed, 09 Oct 2024 14:55:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syY6A-0006AF-5V; Wed, 09 Oct 2024 14:55:34 +0000
Received: by outflank-mailman (input) for mailman id 814728;
 Wed, 09 Oct 2024 14: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 1syY68-0006A3-Ja
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14: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 1syY68-0003Kx-Iz
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syY68-0003aH-I4
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=981xif1xAhx9Ok3T84ux094ZyQMFvyTRr/eWgaXEywM=; b=idY1EH4a9p87NfNRX95NCu2w8T
	SrhhE6ge5KmHawWUPFKjOM19i4s73XcrK3XTysRm6+y+sBcs+y9eOlLpk6f/0HLyfmO19VPmQHwEF
	Up/UtCAkTzRP/MSvSfHWIjFSuec+I4LZ0C/8veMspN+ou2UlA8lYhjEJPVdS/HLgqhmI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: Use standard C types in multiboot2.h header
Message-Id: <E1syY68-0003aH-I4@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 14:55:32 +0000

commit 79ade905b9b1875e5552946a8975615368ef7c8f
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Tue Oct 8 09:41:57 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 8 11:15:08 2024 +0100

    x86: Use standard C types in multiboot2.h header
    
    The header already uses standard types for many fields, extend
    their usage.
    No functional change.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/multiboot2.h | 62 ++++++++++++++++++++++----------------------
 1 file changed, 31 insertions(+), 31 deletions(-)

diff --git a/xen/include/xen/multiboot2.h b/xen/include/xen/multiboot2.h
index f792040205..7cda620eec 100644
--- a/xen/include/xen/multiboot2.h
+++ b/xen/include/xen/multiboot2.h
@@ -115,46 +115,46 @@
 
 #ifndef __ASSEMBLY__
 typedef struct {
-    u32 total_size;
-    u32 reserved;
+    uint32_t total_size;
+    uint32_t reserved;
 } multiboot2_fixed_t;
 
 typedef struct {
-    u32 type;
-    u32 size;
+    uint32_t type;
+    uint32_t size;
 } multiboot2_tag_t;
 
 typedef struct {
-    u32 type;
-    u32 size;
-    u32 load_base_addr;
+    uint32_t type;
+    uint32_t size;
+    uint32_t load_base_addr;
 } multiboot2_tag_load_base_addr_t;
 
 typedef struct {
-    u32 type;
-    u32 size;
+    uint32_t type;
+    uint32_t size;
     char string[];
 } multiboot2_tag_string_t;
 
 typedef struct {
-    u32 type;
-    u32 size;
-    u32 mem_lower;
-    u32 mem_upper;
+    uint32_t type;
+    uint32_t size;
+    uint32_t mem_lower;
+    uint32_t mem_upper;
 } multiboot2_tag_basic_meminfo_t;
 
 typedef struct {
-    u64 addr;
-    u64 len;
-    u32 type;
-    u32 zero;
+    uint64_t addr;
+    uint64_t len;
+    uint32_t type;
+    uint32_t zero;
 } multiboot2_memory_map_t;
 
 typedef struct {
-    u32 type;
-    u32 size;
-    u32 entry_size;
-    u32 entry_version;
+    uint32_t type;
+    uint32_t size;
+    uint32_t entry_size;
+    uint32_t entry_version;
     multiboot2_memory_map_t entries[];
 } multiboot2_tag_mmap_t;
 
@@ -212,22 +212,22 @@ typedef struct
 } multiboot2_tag_framebuffer_t;
 
 typedef struct {
-    u32 type;
-    u32 size;
-    u64 pointer;
+    uint32_t type;
+    uint32_t size;
+    uint64_t pointer;
 } multiboot2_tag_efi64_t;
 
 typedef struct {
-    u32 type;
-    u32 size;
-    u64 pointer;
+    uint32_t type;
+    uint32_t size;
+    uint64_t pointer;
 } multiboot2_tag_efi64_ih_t;
 
 typedef struct {
-    u32 type;
-    u32 size;
-    u32 mod_start;
-    u32 mod_end;
+    uint32_t type;
+    uint32_t size;
+    uint32_t mod_start;
+    uint32_t mod_end;
     char cmdline[];
 } multiboot2_tag_module_t;
 #endif /* __ASSEMBLY__ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 14:55:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 14:55:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814729.1228359 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syY6K-0006DU-BW; Wed, 09 Oct 2024 14:55:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814729.1228359; Wed, 09 Oct 2024 14: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 1syY6K-0006DL-6u; Wed, 09 Oct 2024 14:55:44 +0000
Received: by outflank-mailman (input) for mailman id 814729;
 Wed, 09 Oct 2024 14: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 1syY6I-0006D5-Ma
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14: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 1syY6I-0003Le-Lx
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syY6I-0003b6-L7
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NhDL9wkMA9aYbPxmGZEGqPzY92zO9ERXHIoLFs4gOX8=; b=ylJVgaGQvcONLgShe56xaqDibE
	Sk0wm18QR+7QlgZWgboRvVaAZC2J0oxotvotsjPDivTl7UCA9o6z6xc3g31Q5qJ+vkoYg0LA7WG0+
	UoY2TFK/if/mNLAWBwjFsEiSy5GoMVreqkY903iUGgmpZ3e0jGtOakIYrILm4HAQosEo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Drop bin86/dev86 from archlinux container
Message-Id: <E1syY6I-0003b6-L7@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 14:55:42 +0000

commit c1035b0463b73ff62e80b1e8f37aa5ba5348f779
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Jul 2 17:40:11 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 8 11:15:08 2024 +0100

    CI: Drop bin86/dev86 from archlinux container
    
    These packages have moved out of main to AUR, and are not easily accessible
    any more.  Drop them, because they're only needed for RomBIOS which is very
    legacy these days.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/archlinux/current.dockerfile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/automation/build/archlinux/current.dockerfile b/automation/build/archlinux/current.dockerfile
index 8929e9b5f0..657ddd77a8 100644
--- a/automation/build/archlinux/current.dockerfile
+++ b/automation/build/archlinux/current.dockerfile
@@ -6,10 +6,8 @@ LABEL maintainer.name="The Xen Project" \
 RUN pacman-key --init
 
 RUN pacman -S --refresh --sysupgrade --noconfirm --noprogressbar --needed \
-        bin86 \
         bridge-utils \
         bzip2 \
-        dev86 \
         discount \
         dtc \
         e2fsprogs \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 14:55:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 14:55:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814730.1228362 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syY6U-0006Fn-Bw; Wed, 09 Oct 2024 14:55:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814730.1228362; Wed, 09 Oct 2024 14: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 1syY6U-0006Fd-8P; Wed, 09 Oct 2024 14:55:54 +0000
Received: by outflank-mailman (input) for mailman id 814730;
 Wed, 09 Oct 2024 14: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 1syY6S-0006FT-Pb
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14: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 1syY6S-0003Lt-Ou
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syY6S-0003d5-O4
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:55:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nTAIvdiSqskL4zYSGTD3UUmWzoSITXgkNvqSU13eoBs=; b=bYi96QLUa1IFSpnMIqLWR0whoP
	YBHzyn1iXdC5+jXMfT2kY5FsOYZ0LFUa6GxDZRKL/zY1FwqfLkeMRHm9qYkEw7LON1TqYh4Al+9ly
	L72y3OmzD822q2nGwL8e9wk1kjk0wHiJ9ihEYOXRmIytmsWy2ddeml2tyDOSkxpxApug=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: use python-3.11 in Leap container
Message-Id: <E1syY6S-0003d5-O4@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 14:55:52 +0000

commit 16a81486c4cdafa8d881dec529a99e2441109872
Author:     Olaf Hering <olaf@aepfle.de>
AuthorDate: Mon Oct 7 17:25:09 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 8 12:15:31 2024 +0100

    automation: use python-3.11 in Leap container
    
    python311 is available since Leap 15.4 as additional Python variant.
    
    Signed-off-by: Olaf Hering <olaf@aepfle.de>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/opensuse/leap-15.6-x86_64.dockerfile | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/automation/build/opensuse/leap-15.6-x86_64.dockerfile b/automation/build/opensuse/leap-15.6-x86_64.dockerfile
index ea70dffe2a..97890dfc00 100644
--- a/automation/build/opensuse/leap-15.6-x86_64.dockerfile
+++ b/automation/build/opensuse/leap-15.6-x86_64.dockerfile
@@ -3,6 +3,7 @@ FROM --platform=linux/amd64 opensuse/leap:15.6
 LABEL maintainer.name="The Xen Project"
 LABEL maintainer.email="xen-devel@lists.xenproject.org"
 
+ENV PYTHON=python3.11
 ENV XEN_TARGET_ARCH=x86_64
 
 RUN <<EOF
@@ -25,7 +26,7 @@ RUN <<EOF
         gawk
         gcc
         make
-        python3
+        python311
 
         # Tools (general)
         git-core
@@ -53,8 +54,8 @@ RUN <<EOF
         # xentop
         'pkgconfig(ncurses)'
         # Python bindings
-        python3-devel
-        python3-setuptools
+        python311-devel
+        python311-setuptools
         # Ocaml bindings/oxenstored
         ocaml
         ocaml-findlib
@@ -68,7 +69,7 @@ RUN <<EOF
         ninja
         'pkgconfig(glib-2.0)'
         'pkgconfig(pixman-1)'
-        python3-packaging
+        python311-packaging
     )
 
     zypper install -y --no-recommends "${DEPS[@]}"
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 14:56:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 14:56:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814731.1228365 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syY6e-0006IZ-Ea; Wed, 09 Oct 2024 14:56:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814731.1228365; Wed, 09 Oct 2024 14: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 1syY6e-0006IR-Bw; Wed, 09 Oct 2024 14:56:04 +0000
Received: by outflank-mailman (input) for mailman id 814731;
 Wed, 09 Oct 2024 14: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 1syY6c-0006IH-SL
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14: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 1syY6c-0003ME-Ri
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syY6c-0003fI-R1
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:56:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0Gw3oZW0W22hm9GW8ENuv5s2iKNVx7FsGmAZWdgai3w=; b=B1n1vot5owqpjwlTZOwX3Cvwuz
	Y/wPBwTMreZEsZj4wOlAf6u08WJxaTEz8Q6clcLCtUMA31PqUIXKQkdyBPiaLmV/OqUlfaTdM+zga
	nIXFeQzLsiN7D3/yK20JznL3+nmE2T/wVEyNDndVrlsHxMDriR+vu02QaDBo/x/TG1YM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] .gitignore: Remove not generated files
Message-Id: <E1syY6c-0003fI-R1@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 14:56:02 +0000

commit 9ab0496350e6d8ea35465e7a5fadf94ff0838c0a
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Mon Oct 7 15:15:34 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 8 13:06:13 2024 +0100

    .gitignore: Remove not generated files
    
    Both reloc.S and cmdline.S are not generated since commit
    1ab7c128d9d1 ("x86/build: Don't convert boot/{cmdline,head}.bin back to .S")
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 .gitignore | 2 --
 1 file changed, 2 deletions(-)

diff --git a/.gitignore b/.gitignore
index 5c13fb5878..5d65bcd7bc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -213,8 +213,6 @@ xen/.config.old
 xen/.xen.elf32
 xen/System.map
 xen/arch/x86/boot/mkelf32
-xen/arch/x86/boot/cmdline.S
-xen/arch/x86/boot/reloc.S
 xen/arch/x86/boot/*.bin
 xen/arch/x86/boot/*.lnk
 xen/arch/x86/efi.lds
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 14:56:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 14:56:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814732.1228369 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syY6o-0006LX-GN; Wed, 09 Oct 2024 14:56:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814732.1228369; Wed, 09 Oct 2024 14: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 1syY6o-0006LQ-Dk; Wed, 09 Oct 2024 14:56:14 +0000
Received: by outflank-mailman (input) for mailman id 814732;
 Wed, 09 Oct 2024 14:56: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 1syY6m-0006LC-VF
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14: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 1syY6m-0003MP-Ub
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:56:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syY6m-0003h8-Tn
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:56:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=u28SuOYYsiynBj0HZVJqgY1H6dIeulthmACwM2zZn64=; b=5mkr1cZIAO69AKwheRDXZa9ekA
	lW77UDYaRNItHjxZJNCyRhzZL5H3JuDZ5AbEon/L4ysdbRlB6cpoLmo4mYwAcf7vEo4D26fR1vma+
	N4YCuNjW1fTxLSsexHS8RmZLhLMiv6XRl2rHSQwihhOnLXwQXuvFQfpS1UnpiaoMUrH8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Rationalise .gitignore
Message-Id: <E1syY6m-0003h8-Tn@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 14:56:12 +0000

commit 011814bd45c42720c9212dd61b65668c33c216d6
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Mon Oct 7 15:15:35 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 8 13:06:13 2024 +0100

    x86/boot: Rationalise .gitignore
    
    Strip all related content out of the root .gitignore, and provide a
    more local .gitignore's with up-to-date patterns.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 .gitignore                   | 3 ---
 xen/arch/x86/boot/.gitignore | 3 +++
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/.gitignore b/.gitignore
index 5d65bcd7bc..25484a8fd8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -212,9 +212,6 @@ xen/.config
 xen/.config.old
 xen/.xen.elf32
 xen/System.map
-xen/arch/x86/boot/mkelf32
-xen/arch/x86/boot/*.bin
-xen/arch/x86/boot/*.lnk
 xen/arch/x86/efi.lds
 xen/arch/x86/efi/check.efi
 xen/arch/x86/efi/mkreloc
diff --git a/xen/arch/x86/boot/.gitignore b/xen/arch/x86/boot/.gitignore
new file mode 100644
index 0000000000..a379db7988
--- /dev/null
+++ b/xen/arch/x86/boot/.gitignore
@@ -0,0 +1,3 @@
+/mkelf32
+/*.bin
+/*.lnk
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 14:56:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 14:56:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814733.1228373 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syY6y-0006Nr-Ho; Wed, 09 Oct 2024 14:56:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814733.1228373; Wed, 09 Oct 2024 14: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 1syY6y-0006Nj-FF; Wed, 09 Oct 2024 14:56:24 +0000
Received: by outflank-mailman (input) for mailman id 814733;
 Wed, 09 Oct 2024 14:56: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 1syY6x-0006NS-2B
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:56: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 1syY6x-0003MX-1V
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:56:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syY6x-0003i7-0W
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:56:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BfZyGch0Vu27ti9V3x+2FA8c8idmL/157BrTd9a0jTc=; b=pQTbaRHn944JxDAvQUjZZeUVZr
	A56yb7C/jKjsOhHnnpQKk4Ocyk6H3SY4IOU6Ee2DYk1/AoaVCYa/CKC27F8sjldPO8JsyNcIlK6s5
	F+WP7m4NBYvkXhn4SRpHitcza4uGrvmTWPI2kNKeodT0Qi4VFZV25pGI47XBvuruOLd4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ioreq: don't wrongly claim "success" in ioreq_send_buffered()
Message-Id: <E1syY6x-0003i7-0W@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 14:56:23 +0000

commit 2e0b545b847df7d4feb07308d50bad708bd35a66
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Oct 8 14:36:27 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 8 14:36:27 2024 +0200

    ioreq: don't wrongly claim "success" in ioreq_send_buffered()
    
    Returning a literal number is a bad idea anyway when all other returns
    use IOREQ_STATUS_* values. The function is dead on Arm, and mapping to
    X86EMUL_OKAY is surely wrong on x86.
    
    Fixes: f6bf39f84f82 ("x86/hvm: add support for broadcast of buffered ioreqs...")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/ioreq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/common/ioreq.c b/xen/common/ioreq.c
index 1257a3d972..f5fd30ce12 100644
--- a/xen/common/ioreq.c
+++ b/xen/common/ioreq.c
@@ -1175,7 +1175,7 @@ static int ioreq_send_buffered(struct ioreq_server *s, ioreq_t *p)
         return IOREQ_STATUS_UNHANDLED;
 
     /*
-     * Return 0 for the cases we can't deal with:
+     * Return UNHANDLED for the cases we can't deal with:
      *  - 'addr' is only a 20-bit field, so we cannot address beyond 1MB
      *  - we cannot buffer accesses to guest memory buffers, as the guest
      *    may expect the memory buffer to be synchronously accessed
@@ -1183,7 +1183,7 @@ static int ioreq_send_buffered(struct ioreq_server *s, ioreq_t *p)
      *    support data_is_ptr we do not waste space for the count field either
      */
     if ( (p->addr > 0xfffffUL) || p->data_is_ptr || (p->count != 1) )
-        return 0;
+        return IOREQ_STATUS_UNHANDLED;
 
     switch ( p->size )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 14:56:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 14:56:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814734.1228377 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syY78-0006Rt-JP; Wed, 09 Oct 2024 14:56:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814734.1228377; Wed, 09 Oct 2024 14:56:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syY78-0006Rl-Gd; Wed, 09 Oct 2024 14:56:34 +0000
Received: by outflank-mailman (input) for mailman id 814734;
 Wed, 09 Oct 2024 14:56: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 1syY77-0006RU-63
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:56: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 1syY77-0003Mg-5G
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:56:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syY77-0003jq-4J
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:56:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1NnRwfYzvV/nTxiKr2/0SwYR+9ZhBJu1SnrGCYgOL3k=; b=Oapdt4A3isk5URJT4y36YtSwOx
	xqI3rJ+OesCtj/PvONIxrDHJbbploeP0f1EQhH46q+1pmYinEQgD1bARjWrGTx3dnbfWegFwE5Hzx
	1NpziYPV9r+I7h9o4m5tSVVD5lyNACLsYIz3Oe1NwZI9PGVinsgoE5UG5Rs0moQIGZCg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/emul: add defensive code
Message-Id: <E1syY77-0003jq-4J@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 14:56:33 +0000

commit 7f743fac946bc6ebfbddf714827cca352edd7ace
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Tue Oct 8 14:36:59 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 8 14:36:59 2024 +0200

    x86/emul: add defensive code
    
    Add defensive code after unreachable program points.
    This also meets the requirements to deviate violations of MISRA C:2012
    Rule 16.3: "An unconditional `break' statement shall terminate every
    switch-clause".
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/x86_emulate/x86_emulate.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 0ea0d5e67e..6b6b8c8fe4 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -6840,6 +6840,7 @@ x86_emulate(
             break;
         default:
             ASSERT_UNREACHABLE();
+            goto unhandleable;
         }
         break;
 #ifdef HAVE_AS_SSE4_2
@@ -6868,6 +6869,7 @@ x86_emulate(
 # endif
         default:
             ASSERT_UNREACHABLE();
+            goto unhandleable;
         }
         break;
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 14:56:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 14:56:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814735.1228381 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syY7I-0006ZW-Ke; Wed, 09 Oct 2024 14:56:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814735.1228381; Wed, 09 Oct 2024 14:56:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syY7I-0006ZO-Hz; Wed, 09 Oct 2024 14:56:44 +0000
Received: by outflank-mailman (input) for mailman id 814735;
 Wed, 09 Oct 2024 14: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 1syY7H-0006Z0-92
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14: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 1syY7H-0003N3-8M
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:56:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syY7H-0003lC-7d
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:56:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gqo6idxct899PgHL8u7NEZpuLvc2O/K6IO05WX6q9xQ=; b=qOxjsLJ24JhR7ffBTgtUcXj1Rs
	TqmrT2WHCiJdZR2zNW3597hZMRcGB9ljv7DzHiTGyIzetiTgbc1M2dHZYWVOsacIucgJPsyVGHq3U
	9gs0MhgMP1/I76KfYrBTUJczY7yPYojIKU1OCxj6eMjvFqAhh75FDoUHvdYm+fyzdzbU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/pci: address a violation of MISRA C Rule 16.3
Message-Id: <E1syY7H-0003lC-7d@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 14:56:43 +0000

commit 7d83c392c7bfecdfcb7a91166cc75edd79e49a05
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Tue Oct 8 14:37:16 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 8 14:37:16 2024 +0200

    xen/pci: address a violation of MISRA C Rule 16.3
    
    Refactor the code to avoid an implicit fallthrough and address
    a violation of MISRA C:2012 Rule 16.3: "An unconditional `break'
    statement shall terminate every switch-clause".
    
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/drivers/passthrough/pci.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
index 5a446d3dce..74d3895e1e 100644
--- a/xen/drivers/passthrough/pci.c
+++ b/xen/drivers/passthrough/pci.c
@@ -170,8 +170,11 @@ static int __init cf_check parse_phantom_dev(const char *str)
     {
     case 1: case 2: case 4:
         if ( *s )
-    default:
             return -EINVAL;
+        break;
+
+    default:
+        return -EINVAL;
     }
 
     phantom_devs[nr_phantom_devs++] = phantom;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 14:56:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 14:56:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814736.1228385 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syY7S-0006lf-MF; Wed, 09 Oct 2024 14:56:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814736.1228385; Wed, 09 Oct 2024 14:56:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syY7S-0006lU-JW; Wed, 09 Oct 2024 14:56:54 +0000
Received: by outflank-mailman (input) for mailman id 814736;
 Wed, 09 Oct 2024 14: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 1syY7R-0006hB-Bv
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14: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 1syY7R-0003NA-BG
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:56:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syY7R-0003mS-AV
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:56:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fDxWLiqNaMMdlWrSltleO46wmlO+Tv0DtWiSnh7EBcA=; b=bt8AMQKuMcs9YpR7nsd3ShEEPM
	lkIQ0Okw6bMZkGL7jsGuWu6KEq0mqkqWGnA20LHCPFkDs6uxCyVu2M254PDZVPTmqC+g381RpE3dh
	DMbmE5iZQS5pb6d9p8+ki7+CmoAUE/zpFWYb3SsGECS8toyrssQKM3tgk9uo2ND+mmnM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: fusa: Replace VM with domain
Message-Id: <E1syY7R-0003mS-AV@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 14:56:53 +0000

commit 908c1b5efaa4c645728f4b885a008ef12da11476
Author:     Ayan Kumar Halder <ayan.kumar.halder@amd.com>
AuthorDate: Tue Oct 8 14:37:37 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 8 14:37:37 2024 +0200

    docs: fusa: Replace VM with domain
    
    We should use the word domain everywhere (instead of VM or guest).
    
    Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com>
    Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 docs/fusa/reqs/market-reqs/reqs.rst        | 26 +++++++++++++-------------
 docs/fusa/reqs/product-reqs/arm64/reqs.rst | 10 +++++-----
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/docs/fusa/reqs/market-reqs/reqs.rst b/docs/fusa/reqs/market-reqs/reqs.rst
index e98f348cf4..f456788d96 100644
--- a/docs/fusa/reqs/market-reqs/reqs.rst
+++ b/docs/fusa/reqs/market-reqs/reqs.rst
@@ -3,13 +3,13 @@
 Functional Requirements
 =======================
 
-Run Arm64 VMs
--------------
+Run Arm64 domains
+-----------------
 
-`XenMkt~run_arm64_vms~1`
+`XenMkt~run_arm64_domains~1`
 
 Description:
-Xen shall run Arm64 VMs.
+Xen shall run Arm64 domains.
 
 Rationale:
 
@@ -18,13 +18,13 @@ Comments:
 Needs:
  - XenProd
 
-Provide timer to the VMs
-------------------------
+Provide timer to the domains
+----------------------------
 
-`XenMkt~provide_timer_vms~1`
+`XenMkt~provide_timer_domains~1`
 
 Description:
-Xen shall provide a timer to a VM.
+Xen shall provide a timer to a domain.
 
 Rationale:
 
@@ -33,17 +33,17 @@ Comments:
 Needs:
  - XenProd
 
-Provide console to the VMs
---------------------------
+Provide console to the domains
+------------------------------
 
-`XenMkt~provide_console_vms~1`
+`XenMkt~provide_console_domains~1`
 
 Description:
-Xen shall provide a console to a VM.
+Xen shall provide a console to a domain.
 
 Rationale:
 
 Comments:
 
 Needs:
- - XenProd
\ No newline at end of file
+ - XenProd
diff --git a/docs/fusa/reqs/product-reqs/arm64/reqs.rst b/docs/fusa/reqs/product-reqs/arm64/reqs.rst
index 97e90813ec..db91c47a02 100644
--- a/docs/fusa/reqs/product-reqs/arm64/reqs.rst
+++ b/docs/fusa/reqs/product-reqs/arm64/reqs.rst
@@ -16,8 +16,8 @@ Rationale:
 Comments:
 
 Covers:
- - `XenMkt~run_arm64_vms~1`
- - `XenMkt~provide_timer_vms~1`
+ - `XenMkt~run_arm64_domains~1`
+ - `XenMkt~provide_timer_domains~1`
 
 Needs:
  - XenSwdgn
@@ -35,8 +35,8 @@ Rationale:
 Comments:
 
 Covers:
- - `XenMkt~run_arm64_vms~1`
- - `XenMkt~provide_console_vms~1`
+ - `XenMkt~run_arm64_domains~1`
+ - `XenMkt~provide_console_domains~1`
 
 Needs:
- - XenSwdgn
\ No newline at end of file
+ - XenSwdgn
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 09 14:57:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 09 Oct 2024 14:57:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.814737.1228390 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syY7c-0006pc-P0; Wed, 09 Oct 2024 14:57:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 814737.1228390; Wed, 09 Oct 2024 14:57:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syY7c-0006pU-Kw; Wed, 09 Oct 2024 14:57:04 +0000
Received: by outflank-mailman (input) for mailman id 814737;
 Wed, 09 Oct 2024 14: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 1syY7b-0006pH-Ep
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14: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 1syY7b-0003NU-EB
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:57:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syY7b-0003nc-DP
 for xen-changelog@lists.xenproject.org; Wed, 09 Oct 2024 14:57:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bSznrPiezTJYBsFXFGhPFiv/ScffJElaJ/BYE0H9JWA=; b=ZDzSaWR04cLmoVr3wfyShLBend
	L8MDTH3mNk7kC08JdOZoKEzNDirU2F8fBPR/EnSaIJYvua1vulkFBO67yU0IaNPAnrlhZx1dh7jih
	hsQAMymkWk/uB4QvOo7OPH8a2J9sG5M9NcvJldGjqey+8jWME+sIBinK53eviy2UVKKc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/domctl: fix maximum number of MSRs in XEN_DOMCTL_{get,set}_vcpu_msrs
Message-Id: <E1syY7b-0003nc-DP@xenbits.xenproject.org>
Date: Wed, 09 Oct 2024 14:57:03 +0000

commit c95cd5f9c5a8c1c6ab1b0b366d829fa8561958fd
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Oct 8 14:37:53 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 8 14:37:53 2024 +0200

    x86/domctl: fix maximum number of MSRs in XEN_DOMCTL_{get,set}_vcpu_msrs
    
    Since the addition of the MSR_AMD64_DR{1-4}_ADDRESS_MASK MSRs to the
    msrs_to_send array, the calculations for the maximum number of MSRs that
    the hypercall can handle is off by 4.
    
    Remove the addition of 4 to the maximum number of MSRs that
    XEN_DOMCTL_{set,get}_vcpu_msrs supports, as those are already part of the
    array.
    
    A further adjustment could be to subtract 4 from the maximum size if the DBEXT
    CPUID feature is not exposed to the guest, but guest_{rd,wr}msr() will already
    perform that check when fetching or loading the MSRs.  The maximum array is
    used to indicate the caller of the buffer it needs to allocate in the get case,
    and as an early input sanitation in the set case, using a buffer size slightly
    lager than required is not an issue.
    
    Fixes: 86d47adcd3c4 ('x86/msr: Handle MSR_AMD64_DR{0-3}_ADDRESS_MASK in the new MSR infrastructure')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domctl.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 96d816cf1a..27d5b3f3d6 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1088,10 +1088,6 @@ long arch_do_domctl(
              !is_pv_domain(d) )
             break;
 
-        /* Count maximum number of optional msrs. */
-        if ( boot_cpu_has(X86_FEATURE_DBEXT) )
-            nr_msrs += 4;
-
         if ( domctl->cmd == XEN_DOMCTL_get_vcpu_msrs )
         {
             ret = 0; copyback = true;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:44:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815471.1229223 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symu5-0001cB-3E; Thu, 10 Oct 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 815471.1229223; Thu, 10 Oct 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 1symu5-0001c3-0V; Thu, 10 Oct 2024 06:44:05 +0000
Received: by outflank-mailman (input) for mailman id 815471;
 Thu, 10 Oct 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 1symu3-0001bv-9g
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 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 1symu3-0004i4-8w
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 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 1symu3-0001rG-6o
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 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=KLtbCMHZRc/3gPbwlZoPH0TLfx61aTLL1LiJbS2rWWM=; b=yhQA5zKPZcXuudEmA27MeyJs0v
	3iijOKgX8cbkSwdZP4BL6VkAAKzmTEf8a6Xe9z8olDd8ZSYYXww2yQ+zZyM1YFgmbcSJwDeZRkxz5
	//YVIpwnaWNJ1cVQeiSuXeBP6Eg5pvH/vbn9cavd4ZJNOAhPKzqDT5f37qzYKYve24wY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] memory: prevent dma-reentracy issues
Message-Id: <E1symu3-0001rG-6o@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:44:03 +0000

commit a08c78dda7e018fbbe33bc7979f7a53f89a488b5
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:06 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:01:33 2023 +0300

    memory: prevent dma-reentracy issues
    
    Add a flag to the DeviceState, when a device is engaged in PIO/MMIO/DMA.
    This flag is set/checked prior to calling a device's MemoryRegion
    handlers, and set when device code initiates DMA.  The purpose of this
    flag is to prevent two types of DMA-based reentrancy issues:
    
    1.) mmio -> dma -> mmio case
    2.) bh -> dma write -> mmio case
    
    These issues have led to problems such as stack-exhaustion and
    use-after-frees.
    
    Summary of the problem from Peter Maydell:
    https://lore.kernel.org/qemu-devel/CAFEAcA_23vc7hE3iaM-JVA6W38LK4hJoWae5KcknhPRD5fPBZA@mail.gmail.com
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/62
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/540
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/541
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/556
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/557
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/827
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1282
    Resolves: CVE-2023-0330
    
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Message-Id: <20230427211013.2994127-2-alxndr@bu.edu>
    [thuth: Replace warn_report() with warn_report_once()]
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit a2e1753b8054344f32cf94f31c6399a58794a380)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 include/exec/memory.h  |  5 +++++
 include/hw/qdev-core.h |  7 +++++++
 softmmu/memory.c       | 16 ++++++++++++++++
 3 files changed, 28 insertions(+)

diff --git a/include/exec/memory.h b/include/exec/memory.h
index 15ade918ba..e45ce6061f 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -767,6 +767,8 @@ struct MemoryRegion {
     bool is_iommu;
     RAMBlock *ram_block;
     Object *owner;
+    /* owner as TYPE_DEVICE. Used for re-entrancy checks in MR access hotpath */
+    DeviceState *dev;
 
     const MemoryRegionOps *ops;
     void *opaque;
@@ -791,6 +793,9 @@ struct MemoryRegion {
     unsigned ioeventfd_nb;
     MemoryRegionIoeventfd *ioeventfds;
     RamDiscardManager *rdm; /* Only for RAM */
+
+    /* For devices designed to perform re-entrant IO into their own IO MRs */
+    bool disable_reentrancy_guard;
 };
 
 struct IOMMUMemoryRegion {
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index bd50ad5ee1..7623703943 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -162,6 +162,10 @@ struct NamedClockList {
     QLIST_ENTRY(NamedClockList) node;
 };
 
+typedef struct {
+    bool engaged_in_io;
+} MemReentrancyGuard;
+
 /**
  * DeviceState:
  * @realized: Indicates whether the device has been fully constructed.
@@ -194,6 +198,9 @@ struct DeviceState {
     int alias_required_for_version;
     ResettableState reset;
     GSList *unplug_blockers;
+
+    /* Is the device currently in mmio/pio/dma? Used to prevent re-entrancy */
+    MemReentrancyGuard mem_reentrancy_guard;
 };
 
 struct DeviceListener {
diff --git a/softmmu/memory.c b/softmmu/memory.c
index b1a6cae6f5..b7b3386e9d 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -542,6 +542,18 @@ static MemTxResult access_with_adjusted_size(hwaddr addr,
         access_size_max = 4;
     }
 
+    /* Do not allow more than one simultaneous access to a device's IO Regions */
+    if (mr->dev && !mr->disable_reentrancy_guard &&
+        !mr->ram_device && !mr->ram && !mr->rom_device && !mr->readonly) {
+        if (mr->dev->mem_reentrancy_guard.engaged_in_io) {
+            warn_report_once("Blocked re-entrant IO on MemoryRegion: "
+                             "%s at addr: 0x%" HWADDR_PRIX,
+                             memory_region_name(mr), addr);
+            return MEMTX_ACCESS_ERROR;
+        }
+        mr->dev->mem_reentrancy_guard.engaged_in_io = true;
+    }
+
     /* FIXME: support unaligned access? */
     access_size = MAX(MIN(size, access_size_max), access_size_min);
     access_mask = MAKE_64BIT_MASK(0, access_size * 8);
@@ -556,6 +568,9 @@ static MemTxResult access_with_adjusted_size(hwaddr addr,
                         access_mask, attrs);
         }
     }
+    if (mr->dev) {
+        mr->dev->mem_reentrancy_guard.engaged_in_io = false;
+    }
     return r;
 }
 
@@ -1170,6 +1185,7 @@ static void memory_region_do_init(MemoryRegion *mr,
     }
     mr->name = g_strdup(name);
     mr->owner = owner;
+    mr->dev = (DeviceState *) object_dynamic_cast(mr->owner, TYPE_DEVICE);
     mr->ram_block = NULL;
 
     if (name) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:44:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:44:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815472.1229228 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symuE-0001el-6F; Thu, 10 Oct 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 815472.1229228; Thu, 10 Oct 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 1symuE-0001ed-3o; Thu, 10 Oct 2024 06:44:14 +0000
Received: by outflank-mailman (input) for mailman id 815472;
 Thu, 10 Oct 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 1symuD-0001eQ-F5
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 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 1symuD-0004iB-DA
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 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 1symuD-0001s0-BZ
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 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=HGcEmg3PR5eJh5x3d0TD7psr0F9QSQhht7NVsRAEkLQ=; b=UEOF9Qvp+vfeucRTQekBoQQola
	ca5nCSwITzMdpyZdTryF4C05o16KA1s/xhkscSUKZZSE6fKS31rAGkflK/Y3HwDfITA/gd1AJT9/Y
	ahPkBxHM6VLmHApQ+FBNQSU/QpzEVjOEAMEWH4l3+6GbZSu+smtDNaSLCxr2hShUWIv0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] async: Add an optional reentrancy guard to the BH API
Message-Id: <E1symuD-0001s0-BZ@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:44:13 +0000

commit 932cf49f0620544d1fb37f1d8dd02219a3636ee9
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:07 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:01:33 2023 +0300

    async: Add an optional reentrancy guard to the BH API
    
    Devices can pass their MemoryReentrancyGuard (from their DeviceState),
    when creating new BHes. Then, the async API will toggle the guard
    before/after calling the BH call-back. This prevents bh->mmio reentrancy
    issues.
    
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Message-Id: <20230427211013.2994127-3-alxndr@bu.edu>
    [thuth: Fix "line over 90 characters" checkpatch.pl error]
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 9c86c97f12c060bf7484dd931f38634e166a81f0)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 docs/devel/multiple-iothreads.txt |  7 +++++++
 include/block/aio.h               | 18 ++++++++++++++++--
 include/qemu/main-loop.h          |  7 +++++--
 tests/unit/ptimer-test-stubs.c    |  3 ++-
 util/async.c                      | 18 +++++++++++++++++-
 util/main-loop.c                  |  6 ++++--
 util/trace-events                 |  1 +
 7 files changed, 52 insertions(+), 8 deletions(-)

diff --git a/docs/devel/multiple-iothreads.txt b/docs/devel/multiple-iothreads.txt
index 343120f2ef..a3e949f6b3 100644
--- a/docs/devel/multiple-iothreads.txt
+++ b/docs/devel/multiple-iothreads.txt
@@ -61,6 +61,7 @@ There are several old APIs that use the main loop AioContext:
  * LEGACY qemu_aio_set_event_notifier() - monitor an event notifier
  * LEGACY timer_new_ms() - create a timer
  * LEGACY qemu_bh_new() - create a BH
+ * LEGACY qemu_bh_new_guarded() - create a BH with a device re-entrancy guard
  * LEGACY qemu_aio_wait() - run an event loop iteration
 
 Since they implicitly work on the main loop they cannot be used in code that
@@ -72,8 +73,14 @@ Instead, use the AioContext functions directly (see include/block/aio.h):
  * aio_set_event_notifier() - monitor an event notifier
  * aio_timer_new() - create a timer
  * aio_bh_new() - create a BH
+ * aio_bh_new_guarded() - create a BH with a device re-entrancy guard
  * aio_poll() - run an event loop iteration
 
+The qemu_bh_new_guarded/aio_bh_new_guarded APIs accept a "MemReentrancyGuard"
+argument, which is used to check for and prevent re-entrancy problems. For
+BHs associated with devices, the reentrancy-guard is contained in the
+corresponding DeviceState and named "mem_reentrancy_guard".
+
 The AioContext can be obtained from the IOThread using
 iothread_get_aio_context() or for the main loop using qemu_get_aio_context().
 Code that takes an AioContext argument works both in IOThreads or the main
diff --git a/include/block/aio.h b/include/block/aio.h
index 543717f294..db6f23c619 100644
--- a/include/block/aio.h
+++ b/include/block/aio.h
@@ -23,6 +23,8 @@
 #include "qemu/thread.h"
 #include "qemu/timer.h"
 #include "block/graph-lock.h"
+#include "hw/qdev-core.h"
+
 
 typedef struct BlockAIOCB BlockAIOCB;
 typedef void BlockCompletionFunc(void *opaque, int ret);
@@ -331,9 +333,11 @@ void aio_bh_schedule_oneshot_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
  * is opaque and must be allocated prior to its use.
  *
  * @name: A human-readable identifier for debugging purposes.
+ * @reentrancy_guard: A guard set when entering a cb to prevent
+ * device-reentrancy issues
  */
 QEMUBH *aio_bh_new_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
-                        const char *name);
+                        const char *name, MemReentrancyGuard *reentrancy_guard);
 
 /**
  * aio_bh_new: Allocate a new bottom half structure
@@ -342,7 +346,17 @@ QEMUBH *aio_bh_new_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
  * string.
  */
 #define aio_bh_new(ctx, cb, opaque) \
-    aio_bh_new_full((ctx), (cb), (opaque), (stringify(cb)))
+    aio_bh_new_full((ctx), (cb), (opaque), (stringify(cb)), NULL)
+
+/**
+ * aio_bh_new_guarded: Allocate a new bottom half structure with a
+ * reentrancy_guard
+ *
+ * A convenience wrapper for aio_bh_new_full() that uses the cb as the name
+ * string.
+ */
+#define aio_bh_new_guarded(ctx, cb, opaque, guard) \
+    aio_bh_new_full((ctx), (cb), (opaque), (stringify(cb)), guard)
 
 /**
  * aio_notify: Force processing of pending events.
diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h
index b3e54e00bc..68e70e61aa 100644
--- a/include/qemu/main-loop.h
+++ b/include/qemu/main-loop.h
@@ -387,9 +387,12 @@ void qemu_cond_timedwait_iothread(QemuCond *cond, int ms);
 
 /* internal interfaces */
 
+#define qemu_bh_new_guarded(cb, opaque, guard) \
+    qemu_bh_new_full((cb), (opaque), (stringify(cb)), guard)
 #define qemu_bh_new(cb, opaque) \
-    qemu_bh_new_full((cb), (opaque), (stringify(cb)))
-QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name);
+    qemu_bh_new_full((cb), (opaque), (stringify(cb)), NULL)
+QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name,
+                         MemReentrancyGuard *reentrancy_guard);
 void qemu_bh_schedule_idle(QEMUBH *bh);
 
 enum {
diff --git a/tests/unit/ptimer-test-stubs.c b/tests/unit/ptimer-test-stubs.c
index f2bfcede93..8c9407c560 100644
--- a/tests/unit/ptimer-test-stubs.c
+++ b/tests/unit/ptimer-test-stubs.c
@@ -107,7 +107,8 @@ int64_t qemu_clock_deadline_ns_all(QEMUClockType type, int attr_mask)
     return deadline;
 }
 
-QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name)
+QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name,
+                         MemReentrancyGuard *reentrancy_guard)
 {
     QEMUBH *bh = g_new(QEMUBH, 1);
 
diff --git a/util/async.c b/util/async.c
index 856e1a8a33..9df7674b4e 100644
--- a/util/async.c
+++ b/util/async.c
@@ -65,6 +65,7 @@ struct QEMUBH {
     void *opaque;
     QSLIST_ENTRY(QEMUBH) next;
     unsigned flags;
+    MemReentrancyGuard *reentrancy_guard;
 };
 
 /* Called concurrently from any thread */
@@ -137,7 +138,7 @@ void aio_bh_schedule_oneshot_full(AioContext *ctx, QEMUBHFunc *cb,
 }
 
 QEMUBH *aio_bh_new_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
-                        const char *name)
+                        const char *name, MemReentrancyGuard *reentrancy_guard)
 {
     QEMUBH *bh;
     bh = g_new(QEMUBH, 1);
@@ -146,13 +147,28 @@ QEMUBH *aio_bh_new_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
         .cb = cb,
         .opaque = opaque,
         .name = name,
+        .reentrancy_guard = reentrancy_guard,
     };
     return bh;
 }
 
 void aio_bh_call(QEMUBH *bh)
 {
+    bool last_engaged_in_io = false;
+
+    if (bh->reentrancy_guard) {
+        last_engaged_in_io = bh->reentrancy_guard->engaged_in_io;
+        if (bh->reentrancy_guard->engaged_in_io) {
+            trace_reentrant_aio(bh->ctx, bh->name);
+        }
+        bh->reentrancy_guard->engaged_in_io = true;
+    }
+
     bh->cb(bh->opaque);
+
+    if (bh->reentrancy_guard) {
+        bh->reentrancy_guard->engaged_in_io = last_engaged_in_io;
+    }
 }
 
 /* Multiple occurrences of aio_bh_poll cannot be called concurrently. */
diff --git a/util/main-loop.c b/util/main-loop.c
index e180c85145..7022f02ef8 100644
--- a/util/main-loop.c
+++ b/util/main-loop.c
@@ -605,9 +605,11 @@ void main_loop_wait(int nonblocking)
 
 /* Functions to operate on the main QEMU AioContext.  */
 
-QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name)
+QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name,
+                         MemReentrancyGuard *reentrancy_guard)
 {
-    return aio_bh_new_full(qemu_aio_context, cb, opaque, name);
+    return aio_bh_new_full(qemu_aio_context, cb, opaque, name,
+                           reentrancy_guard);
 }
 
 /*
diff --git a/util/trace-events b/util/trace-events
index 16f78d8fe5..3f7e766683 100644
--- a/util/trace-events
+++ b/util/trace-events
@@ -11,6 +11,7 @@ poll_remove(void *ctx, void *node, int fd) "ctx %p node %p fd %d"
 # async.c
 aio_co_schedule(void *ctx, void *co) "ctx %p co %p"
 aio_co_schedule_bh_cb(void *ctx, void *co) "ctx %p co %p"
+reentrant_aio(void *ctx, const char *name) "ctx %p name %s"
 
 # thread-pool.c
 thread_pool_submit(void *pool, void *req, void *opaque) "pool %p req %p opaque %p"
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:44:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:44:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815473.1229231 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symuO-0001hM-7q; Thu, 10 Oct 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 815473.1229231; Thu, 10 Oct 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 1symuO-0001hE-5G; Thu, 10 Oct 2024 06:44:24 +0000
Received: by outflank-mailman (input) for mailman id 815473;
 Thu, 10 Oct 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 1symuN-0001h3-H4
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 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 1symuN-0004iM-GK
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 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 1symuN-0001u1-FR
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 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=eY7X2rcTW/Q1DxXdIENodScruWLSWqbLoQBBFeWMU/s=; b=SF+RPsAb5yjTBLhDm4R5ok6FkS
	qGxOT+YfatQSiq42VCZIOVmCG97UIkapdFnNDTKhul4cpT9kKFWsaxrfejSoQCOI886xEyMKPgMvS
	n615CogfscAyY3xRkNyW9K3qT2j0dTemnsMRGNBHMoyN+6jKd73LMm95/UIJv5F6unoY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] async: avoid use-after-free on re-entrancy guard
Message-Id: <E1symuN-0001u1-FR@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:44:23 +0000

commit 6a33d4b3453b46ee3fd432d80374f45919985b00
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Mon May 1 10:19:56 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    async: avoid use-after-free on re-entrancy guard
    
    A BH callback can free the BH, causing a use-after-free in aio_bh_call.
    Fix that by keeping a local copy of the re-entrancy guard pointer.
    
    Buglink: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58513
    Fixes: 9c86c97f12 ("async: Add an optional reentrancy guard to the BH API")
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Message-Id: <20230501141956.3444868-1-alxndr@bu.edu>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 7915bd06f25e1803778081161bf6fa10c42dc7cd)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 util/async.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/util/async.c b/util/async.c
index 9df7674b4e..055070ffbd 100644
--- a/util/async.c
+++ b/util/async.c
@@ -156,18 +156,20 @@ void aio_bh_call(QEMUBH *bh)
 {
     bool last_engaged_in_io = false;
 
-    if (bh->reentrancy_guard) {
-        last_engaged_in_io = bh->reentrancy_guard->engaged_in_io;
-        if (bh->reentrancy_guard->engaged_in_io) {
+    /* Make a copy of the guard-pointer as cb may free the bh */
+    MemReentrancyGuard *reentrancy_guard = bh->reentrancy_guard;
+    if (reentrancy_guard) {
+        last_engaged_in_io = reentrancy_guard->engaged_in_io;
+        if (reentrancy_guard->engaged_in_io) {
             trace_reentrant_aio(bh->ctx, bh->name);
         }
-        bh->reentrancy_guard->engaged_in_io = true;
+        reentrancy_guard->engaged_in_io = true;
     }
 
     bh->cb(bh->opaque);
 
-    if (bh->reentrancy_guard) {
-        bh->reentrancy_guard->engaged_in_io = last_engaged_in_io;
+    if (reentrancy_guard) {
+        reentrancy_guard->engaged_in_io = last_engaged_in_io;
     }
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:44:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:44:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815474.1229236 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symuY-0001kH-9f; Thu, 10 Oct 2024 06:44:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815474.1229236; Thu, 10 Oct 2024 06: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 1symuY-0001k9-6e; Thu, 10 Oct 2024 06:44:34 +0000
Received: by outflank-mailman (input) for mailman id 815474;
 Thu, 10 Oct 2024 06: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 1symuX-0001jx-LD
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06: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 1symuX-0004ie-KZ
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:44:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symuX-0001v1-Ia
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06: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=CTFyLlNki2tWHBa+mtQCdhUQigKjnQl7Ct5ozQMyrzY=; b=e9ht60QVvqWLOlbJ/FFOS3F1XG
	HzhMAJjCJbbiQMhGWqYyTI7TE9tVATFoDQVYWEgA67Z1IG4Og/+EOhMMk+T8X3TMYhmsY225TgQaw
	He70ApssIAYrFe66u+Y8W8j4xTywHIRGoZMuH6ZSXjO8hsJJ1ZitO3aJ7yjZJc3NsT98=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] checkpatch: add qemu_bh_new/aio_bh_new checks
Message-Id: <E1symuX-0001v1-Ia@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:44:33 +0000

commit db56206f785909aa830e2a19336bb12abca50e82
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:08 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    checkpatch: add qemu_bh_new/aio_bh_new checks
    
    Advise authors to use the _guarded versions of the APIs, instead.
    
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Message-Id: <20230427211013.2994127-4-alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit ef56ffbdd6b0605dc1e305611287b948c970e236)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 scripts/checkpatch.pl | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d768171dcf..eeaec436eb 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2865,6 +2865,14 @@ sub process {
 		if ($line =~ /\bsignal\s*\(/ && !($line =~ /SIG_(?:IGN|DFL)/)) {
 			ERROR("use sigaction to establish signal handlers; signal is not portable\n" . $herecurr);
 		}
+# recommend qemu_bh_new_guarded instead of qemu_bh_new
+        if ($realfile =~ /.*\/hw\/.*/ && $line =~ /\bqemu_bh_new\s*\(/) {
+			ERROR("use qemu_bh_new_guarded() instead of qemu_bh_new() to avoid reentrancy problems\n" . $herecurr);
+		}
+# recommend aio_bh_new_guarded instead of aio_bh_new
+        if ($realfile =~ /.*\/hw\/.*/ && $line =~ /\baio_bh_new\s*\(/) {
+			ERROR("use aio_bh_new_guarded() instead of aio_bh_new() to avoid reentrancy problems\n" . $herecurr);
+		}
 # check for module_init(), use category-specific init macros explicitly please
 		if ($line =~ /^module_init\s*\(/) {
 			ERROR("please use block_init(), type_init() etc. instead of module_init()\n" . $herecurr);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:44:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:44:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815475.1229240 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symui-0001nG-B5; Thu, 10 Oct 2024 06:44:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815475.1229240; Thu, 10 Oct 2024 06: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 1symui-0001n9-8H; Thu, 10 Oct 2024 06:44:44 +0000
Received: by outflank-mailman (input) for mailman id 815475;
 Thu, 10 Oct 2024 06: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 1symuh-0001n3-QE
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06: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 1symuh-0004ir-PS
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:44:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symuh-0001vf-OW
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06: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=qLKzFue8p1GqrzekQMD16EA1r4mzvjrlJ6K/ZEhv4WE=; b=1S9QLz017ed3FKoefKKxlVaPUR
	lzu4/0nZhw89W1I6f4q4jL4WFCQ/Bn2DNT77mpwh+Tf+YjTPUBSImytxju62Y0s4izsTpJiW7nPRb
	8TChmKqpMIuI0XjEeHVD3k7/aSeIBsxasfiyCJNR2zu4Ke7SCxlLxCUMS/sJhciWK5ko=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw: replace most qemu_bh_new calls with qemu_bh_new_guarded
Message-Id: <E1symuh-0001vf-OW@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:44:43 +0000

commit fd9de51ea3f109d427bced84d80815a97bb7faa0
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:09 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    hw: replace most qemu_bh_new calls with qemu_bh_new_guarded
    
    This protects devices from bh->mmio reentrancy issues.
    
    Thanks: Thomas Huth <thuth@redhat.com> for diagnosing OS X test failure.
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Message-Id: <20230427211013.2994127-5-alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit f63192b0544af5d3e4d5edfd85ab520fcf671377)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/9pfs/xen-9p-backend.c        | 5 ++++-
 hw/block/dataplane/virtio-blk.c | 3 ++-
 hw/block/dataplane/xen-block.c  | 5 +++--
 hw/char/virtio-serial-bus.c     | 3 ++-
 hw/display/qxl.c                | 9 ++++++---
 hw/display/virtio-gpu.c         | 6 ++++--
 hw/ide/ahci.c                   | 3 ++-
 hw/ide/ahci_internal.h          | 1 +
 hw/ide/core.c                   | 4 +++-
 hw/misc/imx_rngc.c              | 6 ++++--
 hw/misc/macio/mac_dbdma.c       | 2 +-
 hw/net/virtio-net.c             | 3 ++-
 hw/nvme/ctrl.c                  | 6 ++++--
 hw/scsi/mptsas.c                | 3 ++-
 hw/scsi/scsi-bus.c              | 3 ++-
 hw/scsi/vmw_pvscsi.c            | 3 ++-
 hw/usb/dev-uas.c                | 3 ++-
 hw/usb/hcd-dwc2.c               | 3 ++-
 hw/usb/hcd-ehci.c               | 3 ++-
 hw/usb/hcd-uhci.c               | 2 +-
 hw/usb/host-libusb.c            | 6 ++++--
 hw/usb/redirect.c               | 6 ++++--
 hw/usb/xen-usb.c                | 3 ++-
 hw/virtio/virtio-balloon.c      | 5 +++--
 hw/virtio/virtio-crypto.c       | 3 ++-
 25 files changed, 66 insertions(+), 33 deletions(-)

diff --git a/hw/9pfs/xen-9p-backend.c b/hw/9pfs/xen-9p-backend.c
index 382be1ab11..4aa9c8c736 100644
--- a/hw/9pfs/xen-9p-backend.c
+++ b/hw/9pfs/xen-9p-backend.c
@@ -63,6 +63,7 @@ typedef struct Xen9pfsDev {
 
     int num_rings;
     Xen9pfsRing *rings;
+    MemReentrancyGuard mem_reentrancy_guard;
 } Xen9pfsDev;
 
 static void xen_9pfs_disconnect(struct XenLegacyDevice *xendev);
@@ -450,7 +451,9 @@ static int xen_9pfs_connect(struct XenLegacyDevice *xendev)
         xen_9pdev->rings[i].ring.out = xen_9pdev->rings[i].data +
                                        XEN_FLEX_RING_SIZE(ring_order);
 
-        xen_9pdev->rings[i].bh = qemu_bh_new(xen_9pfs_bh, &xen_9pdev->rings[i]);
+        xen_9pdev->rings[i].bh = qemu_bh_new_guarded(xen_9pfs_bh,
+                                                     &xen_9pdev->rings[i],
+                                                     &xen_9pdev->mem_reentrancy_guard);
         xen_9pdev->rings[i].out_cons = 0;
         xen_9pdev->rings[i].out_size = 0;
         xen_9pdev->rings[i].inprogress = false;
diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
index b28d81737e..a6202997ee 100644
--- a/hw/block/dataplane/virtio-blk.c
+++ b/hw/block/dataplane/virtio-blk.c
@@ -127,7 +127,8 @@ bool virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *conf,
     } else {
         s->ctx = qemu_get_aio_context();
     }
-    s->bh = aio_bh_new(s->ctx, notify_guest_bh, s);
+    s->bh = aio_bh_new_guarded(s->ctx, notify_guest_bh, s,
+                               &DEVICE(vdev)->mem_reentrancy_guard);
     s->batch_notify_vqs = bitmap_new(conf->num_queues);
 
     *dataplane = s;
diff --git a/hw/block/dataplane/xen-block.c b/hw/block/dataplane/xen-block.c
index 734da42ea7..d8bc39d359 100644
--- a/hw/block/dataplane/xen-block.c
+++ b/hw/block/dataplane/xen-block.c
@@ -633,8 +633,9 @@ XenBlockDataPlane *xen_block_dataplane_create(XenDevice *xendev,
     } else {
         dataplane->ctx = qemu_get_aio_context();
     }
-    dataplane->bh = aio_bh_new(dataplane->ctx, xen_block_dataplane_bh,
-                               dataplane);
+    dataplane->bh = aio_bh_new_guarded(dataplane->ctx, xen_block_dataplane_bh,
+                                       dataplane,
+                                       &DEVICE(xendev)->mem_reentrancy_guard);
 
     return dataplane;
 }
diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
index 7d4601cb5d..dd619f0731 100644
--- a/hw/char/virtio-serial-bus.c
+++ b/hw/char/virtio-serial-bus.c
@@ -985,7 +985,8 @@ static void virtser_port_device_realize(DeviceState *dev, Error **errp)
         return;
     }
 
-    port->bh = qemu_bh_new(flush_queued_data_bh, port);
+    port->bh = qemu_bh_new_guarded(flush_queued_data_bh, port,
+                                   &dev->mem_reentrancy_guard);
     port->elem = NULL;
 }
 
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 80ce1e9a93..f1c0eb7dfc 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -2201,11 +2201,14 @@ static void qxl_realize_common(PCIQXLDevice *qxl, Error **errp)
 
     qemu_add_vm_change_state_handler(qxl_vm_change_state_handler, qxl);
 
-    qxl->update_irq = qemu_bh_new(qxl_update_irq_bh, qxl);
+    qxl->update_irq = qemu_bh_new_guarded(qxl_update_irq_bh, qxl,
+                                          &DEVICE(qxl)->mem_reentrancy_guard);
     qxl_reset_state(qxl);
 
-    qxl->update_area_bh = qemu_bh_new(qxl_render_update_area_bh, qxl);
-    qxl->ssd.cursor_bh = qemu_bh_new(qemu_spice_cursor_refresh_bh, &qxl->ssd);
+    qxl->update_area_bh = qemu_bh_new_guarded(qxl_render_update_area_bh, qxl,
+                                              &DEVICE(qxl)->mem_reentrancy_guard);
+    qxl->ssd.cursor_bh = qemu_bh_new_guarded(qemu_spice_cursor_refresh_bh, &qxl->ssd,
+                                             &DEVICE(qxl)->mem_reentrancy_guard);
 }
 
 static void qxl_realize_primary(PCIDevice *dev, Error **errp)
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 4e2e0dd53a..7c13b056b9 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -1356,8 +1356,10 @@ void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
 
     g->ctrl_vq = virtio_get_queue(vdev, 0);
     g->cursor_vq = virtio_get_queue(vdev, 1);
-    g->ctrl_bh = qemu_bh_new(virtio_gpu_ctrl_bh, g);
-    g->cursor_bh = qemu_bh_new(virtio_gpu_cursor_bh, g);
+    g->ctrl_bh = qemu_bh_new_guarded(virtio_gpu_ctrl_bh, g,
+                                     &qdev->mem_reentrancy_guard);
+    g->cursor_bh = qemu_bh_new_guarded(virtio_gpu_cursor_bh, g,
+                                       &qdev->mem_reentrancy_guard);
     QTAILQ_INIT(&g->reslist);
     QTAILQ_INIT(&g->cmdq);
     QTAILQ_INIT(&g->fenceq);
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 55902e1df7..4e76d6b191 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1509,7 +1509,8 @@ static void ahci_cmd_done(const IDEDMA *dma)
     ahci_write_fis_d2h(ad);
 
     if (ad->port_regs.cmd_issue && !ad->check_bh) {
-        ad->check_bh = qemu_bh_new(ahci_check_cmd_bh, ad);
+        ad->check_bh = qemu_bh_new_guarded(ahci_check_cmd_bh, ad,
+                                           &ad->mem_reentrancy_guard);
         qemu_bh_schedule(ad->check_bh);
     }
 }
diff --git a/hw/ide/ahci_internal.h b/hw/ide/ahci_internal.h
index 303fcd7235..2480455372 100644
--- a/hw/ide/ahci_internal.h
+++ b/hw/ide/ahci_internal.h
@@ -321,6 +321,7 @@ struct AHCIDevice {
     bool init_d2h_sent;
     AHCICmdHdr *cur_cmd;
     NCQTransferState ncq_tfs[AHCI_MAX_CMDS];
+    MemReentrancyGuard mem_reentrancy_guard;
 };
 
 struct AHCIPCIState {
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 45d14a25e9..de48ff9f86 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -513,6 +513,7 @@ BlockAIOCB *ide_issue_trim(
         BlockCompletionFunc *cb, void *cb_opaque, void *opaque)
 {
     IDEState *s = opaque;
+    IDEDevice *dev = s->unit ? s->bus->slave : s->bus->master;
     TrimAIOCB *iocb;
 
     /* Paired with a decrement in ide_trim_bh_cb() */
@@ -520,7 +521,8 @@ BlockAIOCB *ide_issue_trim(
 
     iocb = blk_aio_get(&trim_aiocb_info, s->blk, cb, cb_opaque);
     iocb->s = s;
-    iocb->bh = qemu_bh_new(ide_trim_bh_cb, iocb);
+    iocb->bh = qemu_bh_new_guarded(ide_trim_bh_cb, iocb,
+                                   &DEVICE(dev)->mem_reentrancy_guard);
     iocb->ret = 0;
     iocb->qiov = qiov;
     iocb->i = -1;
diff --git a/hw/misc/imx_rngc.c b/hw/misc/imx_rngc.c
index 632c03779c..082c6980ad 100644
--- a/hw/misc/imx_rngc.c
+++ b/hw/misc/imx_rngc.c
@@ -228,8 +228,10 @@ static void imx_rngc_realize(DeviceState *dev, Error **errp)
     sysbus_init_mmio(sbd, &s->iomem);
 
     sysbus_init_irq(sbd, &s->irq);
-    s->self_test_bh = qemu_bh_new(imx_rngc_self_test, s);
-    s->seed_bh = qemu_bh_new(imx_rngc_seed, s);
+    s->self_test_bh = qemu_bh_new_guarded(imx_rngc_self_test, s,
+                                          &dev->mem_reentrancy_guard);
+    s->seed_bh = qemu_bh_new_guarded(imx_rngc_seed, s,
+                                     &dev->mem_reentrancy_guard);
 }
 
 static void imx_rngc_reset(DeviceState *dev)
diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c
index 43bb1f56ba..80a789f32b 100644
--- a/hw/misc/macio/mac_dbdma.c
+++ b/hw/misc/macio/mac_dbdma.c
@@ -914,7 +914,7 @@ static void mac_dbdma_realize(DeviceState *dev, Error **errp)
 {
     DBDMAState *s = MAC_DBDMA(dev);
 
-    s->bh = qemu_bh_new(DBDMA_run_bh, s);
+    s->bh = qemu_bh_new_guarded(DBDMA_run_bh, s, &dev->mem_reentrancy_guard);
 }
 
 static void mac_dbdma_class_init(ObjectClass *oc, void *data)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 3b66c97e3d..c9ba367c1b 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -2919,7 +2919,8 @@ static void virtio_net_add_queue(VirtIONet *n, int index)
         n->vqs[index].tx_vq =
             virtio_add_queue(vdev, n->net_conf.tx_queue_size,
                              virtio_net_handle_tx_bh);
-        n->vqs[index].tx_bh = qemu_bh_new(virtio_net_tx_bh, &n->vqs[index]);
+        n->vqs[index].tx_bh = qemu_bh_new_guarded(virtio_net_tx_bh, &n->vqs[index],
+                                                  &DEVICE(vdev)->mem_reentrancy_guard);
     }
 
     n->vqs[index].tx_waiting = 0;
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 2097fb1310..812246689c 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -4607,7 +4607,8 @@ static void nvme_init_sq(NvmeSQueue *sq, NvmeCtrl *n, uint64_t dma_addr,
         QTAILQ_INSERT_TAIL(&(sq->req_list), &sq->io_req[i], entry);
     }
 
-    sq->bh = qemu_bh_new(nvme_process_sq, sq);
+    sq->bh = qemu_bh_new_guarded(nvme_process_sq, sq,
+                                 &DEVICE(sq->ctrl)->mem_reentrancy_guard);
 
     if (n->dbbuf_enabled) {
         sq->db_addr = n->dbbuf_dbs + (sqid << 3);
@@ -5253,7 +5254,8 @@ static void nvme_init_cq(NvmeCQueue *cq, NvmeCtrl *n, uint64_t dma_addr,
         }
     }
     n->cq[cqid] = cq;
-    cq->bh = qemu_bh_new(nvme_post_cqes, cq);
+    cq->bh = qemu_bh_new_guarded(nvme_post_cqes, cq,
+                                 &DEVICE(cq->ctrl)->mem_reentrancy_guard);
 }
 
 static uint16_t nvme_create_cq(NvmeCtrl *n, NvmeRequest *req)
diff --git a/hw/scsi/mptsas.c b/hw/scsi/mptsas.c
index c485da792c..3de288b454 100644
--- a/hw/scsi/mptsas.c
+++ b/hw/scsi/mptsas.c
@@ -1322,7 +1322,8 @@ static void mptsas_scsi_realize(PCIDevice *dev, Error **errp)
     }
     s->max_devices = MPTSAS_NUM_PORTS;
 
-    s->request_bh = qemu_bh_new(mptsas_fetch_requests, s);
+    s->request_bh = qemu_bh_new_guarded(mptsas_fetch_requests, s,
+                                        &DEVICE(dev)->mem_reentrancy_guard);
 
     scsi_bus_init(&s->bus, sizeof(s->bus), &dev->qdev, &mptsas_scsi_info);
 }
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index c97176110c..3c20b47ad0 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -193,7 +193,8 @@ static void scsi_dma_restart_cb(void *opaque, bool running, RunState state)
         AioContext *ctx = blk_get_aio_context(s->conf.blk);
         /* The reference is dropped in scsi_dma_restart_bh.*/
         object_ref(OBJECT(s));
-        s->bh = aio_bh_new(ctx, scsi_dma_restart_bh, s);
+        s->bh = aio_bh_new_guarded(ctx, scsi_dma_restart_bh, s,
+                                   &DEVICE(s)->mem_reentrancy_guard);
         qemu_bh_schedule(s->bh);
     }
 }
diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
index fa76696855..4de34536e9 100644
--- a/hw/scsi/vmw_pvscsi.c
+++ b/hw/scsi/vmw_pvscsi.c
@@ -1184,7 +1184,8 @@ pvscsi_realizefn(PCIDevice *pci_dev, Error **errp)
         pcie_endpoint_cap_init(pci_dev, PVSCSI_EXP_EP_OFFSET);
     }
 
-    s->completion_worker = qemu_bh_new(pvscsi_process_completion_queue, s);
+    s->completion_worker = qemu_bh_new_guarded(pvscsi_process_completion_queue, s,
+                                               &DEVICE(pci_dev)->mem_reentrancy_guard);
 
     scsi_bus_init(&s->bus, sizeof(s->bus), DEVICE(pci_dev), &pvscsi_scsi_info);
     /* override default SCSI bus hotplug-handler, with pvscsi's one */
diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c
index 88f99c05d5..f013ded91e 100644
--- a/hw/usb/dev-uas.c
+++ b/hw/usb/dev-uas.c
@@ -937,7 +937,8 @@ static void usb_uas_realize(USBDevice *dev, Error **errp)
 
     QTAILQ_INIT(&uas->results);
     QTAILQ_INIT(&uas->requests);
-    uas->status_bh = qemu_bh_new(usb_uas_send_status_bh, uas);
+    uas->status_bh = qemu_bh_new_guarded(usb_uas_send_status_bh, uas,
+                                         &d->mem_reentrancy_guard);
 
     dev->flags |= (1 << USB_DEV_FLAG_IS_SCSI_STORAGE);
     scsi_bus_init(&uas->bus, sizeof(uas->bus), DEVICE(dev), &usb_uas_scsi_info);
diff --git a/hw/usb/hcd-dwc2.c b/hw/usb/hcd-dwc2.c
index 8755e9cbb0..a0c4e782b2 100644
--- a/hw/usb/hcd-dwc2.c
+++ b/hw/usb/hcd-dwc2.c
@@ -1364,7 +1364,8 @@ static void dwc2_realize(DeviceState *dev, Error **errp)
     s->fi = USB_FRMINTVL - 1;
     s->eof_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, dwc2_frame_boundary, s);
     s->frame_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, dwc2_work_timer, s);
-    s->async_bh = qemu_bh_new(dwc2_work_bh, s);
+    s->async_bh = qemu_bh_new_guarded(dwc2_work_bh, s,
+                                      &dev->mem_reentrancy_guard);
 
     sysbus_init_irq(sbd, &s->irq);
 }
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index d4da8dcb8d..c930c60921 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -2533,7 +2533,8 @@ void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp)
     }
 
     s->frame_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, ehci_work_timer, s);
-    s->async_bh = qemu_bh_new(ehci_work_bh, s);
+    s->async_bh = qemu_bh_new_guarded(ehci_work_bh, s,
+                                      &dev->mem_reentrancy_guard);
     s->device = dev;
 
     s->vmstate = qemu_add_vm_change_state_handler(usb_ehci_vm_state_change, s);
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index 8ac1175ad2..77baaa7a6b 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -1190,7 +1190,7 @@ void usb_uhci_common_realize(PCIDevice *dev, Error **errp)
                               USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
         }
     }
-    s->bh = qemu_bh_new(uhci_bh, s);
+    s->bh = qemu_bh_new_guarded(uhci_bh, s, &DEVICE(dev)->mem_reentrancy_guard);
     s->frame_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, uhci_frame_timer, s);
     s->num_ports_vmstate = NB_PORTS;
     QTAILQ_INIT(&s->queues);
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index 176868d345..f500db85ab 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -1141,7 +1141,8 @@ static void usb_host_nodev_bh(void *opaque)
 static void usb_host_nodev(USBHostDevice *s)
 {
     if (!s->bh_nodev) {
-        s->bh_nodev = qemu_bh_new(usb_host_nodev_bh, s);
+        s->bh_nodev = qemu_bh_new_guarded(usb_host_nodev_bh, s,
+                                          &DEVICE(s)->mem_reentrancy_guard);
     }
     qemu_bh_schedule(s->bh_nodev);
 }
@@ -1739,7 +1740,8 @@ static int usb_host_post_load(void *opaque, int version_id)
     USBHostDevice *dev = opaque;
 
     if (!dev->bh_postld) {
-        dev->bh_postld = qemu_bh_new(usb_host_post_load_bh, dev);
+        dev->bh_postld = qemu_bh_new_guarded(usb_host_post_load_bh, dev,
+                                             &DEVICE(dev)->mem_reentrancy_guard);
     }
     qemu_bh_schedule(dev->bh_postld);
     dev->bh_postld_pending = true;
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index fd7df599bc..39fbaaab16 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -1441,8 +1441,10 @@ static void usbredir_realize(USBDevice *udev, Error **errp)
         }
     }
 
-    dev->chardev_close_bh = qemu_bh_new(usbredir_chardev_close_bh, dev);
-    dev->device_reject_bh = qemu_bh_new(usbredir_device_reject_bh, dev);
+    dev->chardev_close_bh = qemu_bh_new_guarded(usbredir_chardev_close_bh, dev,
+                                                &DEVICE(dev)->mem_reentrancy_guard);
+    dev->device_reject_bh = qemu_bh_new_guarded(usbredir_device_reject_bh, dev,
+                                                &DEVICE(dev)->mem_reentrancy_guard);
     dev->attach_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, usbredir_do_attach, dev);
 
     packet_id_queue_init(&dev->cancelled, dev, "cancelled");
diff --git a/hw/usb/xen-usb.c b/hw/usb/xen-usb.c
index 66cb3f7c24..38ee660a30 100644
--- a/hw/usb/xen-usb.c
+++ b/hw/usb/xen-usb.c
@@ -1032,7 +1032,8 @@ static void usbback_alloc(struct XenLegacyDevice *xendev)
 
     QTAILQ_INIT(&usbif->req_free_q);
     QSIMPLEQ_INIT(&usbif->hotplug_q);
-    usbif->bh = qemu_bh_new(usbback_bh, usbif);
+    usbif->bh = qemu_bh_new_guarded(usbback_bh, usbif,
+                                    &DEVICE(xendev)->mem_reentrancy_guard);
 }
 
 static int usbback_free(struct XenLegacyDevice *xendev)
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index 746f07c4d2..d60dd1f61e 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -908,8 +908,9 @@ static void virtio_balloon_device_realize(DeviceState *dev, Error **errp)
         precopy_add_notifier(&s->free_page_hint_notify);
 
         object_ref(OBJECT(s->iothread));
-        s->free_page_bh = aio_bh_new(iothread_get_aio_context(s->iothread),
-                                     virtio_ballloon_get_free_page_hints, s);
+        s->free_page_bh = aio_bh_new_guarded(iothread_get_aio_context(s->iothread),
+                                             virtio_ballloon_get_free_page_hints, s,
+                                             &dev->mem_reentrancy_guard);
     }
 
     if (virtio_has_feature(s->host_features, VIRTIO_BALLOON_F_REPORTING)) {
diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c
index ccaa704530..f4a25de5ac 100644
--- a/hw/virtio/virtio-crypto.c
+++ b/hw/virtio/virtio-crypto.c
@@ -1081,7 +1081,8 @@ static void virtio_crypto_device_realize(DeviceState *dev, Error **errp)
         vcrypto->vqs[i].dataq =
                  virtio_add_queue(vdev, 1024, virtio_crypto_handle_dataq_bh);
         vcrypto->vqs[i].dataq_bh =
-                 qemu_bh_new(virtio_crypto_dataq_bh, &vcrypto->vqs[i]);
+                 qemu_bh_new_guarded(virtio_crypto_dataq_bh, &vcrypto->vqs[i],
+                                     &dev->mem_reentrancy_guard);
         vcrypto->vqs[i].vcrypto = vcrypto;
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:44:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:44:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815476.1229243 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symus-0001qT-EL; Thu, 10 Oct 2024 06:44:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815476.1229243; Thu, 10 Oct 2024 06: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 1symus-0001qL-Bd; Thu, 10 Oct 2024 06:44:54 +0000
Received: by outflank-mailman (input) for mailman id 815476;
 Thu, 10 Oct 2024 06: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 1symur-0001qF-TN
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06: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 1symur-0004jF-Sc
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:44:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symur-0001wR-Rm
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06: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=61VMPthslIcLN9Bf5kCVTdmWgvQpminsw8QgJxRSlAQ=; b=6eatts51P4oRjP+zXgFvweL4YL
	x8/6DurV+4+w37fajb4TOosrM6nHTPcMS87d3Jn5BkrG3vAZvFz9zzoslfcxooEkZC60S4PqaRHHg
	R0Pe76kn7DDNtVUQfYX+9d6fmDVxsL6JWRKHyAV3XUI9E9gioZTjuAElsiMmHF6pnNZM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] lsi53c895a: disable reentrancy detection for script RAM
Message-Id: <E1symur-0001wR-Rm@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:44:53 +0000

commit db43c7db206427ff5f6cbc7116c66d6cc6e81385
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:10 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    lsi53c895a: disable reentrancy detection for script RAM
    
    As the code is designed to use the memory APIs to access the script ram,
    disable reentrancy checks for the pseudo-RAM ram_io MemoryRegion.
    
    In the future, ram_io may be converted from an IO to a proper RAM MemoryRegion.
    
    Reported-by: Fiona Ebner <f.ebner@proxmox.com>
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Message-Id: <20230427211013.2994127-6-alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit bfd6e7ae6a72b84e2eb9574f56e6ec037f05182c)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/scsi/lsi53c895a.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index bbf32d3f73..17af67935f 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -2313,6 +2313,12 @@ static void lsi_scsi_realize(PCIDevice *dev, Error **errp)
     memory_region_init_io(&s->io_io, OBJECT(s), &lsi_io_ops, s,
                           "lsi-io", 256);
 
+    /*
+     * Since we use the address-space API to interact with ram_io, disable the
+     * re-entrancy guard.
+     */
+    s->ram_io.disable_reentrancy_guard = true;
+
     address_space_init(&s->pci_io_as, pci_address_space_io(dev), "lsi-pci-io");
     qdev_init_gpio_out(d, &s->ext_irq, 1);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:45:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:45:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815477.1229248 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symv2-0001t8-Fl; Thu, 10 Oct 2024 06:45:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815477.1229248; Thu, 10 Oct 2024 06: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 1symv2-0001t0-D2; Thu, 10 Oct 2024 06:45:04 +0000
Received: by outflank-mailman (input) for mailman id 815477;
 Thu, 10 Oct 2024 06: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 1symv2-0001sr-0l
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06: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 1symv2-0004jt-02
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:45:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symv1-0001xb-V1
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06: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=gkBVjsBtS6mtbR20+yHPGRtv6W8aZ657RCrNoysljP0=; b=40IHWC2dIZgkFomSd4tlCRHKv6
	VGyNqzF3s4xjABgn2K6TNU5/lVoynML8CZNhFf/XJefqR/mL775VeM0jPoce4VNF5kpA2HPM+iVw4
	ma6LTjj1MX+YiVd7sDnmBQwzd8mSvitJ3baguhbjgmcqKj/3JfU60g7a4tfnD9dwgYZQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] lsi53c895a: disable reentrancy detection for MMIO region, too
Message-Id: <E1symv1-0001xb-V1@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:45:03 +0000

commit 0f0fb19d2bae3a5184fdbfcaa5de24f6ce759042
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Tue May 16 11:05:56 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    lsi53c895a: disable reentrancy detection for MMIO region, too
    
    While trying to use a SCSI disk on the LSI controller with an
    older version of Fedora (25), I'm getting:
    
     qemu: warning: Blocked re-entrant IO on MemoryRegion: lsi-mmio at addr: 0x34
    
    and the SCSI controller is not usable. Seems like we have to
    disable the reentrancy checker for the MMIO region, too, to
    get this working again.
    
    The problem could be reproduced it like this:
    
    ./qemu-system-x86_64 -accel kvm -m 2G -machine q35 \
     -device lsi53c810,id=lsi1 -device scsi-hd,drive=d0 \
     -drive if=none,id=d0,file=.../somedisk.qcow2 \
     -cdrom Fedora-Everything-netinst-i386-25-1.3.iso
    
    Where somedisk.qcow2 is an image that contains already some partitions
    and file systems.
    
    In the boot menu of Fedora, go to
    "Troubleshooting" -> "Rescue a Fedora system" -> "3) Skip to shell"
    
    Then check "dmesg | grep -i 53c" for failure messages, and try to mount
    a partition from somedisk.qcow2.
    
    Message-Id: <20230516090556.553813-1-thuth@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit d139fe9ad8a27bcc50b4ead77d2f97d191a0e95e)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/scsi/lsi53c895a.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index 17af67935f..f7d45b0b20 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -2318,6 +2318,7 @@ static void lsi_scsi_realize(PCIDevice *dev, Error **errp)
      * re-entrancy guard.
      */
     s->ram_io.disable_reentrancy_guard = true;
+    s->mmio_io.disable_reentrancy_guard = true;
 
     address_space_init(&s->pci_io_as, pci_address_space_io(dev), "lsi-pci-io");
     qdev_init_gpio_out(d, &s->ext_irq, 1);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:45:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:45:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815478.1229252 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symvD-0001vg-H8; Thu, 10 Oct 2024 06:45:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815478.1229252; Thu, 10 Oct 2024 06: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 1symvD-0001vZ-EU; Thu, 10 Oct 2024 06:45:15 +0000
Received: by outflank-mailman (input) for mailman id 815478;
 Thu, 10 Oct 2024 06: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 1symvC-0001vM-3p
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06: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 1symvC-0004k4-38
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:45:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symvC-0001yG-2G
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06: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=nOc/ZI7SiVKuhoOa0/g7DeLuuP3aJIy4NeS6p80u+mw=; b=KiQhj5kvwMJ7jGhMcMk3Z5cTAj
	tEyAxHgZoHcmII6tr4LWEl/w12TlLpvZCKWbSduetgJ9xCDFPYpSIq4FRhLWVHpPOg8JSYQGTbUn+
	LGZXyu/EXowa9RXe37B2nvMAJmqxE/hy3D4IJybn1WKoj4eswZfzi6+CdOSJwOQs34Qs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] bcm2835_property: disable reentrancy detection for iomem
Message-Id: <E1symvC-0001yG-2G@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:45:14 +0000

commit 83d080e85ae769dddf67118b420ec39bfcc3323f
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:11 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    bcm2835_property: disable reentrancy detection for iomem
    
    As the code is designed for re-entrant calls from bcm2835_property to
    bcm2835_mbox and back into bcm2835_property, mark iomem as
    reentrancy-safe.
    
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Message-Id: <20230427211013.2994127-7-alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 985c4a4e547afb9573b6bd6843d20eb2c3d1d1cd)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/misc/bcm2835_property.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c
index 890ae7bae5..de056ea2df 100644
--- a/hw/misc/bcm2835_property.c
+++ b/hw/misc/bcm2835_property.c
@@ -382,6 +382,13 @@ static void bcm2835_property_init(Object *obj)
 
     memory_region_init_io(&s->iomem, OBJECT(s), &bcm2835_property_ops, s,
                           TYPE_BCM2835_PROPERTY, 0x10);
+
+    /*
+     * bcm2835_property_ops call into bcm2835_mbox, which in-turn reads from
+     * iomem. As such, mark iomem as re-entracy safe.
+     */
+    s->iomem.disable_reentrancy_guard = true;
+
     sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->iomem);
     sysbus_init_irq(SYS_BUS_DEVICE(s), &s->mbox_irq);
 }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:45:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:45:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815479.1229258 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symvN-0001ya-JO; Thu, 10 Oct 2024 06:45:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815479.1229258; Thu, 10 Oct 2024 06: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 1symvN-0001yS-Fv; Thu, 10 Oct 2024 06:45:25 +0000
Received: by outflank-mailman (input) for mailman id 815479;
 Thu, 10 Oct 2024 06: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 1symvM-0001yD-6n
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06: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 1symvM-0004kB-6D
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:45:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symvM-0001yz-5R
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06: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=fK2QSyKmJpTImq3wFCJcI72qZfC1exVXzAkhpXZDnbU=; b=mP+AZn2y3mvs5sIZgiuCrFMSHt
	wWbmm6r1poYxDCCqMvoV316S/4mHuh3xWvHDzmgl2yVy2X5yOa08lZxh1cITfGe1HIE+ARze2whyp
	QVLJ9H6nGzp5MOmw4Ayyula45JjcGU+ObMcdtLrFm52sUcAeEnPBiDqVPvqlXqOzlL8s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] raven: disable reentrancy detection for iomem
Message-Id: <E1symvM-0001yz-5R@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:45:24 +0000

commit 151649da1b821809d016c03287301ee0f81596c4
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:12 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    raven: disable reentrancy detection for iomem
    
    As the code is designed for re-entrant calls from raven_io_ops to
    pci-conf, mark raven_io_ops as reentrancy-safe.
    
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Message-Id: <20230427211013.2994127-8-alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 6dad5a6810d9c60ca320d01276f6133bbcfa1fc7)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/pci-host/raven.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c
index 072ffe3c5e..9a11ac4b2b 100644
--- a/hw/pci-host/raven.c
+++ b/hw/pci-host/raven.c
@@ -294,6 +294,13 @@ static void raven_pcihost_initfn(Object *obj)
     memory_region_init(&s->pci_memory, obj, "pci-memory", 0x3f000000);
     address_space_init(&s->pci_io_as, &s->pci_io, "raven-io");
 
+    /*
+     * Raven's raven_io_ops use the address-space API to access pci-conf-idx
+     * (which is also owned by the raven device). As such, mark the
+     * pci_io_non_contiguous as re-entrancy safe.
+     */
+    s->pci_io_non_contiguous.disable_reentrancy_guard = true;
+
     /* CPU address space */
     memory_region_add_subregion(address_space_mem, PCI_IO_BASE_ADDR,
                                 &s->pci_io);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:45:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:45:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815480.1229260 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symvX-00022i-K3; Thu, 10 Oct 2024 06:45:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815480.1229260; Thu, 10 Oct 2024 06:45: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 1symvX-00022a-HT; Thu, 10 Oct 2024 06:45:35 +0000
Received: by outflank-mailman (input) for mailman id 815480;
 Thu, 10 Oct 2024 06:45: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 1symvW-00022K-9z
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:45: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 1symvW-0004kI-9K
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:45:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symvW-0001zk-8T
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:45: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=WseIUrlfJaH7igwX/Csl/NBUR8XYilMWdnHfs+SfIXM=; b=hX7IZrAFcpXl1B1JjF82y5dBZ/
	9VUdW3Y2Mrhpx+epWpVaU7A6CeVaaVUyx8imKvhJ9ZGpPiMrSMeKu8iYfvSl90X9KDtEYajoAQD1q
	zFylXKf8S5wxzJKd8U73MeXQwY78ptf4YkAHz3YIhDoATrN9S3qyUrMRxds+8z/ONaqI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] apic: disable reentrancy detection for apic-msi
Message-Id: <E1symvW-0001zk-8T@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:45:34 +0000

commit 305ffdeca8d134e5982e18137fc369eb929b2059
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:13 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    apic: disable reentrancy detection for apic-msi
    
    As the code is designed for re-entrant calls to apic-msi, mark apic-msi
    as reentrancy-safe.
    
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Message-Id: <20230427211013.2994127-9-alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 50795ee051a342c681a9b45671c552fbd6274db8)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/intc/apic.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/intc/apic.c b/hw/intc/apic.c
index 20b5a94073..ac3d47d231 100644
--- a/hw/intc/apic.c
+++ b/hw/intc/apic.c
@@ -885,6 +885,13 @@ static void apic_realize(DeviceState *dev, Error **errp)
     memory_region_init_io(&s->io_memory, OBJECT(s), &apic_io_ops, s, "apic-msi",
                           APIC_SPACE_SIZE);
 
+    /*
+     * apic-msi's apic_mem_write can call into ioapic_eoi_broadcast, which can
+     * write back to apic-msi. As such mark the apic-msi region re-entrancy
+     * safe.
+     */
+    s->io_memory.disable_reentrancy_guard = true;
+
     s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, apic_timer, s);
     local_apics[s->id] = s;
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:45:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:45:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815481.1229264 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symvh-00025G-Lk; Thu, 10 Oct 2024 06:45:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815481.1229264; Thu, 10 Oct 2024 06:45: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 1symvh-000258-Iw; Thu, 10 Oct 2024 06:45:45 +0000
Received: by outflank-mailman (input) for mailman id 815481;
 Thu, 10 Oct 2024 06:45: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 1symvg-00024x-E5
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:45: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 1symvg-0004kQ-DS
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:45:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symvg-00020Y-Bg
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:45: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=lkQ1Df6FEIh4z2Ngsz6vK6OdodO5U34Ab9sEF0ss9K8=; b=SammROolgKwut48rn7OW8vXFDN
	/GvTF68/C0Rubrmw9jkAmyXP3SONNgybE0Khv/XakXtqbYsrfwM9bqubGWR3oGbZ6DeYYNpfDgId3
	rQrvcO+rxowNH22tEyGlWKZLSDEPRWWohFqIGjHJ4+A3GFf50JtjDFR81S3Dbcoq7N0A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] loongarch: mark loongarch_ipi_iocsr re-entrnacy safe
Message-Id: <E1symvg-00020Y-Bg@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:45:44 +0000

commit 48c04e42f033bf2e717052d99192fada589d62b3
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Sat May 6 07:21:45 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    loongarch: mark loongarch_ipi_iocsr re-entrnacy safe
    
    loongarch_ipi_iocsr MRs rely on re-entrant IO through the ipi_send
    function. As such, mark these MRs re-entrancy-safe.
    
    Fixes: a2e1753b80 ("memory: prevent dma-reentracy issues")
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Song Gao <gaosong@loongson.cn>
    Message-Id: <20230506112145.3563708-1-alxndr@bu.edu>
    Signed-off-by: Song Gao <gaosong@loongson.cn>
    (cherry picked from commit 6d0589e0e6c64b888864a2bf980537be20389264)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/intc/loongarch_ipi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/intc/loongarch_ipi.c b/hw/intc/loongarch_ipi.c
index aa4bf9eb74..40e98af2ce 100644
--- a/hw/intc/loongarch_ipi.c
+++ b/hw/intc/loongarch_ipi.c
@@ -215,6 +215,10 @@ static void loongarch_ipi_init(Object *obj)
     for (cpu = 0; cpu < MAX_IPI_CORE_NUM; cpu++) {
         memory_region_init_io(&s->ipi_iocsr_mem[cpu], obj, &loongarch_ipi_ops,
                             &lams->ipi_core[cpu], "loongarch_ipi_iocsr", 0x48);
+
+        /* loongarch_ipi_iocsr performs re-entrant IO through ipi_send */
+        s->ipi_iocsr_mem[cpu].disable_reentrancy_guard = true;
+
         sysbus_init_mmio(sbd, &s->ipi_iocsr_mem[cpu]);
 
         memory_region_init_io(&s->ipi64_iocsr_mem[cpu], obj, &loongarch_ipi64_ops,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:45:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:45:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815482.1229268 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symvr-00027q-N4; Thu, 10 Oct 2024 06:45:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815482.1229268; Thu, 10 Oct 2024 06:45:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symvr-00027i-KX; Thu, 10 Oct 2024 06:45:55 +0000
Received: by outflank-mailman (input) for mailman id 815482;
 Thu, 10 Oct 2024 06:45: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 1symvq-00027Z-HD
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:45: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 1symvq-0004kq-GX
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:45:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symvq-00021M-Fp
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:45: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=+gMq3vPBmYN0pMPoJMyn0Fkth5JJ4sTtCrai8R9yM88=; b=2CZmoI3N8HMg/oTbNhw4zotM7O
	xN6FdYRNtY8tZLlSwui0mumief7JfCQv3ssnsOiGQvpR0AEhIAj7/puZYh33bTyEtp0hr7dqd7s8q
	X8Gfwn6v4ir35XH5Yi5MiDPIbixUDM1+HJILz6HbojltXg1GGLCHp2tNffCujgytnA5M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] pnv_lpc: disable reentrancy detection for lpc-hc
Message-Id: <E1symvq-00021M-Fp@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:45:54 +0000

commit e7f12ce43d9fc6016c1f12d49bcb5e024663d7ad
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Fri May 26 09:38:50 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    pnv_lpc: disable reentrancy detection for lpc-hc
    
    As lpc-hc is designed for re-entrant calls from xscom, mark it
    re-entrancy safe.
    
    Reported-by: Thomas Huth <thuth@redhat.com>
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    [clg: mark opb_master_regs as re-entrancy safe also ]
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
    Tested-by: Thomas Huth <thuth@redhat.com>
    Message-Id: <20230526073850.2772197-1-clg@kaod.org>
    Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
    (cherry picked from commit 76f9ebffcd41b62ae9ec26a1c25676f2ae1d9cc3)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ppc/pnv_lpc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/ppc/pnv_lpc.c b/hw/ppc/pnv_lpc.c
index 01f44c19eb..605d390861 100644
--- a/hw/ppc/pnv_lpc.c
+++ b/hw/ppc/pnv_lpc.c
@@ -734,10 +734,13 @@ static void pnv_lpc_realize(DeviceState *dev, Error **errp)
     /* Create MMIO regions for LPC HC and OPB registers */
     memory_region_init_io(&lpc->opb_master_regs, OBJECT(dev), &opb_master_ops,
                           lpc, "lpc-opb-master", LPC_OPB_REGS_OPB_SIZE);
+    lpc->opb_master_regs.disable_reentrancy_guard = true;
     memory_region_add_subregion(&lpc->opb_mr, LPC_OPB_REGS_OPB_ADDR,
                                 &lpc->opb_master_regs);
     memory_region_init_io(&lpc->lpc_hc_regs, OBJECT(dev), &lpc_hc_ops, lpc,
                           "lpc-hc", LPC_HC_REGS_OPB_SIZE);
+    /* xscom writes to lpc-hc. As such mark lpc-hc re-entrancy safe */
+    lpc->lpc_hc_regs.disable_reentrancy_guard = true;
     memory_region_add_subregion(&lpc->opb_mr, LPC_HC_REGS_OPB_ADDR,
                                 &lpc->lpc_hc_regs);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:46:05 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:46:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815483.1229271 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symw1-0002AR-Ow; Thu, 10 Oct 2024 06:46:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815483.1229271; Thu, 10 Oct 2024 06:46:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symw1-0002AK-M9; Thu, 10 Oct 2024 06:46:05 +0000
Received: by outflank-mailman (input) for mailman id 815483;
 Thu, 10 Oct 2024 06:46: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 1symw0-0002A7-KH
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:46: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 1symw0-0004lD-Jf
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:46:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symw0-00025E-It
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:46: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=YEf9Bwg2jj+tysB5kCkOZifRX01JmViKMMkAtSrGVDU=; b=oR9CKO4W8OfY5EgM9NVLQITcBZ
	tLKodx+L3GzoWZwrgzO44uFUTGRSDvsI6Kv9TzKFDm8vM48GUZK1yvcRQD+5HONVj0WN53JfSI06n
	VE1bkQFfQ2uSlDEy2igZV7nxIfPzHekfw6kG9IxzjlfQ0UJ2vSuIwwMfpogRG9uEonqo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] machine: Add helpers to get cores/threads per socket
Message-Id: <E1symw0-00025E-It@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:46:04 +0000

commit cfff72b21ebd8bb893181bb1107848cf8903ebaa
Author:     Zhao Liu <zhao1.liu@intel.com>
AuthorDate: Wed Jun 28 21:54:34 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    machine: Add helpers to get cores/threads per socket
    
    The number of cores/threads per socket are needed for smbios, and are
    also useful for other modules.
    
    Provide the helpers to wrap the calculation of cores/threads per socket
    so that we can avoid calculation errors caused by other modules miss
    topology changes.
    
    Suggested-by: Igor Mammedov <imammedo@redhat.com>
    Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
    Message-Id: <20230628135437.1145805-2-zhao1.liu@linux.intel.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit a1d027be95bc375238e5b9292c6aa661a8ddef4c)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/core/machine-smp.c | 10 ++++++++++
 include/hw/boards.h   |  2 ++
 2 files changed, 12 insertions(+)

diff --git a/hw/core/machine-smp.c b/hw/core/machine-smp.c
index 89fe0cda42..0f4d9b6f7a 100644
--- a/hw/core/machine-smp.c
+++ b/hw/core/machine-smp.c
@@ -197,3 +197,13 @@ void machine_parse_smp_config(MachineState *ms,
         return;
     }
 }
+
+unsigned int machine_topo_get_cores_per_socket(const MachineState *ms)
+{
+    return ms->smp.cores * ms->smp.clusters * ms->smp.dies;
+}
+
+unsigned int machine_topo_get_threads_per_socket(const MachineState *ms)
+{
+    return ms->smp.threads * machine_topo_get_cores_per_socket(ms);
+}
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 6fbbfd56c8..75c0b195af 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -35,6 +35,8 @@ void machine_set_cpu_numa_node(MachineState *machine,
                                Error **errp);
 void machine_parse_smp_config(MachineState *ms,
                               const SMPConfiguration *config, Error **errp);
+unsigned int machine_topo_get_cores_per_socket(const MachineState *ms);
+unsigned int machine_topo_get_threads_per_socket(const MachineState *ms);
 
 /**
  * machine_class_allow_dynamic_sysbus_dev: Add type to list of valid devices
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:46:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:46:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815484.1229275 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symwB-0002DW-Rt; Thu, 10 Oct 2024 06:46:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815484.1229275; Thu, 10 Oct 2024 06:46: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 1symwB-0002DP-PI; Thu, 10 Oct 2024 06:46:15 +0000
Received: by outflank-mailman (input) for mailman id 815484;
 Thu, 10 Oct 2024 06:46: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 1symwA-0002DH-NO
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:46: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 1symwA-0004lN-Mi
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:46:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symwA-000264-Lv
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:46: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=g6MfAnMXpVf+reOh0jbx1IhzSQvlFtMX463Py8UlMfE=; b=0FoG0xcxAUn5CtD2n4ZfTypQGe
	JNep3Tk9HyY3p3zmetoTehU0ldYs/SK5GOhPsj/JUB1uOjOboK262GJeb+o/i7F35bTtEBfVYKsdS
	C5qZ980lStgB/nmkTHaZLbqf2br1pzIUHbnB03h0Cc4OaM38ncK1kNYN7DLjCx5CLLbg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/smbios: Fix smbios_smp_sockets caculation
Message-Id: <E1symwA-000264-Lv@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:46:14 +0000

commit c107dab4940d19760560ded7651550de9441db28
Author:     Zhao Liu <zhao1.liu@intel.com>
AuthorDate: Wed Jun 28 21:54:35 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/smbios: Fix smbios_smp_sockets caculation
    
    smp.sockets is the number of sockets which is configured by "-smp" (
    otherwise, the default is 1). Trying to recalculate it here with another
    rules leads to errors, such as:
    
    1. 003f230e37d7 ("machine: Tweak the order of topology members in struct
       CpuTopology") changes the meaning of smp.cores but doesn't fix
       original smp.cores uses.
    
       With the introduction of cluster, now smp.cores means the number of
       cores in one cluster. So smp.cores * smp.threads just means the
       threads in a cluster not in a socket.
    
    2. On the other hand, we shouldn't use smp.cpus here because it
       indicates the initial number of online CPUs at the boot time, and is
       not mathematically related to smp.sockets.
    
    So stop reinventing the another wheel and use the topo values that
    has been calculated.
    
    Fixes: 003f230e37d7 ("machine: Tweak the order of topology members in struct CpuTopology")
    Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
    Message-Id: <20230628135437.1145805-3-zhao1.liu@linux.intel.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit d79a284a44bb7d88b233fb6bb12ea3723f43469d)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/smbios/smbios.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index d2007e70fb..d67415d44d 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -1088,8 +1088,7 @@ void smbios_get_tables(MachineState *ms,
         smbios_build_type_2_table();
         smbios_build_type_3_table();
 
-        smbios_smp_sockets = DIV_ROUND_UP(ms->smp.cpus,
-                                          ms->smp.cores * ms->smp.threads);
+        smbios_smp_sockets = ms->smp.sockets;
         assert(smbios_smp_sockets >= 1);
 
         for (i = 0; i < smbios_smp_sockets; i++) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:46:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:46:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815485.1229279 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symwL-0002Xv-TU; Thu, 10 Oct 2024 06:46:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815485.1229279; Thu, 10 Oct 2024 06:46: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 1symwL-0002Xn-Qn; Thu, 10 Oct 2024 06:46:25 +0000
Received: by outflank-mailman (input) for mailman id 815485;
 Thu, 10 Oct 2024 06:46: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 1symwK-0002Iw-QO
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:46: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 1symwK-0004lU-Pk
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:46:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symwK-00026i-Ox
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:46: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=wcKValXQB524f87Wd/PnK4M6sMu0f4IjhR5HZJQw5DA=; b=E88wQ3G9jd/vMAVu76QWup44pi
	l+KR3juevFsdFR7fFps7rNzKObBoW9hyfihBohwZtwSGQlIrhRumzBbvV3btwU16WEKm8W6ovCYSs
	7N51yTPPNxAL6k5jLUKsIrdXOecPD7TzpSD1PWYXE+vcW2JpUKktrsost9iI35DXKdto=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/smbios: Fix thread count in type4
Message-Id: <E1symwK-00026i-Ox@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:46:24 +0000

commit ce2e3879a4a55317febdc42a0bc22b4a89e80824
Author:     Zhao Liu <zhao1.liu@intel.com>
AuthorDate: Wed Jun 28 21:54:36 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/smbios: Fix thread count in type4
    
    >From SMBIOS 3.0 specification, thread count field means:
    
    Thread Count is the total number of threads detected by the BIOS for
    this processor socket. It is a processor-wide count, not a
    thread-per-core count. [1]
    
    So here we should use threads per socket other than threads per core.
    
    [1] SMBIOS 3.0.0, section 7.5.8, Processor Information - Thread Count
    
    Fixes: c97294ec1b9e ("SMBIOS: Build aggregate smbios tables and entry point")
    Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
    Message-Id: <20230628135437.1145805-4-zhao1.liu@linux.intel.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 7298fd7de5551c4501f54381228458e3c21cab4b)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/smbios/smbios.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index d67415d44d..3aae9328c0 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -713,6 +713,7 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
 {
     char sock_str[128];
     size_t tbl_len = SMBIOS_TYPE_4_LEN_V28;
+    unsigned threads_per_socket;
 
     if (smbios_ep_type == SMBIOS_ENTRY_POINT_TYPE_64) {
         tbl_len = SMBIOS_TYPE_4_LEN_V30;
@@ -747,17 +748,19 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
     SMBIOS_TABLE_SET_STR(4, asset_tag_number_str, type4.asset);
     SMBIOS_TABLE_SET_STR(4, part_number_str, type4.part);
 
+    threads_per_socket = machine_topo_get_threads_per_socket(ms);
+
     t->core_count = (ms->smp.cores > 255) ? 0xFF : ms->smp.cores;
     t->core_enabled = t->core_count;
 
-    t->thread_count = (ms->smp.threads > 255) ? 0xFF : ms->smp.threads;
+    t->thread_count = (threads_per_socket > 255) ? 0xFF : threads_per_socket;
 
     t->processor_characteristics = cpu_to_le16(0x02); /* Unknown */
     t->processor_family2 = cpu_to_le16(0x01); /* Other */
 
     if (tbl_len == SMBIOS_TYPE_4_LEN_V30) {
         t->core_count2 = t->core_enabled2 = cpu_to_le16(ms->smp.cores);
-        t->thread_count2 = cpu_to_le16(ms->smp.threads);
+        t->thread_count2 = cpu_to_le16(threads_per_socket);
     }
 
     SMBIOS_BUILD_TABLE_POST;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:46:36 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:46:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815486.1229284 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symwV-0003La-Um; Thu, 10 Oct 2024 06:46:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815486.1229284; Thu, 10 Oct 2024 06:46:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symwV-0003LS-SB; Thu, 10 Oct 2024 06:46:35 +0000
Received: by outflank-mailman (input) for mailman id 815486;
 Thu, 10 Oct 2024 06:46: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 1symwU-0003LK-TG
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:46: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 1symwU-0004lb-Sb
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:46:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symwU-00027U-Rx
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:46: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=DHGmtLGHrwgFJeLUN73ot/8auoI3qaK6mkF/NENASfI=; b=e/ANjAToVEGG76zR8ve1l+3h+v
	OrWtoyAyTZkEV/GlnLtCw3BCfa2YulQspcZxf7yHLGMI1I/zudpuekYdWeOmWFE2W3z3NLgtxwOqn
	dRokEAfGBLjHFGx/rZ0pDgTO/sabYL3mTBvsu3k8SaRO5EP7v5t0Cgc+pl85Drblmk7o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/smbios: Fix core count in type4
Message-Id: <E1symwU-00027U-Rx@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:46:34 +0000

commit abb4828d5d5cd0fba82e958779a7c14d3b44e2df
Author:     Zhao Liu <zhao1.liu@intel.com>
AuthorDate: Wed Jun 28 21:54:37 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/smbios: Fix core count in type4
    
    >From SMBIOS 3.0 specification, core count field means:
    
    Core Count is the number of cores detected by the BIOS for this
    processor socket. [1]
    
    Before 003f230e37d7 ("machine: Tweak the order of topology members in
    struct CpuTopology"), MachineState.smp.cores means "the number of cores
    in one package", and it's correct to use smp.cores for core count.
    
    But 003f230e37d7 changes the smp.cores' meaning to "the number of cores
    in one die" and doesn't change the original smp.cores' use in smbios as
    well, which makes core count in type4 go wrong.
    
    Fix this issue with the correct "cores per socket" caculation.
    
    [1] SMBIOS 3.0.0, section 7.5.6, Processor Information - Core Count
    
    Fixes: 003f230e37d7 ("machine: Tweak the order of topology members in struct CpuTopology")
    Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
    Message-Id: <20230628135437.1145805-5-zhao1.liu@linux.intel.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 196ea60a734c346d7d75f1d89aa37703d4d854e7)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/smbios/smbios.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index 3aae9328c0..10cd22f610 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -714,6 +714,7 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
     char sock_str[128];
     size_t tbl_len = SMBIOS_TYPE_4_LEN_V28;
     unsigned threads_per_socket;
+    unsigned cores_per_socket;
 
     if (smbios_ep_type == SMBIOS_ENTRY_POINT_TYPE_64) {
         tbl_len = SMBIOS_TYPE_4_LEN_V30;
@@ -749,8 +750,9 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
     SMBIOS_TABLE_SET_STR(4, part_number_str, type4.part);
 
     threads_per_socket = machine_topo_get_threads_per_socket(ms);
+    cores_per_socket = machine_topo_get_cores_per_socket(ms);
 
-    t->core_count = (ms->smp.cores > 255) ? 0xFF : ms->smp.cores;
+    t->core_count = (cores_per_socket > 255) ? 0xFF : cores_per_socket;
     t->core_enabled = t->core_count;
 
     t->thread_count = (threads_per_socket > 255) ? 0xFF : threads_per_socket;
@@ -759,7 +761,7 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
     t->processor_family2 = cpu_to_le16(0x01); /* Other */
 
     if (tbl_len == SMBIOS_TYPE_4_LEN_V30) {
-        t->core_count2 = t->core_enabled2 = cpu_to_le16(ms->smp.cores);
+        t->core_count2 = t->core_enabled2 = cpu_to_le16(cores_per_socket);
         t->thread_count2 = cpu_to_le16(threads_per_socket);
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:46:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:46:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815487.1229288 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symwf-000459-W7; Thu, 10 Oct 2024 06:46:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815487.1229288; Thu, 10 Oct 2024 06:46: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 1symwf-000451-TZ; Thu, 10 Oct 2024 06:46:45 +0000
Received: by outflank-mailman (input) for mailman id 815487;
 Thu, 10 Oct 2024 06:46: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 1symwf-00044s-36
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:46: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 1symwe-0004lj-VT
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:46:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symwe-00028J-Up
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:46: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=dCe3OIMi+B+HZwaVtZk9abgPMKz7Rs+Xk9CfFaRBJ4g=; b=HVuW7dI1mBP+Td+EjOj2q9pgNM
	e5x5Kco8h0DLMEFI4kSw1S14Mu9o8MrartFnpVx2mI8wu4Pq3JGv1mgzWltPJSuvKJCCkTLRyHWPJ
	+6XHn5uUb+U6SPcQSQCsFRiPqMnBV2AFG/HsohwWd64SE/E2bIKVItwY1eXnMwpiay44=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/i2c: Fix bitbang_i2c_data trace event
Message-Id: <E1symwe-00028J-Up@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:46:44 +0000

commit 07b7ec0af04711f62c7c274d1440d10efb936ede
Author:     BALATON Zoltan <balaton@eik.bme.hu>
AuthorDate: Fri Jul 28 02:45:24 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/i2c: Fix bitbang_i2c_data trace event
    
    The clock and data values were logged swapped. Correct the trace event
    text to match what is logged. Also fix a typo in a comment nearby.
    
    Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (cherry picked from commit 8ada214a902225c90583b644cabd85bc89bf188c)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/i2c/bitbang_i2c.c | 2 +-
 hw/i2c/trace-events  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c
index bb18954765..de5f5aacf5 100644
--- a/hw/i2c/bitbang_i2c.c
+++ b/hw/i2c/bitbang_i2c.c
@@ -70,7 +70,7 @@ static int bitbang_i2c_ret(bitbang_i2c_interface *i2c, int level)
     return level & i2c->last_data;
 }
 
-/* Leave device data pin unodified.  */
+/* Leave device data pin unmodified.  */
 static int bitbang_i2c_nop(bitbang_i2c_interface *i2c)
 {
     return bitbang_i2c_ret(i2c, i2c->device_out);
diff --git a/hw/i2c/trace-events b/hw/i2c/trace-events
index 8e88aa24c1..d7b1e25858 100644
--- a/hw/i2c/trace-events
+++ b/hw/i2c/trace-events
@@ -5,7 +5,7 @@ bitbang_i2c_state(const char *old_state, const char *new_state) "state %s -> %s"
 bitbang_i2c_addr(uint8_t addr) "Address 0x%02x"
 bitbang_i2c_send(uint8_t byte) "TX byte 0x%02x"
 bitbang_i2c_recv(uint8_t byte) "RX byte 0x%02x"
-bitbang_i2c_data(unsigned dat, unsigned clk, unsigned old_out, unsigned new_out) "dat %u clk %u out %u -> %u"
+bitbang_i2c_data(unsigned clk, unsigned dat, unsigned old_out, unsigned new_out) "clk %u dat %u out %u -> %u"
 
 # core.c
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:46:56 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:46:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815488.1229292 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symwq-0004ho-1M; Thu, 10 Oct 2024 06:46:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815488.1229292; Thu, 10 Oct 2024 06:46: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 1symwp-0004hg-V4; Thu, 10 Oct 2024 06:46:55 +0000
Received: by outflank-mailman (input) for mailman id 815488;
 Thu, 10 Oct 2024 06:46: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 1symwp-0004cE-2s
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:46: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 1symwp-0004m8-2C
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:46:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symwp-000293-1Y
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:46: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=fSsrg1Cjx9SpO0cqcFvxnGtwRuzG08flMASPJewsxEI=; b=zlpNewMc5mWKvLFmSR0X9PK6YA
	eJrGaSGX9rYm/sQYG2hMwEv40aPtJH16G0R1L/B+Vdzf0YUlE7eVNmzV/pBjYupQMBrpHKwZ7qTSj
	3Y2l4ZYSubPjnxKHortKDmO94d+7ffY//lIwLUxJq/jQd6l9vP0Pid0ocJ4owBfAkAJQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] dump: kdump-zlib data pages not dumped with pvtime/aarch64
Message-Id: <E1symwp-000293-1Y@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:46:55 +0000

commit a11a2007a50d6d2b8e57605fc2ec40b9f962df13
Author:     Dongli Zhang <dongli.zhang@oracle.com>
AuthorDate: Wed Jul 12 22:58:19 2023 -0700
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    dump: kdump-zlib data pages not dumped with pvtime/aarch64
    
    The kdump-zlib data pages are not dumped from aarch64 host when the
    'pvtime' is involved, that is, when the block->target_end is not aligned to
    page_size. In the below example, it is expected to dump two blocks.
    
    (qemu) info mtree -f
    ... ...
      00000000090a0000-00000000090a0fff (prio 0, ram): pvtime KVM
    ... ...
      0000000040000000-00000001bfffffff (prio 0, ram): mach-virt.ram KVM
    ... ...
    
    However, there is an issue with get_next_page() so that the pages for
    "mach-virt.ram" will not be dumped.
    
    At line 1296, although we have reached at the end of the 'pvtime' block,
    since it is not aligned to the page_size (e.g., 0x10000), it will not break
    at line 1298.
    
    1255 static bool get_next_page(GuestPhysBlock **blockptr, uint64_t *pfnptr,
    1256                           uint8_t **bufptr, DumpState *s)
    ... ...
    1294             memcpy(buf + addr % page_size, hbuf, n);
    1295             addr += n;
    1296             if (addr % page_size == 0) {
    1297                 /* we filled up the page */
    1298                 break;
    1299             }
    
    As a result, get_next_page() will continue to the next
    block ("mach-virt.ram"). Finally, when get_next_page() returns to the
    caller:
    
    - 'pfnptr' is referring to the 'pvtime'
    - but 'blockptr' is referring to the "mach-virt.ram"
    
    When get_next_page() is called the next time, "*pfnptr += 1" still refers
    to the prior 'pvtime'. It will exit immediately because it is out of the
    range of the current "mach-virt.ram".
    
    The fix is to break when it is time to come to the next block, so that both
    'pfnptr' and 'blockptr' refer to the same block.
    
    Fixes: 94d788408d2d ("dump: fix kdump to work over non-aligned blocks")
    Cc: Joe Jin <joe.jin@oracle.com>
    Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Message-ID: <20230713055819.30497-1-dongli.zhang@oracle.com>
    (cherry picked from commit 8a64609eea8cb2bac015968c4b62da5bce266e22)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 dump/dump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dump/dump.c b/dump/dump.c
index 1f1a6edcab..d4ef713cd0 100644
--- a/dump/dump.c
+++ b/dump/dump.c
@@ -1293,8 +1293,8 @@ static bool get_next_page(GuestPhysBlock **blockptr, uint64_t *pfnptr,
 
             memcpy(buf + addr % page_size, hbuf, n);
             addr += n;
-            if (addr % page_size == 0) {
-                /* we filled up the page */
+            if (addr % page_size == 0 || addr >= block->target_end) {
+                /* we filled up the page or the current block is finished */
                 break;
             }
         } else {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:47:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:47:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815489.1229296 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symx0-0005HT-2v; Thu, 10 Oct 2024 06:47:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815489.1229296; Thu, 10 Oct 2024 06:47: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 1symx0-0005HL-0H; Thu, 10 Oct 2024 06:47:06 +0000
Received: by outflank-mailman (input) for mailman id 815489;
 Thu, 10 Oct 2024 06:47: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 1symwz-0005Dm-5w
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:47: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 1symwz-0004mT-5H
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:47:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symwz-00029w-4f
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:47: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=IaRx/gT7eGQtJpjq3HEwubaVk2wLEclWVzNy4bf/JWU=; b=O9dfYDfMW3s5MyEWMd9RnW/SKK
	drCZzIs5nCaPDnU6jZ9wqbq99I1QoL1NJqIkClrEbrkrF0X7/8MYKCib/VNadtUAUUiJ1E6QYhdDP
	vTQXIdUi3Bc76tXef49pp2MndPG+iUS2ubcbszcGadHs0HSGR8UDx14z969vr5PY1ViY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/nvme: fix oob memory read in fdp events log
Message-Id: <E1symwz-00029w-4f@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:47:05 +0000

commit dd496f92b97a9a2d36f83a91d8adae90ba65465a
Author:     Klaus Jensen <k.jensen@samsung.com>
AuthorDate: Thu Aug 3 20:44:23 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/nvme: fix oob memory read in fdp events log
    
    As reported by Trend Micro's Zero Day Initiative, an oob memory read
    vulnerability exists in nvme_fdp_events(). The host-provided offset is
    not verified.
    
    Fix this.
    
    This is only exploitable when Flexible Data Placement mode (fdp=on) is
    enabled.
    
    Fixes: CVE-2023-4135
    Fixes: 73064edfb864 ("hw/nvme: flexible data placement emulation")
    Reported-by: Trend Micro's Zero Day Initiative
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
    (cherry picked from commit ecb1b7b082d3b7dceff0e486a114502fc52c0fdf)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/nvme/ctrl.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 812246689c..e16e19ead8 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -5092,6 +5092,11 @@ static uint16_t nvme_fdp_events(NvmeCtrl *n, uint32_t endgrpid,
     }
 
     log_size = sizeof(NvmeFdpEventsLog) + ebuf->nelems * sizeof(NvmeFdpEvent);
+
+    if (off >= log_size) {
+        return NVME_INVALID_FIELD | NVME_DNR;
+    }
+
     trans_len = MIN(log_size - off, buf_len);
     elog = g_malloc0(log_size);
     elog->num_events = cpu_to_le32(ebuf->nelems);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:47:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:47:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815490.1229299 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symxA-0005lh-4V; Thu, 10 Oct 2024 06:47:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815490.1229299; Thu, 10 Oct 2024 06:47: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 1symxA-0005lZ-1i; Thu, 10 Oct 2024 06:47:16 +0000
Received: by outflank-mailman (input) for mailman id 815490;
 Thu, 10 Oct 2024 06:47: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 1symx9-0005ir-9A
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:47: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 1symx9-0004mc-8U
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:47:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symx9-0002At-7r
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:47: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=0frBfWz7SGwIxX1BACZc3o5TJ5GSGV4t24NrOwU6/9U=; b=SpSQ93uC4YBN3i98lBYDUiZN8C
	2ZHAdygVOLIiAgDnRO5Ta1kJzL9MWFjJu9Po0ypfvMgtV/ydsrAoti+X2Mf7RDOEz3EKTr/EnScvO
	bpPD0tvCdlqB4Nrs0G5pY17HX7wKKe740juSyrQoxcQ5MJ5niy4sJDflcyPoHQKLFjdE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/nvme: fix compliance issue wrt. iosqes/iocqes
Message-Id: <E1symx9-0002At-7r@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:47:15 +0000

commit cbd3c5db76f0c91ec092692b3ace2727403e4954
Author:     Klaus Jensen <k.jensen@samsung.com>
AuthorDate: Wed Jul 19 20:21:58 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/nvme: fix compliance issue wrt. iosqes/iocqes
    
    As of prior to this patch, the controller checks the value of CC.IOCQES
    and CC.IOSQES prior to enabling the controller. As reported by Ben in
    GitLab issue #1691, this is not spec compliant. The controller should
    only check these values when queues are created.
    
    This patch moves these checks to nvme_create_cq(). We do not need to
    check it in nvme_create_sq() since that will error out if the completion
    queue is not already created.
    
    Also, since the controller exclusively supports SQEs of size 64 bytes
    and CQEs of size 16 bytes, hard code that.
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1691
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
    (cherry picked from commit 6a33f2e920ec0b489a77200888e3692664077f2d)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/nvme/ctrl.c       | 46 ++++++++++++----------------------------------
 hw/nvme/nvme.h       |  9 +++++++--
 hw/nvme/trace-events |  1 +
 3 files changed, 20 insertions(+), 36 deletions(-)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index e16e19ead8..00b910ca9e 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -1504,7 +1504,7 @@ static void nvme_post_cqes(void *opaque)
         req->cqe.status = cpu_to_le16((req->status << 1) | cq->phase);
         req->cqe.sq_id = cpu_to_le16(sq->sqid);
         req->cqe.sq_head = cpu_to_le16(sq->head);
-        addr = cq->dma_addr + cq->tail * n->cqe_size;
+        addr = cq->dma_addr + (cq->tail << NVME_CQES);
         ret = pci_dma_write(PCI_DEVICE(n), addr, (void *)&req->cqe,
                             sizeof(req->cqe));
         if (ret) {
@@ -5272,10 +5272,18 @@ static uint16_t nvme_create_cq(NvmeCtrl *n, NvmeRequest *req)
     uint16_t qsize = le16_to_cpu(c->qsize);
     uint16_t qflags = le16_to_cpu(c->cq_flags);
     uint64_t prp1 = le64_to_cpu(c->prp1);
+    uint32_t cc = ldq_le_p(&n->bar.cc);
+    uint8_t iocqes = NVME_CC_IOCQES(cc);
+    uint8_t iosqes = NVME_CC_IOSQES(cc);
 
     trace_pci_nvme_create_cq(prp1, cqid, vector, qsize, qflags,
                              NVME_CQ_FLAGS_IEN(qflags) != 0);
 
+    if (iosqes != NVME_SQES || iocqes != NVME_CQES) {
+        trace_pci_nvme_err_invalid_create_cq_entry_size(iosqes, iocqes);
+        return NVME_MAX_QSIZE_EXCEEDED | NVME_DNR;
+    }
+
     if (unlikely(!cqid || cqid > n->conf_ioqpairs || n->cq[cqid] != NULL)) {
         trace_pci_nvme_err_invalid_create_cq_cqid(cqid);
         return NVME_INVALID_QID | NVME_DNR;
@@ -6981,7 +6989,7 @@ static void nvme_process_sq(void *opaque)
     }
 
     while (!(nvme_sq_empty(sq) || QTAILQ_EMPTY(&sq->req_list))) {
-        addr = sq->dma_addr + sq->head * n->sqe_size;
+        addr = sq->dma_addr + (sq->head << NVME_SQES);
         if (nvme_addr_read(n, addr, (void *)&cmd, sizeof(cmd))) {
             trace_pci_nvme_err_addr_read(addr);
             trace_pci_nvme_err_cfs();
@@ -7208,34 +7216,6 @@ static int nvme_start_ctrl(NvmeCtrl *n)
                     NVME_CAP_MPSMAX(cap));
         return -1;
     }
-    if (unlikely(NVME_CC_IOCQES(cc) <
-                 NVME_CTRL_CQES_MIN(n->id_ctrl.cqes))) {
-        trace_pci_nvme_err_startfail_cqent_too_small(
-                    NVME_CC_IOCQES(cc),
-                    NVME_CTRL_CQES_MIN(cap));
-        return -1;
-    }
-    if (unlikely(NVME_CC_IOCQES(cc) >
-                 NVME_CTRL_CQES_MAX(n->id_ctrl.cqes))) {
-        trace_pci_nvme_err_startfail_cqent_too_large(
-                    NVME_CC_IOCQES(cc),
-                    NVME_CTRL_CQES_MAX(cap));
-        return -1;
-    }
-    if (unlikely(NVME_CC_IOSQES(cc) <
-                 NVME_CTRL_SQES_MIN(n->id_ctrl.sqes))) {
-        trace_pci_nvme_err_startfail_sqent_too_small(
-                    NVME_CC_IOSQES(cc),
-                    NVME_CTRL_SQES_MIN(cap));
-        return -1;
-    }
-    if (unlikely(NVME_CC_IOSQES(cc) >
-                 NVME_CTRL_SQES_MAX(n->id_ctrl.sqes))) {
-        trace_pci_nvme_err_startfail_sqent_too_large(
-                    NVME_CC_IOSQES(cc),
-                    NVME_CTRL_SQES_MAX(cap));
-        return -1;
-    }
     if (unlikely(!NVME_AQA_ASQS(aqa))) {
         trace_pci_nvme_err_startfail_asqent_sz_zero();
         return -1;
@@ -7248,8 +7228,6 @@ static int nvme_start_ctrl(NvmeCtrl *n)
     n->page_bits = page_bits;
     n->page_size = page_size;
     n->max_prp_ents = n->page_size / sizeof(uint64_t);
-    n->cqe_size = 1 << NVME_CC_IOCQES(cc);
-    n->sqe_size = 1 << NVME_CC_IOSQES(cc);
     nvme_init_cq(&n->admin_cq, n, acq, 0, 0, NVME_AQA_ACQS(aqa) + 1, 1);
     nvme_init_sq(&n->admin_sq, n, asq, 0, 0, NVME_AQA_ASQS(aqa) + 1);
 
@@ -8221,8 +8199,8 @@ static void nvme_init_ctrl(NvmeCtrl *n, PCIDevice *pci_dev)
     id->wctemp = cpu_to_le16(NVME_TEMPERATURE_WARNING);
     id->cctemp = cpu_to_le16(NVME_TEMPERATURE_CRITICAL);
 
-    id->sqes = (0x6 << 4) | 0x6;
-    id->cqes = (0x4 << 4) | 0x4;
+    id->sqes = (NVME_SQES << 4) | NVME_SQES;
+    id->cqes = (NVME_CQES << 4) | NVME_CQES;
     id->nn = cpu_to_le32(NVME_MAX_NAMESPACES);
     id->oncs = cpu_to_le16(NVME_ONCS_WRITE_ZEROES | NVME_ONCS_TIMESTAMP |
                            NVME_ONCS_FEATURES | NVME_ONCS_DSM |
diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h
index 209e8f5b4c..5f2ae7b28b 100644
--- a/hw/nvme/nvme.h
+++ b/hw/nvme/nvme.h
@@ -30,6 +30,13 @@
 #define NVME_FDP_MAX_EVENTS 63
 #define NVME_FDP_MAXPIDS 128
 
+/*
+ * The controller only supports Submission and Completion Queue Entry Sizes of
+ * 64 and 16 bytes respectively.
+ */
+#define NVME_SQES 6
+#define NVME_CQES 4
+
 QEMU_BUILD_BUG_ON(NVME_MAX_NAMESPACES > NVME_NSID_BROADCAST - 1);
 
 typedef struct NvmeCtrl NvmeCtrl;
@@ -530,8 +537,6 @@ typedef struct NvmeCtrl {
     uint32_t    page_size;
     uint16_t    page_bits;
     uint16_t    max_prp_ents;
-    uint16_t    cqe_size;
-    uint16_t    sqe_size;
     uint32_t    max_q_ents;
     uint8_t     outstanding_aers;
     uint32_t    irq_status;
diff --git a/hw/nvme/trace-events b/hw/nvme/trace-events
index 7f7837e1a2..75083e992d 100644
--- a/hw/nvme/trace-events
+++ b/hw/nvme/trace-events
@@ -168,6 +168,7 @@ pci_nvme_err_invalid_create_cq_size(uint16_t size) "failed creating completion q
 pci_nvme_err_invalid_create_cq_addr(uint64_t addr) "failed creating completion queue, addr=0x%"PRIx64""
 pci_nvme_err_invalid_create_cq_vector(uint16_t vector) "failed creating completion queue, vector=%"PRIu16""
 pci_nvme_err_invalid_create_cq_qflags(uint16_t qflags) "failed creating completion queue, qflags=%"PRIu16""
+pci_nvme_err_invalid_create_cq_entry_size(uint8_t iosqes, uint8_t iocqes) "iosqes %"PRIu8" iocqes %"PRIu8""
 pci_nvme_err_invalid_identify_cns(uint16_t cns) "identify, invalid cns=0x%"PRIx16""
 pci_nvme_err_invalid_getfeat(int dw10) "invalid get features, dw10=0x%"PRIx32""
 pci_nvme_err_invalid_setfeat(uint32_t dw10) "invalid set features, dw10=0x%"PRIx32""
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:47:27 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:47:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815491.1229304 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symxL-0006Gb-7C; Thu, 10 Oct 2024 06:47:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815491.1229304; Thu, 10 Oct 2024 06:47: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 1symxL-0006GT-4Z; Thu, 10 Oct 2024 06:47:27 +0000
Received: by outflank-mailman (input) for mailman id 815491;
 Thu, 10 Oct 2024 06:47: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 1symxJ-0006Dd-Bw
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:47: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 1symxJ-0004oG-BJ
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:47:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symxJ-0002Bt-Af
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:47: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=ydeq3kLtnP6vr7huzyAtlinIA2xlTB3iQswSauMSVNw=; b=PbKpqltbfG9GhRyjMi7S8P7DeR
	Y/NH3BS39jGp18/w/wqi7WDA4qzCb7Li15ew5uyccP2/LjNuV91pU8jnbOLsZMQNnvcW/0PBEfYf/
	MwUSlBtoW8BVPyf1sLtBOY3VYKvGpBGDtjTrYOJLv7YWXW5vpUM2go/qFCa2mEtNC3TM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/nvme: fix CRC64 for guard tag
Message-Id: <E1symxJ-0002Bt-Af@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:47:25 +0000

commit f47369c3d114ddd2021d9ca2cdde9fe138675bcb
Author:     Ankit Kumar <ankit.kumar@samsung.com>
AuthorDate: Tue Aug 8 02:57:43 2023 +0530
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/nvme: fix CRC64 for guard tag
    
    The nvme CRC64 generator expects the caller to pass inverted seed value.
    Pass inverted crc value for metadata buffer.
    
    Cc: qemu-stable@nongnu.org
    Fixes: 44219b6029fc ("hw/nvme: 64-bit pi support")
    Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
    (cherry picked from commit dbdb13f931d7cf2d3c3ca662e751bb1551e9eab6)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/nvme/dif.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/nvme/dif.c b/hw/nvme/dif.c
index 63c44c86ab..01b19c3373 100644
--- a/hw/nvme/dif.c
+++ b/hw/nvme/dif.c
@@ -115,7 +115,7 @@ static void nvme_dif_pract_generate_dif_crc64(NvmeNamespace *ns, uint8_t *buf,
         uint64_t crc = crc64_nvme(~0ULL, buf, ns->lbasz);
 
         if (pil) {
-            crc = crc64_nvme(crc, mbuf, pil);
+            crc = crc64_nvme(~crc, mbuf, pil);
         }
 
         dif->g64.guard = cpu_to_be64(crc);
@@ -246,7 +246,7 @@ static uint16_t nvme_dif_prchk_crc64(NvmeNamespace *ns, NvmeDifTuple *dif,
         uint64_t crc = crc64_nvme(~0ULL, buf, ns->lbasz);
 
         if (pil) {
-            crc = crc64_nvme(crc, mbuf, pil);
+            crc = crc64_nvme(~crc, mbuf, pil);
         }
 
         trace_pci_nvme_dif_prchk_guard_crc64(be64_to_cpu(dif->g64.guard), crc);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:47:37 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:47:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815492.1229309 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symxV-0006Z2-96; Thu, 10 Oct 2024 06:47:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815492.1229309; Thu, 10 Oct 2024 06:47: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 1symxV-0006Yu-5w; Thu, 10 Oct 2024 06:47:37 +0000
Received: by outflank-mailman (input) for mailman id 815492;
 Thu, 10 Oct 2024 06:47: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 1symxT-0006Yh-F8
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:47: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 1symxT-0004oP-EV
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:47:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symxT-0002Cp-Ds
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:47: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=XBJZqU/3o3lHl2+f0NxDCckuu9lzH3n0YsXaNlgCqnU=; b=0Jpjsz9erA6DAjTwIMR+k5ueCv
	CwQ2hUw5VLMNjrmJHwI0AUpfYidBCu3pIXKVuMiPCkRD9FFT8lLYoD9ACuYZAznpX+vdGvpDxsufg
	Wwv2OY5ElBnS6gNSK6KbOFYCjtNlkMSkjSHfuMy+1zwP2ls7TlxBMkEgoCp4VJnYjFvs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/nvme: fix null pointer access in directive receive
Message-Id: <E1symxT-0002Cp-Ds@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:47:35 +0000

commit 43328764f7a0c4371f0142a8cee6dcdbeecfa633
Author:     Klaus Jensen <k.jensen@samsung.com>
AuthorDate: Tue Aug 8 17:16:13 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/nvme: fix null pointer access in directive receive
    
    nvme_directive_receive() does not check if an endurance group has been
    configured (set) prior to testing if flexible data placement is enabled
    or not.
    
    Fix this.
    
    Cc: qemu-stable@nongnu.org
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1815
    Fixes: 73064edfb864 ("hw/nvme: flexible data placement emulation")
    Reviewed-by: Jesper Wendel Devantier <j.devantier@samsung.com>
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
    (cherry picked from commit 6c8f8456cb0b239812dee5211881426496da7b98)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/nvme/ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 00b910ca9e..ac505727e5 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -6877,7 +6877,7 @@ static uint16_t nvme_directive_receive(NvmeCtrl *n, NvmeRequest *req)
     case NVME_DIRECTIVE_IDENTIFY:
         switch (doper) {
         case NVME_DIRECTIVE_RETURN_PARAMS:
-            if (ns->endgrp->fdp.enabled) {
+            if (ns->endgrp && ns->endgrp->fdp.enabled) {
                 id.supported |= 1 << NVME_DIRECTIVE_DATA_PLACEMENT;
                 id.enabled |= 1 << NVME_DIRECTIVE_DATA_PLACEMENT;
                 id.persistent |= 1 << NVME_DIRECTIVE_DATA_PLACEMENT;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:47:47 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:47:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815493.1229312 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symxf-0006bX-A0; Thu, 10 Oct 2024 06:47:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815493.1229312; Thu, 10 Oct 2024 06:47: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 1symxf-0006bP-7M; Thu, 10 Oct 2024 06:47:47 +0000
Received: by outflank-mailman (input) for mailman id 815493;
 Thu, 10 Oct 2024 06:47: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 1symxd-0006bG-IJ
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:47: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 1symxd-0004oX-Hi
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:47:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symxd-0002Dc-H7
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:47: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=7k+jskrv8LsH+L/pNm+ybsVX1QEKPTfKbRFvsGuChRg=; b=1owwH7cbPNeoj4TsenjIKVSW7m
	itbA+H6WnU0rz4smm+UsdhTEzMWJwKhd77Zda+R7hQGl9hAT8dpf/fII5bgLWnZmrDmtYwid/jKHo
	7T2Mrh83GQ6Po1CX+n8vwNX8EHhM4BCSl9ko3BXKeU3zflHMHcIQH76sUKFhbB6UW3Vs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/nvme: fix null pointer access in ruh update
Message-Id: <E1symxd-0002Dc-H7@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:47:45 +0000

commit bb5f9036d5f6914215c75e19048444b2ce06b190
Author:     Klaus Jensen <k.jensen@samsung.com>
AuthorDate: Tue Aug 8 17:16:14 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/nvme: fix null pointer access in ruh update
    
    The Reclaim Unit Update operation in I/O Management Receive does not
    verify the presence of a configured endurance group prior to accessing
    it.
    
    Fix this.
    
    Cc: qemu-stable@nongnu.org
    Fixes: 73064edfb864 ("hw/nvme: flexible data placement emulation")
    Reviewed-by: Jesper Wendel Devantier <j.devantier@samsung.com>
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
    (cherry picked from commit 3439ba9c5da943d96f7a3c86e0a7eb2ff48de41c)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/nvme/ctrl.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index ac505727e5..c71d57d17a 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -4333,7 +4333,13 @@ static uint16_t nvme_io_mgmt_send_ruh_update(NvmeCtrl *n, NvmeRequest *req)
     uint32_t npid = (cdw10 >> 1) + 1;
     unsigned int i = 0;
     g_autofree uint16_t *pids = NULL;
-    uint32_t maxnpid = n->subsys->endgrp.fdp.nrg * n->subsys->endgrp.fdp.nruh;
+    uint32_t maxnpid;
+
+    if (!ns->endgrp || !ns->endgrp->fdp.enabled) {
+        return NVME_FDP_DISABLED | NVME_DNR;
+    }
+
+    maxnpid = n->subsys->endgrp.fdp.nrg * n->subsys->endgrp.fdp.nruh;
 
     if (unlikely(npid >= MIN(NVME_FDP_MAXPIDS, maxnpid))) {
         return NVME_INVALID_FIELD | NVME_DNR;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:47:57 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:47:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815494.1229315 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symxp-0006e6-BI; Thu, 10 Oct 2024 06:47:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815494.1229315; Thu, 10 Oct 2024 06:47: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 1symxp-0006dy-8h; Thu, 10 Oct 2024 06:47:57 +0000
Received: by outflank-mailman (input) for mailman id 815494;
 Thu, 10 Oct 2024 06:47: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 1symxn-0006dk-LR
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:47: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 1symxn-0004ox-Kn
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:47:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symxn-0002Eq-K8
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:47: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=b9LtQ6G/kbS2fTe3/JfDqTOPmBqi2nQxHsPqa4pLlA8=; b=mA/Yme1rCPnz4GFLgJQZc+GbWN
	RV+taGIKxWr/KmC/EJZsvv8gOibFvyfkIJytIzDU1/zdPaoKvSrwKJVpDn8CqSSSJ1EcqtEKzuKlc
	3EVHjS4KMNb1Cs4K/JCFnRQ5i5f1P/fLf9o8NQPpBPv5lWDOqlkkjowT7sJIgcgfV9uU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] linux-user/elfload: Set V in ELF_HWCAP for RISC-V
Message-Id: <E1symxn-0002Eq-K8@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:47:55 +0000

commit ee638bc5b53cff87768b0b7c6d2c4a4e275994f6
Author:     Nathan Egge <negge@xiph.org>
AuthorDate: Thu Aug 3 09:14:24 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    linux-user/elfload: Set V in ELF_HWCAP for RISC-V
    
    Set V bit for hwcap if misa is set.
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1793
    Signed-off-by: Nathan Egge <negge@xiph.org>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Message-Id: <20230803131424.40744-1-negge@xiph.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    (cherry picked from commit 4333f0924c2f2ca8efaebaed8c24f55f77d8b013)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 linux-user/elfload.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 88ef26dc03..a3e78a7e18 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -1679,7 +1679,8 @@ static uint32_t get_elf_hwcap(void)
 #define MISA_BIT(EXT) (1 << (EXT - 'A'))
     RISCVCPU *cpu = RISCV_CPU(thread_cpu);
     uint32_t mask = MISA_BIT('I') | MISA_BIT('M') | MISA_BIT('A')
-                    | MISA_BIT('F') | MISA_BIT('D') | MISA_BIT('C');
+                    | MISA_BIT('F') | MISA_BIT('D') | MISA_BIT('C')
+                    | MISA_BIT('V');
 
     return cpu->env.misa_ext & mask;
 #undef MISA_BIT
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:48:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:48:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815495.1229319 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symxz-0006gh-Ch; Thu, 10 Oct 2024 06:48:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815495.1229319; Thu, 10 Oct 2024 06:48: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 1symxz-0006gZ-A4; Thu, 10 Oct 2024 06:48:07 +0000
Received: by outflank-mailman (input) for mailman id 815495;
 Thu, 10 Oct 2024 06:48: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 1symxx-0006gQ-OQ
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:48: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 1symxx-0004pE-Nk
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:48:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symxx-0002G2-N4
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:48: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=xBUfDxXIsaZFIMqzqC0jxdjCKy+E1I66U0NaiOMmoiE=; b=ZKnzNj0AwtLE5ZKHVGuNo5oCyk
	QzRNah5DScKWvc2KtYhSJge1EMrVB6cncJzNE2fNxUalCpUJdauAjPcmCIw+F8wh7bSrm5exEQE8m
	ZYQtmtpGbmfkPaCbiHRafLBdqRnN242M2UB/35ORYt34GruUWIi0wpbQBTOGFUp06boc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for microblaze
Message-Id: <E1symxx-0002G2-N4@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:48:05 +0000

commit 43d2db492878f7931457d6d4d9097f9573917c6d
Author:     Richard Henderson <richard.henderson@linaro.org>
AuthorDate: Sat Jun 3 14:55:03 2023 -0700
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for microblaze
    
    Based on gcc's microblaze.h setting BIGGEST_ALIGNMENT to 32 bits.
    
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    (cherry picked from commit e73f27003e777fd9b77d13e71c5268015b8ed2b6)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 include/exec/user/abitypes.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/exec/user/abitypes.h b/include/exec/user/abitypes.h
index 743b8bb9ea..beba0a48c7 100644
--- a/include/exec/user/abitypes.h
+++ b/include/exec/user/abitypes.h
@@ -15,7 +15,9 @@
 #define ABI_LLONG_ALIGNMENT 2
 #endif
 
-#if (defined(TARGET_I386) && !defined(TARGET_X86_64)) || defined(TARGET_SH4)
+#if (defined(TARGET_I386) && !defined(TARGET_X86_64)) \
+    || defined(TARGET_SH4) \
+    || defined(TARGET_MICROBLAZE)
 #define ABI_LLONG_ALIGNMENT 4
 #endif
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:48:17 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:48:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815496.1229324 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symy9-0006jW-EN; Thu, 10 Oct 2024 06:48:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815496.1229324; Thu, 10 Oct 2024 06:48: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 1symy9-0006jO-BX; Thu, 10 Oct 2024 06:48:17 +0000
Received: by outflank-mailman (input) for mailman id 815496;
 Thu, 10 Oct 2024 06:48: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 1symy7-0006j6-Rr
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:48: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 1symy7-0004pL-R9
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:48:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symy7-0002Gy-Pz
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:48: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=qfVVZbZIqPLOoWzzLnPD5OAu7X8rNO3cZqjRqRPmukE=; b=U6/jwYFDjNNkHMkj775JzZcXyT
	tzYSvfiQnleihTMRHsI+ayrPCmpLcLdQJ6Jq3UTWxkj5u+Gv5VtlkNGCOqd9AYqPvLhAMZ9ydGsLu
	rSLS5Ar3LtYHSahZ/hT+fsdzTYOGv9d0FM9Hrj7hUUYLrcf6QFqXD7zdfOd8E9iuXwQM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for nios2
Message-Id: <E1symy7-0002Gy-Pz@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:48:15 +0000

commit 40cfe12cb6f8b9d3a1172af2e65540773ad17be1
Author:     Richard Henderson <richard.henderson@linaro.org>
AuthorDate: Sat Jun 3 14:58:46 2023 -0700
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for nios2
    
    Based on gcc's nios2.h setting BIGGEST_ALIGNMENT to 32 bits.
    
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    (cherry picked from commit ea9812d93f9c3e1a308ac33097021c50d581d10e)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 include/exec/user/abitypes.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/exec/user/abitypes.h b/include/exec/user/abitypes.h
index beba0a48c7..6191ce9f74 100644
--- a/include/exec/user/abitypes.h
+++ b/include/exec/user/abitypes.h
@@ -17,7 +17,8 @@
 
 #if (defined(TARGET_I386) && !defined(TARGET_X86_64)) \
     || defined(TARGET_SH4) \
-    || defined(TARGET_MICROBLAZE)
+    || defined(TARGET_MICROBLAZE) \
+    || defined(TARGET_NIOS2)
 #define ABI_LLONG_ALIGNMENT 4
 #endif
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:48:27 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:48:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815497.1229329 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symyJ-0006mL-GK; Thu, 10 Oct 2024 06:48:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815497.1229329; Thu, 10 Oct 2024 06:48: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 1symyJ-0006mC-Cu; Thu, 10 Oct 2024 06:48:27 +0000
Received: by outflank-mailman (input) for mailman id 815497;
 Thu, 10 Oct 2024 06:48: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 1symyH-0006m3-Ul
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:48: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 1symyH-0004pQ-U9
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:48:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symyH-0002Hk-TR
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:48: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=DvQpeO7c841VmfGwygCzCMQySWoXEUGThDoVCZPlGwI=; b=zTsGwkn55BzreQDdN1bIxntJO0
	BfjOP5d0cLhLl7MVL99GlSZPccHaa30E2rLniJTMT64pdLGUsReZ90s8GA4iSNbgvhQpBlP8a7rUt
	e61RLhJEXH8sNH/U61dSZQjfr4LSUfzE6JPDSFBVgfwWZcNFiLiFgT7pISBxYiA1dvo8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] Fixed incorrect LLONG alignment for openrisc and cris
Message-Id: <E1symyH-0002Hk-TR@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:48:25 +0000

commit af0c16fae9532033453f8c208ad1e2e78701de5c
Author:     Luca Bonissi <qemu@bonslack.org>
AuthorDate: Thu Aug 3 02:15:57 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    Fixed incorrect LLONG alignment for openrisc and cris
    
    OpenRISC (or1k) has long long alignment to 4 bytes, but currently not
    defined in abitypes.h. This lead to incorrect packing of /epoll_event/
    structure and eventually infinite loop while waiting for file
    descriptor[s] event[s].
    
    Fixed also CRIS alignments (1 byte for all types).
    
    Signed-off-by: Luca Bonissi <qemu@bonslack.org>
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1770
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (cherry picked from commit 6ee960823da8fd780ae9912c4327b7e85e80d846)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 include/exec/user/abitypes.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/exec/user/abitypes.h b/include/exec/user/abitypes.h
index 6191ce9f74..6178453d94 100644
--- a/include/exec/user/abitypes.h
+++ b/include/exec/user/abitypes.h
@@ -15,8 +15,16 @@
 #define ABI_LLONG_ALIGNMENT 2
 #endif
 
+#ifdef TARGET_CRIS
+#define ABI_SHORT_ALIGNMENT 1
+#define ABI_INT_ALIGNMENT 1
+#define ABI_LONG_ALIGNMENT 1
+#define ABI_LLONG_ALIGNMENT 1
+#endif
+
 #if (defined(TARGET_I386) && !defined(TARGET_X86_64)) \
     || defined(TARGET_SH4) \
+    || defined(TARGET_OPENRISC) \
     || defined(TARGET_MICROBLAZE) \
     || defined(TARGET_NIOS2)
 #define ABI_LLONG_ALIGNMENT 4
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:48:37 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:48:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815498.1229331 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symyT-0006ot-Gw; Thu, 10 Oct 2024 06:48:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815498.1229331; Thu, 10 Oct 2024 06:48: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 1symyT-0006om-ET; Thu, 10 Oct 2024 06:48:37 +0000
Received: by outflank-mailman (input) for mailman id 815498;
 Thu, 10 Oct 2024 06:48: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 1symyS-0006oe-1S
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:48: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 1symyS-0004pb-0l
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:48:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symyS-0002K3-08
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:48: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=vNuCMYxqkZxH6cbxkbFxTZl6Tkw4kZipuZl0UYlxr0o=; b=6VDkZ1EWInBqKhIE+yrEgQAca8
	KP59lqJTHuIChnTdmUmrGaLZXEy0hH3WgQ+TqPqg4RBOQGP6TLh+L7ZmaPytHijtaDK7p5pONUvjb
	auC5/7ZySFIthsqxPE/usZobnwfBf3QzdREr904a9iqGPmjPwsdloOSzkmlJGAMjxfMY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/sd/sdhci: Do not force sdhci_mmio_*_ops onto all SD controllers
Message-Id: <E1symyS-0002K3-08@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:48:36 +0000

commit b4b3aac5b542557c63bc24049b61c2640ad90dd9
Author:     Bernhard Beschow <shentey@gmail.com>
AuthorDate: Sun Jul 9 10:09:50 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/sd/sdhci: Do not force sdhci_mmio_*_ops onto all SD controllers
    
    Since commit c0a55a0c9da2 "hw/sd/sdhci: Support big endian SD host controller
    interfaces" sdhci_common_realize() forces all SD card controllers to use either
    sdhci_mmio_le_ops or sdhci_mmio_be_ops, depending on the "endianness" property.
    However, there are device models which use different MMIO ops: TYPE_IMX_USDHC
    uses usdhc_mmio_ops and TYPE_S3C_SDHCI uses sdhci_s3c_mmio_ops.
    
    Forcing sdhci_mmio_le_ops breaks SD card handling on the "sabrelite" board, for
    example. Fix this by defaulting the io_ops to little endian and switch to big
    endian in sdhci_common_realize() only if there is a matchig big endian variant
    available.
    
    Fixes: c0a55a0c9da2 ("hw/sd/sdhci: Support big endian SD host controller
    interfaces")
    
    Signed-off-by: Bernhard Beschow <shentey@gmail.com>
    Tested-by: Guenter Roeck <linux@roeck-us.net>
    Message-Id: <20230709080950.92489-1-shentey@gmail.com>
    (cherry picked from commit 3b830790151ff231531ef2595793e387dd154efb)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/sd/sdhci.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index 6811f0f1a8..362c2c86aa 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -1382,6 +1382,8 @@ void sdhci_initfn(SDHCIState *s)
 
     s->insert_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, sdhci_raise_insertion_irq, s);
     s->transfer_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, sdhci_data_transfer, s);
+
+    s->io_ops = &sdhci_mmio_le_ops;
 }
 
 void sdhci_uninitfn(SDHCIState *s)
@@ -1399,9 +1401,13 @@ void sdhci_common_realize(SDHCIState *s, Error **errp)
 
     switch (s->endianness) {
     case DEVICE_LITTLE_ENDIAN:
-        s->io_ops = &sdhci_mmio_le_ops;
+        /* s->io_ops is little endian by default */
         break;
     case DEVICE_BIG_ENDIAN:
+        if (s->io_ops != &sdhci_mmio_le_ops) {
+            error_setg(errp, "SD controller doesn't support big endianness");
+            return;
+        }
         s->io_ops = &sdhci_mmio_be_ops;
         break;
     default:
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:48:47 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:48:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815499.1229336 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symyd-0006rv-J3; Thu, 10 Oct 2024 06:48:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815499.1229336; Thu, 10 Oct 2024 06:48: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 1symyd-0006rn-Fw; Thu, 10 Oct 2024 06:48:47 +0000
Received: by outflank-mailman (input) for mailman id 815499;
 Thu, 10 Oct 2024 06:48: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 1symyc-0006rc-4P
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:48: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 1symyc-0004pi-3k
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:48:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symyc-0002Kh-37
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:48: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=Y4tMRN4+RP8p9HIq/t/QJ7oDEdpXBGXPeDV7e4emqZ8=; b=Ioub6j9PhOIvKMAWsns1NHwrTq
	fy8Xsep7mcNIp6CjnJKluzWtTft7SqyaIHy0H2OptPIOBfP6/k/AlZkooX7KQ9mHornvPf8KP44S2
	ByfJ/oHbAGe1CuAQR+mhuJAHW/CNy5vZlmVfBapYH3i2hGmfyZCmZ3zbCgfiRwctuekU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] target/s390x: Fix the "ignored match" case in VSTRS
Message-Id: <E1symyc-0002Kh-37@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:48:46 +0000

commit 179a37924d55e645e660731f0e389d70a277a1c2
Author:     Ilya Leoshkevich <iii@linux.ibm.com>
AuthorDate: Sat Aug 5 01:03:18 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/s390x: Fix the "ignored match" case in VSTRS
    
    Currently the emulation of VSTRS recognizes partial matches in presence
    of \0 in the haystack, which, according to PoP, is not correct:
    
        If the ZS flag is one and a zero byte was detected
        in the second operand, then there can not be a
        partial match ...
    
    Add a check for this. While at it, fold a number of explicitly handled
    special cases into the generic logic.
    
    Cc: qemu-stable@nongnu.org
    Reported-by: Claudio Fontana <cfontana@suse.de>
    Closes: https://lists.gnu.org/archive/html/qemu-devel/2023-08/msg00633.html
    Fixes: 1d706f314191 ("target/s390x: vxeh2: vector string search")
    Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
    Message-Id: <20230804233748.218935-3-iii@linux.ibm.com>
    Tested-by: Claudio Fontana <cfontana@suse.de>
    Acked-by: David Hildenbrand <david@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 791b2b6a930273db694b9ba48bbb406e78715927)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/s390x/tcg/vec_string_helper.c | 54 ++++++++++++------------------------
 1 file changed, 17 insertions(+), 37 deletions(-)

diff --git a/target/s390x/tcg/vec_string_helper.c b/target/s390x/tcg/vec_string_helper.c
index 9b85becdfb..a19f429768 100644
--- a/target/s390x/tcg/vec_string_helper.c
+++ b/target/s390x/tcg/vec_string_helper.c
@@ -474,9 +474,9 @@ DEF_VSTRC_CC_RT_HELPER(32)
 static int vstrs(S390Vector *v1, const S390Vector *v2, const S390Vector *v3,
                  const S390Vector *v4, uint8_t es, bool zs)
 {
-    int substr_elen, substr_0, str_elen, i, j, k, cc;
+    int substr_elen, i, j, k, cc;
     int nelem = 16 >> es;
-    bool eos = false;
+    int str_leftmost_0;
 
     substr_elen = s390_vec_read_element8(v4, 7) >> es;
 
@@ -498,47 +498,20 @@ static int vstrs(S390Vector *v1, const S390Vector *v2, const S390Vector *v3,
     }
 
     /* If ZS, look for eos in the searched string. */
+    str_leftmost_0 = nelem;
     if (zs) {
         for (k = 0; k < nelem; k++) {
             if (s390_vec_read_element(v2, k, es) == 0) {
-                eos = true;
+                str_leftmost_0 = k;
                 break;
             }
         }
-        str_elen = k;
-    } else {
-        str_elen = nelem;
     }
 
-    substr_0 = s390_vec_read_element(v3, 0, es);
-
-    for (k = 0; ; k++) {
-        for (; k < str_elen; k++) {
-            if (s390_vec_read_element(v2, k, es) == substr_0) {
-                break;
-            }
-        }
-
-        /* If we reached the end of the string, no match. */
-        if (k == str_elen) {
-            cc = eos; /* no match (with or without zero char) */
-            goto done;
-        }
-
-        /* If the substring is only one char, match. */
-        if (substr_elen == 1) {
-            cc = 2; /* full match */
-            goto done;
-        }
-
-        /* If the match begins at the last char, we have a partial match. */
-        if (k == str_elen - 1) {
-            cc = 3; /* partial match */
-            goto done;
-        }
-
+    cc = str_leftmost_0 == nelem ? 0 : 1;  /* No match. */
+    for (k = 0; k < nelem; k++) {
         i = MIN(nelem, k + substr_elen);
-        for (j = k + 1; j < i; j++) {
+        for (j = k; j < i; j++) {
             uint32_t e2 = s390_vec_read_element(v2, j, es);
             uint32_t e3 = s390_vec_read_element(v3, j - k, es);
             if (e2 != e3) {
@@ -546,9 +519,16 @@ static int vstrs(S390Vector *v1, const S390Vector *v2, const S390Vector *v3,
             }
         }
         if (j == i) {
-            /* Matched up until "end". */
-            cc = i - k == substr_elen ? 2 : 3; /* full or partial match */
-            goto done;
+            /* All elements matched. */
+            if (k > str_leftmost_0) {
+                cc = 1;  /* Ignored match. */
+                k = nelem;
+            } else if (i - k == substr_elen) {
+                cc = 2;  /* Full match. */
+            } else {
+                cc = 3;  /* Partial match. */
+            }
+            break;
         }
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:48:57 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:48:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815500.1229340 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symyn-0006v7-LP; Thu, 10 Oct 2024 06:48:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815500.1229340; Thu, 10 Oct 2024 06:48: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 1symyn-0006uz-Iq; Thu, 10 Oct 2024 06:48:57 +0000
Received: by outflank-mailman (input) for mailman id 815500;
 Thu, 10 Oct 2024 06:48: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 1symym-0006un-7d
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:48: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 1symym-0004q5-6u
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:48:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symym-0002LR-68
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:48: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=q1KtmH3za0w3iVnVDGXmda7hgQG3zz/WQCEVxK1p5fA=; b=xZ42IWDYcaiKnhYC0vu2VcnKHk
	Rra13FobSakiJgPhenunpgbgmCt7GDrdqtZDdnCUcU8MmvwMHhYe1o19+gkuHFwKGMcu7a1XNYmq/
	KvqB2XhFOHS1oaPgDdW2jYq/IXkr4rh6Chj/ldr9hRv6ne9bvP3N93MlYE2eJgEHjlUE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] target/s390x: Use a 16-bit immediate in VREP
Message-Id: <E1symym-0002LR-68@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:48:56 +0000

commit 14f78932e02c15e59f3a0894a08159cd00712765
Author:     Ilya Leoshkevich <iii@linux.ibm.com>
AuthorDate: Mon Aug 7 18:34:31 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/s390x: Use a 16-bit immediate in VREP
    
    Unlike most other instructions that contain an immediate element index,
    VREP's one is 16-bit, and not 4-bit. The code uses only 8 bits, so
    using, e.g., 0x101 does not lead to a specification exception.
    
    Fix by checking all 16 bits.
    
    Cc: qemu-stable@nongnu.org
    Fixes: 28d08731b1d8 ("s390x/tcg: Implement VECTOR REPLICATE")
    Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
    Message-Id: <20230807163459.849766-1-iii@linux.ibm.com>
    Reviewed-by: David Hildenbrand <david@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 23e87d419f347b6b5f4da3bf70d222acc24cdb64)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/s390x/tcg/translate_vx.c.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/s390x/tcg/translate_vx.c.inc b/target/s390x/tcg/translate_vx.c.inc
index f8df121d3d..a6d840d406 100644
--- a/target/s390x/tcg/translate_vx.c.inc
+++ b/target/s390x/tcg/translate_vx.c.inc
@@ -57,7 +57,7 @@
 #define FPF_LONG        3
 #define FPF_EXT         4
 
-static inline bool valid_vec_element(uint8_t enr, MemOp es)
+static inline bool valid_vec_element(uint16_t enr, MemOp es)
 {
     return !(enr & ~(NUM_VEC_ELEMENTS(es) - 1));
 }
@@ -964,7 +964,7 @@ static DisasJumpType op_vpdi(DisasContext *s, DisasOps *o)
 
 static DisasJumpType op_vrep(DisasContext *s, DisasOps *o)
 {
-    const uint8_t enr = get_field(s, i2);
+    const uint16_t enr = get_field(s, i2);
     const uint8_t es = get_field(s, m4);
 
     if (es > ES_64 || !valid_vec_element(enr, es)) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:49:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:49:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815501.1229345 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symyx-0006xf-O0; Thu, 10 Oct 2024 06:49:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815501.1229345; Thu, 10 Oct 2024 06:49: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 1symyx-0006xX-KD; Thu, 10 Oct 2024 06:49:07 +0000
Received: by outflank-mailman (input) for mailman id 815501;
 Thu, 10 Oct 2024 06:49: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 1symyw-0006xN-AY
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:49: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 1symyw-0004qS-9t
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:49:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symyw-0002Mh-97
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:49: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=66rIAIICVqx4S0X9/NNQ9+rUKXukt0xn2GeGWep8vEc=; b=sFbkNAQWNPE6LUkWvMLX1KPbIs
	0Dd7uqN2hmmNoMCom+oyGfl+r13h6u/n7/C4prxQn1HfM9NHdItdLQkE+zpVfBQfkw49tFT9y0Nsc
	kctIr78/fpLXBR2ExG3NkMoRJXzK3WUNd7rcQg7vQAR3x41wLSHWL76b6S/s4gLek4c4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] target/s390x: Fix VSTL with a large length
Message-Id: <E1symyw-0002Mh-97@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:49:06 +0000

commit 62ac9cbb6fe2d088dd56cd258c61b033f610fe6f
Author:     Ilya Leoshkevich <iii@linux.ibm.com>
AuthorDate: Sat Aug 5 01:55:33 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/s390x: Fix VSTL with a large length
    
    The length is always truncated to 16 bytes. Do not probe more than
    that.
    
    Cc: qemu-stable@nongnu.org
    Fixes: 0e0a5b49ad58 ("s390x/tcg: Implement VECTOR STORE WITH LENGTH")
    Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
    Message-Id: <20230804235624.263260-1-iii@linux.ibm.com>
    Reviewed-by: David Hildenbrand <david@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 6db3518ba4fcddd71049718f138552999f0d97b4)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/s390x/tcg/vec_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/s390x/tcg/vec_helper.c b/target/s390x/tcg/vec_helper.c
index 48d86722b2..dafc4c3582 100644
--- a/target/s390x/tcg/vec_helper.c
+++ b/target/s390x/tcg/vec_helper.c
@@ -193,7 +193,7 @@ void HELPER(vstl)(CPUS390XState *env, const void *v1, uint64_t addr,
                   uint64_t bytes)
 {
     /* Probe write access before actually modifying memory */
-    probe_write_access(env, addr, bytes, GETPC());
+    probe_write_access(env, addr, MIN(bytes, 16), GETPC());
 
     if (likely(bytes >= 16)) {
         cpu_stq_data_ra(env, addr, s390_vec_read_element64(v1, 0), GETPC());
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:49:19 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:49:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815502.1229349 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symz7-00070C-Om; Thu, 10 Oct 2024 06:49:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815502.1229349; Thu, 10 Oct 2024 06:49: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 1symz7-000700-Li; Thu, 10 Oct 2024 06:49:17 +0000
Received: by outflank-mailman (input) for mailman id 815502;
 Thu, 10 Oct 2024 06:49: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 1symz6-0006zs-Dd
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:49: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 1symz6-0004qb-Cu
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:49:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symz6-0002NU-CF
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:49: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=zWc9GHGSXKQDzQjbBVt5fazhS9PCEb11wqkHHj4vXpo=; b=GeEKvrvB5mnyHMh0Ij0QzufF6/
	cdr4lwsAoMER06IosIPFEuJXsamI94h1Ha7yzUFxtI1WPDyGuPVm43Yd6axr+kyOE/CGYQ8VcgDzN
	lN67yRQtCv/RLi8TEiOngaXVef8eh0Xowd+ifRMDwL1RhWT1N4KHymV2tADluaPV/74I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] target/s390x: Check reserved bits of VFMIN/VFMAX's M5
Message-Id: <E1symz6-0002NU-CF@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:49:16 +0000

commit 96fd3b85081a119353b9ef3f783c2bc8c63758a2
Author:     Ilya Leoshkevich <iii@linux.ibm.com>
AuthorDate: Sat Aug 5 01:46:10 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/s390x: Check reserved bits of VFMIN/VFMAX's M5
    
    VFMIN and VFMAX should raise a specification exceptions when bits 1-3
    of M5 are set.
    
    Cc: qemu-stable@nongnu.org
    Fixes: da4807527f3b ("s390x/tcg: Implement VECTOR FP (MAXIMUM|MINIMUM)")
    Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
    Message-Id: <20230804234621.252522-1-iii@linux.ibm.com>
    Reviewed-by: David Hildenbrand <david@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 6a2ea6151835aa4f5fee29382a421c13b0e6619f)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/s390x/tcg/translate_vx.c.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/s390x/tcg/translate_vx.c.inc b/target/s390x/tcg/translate_vx.c.inc
index a6d840d406..ec94d39df0 100644
--- a/target/s390x/tcg/translate_vx.c.inc
+++ b/target/s390x/tcg/translate_vx.c.inc
@@ -3047,7 +3047,7 @@ static DisasJumpType op_vfmax(DisasContext *s, DisasOps *o)
     const uint8_t m5 = get_field(s, m5);
     gen_helper_gvec_3_ptr *fn;
 
-    if (m6 == 5 || m6 == 6 || m6 == 7 || m6 >= 13) {
+    if (m6 == 5 || m6 == 6 || m6 == 7 || m6 >= 13 || (m5 & 7)) {
         gen_program_exception(s, PGM_SPECIFICATION);
         return DISAS_NORETURN;
     }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:49:27 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:49:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815503.1229352 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symzH-00072b-Pm; Thu, 10 Oct 2024 06:49:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815503.1229352; Thu, 10 Oct 2024 06:49: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 1symzH-00072T-N7; Thu, 10 Oct 2024 06:49:27 +0000
Received: by outflank-mailman (input) for mailman id 815503;
 Thu, 10 Oct 2024 06:49: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 1symzG-00072L-Gd
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:49: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 1symzG-0004ql-Fx
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:49:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symzG-0002Pf-F5
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:49: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=QKIOABd5Vnon2O0V+UrnPhJXDlKmNczRDkGOhSvU9zU=; b=u3+4mmEjOsOjQI9C734YqnPXCu
	o2K18cAX9tsjGDrS2ne/S6fQBJKVkMjZrD6Qns4g9oqqeN+U1qs1eQBJ0Zkl+/F2Seu7U7P3aCxny
	Cl86d4FBk0Fjb+t0C6NKEyjVCBOdB7bMy2j8xP8T3dcF7E14YoGK5HRTFFHv3VCSsMUk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] include/hw/virtio/virtio-gpu: Fix virtio-gpu with blob on big endian hosts
Message-Id: <E1symzG-0002Pf-F5@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:49:26 +0000

commit f2f8e74ff4eeca352981be4c5fdb03f19e58be7d
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Tue Aug 15 14:20:07 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    include/hw/virtio/virtio-gpu: Fix virtio-gpu with blob on big endian hosts
    
    Using "-device virtio-gpu,blob=true" currently does not work on big
    endian hosts (like s390x). The guest kernel prints an error message
    like:
    
     [drm:virtio_gpu_dequeue_ctrl_func [virtio_gpu]] *ERROR* response 0x1200 (command 0x10c)
    
    and the display stays black. When running QEMU with "-d guest_errors",
    it shows an error message like this:
    
     virtio_gpu_create_mapping_iov: nr_entries is too big (83886080 > 16384)
    
    which indicates that this value has not been properly byte-swapped.
    And indeed, the virtio_gpu_create_blob_bswap() function (that should
    swap the fields in the related structure) fails to swap some of the
    entries. After correctly swapping all missing values here, too, the
    virtio-gpu device is now also working with blob=true on s390x hosts.
    
    Fixes: e0933d91b1 ("virtio-gpu: Add virtio_gpu_resource_create_blob")
    Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=2230469
    Message-Id: <20230815122007.928049-1-thuth@redhat.com>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit d194362910138776e8abd6bb3c9fb3693254e95f)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 include/hw/virtio/virtio-gpu-bswap.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/hw/virtio/virtio-gpu-bswap.h b/include/hw/virtio/virtio-gpu-bswap.h
index 9124108485..637a0585d0 100644
--- a/include/hw/virtio/virtio-gpu-bswap.h
+++ b/include/hw/virtio/virtio-gpu-bswap.h
@@ -63,7 +63,10 @@ virtio_gpu_create_blob_bswap(struct virtio_gpu_resource_create_blob *cblob)
 {
     virtio_gpu_ctrl_hdr_bswap(&cblob->hdr);
     le32_to_cpus(&cblob->resource_id);
+    le32_to_cpus(&cblob->blob_mem);
     le32_to_cpus(&cblob->blob_flags);
+    le32_to_cpus(&cblob->nr_entries);
+    le64_to_cpus(&cblob->blob_id);
     le64_to_cpus(&cblob->size);
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:49:38 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:49:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815504.1229356 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symzS-00075J-RJ; Thu, 10 Oct 2024 06:49:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815504.1229356; Thu, 10 Oct 2024 06:49:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symzS-00075C-Oc; Thu, 10 Oct 2024 06:49:38 +0000
Received: by outflank-mailman (input) for mailman id 815504;
 Thu, 10 Oct 2024 06:49: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 1symzQ-00074y-Kg
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:49: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 1symzQ-0004qx-Jz
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:49:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symzQ-0002QR-JB
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:49: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=TDGMNiQwxjZcnVGvLXQqc5919Vmdi5PPZW+MV8Xu2WQ=; b=rMXrG5fYk/w2Hitd6p9FLqRaWN
	xMJBqy2PG1EIEK9x8U8Gcl+4vGdlUVe6T7EWDYSaY/l+zO3PBk3peQtNEHw6YejztnQO/FgIY0fqi
	N9iu+HE1Kp3EZFcHL6a004cIITd+XyPVHXWgpaDThABCyS+PZsi9uqBWRr4Y3Mj61P6E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] kvm: Introduce kvm_arch_get_default_type hook
Message-Id: <E1symzQ-0002QR-JB@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:49:36 +0000

commit aa152711dbed973d7a4ecc725819d3eb280906f1
Author:     Akihiko Odaki <akihiko.odaki@daynix.com>
AuthorDate: Tue Aug 22 17:31:02 2023 +0100
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    kvm: Introduce kvm_arch_get_default_type hook
    
    kvm_arch_get_default_type() returns the default KVM type. This hook is
    particularly useful to derive a KVM type that is valid for "none"
    machine model, which is used by libvirt to probe the availability of
    KVM.
    
    For MIPS, the existing mips_kvm_type() is reused. This function ensures
    the availability of VZ which is mandatory to use KVM on the current
    QEMU.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
    Message-id: 20230727073134.134102-2-akihiko.odaki@daynix.com
    Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
    [PMM: added doc comment for new function]
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    (cherry picked from commit 5e0d65909c6f335d578b90491e165440c99adf81)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 accel/kvm/kvm-all.c      | 4 +++-
 hw/mips/loongson3_virt.c | 2 --
 include/sysemu/kvm.h     | 2 ++
 target/arm/kvm.c         | 5 +++++
 target/i386/kvm/kvm.c    | 5 +++++
 target/mips/kvm.c        | 2 +-
 target/mips/kvm_mips.h   | 9 ---------
 target/ppc/kvm.c         | 5 +++++
 target/riscv/kvm.c       | 5 +++++
 target/s390x/kvm/kvm.c   | 5 +++++
 10 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index cf3a88d90e..4c3ad74a6d 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -2382,7 +2382,7 @@ static int kvm_init(MachineState *ms)
     KVMState *s;
     const KVMCapabilityInfo *missing_cap;
     int ret;
-    int type = 0;
+    int type;
     uint64_t dirty_log_manual_caps;
 
     qemu_mutex_init(&kml_slots_lock);
@@ -2447,6 +2447,8 @@ static int kvm_init(MachineState *ms)
         type = mc->kvm_type(ms, kvm_type);
     } else if (mc->kvm_type) {
         type = mc->kvm_type(ms, NULL);
+    } else {
+        type = kvm_arch_get_default_type(ms);
     }
 
     do {
diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c
index 25534288dd..b4f6bff1b8 100644
--- a/hw/mips/loongson3_virt.c
+++ b/hw/mips/loongson3_virt.c
@@ -29,7 +29,6 @@
 #include "qemu/datadir.h"
 #include "qapi/error.h"
 #include "elf.h"
-#include "kvm_mips.h"
 #include "hw/char/serial.h"
 #include "hw/intc/loongson_liointc.h"
 #include "hw/mips/mips.h"
@@ -617,7 +616,6 @@ static void loongson3v_machine_class_init(ObjectClass *oc, void *data)
     mc->max_cpus = LOONGSON_MAX_VCPUS;
     mc->default_ram_id = "loongson3.highram";
     mc->default_ram_size = 1600 * MiB;
-    mc->kvm_type = mips_kvm_type;
     mc->minimum_page_bits = 14;
 }
 
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index c8281c07a7..e97ea915a2 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -369,6 +369,8 @@ int kvm_arch_get_registers(CPUState *cpu);
 
 int kvm_arch_put_registers(CPUState *cpu, int level);
 
+int kvm_arch_get_default_type(MachineState *ms);
+
 int kvm_arch_init(MachineState *ms, KVMState *s);
 
 int kvm_arch_init_vcpu(CPUState *cpu);
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 84da49332c..34bc329b5b 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -247,6 +247,11 @@ int kvm_arm_get_max_vm_ipa_size(MachineState *ms, bool *fixed_ipa)
     return ret > 0 ? ret : 40;
 }
 
+int kvm_arch_get_default_type(MachineState *ms)
+{
+    return 0;
+}
+
 int kvm_arch_init(MachineState *ms, KVMState *s)
 {
     int ret = 0;
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index de531842f6..eb2f4e3238 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -2552,6 +2552,11 @@ static void register_smram_listener(Notifier *n, void *unused)
                                  &smram_address_space, 1, "kvm-smram");
 }
 
+int kvm_arch_get_default_type(MachineState *ms)
+{
+    return 0;
+}
+
 int kvm_arch_init(MachineState *ms, KVMState *s)
 {
     uint64_t identity_base = 0xfffbc000;
diff --git a/target/mips/kvm.c b/target/mips/kvm.c
index c14e8f550f..e98aad01bd 100644
--- a/target/mips/kvm.c
+++ b/target/mips/kvm.c
@@ -1266,7 +1266,7 @@ int kvm_arch_msi_data_to_gsi(uint32_t data)
     abort();
 }
 
-int mips_kvm_type(MachineState *machine, const char *vm_type)
+int kvm_arch_get_default_type(MachineState *machine)
 {
 #if defined(KVM_CAP_MIPS_VZ)
     int r;
diff --git a/target/mips/kvm_mips.h b/target/mips/kvm_mips.h
index 171d53dbe1..c711269d0a 100644
--- a/target/mips/kvm_mips.h
+++ b/target/mips/kvm_mips.h
@@ -25,13 +25,4 @@ void kvm_mips_reset_vcpu(MIPSCPU *cpu);
 int kvm_mips_set_interrupt(MIPSCPU *cpu, int irq, int level);
 int kvm_mips_set_ipi_interrupt(MIPSCPU *cpu, int irq, int level);
 
-#ifdef CONFIG_KVM
-int mips_kvm_type(MachineState *machine, const char *vm_type);
-#else
-static inline int mips_kvm_type(MachineState *machine, const char *vm_type)
-{
-    return 0;
-}
-#endif
-
 #endif /* KVM_MIPS_H */
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 78f6fc50cd..90a69af926 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -107,6 +107,11 @@ static int kvm_ppc_register_host_cpu_type(void);
 static void kvmppc_get_cpu_characteristics(KVMState *s);
 static int kvmppc_get_dec_bits(void);
 
+int kvm_arch_get_default_type(MachineState *ms)
+{
+    return 0;
+}
+
 int kvm_arch_init(MachineState *ms, KVMState *s)
 {
     cap_interrupt_unset = kvm_check_extension(s, KVM_CAP_PPC_UNSET_IRQ);
diff --git a/target/riscv/kvm.c b/target/riscv/kvm.c
index 0f932a5b96..ee0b381400 100644
--- a/target/riscv/kvm.c
+++ b/target/riscv/kvm.c
@@ -426,6 +426,11 @@ int kvm_arch_add_msi_route_post(struct kvm_irq_routing_entry *route,
     return 0;
 }
 
+int kvm_arch_get_default_type(MachineState *ms)
+{
+    return 0;
+}
+
 int kvm_arch_init(MachineState *ms, KVMState *s)
 {
     return 0;
diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c
index 3ac7ec9acf..8ffe140513 100644
--- a/target/s390x/kvm/kvm.c
+++ b/target/s390x/kvm/kvm.c
@@ -340,6 +340,11 @@ static void ccw_machine_class_foreach(ObjectClass *oc, void *opaque)
     mc->default_cpu_type = S390_CPU_TYPE_NAME("host");
 }
 
+int kvm_arch_get_default_type(MachineState *ms)
+{
+    return 0;
+}
+
 int kvm_arch_init(MachineState *ms, KVMState *s)
 {
     object_class_foreach(ccw_machine_class_foreach, TYPE_S390_CCW_MACHINE,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:49:47 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:49:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815505.1229361 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symzb-000785-T4; Thu, 10 Oct 2024 06:49:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815505.1229361; Thu, 10 Oct 2024 06:49: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 1symzb-00077x-QH; Thu, 10 Oct 2024 06:49:47 +0000
Received: by outflank-mailman (input) for mailman id 815505;
 Thu, 10 Oct 2024 06:49: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 1symza-00077n-Na
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:49: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 1symza-0004rW-Mw
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:49:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symza-0002RY-MH
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:49: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=LtEH7VI3vnuNsOWY4sHfTS1eijSxHBIfSaglQiLj/co=; b=bsKVUJzQfUcE8A3QSnBY1pK9mu
	bau7cR3GBdOgPqB0DmSw2HJw7Yt+myPu45mZ1V3JTe53LztewUEU5g+vH2oCu2thBLQlU2RVNnK+e
	9CeW5yywkDwyjL1mGot1PGcdxFm2tnWb1c8JCjJXr731PjoHnQavRmHYb5fU/xW5rkOk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] accel/kvm: Specify default IPA size for arm64
Message-Id: <E1symza-0002RY-MH@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:49:46 +0000

commit f5cb21416e6fc6a3e2d58f4bb557c929ffe01818
Author:     Akihiko Odaki <akihiko.odaki@daynix.com>
AuthorDate: Tue Aug 22 17:31:02 2023 +0100
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    accel/kvm: Specify default IPA size for arm64
    
    Before this change, the default KVM type, which is used for non-virt
    machine models, was 0.
    
    The kernel documentation says:
    > On arm64, the physical address size for a VM (IPA Size limit) is
    > limited to 40bits by default. The limit can be configured if the host
    > supports the extension KVM_CAP_ARM_VM_IPA_SIZE. When supported, use
    > KVM_VM_TYPE_ARM_IPA_SIZE(IPA_Bits) to set the size in the machine type
    > identifier, where IPA_Bits is the maximum width of any physical
    > address used by the VM. The IPA_Bits is encoded in bits[7-0] of the
    > machine type identifier.
    >
    > e.g, to configure a guest to use 48bit physical address size::
    >
    >     vm_fd = ioctl(dev_fd, KVM_CREATE_VM, KVM_VM_TYPE_ARM_IPA_SIZE(48));
    >
    > The requested size (IPA_Bits) must be:
    >
    >  ==   =========================================================
    >   0   Implies default size, 40bits (for backward compatibility)
    >   N   Implies N bits, where N is a positive integer such that,
    >       32 <= N <= Host_IPA_Limit
    >  ==   =========================================================
    
    > Host_IPA_Limit is the maximum possible value for IPA_Bits on the host
    > and is dependent on the CPU capability and the kernel configuration.
    > The limit can be retrieved using KVM_CAP_ARM_VM_IPA_SIZE of the
    > KVM_CHECK_EXTENSION ioctl() at run-time.
    >
    > Creation of the VM will fail if the requested IPA size (whether it is
    > implicit or explicit) is unsupported on the host.
    https://docs.kernel.org/virt/kvm/api.html#kvm-create-vm
    
    So if Host_IPA_Limit < 40, specifying 0 as the type will fail. This
    actually confused libvirt, which uses "none" machine model to probe the
    KVM availability, on M2 MacBook Air.
    
    Fix this by using Host_IPA_Limit as the default type when
    KVM_CAP_ARM_VM_IPA_SIZE is available.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
    Message-id: 20230727073134.134102-3-akihiko.odaki@daynix.com
    Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    (cherry picked from commit 1ab445af8cd99343f29032b5944023ad7d8edebf)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/arm/kvm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 34bc329b5b..e219f78535 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -249,7 +249,9 @@ int kvm_arm_get_max_vm_ipa_size(MachineState *ms, bool *fixed_ipa)
 
 int kvm_arch_get_default_type(MachineState *ms)
 {
-    return 0;
+    bool fixed_ipa;
+    int size = kvm_arm_get_max_vm_ipa_size(ms, &fixed_ipa);
+    return fixed_ipa ? 0 : size;
 }
 
 int kvm_arch_init(MachineState *ms, KVMState *s)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:49:57 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:49:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815506.1229364 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symzl-0007An-Uy; Thu, 10 Oct 2024 06:49:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815506.1229364; Thu, 10 Oct 2024 06:49: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 1symzl-0007Af-Rn; Thu, 10 Oct 2024 06:49:57 +0000
Received: by outflank-mailman (input) for mailman id 815506;
 Thu, 10 Oct 2024 06:49: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 1symzk-0007AV-RJ
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:49: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 1symzk-0004rf-Qh
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:49:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symzk-0002SN-Pe
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:49: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=H2qXzQdTqIhgWqHhjW+PUSCr08f4JXG+BWsEvd/xvxY=; b=KzYNYZh79r+6tg8ULfT98C2cUH
	KikXuW0FHQL85guUCY5kpBMCFu5GAOWPTjimfdQWrtMedMJ96FDVMHb+eN3aMmU5IkLt+Kqw7SB+r
	jLzDvHbcYAJAFt6NHR5Ruyzf/HSY8lV3LB0LKDXJK6Ds6WCF3ZbxMYp23yrd0DGY8o9k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] target/arm: Fix SME ST1Q
Message-Id: <E1symzk-0002SN-Pe@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:49:56 +0000

commit 09640031edd4314b8b2b05235f3da8114b4d5d36
Author:     Richard Henderson <richard.henderson@linaro.org>
AuthorDate: Tue Aug 22 17:31:13 2023 +0100
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/arm: Fix SME ST1Q
    
    A typo, noted in the bug report, resulting in an
    incorrect write offset.
    
    Cc: qemu-stable@nongnu.org
    Fixes: 7390e0e9ab8 ("target/arm: Implement SME LD1, ST1")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1833
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20230818214255.146905-1-richard.henderson@linaro.org
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    (cherry picked from commit 4b3520fd93cd49cc56dfcab45d90735cc2e35af7)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/arm/tcg/sme_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/arm/tcg/sme_helper.c b/target/arm/tcg/sme_helper.c
index 1e67fcac30..296826ffe6 100644
--- a/target/arm/tcg/sme_helper.c
+++ b/target/arm/tcg/sme_helper.c
@@ -379,7 +379,7 @@ static inline void HNAME##_host(void *za, intptr_t off, void *host)         \
 {                                                                           \
     uint64_t *ptr = za + off;                                               \
     HOST(host, ptr[BE]);                                                    \
-    HOST(host + 1, ptr[!BE]);                                               \
+    HOST(host + 8, ptr[!BE]);                                               \
 }                                                                           \
 static inline void VNAME##_v_host(void *za, intptr_t off, void *host)       \
 {                                                                           \
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:50:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:50:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815507.1229368 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symzw-00087K-16; Thu, 10 Oct 2024 06:50:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815507.1229368; Thu, 10 Oct 2024 06:50:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1symzv-00087D-Ui; Thu, 10 Oct 2024 06:50:07 +0000
Received: by outflank-mailman (input) for mailman id 815507;
 Thu, 10 Oct 2024 06:50: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 1symzu-00081i-Uh
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:50: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 1symzu-0004sN-U3
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:50:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1symzu-0002Ts-TH
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:50: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=obF08DE/5RwhTQHVkKcKLbW5itHchsiowJC8rzSDyqc=; b=AF4UEVAX39SH6nQFYbPELsI/EK
	t6ei8KaxAom5NLRAhYlM6LmDoQuaPYy7/HzkPNOYKH2Dlj+Ylzx/XGZKQnBUu5c3rEYJG8Vg3w3L4
	PGs7dmNvNaDmbTwWvTKdeI4MJpJXzfvxcqX1dvHAN70IUgs4iwbse05U+TimL9T+pBeE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] target/arm: Fix 64-bit SSRA
Message-Id: <E1symzu-0002Ts-TH@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:50:06 +0000

commit d4c0ac705d720e19d9ec5b9fe1c6c7bb22b6913a
Author:     Richard Henderson <richard.henderson@linaro.org>
AuthorDate: Tue Aug 22 17:31:14 2023 +0100
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/arm: Fix 64-bit SSRA
    
    Typo applied byte-wise shift instead of double-word shift.
    
    Cc: qemu-stable@nongnu.org
    Fixes: 631e565450c ("target/arm: Create gen_gvec_[us]sra")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1737
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20230821022025.397682-1-richard.henderson@linaro.org
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    (cherry picked from commit cd1e4db73646006039f25879af3bff55b2295ff3)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/arm/tcg/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c
index 1e4d94e58a..e1fe68f73a 100644
--- a/target/arm/tcg/translate.c
+++ b/target/arm/tcg/translate.c
@@ -3063,7 +3063,7 @@ void gen_gvec_ssra(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs,
           .vece = MO_32 },
         { .fni8 = gen_ssra64_i64,
           .fniv = gen_ssra_vec,
-          .fno = gen_helper_gvec_ssra_b,
+          .fno = gen_helper_gvec_ssra_d,
           .prefer_i64 = TCG_TARGET_REG_BITS == 64,
           .opt_opc = vecop_list,
           .load_dest = true,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:50:18 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:50:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815508.1229374 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn06-00089s-3H; Thu, 10 Oct 2024 06:50:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815508.1229374; Thu, 10 Oct 2024 06:50:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn06-00089k-00; Thu, 10 Oct 2024 06:50:18 +0000
Received: by outflank-mailman (input) for mailman id 815508;
 Thu, 10 Oct 2024 06:50:17 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn05-00089X-1Z
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:50:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn05-0004sV-0r
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:50:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn04-0002V4-WE
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:50:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5Az3+93zbbNGp16QKTRbpmcgPyvcPBqo5oGWiqh4UNg=; b=RnQzGjG1BlYr1E4N8hhJoRYY2C
	v/waeL2pUOs2mUqUmvAth1h6d9JJf47lMimIxyyVBvCKWVjVW6J8s2CYQFlGN/P5Mo4HAuRYOKHAD
	nQ8aes+M8mOVdv1ThXxxcd6g01yz11tbpQn3vOoz31s2VDdROZucgBsjOBwxZZwyNNWM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] docs/about/license: Update LICENSE URL
Message-Id: <E1syn04-0002V4-WE@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:50:16 +0000

commit 3c934310ffdfef69a085b8061d884d222b1d201b
Author:     Philippe Mathieu-Daudé <philmd@linaro.org>
AuthorDate: Tue Aug 22 14:57:16 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    docs/about/license: Update LICENSE URL
    
    In early 2021 (see commit 2ad784339e "docs: update README to use
    GitLab repo URLs") almost all of the code base was converted to
    point to GitLab instead of git.qemu.org. During 2023, git.qemu.org
    switched from a git mirror to a http redirect to GitLab (see [1]).
    
    Update the LICENSE URL to match its previous content, displaying
    the file raw content similarly to gitweb 'blob_plain' format ([2]).
    
    [1] https://lore.kernel.org/qemu-devel/CABgObfZu3mFc8tM20K-yXdt7F-7eV-uKZN4sKDarSeu7DYoRbA@mail.gmail.com/
    [2] https://git-scm.com/docs/gitweb#Documentation/gitweb.txt-blobplain
    
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Message-ID: <20230822125716.55295-1-philmd@linaro.org>
    (cherry picked from commit 09a3fffae00b042bed8ad9c351b1a58c505fde37)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 docs/about/license.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/about/license.rst b/docs/about/license.rst
index cde3d2d25d..303c55d61b 100644
--- a/docs/about/license.rst
+++ b/docs/about/license.rst
@@ -8,4 +8,4 @@ QEMU is a trademark of Fabrice Bellard.
 QEMU is released under the `GNU General Public
 License <https://www.gnu.org/licenses/gpl-2.0.txt>`__, version 2. Parts
 of QEMU have specific licenses, see file
-`LICENSE <https://git.qemu.org/?p=qemu.git;a=blob_plain;f=LICENSE>`__.
+`LICENSE <https://gitlab.com/qemu-project/qemu/-/raw/master/LICENSE>`__.
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:50:28 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:50:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815509.1229375 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn0G-0008Cb-4C; Thu, 10 Oct 2024 06:50:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815509.1229375; Thu, 10 Oct 2024 06:50:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn0G-0008CU-1a; Thu, 10 Oct 2024 06:50:28 +0000
Received: by outflank-mailman (input) for mailman id 815509;
 Thu, 10 Oct 2024 06:50:27 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn0F-0008CM-4e
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:50:27 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn0F-0004sc-3v
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:50:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn0F-0002Vx-38
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:50:27 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SlnUkRfCOKwLXLrS9ekq2sYI/vZPE9OO2w/OR75l110=; b=LqO6I4/7JtoO2DiLffrvzGBlhu
	cjRl4QTbw9JdrJyiN9Z9P4+fE2Qfj9mKZ9Jl6GU45TU6Lq1k0tRAaARurVliiGZ/OJ37OLS8uOKW0
	eubrI0EB+gUKKaPurUi/LwzKWXIuWH7tWm6uKLhsBmMlnxUJoIlrgGgr5lPi2Q63dKiQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] block-migration: Ensure we don't crash during migration cleanup
Message-Id: <E1syn0F-0002Vx-38@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:50:27 +0000

commit e8bb4dc55a9a8e52f55c17ee9b50d7436a672881
Author:     Fabiano Rosas <farosas@suse.de>
AuthorDate: Mon Jul 31 17:33:38 2023 -0300
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    block-migration: Ensure we don't crash during migration cleanup
    
    We can fail the blk_insert_bs() at init_blk_migration(), leaving the
    BlkMigDevState without a dirty_bitmap and BlockDriverState. Account
    for the possibly missing elements when doing cleanup.
    
    Fix the following crashes:
    
    Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
    0x0000555555ec83ef in bdrv_release_dirty_bitmap (bitmap=0x0) at ../block/dirty-bitmap.c:359
    359         BlockDriverState *bs = bitmap->bs;
     #0  0x0000555555ec83ef in bdrv_release_dirty_bitmap (bitmap=0x0) at ../block/dirty-bitmap.c:359
     #1  0x0000555555bba331 in unset_dirty_tracking () at ../migration/block.c:371
     #2  0x0000555555bbad98 in block_migration_cleanup_bmds () at ../migration/block.c:681
    
    Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
    0x0000555555e971ff in bdrv_op_unblock (bs=0x0, op=BLOCK_OP_TYPE_BACKUP_SOURCE, reason=0x0) at ../block.c:7073
    7073        QLIST_FOREACH_SAFE(blocker, &bs->op_blockers[op], list, next) {
     #0  0x0000555555e971ff in bdrv_op_unblock (bs=0x0, op=BLOCK_OP_TYPE_BACKUP_SOURCE, reason=0x0) at ../block.c:7073
     #1  0x0000555555e9734a in bdrv_op_unblock_all (bs=0x0, reason=0x0) at ../block.c:7095
     #2  0x0000555555bbae13 in block_migration_cleanup_bmds () at ../migration/block.c:690
    
    Signed-off-by: Fabiano Rosas <farosas@suse.de>
    Message-id: 20230731203338.27581-1-farosas@suse.de
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    (cherry picked from commit f187609f27b261702a17f79d20bf252ee0d4f9cd)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 migration/block.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/migration/block.c b/migration/block.c
index b2497bbd32..ece746e788 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -366,7 +366,9 @@ static void unset_dirty_tracking(void)
     BlkMigDevState *bmds;
 
     QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
-        bdrv_release_dirty_bitmap(bmds->dirty_bitmap);
+        if (bmds->dirty_bitmap) {
+            bdrv_release_dirty_bitmap(bmds->dirty_bitmap);
+        }
     }
 }
 
@@ -674,13 +676,18 @@ static int64_t get_remaining_dirty(void)
 static void block_migration_cleanup_bmds(void)
 {
     BlkMigDevState *bmds;
+    BlockDriverState *bs;
     AioContext *ctx;
 
     unset_dirty_tracking();
 
     while ((bmds = QSIMPLEQ_FIRST(&block_mig_state.bmds_list)) != NULL) {
         QSIMPLEQ_REMOVE_HEAD(&block_mig_state.bmds_list, entry);
-        bdrv_op_unblock_all(blk_bs(bmds->blk), bmds->blocker);
+
+        bs = blk_bs(bmds->blk);
+        if (bs) {
+            bdrv_op_unblock_all(bs, bmds->blocker);
+        }
         error_free(bmds->blocker);
 
         /* Save ctx, because bmds->blk can disappear during blk_unref.  */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:50:38 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:50:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815510.1229380 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn0Q-0008Gi-5k; Thu, 10 Oct 2024 06:50:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815510.1229380; Thu, 10 Oct 2024 06:50:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn0Q-0008Gb-33; Thu, 10 Oct 2024 06:50:38 +0000
Received: by outflank-mailman (input) for mailman id 815510;
 Thu, 10 Oct 2024 06:50:37 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn0P-0008GR-7f
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:50:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn0P-0004sl-70
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:50:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn0P-0002Wy-6D
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:50:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=SuiTKbByzSj/Hlf5zke+uUeMg+BC6pEXOP21No8cF3A=; b=TQtFJBQ0vnkfOVCa5h0znlfv36
	stzPLg86222Ki7IHMXbirE45W80K8h1hEGCLSE0WxG8FtdaWdoZRiJ/B5238oTtj76CCoVe0cJ/+P
	lcyHMlzCUzxY6nJ8zZXify7tEB6SGFqBJD7Ejtf2VMZcOHnCW2g0Tr56eXWQfqivWaUA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/ppc/e500: fix broken snapshot replay
Message-Id: <E1syn0P-0002Wy-6D@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:50:37 +0000

commit fcb49ea23c39dd93b8e1d4e0edae67967d28e001
Author:     Maksim Kostin <maksim.kostin@ispras.ru>
AuthorDate: Wed Aug 9 13:07:33 2023 +0300
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/ppc/e500: fix broken snapshot replay
    
    ppce500_reset_device_tree is registered for system reset, but after
    c4b075318eb1 this function rerandomizes rng-seed via
    qemu_guest_getrandom_nofail. And when loading a snapshot, it tries to read
    EVENT_RANDOM that doesn't exist, so we have an error:
    
      qemu-system-ppc: Missing random event in the replay log
    
    To fix this, use qemu_register_reset_nosnapshotload instead of
    qemu_register_reset.
    
    Reported-by: Vitaly Cheptsov <cheptsov@ispras.ru>
    Fixes: c4b075318eb1 ("hw/ppc: pass random seed to fdt ")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1634
    Signed-off-by: Maksim Kostin <maksim.kostin@ispras.ru>
    Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    (cherry picked from commit 6ec65b69ba17c954414fa23a397fb8a3fcfb4a43)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ppc/e500.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index 117c9c08ed..27d83a4bf6 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -712,7 +712,7 @@ static int ppce500_prep_device_tree(PPCE500MachineState *machine,
     p->kernel_base = kernel_base;
     p->kernel_size = kernel_size;
 
-    qemu_register_reset(ppce500_reset_device_tree, p);
+    qemu_register_reset_nosnapshotload(ppce500_reset_device_tree, p);
     p->notifier.notify = ppce500_init_notify;
     qemu_add_machine_init_done_notifier(&p->notifier);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:50:48 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:50:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815511.1229384 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn0a-0008JI-7K; Thu, 10 Oct 2024 06:50:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815511.1229384; Thu, 10 Oct 2024 06:50:48 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn0a-0008JB-4l; Thu, 10 Oct 2024 06:50:48 +0000
Received: by outflank-mailman (input) for mailman id 815511;
 Thu, 10 Oct 2024 06:50:47 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn0Z-0008J3-Ah
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:50:47 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn0Z-0004t8-9y
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:50:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn0Z-0002Xo-9B
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:50:47 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Wzox+n13sDLBS+jmd66JZhUdPXrlRK0x1eS+tPsuZ6g=; b=g8w95G5E7rEhlKtg+IEpKWLWu2
	Gs7ChudmsYzvijtZwDrBj/44hnfOnq2HMOu++kXBkv9VCuZZ6XJz8t0JMhQL2PW9OPTEzhTI7t1Tx
	eXdHRrDY+5mIjYnPx3E6ixk0ARyEIQL55eheZ1INlDGdFzN6jv3mcOpo8CeT/4v23NoA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] ppc/vof: Fix missed fields in VOF cleanup
Message-Id: <E1syn0Z-0002Xo-9B@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:50:47 +0000

commit ea25506b5d6439c76a3a6b7b55dd3f861e98eb85
Author:     Nicholas Piggin <npiggin@gmail.com>
AuthorDate: Tue Aug 8 14:19:44 2023 +1000
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    ppc/vof: Fix missed fields in VOF cleanup
    
    Failing to reset the of_instance_last makes ihandle allocation continue
    to increase, which causes record-replay replay fail to match the
    recorded trace.
    
    Not resetting claimed_base makes VOF eventually run out of memory after
    some resets.
    
    Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
    Fixes: fc8c745d501 ("spapr: Implement Open Firmware client interface")
    Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
    Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    (cherry picked from commit 7b8589d7ce7e23f26ff53338d575a5cbd7818e28)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ppc/vof.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/ppc/vof.c b/hw/ppc/vof.c
index 18c3f92317..e3b430a81f 100644
--- a/hw/ppc/vof.c
+++ b/hw/ppc/vof.c
@@ -1024,6 +1024,8 @@ void vof_cleanup(Vof *vof)
     }
     vof->claimed = NULL;
     vof->of_instances = NULL;
+    vof->of_instance_last = 0;
+    vof->claimed_base = 0;
 }
 
 void vof_build_dt(void *fdt, Vof *vof)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:50:58 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:50:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815512.1229388 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn0k-0008M3-8l; Thu, 10 Oct 2024 06:50:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815512.1229388; Thu, 10 Oct 2024 06:50:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn0k-0008Lv-69; Thu, 10 Oct 2024 06:50:58 +0000
Received: by outflank-mailman (input) for mailman id 815512;
 Thu, 10 Oct 2024 06:50:57 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn0j-0008Lb-Dg
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:50:57 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn0j-0004tG-D6
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:50:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn0j-0002Ye-CH
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:50:57 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tYUDI/Ny5AM6kD9JQZ8gJzD4BBQaeX6gCB4ASSswz5E=; b=k5QpFtnvH+jYviTazP3cxLfMkM
	jfP8r0/ivJEk9pdkMatIeOjWqafdkNspB66aKbTr4g2E4EDnI5pOrasqIgIQx8FZptlNTe5jFizEj
	JHf60iETETTQFsWGwMNNSYd9LiFuwH6U8FnEVNak0INRlKdnLBKwbh9lrB/eTxA5H6Xc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] target/ppc: Flush inputs to zero with NJ in ppc_store_vscr
Message-Id: <E1syn0j-0002Ye-CH@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:50:57 +0000

commit 956b96f9e25f22a1e66d0dcacfb3621ef8a671b4
Author:     Richard Henderson <richard.henderson@linaro.org>
AuthorDate: Sun Aug 20 19:59:35 2023 -0700
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/ppc: Flush inputs to zero with NJ in ppc_store_vscr
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1779
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    (cherry picked from commit af03aeb631eeb81a44d2c0ff5b429cd4b5dc2799)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/ppc/cpu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c
index 1a97b41c6b..6e597680fb 100644
--- a/target/ppc/cpu.c
+++ b/target/ppc/cpu.c
@@ -59,6 +59,7 @@ void ppc_store_vscr(CPUPPCState *env, uint32_t vscr)
     env->vscr_sat.u64[0] = vscr & (1u << VSCR_SAT);
     env->vscr_sat.u64[1] = 0;
     set_flush_to_zero((vscr >> VSCR_NJ) & 1, &env->vec_status);
+    set_flush_inputs_to_zero((vscr >> VSCR_NJ) & 1, &env->vec_status);
 }
 
 uint32_t ppc_get_vscr(CPUPPCState *env)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:51:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:51:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815513.1229392 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn0u-0008OS-AE; Thu, 10 Oct 2024 06:51:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815513.1229392; Thu, 10 Oct 2024 06:51:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn0u-0008OK-7g; Thu, 10 Oct 2024 06:51:08 +0000
Received: by outflank-mailman (input) for mailman id 815513;
 Thu, 10 Oct 2024 06:51:07 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn0t-0008OE-Gw
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:51:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn0t-0004te-GK
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:51:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn0t-0002Zm-FU
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:51:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RgjB2sBtSXq4Md299YLxqMCWhLO1/o7cBiFlySYcvUs=; b=bGjxu0xbdcrtWP+KfB1k93zLvA
	zhoScgdGX2f5UxKm0F7/NZTbYEClop9vfgd54NgdfQ1ZtNawXshkXDQCkBGCZwzXUhGgBaP0sEBUy
	tNN7LvFNsYkEgC3B5kVs/b3fi2C2rTsmtlVsj0rsu1Afy+5Gcu41nm6+EmoLBnUL/4kY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/ide/core: set ERR_STAT in unsupported command completion
Message-Id: <E1syn0t-0002Zm-FU@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:51:07 +0000

commit 67894ec9fd512db33a883bd8df01ddac7f9f9780
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:38 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/ide/core: set ERR_STAT in unsupported command completion
    
    Currently, the first time sending an unsupported command
    (e.g. READ LOG DMA EXT) will not have ERR_STAT set in the completion.
    Sending the unsupported command again, will correctly have ERR_STAT set.
    
    When ide_cmd_permitted() returns false, it calls ide_abort_command().
    ide_abort_command() first calls ide_transfer_stop(), which will call
    ide_transfer_halt() and ide_cmd_done(), after that ide_abort_command()
    sets ERR_STAT in status.
    
    ide_cmd_done() for AHCI will call ahci_write_fis_d2h() which writes the
    current status in the FIS, and raises an IRQ. (The status here will not
    have ERR_STAT set!).
    
    Thus, we cannot call ide_transfer_stop() before setting ERR_STAT, as
    ide_transfer_stop() will result in the FIS being written and an IRQ
    being raised.
    
    The reason why it works the second time, is that ERR_STAT will still
    be set from the previous command, so when writing the FIS, the
    completion will correctly have ERR_STAT set.
    
    Set ERR_STAT before writing the FIS (calling cmd_done), so that we will
    raise an error IRQ correctly when receiving an unsupported command.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20230609140844.202795-3-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit c3461c6264a7c8ca15b117e91fe5da786924a784)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/ide/core.c b/hw/ide/core.c
index de48ff9f86..07971c0218 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -533,9 +533,9 @@ BlockAIOCB *ide_issue_trim(
 
 void ide_abort_command(IDEState *s)
 {
-    ide_transfer_stop(s);
     s->status = READY_STAT | ERR_STAT;
     s->error = ABRT_ERR;
+    ide_transfer_stop(s);
 }
 
 static void ide_set_retry(IDEState *s)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:51:18 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:51:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815514.1229397 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn14-0008R9-CU; Thu, 10 Oct 2024 06:51:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815514.1229397; Thu, 10 Oct 2024 06:51:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn14-0008Qw-91; Thu, 10 Oct 2024 06:51:18 +0000
Received: by outflank-mailman (input) for mailman id 815514;
 Thu, 10 Oct 2024 06:51:17 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn13-0008Qm-K0
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:51:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn13-0004tl-JO
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:51:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn13-0002aZ-Ib
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:51:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MoR74BMXbg7QEVePhVYz1p1lTtEWvldbDddaH5Najhc=; b=EuZCT37kLGDWr7Ivur0acSDMmH
	dN06lPxa4nriKAbfpqscEE2jeEp/2sCMVe8KrswYTnvJmvibqHyVUqt62U0ykIQDdWYCbIUXFGbYw
	1meqfU2aEjhX6xwJJtuOpCOss/rx56C3m+88qBKB+UbWmrzej6gJ5t+yHqAZ4/IfkJiU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/ide/ahci: write D2H FIS when processing NCQ command
Message-Id: <E1syn13-0002aZ-Ib@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:51:17 +0000

commit 362a4d8658c9370a071b5e598c158d522a3fa60d
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:39 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/ide/ahci: write D2H FIS when processing NCQ command
    
    The way that BUSY + PxCI is cleared for NCQ (FPDMA QUEUED) commands is
    described in SATA 3.5a Gold:
    
    11.15 FPDMA QUEUED command protocol
    DFPDMAQ2: ClearInterfaceBsy
    "Transmit Register Device to Host FIS with the BSY bit cleared to zero
    and the DRQ bit cleared to zero and Interrupt bit cleared to zero to
    mark interface ready for the next command."
    
    PxCI is currently cleared by handle_cmd(), but we don't write the D2H
    FIS to the FIS Receive Area that actually caused PxCI to be cleared.
    
    Similar to how ahci_pio_transfer() calls ahci_write_fis_pio() with an
    additional parameter to write a PIO Setup FIS without raising an IRQ,
    add a parameter to ahci_write_fis_d2h() so that ahci_write_fis_d2h()
    also can write the FIS to the FIS Receive Area without raising an IRQ.
    
    Change process_ncq_command() to call ahci_write_fis_d2h() without
    raising an IRQ (similar to ahci_pio_transfer()), such that the FIS
    Receive Area is in sync with the PxTFD shadow register.
    
    E.g. Linux reads status and error fields from the FIS Receive Area
    directly, so it is wise to keep the FIS Receive Area and the PxTFD
    shadow register in sync.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Message-id: 20230609140844.202795-4-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit 2967dc8209dd27b61a6ab7bad78cf7c6ec58ddb4)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/ahci.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 4e76d6b191..b81da46e3e 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -43,7 +43,7 @@
 static void check_cmd(AHCIState *s, int port);
 static int handle_cmd(AHCIState *s, int port, uint8_t slot);
 static void ahci_reset_port(AHCIState *s, int port);
-static bool ahci_write_fis_d2h(AHCIDevice *ad);
+static bool ahci_write_fis_d2h(AHCIDevice *ad, bool d2h_fis_i);
 static void ahci_init_d2h(AHCIDevice *ad);
 static int ahci_dma_prepare_buf(const IDEDMA *dma, int32_t limit);
 static bool ahci_map_clb_address(AHCIDevice *ad);
@@ -618,7 +618,7 @@ static void ahci_init_d2h(AHCIDevice *ad)
         return;
     }
 
-    if (ahci_write_fis_d2h(ad)) {
+    if (ahci_write_fis_d2h(ad, true)) {
         ad->init_d2h_sent = true;
         /* We're emulating receiving the first Reg H2D Fis from the device;
          * Update the SIG register, but otherwise proceed as normal. */
@@ -850,7 +850,7 @@ static void ahci_write_fis_pio(AHCIDevice *ad, uint16_t len, bool pio_fis_i)
     }
 }
 
-static bool ahci_write_fis_d2h(AHCIDevice *ad)
+static bool ahci_write_fis_d2h(AHCIDevice *ad, bool d2h_fis_i)
 {
     AHCIPortRegs *pr = &ad->port_regs;
     uint8_t *d2h_fis;
@@ -864,7 +864,7 @@ static bool ahci_write_fis_d2h(AHCIDevice *ad)
     d2h_fis = &ad->res_fis[RES_FIS_RFIS];
 
     d2h_fis[0] = SATA_FIS_TYPE_REGISTER_D2H;
-    d2h_fis[1] = (1 << 6); /* interrupt bit */
+    d2h_fis[1] = d2h_fis_i ? (1 << 6) : 0; /* interrupt bit */
     d2h_fis[2] = s->status;
     d2h_fis[3] = s->error;
 
@@ -890,7 +890,10 @@ static bool ahci_write_fis_d2h(AHCIDevice *ad)
         ahci_trigger_irq(ad->hba, ad, AHCI_PORT_IRQ_BIT_TFES);
     }
 
-    ahci_trigger_irq(ad->hba, ad, AHCI_PORT_IRQ_BIT_DHRS);
+    if (d2h_fis_i) {
+        ahci_trigger_irq(ad->hba, ad, AHCI_PORT_IRQ_BIT_DHRS);
+    }
+
     return true;
 }
 
@@ -1120,6 +1123,8 @@ static void process_ncq_command(AHCIState *s, int port, const uint8_t *cmd_fis,
         return;
     }
 
+    ahci_write_fis_d2h(ad, false);
+
     ncq_tfs->used = 1;
     ncq_tfs->drive = ad;
     ncq_tfs->slot = slot;
@@ -1506,7 +1511,7 @@ static void ahci_cmd_done(const IDEDMA *dma)
     }
 
     /* update d2h status */
-    ahci_write_fis_d2h(ad);
+    ahci_write_fis_d2h(ad, true);
 
     if (ad->port_regs.cmd_issue && !ad->check_bh) {
         ad->check_bh = qemu_bh_new_guarded(ahci_check_cmd_bh, ad,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:51:28 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:51:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815515.1229399 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn1E-0008UO-E7; Thu, 10 Oct 2024 06:51:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815515.1229399; Thu, 10 Oct 2024 06:51:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn1E-0008UH-Bg; Thu, 10 Oct 2024 06:51:28 +0000
Received: by outflank-mailman (input) for mailman id 815515;
 Thu, 10 Oct 2024 06:51:27 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn1D-0008U9-ND
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:51:27 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn1D-0004tu-MR
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:51:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn1D-0002bP-Li
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:51:27 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=COrgT6HRGI/86UQrGWUjaZRTTLbetaBexW8hQDuiVDA=; b=Wsudxp+kjt0uDcl8kzAWpHYuLh
	/9KIma4FqoiMHtE6oE7tc7+oghN8lQ6xxB33RT4t2XDRmGHeqyZQ2+mxfol7QyQaFLRMaLh73nH9c
	McMQRd/4J/6BQ9GHmVquNfJ6HSS4HaezulNHtreNCExBrRPouxLSyuMSGTeaayn+M0VA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/ide/ahci: simplify and document PxCI handling
Message-Id: <E1syn1D-0002bP-Li@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:51:27 +0000

commit 7bcd32128b227cee1fb39ff242d486ed9fff7648
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:40 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/ide/ahci: simplify and document PxCI handling
    
    The AHCI spec states that:
    For NCQ, PxCI is cleared on command queued successfully.
    
    For non-NCQ, PxCI is cleared on command completed successfully.
    (A non-NCQ command that completes with error does not clear PxCI.)
    
    The current QEMU implementation either clears PxCI in check_cmd(),
    or in ahci_cmd_done().
    
    check_cmd() will clear PxCI for a command if handle_cmd() returns 0.
    handle_cmd() will return -1 if BUSY or DRQ is set.
    
    The QEMU implementation for NCQ commands will currently not set BUSY
    or DRQ, so they will always have PxCI cleared by handle_cmd().
    ahci_cmd_done() will never even get called for NCQ commands.
    
    Non-NCQ commands are executed by ide_bus_exec_cmd().
    Non-NCQ commands in QEMU are implemented either in a sync or in an async
    way.
    
    For non-NCQ commands implemented in a sync way, the command handler will
    return true, and when ide_bus_exec_cmd() sees that a command handler
    returns true, it will call ide_cmd_done() (which will call
    ahci_cmd_done()). For a command implemented in a sync way,
    ahci_cmd_done() will do nothing (since busy_slot is not set). Instead,
    after ide_bus_exec_cmd() has finished, check_cmd() will clear PxCI for
    these commands.
    
    For non-NCQ commands implemented in an async way (using either aiocb or
    pio_aiocb), the command handler will return false, ide_bus_exec_cmd()
    will not call ide_cmd_done(), instead it is expected that the async
    callback function will call ide_cmd_done() once the async command is
    done. handle_cmd() will set busy_slot, if and only if BUSY or DRQ is
    set, and this is checked _after_ ide_bus_exec_cmd() has returned.
    handle_cmd() will return -1, so check_cmd() will not clear PxCI.
    When the async callback calls ide_cmd_done() (which will call
    ahci_cmd_done()), it will see that busy_slot is set, and
    ahci_cmd_done() will clear PxCI.
    
    This seems racy, since busy_slot is set _after_ ide_bus_exec_cmd() has
    returned. The callback might come before busy_slot gets set. And it is
    quite confusing that ahci_cmd_done() will be called for all non-NCQ
    commands when the command is done, but will only clear PxCI in certain
    cases, even though it will always write a D2H FIS and raise an IRQ.
    
    Even worse, in the case where ahci_cmd_done() does not clear PxCI, it
    still raises an IRQ. Host software might thus read an old PxCI value,
    since PxCI is cleared (by check_cmd()) after the IRQ has been raised.
    
    Try to simplify this by always setting busy_slot for non-NCQ commands,
    such that ahci_cmd_done() will always be responsible for clearing PxCI
    for non-NCQ commands.
    
    For NCQ commands, clear PxCI when we receive the D2H FIS, but before
    raising the IRQ, see AHCI 1.3.1, section 5.3.8, states RegFIS:Entry and
    RegFIS:ClearCI.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Message-id: 20230609140844.202795-5-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit e2a5d9b3d9c3d311618160603cc9bc04fbd98796)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/ahci.c | 70 ++++++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 50 insertions(+), 20 deletions(-)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index b81da46e3e..6299320ffb 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -41,9 +41,10 @@
 #include "trace.h"
 
 static void check_cmd(AHCIState *s, int port);
-static int handle_cmd(AHCIState *s, int port, uint8_t slot);
+static void handle_cmd(AHCIState *s, int port, uint8_t slot);
 static void ahci_reset_port(AHCIState *s, int port);
 static bool ahci_write_fis_d2h(AHCIDevice *ad, bool d2h_fis_i);
+static void ahci_clear_cmd_issue(AHCIDevice *ad, uint8_t slot);
 static void ahci_init_d2h(AHCIDevice *ad);
 static int ahci_dma_prepare_buf(const IDEDMA *dma, int32_t limit);
 static bool ahci_map_clb_address(AHCIDevice *ad);
@@ -591,9 +592,8 @@ static void check_cmd(AHCIState *s, int port)
 
     if ((pr->cmd & PORT_CMD_START) && pr->cmd_issue) {
         for (slot = 0; (slot < 32) && pr->cmd_issue; slot++) {
-            if ((pr->cmd_issue & (1U << slot)) &&
-                !handle_cmd(s, port, slot)) {
-                pr->cmd_issue &= ~(1U << slot);
+            if (pr->cmd_issue & (1U << slot)) {
+                handle_cmd(s, port, slot);
             }
         }
     }
@@ -1123,6 +1123,22 @@ static void process_ncq_command(AHCIState *s, int port, const uint8_t *cmd_fis,
         return;
     }
 
+    /*
+     * A NCQ command clears the bit in PxCI after the command has been QUEUED
+     * successfully (ERROR not set, BUSY and DRQ cleared).
+     *
+     * For NCQ commands, PxCI will always be cleared here.
+     *
+     * (Once the NCQ command is COMPLETED, the device will send a SDB FIS with
+     * the interrupt bit set, which will clear PxSACT and raise an interrupt.)
+     */
+    ahci_clear_cmd_issue(ad, slot);
+
+    /*
+     * In reality, for NCQ commands, PxCI is cleared after receiving a D2H FIS
+     * without the interrupt bit set, but since ahci_write_fis_d2h() can raise
+     * an IRQ on error, we need to call them in reverse order.
+     */
     ahci_write_fis_d2h(ad, false);
 
     ncq_tfs->used = 1;
@@ -1197,6 +1213,7 @@ static void handle_reg_h2d_fis(AHCIState *s, int port,
 {
     IDEState *ide_state = &s->dev[port].port.ifs[0];
     AHCICmdHdr *cmd = get_cmd_header(s, port, slot);
+    AHCIDevice *ad = &s->dev[port];
     uint16_t opts = le16_to_cpu(cmd->opts);
 
     if (cmd_fis[1] & 0x0F) {
@@ -1273,11 +1290,19 @@ static void handle_reg_h2d_fis(AHCIState *s, int port,
     /* Reset transferred byte counter */
     cmd->status = 0;
 
+    /*
+     * A non-NCQ command clears the bit in PxCI after the command has COMPLETED
+     * successfully (ERROR not set, BUSY and DRQ cleared).
+     *
+     * For non-NCQ commands, PxCI will always be cleared by ahci_cmd_done().
+     */
+    ad->busy_slot = slot;
+
     /* We're ready to process the command in FIS byte 2. */
     ide_bus_exec_cmd(&s->dev[port].port, cmd_fis[2]);
 }
 
-static int handle_cmd(AHCIState *s, int port, uint8_t slot)
+static void handle_cmd(AHCIState *s, int port, uint8_t slot)
 {
     IDEState *ide_state;
     uint64_t tbl_addr;
@@ -1288,12 +1313,12 @@ static int handle_cmd(AHCIState *s, int port, uint8_t slot)
     if (s->dev[port].port.ifs[0].status & (BUSY_STAT|DRQ_STAT)) {
         /* Engine currently busy, try again later */
         trace_handle_cmd_busy(s, port);
-        return -1;
+        return;
     }
 
     if (!s->dev[port].lst) {
         trace_handle_cmd_nolist(s, port);
-        return -1;
+        return;
     }
     cmd = get_cmd_header(s, port, slot);
     /* remember current slot handle for later */
@@ -1303,7 +1328,7 @@ static int handle_cmd(AHCIState *s, int port, uint8_t slot)
     ide_state = &s->dev[port].port.ifs[0];
     if (!ide_state->blk) {
         trace_handle_cmd_badport(s, port);
-        return -1;
+        return;
     }
 
     tbl_addr = le64_to_cpu(cmd->tbl_addr);
@@ -1312,7 +1337,7 @@ static int handle_cmd(AHCIState *s, int port, uint8_t slot)
                              DMA_DIRECTION_TO_DEVICE, MEMTXATTRS_UNSPECIFIED);
     if (!cmd_fis) {
         trace_handle_cmd_badfis(s, port);
-        return -1;
+        return;
     } else if (cmd_len != 0x80) {
         ahci_trigger_irq(s, &s->dev[port], AHCI_PORT_IRQ_BIT_HBFS);
         trace_handle_cmd_badmap(s, port, cmd_len);
@@ -1336,15 +1361,6 @@ static int handle_cmd(AHCIState *s, int port, uint8_t slot)
 out:
     dma_memory_unmap(s->as, cmd_fis, cmd_len, DMA_DIRECTION_TO_DEVICE,
                      cmd_len);
-
-    if (s->dev[port].port.ifs[0].status & (BUSY_STAT|DRQ_STAT)) {
-        /* async command, complete later */
-        s->dev[port].busy_slot = slot;
-        return -1;
-    }
-
-    /* done handling the command */
-    return 0;
 }
 
 /* Transfer PIO data between RAM and device */
@@ -1498,6 +1514,16 @@ static int ahci_dma_rw_buf(const IDEDMA *dma, bool is_write)
     return 1;
 }
 
+static void ahci_clear_cmd_issue(AHCIDevice *ad, uint8_t slot)
+{
+    IDEState *ide_state = &ad->port.ifs[0];
+
+    if (!(ide_state->status & (BUSY_STAT | DRQ_STAT))) {
+        ad->port_regs.cmd_issue &= ~(1 << slot);
+    }
+}
+
+/* Non-NCQ command is done - This function is never called for NCQ commands. */
 static void ahci_cmd_done(const IDEDMA *dma)
 {
     AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma);
@@ -1506,11 +1532,15 @@ static void ahci_cmd_done(const IDEDMA *dma)
 
     /* no longer busy */
     if (ad->busy_slot != -1) {
-        ad->port_regs.cmd_issue &= ~(1 << ad->busy_slot);
+        ahci_clear_cmd_issue(ad, ad->busy_slot);
         ad->busy_slot = -1;
     }
 
-    /* update d2h status */
+    /*
+     * In reality, for non-NCQ commands, PxCI is cleared after receiving a D2H
+     * FIS with the interrupt bit set, but since ahci_write_fis_d2h() will raise
+     * an IRQ, we need to call them in reverse order.
+     */
     ahci_write_fis_d2h(ad, true);
 
     if (ad->port_regs.cmd_issue && !ad->check_bh) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:51:38 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:51:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815517.1229404 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn1O-00005R-Ft; Thu, 10 Oct 2024 06:51:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815517.1229404; Thu, 10 Oct 2024 06:51:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn1O-00005J-DE; Thu, 10 Oct 2024 06:51:38 +0000
Received: by outflank-mailman (input) for mailman id 815517;
 Thu, 10 Oct 2024 06:51:37 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn1N-000057-QA
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:51:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn1N-0004u1-PU
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:51:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn1N-0002c7-Of
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:51:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=X9c2eZJntlRhlkuXJcrkb0mBB8az4AZLSIkkXKZNFMg=; b=PLHgt/TNCmRfDZ5g2Ezatmox+c
	CHd392/cQUbTBCrE3jSqwzzIxjioINSuVDx8U57kWowCwKtLESVP7yc/mEZPJKqTYm0YWUc1X3bC8
	Kf07CEyzlgRzbcqSfK/NkKh7b05Q4FXQE6cyEeCwZq7lJBogWn/AYXanQOxmTV458J4w=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/ide/ahci: PxSACT and PxCI is cleared when PxCMD.ST is cleared
Message-Id: <E1syn1N-0002c7-Of@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:51:37 +0000

commit 2eaf7775fc05d65c9254530ea0fdbbcf910c92cd
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:41 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/ide/ahci: PxSACT and PxCI is cleared when PxCMD.ST is cleared
    
    According to AHCI 1.3.1 definition of PxSACT:
    This field is cleared when PxCMD.ST is written from a '1' to a '0' by
    software. This field is not cleared by a COMRESET or a software reset.
    
    According to AHCI 1.3.1 definition of PxCI:
    This field is also cleared when PxCMD.ST is written from a '1' to a '0'
    by software.
    
    Clearing PxCMD.ST is part of the error recovery procedure, see
    AHCI 1.3.1, section "6.2 Error Recovery".
    
    If we don't clear PxCI on error recovery, the previous command will
    incorrectly still be marked as pending after error recovery.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20230609140844.202795-6-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit d73b84d0b664e60fffb66f46e84d0db4a8e1c713)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/ahci.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 6299320ffb..a93a1878de 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -329,6 +329,11 @@ static void ahci_port_write(AHCIState *s, int port, int offset, uint32_t val)
         ahci_check_irq(s);
         break;
     case AHCI_PORT_REG_CMD:
+        if ((pr->cmd & PORT_CMD_START) && !(val & PORT_CMD_START)) {
+            pr->scr_act = 0;
+            pr->cmd_issue = 0;
+        }
+
         /* Block any Read-only fields from being set;
          * including LIST_ON and FIS_ON.
          * The spec requires to set ICC bits to zero after the ICC change
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:51:49 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:51:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815518.1229408 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn1Z-00008L-HN; Thu, 10 Oct 2024 06:51:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815518.1229408; Thu, 10 Oct 2024 06:51:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn1Z-00008D-Eg; Thu, 10 Oct 2024 06:51:49 +0000
Received: by outflank-mailman (input) for mailman id 815518;
 Thu, 10 Oct 2024 06:51:47 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn1X-00007v-UW
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:51:47 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn1X-0004uR-Sb
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:51:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn1X-0002cu-Ru
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:51:47 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PEyygATsBz0XYQAvAlnQ89Q/OAOzAjAFTYxjt35MUT0=; b=hAN1gDcbMffL1DcznM8pueU2C3
	cStlaifyluEfWz4m3iOx3hx2egFZMBCBtKX6g42CTuzpld/R38T5sYAR7WzJpAO3S++PK0yai+rFJ
	6V+rBEcEnMGgkD26sl1hm4s7hZwaL2Qlk4cM/J1jYo2lLqHHCM93Dq+zqqaQmsPCZbcI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/ide/ahci: PxCI should not get cleared when ERR_STAT is set
Message-Id: <E1syn1X-0002cu-Ru@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:51:47 +0000

commit f7cca09987983644d054fc4f4feb8414dcd624c5
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:42 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:58 2023 +0300

    hw/ide/ahci: PxCI should not get cleared when ERR_STAT is set
    
    For NCQ, PxCI is cleared on command queued successfully.
    For non-NCQ, PxCI is cleared on command completed successfully.
    Successfully means ERR_STAT, BUSY and DRQ are all cleared.
    
    A command that has ERR_STAT set, does not get to clear PxCI.
    See AHCI 1.3.1, section 5.3.8, states RegFIS:Entry and RegFIS:ClearCI,
    and 5.3.16.5 ERR:FatalTaskfile.
    
    In the case of non-NCQ commands, not clearing PxCI is needed in order
    for host software to be able to see which command slot that failed.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Message-id: 20230609140844.202795-7-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit 1a16ce64fda11bdf50f0c4ab5d9fdde72c1383a2)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/ahci.c             |   7 ++-
 tests/qtest/libqos/ahci.c | 106 ++++++++++++++++++++++++++++++++++------------
 tests/qtest/libqos/ahci.h |   8 ++--
 3 files changed, 88 insertions(+), 33 deletions(-)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index a93a1878de..a7b487ff33 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1523,7 +1523,8 @@ static void ahci_clear_cmd_issue(AHCIDevice *ad, uint8_t slot)
 {
     IDEState *ide_state = &ad->port.ifs[0];
 
-    if (!(ide_state->status & (BUSY_STAT | DRQ_STAT))) {
+    if (!(ide_state->status & ERR_STAT) &&
+        !(ide_state->status & (BUSY_STAT | DRQ_STAT))) {
         ad->port_regs.cmd_issue &= ~(1 << slot);
     }
 }
@@ -1532,6 +1533,7 @@ static void ahci_clear_cmd_issue(AHCIDevice *ad, uint8_t slot)
 static void ahci_cmd_done(const IDEDMA *dma)
 {
     AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma);
+    IDEState *ide_state = &ad->port.ifs[0];
 
     trace_ahci_cmd_done(ad->hba, ad->port_no);
 
@@ -1548,7 +1550,8 @@ static void ahci_cmd_done(const IDEDMA *dma)
      */
     ahci_write_fis_d2h(ad, true);
 
-    if (ad->port_regs.cmd_issue && !ad->check_bh) {
+    if (!(ide_state->status & ERR_STAT) &&
+        ad->port_regs.cmd_issue && !ad->check_bh) {
         ad->check_bh = qemu_bh_new_guarded(ahci_check_cmd_bh, ad,
                                            &ad->mem_reentrancy_guard);
         qemu_bh_schedule(ad->check_bh);
diff --git a/tests/qtest/libqos/ahci.c b/tests/qtest/libqos/ahci.c
index f53f12aa99..a2c94c6e06 100644
--- a/tests/qtest/libqos/ahci.c
+++ b/tests/qtest/libqos/ahci.c
@@ -404,57 +404,110 @@ void ahci_port_clear(AHCIQState *ahci, uint8_t port)
 /**
  * Check a port for errors.
  */
-void ahci_port_check_error(AHCIQState *ahci, uint8_t port,
-                           uint32_t imask, uint8_t emask)
+void ahci_port_check_error(AHCIQState *ahci, AHCICommand *cmd)
 {
+    uint8_t port = cmd->port;
     uint32_t reg;
 
-    /* The upper 9 bits of the IS register all indicate errors. */
-    reg = ahci_px_rreg(ahci, port, AHCI_PX_IS);
-    reg &= ~imask;
-    reg >>= 23;
-    g_assert_cmphex(reg, ==, 0);
+    /* If expecting TF error, ensure that TFES is set. */
+    if (cmd->errors) {
+        reg = ahci_px_rreg(ahci, port, AHCI_PX_IS);
+        ASSERT_BIT_SET(reg, AHCI_PX_IS_TFES);
+    } else {
+        /* The upper 9 bits of the IS register all indicate errors. */
+        reg = ahci_px_rreg(ahci, port, AHCI_PX_IS);
+        reg &= ~cmd->interrupts;
+        reg >>= 23;
+        g_assert_cmphex(reg, ==, 0);
+    }
 
-    /* The Sata Error Register should be empty. */
+    /* The Sata Error Register should be empty, even when expecting TF error. */
     reg = ahci_px_rreg(ahci, port, AHCI_PX_SERR);
     g_assert_cmphex(reg, ==, 0);
 
+    /* If expecting TF error, and TFES was set, perform error recovery
+     * (see AHCI 1.3 section 6.2.2.1) such that we can send new commands. */
+    if (cmd->errors) {
+        /* This will clear PxCI. */
+        ahci_px_clr(ahci, port, AHCI_PX_CMD, AHCI_PX_CMD_ST);
+
+        /* The port has 500ms to disengage. */
+        usleep(500000);
+        reg = ahci_px_rreg(ahci, port, AHCI_PX_CMD);
+        ASSERT_BIT_CLEAR(reg, AHCI_PX_CMD_CR);
+
+        /* Clear PxIS. */
+        reg = ahci_px_rreg(ahci, port, AHCI_PX_IS);
+        ahci_px_wreg(ahci, port, AHCI_PX_IS, reg);
+
+        /* Check if we need to perform a COMRESET.
+         * Not implemented right now, as there is no reason why our QEMU model
+         * should need a COMRESET when expecting TF error. */
+        reg = ahci_px_rreg(ahci, port, AHCI_PX_TFD);
+        ASSERT_BIT_CLEAR(reg, AHCI_PX_TFD_STS_BSY | AHCI_PX_TFD_STS_DRQ);
+
+        /* Enable issuing new commands. */
+        ahci_px_set(ahci, port, AHCI_PX_CMD, AHCI_PX_CMD_ST);
+    }
+
     /* The TFD also has two error sections. */
     reg = ahci_px_rreg(ahci, port, AHCI_PX_TFD);
-    if (!emask) {
+    if (!cmd->errors) {
         ASSERT_BIT_CLEAR(reg, AHCI_PX_TFD_STS_ERR);
     } else {
         ASSERT_BIT_SET(reg, AHCI_PX_TFD_STS_ERR);
     }
-    ASSERT_BIT_CLEAR(reg, AHCI_PX_TFD_ERR & (~emask << 8));
-    ASSERT_BIT_SET(reg, AHCI_PX_TFD_ERR & (emask << 8));
+    ASSERT_BIT_CLEAR(reg, AHCI_PX_TFD_ERR & (~cmd->errors << 8));
+    ASSERT_BIT_SET(reg, AHCI_PX_TFD_ERR & (cmd->errors << 8));
 }
 
-void ahci_port_check_interrupts(AHCIQState *ahci, uint8_t port,
-                                uint32_t intr_mask)
+void ahci_port_check_interrupts(AHCIQState *ahci, AHCICommand *cmd)
 {
+    uint8_t port = cmd->port;
     uint32_t reg;
 
+    /* If we expect errors, error handling in ahci_port_check_error() will
+     * already have cleared PxIS, so in that case this function cannot verify
+     * and clear expected interrupts. */
+    if (cmd->errors) {
+        return;
+    }
+
     /* Check for expected interrupts */
     reg = ahci_px_rreg(ahci, port, AHCI_PX_IS);
-    ASSERT_BIT_SET(reg, intr_mask);
+    ASSERT_BIT_SET(reg, cmd->interrupts);
 
     /* Clear expected interrupts and assert all interrupts now cleared. */
-    ahci_px_wreg(ahci, port, AHCI_PX_IS, intr_mask);
+    ahci_px_wreg(ahci, port, AHCI_PX_IS, cmd->interrupts);
     g_assert_cmphex(ahci_px_rreg(ahci, port, AHCI_PX_IS), ==, 0);
 }
 
-void ahci_port_check_nonbusy(AHCIQState *ahci, uint8_t port, uint8_t slot)
+void ahci_port_check_nonbusy(AHCIQState *ahci, AHCICommand *cmd)
 {
+    uint8_t slot = cmd->slot;
+    uint8_t port = cmd->port;
     uint32_t reg;
 
-    /* Assert that the command slot is no longer busy (NCQ) */
+    /* For NCQ command with error PxSACT bit should still be set.
+     * For NCQ command without error, PxSACT bit should be cleared.
+     * For non-NCQ command, PxSACT bit should always be cleared. */
     reg = ahci_px_rreg(ahci, port, AHCI_PX_SACT);
-    ASSERT_BIT_CLEAR(reg, (1 << slot));
+    if (cmd->props->ncq && cmd->errors) {
+        ASSERT_BIT_SET(reg, (1 << slot));
+    } else {
+        ASSERT_BIT_CLEAR(reg, (1 << slot));
+    }
 
-    /* Non-NCQ */
+    /* For non-NCQ command with error, PxCI bit should still be set.
+     * For non-NCQ command without error, PxCI bit should be cleared.
+     * For NCQ command without error, PxCI bit should be cleared.
+     * For NCQ command with error, PxCI bit may or may not be cleared. */
     reg = ahci_px_rreg(ahci, port, AHCI_PX_CI);
-    ASSERT_BIT_CLEAR(reg, (1 << slot));
+    if (!cmd->props->ncq && cmd->errors) {
+        ASSERT_BIT_SET(reg, (1 << slot));
+    } else if (!cmd->errors) {
+        ASSERT_BIT_CLEAR(reg, (1 << slot));
+    }
 
     /* And assert that we are generally not busy. */
     reg = ahci_px_rreg(ahci, port, AHCI_PX_TFD);
@@ -1207,9 +1260,10 @@ void ahci_command_wait(AHCIQState *ahci, AHCICommand *cmd)
 
 #define RSET(REG, MASK) (BITSET(ahci_px_rreg(ahci, cmd->port, (REG)), (MASK)))
 
-    while (RSET(AHCI_PX_TFD, AHCI_PX_TFD_STS_BSY) ||
-           RSET(AHCI_PX_CI, 1 << cmd->slot) ||
-           (cmd->props->ncq && RSET(AHCI_PX_SACT, 1 << cmd->slot))) {
+    while (!RSET(AHCI_PX_TFD, AHCI_PX_TFD_STS_ERR) &&
+           (RSET(AHCI_PX_TFD, AHCI_PX_TFD_STS_BSY) ||
+            RSET(AHCI_PX_CI, 1 << cmd->slot) ||
+            (cmd->props->ncq && RSET(AHCI_PX_SACT, 1 << cmd->slot)))) {
         usleep(50);
     }
 
@@ -1226,9 +1280,9 @@ void ahci_command_verify(AHCIQState *ahci, AHCICommand *cmd)
     uint8_t slot = cmd->slot;
     uint8_t port = cmd->port;
 
-    ahci_port_check_error(ahci, port, cmd->interrupts, cmd->errors);
-    ahci_port_check_interrupts(ahci, port, cmd->interrupts);
-    ahci_port_check_nonbusy(ahci, port, slot);
+    ahci_port_check_nonbusy(ahci, cmd);
+    ahci_port_check_error(ahci, cmd);
+    ahci_port_check_interrupts(ahci, cmd);
     ahci_port_check_cmd_sanity(ahci, cmd);
     if (cmd->interrupts & AHCI_PX_IS_DHRS) {
         ahci_port_check_d2h_sanity(ahci, port, slot);
diff --git a/tests/qtest/libqos/ahci.h b/tests/qtest/libqos/ahci.h
index 88835b6228..48017864bf 100644
--- a/tests/qtest/libqos/ahci.h
+++ b/tests/qtest/libqos/ahci.h
@@ -590,11 +590,9 @@ void ahci_set_command_header(AHCIQState *ahci, uint8_t port,
 void ahci_destroy_command(AHCIQState *ahci, uint8_t port, uint8_t slot);
 
 /* AHCI sanity check routines */
-void ahci_port_check_error(AHCIQState *ahci, uint8_t port,
-                           uint32_t imask, uint8_t emask);
-void ahci_port_check_interrupts(AHCIQState *ahci, uint8_t port,
-                                uint32_t intr_mask);
-void ahci_port_check_nonbusy(AHCIQState *ahci, uint8_t port, uint8_t slot);
+void ahci_port_check_error(AHCIQState *ahci, AHCICommand *cmd);
+void ahci_port_check_interrupts(AHCIQState *ahci, AHCICommand *cmd);
+void ahci_port_check_nonbusy(AHCIQState *ahci, AHCICommand *cmd);
 void ahci_port_check_d2h_sanity(AHCIQState *ahci, uint8_t port, uint8_t slot);
 void ahci_port_check_pio_sanity(AHCIQState *ahci, AHCICommand *cmd);
 void ahci_port_check_cmd_sanity(AHCIQState *ahci, AHCICommand *cmd);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:51:59 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:51:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815519.1229412 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn1j-0000B3-Iq; Thu, 10 Oct 2024 06:51:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815519.1229412; Thu, 10 Oct 2024 06:51:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn1j-0000Av-GA; Thu, 10 Oct 2024 06:51:59 +0000
Received: by outflank-mailman (input) for mailman id 815519;
 Thu, 10 Oct 2024 06:51:58 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn1i-0000Aj-01
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:51:58 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn1h-0004uV-Va
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:51:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn1h-0002dX-Uw
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:51:57 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=cCP4JT/tRNi5KGgc8vuRC8iI94xG+oJzgnxL2LXU45Q=; b=psO4Sho2zcH6fgzontgnvrxU+F
	7sfEYaR6f9jHfthz6Cjbk6bf4LelYtOLET2Ouqt5F+8R2spWAZ7f1AuDXou8rAl2aSIe3MQy7AAx0
	+zw3ByZyy5ryj7miooF3FVSOHHOsIA0hM0CwrXs+ZUu03r0xFPqyAqDhbG3Q8r/KVqNE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/ide/ahci: fix ahci_write_fis_sdb()
Message-Id: <E1syn1h-0002dX-Uw@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:51:57 +0000

commit 9c7e2253eba2e057f11377beb64dd78d12a1e27d
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:43 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    hw/ide/ahci: fix ahci_write_fis_sdb()
    
    When there is an error, we need to raise a TFES error irq, see AHCI 1.3.1,
    5.3.13.1 SDB:Entry.
    
    If ERR_STAT is set, we jump to state ERR:FatalTaskfile, which will raise
    a TFES IRQ unconditionally, regardless if the I bit is set in the FIS or
    not.
    
    Thus, we should never raise a normal IRQ after having sent an error IRQ.
    
    It is valid to signal successfully completed commands as finished in the
    same SDB FIS that generates the error IRQ. The important thing is that
    commands that did not complete successfully (e.g. commands that were
    aborted, do not get the finished bit set).
    
    Before this commit, there was never a TFES IRQ raised on NCQ error.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20230609140844.202795-8-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit 7e85cb0db4c693b4e084a00e66fe73a22ed1688a)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/ahci.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index a7b487ff33..8ce3dd796e 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -806,8 +806,14 @@ static void ahci_write_fis_sdb(AHCIState *s, NCQTransferState *ncq_tfs)
     pr->scr_act &= ~ad->finished;
     ad->finished = 0;
 
-    /* Trigger IRQ if interrupt bit is set (which currently, it always is) */
-    if (sdb_fis->flags & 0x40) {
+    /*
+     * TFES IRQ is always raised if ERR_STAT is set, regardless of I bit.
+     * If ERR_STAT is not set, trigger SDBS IRQ if interrupt bit is set
+     * (which currently, it always is).
+     */
+    if (sdb_fis->status & ERR_STAT) {
+        ahci_trigger_irq(s, ad, AHCI_PORT_IRQ_BIT_TFES);
+    } else if (sdb_fis->flags & 0x40) {
         ahci_trigger_irq(s, ad, AHCI_PORT_IRQ_BIT_SDBS);
     }
 }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:52:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:52:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815520.1229416 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn1t-0000ES-Ma; Thu, 10 Oct 2024 06:52:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815520.1229416; Thu, 10 Oct 2024 06:52:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn1t-0000EK-K3; Thu, 10 Oct 2024 06:52:09 +0000
Received: by outflank-mailman (input) for mailman id 815520;
 Thu, 10 Oct 2024 06:52:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn1s-0000EA-2o
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:52:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn1s-0004ut-2A
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:52:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn1s-0002f0-1Y
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:52:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=x0DrKn4I4kiE6MGfUd/zTVezWZadZK2DA/ES8RXfTi4=; b=FiJLPLbvQPWs0U0SqGUvZQ4If4
	xcJZCW7KEHitY1IAVD4U+NlVV40Fjl4lz6CrncTAiw8tfpOw8xJzJ317DHwIIn511sQ2cuj/G2hem
	oJOZZCmv06eayJjWrp4PDP0bpPl5sSXT/atsm++2qhaPhmG92GBJV2J3yqDbGFiGtamI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/ide/ahci: fix broken SError handling
Message-Id: <E1syn1s-0002f0-1Y@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:52:08 +0000

commit 4f6c55371743ba9d6512fcf4a88a5b5b8936037e
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:44 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    hw/ide/ahci: fix broken SError handling
    
    When encountering an NCQ error, you should not write the NCQ tag to the
    SError register. This is completely wrong.
    
    The SError register has a clear definition, where each bit represents a
    different error, see PxSERR definition in AHCI 1.3.1.
    
    If we write a random value (like the NCQ tag) in SError, e.g. Linux will
    read SError, and will trigger arbitrary error handling depending on the
    NCQ tag that happened to be executing.
    
    In case of success, ncq_cb() will call ncq_finish().
    In case of error, ncq_cb() will call ncq_err() (which will clear
    ncq_tfs->used), and then call ncq_finish(), thus using ncq_tfs->used is
    sufficient to tell if finished should get set or not.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20230609140844.202795-9-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit 9f89423537653de07ca40c18b5ff5b70b104cc93)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/ahci.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 8ce3dd796e..29ddd4b6c4 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1012,7 +1012,6 @@ static void ncq_err(NCQTransferState *ncq_tfs)
 
     ide_state->error = ABRT_ERR;
     ide_state->status = READY_STAT | ERR_STAT;
-    ncq_tfs->drive->port_regs.scr_err |= (1 << ncq_tfs->tag);
     qemu_sglist_destroy(&ncq_tfs->sglist);
     ncq_tfs->used = 0;
 }
@@ -1022,7 +1021,7 @@ static void ncq_finish(NCQTransferState *ncq_tfs)
     /* If we didn't error out, set our finished bit. Errored commands
      * do not get a bit set for the SDB FIS ACT register, nor do they
      * clear the outstanding bit in scr_act (PxSACT). */
-    if (!(ncq_tfs->drive->port_regs.scr_err & (1 << ncq_tfs->tag))) {
+    if (ncq_tfs->used) {
         ncq_tfs->drive->finished |= (1 << ncq_tfs->tag);
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:52:19 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:52:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815521.1229420 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn23-0000HR-OC; Thu, 10 Oct 2024 06:52:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815521.1229420; Thu, 10 Oct 2024 06:52:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn23-0000H6-LU; Thu, 10 Oct 2024 06:52:19 +0000
Received: by outflank-mailman (input) for mailman id 815521;
 Thu, 10 Oct 2024 06:52:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn22-0000Gn-5n
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:52:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn22-0004v2-54
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:52:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn22-0002fb-4T
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:52:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5R8Ul12chiX/hj3r+7aToyDZykHw9YlC7+73SpPJraU=; b=X/JG49VPuDFlJ0bQh5ZXalFF/S
	AaZKomdmHh29XYQYK88JAZ0TVCKUy2YJuCCmItycS8s9d0+WwnPtD37I85nhEtDIW6plj1NrP8zuD
	lcCUg2nmZtjTYaBBJMlWw1e7coC3VT8pmpfQf1lKqPsrGneJnHaapiRgpkfjYmMbeNh4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/i2c/aspeed: Fix Tx count and Rx size error in buffer pool mode
Message-Id: <E1syn22-0002fb-4T@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:52:18 +0000

commit 4a398e64ba8e9c1eced75217d856668c0d17e62e
Author:     Hang Yu <francis_yuu@stu.pku.edu.cn>
AuthorDate: Sat Aug 12 14:52:28 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    hw/i2c/aspeed: Fix Tx count and Rx size error in buffer pool mode
    
    Fixed inconsistency between the regisiter bit field definition header file
    and the ast2600 datasheet. The reg name is I2CD1C:Pool Buffer Control
    Register in old register mode and  I2CC0C: Master/Slave Pool Buffer Control
    Register in new register mode. They share bit field
    [12:8]:Transmit Data Byte Count and bit field
    [29:24]:Actual Received Pool Buffer Size according to the datasheet.
    According to the ast2600 datasheet,the actual Tx count is
    Transmit Data Byte Count plus 1, and the max Rx size is
    Receive Pool Buffer Size plus 1, both in Pool Buffer Control Register.
    The version before forgot to plus 1, and mistake Rx count for Rx size.
    
    Signed-off-by: Hang Yu <francis_yuu@stu.pku.edu.cn>
    Fixes: 3be3d6ccf2ad ("aspeed: i2c: Migrate to registerfields API")
    Reviewed-by: Cédric Le Goater <clg@kaod.org>
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    (cherry picked from commit 97b8aa5ae9ff197394395eda5062ea3681e09c28)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/i2c/aspeed_i2c.c         | 8 ++++----
 include/hw/i2c/aspeed_i2c.h | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/i2c/aspeed_i2c.c b/hw/i2c/aspeed_i2c.c
index 1f071a3811..e485d8bfb8 100644
--- a/hw/i2c/aspeed_i2c.c
+++ b/hw/i2c/aspeed_i2c.c
@@ -236,7 +236,7 @@ static int aspeed_i2c_bus_send(AspeedI2CBus *bus, uint8_t pool_start)
     uint32_t reg_byte_buf = aspeed_i2c_bus_byte_buf_offset(bus);
     uint32_t reg_dma_len = aspeed_i2c_bus_dma_len_offset(bus);
     int pool_tx_count = SHARED_ARRAY_FIELD_EX32(bus->regs, reg_pool_ctrl,
-                                                TX_COUNT);
+                                                TX_COUNT) + 1;
 
     if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_BUFF_EN)) {
         for (i = pool_start; i < pool_tx_count; i++) {
@@ -293,7 +293,7 @@ static void aspeed_i2c_bus_recv(AspeedI2CBus *bus)
     uint32_t reg_dma_len = aspeed_i2c_bus_dma_len_offset(bus);
     uint32_t reg_dma_addr = aspeed_i2c_bus_dma_addr_offset(bus);
     int pool_rx_count = SHARED_ARRAY_FIELD_EX32(bus->regs, reg_pool_ctrl,
-                                                RX_COUNT);
+                                                RX_SIZE) + 1;
 
     if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, RX_BUFF_EN)) {
         uint8_t *pool_base = aic->bus_pool_base(bus);
@@ -418,7 +418,7 @@ static void aspeed_i2c_bus_cmd_dump(AspeedI2CBus *bus)
     uint32_t reg_intr_sts = aspeed_i2c_bus_intr_sts_offset(bus);
     uint32_t reg_dma_len = aspeed_i2c_bus_dma_len_offset(bus);
     if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, RX_BUFF_EN)) {
-        count = SHARED_ARRAY_FIELD_EX32(bus->regs, reg_pool_ctrl, TX_COUNT);
+        count = SHARED_ARRAY_FIELD_EX32(bus->regs, reg_pool_ctrl, TX_COUNT) + 1;
     } else if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, RX_DMA_EN)) {
         count = bus->regs[reg_dma_len];
     } else { /* BYTE mode */
@@ -490,7 +490,7 @@ static void aspeed_i2c_bus_handle_cmd(AspeedI2CBus *bus, uint64_t value)
          */
         if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_BUFF_EN)) {
             if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_pool_ctrl, TX_COUNT)
-                == 1) {
+                == 0) {
                 SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, M_TX_CMD, 0);
             } else {
                 /*
diff --git a/include/hw/i2c/aspeed_i2c.h b/include/hw/i2c/aspeed_i2c.h
index adc904d6c1..91d0e7157c 100644
--- a/include/hw/i2c/aspeed_i2c.h
+++ b/include/hw/i2c/aspeed_i2c.h
@@ -132,9 +132,9 @@ REG32(I2CD_CMD, 0x14) /* I2CD Command/Status */
 REG32(I2CD_DEV_ADDR, 0x18) /* Slave Device Address */
     SHARED_FIELD(SLAVE_DEV_ADDR1, 0, 7)
 REG32(I2CD_POOL_CTRL, 0x1C) /* Pool Buffer Control */
-    SHARED_FIELD(RX_COUNT, 24, 5)
+    SHARED_FIELD(RX_COUNT, 24, 6)
     SHARED_FIELD(RX_SIZE, 16, 5)
-    SHARED_FIELD(TX_COUNT, 9, 5)
+    SHARED_FIELD(TX_COUNT, 8, 5)
     FIELD(I2CD_POOL_CTRL, OFFSET, 2, 6) /* AST2400 */
 REG32(I2CD_BYTE_BUF, 0x20) /* Transmit/Receive Byte Buffer */
     SHARED_FIELD(RX_BUF, 8, 8)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:52:29 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:52:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815522.1229423 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn2D-0000Kd-PN; Thu, 10 Oct 2024 06:52:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815522.1229423; Thu, 10 Oct 2024 06:52:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn2D-0000KW-Mw; Thu, 10 Oct 2024 06:52:29 +0000
Received: by outflank-mailman (input) for mailman id 815522;
 Thu, 10 Oct 2024 06:52:28 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn2C-0000KF-8a
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:52:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn2C-0004wi-7s
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:52:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn2C-0002gH-7F
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:52:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=vr+fdrMmc6RTcDP4Uko8Tfwp0YslJDHNsYtYWiPvnI0=; b=UltR83KeLC1NT2oJXlMXP8VifW
	lZ2Py6awKJk3rl0FwToGJ1dC78qOgI29IPSjiA8y7mXxGZpoGi1y7++g7iBUj6BpIj0BpuMogViKN
	ELNG5ASz5lqX9LOWrLxQPwpmYk60PT1rq1sNlAgxOT/Ko15bNmTDj0rkx/WmGJw4u8CY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/i2c/aspeed: Fix TXBUF transmission start position error
Message-Id: <E1syn2C-0002gH-7F@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:52:28 +0000

commit c2ec46c694a176a2ced6d8b62f0ec40569f4a83d
Author:     Hang Yu <francis_yuu@stu.pku.edu.cn>
AuthorDate: Sat Aug 12 14:52:29 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    hw/i2c/aspeed: Fix TXBUF transmission start position error
    
    According to the ast2600 datasheet and the linux aspeed i2c driver,
    the TXBUF transmission start position should be TXBUF[0] instead
    of TXBUF[1],so the arg pool_start is useless,and the address is not
    included in TXBUF.So even if Tx Count equals zero,there is at least
    1 byte data needs to be transmitted,and M_TX_CMD should not be cleared
    at this condition.The driver url is:
    https://github.com/AspeedTech-BMC/linux/blob/aspeed-master-v5.15/drivers/i2c/busses/i2c-ast2600.c
    
    Signed-off-by: Hang Yu <francis_yuu@stu.pku.edu.cn>
    Fixes: 6054fc73e8f4 ("aspeed/i2c: Add support for pool buffer transfers")
    Reviewed-by: Cédric Le Goater <clg@kaod.org>
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    (cherry picked from commit 961faf3ddbd8ffcdf776bbcf88af0bc97218114a)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/i2c/aspeed_i2c.c | 30 ++++++------------------------
 1 file changed, 6 insertions(+), 24 deletions(-)

diff --git a/hw/i2c/aspeed_i2c.c b/hw/i2c/aspeed_i2c.c
index e485d8bfb8..44905d7899 100644
--- a/hw/i2c/aspeed_i2c.c
+++ b/hw/i2c/aspeed_i2c.c
@@ -226,7 +226,7 @@ static int aspeed_i2c_dma_read(AspeedI2CBus *bus, uint8_t *data)
     return 0;
 }
 
-static int aspeed_i2c_bus_send(AspeedI2CBus *bus, uint8_t pool_start)
+static int aspeed_i2c_bus_send(AspeedI2CBus *bus)
 {
     AspeedI2CClass *aic = ASPEED_I2C_GET_CLASS(bus->controller);
     int ret = -1;
@@ -239,7 +239,7 @@ static int aspeed_i2c_bus_send(AspeedI2CBus *bus, uint8_t pool_start)
                                                 TX_COUNT) + 1;
 
     if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_BUFF_EN)) {
-        for (i = pool_start; i < pool_tx_count; i++) {
+        for (i = 0; i < pool_tx_count; i++) {
             uint8_t *pool_base = aic->bus_pool_base(bus);
 
             trace_aspeed_i2c_bus_send("BUF", i + 1, pool_tx_count,
@@ -273,7 +273,7 @@ static int aspeed_i2c_bus_send(AspeedI2CBus *bus, uint8_t pool_start)
         }
         SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, TX_DMA_EN, 0);
     } else {
-        trace_aspeed_i2c_bus_send("BYTE", pool_start, 1,
+        trace_aspeed_i2c_bus_send("BYTE", 0, 1,
                                   bus->regs[reg_byte_buf]);
         ret = i2c_send(bus->bus, bus->regs[reg_byte_buf]);
     }
@@ -446,10 +446,8 @@ static void aspeed_i2c_bus_cmd_dump(AspeedI2CBus *bus)
  */
 static void aspeed_i2c_bus_handle_cmd(AspeedI2CBus *bus, uint64_t value)
 {
-    uint8_t pool_start = 0;
     uint32_t reg_intr_sts = aspeed_i2c_bus_intr_sts_offset(bus);
     uint32_t reg_cmd = aspeed_i2c_bus_cmd_offset(bus);
-    uint32_t reg_pool_ctrl = aspeed_i2c_bus_pool_ctrl_offset(bus);
     uint32_t reg_dma_len = aspeed_i2c_bus_dma_len_offset(bus);
 
     if (!aspeed_i2c_check_sram(bus)) {
@@ -483,27 +481,11 @@ static void aspeed_i2c_bus_handle_cmd(AspeedI2CBus *bus, uint64_t value)
 
         SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, M_START_CMD, 0);
 
-        /*
-         * The START command is also a TX command, as the slave
-         * address is sent on the bus. Drop the TX flag if nothing
-         * else needs to be sent in this sequence.
-         */
-        if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_BUFF_EN)) {
-            if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_pool_ctrl, TX_COUNT)
-                == 0) {
-                SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, M_TX_CMD, 0);
-            } else {
-                /*
-                 * Increase the start index in the TX pool buffer to
-                 * skip the address byte.
-                 */
-                pool_start++;
-            }
-        } else if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_DMA_EN)) {
+        if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_DMA_EN)) {
             if (bus->regs[reg_dma_len] == 0) {
                 SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, M_TX_CMD, 0);
             }
-        } else {
+        } else if (!SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_BUFF_EN)) {
             SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, M_TX_CMD, 0);
         }
 
@@ -520,7 +502,7 @@ static void aspeed_i2c_bus_handle_cmd(AspeedI2CBus *bus, uint64_t value)
 
     if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, M_TX_CMD)) {
         aspeed_i2c_set_state(bus, I2CD_MTXD);
-        if (aspeed_i2c_bus_send(bus, pool_start)) {
+        if (aspeed_i2c_bus_send(bus)) {
             SHARED_ARRAY_FIELD_DP32(bus->regs, reg_intr_sts, TX_NAK, 1);
             i2c_end_transfer(bus->bus);
         } else {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:52:39 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:52:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815523.1229428 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn2N-0000N1-Rf; Thu, 10 Oct 2024 06:52:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815523.1229428; Thu, 10 Oct 2024 06:52:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn2N-0000Mv-OT; Thu, 10 Oct 2024 06:52:39 +0000
Received: by outflank-mailman (input) for mailman id 815523;
 Thu, 10 Oct 2024 06:52:38 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn2M-0000Mm-C3
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:52:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn2M-0004wq-BO
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:52:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn2M-0002h2-AK
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:52:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4nlCVSaQ1vTE62QFtTtk87i//ncGhzLkMo/3lYXcg7I=; b=wqr1k+2Uzk0iYuz7RwK8XttS5X
	yCygjc7OecLhqfFj4aXOO047Fh5eAPlkzirqBBxlBO/FvPB+97/8lqKAXQUDtoipvA9juTTQ7FmF4
	Kp+2r7+7b05tmQ0uc7LRB3GzibsbYIs0VkZ32stmTWuPII6nKhapcj8cZQzPRXeJut0Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] qemu-options.hx: Rephrase the descriptions of the -hd* and -cdrom options
Message-Id: <E1syn2M-0002h2-AK@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:52:38 +0000

commit 45b61f730d953b713dc2bb8b695d6555a5b8adb6
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Tue Aug 29 15:29:48 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    qemu-options.hx: Rephrase the descriptions of the -hd* and -cdrom options
    
    The current description says that these options will create a device
    on the IDE bus, which is only true on x86. So rephrase these sentences
    a little bit to speak of "default bus" instead.
    
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (cherry picked from commit bcd8e243083c878884e52d609deddbe6be17c730)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 qemu-options.hx | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/qemu-options.hx b/qemu-options.hx
index fdddfab6ff..af8156d2f8 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1174,10 +1174,10 @@ SRST
 ERST
 
 DEF("hda", HAS_ARG, QEMU_OPTION_hda,
-    "-hda/-hdb file  use 'file' as IDE hard disk 0/1 image\n", QEMU_ARCH_ALL)
+    "-hda/-hdb file  use 'file' as hard disk 0/1 image\n", QEMU_ARCH_ALL)
 DEF("hdb", HAS_ARG, QEMU_OPTION_hdb, "", QEMU_ARCH_ALL)
 DEF("hdc", HAS_ARG, QEMU_OPTION_hdc,
-    "-hdc/-hdd file  use 'file' as IDE hard disk 2/3 image\n", QEMU_ARCH_ALL)
+    "-hdc/-hdd file  use 'file' as hard disk 2/3 image\n", QEMU_ARCH_ALL)
 DEF("hdd", HAS_ARG, QEMU_OPTION_hdd, "", QEMU_ARCH_ALL)
 SRST
 ``-hda file``
@@ -1187,18 +1187,22 @@ SRST
 ``-hdc file``
   \ 
 ``-hdd file``
-    Use file as hard disk 0, 1, 2 or 3 image (see the :ref:`disk images`
-    chapter in the System Emulation Users Guide).
+    Use file as hard disk 0, 1, 2 or 3 image on the default bus of the
+    emulated machine (this is for example the IDE bus on most x86 machines,
+    but it can also be SCSI, virtio or something else on other target
+    architectures). See also the :ref:`disk images` chapter in the System
+    Emulation Users Guide.
 ERST
 
 DEF("cdrom", HAS_ARG, QEMU_OPTION_cdrom,
-    "-cdrom file     use 'file' as IDE cdrom image (cdrom is ide1 master)\n",
+    "-cdrom file     use 'file' as CD-ROM image\n",
     QEMU_ARCH_ALL)
 SRST
 ``-cdrom file``
-    Use file as CD-ROM image (you cannot use ``-hdc`` and ``-cdrom`` at
-    the same time). You can use the host CD-ROM by using ``/dev/cdrom``
-    as filename.
+    Use file as CD-ROM image on the default bus of the emulated machine
+    (which is IDE1 master on x86, so you cannot use ``-hdc`` and ``-cdrom``
+    at the same time there). On systems that support it, you can use the
+    host CD-ROM by using ``/dev/cdrom`` as filename.
 ERST
 
 DEF("blockdev", HAS_ARG, QEMU_OPTION_blockdev,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:52:50 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:52:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815524.1229432 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn2X-0000Ps-Sn; Thu, 10 Oct 2024 06:52:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815524.1229432; Thu, 10 Oct 2024 06:52:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn2X-0000Pk-QA; Thu, 10 Oct 2024 06:52:49 +0000
Received: by outflank-mailman (input) for mailman id 815524;
 Thu, 10 Oct 2024 06:52:48 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn2W-0000PR-F4
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:52:48 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn2W-0004xD-EQ
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:52:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn2W-0002hu-Dj
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:52:48 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=sDMzsIkr+jMOStEdgj8ARRrFtrpebCrBO/zKwjRbS8w=; b=lw4brJhF6adow2I2yp30naCUp+
	IEQ1rD1ieMo1SHpvlMFkfxQ4Zbb+xoFVqVkazcEecUsZ0NPY5DM68k7fgLCDOpOr27tcx1SGMvw0W
	YCvms4B7SV+D1SSv+siRzEj5BS/jk0yQXwMvndUSdevx/wQ7qP4jUm+LkXerRwMMIUSc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] docs tests: Fix use of migrate_set_parameter
Message-Id: <E1syn2W-0002hu-Dj@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:52:48 +0000

commit 42edb4723afe4a94a7c8011fa7fe02c3846cdc7e
Author:     Markus Armbruster <armbru@redhat.com>
AuthorDate: Fri Aug 25 17:59:22 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    docs tests: Fix use of migrate_set_parameter
    
    docs/multi-thread-compression.txt uses parameter names with
    underscores instead of dashes.  Wrong since day one.
    
    docs/rdma.txt, tests/qemu-iotests/181, and tests/qtest/test-hmp.c are
    wrong the same way since commit cbde7be900d2 (v6.0.0).  Hard to see,
    as test-hmp doesn't check whether the commands work, and iotest 181
    appears to be unaffected.
    
    Fixes: 263170e679df (docs: Add a doc about multiple thread compression)
    Fixes: cbde7be900d2 (migrate: remove QMP/HMP commands for speed, downtime and cache size)
    Signed-off-by: Markus Armbruster <armbru@redhat.com>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (cherry picked from commit b21a6e31a182a5ae7436a444f840d49aac07c94f)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 docs/multi-thread-compression.txt | 12 ++++++------
 docs/rdma.txt                     |  2 +-
 tests/qemu-iotests/181            |  2 +-
 tests/qtest/test-hmp.c            |  6 +++---
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/docs/multi-thread-compression.txt b/docs/multi-thread-compression.txt
index bb88c6bdf1..95b1556f67 100644
--- a/docs/multi-thread-compression.txt
+++ b/docs/multi-thread-compression.txt
@@ -117,13 +117,13 @@ to support the multiple thread compression migration:
     {qemu} migrate_set_capability compress on
 
 3. Set the compression thread count on source:
-    {qemu} migrate_set_parameter compress_threads 12
+    {qemu} migrate_set_parameter compress-threads 12
 
 4. Set the compression level on the source:
-    {qemu} migrate_set_parameter compress_level 1
+    {qemu} migrate_set_parameter compress-level 1
 
 5. Set the decompression thread count on destination:
-    {qemu} migrate_set_parameter decompress_threads 3
+    {qemu} migrate_set_parameter decompress-threads 3
 
 6. Start outgoing migration:
     {qemu} migrate -d tcp:destination.host:4444
@@ -133,9 +133,9 @@ to support the multiple thread compression migration:
 
 The following are the default settings:
     compress: off
-    compress_threads: 8
-    decompress_threads: 2
-    compress_level: 1 (which means best speed)
+    compress-threads: 8
+    decompress-threads: 2
+    compress-level: 1 (which means best speed)
 
 So, only the first two steps are required to use the multiple
 thread compression in migration. You can do more if the default
diff --git a/docs/rdma.txt b/docs/rdma.txt
index 2b4cdea1d8..bd8dd799a9 100644
--- a/docs/rdma.txt
+++ b/docs/rdma.txt
@@ -89,7 +89,7 @@ RUNNING:
 First, set the migration speed to match your hardware's capabilities:
 
 QEMU Monitor Command:
-$ migrate_set_parameter max_bandwidth 40g # or whatever is the MAX of your RDMA device
+$ migrate_set_parameter max-bandwidth 40g # or whatever is the MAX of your RDMA device
 
 Next, on the destination machine, add the following to the QEMU command line:
 
diff --git a/tests/qemu-iotests/181 b/tests/qemu-iotests/181
index cb96d09ae5..dc90a10757 100755
--- a/tests/qemu-iotests/181
+++ b/tests/qemu-iotests/181
@@ -109,7 +109,7 @@ if [ ${QEMU_STATUS[$dest]} -lt 0 ]; then
     _notrun 'Postcopy is not supported'
 fi
 
-_send_qemu_cmd $src 'migrate_set_parameter max_bandwidth 4k' "(qemu)"
+_send_qemu_cmd $src 'migrate_set_parameter max-bandwidth 4k' "(qemu)"
 _send_qemu_cmd $src 'migrate_set_capability postcopy-ram on' "(qemu)"
 _send_qemu_cmd $src "migrate -d unix:${MIG_SOCKET}" "(qemu)"
 _send_qemu_cmd $src 'migrate_start_postcopy' "(qemu)"
diff --git a/tests/qtest/test-hmp.c b/tests/qtest/test-hmp.c
index b4a920df89..e75523f882 100644
--- a/tests/qtest/test-hmp.c
+++ b/tests/qtest/test-hmp.c
@@ -45,9 +45,9 @@ static const char *hmp_cmds[] = {
     "log all",
     "log none",
     "memsave 0 4096 \"/dev/null\"",
-    "migrate_set_parameter xbzrle_cache_size 1",
-    "migrate_set_parameter downtime_limit 1",
-    "migrate_set_parameter max_bandwidth 1",
+    "migrate_set_parameter xbzrle-cache-size 1",
+    "migrate_set_parameter downtime-limit 1",
+    "migrate_set_parameter max-bandwidth 1",
     "netdev_add user,id=net1",
     "set_link net1 off",
     "set_link net1 on",
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:52:59 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:52:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815525.1229436 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn2h-0000S6-UC; Thu, 10 Oct 2024 06:52:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815525.1229436; Thu, 10 Oct 2024 06:52:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn2h-0000Rz-Rc; Thu, 10 Oct 2024 06:52:59 +0000
Received: by outflank-mailman (input) for mailman id 815525;
 Thu, 10 Oct 2024 06:52:58 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn2g-0000Rp-Hv
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:52:58 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn2g-0004xM-HI
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:52:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn2g-0002ie-Gg
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:52:58 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=WmBOF8Jz5G9BOeBV65iky5CgXfh5ol8aUZDe+tLSRR8=; b=6LBH8Yc8Cua0fgMHYjYcFYY/lL
	6nFyHheKfDLIpd62EQiUBrpAyVvRh9B/C2Ma0Gb1LL/XbUDEsI3C4seV4FS2NOmEL9xDWNdUN/fT5
	qHTZ7VtDnbpPnfmOxsszQfpsAU9qnZA5GAX9ADq0ee8rUM0PDmqsfNHx1cnlu27dNrcs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/net/vmxnet3: Fix guest-triggerable assert()
Message-Id: <E1syn2g-0002ie-Gg@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:52:58 +0000

commit c68b844d3376764240afdb3c55d451e4dac11004
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Thu Aug 17 14:56:00 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    hw/net/vmxnet3: Fix guest-triggerable assert()
    
    The assert() that checks for valid MTU sizes can be triggered by
    the guest (e.g. with the reproducer code from the bug ticket
    https://gitlab.com/qemu-project/qemu/-/issues/517 ). Let's avoid
    this problem by simply logging the error and refusing to activate
    the device instead.
    
    Fixes: d05dcd94ae ("net: vmxnet3: validate configuration values during activate")
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    Cc: qemu-stable@nongnu.org
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    [Mjt: change format specifier from %d to %u for uint32_t argument]
    (cherry picked from commit 90a0778421acdf4ca903be64c8ed19378183c944)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/net/vmxnet3.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
index cb52db96a2..fd3b9aff5b 100644
--- a/hw/net/vmxnet3.c
+++ b/hw/net/vmxnet3.c
@@ -1439,7 +1439,10 @@ static void vmxnet3_activate_device(VMXNET3State *s)
     vmxnet3_setup_rx_filtering(s);
     /* Cache fields from shared memory */
     s->mtu = VMXNET3_READ_DRV_SHARED32(d, s->drv_shmem, devRead.misc.mtu);
-    assert(VMXNET3_MIN_MTU <= s->mtu && s->mtu <= VMXNET3_MAX_MTU);
+    if (s->mtu < VMXNET3_MIN_MTU || s->mtu > VMXNET3_MAX_MTU) {
+        qemu_log_mask(LOG_GUEST_ERROR, "vmxnet3: Bad MTU size: %u\n", s->mtu);
+        return;
+    }
     VMW_CFPRN("MTU is %u", s->mtu);
 
     s->max_rx_frags =
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:53:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:53:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815526.1229439 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn2s-0000Uy-12; Thu, 10 Oct 2024 06:53:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815526.1229439; Thu, 10 Oct 2024 06:53:10 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn2r-0000Ur-Um; Thu, 10 Oct 2024 06:53:09 +0000
Received: by outflank-mailman (input) for mailman id 815526;
 Thu, 10 Oct 2024 06:53:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn2q-0000Uj-Ko
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:53:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn2q-0004xn-KE
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:53:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn2q-0002jW-JW
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:53:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=yobeQWi1NAunG5BYRnIUviMmcoytZbdwJbmJ5BGcjj0=; b=IfeRiD7r8vQXw7ZD3o8gwU2ntP
	3iuJoFmxUREXSpTeD/dG+2bijI+zauWvb6o3nz8k7WKKBK45PVq28iNfoWcGveiipapZdeF6PSkD8
	sWvxvEZQlK83KO/rxnjjlvrmVaJHXrXMQl5bOnUwKJG7FJEIguEGq+8gPI8d1Ub7toco=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] qxl: don't assert() if device isn't yet initialized
Message-Id: <E1syn2q-0002jW-JW@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:53:08 +0000

commit 5929f5309194e46f40b20aa07797f531663e323f
Author:     Marc-André Lureau <marcandre.lureau@redhat.com>
AuthorDate: Mon Aug 14 23:33:30 2023 +0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    qxl: don't assert() if device isn't yet initialized
    
    If the PCI BAR isn't yet mapped or was unmapped, QXL_IO_SET_MODE will
    assert(). Instead, report a guest bug and keep going.
    
    This can be reproduced with:
    
    cat << EOF | ./qemu-system-x86_64 -vga qxl -m 2048 -nodefaults -qtest stdio
    outl 0xcf8 0x8000101c
    outl 0xcfc 0xc000
    outl 0xcf8 0x80001001
    outl 0xcfc 0x01000000
    outl 0xc006 0x00
    EOF
    
    Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1829
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (cherry picked from commit 95bef686e490bc3afc3f51f5fc6e20bf260b938c)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/display/qxl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index f1c0eb7dfc..70b73820b2 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -1591,7 +1591,10 @@ static void qxl_set_mode(PCIQXLDevice *d, unsigned int modenr, int loadvm)
     }
 
     d->guest_slots[0].slot = slot;
-    assert(qxl_add_memslot(d, 0, devmem, QXL_SYNC) == 0);
+    if (qxl_add_memslot(d, 0, devmem, QXL_SYNC) != 0) {
+        qxl_set_guest_bug(d, "device isn't initialized yet");
+        return;
+    }
 
     d->guest_primary.surface = surface;
     qxl_create_guest_primary(d, 0, QXL_SYNC);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:53:20 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:53:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815527.1229444 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn32-0000Xf-2l; Thu, 10 Oct 2024 06:53:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815527.1229444; Thu, 10 Oct 2024 06:53:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn32-0000XX-08; Thu, 10 Oct 2024 06:53:20 +0000
Received: by outflank-mailman (input) for mailman id 815527;
 Thu, 10 Oct 2024 06:53:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn30-0000XL-O3
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:53:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn30-0004xw-NM
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:53:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn30-0002kI-Ma
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:53:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9PjGKEpHyLAhcqukM0Cn6/U1W9qjgwzPciK6M9/FSDc=; b=SI3uvpul6rB3H+tix3sU+YtUM9
	KYKUZLoGnFMIqqhWJEIiLtGB3sLsdSdWd/3PFhQQsriD2CWscu0+7DjZd1Qr1ORruGpa9V7G+5z7c
	NWnOsd5citNUHwHC0HfulT0Dzh6pajgr2lBj5ldAk3wqBhreuo3w788L/HzHW8+1412E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] virtio: Drop out of coroutine context in virtio_load()
Message-Id: <E1syn30-0002kI-Ma@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:53:18 +0000

commit 41af7a9bc41c15460a4dbf4d35879d69c460d02a
Author:     Kevin Wolf <kwolf@redhat.com>
AuthorDate: Tue Sep 5 16:50:02 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Mon Sep 11 22:31:56 2023 +0300

    virtio: Drop out of coroutine context in virtio_load()
    
    virtio_load() as a whole should run in coroutine context because it
    reads from the migration stream and we don't want this to block.
    
    However, it calls virtio_set_features_nocheck() and devices don't
    expect their .set_features callback to run in a coroutine and therefore
    call functions that may not be called in coroutine context. To fix this,
    drop out of coroutine context for calling virtio_set_features_nocheck().
    
    Without this fix, the following crash was reported:
    
      #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
      #1  0x00007efc738c05d3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
      #2  0x00007efc73873d26 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
      #3  0x00007efc738477f3 in __GI_abort () at abort.c:79
      #4  0x00007efc7384771b in __assert_fail_base (fmt=0x7efc739dbcb8 "", assertion=assertion@entry=0x560aebfbf5cf "!qemu_in_coroutine()",
         file=file@entry=0x560aebfcd2d4 "../block/graph-lock.c", line=line@entry=275, function=function@entry=0x560aebfcd34d "void bdrv_graph_rdlock_main_loop(void)") at assert.c:92
      #5  0x00007efc7386ccc6 in __assert_fail (assertion=0x560aebfbf5cf "!qemu_in_coroutine()", file=0x560aebfcd2d4 "../block/graph-lock.c", line=275,
         function=0x560aebfcd34d "void bdrv_graph_rdlock_main_loop(void)") at assert.c:101
      #6  0x0000560aebcd8dd6 in bdrv_register_buf ()
      #7  0x0000560aeb97ed97 in ram_block_added.llvm ()
      #8  0x0000560aebb8303f in ram_block_add.llvm ()
      #9  0x0000560aebb834fa in qemu_ram_alloc_internal.llvm ()
      #10 0x0000560aebb2ac98 in vfio_region_mmap ()
      #11 0x0000560aebb3ea0f in vfio_bars_register ()
      #12 0x0000560aebb3c628 in vfio_realize ()
      #13 0x0000560aeb90f0c2 in pci_qdev_realize ()
      #14 0x0000560aebc40305 in device_set_realized ()
      #15 0x0000560aebc48e07 in property_set_bool.llvm ()
      #16 0x0000560aebc46582 in object_property_set ()
      #17 0x0000560aebc4cd58 in object_property_set_qobject ()
      #18 0x0000560aebc46ba7 in object_property_set_bool ()
      #19 0x0000560aeb98b3ca in qdev_device_add_from_qdict ()
      #20 0x0000560aebb1fbaf in virtio_net_set_features ()
      #21 0x0000560aebb46b51 in virtio_set_features_nocheck ()
      #22 0x0000560aebb47107 in virtio_load ()
      #23 0x0000560aeb9ae7ce in vmstate_load_state ()
      #24 0x0000560aeb9d2ee9 in qemu_loadvm_state_main ()
      #25 0x0000560aeb9d45e1 in qemu_loadvm_state ()
      #26 0x0000560aeb9bc32c in process_incoming_migration_co.llvm ()
      #27 0x0000560aebeace56 in coroutine_trampoline.llvm ()
    
    Cc: qemu-stable@nongnu.org
    Buglink: https://issues.redhat.com/browse/RHEL-832
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>
    Message-ID: <20230905145002.46391-3-kwolf@redhat.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>
    (cherry picked from commit 92e2e6a867334a990f8d29f07ca34e3162fdd6ec)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/virtio/virtio.c | 45 ++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 40 insertions(+), 5 deletions(-)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 98c4819fcc..0010a9a5f1 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2825,8 +2825,9 @@ static int virtio_device_put(QEMUFile *f, void *opaque, size_t size,
 }
 
 /* A wrapper for use as a VMState .get function */
-static int virtio_device_get(QEMUFile *f, void *opaque, size_t size,
-                             const VMStateField *field)
+static int coroutine_mixed_fn
+virtio_device_get(QEMUFile *f, void *opaque, size_t size,
+                  const VMStateField *field)
 {
     VirtIODevice *vdev = VIRTIO_DEVICE(opaque);
     DeviceClass *dc = DEVICE_CLASS(VIRTIO_DEVICE_GET_CLASS(vdev));
@@ -2853,6 +2854,39 @@ static int virtio_set_features_nocheck(VirtIODevice *vdev, uint64_t val)
     return bad ? -1 : 0;
 }
 
+typedef struct VirtioSetFeaturesNocheckData {
+    Coroutine *co;
+    VirtIODevice *vdev;
+    uint64_t val;
+    int ret;
+} VirtioSetFeaturesNocheckData;
+
+static void virtio_set_features_nocheck_bh(void *opaque)
+{
+    VirtioSetFeaturesNocheckData *data = opaque;
+
+    data->ret = virtio_set_features_nocheck(data->vdev, data->val);
+    aio_co_wake(data->co);
+}
+
+static int coroutine_mixed_fn
+virtio_set_features_nocheck_maybe_co(VirtIODevice *vdev, uint64_t val)
+{
+    if (qemu_in_coroutine()) {
+        VirtioSetFeaturesNocheckData data = {
+            .co = qemu_coroutine_self(),
+            .vdev = vdev,
+            .val = val,
+        };
+        aio_bh_schedule_oneshot(qemu_get_current_aio_context(),
+                                virtio_set_features_nocheck_bh, &data);
+        qemu_coroutine_yield();
+        return data.ret;
+    } else {
+        return virtio_set_features_nocheck(vdev, val);
+    }
+}
+
 int virtio_set_features(VirtIODevice *vdev, uint64_t val)
 {
     int ret;
@@ -2906,7 +2940,8 @@ size_t virtio_get_config_size(const VirtIOConfigSizeParams *params,
     return config_size;
 }
 
-int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
+int coroutine_mixed_fn
+virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
 {
     int i, ret;
     int32_t config_len;
@@ -3023,14 +3058,14 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
          * host_features.
          */
         uint64_t features64 = vdev->guest_features;
-        if (virtio_set_features_nocheck(vdev, features64) < 0) {
+        if (virtio_set_features_nocheck_maybe_co(vdev, features64) < 0) {
             error_report("Features 0x%" PRIx64 " unsupported. "
                          "Allowed features: 0x%" PRIx64,
                          features64, vdev->host_features);
             return -1;
         }
     } else {
-        if (virtio_set_features_nocheck(vdev, features) < 0) {
+        if (virtio_set_features_nocheck_maybe_co(vdev, features) < 0) {
             error_report("Features 0x%x unsupported. "
                          "Allowed features: 0x%" PRIx64,
                          features, vdev->host_features);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:53:30 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:53:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815528.1229448 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn3C-0000af-4C; Thu, 10 Oct 2024 06:53:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815528.1229448; Thu, 10 Oct 2024 06:53:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn3C-0000aY-1Z; Thu, 10 Oct 2024 06:53:30 +0000
Received: by outflank-mailman (input) for mailman id 815528;
 Thu, 10 Oct 2024 06:53:28 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn3A-0000aN-R2
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:53:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn3A-0004y3-QJ
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:53:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn3A-0002mQ-PW
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:53:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HkpA3hJlOFM7SG6JbxqqJK9ZdSFyAks6jR/sKH4lmUQ=; b=fe1ajvHPbsHqAP4sO3UARO92Eb
	WbqCuNgwyqD0dsT493/h68Axk9nA/dlDcUijiUKQ35CijelWo6sPw1gRp2cmn7wkFQQSH5JAgyUG1
	2AULDKVgCkE7mo4hXyuBjjrswWwhlx4tTA7Ualx/fxjpuHJcC9kemCpFXJ2G1VxS6LuY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] arm64: Restore trapless ptimer access
Message-Id: <E1syn3A-0002mQ-PW@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:53:28 +0000

commit 53a4e7ef420a2e272907b98fd8ffc199bcdc0e06
Author:     Colton Lewis <coltonlewis@google.com>
AuthorDate: Thu Aug 31 19:00:52 2023 +0000
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Mon Sep 11 22:33:58 2023 +0300

    arm64: Restore trapless ptimer access
    
    Due to recent KVM changes, QEMU is setting a ptimer offset resulting
    in unintended trap and emulate access and a consequent performance
    hit. Filter out the PTIMER_CNT register to restore trapless ptimer
    access.
    
    Quoting Andrew Jones:
    
    Simply reading the CNT register and writing back the same value is
    enough to set an offset, since the timer will have certainly moved
    past whatever value was read by the time it's written.  QEMU
    frequently saves and restores all registers in the get-reg-list array,
    unless they've been explicitly filtered out (with Linux commit
    680232a94c12, KVM_REG_ARM_PTIMER_CNT is now in the array). So, to
    restore trapless ptimer accesses, we need a QEMU patch to filter out
    the register.
    
    See
    https://lore.kernel.org/kvmarm/gsntttsonus5.fsf@coltonlewis-kvm.c.googlers.com/T/#m0770023762a821db2a3f0dd0a7dc6aa54e0d0da9
    for additional context.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Andrew Jones <andrew.jones@linux.dev>
    Signed-off-by: Colton Lewis <coltonlewis@google.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Tested-by: Colton Lewis <coltonlewis@google.com>
    Message-id: 20230831190052.129045-1-coltonlewis@google.com
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    (cherry picked from commit 682814e2a3c883b27f24b9e7cab47313c49acbd4)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/arm/kvm64.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
index 810db33ccb..ed85bcfb5c 100644
--- a/target/arm/kvm64.c
+++ b/target/arm/kvm64.c
@@ -950,6 +950,7 @@ typedef struct CPRegStateLevel {
  */
 static const CPRegStateLevel non_runtime_cpregs[] = {
     { KVM_REG_ARM_TIMER_CNT, KVM_PUT_FULL_STATE },
+    { KVM_REG_ARM_PTIMER_CNT, KVM_PUT_FULL_STATE },
 };
 
 int kvm_arm_cpreg_level(uint64_t regidx)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:53:40 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:53:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815529.1229452 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn3M-0000d6-5j; Thu, 10 Oct 2024 06:53:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815529.1229452; Thu, 10 Oct 2024 06:53:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn3M-0000cx-37; Thu, 10 Oct 2024 06:53:40 +0000
Received: by outflank-mailman (input) for mailman id 815529;
 Thu, 10 Oct 2024 06:53:38 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn3K-0000ch-Tp
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:53:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn3K-0004yD-TA
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:53:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn3K-0002n8-SV
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:53:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jDG/+8fcF/2CLjsca7rOrCiPqYtTW6Tbyuc+UH/v86A=; b=1CSykSCt8BLTychdxWE1HBOCsk
	dr/prcWxKMFNkxsyZKOfSVgL9q5ewAJVV1610td7SV5BDRpLIEDFFew+WFo4GxxApUUVos+NSbNbB
	u9+JYEs4Dve9c0MTpOfBnb5aFoACYZjp4EyHyVkgqOmpZKOBEKTl0JrPZzT2gegaCwfQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/char/riscv_htif: Fix printing of console characters on big endian hosts
Message-Id: <E1syn3K-0002n8-SV@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:53:38 +0000

commit 3af03de983108bc8c60a1a274b3e81a9553d4ce1
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Fri Jul 21 11:47:19 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Tue Sep 12 13:37:02 2023 +0300

    hw/char/riscv_htif: Fix printing of console characters on big endian hosts
    
    The character that should be printed is stored in the 64 bit "payload"
    variable. The code currently tries to print it by taking the address
    of the variable and passing this pointer to qemu_chr_fe_write(). However,
    this only works on little endian hosts where the least significant bits
    are stored on the lowest address. To do this in a portable way, we have
    to store the value in an uint8_t variable instead.
    
    Fixes: 5033606780 ("RISC-V HTIF Console")
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Reviewed-by: Bin Meng <bmeng@tinylab.org>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-Id: <20230721094720.902454-2-thuth@redhat.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit c255946e3df4d9660e4f468a456633c24393d468)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/char/riscv_htif.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/char/riscv_htif.c b/hw/char/riscv_htif.c
index 098de50e35..e6e0fa3015 100644
--- a/hw/char/riscv_htif.c
+++ b/hw/char/riscv_htif.c
@@ -190,7 +190,8 @@ static void htif_handle_tohost_write(HTIFState *s, uint64_t val_written)
             s->tohost = 0; /* clear to indicate we read */
             return;
         } else if (cmd == HTIF_CONSOLE_CMD_PUTC) {
-            qemu_chr_fe_write(&s->chr, (uint8_t *)&payload, 1);
+            uint8_t ch = (uint8_t)payload;
+            qemu_chr_fe_write(&s->chr, &ch, 1);
             resp = 0x100 | (uint8_t)payload;
         } else {
             qemu_log("HTIF device %d: unknown command\n", device);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:53:50 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:53:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815530.1229456 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn3W-0000fv-7E; Thu, 10 Oct 2024 06:53:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815530.1229456; Thu, 10 Oct 2024 06:53:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn3W-0000fo-4b; Thu, 10 Oct 2024 06:53:50 +0000
Received: by outflank-mailman (input) for mailman id 815530;
 Thu, 10 Oct 2024 06:53:49 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn3V-0000fe-0K
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:53:49 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn3U-0004yg-Vv
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:53:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn3U-0002nu-VH
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:53:48 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LjUmqV7ZEp0s8amS0D7sRhPAf9QotyTqYkmOOb6gieU=; b=6wKUW66zyhqwfc5u9DHAgsSDGB
	ODDntoSvked7ANHpwjPNhE2WysjV7oyieneNEp3bPSJGBm/0+L6Zf2TfTy3S94WGPo4V3/HDGR2HV
	pzk0Yy0f5X7qJiXjlTBes4UM+UruDOMkcJczk8y8Yv7pCBxj6bTvYwEkO+yP5SQ2KMdM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] include/exec: Provide the tswap() functions for target independent code, too
Message-Id: <E1syn3U-0002nu-VH@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:53:48 +0000

commit aeb931d82b13c50587268f462dcd46b23d2086ff
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Tue Apr 11 20:34:17 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:17:02 2023 +0300

    include/exec: Provide the tswap() functions for target independent code, too
    
    In some cases of target independent code, it would be useful to have access
    to the functions that swap endianess in case it differs between guest and
    host. Thus re-implement the tswapXX() functions in a new header that can be
    included separately. The check whether the swapping is needed continues to
    be done at compile-time for target specific code, while it is done at
    run-time in target-independent code.
    
    Message-Id: <20230411183418.1640500-3-thuth@redhat.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Reviewed-by: Cédric Le Goater <clg@kaod.org>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 24be3369ad63c3882be42dd510a45bad52816fd1)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (trivial change needed for the next commit 058096f1c5
     "hw/char/riscv_htif: Fix the console syscall on big endian hosts")
---
 include/exec/cpu-all.h | 64 +-------------------------------------------
 include/exec/tswap.h   | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+), 63 deletions(-)

diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index 090922e4a8..ad824fee52 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -21,6 +21,7 @@
 
 #include "exec/cpu-common.h"
 #include "exec/memory.h"
+#include "exec/tswap.h"
 #include "qemu/thread.h"
 #include "hw/core/cpu.h"
 #include "qemu/rcu.h"
@@ -44,69 +45,6 @@
 #define BSWAP_NEEDED
 #endif
 
-#ifdef BSWAP_NEEDED
-
-static inline uint16_t tswap16(uint16_t s)
-{
-    return bswap16(s);
-}
-
-static inline uint32_t tswap32(uint32_t s)
-{
-    return bswap32(s);
-}
-
-static inline uint64_t tswap64(uint64_t s)
-{
-    return bswap64(s);
-}
-
-static inline void tswap16s(uint16_t *s)
-{
-    *s = bswap16(*s);
-}
-
-static inline void tswap32s(uint32_t *s)
-{
-    *s = bswap32(*s);
-}
-
-static inline void tswap64s(uint64_t *s)
-{
-    *s = bswap64(*s);
-}
-
-#else
-
-static inline uint16_t tswap16(uint16_t s)
-{
-    return s;
-}
-
-static inline uint32_t tswap32(uint32_t s)
-{
-    return s;
-}
-
-static inline uint64_t tswap64(uint64_t s)
-{
-    return s;
-}
-
-static inline void tswap16s(uint16_t *s)
-{
-}
-
-static inline void tswap32s(uint32_t *s)
-{
-}
-
-static inline void tswap64s(uint64_t *s)
-{
-}
-
-#endif
-
 #if TARGET_LONG_SIZE == 4
 #define tswapl(s) tswap32(s)
 #define tswapls(s) tswap32s((uint32_t *)(s))
diff --git a/include/exec/tswap.h b/include/exec/tswap.h
new file mode 100644
index 0000000000..68944a880b
--- /dev/null
+++ b/include/exec/tswap.h
@@ -0,0 +1,72 @@
+/*
+ * Macros for swapping a value if the endianness is different
+ * between the target and the host.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef TSWAP_H
+#define TSWAP_H
+
+#include "hw/core/cpu.h"
+#include "qemu/bswap.h"
+
+/*
+ * If we're in target-specific code, we can hard-code the swapping
+ * condition, otherwise we have to do (slower) run-time checks.
+ */
+#ifdef NEED_CPU_H
+#define target_needs_bswap()  (HOST_BIG_ENDIAN != TARGET_BIG_ENDIAN)
+#else
+#define target_needs_bswap()  (target_words_bigendian() != HOST_BIG_ENDIAN)
+#endif
+
+static inline uint16_t tswap16(uint16_t s)
+{
+    if (target_needs_bswap()) {
+        return bswap16(s);
+    } else {
+        return s;
+    }
+}
+
+static inline uint32_t tswap32(uint32_t s)
+{
+    if (target_needs_bswap()) {
+        return bswap32(s);
+    } else {
+        return s;
+    }
+}
+
+static inline uint64_t tswap64(uint64_t s)
+{
+    if (target_needs_bswap()) {
+        return bswap64(s);
+    } else {
+        return s;
+    }
+}
+
+static inline void tswap16s(uint16_t *s)
+{
+    if (target_needs_bswap()) {
+        *s = bswap16(*s);
+    }
+}
+
+static inline void tswap32s(uint32_t *s)
+{
+    if (target_needs_bswap()) {
+        *s = bswap32(*s);
+    }
+}
+
+static inline void tswap64s(uint64_t *s)
+{
+    if (target_needs_bswap()) {
+        *s = bswap64(*s);
+    }
+}
+
+#endif  /* TSWAP_H */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:54:00 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:54:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815531.1229459 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn3g-0000id-8p; Thu, 10 Oct 2024 06:54:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815531.1229459; Thu, 10 Oct 2024 06:54:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn3g-0000iV-5y; Thu, 10 Oct 2024 06:54:00 +0000
Received: by outflank-mailman (input) for mailman id 815531;
 Thu, 10 Oct 2024 06:53:59 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn3f-0000iG-37
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:53:59 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn3f-0004yn-2T
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:53:59 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn3f-0002oc-1q
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:53:59 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=tbn3+/y2TM29jl916uwtWTRXwp/88V1vqA1nHhTSxkY=; b=wzNI013tSGJZRePeWAN0Khb2Kh
	bVgYN5OHjWNp9tJdGvNbHaM+ZhMIF5p4Y3StgCpSQONNSyqzi0HmfAm5h+UklMAT/8NChaJVSMrW6
	7EhildcKhvWUnXzaeJFKBQoKLWlZ91y4aw2mxNyFjsxrllRLn7UgKYOf5pOT0WX8rJ+U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/char/riscv_htif: Fix the console syscall on big endian hosts
Message-Id: <E1syn3f-0002oc-1q@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:53:59 +0000

commit a57e4cc6fe81a0b2ca8a32db91ca45df205c4a8f
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Fri Jul 21 11:47:20 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    hw/char/riscv_htif: Fix the console syscall on big endian hosts
    
    Values that have been read via cpu_physical_memory_read() from the
    guest's memory have to be swapped in case the host endianess differs
    from the guest.
    
    Fixes: a6e13e31d5 ("riscv_htif: Support console output via proxy syscall")
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Reviewed-by: Bin Meng <bmeng@tinylab.org>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Message-Id: <20230721094720.902454-3-thuth@redhat.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 058096f1c55ab688db7e1d6814aaefc1bcd87f7a)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (Mjt: context fix in hw/char/riscv_htif.c for #include)
---
 hw/char/riscv_htif.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/hw/char/riscv_htif.c b/hw/char/riscv_htif.c
index e6e0fa3015..198175e232 100644
--- a/hw/char/riscv_htif.c
+++ b/hw/char/riscv_htif.c
@@ -29,6 +29,7 @@
 #include "chardev/char-fe.h"
 #include "qemu/timer.h"
 #include "qemu/error-report.h"
+#include "exec/tswap.h"
 
 #define RISCV_DEBUG_HTIF 0
 #define HTIF_DEBUG(fmt, ...)                                                   \
@@ -167,11 +168,11 @@ static void htif_handle_tohost_write(HTIFState *s, uint64_t val_written)
             } else {
                 uint64_t syscall[8];
                 cpu_physical_memory_read(payload, syscall, sizeof(syscall));
-                if (syscall[0] == PK_SYS_WRITE &&
-                    syscall[1] == HTIF_DEV_CONSOLE &&
-                    syscall[3] == HTIF_CONSOLE_CMD_PUTC) {
+                if (tswap64(syscall[0]) == PK_SYS_WRITE &&
+                    tswap64(syscall[1]) == HTIF_DEV_CONSOLE &&
+                    tswap64(syscall[3]) == HTIF_CONSOLE_CMD_PUTC) {
                     uint8_t ch;
-                    cpu_physical_memory_read(syscall[2], &ch, 1);
+                    cpu_physical_memory_read(tswap64(syscall[2]), &ch, 1);
                     qemu_chr_fe_write(&s->chr, &ch, 1);
                     resp = 0x100 | (uint8_t)payload;
                 } else {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:54:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:54:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815532.1229464 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn3r-0000lv-BX; Thu, 10 Oct 2024 06:54:11 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815532.1229464; Thu, 10 Oct 2024 06:54:11 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn3r-0000ln-8r; Thu, 10 Oct 2024 06:54:11 +0000
Received: by outflank-mailman (input) for mailman id 815532;
 Thu, 10 Oct 2024 06:54:09 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn3p-0000lS-65
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:54:09 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn3p-0004z9-5L
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:54:09 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn3p-0002q8-4f
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:54:09 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=BHiL5or/MsiqdMm9Ip8gdJJbQWq09VnSDnMKu5cjpaU=; b=APHn3gHWC27Pho7NJY86R/JSZH
	njl4XUbZaSdaZGWgSJQWhJeJ16Yahuz1d2Tri4qFVm/3rZ2qaSrdIgU/bLRoE3jO+lOutgEZ6JjW0
	A232klhqhRXESvgYWzp/JscM2v3XYQ/cwS3YnDWTjp4TxTJ/gBZHyPDnWDNAvRBvmDRM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/intc: Fix upper/lower mtime write calculation
Message-Id: <E1syn3p-0002q8-4f@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:54:09 +0000

commit fd1a0c89c66c9e03b6cc7a1283856bb2112a9bde
Author:     Jason Chien <jason.chien@sifive.com>
AuthorDate: Fri Jul 28 08:24:38 2023 +0000
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    hw/intc: Fix upper/lower mtime write calculation
    
    When writing the upper mtime, we should keep the original lower mtime
    whose value is given by cpu_riscv_read_rtc() instead of
    cpu_riscv_read_rtc_raw(). The same logic applies to writes to lower mtime.
    
    Signed-off-by: Jason Chien <jason.chien@sifive.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Message-ID: <20230728082502.26439-1-jason.chien@sifive.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit e0922b73baf00c4c19d4ad30d09bb94f7ffea0f4)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/intc/riscv_aclint.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/intc/riscv_aclint.c b/hw/intc/riscv_aclint.c
index b466a6abaf..bf77e29a70 100644
--- a/hw/intc/riscv_aclint.c
+++ b/hw/intc/riscv_aclint.c
@@ -208,11 +208,12 @@ static void riscv_aclint_mtimer_write(void *opaque, hwaddr addr,
         return;
     } else if (addr == mtimer->time_base || addr == mtimer->time_base + 4) {
         uint64_t rtc_r = cpu_riscv_read_rtc_raw(mtimer->timebase_freq);
+        uint64_t rtc = cpu_riscv_read_rtc(mtimer);
 
         if (addr == mtimer->time_base) {
             if (size == 4) {
                 /* time_lo for RV32/RV64 */
-                mtimer->time_delta = ((rtc_r & ~0xFFFFFFFFULL) | value) - rtc_r;
+                mtimer->time_delta = ((rtc & ~0xFFFFFFFFULL) | value) - rtc_r;
             } else {
                 /* time for RV64 */
                 mtimer->time_delta = value - rtc_r;
@@ -220,7 +221,7 @@ static void riscv_aclint_mtimer_write(void *opaque, hwaddr addr,
         } else {
             if (size == 4) {
                 /* time_hi for RV32/RV64 */
-                mtimer->time_delta = (value << 32 | (rtc_r & 0xFFFFFFFF)) - rtc_r;
+                mtimer->time_delta = (value << 32 | (rtc & 0xFFFFFFFF)) - rtc_r;
             } else {
                 qemu_log_mask(LOG_GUEST_ERROR,
                               "aclint-mtimer: invalid time_hi write: %08x",
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:54:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:54:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815533.1229468 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn41-0000oH-Cv; Thu, 10 Oct 2024 06:54:21 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815533.1229468; Thu, 10 Oct 2024 06:54:21 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn41-0000o9-AR; Thu, 10 Oct 2024 06:54:21 +0000
Received: by outflank-mailman (input) for mailman id 815533;
 Thu, 10 Oct 2024 06:54:19 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn3z-0000nz-93
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:54:19 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn3z-0004zH-8M
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:54:19 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn3z-0002qu-7Y
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:54:19 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=8V4eDbEQ5a5AbmEncPgc9/UN4BpKyUUqbj+XaOLjSC0=; b=mQLFcIG//Zfk8Xkmmw+HGCIB6g
	ZzPJh0NRD9ccxN8J+be54h567W7j4iiN7lghDUX864bvCIHPZ7eumj2wYcw3EVZW4r1kd3cwyEyn8
	jGaSRe79uvNWEXcnEKeViMSKuA5bF+y6l33l8Bjy5aIHGZfBY88GR0BOaH48uxQYKRw8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/intc: Make rtc variable names consistent
Message-Id: <E1syn3z-0002qu-7Y@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:54:19 +0000

commit c00a9ec0613ca428abaedaf8b7be7b1cbb97d37f
Author:     Jason Chien <jason.chien@sifive.com>
AuthorDate: Fri Jul 28 08:24:39 2023 +0000
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    hw/intc: Make rtc variable names consistent
    
    The variables whose values are given by cpu_riscv_read_rtc() should be named
    "rtc". The variables whose value are given by cpu_riscv_read_rtc_raw()
    should be named "rtc_r".
    
    Signed-off-by: Jason Chien <jason.chien@sifive.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Message-ID: <20230728082502.26439-2-jason.chien@sifive.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 9382a9eafccad8dc6a487ea3a8d2bed03dc35db9)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/intc/riscv_aclint.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/intc/riscv_aclint.c b/hw/intc/riscv_aclint.c
index bf77e29a70..25cf7a5d9d 100644
--- a/hw/intc/riscv_aclint.c
+++ b/hw/intc/riscv_aclint.c
@@ -64,13 +64,13 @@ static void riscv_aclint_mtimer_write_timecmp(RISCVAclintMTimerState *mtimer,
     uint64_t next;
     uint64_t diff;
 
-    uint64_t rtc_r = cpu_riscv_read_rtc(mtimer);
+    uint64_t rtc = cpu_riscv_read_rtc(mtimer);
 
     /* Compute the relative hartid w.r.t the socket */
     hartid = hartid - mtimer->hartid_base;
 
     mtimer->timecmp[hartid] = value;
-    if (mtimer->timecmp[hartid] <= rtc_r) {
+    if (mtimer->timecmp[hartid] <= rtc) {
         /*
          * If we're setting an MTIMECMP value in the "past",
          * immediately raise the timer interrupt
@@ -81,7 +81,7 @@ static void riscv_aclint_mtimer_write_timecmp(RISCVAclintMTimerState *mtimer,
 
     /* otherwise, set up the future timer interrupt */
     qemu_irq_lower(mtimer->timer_irqs[hartid]);
-    diff = mtimer->timecmp[hartid] - rtc_r;
+    diff = mtimer->timecmp[hartid] - rtc;
     /* back to ns (note args switched in muldiv64) */
     uint64_t ns_diff = muldiv64(diff, NANOSECONDS_PER_SECOND, timebase_freq);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:54:31 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:54:31 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815534.1229472 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn4B-0000rK-EU; Thu, 10 Oct 2024 06:54:31 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815534.1229472; Thu, 10 Oct 2024 06:54:31 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn4B-0000rC-Bj; Thu, 10 Oct 2024 06:54:31 +0000
Received: by outflank-mailman (input) for mailman id 815534;
 Thu, 10 Oct 2024 06:54:29 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn49-0000qn-Bv
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:54:29 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn49-0004zT-BF
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:54:29 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn49-0002rb-AV
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:54:29 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=t68vlFtk26rOvJrZe+Bsx4cVBAj81GNFvdppJNuax7I=; b=hZzbV0eW4jdqty7ctoUQ44+R/Z
	okeYaPIWsehBES/okT0jKWDUVk5kdCUn9npzAJOXbjtLsDxSkVGNES4f7RCpn3v5QNhqGUJJdUl1J
	JDL5HmUpmJHpWZ031Tm2x5PiY8hX9TKH67v1XtApOjy/CkbBTHUcH2dpgHxPgwVVh3Dg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] linux-user/riscv: Use abi type for target_ucontext
Message-Id: <E1syn49-0002rb-AV@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:54:29 +0000

commit 9bac2bcf10e25506cc1fc7b69b027399afeb3768
Author:     LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
AuthorDate: Fri Aug 11 13:54:38 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    linux-user/riscv: Use abi type for target_ucontext
    
    We should not use types dependend on host arch for target_ucontext.
    This bug is found when run rv32 applications.
    
    Signed-off-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-ID: <20230811055438.1945-1-zhiwei_liu@linux.alibaba.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit ae7d4d625cab49657b9fc2be09d895afb9bcdaf0)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 linux-user/riscv/signal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/linux-user/riscv/signal.c b/linux-user/riscv/signal.c
index eaa168199a..f989f7f51f 100644
--- a/linux-user/riscv/signal.c
+++ b/linux-user/riscv/signal.c
@@ -38,8 +38,8 @@ struct target_sigcontext {
 }; /* cf. riscv-linux:arch/riscv/include/uapi/asm/ptrace.h */
 
 struct target_ucontext {
-    unsigned long uc_flags;
-    struct target_ucontext *uc_link;
+    abi_ulong uc_flags;
+    abi_ptr uc_link;
     target_stack_t uc_stack;
     target_sigset_t uc_sigmask;
     uint8_t   __unused[1024 / 8 - sizeof(target_sigset_t)];
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:54:41 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:54:41 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815535.1229477 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn4L-0000ud-Fw; Thu, 10 Oct 2024 06:54:41 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815535.1229477; Thu, 10 Oct 2024 06:54:41 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn4L-0000uV-D3; Thu, 10 Oct 2024 06:54:41 +0000
Received: by outflank-mailman (input) for mailman id 815535;
 Thu, 10 Oct 2024 06:54:39 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn4J-0000tQ-El
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:54:39 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn4J-0004zf-E6
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:54:39 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn4J-0002sK-DQ
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:54:39 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=c582kmMOG0f/r5FzSI0RnVS3NSv8geCbjY2U7d5atvw=; b=DIjCoOM8+nw1ty5kLK7b0d7YeL
	AuDDaCzR61ItYmKScaf4KyDEWC2jaRsGWuQ6zrwpDd8eemiXLnZIhEPjT8i3baJLKdmQwQLgxXFa1
	UGI0ZUfU7rQCfuuwVFg2n6fLNS7QttD+cufIX9VeGb9k7jZRgAg5uKas6AbHPpdNbq+U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/riscv: virt: Fix riscv,pmu DT node path
Message-Id: <E1syn4J-0002sK-DQ@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:54:39 +0000

commit e94ea3c6dbd48d70edca6de0079d5690a82ec35b
Author:     Conor Dooley <conor.dooley@microchip.com>
AuthorDate: Thu Jul 27 15:24:17 2023 +0100
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    hw/riscv: virt: Fix riscv,pmu DT node path
    
    On a dtb dumped from the virt machine, dt-validate complains:
    soc: pmu: {'riscv,event-to-mhpmcounters': [[1, 1, 524281], [2, 2, 524284], [65561, 65561, 524280], [65563, 65563, 524280], [65569, 65569, 524280]], 'compatible': ['riscv,pmu']} should not be valid under {'type': 'object'}
            from schema $id: http://devicetree.org/schemas/simple-bus.yaml#
    That's pretty cryptic, but running the dtb back through dtc produces
    something a lot more reasonable:
    Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property
    
    Moving the riscv,pmu node out of the soc bus solves the problem.
    
    Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
    Acked-by: Alistair Francis <alistair.francis@wdc.com>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Message-ID: <20230727-groom-decline-2c57ce42841c@spud>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 9ff31406312500053ecb5f92df01dd9ce52e635d)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/riscv/virt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index 4e3efbee16..be8f0cb26e 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -731,7 +731,7 @@ static void create_fdt_pmu(RISCVVirtState *s)
     MachineState *ms = MACHINE(s);
     RISCVCPU hart = s->soc[0].harts[0];
 
-    pmu_name = g_strdup_printf("/soc/pmu");
+    pmu_name = g_strdup_printf("/pmu");
     qemu_fdt_add_subnode(ms->fdt, pmu_name);
     qemu_fdt_setprop_string(ms->fdt, pmu_name, "compatible", "riscv,pmu");
     riscv_pmu_generate_fdt_node(ms->fdt, hart.cfg.pmu_num, pmu_name);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:54:51 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:54:51 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815536.1229480 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn4V-0000x5-Gy; Thu, 10 Oct 2024 06:54:51 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815536.1229480; Thu, 10 Oct 2024 06:54:51 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn4V-0000wx-EO; Thu, 10 Oct 2024 06:54:51 +0000
Received: by outflank-mailman (input) for mailman id 815536;
 Thu, 10 Oct 2024 06:54:49 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn4T-0000wk-Ik
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:54:49 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn4T-000508-I9
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:54:49 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn4T-0002sw-GI
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:54:49 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VgaFMIlYH4VaCkfxtMiGowCX4R9B1aTvMnWQOE3Rj3s=; b=rGQHTcXac+WNzMN41cN6YY8Yba
	h8ymatFufzdYtwJJWOa3xOtEhVropcSWukgg+mWN8iOchu/GuKfnn7o+8xj7CGsjPlKb9Xlk5vwWD
	7cCnQNUl3NQj5ntABpBqQALeaga474m+Y7sKpfZNBDCEARkQ8DVprrqNpxPedSahpeiE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] target/riscv: fix satp_mode_finalize() when satp_mode.supported = 0
Message-Id: <E1syn4T-0002sw-GI@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:54:49 +0000

commit 1805e05db3c6d92c750427b1c1371f44fa8e4893
Author:     Daniel Henrique Barboza <dbarboza@ventanamicro.com>
AuthorDate: Thu Aug 17 12:29:03 2023 -0300
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    target/riscv: fix satp_mode_finalize() when satp_mode.supported = 0
    
    In the same emulated RISC-V host, the 'host' KVM CPU takes 4 times
    longer to boot than the 'rv64' KVM CPU.
    
    The reason is an unintended behavior of riscv_cpu_satp_mode_finalize()
    when satp_mode.supported = 0, i.e. when cpu_init() does not set
    satp_mode_max_supported(). satp_mode_max_from_map(map) does:
    
    31 - __builtin_clz(map)
    
    This means that, if satp_mode.supported = 0, satp_mode_supported_max
    wil be '31 - 32'. But this is C, so satp_mode_supported_max will gladly
    set it to UINT_MAX (4294967295). After that, if the user didn't set a
    satp_mode, set_satp_mode_default_map(cpu) will make
    
    cfg.satp_mode.map = cfg.satp_mode.supported
    
    So satp_mode.map = 0. And then satp_mode_map_max will be set to
    satp_mode_max_from_map(cpu->cfg.satp_mode.map), i.e. also UINT_MAX. The
    guard "satp_mode_map_max > satp_mode_supported_max" doesn't protect us
    here since both are UINT_MAX.
    
    And finally we have 2 loops:
    
            for (int i = satp_mode_map_max - 1; i >= 0; --i) {
    
    Which are, in fact, 2 loops from UINT_MAX -1 to -1. This is where the
    extra delay when booting the 'host' CPU is coming from.
    
    Commit 43d1de32f8 already set a precedence for satp_mode.supported = 0
    in a different manner. We're doing the same here. If supported == 0,
    interpret as 'the CPU wants the OS to handle satp mode alone' and skip
    satp_mode_finalize().
    
    We'll also put a guard in satp_mode_max_from_map() to assert out if map
    is 0 since the function is not ready to deal with it.
    
    Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
    Fixes: 6f23aaeb9b ("riscv: Allow user to set the satp mode")
    Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
    Message-ID: <20230817152903.694926-1-dbarboza@ventanamicro.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 3a2fc23563885c219c73c8f24318921daf02f3f2)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/riscv/cpu.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index 1e97473af2..8c0721c715 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -282,6 +282,17 @@ static uint8_t satp_mode_from_str(const char *satp_mode_str)
 
 uint8_t satp_mode_max_from_map(uint32_t map)
 {
+    /*
+     * 'map = 0' will make us return (31 - 32), which C will
+     * happily overflow to UINT_MAX. There's no good result to
+     * return if 'map = 0' (e.g. returning 0 will be ambiguous
+     * with the result for 'map = 1').
+     *
+     * Assert out if map = 0. Callers will have to deal with
+     * it outside of this function.
+     */
+    g_assert(map > 0);
+
     /* map here has at least one bit set, so no problem with clz */
     return 31 - __builtin_clz(map);
 }
@@ -1043,9 +1054,15 @@ static void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)
 static void riscv_cpu_satp_mode_finalize(RISCVCPU *cpu, Error **errp)
 {
     bool rv32 = riscv_cpu_mxl(&cpu->env) == MXL_RV32;
-    uint8_t satp_mode_map_max;
-    uint8_t satp_mode_supported_max =
-                        satp_mode_max_from_map(cpu->cfg.satp_mode.supported);
+    uint8_t satp_mode_map_max, satp_mode_supported_max;
+
+    /* The CPU wants the OS to decide which satp mode to use */
+    if (cpu->cfg.satp_mode.supported == 0) {
+        return;
+    }
+
+    satp_mode_supported_max =
+                    satp_mode_max_from_map(cpu->cfg.satp_mode.supported);
 
     if (cpu->cfg.satp_mode.map == 0) {
         if (cpu->cfg.satp_mode.init == 0) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:55:00 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:55:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815537.1229484 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn4e-0000zd-IX; Thu, 10 Oct 2024 06:55:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815537.1229484; Thu, 10 Oct 2024 06:55:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn4e-0000zV-Fj; Thu, 10 Oct 2024 06:55:00 +0000
Received: by outflank-mailman (input) for mailman id 815537;
 Thu, 10 Oct 2024 06:54:59 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn4d-0000zP-Lj
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:54:59 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn4d-00050G-L3
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:54:59 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn4d-0002u0-KN
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:54:59 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Wlw/B+2Hyco6y5izBzPJEOQl/CUSGkzigKY/Saoqsoc=; b=M/VB1BbF5wXNFWjOjgY12VwAst
	ytnBkrFf5K1U5l4HeJsmDUL70gyGf/gLolh6nS/5Owr3gTHNvz2mEmpYgyCisLZmOJWBTx/Sk5UvB
	AiZCEyVP4Z2IXtwCFWRdgLbeRd7J9cMIBdIeNwd9/CGw+AtM3Hd7xi6vJYFwWVkOBMWE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] target/riscv/pmp.c: respect mseccfg.RLB for pmpaddrX changes
Message-Id: <E1syn4d-0002u0-KN@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:54:59 +0000

commit 70c97e75d709eadf80845259ea0a0409475102c3
Author:     Leon Schuermann <leons@opentitan.org>
AuthorDate: Tue Aug 29 17:50:46 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    target/riscv/pmp.c: respect mseccfg.RLB for pmpaddrX changes
    
    When the rule-lock bypass (RLB) bit is set in the mseccfg CSR, the PMP
    configuration lock bits must not apply. While this behavior is
    implemented for the pmpcfgX CSRs, this bit is not respected for
    changes to the pmpaddrX CSRs. This patch ensures that pmpaddrX CSR
    writes work even on locked regions when the global rule-lock bypass is
    enabled.
    
    Signed-off-by: Leon Schuermann <leons@opentitan.org>
    Reviewed-by: Mayuresh Chitale <mchitale@ventanamicro.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Message-ID: <20230829215046.1430463-1-leon@is.currently.online>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 4e3adce1244e1ca30ec05874c3eca14911dc0825)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/riscv/pmp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c
index a08cd95658..bcb4baa0a2 100644
--- a/target/riscv/pmp.c
+++ b/target/riscv/pmp.c
@@ -45,6 +45,10 @@ static inline uint8_t pmp_get_a_field(uint8_t cfg)
  */
 static inline int pmp_is_locked(CPURISCVState *env, uint32_t pmp_index)
 {
+    /* mseccfg.RLB is set */
+    if (MSECCFG_RLB_ISSET(env)) {
+        return 0;
+    }
 
     if (env->pmp_state.pmp[pmp_index].cfg_reg & PMP_LOCK) {
         return 1;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:55:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:55:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815538.1229487 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn4o-00012E-Jk; Thu, 10 Oct 2024 06:55:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815538.1229487; Thu, 10 Oct 2024 06:55:10 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn4o-000126-HC; Thu, 10 Oct 2024 06:55:10 +0000
Received: by outflank-mailman (input) for mailman id 815538;
 Thu, 10 Oct 2024 06:55:09 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn4n-00011w-OT
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:55:09 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn4n-00050u-Np
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:55:09 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn4n-0002vZ-NB
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:55:09 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zto5Tsjc0I0rRal9ln0U95oxBYsoGRqzs1wflmTDLZI=; b=l6S4PwmhQ6yedZ78CWpLAnCo9Z
	FB2OpbDhoLw+HiBAbepOMtL1a3XqePhzEW4Cro3q7eL9wwfdaLFbEdNwBFoIvkbIj5cqP3OI8A3Ug
	aUe7Y1Leg2I6mF7xRvOdEIBSkWkpDo0jUlh1N8SN1Bw+ugRUwCFCEALl1q33iivG/oyA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] hw/tpm: TIS on sysbus: Remove unsupport ppi command line option
Message-Id: <E1syn4n-0002vZ-NB@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:55:09 +0000

commit 36540b367eb80f1d6a646f691e6a2b75bf57ad61
Author:     Stefan Berger <stefanb@linux.ibm.com>
AuthorDate: Thu Jul 13 13:19:55 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    hw/tpm: TIS on sysbus: Remove unsupport ppi command line option
    
    The ppi command line option for the TIS device on sysbus never worked
    and caused an immediate segfault. Remove support for it since it also
    needs support in the firmware and needs testing inside the VM.
    
    Reproducer with the ppi=on option passed:
    
    qemu-system-aarch64 \
       -machine virt,gic-version=3 \
       -m 4G  \
       -nographic -no-acpi \
       -chardev socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
       -tpmdev emulator,id=tpm0,chardev=chrtpm \
       -device tpm-tis-device,tpmdev=tpm0,ppi=on
    [...]
    Segmentation fault (core dumped)
    
    Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
    Reviewed-by: Eric Auger <eric.auger@redhat.com>
    Message-id: 20230713171955.149236-1-stefanb@linux.ibm.com
    (cherry picked from commit 4c46fe2ed492f35f411632c8b5a8442f322bc3f0)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/tpm/tpm_tis_sysbus.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/hw/tpm/tpm_tis_sysbus.c b/hw/tpm/tpm_tis_sysbus.c
index 45e63efd63..6724b3d4f6 100644
--- a/hw/tpm/tpm_tis_sysbus.c
+++ b/hw/tpm/tpm_tis_sysbus.c
@@ -93,7 +93,6 @@ static void tpm_tis_sysbus_reset(DeviceState *dev)
 static Property tpm_tis_sysbus_properties[] = {
     DEFINE_PROP_UINT32("irq", TPMStateSysBus, state.irq_num, TPM_TIS_IRQ),
     DEFINE_PROP_TPMBE("tpmdev", TPMStateSysBus, state.be_driver),
-    DEFINE_PROP_BOOL("ppi", TPMStateSysBus, state.ppi_enabled, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:55:20 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:55:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815539.1229491 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn4y-00015L-MY; Thu, 10 Oct 2024 06:55:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815539.1229491; Thu, 10 Oct 2024 06:55:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn4y-00015D-Jn; Thu, 10 Oct 2024 06:55:20 +0000
Received: by outflank-mailman (input) for mailman id 815539;
 Thu, 10 Oct 2024 06:55:19 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn4x-000156-RM
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:55:19 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn4x-000511-Qi
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:55:19 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn4x-0002wM-Q2
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:55:19 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nQDcbWFaarQ8WI9+q3P/crjcv0T3QXiP3fb7AQny4Q0=; b=tLPp4MYnrHd/APVXsDN0UoqyQ/
	5hZesU+SJbf0N7jy5egwT9yMbWDW2nj4w3PCLAZr0lW56lJnypnahw0dD9fmcR5bzmHKWojqn1GH6
	WQ/CTzhitfWys8uhVmb2rKJpG20a6q8MeuS7hR3XAXy4j21QQ20Ko73oETcq44yzcL7Q=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] ui: fix crash when there are no active_console
Message-Id: <E1syn4x-0002wM-Q2@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:55:19 +0000

commit 6c575436cd3e692079fc3e2fe4f54efe77211549
Author:     Marc-André Lureau <marcandre.lureau@redhat.com>
AuthorDate: Mon Sep 11 18:04:47 2023 +0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    ui: fix crash when there are no active_console
    
    Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
    0x0000555555888630 in dpy_ui_info_supported (con=0x0) at ../ui/console.c:812
    812         return con->hw_ops->ui_info != NULL;
    (gdb) bt
    #0  0x0000555555888630 in dpy_ui_info_supported (con=0x0) at ../ui/console.c:812
    #1  0x00005555558a44b1 in protocol_client_msg (vs=0x5555578c76c0, data=0x5555581e93f0 <incomplete sequence \373>, len=24) at ../ui/vnc.c:2585
    #2  0x00005555558a19ac in vnc_client_read (vs=0x5555578c76c0) at ../ui/vnc.c:1607
    #3  0x00005555558a1ac2 in vnc_client_io (ioc=0x5555581eb0e0, condition=G_IO_IN, opaque=0x5555578c76c0) at ../ui/vnc.c:1635
    
    Fixes:
    https://issues.redhat.com/browse/RHEL-2600
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Reviewed-by: Albert Esteve <aesteve@redhat.com>
    (cherry picked from commit 48a35e12faf90a896c5aa4755812201e00d60316)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 ui/console.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ui/console.c b/ui/console.c
index 7461446e71..a327c9f94a 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1707,6 +1707,9 @@ bool dpy_ui_info_supported(QemuConsole *con)
     if (con == NULL) {
         con = active_console;
     }
+    if (con == NULL) {
+        return false;
+    }
 
     return con->hw_ops->ui_info != NULL;
 }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:55:30 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:55:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815540.1229495 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn58-00018C-Nz; Thu, 10 Oct 2024 06:55:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815540.1229495; Thu, 10 Oct 2024 06:55:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn58-000182-LG; Thu, 10 Oct 2024 06:55:30 +0000
Received: by outflank-mailman (input) for mailman id 815540;
 Thu, 10 Oct 2024 06:55:29 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn57-00017w-U4
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:55:29 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn57-000519-TV
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:55:29 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn57-0002x1-Sr
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:55:29 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Cqeyy7h3jvKv/evrr3+QVDA3FHrXRMhZZvz7hmT+2CA=; b=hd+u8OVFHyFddZZB/a/wTpvPQt
	wwToU30iFouM23Ia2VOYMs2SUOKs//62knxLZ26t4O5RvIcOn+Yc/HTm0ZGQnEyBRWdgyyTSJ4zZY
	LxXFNhEivU3OEIo4YPxXTUEvVeVoUX6A1bDn8FKFKR3B2EzRSpt7GI/4Yh1qxeKvbwJw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] s390x/ap: fix missing subsystem reset registration
Message-Id: <E1syn57-0002x1-Sr@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:55:29 +0000

commit 0ef930a29f432320d979e227a305f927bb15eb09
Author:     Janosch Frank <frankja@linux.ibm.com>
AuthorDate: Wed Aug 23 16:22:15 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    s390x/ap: fix missing subsystem reset registration
    
    A subsystem reset contains a reset of AP resources which has been
    missing.  Adding the AP bridge to the list of device types that need
    reset fixes this issue.
    
    Reviewed-by: Jason J. Herne <jjherne@linux.ibm.com>
    Reviewed-by: Tony Krowiak <akrowiak@linux.ibm.com>
    Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
    Fixes: a51b3153 ("s390x/ap: base Adjunct Processor (AP) object model")
    Message-ID: <20230823142219.1046522-2-seiden@linux.ibm.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 297ec01f0b9864ea8209ca0ddc6643b4c0574bdb)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/s390x/s390-virtio-ccw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 0daf445d60..ea048e4667 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -109,6 +109,7 @@ static const char *const reset_dev_types[] = {
     "s390-flic",
     "diag288",
     TYPE_S390_PCI_HOST_BRIDGE,
+    TYPE_AP_BRIDGE,
 };
 
 static void subsystem_reset(void)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:55:40 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:55:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815541.1229501 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn5I-0001CF-Pl; Thu, 10 Oct 2024 06:55:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815541.1229501; Thu, 10 Oct 2024 06:55:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn5I-0001C7-Mf; Thu, 10 Oct 2024 06:55:40 +0000
Received: by outflank-mailman (input) for mailman id 815541;
 Thu, 10 Oct 2024 06:55:40 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn5I-0001C1-0t
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:55:40 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn5I-00051G-0B
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:55:40 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn5H-0002xi-Vg
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:55:39 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=uiQQ7rzOlSU7t2E8icXGhhbsmRLVCyGOKV0ST/loOtI=; b=paCLot909xNT+DA04et3QkZVvO
	256/QNXZWo0UCbvWm0VyR1ocAP0PJo0Y7Mmu/NnOxOyaju6j6j6n5ML+3T59FFy3PXm7PBFA6hgZs
	miNlR6peZPncgpVXylao92DiKlaK81CI2lxKPXb3h0UwgCaltMQmILiQuDmZEa4KW/fk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] tpm: fix crash when FD >= 1024 and unnecessary errors due to EINTR
Message-Id: <E1syn5H-0002xi-Vg@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:55:39 +0000

commit fcf58d6f20d29ee250f542ac8de968700c957134
Author:     Marc-André Lureau <marcandre.lureau@redhat.com>
AuthorDate: Mon Sep 11 17:25:51 2023 +0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    tpm: fix crash when FD >= 1024 and unnecessary errors due to EINTR
    
    Replace select() with poll() to fix a crash when QEMU has a large number
    of FDs. Also use RETRY_ON_EINTR to avoid unnecessary errors due to EINTR.
    
    Cc: qemu-stable@nongnu.org
    Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2020133
    Fixes: 56a3c24ffc ("tpm: Probe for connected TPM 1.2 or TPM 2")
    Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
    Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
    Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
    (cherry picked from commit 8e32ddff69b6b4547cc00592ad816484e160817a)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 backends/tpm/tpm_util.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/backends/tpm/tpm_util.c b/backends/tpm/tpm_util.c
index a6e6d3e72f..1856589c3b 100644
--- a/backends/tpm/tpm_util.c
+++ b/backends/tpm/tpm_util.c
@@ -112,12 +112,8 @@ static int tpm_util_request(int fd,
                             void *response,
                             size_t responselen)
 {
-    fd_set readfds;
+    GPollFD fds[1] = { {.fd = fd, .events = G_IO_IN } };
     int n;
-    struct timeval tv = {
-        .tv_sec = 1,
-        .tv_usec = 0,
-    };
 
     n = write(fd, request, requestlen);
     if (n < 0) {
@@ -127,11 +123,8 @@ static int tpm_util_request(int fd,
         return -EFAULT;
     }
 
-    FD_ZERO(&readfds);
-    FD_SET(fd, &readfds);
-
     /* wait for a second */
-    n = select(fd + 1, &readfds, NULL, NULL, &tv);
+    n = RETRY_ON_EINTR(g_poll(fds, 1, 1000));
     if (n != 1) {
         return -errno;
     }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:55:50 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:55:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815542.1229504 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn5S-0001Eu-Qs; Thu, 10 Oct 2024 06:55:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815542.1229504; Thu, 10 Oct 2024 06:55:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn5S-0001En-OC; Thu, 10 Oct 2024 06:55:50 +0000
Received: by outflank-mailman (input) for mailman id 815542;
 Thu, 10 Oct 2024 06:55:50 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn5S-0001Ec-3m
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:55:50 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn5S-00051h-38
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:55:50 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn5S-000300-2L
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:55:50 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bvS8bV6ubZyIvXrppYoL9jqcV6xJNVx9oXy6M//cxoE=; b=iHNP7DpB1CTD2Sb2GDt/dsy/hr
	ImtOePGpXpWAFXO3FmF1hNpiZ0qjxUosLLMHDv23npAQnKQ0b9Gou69LeQhm2cXVqfJPL12NAwztw
	hb4K2a3yr9KZ4jW8iucIfB5tRTK7E0ciOCOp6ly1Avqrv7QMQl7IRDBvVf141/Pn1HxI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] Update version for 8.0.5 release
Message-Id: <E1syn5S-000300-2L@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:55:50 +0000

commit 6bbce8b464206e6622216b62841cb3e953d56eb8
Author:     Michael Tokarev <mjt@tls.msk.ru>
AuthorDate: Thu Sep 21 19:23:20 2023 +0300
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Thu Sep 21 19:23:20 2023 +0300

    Update version for 8.0.5 release
    
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 VERSION | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/VERSION b/VERSION
index 50c496d20c..904be6d4e4 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-8.0.4
+8.0.5
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 06:56:00 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 06:56:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815543.1229509 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn5c-0001Hh-Sq; Thu, 10 Oct 2024 06:56:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815543.1229509; Thu, 10 Oct 2024 06:56:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syn5c-0001HZ-Pv; Thu, 10 Oct 2024 06:56:00 +0000
Received: by outflank-mailman (input) for mailman id 815543;
 Thu, 10 Oct 2024 06:56:00 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn5c-0001HT-77
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:56:00 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn5c-00051o-6H
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:56:00 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syn5c-00030g-5U
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 06:56:00 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=qoxzbCCCjJkXblT/zaP+pkGd28C+aRxbwhxDsX+18w0=; b=xlhjSZ18+YjaD63bLUGorHJu8T
	yjvBTaw8j5RDrIHb9Jj8WjHWuUzBkZ5+wlB/lP2u8rF6lNW6XrckE2apqhKLSTuyz29bmZGkTU5n6
	1pUa90HQl+P+CjerkTynvTyhJAFklLJ9YPffK6LQG4CN50Gv1uazh4vPLrDqADf3zKoA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.18] Merge tag 'v8.0.5' into 'staging-4.18'
Message-Id: <E1syn5c-00030g-5U@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 06:56:00 +0000

commit bdf719c4c535cf14ec4fe8e9cb7a798a5a73fb23
Merge: 6bbce8b464206e6622216b62841cb3e953d56eb8 0df9387c8983e1b1e72d8c574356f572342c03e6
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Wed Oct 9 11:40:12 2024 +0200
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Wed Oct 9 11:40:12 2024 +0200

    Merge tag 'v8.0.5' into 'staging-4.18'

--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.18


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:11:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815691.1229682 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoGF-0002X8-Ip; Thu, 10 Oct 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 815691.1229682; Thu, 10 Oct 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 1syoGF-0002X0-G6; Thu, 10 Oct 2024 08:11:03 +0000
Received: by outflank-mailman (input) for mailman id 815691;
 Thu, 10 Oct 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 1syoGE-0002Wr-Kk
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 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 1syoGE-0006rh-JZ
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 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 1syoGE-0004Ey-IC
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 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=kCGVJK4ickQJCT0MMh13XnTfSdyFIPgH/VrnbeWEf0Q=; b=6KP5XLKo4vqcsk/h0Dg2NOkwH9
	howCuNio6vc5phIh7RWo4c5tCpYPG60Orkxk9m2CnbRqcDw5O5VOTsNx7BMTOu/rBdE5EicrFqpAt
	l1NPGeH5yVYGosRQc4IfWsJ15XXWqGrgVV+Z+s9yMQHTmjPRXoDFBlYXiJsMC9Zyc7TQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] memory: prevent dma-reentracy issues
Message-Id: <E1syoGE-0004Ey-IC@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:11:02 +0000

commit a08c78dda7e018fbbe33bc7979f7a53f89a488b5
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:06 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:01:33 2023 +0300

    memory: prevent dma-reentracy issues
    
    Add a flag to the DeviceState, when a device is engaged in PIO/MMIO/DMA.
    This flag is set/checked prior to calling a device's MemoryRegion
    handlers, and set when device code initiates DMA.  The purpose of this
    flag is to prevent two types of DMA-based reentrancy issues:
    
    1.) mmio -> dma -> mmio case
    2.) bh -> dma write -> mmio case
    
    These issues have led to problems such as stack-exhaustion and
    use-after-frees.
    
    Summary of the problem from Peter Maydell:
    https://lore.kernel.org/qemu-devel/CAFEAcA_23vc7hE3iaM-JVA6W38LK4hJoWae5KcknhPRD5fPBZA@mail.gmail.com
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/62
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/540
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/541
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/556
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/557
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/827
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1282
    Resolves: CVE-2023-0330
    
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Message-Id: <20230427211013.2994127-2-alxndr@bu.edu>
    [thuth: Replace warn_report() with warn_report_once()]
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit a2e1753b8054344f32cf94f31c6399a58794a380)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 include/exec/memory.h  |  5 +++++
 include/hw/qdev-core.h |  7 +++++++
 softmmu/memory.c       | 16 ++++++++++++++++
 3 files changed, 28 insertions(+)

diff --git a/include/exec/memory.h b/include/exec/memory.h
index 15ade918ba..e45ce6061f 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -767,6 +767,8 @@ struct MemoryRegion {
     bool is_iommu;
     RAMBlock *ram_block;
     Object *owner;
+    /* owner as TYPE_DEVICE. Used for re-entrancy checks in MR access hotpath */
+    DeviceState *dev;
 
     const MemoryRegionOps *ops;
     void *opaque;
@@ -791,6 +793,9 @@ struct MemoryRegion {
     unsigned ioeventfd_nb;
     MemoryRegionIoeventfd *ioeventfds;
     RamDiscardManager *rdm; /* Only for RAM */
+
+    /* For devices designed to perform re-entrant IO into their own IO MRs */
+    bool disable_reentrancy_guard;
 };
 
 struct IOMMUMemoryRegion {
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index bd50ad5ee1..7623703943 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -162,6 +162,10 @@ struct NamedClockList {
     QLIST_ENTRY(NamedClockList) node;
 };
 
+typedef struct {
+    bool engaged_in_io;
+} MemReentrancyGuard;
+
 /**
  * DeviceState:
  * @realized: Indicates whether the device has been fully constructed.
@@ -194,6 +198,9 @@ struct DeviceState {
     int alias_required_for_version;
     ResettableState reset;
     GSList *unplug_blockers;
+
+    /* Is the device currently in mmio/pio/dma? Used to prevent re-entrancy */
+    MemReentrancyGuard mem_reentrancy_guard;
 };
 
 struct DeviceListener {
diff --git a/softmmu/memory.c b/softmmu/memory.c
index b1a6cae6f5..b7b3386e9d 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -542,6 +542,18 @@ static MemTxResult access_with_adjusted_size(hwaddr addr,
         access_size_max = 4;
     }
 
+    /* Do not allow more than one simultaneous access to a device's IO Regions */
+    if (mr->dev && !mr->disable_reentrancy_guard &&
+        !mr->ram_device && !mr->ram && !mr->rom_device && !mr->readonly) {
+        if (mr->dev->mem_reentrancy_guard.engaged_in_io) {
+            warn_report_once("Blocked re-entrant IO on MemoryRegion: "
+                             "%s at addr: 0x%" HWADDR_PRIX,
+                             memory_region_name(mr), addr);
+            return MEMTX_ACCESS_ERROR;
+        }
+        mr->dev->mem_reentrancy_guard.engaged_in_io = true;
+    }
+
     /* FIXME: support unaligned access? */
     access_size = MAX(MIN(size, access_size_max), access_size_min);
     access_mask = MAKE_64BIT_MASK(0, access_size * 8);
@@ -556,6 +568,9 @@ static MemTxResult access_with_adjusted_size(hwaddr addr,
                         access_mask, attrs);
         }
     }
+    if (mr->dev) {
+        mr->dev->mem_reentrancy_guard.engaged_in_io = false;
+    }
     return r;
 }
 
@@ -1170,6 +1185,7 @@ static void memory_region_do_init(MemoryRegion *mr,
     }
     mr->name = g_strdup(name);
     mr->owner = owner;
+    mr->dev = (DeviceState *) object_dynamic_cast(mr->owner, TYPE_DEVICE);
     mr->ram_block = NULL;
 
     if (name) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:11:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815693.1229685 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoGP-0002ZW-K2; Thu, 10 Oct 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 815693.1229685; Thu, 10 Oct 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 1syoGP-0002ZP-HZ; Thu, 10 Oct 2024 08:11:13 +0000
Received: by outflank-mailman (input) for mailman id 815693;
 Thu, 10 Oct 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 1syoGO-0002ZB-Nl
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 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 1syoGO-0006ro-N2
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 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 1syoGO-0004Fr-M1
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 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=mkYb87FaBM/oCN3I3hlX1exi08bG/IoRqSq7r68m00I=; b=7EdqhLjwVBAaa337HWuksjVuvd
	KS/TjgMd9rCznR2pfJyUF9gR2r6rTbie6wJCpvoyB6m80cjseNb8UnQJuscG0HxIQE0vRWEm+1/E0
	RvkCkADFQdq7oKAavRJ3UfG4smYbs7sgKmIBmkTm01tuTFK+u4l+OiZzlklfoCSyJn5c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] async: Add an optional reentrancy guard to the BH API
Message-Id: <E1syoGO-0004Fr-M1@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:11:12 +0000

commit 932cf49f0620544d1fb37f1d8dd02219a3636ee9
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:07 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:01:33 2023 +0300

    async: Add an optional reentrancy guard to the BH API
    
    Devices can pass their MemoryReentrancyGuard (from their DeviceState),
    when creating new BHes. Then, the async API will toggle the guard
    before/after calling the BH call-back. This prevents bh->mmio reentrancy
    issues.
    
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Message-Id: <20230427211013.2994127-3-alxndr@bu.edu>
    [thuth: Fix "line over 90 characters" checkpatch.pl error]
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 9c86c97f12c060bf7484dd931f38634e166a81f0)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 docs/devel/multiple-iothreads.txt |  7 +++++++
 include/block/aio.h               | 18 ++++++++++++++++--
 include/qemu/main-loop.h          |  7 +++++--
 tests/unit/ptimer-test-stubs.c    |  3 ++-
 util/async.c                      | 18 +++++++++++++++++-
 util/main-loop.c                  |  6 ++++--
 util/trace-events                 |  1 +
 7 files changed, 52 insertions(+), 8 deletions(-)

diff --git a/docs/devel/multiple-iothreads.txt b/docs/devel/multiple-iothreads.txt
index 343120f2ef..a3e949f6b3 100644
--- a/docs/devel/multiple-iothreads.txt
+++ b/docs/devel/multiple-iothreads.txt
@@ -61,6 +61,7 @@ There are several old APIs that use the main loop AioContext:
  * LEGACY qemu_aio_set_event_notifier() - monitor an event notifier
  * LEGACY timer_new_ms() - create a timer
  * LEGACY qemu_bh_new() - create a BH
+ * LEGACY qemu_bh_new_guarded() - create a BH with a device re-entrancy guard
  * LEGACY qemu_aio_wait() - run an event loop iteration
 
 Since they implicitly work on the main loop they cannot be used in code that
@@ -72,8 +73,14 @@ Instead, use the AioContext functions directly (see include/block/aio.h):
  * aio_set_event_notifier() - monitor an event notifier
  * aio_timer_new() - create a timer
  * aio_bh_new() - create a BH
+ * aio_bh_new_guarded() - create a BH with a device re-entrancy guard
  * aio_poll() - run an event loop iteration
 
+The qemu_bh_new_guarded/aio_bh_new_guarded APIs accept a "MemReentrancyGuard"
+argument, which is used to check for and prevent re-entrancy problems. For
+BHs associated with devices, the reentrancy-guard is contained in the
+corresponding DeviceState and named "mem_reentrancy_guard".
+
 The AioContext can be obtained from the IOThread using
 iothread_get_aio_context() or for the main loop using qemu_get_aio_context().
 Code that takes an AioContext argument works both in IOThreads or the main
diff --git a/include/block/aio.h b/include/block/aio.h
index 543717f294..db6f23c619 100644
--- a/include/block/aio.h
+++ b/include/block/aio.h
@@ -23,6 +23,8 @@
 #include "qemu/thread.h"
 #include "qemu/timer.h"
 #include "block/graph-lock.h"
+#include "hw/qdev-core.h"
+
 
 typedef struct BlockAIOCB BlockAIOCB;
 typedef void BlockCompletionFunc(void *opaque, int ret);
@@ -331,9 +333,11 @@ void aio_bh_schedule_oneshot_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
  * is opaque and must be allocated prior to its use.
  *
  * @name: A human-readable identifier for debugging purposes.
+ * @reentrancy_guard: A guard set when entering a cb to prevent
+ * device-reentrancy issues
  */
 QEMUBH *aio_bh_new_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
-                        const char *name);
+                        const char *name, MemReentrancyGuard *reentrancy_guard);
 
 /**
  * aio_bh_new: Allocate a new bottom half structure
@@ -342,7 +346,17 @@ QEMUBH *aio_bh_new_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
  * string.
  */
 #define aio_bh_new(ctx, cb, opaque) \
-    aio_bh_new_full((ctx), (cb), (opaque), (stringify(cb)))
+    aio_bh_new_full((ctx), (cb), (opaque), (stringify(cb)), NULL)
+
+/**
+ * aio_bh_new_guarded: Allocate a new bottom half structure with a
+ * reentrancy_guard
+ *
+ * A convenience wrapper for aio_bh_new_full() that uses the cb as the name
+ * string.
+ */
+#define aio_bh_new_guarded(ctx, cb, opaque, guard) \
+    aio_bh_new_full((ctx), (cb), (opaque), (stringify(cb)), guard)
 
 /**
  * aio_notify: Force processing of pending events.
diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h
index b3e54e00bc..68e70e61aa 100644
--- a/include/qemu/main-loop.h
+++ b/include/qemu/main-loop.h
@@ -387,9 +387,12 @@ void qemu_cond_timedwait_iothread(QemuCond *cond, int ms);
 
 /* internal interfaces */
 
+#define qemu_bh_new_guarded(cb, opaque, guard) \
+    qemu_bh_new_full((cb), (opaque), (stringify(cb)), guard)
 #define qemu_bh_new(cb, opaque) \
-    qemu_bh_new_full((cb), (opaque), (stringify(cb)))
-QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name);
+    qemu_bh_new_full((cb), (opaque), (stringify(cb)), NULL)
+QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name,
+                         MemReentrancyGuard *reentrancy_guard);
 void qemu_bh_schedule_idle(QEMUBH *bh);
 
 enum {
diff --git a/tests/unit/ptimer-test-stubs.c b/tests/unit/ptimer-test-stubs.c
index f2bfcede93..8c9407c560 100644
--- a/tests/unit/ptimer-test-stubs.c
+++ b/tests/unit/ptimer-test-stubs.c
@@ -107,7 +107,8 @@ int64_t qemu_clock_deadline_ns_all(QEMUClockType type, int attr_mask)
     return deadline;
 }
 
-QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name)
+QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name,
+                         MemReentrancyGuard *reentrancy_guard)
 {
     QEMUBH *bh = g_new(QEMUBH, 1);
 
diff --git a/util/async.c b/util/async.c
index 856e1a8a33..9df7674b4e 100644
--- a/util/async.c
+++ b/util/async.c
@@ -65,6 +65,7 @@ struct QEMUBH {
     void *opaque;
     QSLIST_ENTRY(QEMUBH) next;
     unsigned flags;
+    MemReentrancyGuard *reentrancy_guard;
 };
 
 /* Called concurrently from any thread */
@@ -137,7 +138,7 @@ void aio_bh_schedule_oneshot_full(AioContext *ctx, QEMUBHFunc *cb,
 }
 
 QEMUBH *aio_bh_new_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
-                        const char *name)
+                        const char *name, MemReentrancyGuard *reentrancy_guard)
 {
     QEMUBH *bh;
     bh = g_new(QEMUBH, 1);
@@ -146,13 +147,28 @@ QEMUBH *aio_bh_new_full(AioContext *ctx, QEMUBHFunc *cb, void *opaque,
         .cb = cb,
         .opaque = opaque,
         .name = name,
+        .reentrancy_guard = reentrancy_guard,
     };
     return bh;
 }
 
 void aio_bh_call(QEMUBH *bh)
 {
+    bool last_engaged_in_io = false;
+
+    if (bh->reentrancy_guard) {
+        last_engaged_in_io = bh->reentrancy_guard->engaged_in_io;
+        if (bh->reentrancy_guard->engaged_in_io) {
+            trace_reentrant_aio(bh->ctx, bh->name);
+        }
+        bh->reentrancy_guard->engaged_in_io = true;
+    }
+
     bh->cb(bh->opaque);
+
+    if (bh->reentrancy_guard) {
+        bh->reentrancy_guard->engaged_in_io = last_engaged_in_io;
+    }
 }
 
 /* Multiple occurrences of aio_bh_poll cannot be called concurrently. */
diff --git a/util/main-loop.c b/util/main-loop.c
index e180c85145..7022f02ef8 100644
--- a/util/main-loop.c
+++ b/util/main-loop.c
@@ -605,9 +605,11 @@ void main_loop_wait(int nonblocking)
 
 /* Functions to operate on the main QEMU AioContext.  */
 
-QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name)
+QEMUBH *qemu_bh_new_full(QEMUBHFunc *cb, void *opaque, const char *name,
+                         MemReentrancyGuard *reentrancy_guard)
 {
-    return aio_bh_new_full(qemu_aio_context, cb, opaque, name);
+    return aio_bh_new_full(qemu_aio_context, cb, opaque, name,
+                           reentrancy_guard);
 }
 
 /*
diff --git a/util/trace-events b/util/trace-events
index 16f78d8fe5..3f7e766683 100644
--- a/util/trace-events
+++ b/util/trace-events
@@ -11,6 +11,7 @@ poll_remove(void *ctx, void *node, int fd) "ctx %p node %p fd %d"
 # async.c
 aio_co_schedule(void *ctx, void *co) "ctx %p co %p"
 aio_co_schedule_bh_cb(void *ctx, void *co) "ctx %p co %p"
+reentrant_aio(void *ctx, const char *name) "ctx %p name %s"
 
 # thread-pool.c
 thread_pool_submit(void *pool, void *req, void *opaque) "pool %p req %p opaque %p"
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:11:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815696.1229690 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoGZ-0002dY-NB; Thu, 10 Oct 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 815696.1229690; Thu, 10 Oct 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 1syoGZ-0002dQ-KN; Thu, 10 Oct 2024 08:11:23 +0000
Received: by outflank-mailman (input) for mailman id 815696;
 Thu, 10 Oct 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 1syoGY-0002dE-Qz
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 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 1syoGY-0006s8-QJ
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 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 1syoGY-0004H7-PI
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 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=yTB+rCvtpwO093TSjONjmwFIfHhPyxDv3IG4eCBhZV8=; b=6+HMPSf62PDm/Buz6H28Q02z1X
	Iiv0165J+unn9ahI9PAg4Pw5+oSNjkLe2lAP1cFIe5BjRaj2s7iCGVyTDlgSLWa2wkY+kfNWocYKe
	DI86W2wq8rzeHdb98CBWBAwAM1go0DsHxOdxx6cOtPoILvT6lu1NXGNMfDVPpSWoBCzk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] async: avoid use-after-free on re-entrancy guard
Message-Id: <E1syoGY-0004H7-PI@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:11:22 +0000

commit 6a33d4b3453b46ee3fd432d80374f45919985b00
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Mon May 1 10:19:56 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    async: avoid use-after-free on re-entrancy guard
    
    A BH callback can free the BH, causing a use-after-free in aio_bh_call.
    Fix that by keeping a local copy of the re-entrancy guard pointer.
    
    Buglink: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58513
    Fixes: 9c86c97f12 ("async: Add an optional reentrancy guard to the BH API")
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Message-Id: <20230501141956.3444868-1-alxndr@bu.edu>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 7915bd06f25e1803778081161bf6fa10c42dc7cd)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 util/async.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/util/async.c b/util/async.c
index 9df7674b4e..055070ffbd 100644
--- a/util/async.c
+++ b/util/async.c
@@ -156,18 +156,20 @@ void aio_bh_call(QEMUBH *bh)
 {
     bool last_engaged_in_io = false;
 
-    if (bh->reentrancy_guard) {
-        last_engaged_in_io = bh->reentrancy_guard->engaged_in_io;
-        if (bh->reentrancy_guard->engaged_in_io) {
+    /* Make a copy of the guard-pointer as cb may free the bh */
+    MemReentrancyGuard *reentrancy_guard = bh->reentrancy_guard;
+    if (reentrancy_guard) {
+        last_engaged_in_io = reentrancy_guard->engaged_in_io;
+        if (reentrancy_guard->engaged_in_io) {
             trace_reentrant_aio(bh->ctx, bh->name);
         }
-        bh->reentrancy_guard->engaged_in_io = true;
+        reentrancy_guard->engaged_in_io = true;
     }
 
     bh->cb(bh->opaque);
 
-    if (bh->reentrancy_guard) {
-        bh->reentrancy_guard->engaged_in_io = last_engaged_in_io;
+    if (reentrancy_guard) {
+        reentrancy_guard->engaged_in_io = last_engaged_in_io;
     }
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:11:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815699.1229694 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoGj-0002gN-OI; Thu, 10 Oct 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 815699.1229694; Thu, 10 Oct 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 1syoGj-0002gF-Ll; Thu, 10 Oct 2024 08:11:33 +0000
Received: by outflank-mailman (input) for mailman id 815699;
 Thu, 10 Oct 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 1syoGi-0002g5-UF
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 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 1syoGi-0006sF-TZ
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 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 1syoGi-0004Hn-Sb
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 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=DsA26CMxxjRUolG0LZThBBQesd3kPxDdZ3aM3oDmrMM=; b=06mem82X0AJbnltI0NL1Q7YtZn
	94lXXBJHKU1mf+ifG1jTpTu3TVWuH+wcZofcc4xTXGfA6zMaIDpRUfjlvtHXaXrqZPXyZ60MSgpEb
	fzMAVABkJsZpVHCwItAMYwzVhMRmmdcZPBiEWugJKLO41Sqm5/Lz3OBWxftWNXwwV8SE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] checkpatch: add qemu_bh_new/aio_bh_new checks
Message-Id: <E1syoGi-0004Hn-Sb@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:11:32 +0000

commit db56206f785909aa830e2a19336bb12abca50e82
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:08 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    checkpatch: add qemu_bh_new/aio_bh_new checks
    
    Advise authors to use the _guarded versions of the APIs, instead.
    
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Message-Id: <20230427211013.2994127-4-alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit ef56ffbdd6b0605dc1e305611287b948c970e236)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 scripts/checkpatch.pl | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index d768171dcf..eeaec436eb 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2865,6 +2865,14 @@ sub process {
 		if ($line =~ /\bsignal\s*\(/ && !($line =~ /SIG_(?:IGN|DFL)/)) {
 			ERROR("use sigaction to establish signal handlers; signal is not portable\n" . $herecurr);
 		}
+# recommend qemu_bh_new_guarded instead of qemu_bh_new
+        if ($realfile =~ /.*\/hw\/.*/ && $line =~ /\bqemu_bh_new\s*\(/) {
+			ERROR("use qemu_bh_new_guarded() instead of qemu_bh_new() to avoid reentrancy problems\n" . $herecurr);
+		}
+# recommend aio_bh_new_guarded instead of aio_bh_new
+        if ($realfile =~ /.*\/hw\/.*/ && $line =~ /\baio_bh_new\s*\(/) {
+			ERROR("use aio_bh_new_guarded() instead of aio_bh_new() to avoid reentrancy problems\n" . $herecurr);
+		}
 # check for module_init(), use category-specific init macros explicitly please
 		if ($line =~ /^module_init\s*\(/) {
 			ERROR("please use block_init(), type_init() etc. instead of module_init()\n" . $herecurr);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:11:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815700.1229698 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoGt-0002jM-Pr; Thu, 10 Oct 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 815700.1229698; Thu, 10 Oct 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 1syoGt-0002jE-N9; Thu, 10 Oct 2024 08:11:43 +0000
Received: by outflank-mailman (input) for mailman id 815700;
 Thu, 10 Oct 2024 08:11: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 1syoGt-0002j0-2J
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:11: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 1syoGt-0006sM-1e
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:11:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoGt-0004J1-0n
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:11: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=9hjoKyFbMB0rZY0jX0rWBATKW26oe/GKpzDok2wSCws=; b=vOVW1BQtogRzJIvLDYvKb/5iF8
	OdpD98wj4FWpIY8R2ExmZsJJROGbz1v1w2eEYnzJcrUsTadX+QO+DqGTp5ZOuL4ouL7osHe0HhJFh
	tAj0f2MujamxVExuD3r1SUdFinb5KV2FjQ/b5t70oxeY7xrctLU6ETxtuiys0MC7dhYo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw: replace most qemu_bh_new calls with qemu_bh_new_guarded
Message-Id: <E1syoGt-0004J1-0n@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:11:43 +0000

commit fd9de51ea3f109d427bced84d80815a97bb7faa0
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:09 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    hw: replace most qemu_bh_new calls with qemu_bh_new_guarded
    
    This protects devices from bh->mmio reentrancy issues.
    
    Thanks: Thomas Huth <thuth@redhat.com> for diagnosing OS X test failure.
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Reviewed-by: Paul Durrant <paul@xen.org>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Message-Id: <20230427211013.2994127-5-alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit f63192b0544af5d3e4d5edfd85ab520fcf671377)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/9pfs/xen-9p-backend.c        | 5 ++++-
 hw/block/dataplane/virtio-blk.c | 3 ++-
 hw/block/dataplane/xen-block.c  | 5 +++--
 hw/char/virtio-serial-bus.c     | 3 ++-
 hw/display/qxl.c                | 9 ++++++---
 hw/display/virtio-gpu.c         | 6 ++++--
 hw/ide/ahci.c                   | 3 ++-
 hw/ide/ahci_internal.h          | 1 +
 hw/ide/core.c                   | 4 +++-
 hw/misc/imx_rngc.c              | 6 ++++--
 hw/misc/macio/mac_dbdma.c       | 2 +-
 hw/net/virtio-net.c             | 3 ++-
 hw/nvme/ctrl.c                  | 6 ++++--
 hw/scsi/mptsas.c                | 3 ++-
 hw/scsi/scsi-bus.c              | 3 ++-
 hw/scsi/vmw_pvscsi.c            | 3 ++-
 hw/usb/dev-uas.c                | 3 ++-
 hw/usb/hcd-dwc2.c               | 3 ++-
 hw/usb/hcd-ehci.c               | 3 ++-
 hw/usb/hcd-uhci.c               | 2 +-
 hw/usb/host-libusb.c            | 6 ++++--
 hw/usb/redirect.c               | 6 ++++--
 hw/usb/xen-usb.c                | 3 ++-
 hw/virtio/virtio-balloon.c      | 5 +++--
 hw/virtio/virtio-crypto.c       | 3 ++-
 25 files changed, 66 insertions(+), 33 deletions(-)

diff --git a/hw/9pfs/xen-9p-backend.c b/hw/9pfs/xen-9p-backend.c
index 382be1ab11..4aa9c8c736 100644
--- a/hw/9pfs/xen-9p-backend.c
+++ b/hw/9pfs/xen-9p-backend.c
@@ -63,6 +63,7 @@ typedef struct Xen9pfsDev {
 
     int num_rings;
     Xen9pfsRing *rings;
+    MemReentrancyGuard mem_reentrancy_guard;
 } Xen9pfsDev;
 
 static void xen_9pfs_disconnect(struct XenLegacyDevice *xendev);
@@ -450,7 +451,9 @@ static int xen_9pfs_connect(struct XenLegacyDevice *xendev)
         xen_9pdev->rings[i].ring.out = xen_9pdev->rings[i].data +
                                        XEN_FLEX_RING_SIZE(ring_order);
 
-        xen_9pdev->rings[i].bh = qemu_bh_new(xen_9pfs_bh, &xen_9pdev->rings[i]);
+        xen_9pdev->rings[i].bh = qemu_bh_new_guarded(xen_9pfs_bh,
+                                                     &xen_9pdev->rings[i],
+                                                     &xen_9pdev->mem_reentrancy_guard);
         xen_9pdev->rings[i].out_cons = 0;
         xen_9pdev->rings[i].out_size = 0;
         xen_9pdev->rings[i].inprogress = false;
diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c
index b28d81737e..a6202997ee 100644
--- a/hw/block/dataplane/virtio-blk.c
+++ b/hw/block/dataplane/virtio-blk.c
@@ -127,7 +127,8 @@ bool virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *conf,
     } else {
         s->ctx = qemu_get_aio_context();
     }
-    s->bh = aio_bh_new(s->ctx, notify_guest_bh, s);
+    s->bh = aio_bh_new_guarded(s->ctx, notify_guest_bh, s,
+                               &DEVICE(vdev)->mem_reentrancy_guard);
     s->batch_notify_vqs = bitmap_new(conf->num_queues);
 
     *dataplane = s;
diff --git a/hw/block/dataplane/xen-block.c b/hw/block/dataplane/xen-block.c
index 734da42ea7..d8bc39d359 100644
--- a/hw/block/dataplane/xen-block.c
+++ b/hw/block/dataplane/xen-block.c
@@ -633,8 +633,9 @@ XenBlockDataPlane *xen_block_dataplane_create(XenDevice *xendev,
     } else {
         dataplane->ctx = qemu_get_aio_context();
     }
-    dataplane->bh = aio_bh_new(dataplane->ctx, xen_block_dataplane_bh,
-                               dataplane);
+    dataplane->bh = aio_bh_new_guarded(dataplane->ctx, xen_block_dataplane_bh,
+                                       dataplane,
+                                       &DEVICE(xendev)->mem_reentrancy_guard);
 
     return dataplane;
 }
diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
index 7d4601cb5d..dd619f0731 100644
--- a/hw/char/virtio-serial-bus.c
+++ b/hw/char/virtio-serial-bus.c
@@ -985,7 +985,8 @@ static void virtser_port_device_realize(DeviceState *dev, Error **errp)
         return;
     }
 
-    port->bh = qemu_bh_new(flush_queued_data_bh, port);
+    port->bh = qemu_bh_new_guarded(flush_queued_data_bh, port,
+                                   &dev->mem_reentrancy_guard);
     port->elem = NULL;
 }
 
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 80ce1e9a93..f1c0eb7dfc 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -2201,11 +2201,14 @@ static void qxl_realize_common(PCIQXLDevice *qxl, Error **errp)
 
     qemu_add_vm_change_state_handler(qxl_vm_change_state_handler, qxl);
 
-    qxl->update_irq = qemu_bh_new(qxl_update_irq_bh, qxl);
+    qxl->update_irq = qemu_bh_new_guarded(qxl_update_irq_bh, qxl,
+                                          &DEVICE(qxl)->mem_reentrancy_guard);
     qxl_reset_state(qxl);
 
-    qxl->update_area_bh = qemu_bh_new(qxl_render_update_area_bh, qxl);
-    qxl->ssd.cursor_bh = qemu_bh_new(qemu_spice_cursor_refresh_bh, &qxl->ssd);
+    qxl->update_area_bh = qemu_bh_new_guarded(qxl_render_update_area_bh, qxl,
+                                              &DEVICE(qxl)->mem_reentrancy_guard);
+    qxl->ssd.cursor_bh = qemu_bh_new_guarded(qemu_spice_cursor_refresh_bh, &qxl->ssd,
+                                             &DEVICE(qxl)->mem_reentrancy_guard);
 }
 
 static void qxl_realize_primary(PCIDevice *dev, Error **errp)
diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 4e2e0dd53a..7c13b056b9 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -1356,8 +1356,10 @@ void virtio_gpu_device_realize(DeviceState *qdev, Error **errp)
 
     g->ctrl_vq = virtio_get_queue(vdev, 0);
     g->cursor_vq = virtio_get_queue(vdev, 1);
-    g->ctrl_bh = qemu_bh_new(virtio_gpu_ctrl_bh, g);
-    g->cursor_bh = qemu_bh_new(virtio_gpu_cursor_bh, g);
+    g->ctrl_bh = qemu_bh_new_guarded(virtio_gpu_ctrl_bh, g,
+                                     &qdev->mem_reentrancy_guard);
+    g->cursor_bh = qemu_bh_new_guarded(virtio_gpu_cursor_bh, g,
+                                       &qdev->mem_reentrancy_guard);
     QTAILQ_INIT(&g->reslist);
     QTAILQ_INIT(&g->cmdq);
     QTAILQ_INIT(&g->fenceq);
diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 55902e1df7..4e76d6b191 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1509,7 +1509,8 @@ static void ahci_cmd_done(const IDEDMA *dma)
     ahci_write_fis_d2h(ad);
 
     if (ad->port_regs.cmd_issue && !ad->check_bh) {
-        ad->check_bh = qemu_bh_new(ahci_check_cmd_bh, ad);
+        ad->check_bh = qemu_bh_new_guarded(ahci_check_cmd_bh, ad,
+                                           &ad->mem_reentrancy_guard);
         qemu_bh_schedule(ad->check_bh);
     }
 }
diff --git a/hw/ide/ahci_internal.h b/hw/ide/ahci_internal.h
index 303fcd7235..2480455372 100644
--- a/hw/ide/ahci_internal.h
+++ b/hw/ide/ahci_internal.h
@@ -321,6 +321,7 @@ struct AHCIDevice {
     bool init_d2h_sent;
     AHCICmdHdr *cur_cmd;
     NCQTransferState ncq_tfs[AHCI_MAX_CMDS];
+    MemReentrancyGuard mem_reentrancy_guard;
 };
 
 struct AHCIPCIState {
diff --git a/hw/ide/core.c b/hw/ide/core.c
index 45d14a25e9..de48ff9f86 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -513,6 +513,7 @@ BlockAIOCB *ide_issue_trim(
         BlockCompletionFunc *cb, void *cb_opaque, void *opaque)
 {
     IDEState *s = opaque;
+    IDEDevice *dev = s->unit ? s->bus->slave : s->bus->master;
     TrimAIOCB *iocb;
 
     /* Paired with a decrement in ide_trim_bh_cb() */
@@ -520,7 +521,8 @@ BlockAIOCB *ide_issue_trim(
 
     iocb = blk_aio_get(&trim_aiocb_info, s->blk, cb, cb_opaque);
     iocb->s = s;
-    iocb->bh = qemu_bh_new(ide_trim_bh_cb, iocb);
+    iocb->bh = qemu_bh_new_guarded(ide_trim_bh_cb, iocb,
+                                   &DEVICE(dev)->mem_reentrancy_guard);
     iocb->ret = 0;
     iocb->qiov = qiov;
     iocb->i = -1;
diff --git a/hw/misc/imx_rngc.c b/hw/misc/imx_rngc.c
index 632c03779c..082c6980ad 100644
--- a/hw/misc/imx_rngc.c
+++ b/hw/misc/imx_rngc.c
@@ -228,8 +228,10 @@ static void imx_rngc_realize(DeviceState *dev, Error **errp)
     sysbus_init_mmio(sbd, &s->iomem);
 
     sysbus_init_irq(sbd, &s->irq);
-    s->self_test_bh = qemu_bh_new(imx_rngc_self_test, s);
-    s->seed_bh = qemu_bh_new(imx_rngc_seed, s);
+    s->self_test_bh = qemu_bh_new_guarded(imx_rngc_self_test, s,
+                                          &dev->mem_reentrancy_guard);
+    s->seed_bh = qemu_bh_new_guarded(imx_rngc_seed, s,
+                                     &dev->mem_reentrancy_guard);
 }
 
 static void imx_rngc_reset(DeviceState *dev)
diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c
index 43bb1f56ba..80a789f32b 100644
--- a/hw/misc/macio/mac_dbdma.c
+++ b/hw/misc/macio/mac_dbdma.c
@@ -914,7 +914,7 @@ static void mac_dbdma_realize(DeviceState *dev, Error **errp)
 {
     DBDMAState *s = MAC_DBDMA(dev);
 
-    s->bh = qemu_bh_new(DBDMA_run_bh, s);
+    s->bh = qemu_bh_new_guarded(DBDMA_run_bh, s, &dev->mem_reentrancy_guard);
 }
 
 static void mac_dbdma_class_init(ObjectClass *oc, void *data)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 3b66c97e3d..c9ba367c1b 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -2919,7 +2919,8 @@ static void virtio_net_add_queue(VirtIONet *n, int index)
         n->vqs[index].tx_vq =
             virtio_add_queue(vdev, n->net_conf.tx_queue_size,
                              virtio_net_handle_tx_bh);
-        n->vqs[index].tx_bh = qemu_bh_new(virtio_net_tx_bh, &n->vqs[index]);
+        n->vqs[index].tx_bh = qemu_bh_new_guarded(virtio_net_tx_bh, &n->vqs[index],
+                                                  &DEVICE(vdev)->mem_reentrancy_guard);
     }
 
     n->vqs[index].tx_waiting = 0;
diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 2097fb1310..812246689c 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -4607,7 +4607,8 @@ static void nvme_init_sq(NvmeSQueue *sq, NvmeCtrl *n, uint64_t dma_addr,
         QTAILQ_INSERT_TAIL(&(sq->req_list), &sq->io_req[i], entry);
     }
 
-    sq->bh = qemu_bh_new(nvme_process_sq, sq);
+    sq->bh = qemu_bh_new_guarded(nvme_process_sq, sq,
+                                 &DEVICE(sq->ctrl)->mem_reentrancy_guard);
 
     if (n->dbbuf_enabled) {
         sq->db_addr = n->dbbuf_dbs + (sqid << 3);
@@ -5253,7 +5254,8 @@ static void nvme_init_cq(NvmeCQueue *cq, NvmeCtrl *n, uint64_t dma_addr,
         }
     }
     n->cq[cqid] = cq;
-    cq->bh = qemu_bh_new(nvme_post_cqes, cq);
+    cq->bh = qemu_bh_new_guarded(nvme_post_cqes, cq,
+                                 &DEVICE(cq->ctrl)->mem_reentrancy_guard);
 }
 
 static uint16_t nvme_create_cq(NvmeCtrl *n, NvmeRequest *req)
diff --git a/hw/scsi/mptsas.c b/hw/scsi/mptsas.c
index c485da792c..3de288b454 100644
--- a/hw/scsi/mptsas.c
+++ b/hw/scsi/mptsas.c
@@ -1322,7 +1322,8 @@ static void mptsas_scsi_realize(PCIDevice *dev, Error **errp)
     }
     s->max_devices = MPTSAS_NUM_PORTS;
 
-    s->request_bh = qemu_bh_new(mptsas_fetch_requests, s);
+    s->request_bh = qemu_bh_new_guarded(mptsas_fetch_requests, s,
+                                        &DEVICE(dev)->mem_reentrancy_guard);
 
     scsi_bus_init(&s->bus, sizeof(s->bus), &dev->qdev, &mptsas_scsi_info);
 }
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index c97176110c..3c20b47ad0 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -193,7 +193,8 @@ static void scsi_dma_restart_cb(void *opaque, bool running, RunState state)
         AioContext *ctx = blk_get_aio_context(s->conf.blk);
         /* The reference is dropped in scsi_dma_restart_bh.*/
         object_ref(OBJECT(s));
-        s->bh = aio_bh_new(ctx, scsi_dma_restart_bh, s);
+        s->bh = aio_bh_new_guarded(ctx, scsi_dma_restart_bh, s,
+                                   &DEVICE(s)->mem_reentrancy_guard);
         qemu_bh_schedule(s->bh);
     }
 }
diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
index fa76696855..4de34536e9 100644
--- a/hw/scsi/vmw_pvscsi.c
+++ b/hw/scsi/vmw_pvscsi.c
@@ -1184,7 +1184,8 @@ pvscsi_realizefn(PCIDevice *pci_dev, Error **errp)
         pcie_endpoint_cap_init(pci_dev, PVSCSI_EXP_EP_OFFSET);
     }
 
-    s->completion_worker = qemu_bh_new(pvscsi_process_completion_queue, s);
+    s->completion_worker = qemu_bh_new_guarded(pvscsi_process_completion_queue, s,
+                                               &DEVICE(pci_dev)->mem_reentrancy_guard);
 
     scsi_bus_init(&s->bus, sizeof(s->bus), DEVICE(pci_dev), &pvscsi_scsi_info);
     /* override default SCSI bus hotplug-handler, with pvscsi's one */
diff --git a/hw/usb/dev-uas.c b/hw/usb/dev-uas.c
index 88f99c05d5..f013ded91e 100644
--- a/hw/usb/dev-uas.c
+++ b/hw/usb/dev-uas.c
@@ -937,7 +937,8 @@ static void usb_uas_realize(USBDevice *dev, Error **errp)
 
     QTAILQ_INIT(&uas->results);
     QTAILQ_INIT(&uas->requests);
-    uas->status_bh = qemu_bh_new(usb_uas_send_status_bh, uas);
+    uas->status_bh = qemu_bh_new_guarded(usb_uas_send_status_bh, uas,
+                                         &d->mem_reentrancy_guard);
 
     dev->flags |= (1 << USB_DEV_FLAG_IS_SCSI_STORAGE);
     scsi_bus_init(&uas->bus, sizeof(uas->bus), DEVICE(dev), &usb_uas_scsi_info);
diff --git a/hw/usb/hcd-dwc2.c b/hw/usb/hcd-dwc2.c
index 8755e9cbb0..a0c4e782b2 100644
--- a/hw/usb/hcd-dwc2.c
+++ b/hw/usb/hcd-dwc2.c
@@ -1364,7 +1364,8 @@ static void dwc2_realize(DeviceState *dev, Error **errp)
     s->fi = USB_FRMINTVL - 1;
     s->eof_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, dwc2_frame_boundary, s);
     s->frame_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, dwc2_work_timer, s);
-    s->async_bh = qemu_bh_new(dwc2_work_bh, s);
+    s->async_bh = qemu_bh_new_guarded(dwc2_work_bh, s,
+                                      &dev->mem_reentrancy_guard);
 
     sysbus_init_irq(sbd, &s->irq);
 }
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index d4da8dcb8d..c930c60921 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -2533,7 +2533,8 @@ void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp)
     }
 
     s->frame_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, ehci_work_timer, s);
-    s->async_bh = qemu_bh_new(ehci_work_bh, s);
+    s->async_bh = qemu_bh_new_guarded(ehci_work_bh, s,
+                                      &dev->mem_reentrancy_guard);
     s->device = dev;
 
     s->vmstate = qemu_add_vm_change_state_handler(usb_ehci_vm_state_change, s);
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
index 8ac1175ad2..77baaa7a6b 100644
--- a/hw/usb/hcd-uhci.c
+++ b/hw/usb/hcd-uhci.c
@@ -1190,7 +1190,7 @@ void usb_uhci_common_realize(PCIDevice *dev, Error **errp)
                               USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL);
         }
     }
-    s->bh = qemu_bh_new(uhci_bh, s);
+    s->bh = qemu_bh_new_guarded(uhci_bh, s, &DEVICE(dev)->mem_reentrancy_guard);
     s->frame_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, uhci_frame_timer, s);
     s->num_ports_vmstate = NB_PORTS;
     QTAILQ_INIT(&s->queues);
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index 176868d345..f500db85ab 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -1141,7 +1141,8 @@ static void usb_host_nodev_bh(void *opaque)
 static void usb_host_nodev(USBHostDevice *s)
 {
     if (!s->bh_nodev) {
-        s->bh_nodev = qemu_bh_new(usb_host_nodev_bh, s);
+        s->bh_nodev = qemu_bh_new_guarded(usb_host_nodev_bh, s,
+                                          &DEVICE(s)->mem_reentrancy_guard);
     }
     qemu_bh_schedule(s->bh_nodev);
 }
@@ -1739,7 +1740,8 @@ static int usb_host_post_load(void *opaque, int version_id)
     USBHostDevice *dev = opaque;
 
     if (!dev->bh_postld) {
-        dev->bh_postld = qemu_bh_new(usb_host_post_load_bh, dev);
+        dev->bh_postld = qemu_bh_new_guarded(usb_host_post_load_bh, dev,
+                                             &DEVICE(dev)->mem_reentrancy_guard);
     }
     qemu_bh_schedule(dev->bh_postld);
     dev->bh_postld_pending = true;
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index fd7df599bc..39fbaaab16 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -1441,8 +1441,10 @@ static void usbredir_realize(USBDevice *udev, Error **errp)
         }
     }
 
-    dev->chardev_close_bh = qemu_bh_new(usbredir_chardev_close_bh, dev);
-    dev->device_reject_bh = qemu_bh_new(usbredir_device_reject_bh, dev);
+    dev->chardev_close_bh = qemu_bh_new_guarded(usbredir_chardev_close_bh, dev,
+                                                &DEVICE(dev)->mem_reentrancy_guard);
+    dev->device_reject_bh = qemu_bh_new_guarded(usbredir_device_reject_bh, dev,
+                                                &DEVICE(dev)->mem_reentrancy_guard);
     dev->attach_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, usbredir_do_attach, dev);
 
     packet_id_queue_init(&dev->cancelled, dev, "cancelled");
diff --git a/hw/usb/xen-usb.c b/hw/usb/xen-usb.c
index 66cb3f7c24..38ee660a30 100644
--- a/hw/usb/xen-usb.c
+++ b/hw/usb/xen-usb.c
@@ -1032,7 +1032,8 @@ static void usbback_alloc(struct XenLegacyDevice *xendev)
 
     QTAILQ_INIT(&usbif->req_free_q);
     QSIMPLEQ_INIT(&usbif->hotplug_q);
-    usbif->bh = qemu_bh_new(usbback_bh, usbif);
+    usbif->bh = qemu_bh_new_guarded(usbback_bh, usbif,
+                                    &DEVICE(xendev)->mem_reentrancy_guard);
 }
 
 static int usbback_free(struct XenLegacyDevice *xendev)
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index 746f07c4d2..d60dd1f61e 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -908,8 +908,9 @@ static void virtio_balloon_device_realize(DeviceState *dev, Error **errp)
         precopy_add_notifier(&s->free_page_hint_notify);
 
         object_ref(OBJECT(s->iothread));
-        s->free_page_bh = aio_bh_new(iothread_get_aio_context(s->iothread),
-                                     virtio_ballloon_get_free_page_hints, s);
+        s->free_page_bh = aio_bh_new_guarded(iothread_get_aio_context(s->iothread),
+                                             virtio_ballloon_get_free_page_hints, s,
+                                             &dev->mem_reentrancy_guard);
     }
 
     if (virtio_has_feature(s->host_features, VIRTIO_BALLOON_F_REPORTING)) {
diff --git a/hw/virtio/virtio-crypto.c b/hw/virtio/virtio-crypto.c
index ccaa704530..f4a25de5ac 100644
--- a/hw/virtio/virtio-crypto.c
+++ b/hw/virtio/virtio-crypto.c
@@ -1081,7 +1081,8 @@ static void virtio_crypto_device_realize(DeviceState *dev, Error **errp)
         vcrypto->vqs[i].dataq =
                  virtio_add_queue(vdev, 1024, virtio_crypto_handle_dataq_bh);
         vcrypto->vqs[i].dataq_bh =
-                 qemu_bh_new(virtio_crypto_dataq_bh, &vcrypto->vqs[i]);
+                 qemu_bh_new_guarded(virtio_crypto_dataq_bh, &vcrypto->vqs[i],
+                                     &dev->mem_reentrancy_guard);
         vcrypto->vqs[i].vcrypto = vcrypto;
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:11:53 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:11:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815701.1229702 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoH3-0002mO-RW; Thu, 10 Oct 2024 08:11:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815701.1229702; Thu, 10 Oct 2024 08:11:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoH3-0002mH-Od; Thu, 10 Oct 2024 08:11:53 +0000
Received: by outflank-mailman (input) for mailman id 815701;
 Thu, 10 Oct 2024 08:11: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 1syoH3-0002m9-5b
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:11: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 1syoH3-0006sm-4t
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:11:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoH3-0004K2-46
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:11: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=Bv/E2g19gLycb51dINBeSWyjQTna81ZP7f9NbkLwtqQ=; b=3eQdT0ltiWbrEfSbScPK3aGUjr
	t2xiHQNBbBZezS+ZAVYjJRWv87VAmStABHW8SqHFl/yISrAVFmm3zWX4nMeqGM6qzkFrxWzqlmhkE
	tXV+OyaKsjS/p6hDOwH43hcSfkTk4tyg2FT0dH2WtWiyefnjsYyujACb/SiuoMxhusI4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] lsi53c895a: disable reentrancy detection for script RAM
Message-Id: <E1syoH3-0004K2-46@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:11:53 +0000

commit db43c7db206427ff5f6cbc7116c66d6cc6e81385
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:10 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    lsi53c895a: disable reentrancy detection for script RAM
    
    As the code is designed to use the memory APIs to access the script ram,
    disable reentrancy checks for the pseudo-RAM ram_io MemoryRegion.
    
    In the future, ram_io may be converted from an IO to a proper RAM MemoryRegion.
    
    Reported-by: Fiona Ebner <f.ebner@proxmox.com>
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Message-Id: <20230427211013.2994127-6-alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit bfd6e7ae6a72b84e2eb9574f56e6ec037f05182c)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/scsi/lsi53c895a.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index bbf32d3f73..17af67935f 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -2313,6 +2313,12 @@ static void lsi_scsi_realize(PCIDevice *dev, Error **errp)
     memory_region_init_io(&s->io_io, OBJECT(s), &lsi_io_ops, s,
                           "lsi-io", 256);
 
+    /*
+     * Since we use the address-space API to interact with ram_io, disable the
+     * re-entrancy guard.
+     */
+    s->ram_io.disable_reentrancy_guard = true;
+
     address_space_init(&s->pci_io_as, pci_address_space_io(dev), "lsi-pci-io");
     qdev_init_gpio_out(d, &s->ext_irq, 1);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:12:03 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:12:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815702.1229706 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoHD-0002pl-UM; Thu, 10 Oct 2024 08:12:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815702.1229706; Thu, 10 Oct 2024 08:12:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoHD-0002pe-Rb; Thu, 10 Oct 2024 08:12:03 +0000
Received: by outflank-mailman (input) for mailman id 815702;
 Thu, 10 Oct 2024 08:12: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 1syoHD-0002pW-8t
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:12: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 1syoHD-0006t6-8D
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:12:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoHD-0004LY-79
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:12:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TyPwfzs3w3NoEgOu8MOzWKxidLLC3VN5RfhGHFCdL+s=; b=HcH7XG3a7ShvmcWYzaYGk12dpc
	L2ldvXxkSWUmhNqhdnWx2XIW6TgDjY7t3tcNbN7a12qCsj9cvuqxbum8qaArGi5XLNERfP8Fmeur9
	ZLLnM21JQwpncFswOyNRP6sJqsXLNFod8/nBxZKaE2TGB/wHw3zvq8Kof0XTPejxRFMI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] lsi53c895a: disable reentrancy detection for MMIO region, too
Message-Id: <E1syoHD-0004LY-79@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:12:03 +0000

commit 0f0fb19d2bae3a5184fdbfcaa5de24f6ce759042
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Tue May 16 11:05:56 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    lsi53c895a: disable reentrancy detection for MMIO region, too
    
    While trying to use a SCSI disk on the LSI controller with an
    older version of Fedora (25), I'm getting:
    
     qemu: warning: Blocked re-entrant IO on MemoryRegion: lsi-mmio at addr: 0x34
    
    and the SCSI controller is not usable. Seems like we have to
    disable the reentrancy checker for the MMIO region, too, to
    get this working again.
    
    The problem could be reproduced it like this:
    
    ./qemu-system-x86_64 -accel kvm -m 2G -machine q35 \
     -device lsi53c810,id=lsi1 -device scsi-hd,drive=d0 \
     -drive if=none,id=d0,file=.../somedisk.qcow2 \
     -cdrom Fedora-Everything-netinst-i386-25-1.3.iso
    
    Where somedisk.qcow2 is an image that contains already some partitions
    and file systems.
    
    In the boot menu of Fedora, go to
    "Troubleshooting" -> "Rescue a Fedora system" -> "3) Skip to shell"
    
    Then check "dmesg | grep -i 53c" for failure messages, and try to mount
    a partition from somedisk.qcow2.
    
    Message-Id: <20230516090556.553813-1-thuth@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit d139fe9ad8a27bcc50b4ead77d2f97d191a0e95e)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/scsi/lsi53c895a.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index 17af67935f..f7d45b0b20 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -2318,6 +2318,7 @@ static void lsi_scsi_realize(PCIDevice *dev, Error **errp)
      * re-entrancy guard.
      */
     s->ram_io.disable_reentrancy_guard = true;
+    s->mmio_io.disable_reentrancy_guard = true;
 
     address_space_init(&s->pci_io_as, pci_address_space_io(dev), "lsi-pci-io");
     qdev_init_gpio_out(d, &s->ext_irq, 1);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:12:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815703.1229709 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoHN-0002sc-Vy; Thu, 10 Oct 2024 08:12:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815703.1229709; Thu, 10 Oct 2024 08:12:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoHN-0002sU-TJ; Thu, 10 Oct 2024 08:12:13 +0000
Received: by outflank-mailman (input) for mailman id 815703;
 Thu, 10 Oct 2024 08:12: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 1syoHN-0002sO-Bn
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:12: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 1syoHN-0006tJ-BB
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:12:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoHN-0004MM-AM
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:12:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xKCY9tzCDbP0dtNfZbDkeBuqdv6Oi9nzloU1qSr65Uo=; b=leJ/rcMuZcZN5QjllWCMvAzO/b
	fmdbwxsX2lplOOvf8BEsWtz4Z7N56MXtA+bGZVar5ZIbxdkwutBtcqGMMc7mblUJ0idm6WHMgdFaO
	lWigM4t+ojWMUQbfsnj6GWPv2AlXDNA7fE1UCUSNkGj3dSWlazRKomkfOm6Bg8I31+7M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] bcm2835_property: disable reentrancy detection for iomem
Message-Id: <E1syoHN-0004MM-AM@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:12:13 +0000

commit 83d080e85ae769dddf67118b420ec39bfcc3323f
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:11 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    bcm2835_property: disable reentrancy detection for iomem
    
    As the code is designed for re-entrant calls from bcm2835_property to
    bcm2835_mbox and back into bcm2835_property, mark iomem as
    reentrancy-safe.
    
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Message-Id: <20230427211013.2994127-7-alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 985c4a4e547afb9573b6bd6843d20eb2c3d1d1cd)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/misc/bcm2835_property.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c
index 890ae7bae5..de056ea2df 100644
--- a/hw/misc/bcm2835_property.c
+++ b/hw/misc/bcm2835_property.c
@@ -382,6 +382,13 @@ static void bcm2835_property_init(Object *obj)
 
     memory_region_init_io(&s->iomem, OBJECT(s), &bcm2835_property_ops, s,
                           TYPE_BCM2835_PROPERTY, 0x10);
+
+    /*
+     * bcm2835_property_ops call into bcm2835_mbox, which in-turn reads from
+     * iomem. As such, mark iomem as re-entracy safe.
+     */
+    s->iomem.disable_reentrancy_guard = true;
+
     sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->iomem);
     sysbus_init_irq(SYS_BUS_DEVICE(s), &s->mbox_irq);
 }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:12:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:12:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815704.1229713 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoHY-0002vH-11; Thu, 10 Oct 2024 08:12:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815704.1229713; Thu, 10 Oct 2024 08:12:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoHX-0002v9-Ul; Thu, 10 Oct 2024 08:12:23 +0000
Received: by outflank-mailman (input) for mailman id 815704;
 Thu, 10 Oct 2024 08:12: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 1syoHX-0002uy-Ep
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:12: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 1syoHX-0006ux-EA
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:12:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoHX-0004N6-DN
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:12:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=XJF4Q7y0KWcb8v9tViKk9PP0V7uW1kqoY6ym5FJTf5Y=; b=WhLKksR90wqauB+onpkCTfrANG
	dn5UpT85HEUl2JQNJm30KohFRpwR19A/ZEDWoG1MRz+kIsMX4SaE3U0bHubyDoF6fLEhkF10WtLAh
	lK4HhY5vQeSnsNGHIxv6IqqkZvbq0PhrwJTJSu/XpXimQKPg0MTEC6VFhq2u0pIQRIEE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] raven: disable reentrancy detection for iomem
Message-Id: <E1syoHX-0004N6-DN@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:12:23 +0000

commit 151649da1b821809d016c03287301ee0f81596c4
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:12 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    raven: disable reentrancy detection for iomem
    
    As the code is designed for re-entrant calls from raven_io_ops to
    pci-conf, mark raven_io_ops as reentrancy-safe.
    
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Message-Id: <20230427211013.2994127-8-alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 6dad5a6810d9c60ca320d01276f6133bbcfa1fc7)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/pci-host/raven.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c
index 072ffe3c5e..9a11ac4b2b 100644
--- a/hw/pci-host/raven.c
+++ b/hw/pci-host/raven.c
@@ -294,6 +294,13 @@ static void raven_pcihost_initfn(Object *obj)
     memory_region_init(&s->pci_memory, obj, "pci-memory", 0x3f000000);
     address_space_init(&s->pci_io_as, &s->pci_io, "raven-io");
 
+    /*
+     * Raven's raven_io_ops use the address-space API to access pci-conf-idx
+     * (which is also owned by the raven device). As such, mark the
+     * pci_io_non_contiguous as re-entrancy safe.
+     */
+    s->pci_io_non_contiguous.disable_reentrancy_guard = true;
+
     /* CPU address space */
     memory_region_add_subregion(address_space_mem, PCI_IO_BASE_ADDR,
                                 &s->pci_io);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:12:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:12:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815705.1229718 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoHj-0002yC-31; Thu, 10 Oct 2024 08:12:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815705.1229718; Thu, 10 Oct 2024 08:12: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 1syoHj-0002y0-00; Thu, 10 Oct 2024 08:12:35 +0000
Received: by outflank-mailman (input) for mailman id 815705;
 Thu, 10 Oct 2024 08:12: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 1syoHh-0002xl-Hv
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:12: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 1syoHh-0006v5-HH
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:12:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoHh-0004O2-GS
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:12:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=n2YRqkXTZXJ+9LqvrgOkaox3wS4XTeiRGEDZ0sxmMvQ=; b=ydUFY2JphgR4pKIRZPonupmfu4
	t1WDVlydsPp+hurGpGfKMoR3PyFJhgR7ix4a7P+YUcnxWyTNnjvXjhHxAWo4NMBii4Uk8L98aKSv6
	Kh0ipRDdzTrAIUOO7iK/3MgNMp+GxDLbbPmYz4Qq4gqTMOsERwrwO+koU2goAjoNMKuo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] apic: disable reentrancy detection for apic-msi
Message-Id: <E1syoHh-0004O2-GS@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:12:33 +0000

commit 305ffdeca8d134e5982e18137fc369eb929b2059
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Thu Apr 27 17:10:13 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    apic: disable reentrancy detection for apic-msi
    
    As the code is designed for re-entrant calls to apic-msi, mark apic-msi
    as reentrancy-safe.
    
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
    Message-Id: <20230427211013.2994127-9-alxndr@bu.edu>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 50795ee051a342c681a9b45671c552fbd6274db8)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/intc/apic.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/hw/intc/apic.c b/hw/intc/apic.c
index 20b5a94073..ac3d47d231 100644
--- a/hw/intc/apic.c
+++ b/hw/intc/apic.c
@@ -885,6 +885,13 @@ static void apic_realize(DeviceState *dev, Error **errp)
     memory_region_init_io(&s->io_memory, OBJECT(s), &apic_io_ops, s, "apic-msi",
                           APIC_SPACE_SIZE);
 
+    /*
+     * apic-msi's apic_mem_write can call into ioapic_eoi_broadcast, which can
+     * write back to apic-msi. As such mark the apic-msi region re-entrancy
+     * safe.
+     */
+    s->io_memory.disable_reentrancy_guard = true;
+
     s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, apic_timer, s);
     local_apics[s->id] = s;
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:12:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:12:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815706.1229722 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoHt-00030Y-4E; Thu, 10 Oct 2024 08:12:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815706.1229722; Thu, 10 Oct 2024 08:12: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 1syoHt-00030Q-1Q; Thu, 10 Oct 2024 08:12:45 +0000
Received: by outflank-mailman (input) for mailman id 815706;
 Thu, 10 Oct 2024 08:12: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 1syoHr-00030G-L8
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:12: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 1syoHr-0006vD-KS
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:12:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoHr-0004Of-JR
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:12:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=S9Dkhz2zzCtnOAnBAfoE6fP2cLdvElAxHR6tiOf16TA=; b=T4EUdrJavfpeiAh6XSiS1iNxKp
	Vo2lw4ggyNAZgprlAZ7ucm09D5Er3jqxkyvAzWTTjcgOMC6j4HDhiCYIQtbOP+6nWOBUs3YN/cTAV
	+0JTHaPqmvhJRnWkUBQQcuRIPTTCgV1FdWPBQpt6NDq+gZaHdp485pT5VWq6iyAK3c7k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] loongarch: mark loongarch_ipi_iocsr re-entrnacy safe
Message-Id: <E1syoHr-0004Of-JR@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:12:43 +0000

commit 48c04e42f033bf2e717052d99192fada589d62b3
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Sat May 6 07:21:45 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    loongarch: mark loongarch_ipi_iocsr re-entrnacy safe
    
    loongarch_ipi_iocsr MRs rely on re-entrant IO through the ipi_send
    function. As such, mark these MRs re-entrancy-safe.
    
    Fixes: a2e1753b80 ("memory: prevent dma-reentracy issues")
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    Reviewed-by: Song Gao <gaosong@loongson.cn>
    Message-Id: <20230506112145.3563708-1-alxndr@bu.edu>
    Signed-off-by: Song Gao <gaosong@loongson.cn>
    (cherry picked from commit 6d0589e0e6c64b888864a2bf980537be20389264)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/intc/loongarch_ipi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/intc/loongarch_ipi.c b/hw/intc/loongarch_ipi.c
index aa4bf9eb74..40e98af2ce 100644
--- a/hw/intc/loongarch_ipi.c
+++ b/hw/intc/loongarch_ipi.c
@@ -215,6 +215,10 @@ static void loongarch_ipi_init(Object *obj)
     for (cpu = 0; cpu < MAX_IPI_CORE_NUM; cpu++) {
         memory_region_init_io(&s->ipi_iocsr_mem[cpu], obj, &loongarch_ipi_ops,
                             &lams->ipi_core[cpu], "loongarch_ipi_iocsr", 0x48);
+
+        /* loongarch_ipi_iocsr performs re-entrant IO through ipi_send */
+        s->ipi_iocsr_mem[cpu].disable_reentrancy_guard = true;
+
         sysbus_init_mmio(sbd, &s->ipi_iocsr_mem[cpu]);
 
         memory_region_init_io(&s->ipi64_iocsr_mem[cpu], obj, &loongarch_ipi64_ops,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:12:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:12:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815707.1229726 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoI3-00033A-5b; Thu, 10 Oct 2024 08:12:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815707.1229726; Thu, 10 Oct 2024 08:12:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoI3-000332-2y; Thu, 10 Oct 2024 08:12:55 +0000
Received: by outflank-mailman (input) for mailman id 815707;
 Thu, 10 Oct 2024 08:12: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 1syoI1-00032r-O9
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:12: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 1syoI1-0006va-NN
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:12:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoI1-0004PS-Mf
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:12:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=c0DgRDMaEq2SvaoY5UsQABV2v/8KCALla7bYel0V07c=; b=PeDgyM+Co+M0ytIupjt3lt2I0k
	fFOdNDf6M5U4KYzSWrxEAN6m9Oj7rUVdnlFrVqeik0p8VMSkoaSkeAtCH/Kkh97o5blCVhMvf2OhD
	DKAss7Ay6+D4/qeI78sxd3RvwmDvLQdalCMYqkOfiBcE7CEnJfaQ0nuFtq0mZhUuniEQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] pnv_lpc: disable reentrancy detection for lpc-hc
Message-Id: <E1syoI1-0004PS-Mf@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:12:53 +0000

commit e7f12ce43d9fc6016c1f12d49bcb5e024663d7ad
Author:     Alexander Bulekov <alxndr@bu.edu>
AuthorDate: Fri May 26 09:38:50 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:38:01 2023 +0300

    pnv_lpc: disable reentrancy detection for lpc-hc
    
    As lpc-hc is designed for re-entrant calls from xscom, mark it
    re-entrancy safe.
    
    Reported-by: Thomas Huth <thuth@redhat.com>
    Signed-off-by: Alexander Bulekov <alxndr@bu.edu>
    [clg: mark opb_master_regs as re-entrancy safe also ]
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    Reviewed-by: Frederic Barrat <fbarrat@linux.ibm.com>
    Tested-by: Thomas Huth <thuth@redhat.com>
    Message-Id: <20230526073850.2772197-1-clg@kaod.org>
    Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
    (cherry picked from commit 76f9ebffcd41b62ae9ec26a1c25676f2ae1d9cc3)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ppc/pnv_lpc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/ppc/pnv_lpc.c b/hw/ppc/pnv_lpc.c
index 01f44c19eb..605d390861 100644
--- a/hw/ppc/pnv_lpc.c
+++ b/hw/ppc/pnv_lpc.c
@@ -734,10 +734,13 @@ static void pnv_lpc_realize(DeviceState *dev, Error **errp)
     /* Create MMIO regions for LPC HC and OPB registers */
     memory_region_init_io(&lpc->opb_master_regs, OBJECT(dev), &opb_master_ops,
                           lpc, "lpc-opb-master", LPC_OPB_REGS_OPB_SIZE);
+    lpc->opb_master_regs.disable_reentrancy_guard = true;
     memory_region_add_subregion(&lpc->opb_mr, LPC_OPB_REGS_OPB_ADDR,
                                 &lpc->opb_master_regs);
     memory_region_init_io(&lpc->lpc_hc_regs, OBJECT(dev), &lpc_hc_ops, lpc,
                           "lpc-hc", LPC_HC_REGS_OPB_SIZE);
+    /* xscom writes to lpc-hc. As such mark lpc-hc re-entrancy safe */
+    lpc->lpc_hc_regs.disable_reentrancy_guard = true;
     memory_region_add_subregion(&lpc->opb_mr, LPC_HC_REGS_OPB_ADDR,
                                 &lpc->lpc_hc_regs);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:13:05 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:13:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815708.1229731 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoID-00035o-7Z; Thu, 10 Oct 2024 08:13:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815708.1229731; Thu, 10 Oct 2024 08:13:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoID-00035g-4L; Thu, 10 Oct 2024 08:13:05 +0000
Received: by outflank-mailman (input) for mailman id 815708;
 Thu, 10 Oct 2024 08:13: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 1syoIB-00035T-R8
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:13: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 1syoIB-0006vu-QO
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:13:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoIB-0004QF-Pd
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:13:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mkxP6RIJVAebYqWDeR53fUC1T4QyWn4WAsWd1OoEP5k=; b=ZsbGLbCKRzmz0Udiot+b1nkFQD
	ezs3ZvJURX4GTT7mSaEYeiNbijy9LyEKiIze+CcJ/aAgG9nUt/wsiiX5GecDOeZzQDMIefI4kvkE3
	avYJJkZ49X/5NCRINuW78dC5NhDoaNAJIrMzCtKyTkDzfKVYT2LcCZENNtxnKab7+AAo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] machine: Add helpers to get cores/threads per socket
Message-Id: <E1syoIB-0004QF-Pd@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:13:03 +0000

commit cfff72b21ebd8bb893181bb1107848cf8903ebaa
Author:     Zhao Liu <zhao1.liu@intel.com>
AuthorDate: Wed Jun 28 21:54:34 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    machine: Add helpers to get cores/threads per socket
    
    The number of cores/threads per socket are needed for smbios, and are
    also useful for other modules.
    
    Provide the helpers to wrap the calculation of cores/threads per socket
    so that we can avoid calculation errors caused by other modules miss
    topology changes.
    
    Suggested-by: Igor Mammedov <imammedo@redhat.com>
    Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
    Message-Id: <20230628135437.1145805-2-zhao1.liu@linux.intel.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit a1d027be95bc375238e5b9292c6aa661a8ddef4c)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/core/machine-smp.c | 10 ++++++++++
 include/hw/boards.h   |  2 ++
 2 files changed, 12 insertions(+)

diff --git a/hw/core/machine-smp.c b/hw/core/machine-smp.c
index 89fe0cda42..0f4d9b6f7a 100644
--- a/hw/core/machine-smp.c
+++ b/hw/core/machine-smp.c
@@ -197,3 +197,13 @@ void machine_parse_smp_config(MachineState *ms,
         return;
     }
 }
+
+unsigned int machine_topo_get_cores_per_socket(const MachineState *ms)
+{
+    return ms->smp.cores * ms->smp.clusters * ms->smp.dies;
+}
+
+unsigned int machine_topo_get_threads_per_socket(const MachineState *ms)
+{
+    return ms->smp.threads * machine_topo_get_cores_per_socket(ms);
+}
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 6fbbfd56c8..75c0b195af 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -35,6 +35,8 @@ void machine_set_cpu_numa_node(MachineState *machine,
                                Error **errp);
 void machine_parse_smp_config(MachineState *ms,
                               const SMPConfiguration *config, Error **errp);
+unsigned int machine_topo_get_cores_per_socket(const MachineState *ms);
+unsigned int machine_topo_get_threads_per_socket(const MachineState *ms);
 
 /**
  * machine_class_allow_dynamic_sysbus_dev: Add type to list of valid devices
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:13:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:13:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815709.1229734 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoIN-00038T-99; Thu, 10 Oct 2024 08:13:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815709.1229734; Thu, 10 Oct 2024 08:13:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoIN-00038L-6D; Thu, 10 Oct 2024 08:13:15 +0000
Received: by outflank-mailman (input) for mailman id 815709;
 Thu, 10 Oct 2024 08:13: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 1syoIL-000386-U2
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:13: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 1syoIL-0006w1-TF
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:13:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoIL-0004Si-Sb
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:13:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=V62291ciprUaRWVysdxU7ZkZZ0gdlQvwKI4E2lunha0=; b=GFMhIVq/HlfwWhtpGuTtN1HS0s
	A7rnI+Pg1SMYlm47hdup+5mShNVXzMFQuFmCMu2bs3pohJeCsINKH6fxW6yY3fSuAmaO6Dw0zUkNF
	60fdrnekJCii+E2Hhtx5IR5JRWgI6ledPJgkxFc9YNlU7ilt40Yw74eFKUc+wObK06RA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/smbios: Fix smbios_smp_sockets caculation
Message-Id: <E1syoIL-0004Si-Sb@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:13:13 +0000

commit c107dab4940d19760560ded7651550de9441db28
Author:     Zhao Liu <zhao1.liu@intel.com>
AuthorDate: Wed Jun 28 21:54:35 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/smbios: Fix smbios_smp_sockets caculation
    
    smp.sockets is the number of sockets which is configured by "-smp" (
    otherwise, the default is 1). Trying to recalculate it here with another
    rules leads to errors, such as:
    
    1. 003f230e37d7 ("machine: Tweak the order of topology members in struct
       CpuTopology") changes the meaning of smp.cores but doesn't fix
       original smp.cores uses.
    
       With the introduction of cluster, now smp.cores means the number of
       cores in one cluster. So smp.cores * smp.threads just means the
       threads in a cluster not in a socket.
    
    2. On the other hand, we shouldn't use smp.cpus here because it
       indicates the initial number of online CPUs at the boot time, and is
       not mathematically related to smp.sockets.
    
    So stop reinventing the another wheel and use the topo values that
    has been calculated.
    
    Fixes: 003f230e37d7 ("machine: Tweak the order of topology members in struct CpuTopology")
    Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
    Message-Id: <20230628135437.1145805-3-zhao1.liu@linux.intel.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit d79a284a44bb7d88b233fb6bb12ea3723f43469d)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/smbios/smbios.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index d2007e70fb..d67415d44d 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -1088,8 +1088,7 @@ void smbios_get_tables(MachineState *ms,
         smbios_build_type_2_table();
         smbios_build_type_3_table();
 
-        smbios_smp_sockets = DIV_ROUND_UP(ms->smp.cpus,
-                                          ms->smp.cores * ms->smp.threads);
+        smbios_smp_sockets = ms->smp.sockets;
         assert(smbios_smp_sockets >= 1);
 
         for (i = 0; i < smbios_smp_sockets; i++) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:13:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:13:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815710.1229738 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoIX-0003Bo-Be; Thu, 10 Oct 2024 08:13:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815710.1229738; Thu, 10 Oct 2024 08:13:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoIX-0003Bg-8q; Thu, 10 Oct 2024 08:13:25 +0000
Received: by outflank-mailman (input) for mailman id 815710;
 Thu, 10 Oct 2024 08:13: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 1syoIW-0003BG-0Y
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:13: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 1syoIV-0006wA-W6
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:13:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoIV-0004Tj-VS
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:13:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=owUbQXuNPPjpUExS6rV5ZDvrFkoKDCTrszoN/5WoMUc=; b=bNIDQ3GZIe1+/9j3o7NobDc2VP
	PThVbUTT2pJXtuVTq5XdpKJdff1q4kCwAHoUs/kOigYeGcEWSNtfxeh0d9aWlQh8C0is9lAeOrO+u
	ME9st7zMyMdU3f0olmxzS/e+3ccfgJAd/vTW6l4eQccMAWboSkzKZgAz31aKF7br4UQ8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/smbios: Fix thread count in type4
Message-Id: <E1syoIV-0004Tj-VS@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:13:23 +0000

commit ce2e3879a4a55317febdc42a0bc22b4a89e80824
Author:     Zhao Liu <zhao1.liu@intel.com>
AuthorDate: Wed Jun 28 21:54:36 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/smbios: Fix thread count in type4
    
    >From SMBIOS 3.0 specification, thread count field means:
    
    Thread Count is the total number of threads detected by the BIOS for
    this processor socket. It is a processor-wide count, not a
    thread-per-core count. [1]
    
    So here we should use threads per socket other than threads per core.
    
    [1] SMBIOS 3.0.0, section 7.5.8, Processor Information - Thread Count
    
    Fixes: c97294ec1b9e ("SMBIOS: Build aggregate smbios tables and entry point")
    Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
    Message-Id: <20230628135437.1145805-4-zhao1.liu@linux.intel.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 7298fd7de5551c4501f54381228458e3c21cab4b)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/smbios/smbios.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index d67415d44d..3aae9328c0 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -713,6 +713,7 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
 {
     char sock_str[128];
     size_t tbl_len = SMBIOS_TYPE_4_LEN_V28;
+    unsigned threads_per_socket;
 
     if (smbios_ep_type == SMBIOS_ENTRY_POINT_TYPE_64) {
         tbl_len = SMBIOS_TYPE_4_LEN_V30;
@@ -747,17 +748,19 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
     SMBIOS_TABLE_SET_STR(4, asset_tag_number_str, type4.asset);
     SMBIOS_TABLE_SET_STR(4, part_number_str, type4.part);
 
+    threads_per_socket = machine_topo_get_threads_per_socket(ms);
+
     t->core_count = (ms->smp.cores > 255) ? 0xFF : ms->smp.cores;
     t->core_enabled = t->core_count;
 
-    t->thread_count = (ms->smp.threads > 255) ? 0xFF : ms->smp.threads;
+    t->thread_count = (threads_per_socket > 255) ? 0xFF : threads_per_socket;
 
     t->processor_characteristics = cpu_to_le16(0x02); /* Unknown */
     t->processor_family2 = cpu_to_le16(0x01); /* Other */
 
     if (tbl_len == SMBIOS_TYPE_4_LEN_V30) {
         t->core_count2 = t->core_enabled2 = cpu_to_le16(ms->smp.cores);
-        t->thread_count2 = cpu_to_le16(ms->smp.threads);
+        t->thread_count2 = cpu_to_le16(threads_per_socket);
     }
 
     SMBIOS_BUILD_TABLE_POST;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:13:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:13:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815711.1229741 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoIh-0003ET-Ca; Thu, 10 Oct 2024 08:13:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815711.1229741; Thu, 10 Oct 2024 08:13: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 1syoIh-0003EM-AB; Thu, 10 Oct 2024 08:13:35 +0000
Received: by outflank-mailman (input) for mailman id 815711;
 Thu, 10 Oct 2024 08:13: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 1syoIg-0003E6-3P
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:13: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 1syoIg-0006wH-2k
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:13:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoIg-0004W3-28
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:13: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=vxvohhpZ18irQk52LpfbYUU46LcRrwkYbrFXEbBIZMs=; b=mafTgUppZgGSfZb+uJyTTK+2Uf
	YEaZ2ivCvEHF2KhvZwXcP+MS0vzZwaq5qnKmWyOr1LmIFxpjB+cc0g6xLyCnUW94fprMTL6r4Kx53
	WYbxuXlvid8MpqjygOV1Yrlp5oL17cAUUKgskx6qEBrx+syORzWIH2EZrrKbQpIrPERw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/smbios: Fix core count in type4
Message-Id: <E1syoIg-0004W3-28@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:13:34 +0000

commit abb4828d5d5cd0fba82e958779a7c14d3b44e2df
Author:     Zhao Liu <zhao1.liu@intel.com>
AuthorDate: Wed Jun 28 21:54:37 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/smbios: Fix core count in type4
    
    >From SMBIOS 3.0 specification, core count field means:
    
    Core Count is the number of cores detected by the BIOS for this
    processor socket. [1]
    
    Before 003f230e37d7 ("machine: Tweak the order of topology members in
    struct CpuTopology"), MachineState.smp.cores means "the number of cores
    in one package", and it's correct to use smp.cores for core count.
    
    But 003f230e37d7 changes the smp.cores' meaning to "the number of cores
    in one die" and doesn't change the original smp.cores' use in smbios as
    well, which makes core count in type4 go wrong.
    
    Fix this issue with the correct "cores per socket" caculation.
    
    [1] SMBIOS 3.0.0, section 7.5.6, Processor Information - Core Count
    
    Fixes: 003f230e37d7 ("machine: Tweak the order of topology members in struct CpuTopology")
    Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
    Message-Id: <20230628135437.1145805-5-zhao1.liu@linux.intel.com>
    Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
    Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
    (cherry picked from commit 196ea60a734c346d7d75f1d89aa37703d4d854e7)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/smbios/smbios.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
index 3aae9328c0..10cd22f610 100644
--- a/hw/smbios/smbios.c
+++ b/hw/smbios/smbios.c
@@ -714,6 +714,7 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
     char sock_str[128];
     size_t tbl_len = SMBIOS_TYPE_4_LEN_V28;
     unsigned threads_per_socket;
+    unsigned cores_per_socket;
 
     if (smbios_ep_type == SMBIOS_ENTRY_POINT_TYPE_64) {
         tbl_len = SMBIOS_TYPE_4_LEN_V30;
@@ -749,8 +750,9 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
     SMBIOS_TABLE_SET_STR(4, part_number_str, type4.part);
 
     threads_per_socket = machine_topo_get_threads_per_socket(ms);
+    cores_per_socket = machine_topo_get_cores_per_socket(ms);
 
-    t->core_count = (ms->smp.cores > 255) ? 0xFF : ms->smp.cores;
+    t->core_count = (cores_per_socket > 255) ? 0xFF : cores_per_socket;
     t->core_enabled = t->core_count;
 
     t->thread_count = (threads_per_socket > 255) ? 0xFF : threads_per_socket;
@@ -759,7 +761,7 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
     t->processor_family2 = cpu_to_le16(0x01); /* Other */
 
     if (tbl_len == SMBIOS_TYPE_4_LEN_V30) {
-        t->core_count2 = t->core_enabled2 = cpu_to_le16(ms->smp.cores);
+        t->core_count2 = t->core_enabled2 = cpu_to_le16(cores_per_socket);
         t->thread_count2 = cpu_to_le16(threads_per_socket);
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:13:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:13:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815712.1229746 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoIr-0003Gz-ER; Thu, 10 Oct 2024 08:13:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815712.1229746; Thu, 10 Oct 2024 08:13: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 1syoIr-0003Gq-Bb; Thu, 10 Oct 2024 08:13:45 +0000
Received: by outflank-mailman (input) for mailman id 815712;
 Thu, 10 Oct 2024 08:13: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 1syoIq-0003Gg-6D
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:13: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 1syoIq-0006wO-5a
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:13:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoIq-0004XC-4v
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:13: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=C/2/p9ge5WzXNS2bacoXlGNj37xI0verfxdUQCcSWR0=; b=zyKI1VZUmNoTiY/0elCskQroAs
	Sgd5ssIZPtsss6OBrYlT0j2+n8bLASp+KTQh+qkCG/Vd4He1oTIuFIqEVKti3/B8W1qg1VwHH1wff
	jfDs8WRrleXpg1AsPK+MNpwNjonJ0daV+IFhKuHPgxZxTw2hc6FL6af9US0ltpSm7X64=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/i2c: Fix bitbang_i2c_data trace event
Message-Id: <E1syoIq-0004XC-4v@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:13:44 +0000

commit 07b7ec0af04711f62c7c274d1440d10efb936ede
Author:     BALATON Zoltan <balaton@eik.bme.hu>
AuthorDate: Fri Jul 28 02:45:24 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/i2c: Fix bitbang_i2c_data trace event
    
    The clock and data values were logged swapped. Correct the trace event
    text to match what is logged. Also fix a typo in a comment nearby.
    
    Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (cherry picked from commit 8ada214a902225c90583b644cabd85bc89bf188c)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/i2c/bitbang_i2c.c | 2 +-
 hw/i2c/trace-events  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/i2c/bitbang_i2c.c b/hw/i2c/bitbang_i2c.c
index bb18954765..de5f5aacf5 100644
--- a/hw/i2c/bitbang_i2c.c
+++ b/hw/i2c/bitbang_i2c.c
@@ -70,7 +70,7 @@ static int bitbang_i2c_ret(bitbang_i2c_interface *i2c, int level)
     return level & i2c->last_data;
 }
 
-/* Leave device data pin unodified.  */
+/* Leave device data pin unmodified.  */
 static int bitbang_i2c_nop(bitbang_i2c_interface *i2c)
 {
     return bitbang_i2c_ret(i2c, i2c->device_out);
diff --git a/hw/i2c/trace-events b/hw/i2c/trace-events
index 8e88aa24c1..d7b1e25858 100644
--- a/hw/i2c/trace-events
+++ b/hw/i2c/trace-events
@@ -5,7 +5,7 @@ bitbang_i2c_state(const char *old_state, const char *new_state) "state %s -> %s"
 bitbang_i2c_addr(uint8_t addr) "Address 0x%02x"
 bitbang_i2c_send(uint8_t byte) "TX byte 0x%02x"
 bitbang_i2c_recv(uint8_t byte) "RX byte 0x%02x"
-bitbang_i2c_data(unsigned dat, unsigned clk, unsigned old_out, unsigned new_out) "dat %u clk %u out %u -> %u"
+bitbang_i2c_data(unsigned clk, unsigned dat, unsigned old_out, unsigned new_out) "clk %u dat %u out %u -> %u"
 
 # core.c
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:13:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:13:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815713.1229749 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoJ1-0003Jf-Ff; Thu, 10 Oct 2024 08:13:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815713.1229749; Thu, 10 Oct 2024 08:13: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 1syoJ1-0003JX-Cx; Thu, 10 Oct 2024 08:13:55 +0000
Received: by outflank-mailman (input) for mailman id 815713;
 Thu, 10 Oct 2024 08:13: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 1syoJ0-0003JH-9D
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:13: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 1syoJ0-0006wp-8U
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:13:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoJ0-0004Xo-7p
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:13:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=jhatzl6PDrHEGvt/g1Su7I9FtJiYG36ptFuhP9RVMP0=; b=sja4sbpZ1VvMITaxROcvWZhBoo
	o7N+nedsnK0YsE2DEnHe+zBX9yvepjMQVsIqxk3XM3+f6eWgbpmb19yAzZjpwjA7b/MjVlXEoWCoO
	jT6vuid0wU+TgxRb3famKVlhZbbRXcB1nDfAtzTC8TgUESpHnDUNrv9eahEa6HisLPJ8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] dump: kdump-zlib data pages not dumped with pvtime/aarch64
Message-Id: <E1syoJ0-0004Xo-7p@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:13:54 +0000

commit a11a2007a50d6d2b8e57605fc2ec40b9f962df13
Author:     Dongli Zhang <dongli.zhang@oracle.com>
AuthorDate: Wed Jul 12 22:58:19 2023 -0700
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    dump: kdump-zlib data pages not dumped with pvtime/aarch64
    
    The kdump-zlib data pages are not dumped from aarch64 host when the
    'pvtime' is involved, that is, when the block->target_end is not aligned to
    page_size. In the below example, it is expected to dump two blocks.
    
    (qemu) info mtree -f
    ... ...
      00000000090a0000-00000000090a0fff (prio 0, ram): pvtime KVM
    ... ...
      0000000040000000-00000001bfffffff (prio 0, ram): mach-virt.ram KVM
    ... ...
    
    However, there is an issue with get_next_page() so that the pages for
    "mach-virt.ram" will not be dumped.
    
    At line 1296, although we have reached at the end of the 'pvtime' block,
    since it is not aligned to the page_size (e.g., 0x10000), it will not break
    at line 1298.
    
    1255 static bool get_next_page(GuestPhysBlock **blockptr, uint64_t *pfnptr,
    1256                           uint8_t **bufptr, DumpState *s)
    ... ...
    1294             memcpy(buf + addr % page_size, hbuf, n);
    1295             addr += n;
    1296             if (addr % page_size == 0) {
    1297                 /* we filled up the page */
    1298                 break;
    1299             }
    
    As a result, get_next_page() will continue to the next
    block ("mach-virt.ram"). Finally, when get_next_page() returns to the
    caller:
    
    - 'pfnptr' is referring to the 'pvtime'
    - but 'blockptr' is referring to the "mach-virt.ram"
    
    When get_next_page() is called the next time, "*pfnptr += 1" still refers
    to the prior 'pvtime'. It will exit immediately because it is out of the
    range of the current "mach-virt.ram".
    
    The fix is to break when it is time to come to the next block, so that both
    'pfnptr' and 'blockptr' refer to the same block.
    
    Fixes: 94d788408d2d ("dump: fix kdump to work over non-aligned blocks")
    Cc: Joe Jin <joe.jin@oracle.com>
    Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Message-ID: <20230713055819.30497-1-dongli.zhang@oracle.com>
    (cherry picked from commit 8a64609eea8cb2bac015968c4b62da5bce266e22)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 dump/dump.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dump/dump.c b/dump/dump.c
index 1f1a6edcab..d4ef713cd0 100644
--- a/dump/dump.c
+++ b/dump/dump.c
@@ -1293,8 +1293,8 @@ static bool get_next_page(GuestPhysBlock **blockptr, uint64_t *pfnptr,
 
             memcpy(buf + addr % page_size, hbuf, n);
             addr += n;
-            if (addr % page_size == 0) {
-                /* we filled up the page */
+            if (addr % page_size == 0 || addr >= block->target_end) {
+                /* we filled up the page or the current block is finished */
                 break;
             }
         } else {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:14:05 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:14:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815714.1229753 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoJB-0003M7-Gw; Thu, 10 Oct 2024 08:14:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815714.1229753; Thu, 10 Oct 2024 08:14:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoJB-0003M0-EK; Thu, 10 Oct 2024 08:14:05 +0000
Received: by outflank-mailman (input) for mailman id 815714;
 Thu, 10 Oct 2024 08:14: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 1syoJA-0003Lq-CT
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:14: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 1syoJA-0006x9-Bi
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:14:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoJA-0004Zv-B0
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:14:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=K7QapHw7D8bX1kYzxd4IZx8K/RrgdStXvo9j1R4xJkM=; b=pO2Ms8mCvKTZS2UdKdlYkceTz3
	qXT7e0XYqruSbFjSFBLwzKCpn2Z2xDTjN1wtvI0f/rCwZskpe8wW2nXUbFFqcJBK2fjCY/omseUDC
	o/kBW3UlpVe/TuBDtBGPRZiJP3UAzl3XdMgyoFKVJl2iqgiNS7oTN5IgYPG/ZeNUmn3M=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/nvme: fix oob memory read in fdp events log
Message-Id: <E1syoJA-0004Zv-B0@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:14:04 +0000

commit dd496f92b97a9a2d36f83a91d8adae90ba65465a
Author:     Klaus Jensen <k.jensen@samsung.com>
AuthorDate: Thu Aug 3 20:44:23 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/nvme: fix oob memory read in fdp events log
    
    As reported by Trend Micro's Zero Day Initiative, an oob memory read
    vulnerability exists in nvme_fdp_events(). The host-provided offset is
    not verified.
    
    Fix this.
    
    This is only exploitable when Flexible Data Placement mode (fdp=on) is
    enabled.
    
    Fixes: CVE-2023-4135
    Fixes: 73064edfb864 ("hw/nvme: flexible data placement emulation")
    Reported-by: Trend Micro's Zero Day Initiative
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
    (cherry picked from commit ecb1b7b082d3b7dceff0e486a114502fc52c0fdf)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/nvme/ctrl.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 812246689c..e16e19ead8 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -5092,6 +5092,11 @@ static uint16_t nvme_fdp_events(NvmeCtrl *n, uint32_t endgrpid,
     }
 
     log_size = sizeof(NvmeFdpEventsLog) + ebuf->nelems * sizeof(NvmeFdpEvent);
+
+    if (off >= log_size) {
+        return NVME_INVALID_FIELD | NVME_DNR;
+    }
+
     trans_len = MIN(log_size - off, buf_len);
     elog = g_malloc0(log_size);
     elog->num_events = cpu_to_le32(ebuf->nelems);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:14:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:14:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815715.1229758 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoJL-0003Ov-Il; Thu, 10 Oct 2024 08:14:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815715.1229758; Thu, 10 Oct 2024 08:14:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoJL-0003Ol-Fp; Thu, 10 Oct 2024 08:14:15 +0000
Received: by outflank-mailman (input) for mailman id 815715;
 Thu, 10 Oct 2024 08:14: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 1syoJK-0003OW-Fo
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:14: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 1syoJK-0006xI-F9
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:14:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoJK-0004aq-EG
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:14:14 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=PLIhnQHBbYdZNbEBzc5qpCbRaV8UnxqrGhzYIGoMZsU=; b=oGPcENX+Qv7cyjCjuWDcHYMAys
	rbhkmrFPHo/OkUvtXcxglXBrIGsVLG5UFZbHQCiBQSM/PJYzuD/jH22OAkxWL/CXN1FxY5nNUcTsi
	BTwD4Jpfk218y1tWqjgpOXICociZYiv4l3s0/spTLYxyHlLC5XXkkciXVtRTAg4rRpAc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/nvme: fix compliance issue wrt. iosqes/iocqes
Message-Id: <E1syoJK-0004aq-EG@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:14:14 +0000

commit cbd3c5db76f0c91ec092692b3ace2727403e4954
Author:     Klaus Jensen <k.jensen@samsung.com>
AuthorDate: Wed Jul 19 20:21:58 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/nvme: fix compliance issue wrt. iosqes/iocqes
    
    As of prior to this patch, the controller checks the value of CC.IOCQES
    and CC.IOSQES prior to enabling the controller. As reported by Ben in
    GitLab issue #1691, this is not spec compliant. The controller should
    only check these values when queues are created.
    
    This patch moves these checks to nvme_create_cq(). We do not need to
    check it in nvme_create_sq() since that will error out if the completion
    queue is not already created.
    
    Also, since the controller exclusively supports SQEs of size 64 bytes
    and CQEs of size 16 bytes, hard code that.
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1691
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
    (cherry picked from commit 6a33f2e920ec0b489a77200888e3692664077f2d)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/nvme/ctrl.c       | 46 ++++++++++++----------------------------------
 hw/nvme/nvme.h       |  9 +++++++--
 hw/nvme/trace-events |  1 +
 3 files changed, 20 insertions(+), 36 deletions(-)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index e16e19ead8..00b910ca9e 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -1504,7 +1504,7 @@ static void nvme_post_cqes(void *opaque)
         req->cqe.status = cpu_to_le16((req->status << 1) | cq->phase);
         req->cqe.sq_id = cpu_to_le16(sq->sqid);
         req->cqe.sq_head = cpu_to_le16(sq->head);
-        addr = cq->dma_addr + cq->tail * n->cqe_size;
+        addr = cq->dma_addr + (cq->tail << NVME_CQES);
         ret = pci_dma_write(PCI_DEVICE(n), addr, (void *)&req->cqe,
                             sizeof(req->cqe));
         if (ret) {
@@ -5272,10 +5272,18 @@ static uint16_t nvme_create_cq(NvmeCtrl *n, NvmeRequest *req)
     uint16_t qsize = le16_to_cpu(c->qsize);
     uint16_t qflags = le16_to_cpu(c->cq_flags);
     uint64_t prp1 = le64_to_cpu(c->prp1);
+    uint32_t cc = ldq_le_p(&n->bar.cc);
+    uint8_t iocqes = NVME_CC_IOCQES(cc);
+    uint8_t iosqes = NVME_CC_IOSQES(cc);
 
     trace_pci_nvme_create_cq(prp1, cqid, vector, qsize, qflags,
                              NVME_CQ_FLAGS_IEN(qflags) != 0);
 
+    if (iosqes != NVME_SQES || iocqes != NVME_CQES) {
+        trace_pci_nvme_err_invalid_create_cq_entry_size(iosqes, iocqes);
+        return NVME_MAX_QSIZE_EXCEEDED | NVME_DNR;
+    }
+
     if (unlikely(!cqid || cqid > n->conf_ioqpairs || n->cq[cqid] != NULL)) {
         trace_pci_nvme_err_invalid_create_cq_cqid(cqid);
         return NVME_INVALID_QID | NVME_DNR;
@@ -6981,7 +6989,7 @@ static void nvme_process_sq(void *opaque)
     }
 
     while (!(nvme_sq_empty(sq) || QTAILQ_EMPTY(&sq->req_list))) {
-        addr = sq->dma_addr + sq->head * n->sqe_size;
+        addr = sq->dma_addr + (sq->head << NVME_SQES);
         if (nvme_addr_read(n, addr, (void *)&cmd, sizeof(cmd))) {
             trace_pci_nvme_err_addr_read(addr);
             trace_pci_nvme_err_cfs();
@@ -7208,34 +7216,6 @@ static int nvme_start_ctrl(NvmeCtrl *n)
                     NVME_CAP_MPSMAX(cap));
         return -1;
     }
-    if (unlikely(NVME_CC_IOCQES(cc) <
-                 NVME_CTRL_CQES_MIN(n->id_ctrl.cqes))) {
-        trace_pci_nvme_err_startfail_cqent_too_small(
-                    NVME_CC_IOCQES(cc),
-                    NVME_CTRL_CQES_MIN(cap));
-        return -1;
-    }
-    if (unlikely(NVME_CC_IOCQES(cc) >
-                 NVME_CTRL_CQES_MAX(n->id_ctrl.cqes))) {
-        trace_pci_nvme_err_startfail_cqent_too_large(
-                    NVME_CC_IOCQES(cc),
-                    NVME_CTRL_CQES_MAX(cap));
-        return -1;
-    }
-    if (unlikely(NVME_CC_IOSQES(cc) <
-                 NVME_CTRL_SQES_MIN(n->id_ctrl.sqes))) {
-        trace_pci_nvme_err_startfail_sqent_too_small(
-                    NVME_CC_IOSQES(cc),
-                    NVME_CTRL_SQES_MIN(cap));
-        return -1;
-    }
-    if (unlikely(NVME_CC_IOSQES(cc) >
-                 NVME_CTRL_SQES_MAX(n->id_ctrl.sqes))) {
-        trace_pci_nvme_err_startfail_sqent_too_large(
-                    NVME_CC_IOSQES(cc),
-                    NVME_CTRL_SQES_MAX(cap));
-        return -1;
-    }
     if (unlikely(!NVME_AQA_ASQS(aqa))) {
         trace_pci_nvme_err_startfail_asqent_sz_zero();
         return -1;
@@ -7248,8 +7228,6 @@ static int nvme_start_ctrl(NvmeCtrl *n)
     n->page_bits = page_bits;
     n->page_size = page_size;
     n->max_prp_ents = n->page_size / sizeof(uint64_t);
-    n->cqe_size = 1 << NVME_CC_IOCQES(cc);
-    n->sqe_size = 1 << NVME_CC_IOSQES(cc);
     nvme_init_cq(&n->admin_cq, n, acq, 0, 0, NVME_AQA_ACQS(aqa) + 1, 1);
     nvme_init_sq(&n->admin_sq, n, asq, 0, 0, NVME_AQA_ASQS(aqa) + 1);
 
@@ -8221,8 +8199,8 @@ static void nvme_init_ctrl(NvmeCtrl *n, PCIDevice *pci_dev)
     id->wctemp = cpu_to_le16(NVME_TEMPERATURE_WARNING);
     id->cctemp = cpu_to_le16(NVME_TEMPERATURE_CRITICAL);
 
-    id->sqes = (0x6 << 4) | 0x6;
-    id->cqes = (0x4 << 4) | 0x4;
+    id->sqes = (NVME_SQES << 4) | NVME_SQES;
+    id->cqes = (NVME_CQES << 4) | NVME_CQES;
     id->nn = cpu_to_le32(NVME_MAX_NAMESPACES);
     id->oncs = cpu_to_le16(NVME_ONCS_WRITE_ZEROES | NVME_ONCS_TIMESTAMP |
                            NVME_ONCS_FEATURES | NVME_ONCS_DSM |
diff --git a/hw/nvme/nvme.h b/hw/nvme/nvme.h
index 209e8f5b4c..5f2ae7b28b 100644
--- a/hw/nvme/nvme.h
+++ b/hw/nvme/nvme.h
@@ -30,6 +30,13 @@
 #define NVME_FDP_MAX_EVENTS 63
 #define NVME_FDP_MAXPIDS 128
 
+/*
+ * The controller only supports Submission and Completion Queue Entry Sizes of
+ * 64 and 16 bytes respectively.
+ */
+#define NVME_SQES 6
+#define NVME_CQES 4
+
 QEMU_BUILD_BUG_ON(NVME_MAX_NAMESPACES > NVME_NSID_BROADCAST - 1);
 
 typedef struct NvmeCtrl NvmeCtrl;
@@ -530,8 +537,6 @@ typedef struct NvmeCtrl {
     uint32_t    page_size;
     uint16_t    page_bits;
     uint16_t    max_prp_ents;
-    uint16_t    cqe_size;
-    uint16_t    sqe_size;
     uint32_t    max_q_ents;
     uint8_t     outstanding_aers;
     uint32_t    irq_status;
diff --git a/hw/nvme/trace-events b/hw/nvme/trace-events
index 7f7837e1a2..75083e992d 100644
--- a/hw/nvme/trace-events
+++ b/hw/nvme/trace-events
@@ -168,6 +168,7 @@ pci_nvme_err_invalid_create_cq_size(uint16_t size) "failed creating completion q
 pci_nvme_err_invalid_create_cq_addr(uint64_t addr) "failed creating completion queue, addr=0x%"PRIx64""
 pci_nvme_err_invalid_create_cq_vector(uint16_t vector) "failed creating completion queue, vector=%"PRIu16""
 pci_nvme_err_invalid_create_cq_qflags(uint16_t qflags) "failed creating completion queue, qflags=%"PRIu16""
+pci_nvme_err_invalid_create_cq_entry_size(uint8_t iosqes, uint8_t iocqes) "iosqes %"PRIu8" iocqes %"PRIu8""
 pci_nvme_err_invalid_identify_cns(uint16_t cns) "identify, invalid cns=0x%"PRIx16""
 pci_nvme_err_invalid_getfeat(int dw10) "invalid get features, dw10=0x%"PRIx32""
 pci_nvme_err_invalid_setfeat(uint32_t dw10) "invalid set features, dw10=0x%"PRIx32""
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:14:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:14:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815716.1229763 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoJV-0003SD-La; Thu, 10 Oct 2024 08:14:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815716.1229763; Thu, 10 Oct 2024 08:14:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoJV-0003S3-Io; Thu, 10 Oct 2024 08:14:25 +0000
Received: by outflank-mailman (input) for mailman id 815716;
 Thu, 10 Oct 2024 08:14: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 1syoJU-0003Rs-Id
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:14: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 1syoJU-0006xP-I2
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:14:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoJU-0004bW-HN
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:14:24 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=6dNr/R8GH6eZJrXbKtXp9UeI3Z6v2bwHNjp4nLFmz1Y=; b=Kwdjnw1O0H4hFtUl0HFobvWutc
	khndq43EsH9LP2pTSq0yiogwGyhhuoeoq2jTDH8t0kSG0p3T816NlOQFSaWgPrDCO5ACsyhden4vA
	4LoIvXNvTK9GSwrAZ3um2qcUDUY7NLrXrFTz1vYPTwkpBEH1NZZkQMveiKsrrQKQCZ1o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/nvme: fix CRC64 for guard tag
Message-Id: <E1syoJU-0004bW-HN@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:14:24 +0000

commit f47369c3d114ddd2021d9ca2cdde9fe138675bcb
Author:     Ankit Kumar <ankit.kumar@samsung.com>
AuthorDate: Tue Aug 8 02:57:43 2023 +0530
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/nvme: fix CRC64 for guard tag
    
    The nvme CRC64 generator expects the caller to pass inverted seed value.
    Pass inverted crc value for metadata buffer.
    
    Cc: qemu-stable@nongnu.org
    Fixes: 44219b6029fc ("hw/nvme: 64-bit pi support")
    Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
    (cherry picked from commit dbdb13f931d7cf2d3c3ca662e751bb1551e9eab6)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/nvme/dif.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/nvme/dif.c b/hw/nvme/dif.c
index 63c44c86ab..01b19c3373 100644
--- a/hw/nvme/dif.c
+++ b/hw/nvme/dif.c
@@ -115,7 +115,7 @@ static void nvme_dif_pract_generate_dif_crc64(NvmeNamespace *ns, uint8_t *buf,
         uint64_t crc = crc64_nvme(~0ULL, buf, ns->lbasz);
 
         if (pil) {
-            crc = crc64_nvme(crc, mbuf, pil);
+            crc = crc64_nvme(~crc, mbuf, pil);
         }
 
         dif->g64.guard = cpu_to_be64(crc);
@@ -246,7 +246,7 @@ static uint16_t nvme_dif_prchk_crc64(NvmeNamespace *ns, NvmeDifTuple *dif,
         uint64_t crc = crc64_nvme(~0ULL, buf, ns->lbasz);
 
         if (pil) {
-            crc = crc64_nvme(crc, mbuf, pil);
+            crc = crc64_nvme(~crc, mbuf, pil);
         }
 
         trace_pci_nvme_dif_prchk_guard_crc64(be64_to_cpu(dif->g64.guard), crc);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:14:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:14:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815717.1229766 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoJf-0003Uj-Mm; Thu, 10 Oct 2024 08:14:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815717.1229766; Thu, 10 Oct 2024 08:14:35 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoJf-0003Ub-KC; Thu, 10 Oct 2024 08:14:35 +0000
Received: by outflank-mailman (input) for mailman id 815717;
 Thu, 10 Oct 2024 08:14: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 1syoJe-0003UT-N3
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:14: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 1syoJe-0006xf-LL
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:14:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoJe-0004cJ-KV
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:14:34 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=mtx5CQnGcGfT6NwRAKaVgvb/rmhyYAVplf0CC8J4fWE=; b=GTo9OuzZPt3P1bLHOdONjqBrDk
	a0l/CP7EK236GHRsX9PAlvmRsInv6kdJCTo5yyIsFsFChI+NRHtpmnJ4WJr+zPoMCy2lvtlLYsrfa
	0WKe9PfdkLLdsqB89pHOcYG7Q78yFnB/mZfY9GgsdiTckJ9ggIy9M1NASGfbCjEe3fxo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/nvme: fix null pointer access in directive receive
Message-Id: <E1syoJe-0004cJ-KV@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:14:34 +0000

commit 43328764f7a0c4371f0142a8cee6dcdbeecfa633
Author:     Klaus Jensen <k.jensen@samsung.com>
AuthorDate: Tue Aug 8 17:16:13 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/nvme: fix null pointer access in directive receive
    
    nvme_directive_receive() does not check if an endurance group has been
    configured (set) prior to testing if flexible data placement is enabled
    or not.
    
    Fix this.
    
    Cc: qemu-stable@nongnu.org
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1815
    Fixes: 73064edfb864 ("hw/nvme: flexible data placement emulation")
    Reviewed-by: Jesper Wendel Devantier <j.devantier@samsung.com>
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
    (cherry picked from commit 6c8f8456cb0b239812dee5211881426496da7b98)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/nvme/ctrl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index 00b910ca9e..ac505727e5 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -6877,7 +6877,7 @@ static uint16_t nvme_directive_receive(NvmeCtrl *n, NvmeRequest *req)
     case NVME_DIRECTIVE_IDENTIFY:
         switch (doper) {
         case NVME_DIRECTIVE_RETURN_PARAMS:
-            if (ns->endgrp->fdp.enabled) {
+            if (ns->endgrp && ns->endgrp->fdp.enabled) {
                 id.supported |= 1 << NVME_DIRECTIVE_DATA_PLACEMENT;
                 id.enabled |= 1 << NVME_DIRECTIVE_DATA_PLACEMENT;
                 id.persistent |= 1 << NVME_DIRECTIVE_DATA_PLACEMENT;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:14:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:14:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815718.1229770 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoJq-0003XU-OL; Thu, 10 Oct 2024 08:14:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815718.1229770; Thu, 10 Oct 2024 08:14: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 1syoJq-0003XM-Ld; Thu, 10 Oct 2024 08:14:46 +0000
Received: by outflank-mailman (input) for mailman id 815718;
 Thu, 10 Oct 2024 08:14: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 1syoJo-0003X3-Qr
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:14: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 1syoJo-0006xs-OZ
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:14:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoJo-0004cz-No
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:14:44 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zUCKvbLlf6dut8Ggufnh8Zd1FN+H4H097xUFMmIfB8c=; b=DEBAVqSqHxchSBs2YFq6syQVEv
	iA3gvgXZtETUyT8plPRp69ytH8vonalys/trv+yZEf8thzx97m2Z+Vm8bjsQNv7gy7KZUiUwVg1BM
	x6rWZiCRcZ36wVwM5JlWFHqc0v3iPWzuuDK+bjDlZKy4kvWhWrCt9BE6BWpIMc/hYQLw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/nvme: fix null pointer access in ruh update
Message-Id: <E1syoJo-0004cz-No@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:14:44 +0000

commit bb5f9036d5f6914215c75e19048444b2ce06b190
Author:     Klaus Jensen <k.jensen@samsung.com>
AuthorDate: Tue Aug 8 17:16:14 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/nvme: fix null pointer access in ruh update
    
    The Reclaim Unit Update operation in I/O Management Receive does not
    verify the presence of a configured endurance group prior to accessing
    it.
    
    Fix this.
    
    Cc: qemu-stable@nongnu.org
    Fixes: 73064edfb864 ("hw/nvme: flexible data placement emulation")
    Reviewed-by: Jesper Wendel Devantier <j.devantier@samsung.com>
    Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
    (cherry picked from commit 3439ba9c5da943d96f7a3c86e0a7eb2ff48de41c)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/nvme/ctrl.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c
index ac505727e5..c71d57d17a 100644
--- a/hw/nvme/ctrl.c
+++ b/hw/nvme/ctrl.c
@@ -4333,7 +4333,13 @@ static uint16_t nvme_io_mgmt_send_ruh_update(NvmeCtrl *n, NvmeRequest *req)
     uint32_t npid = (cdw10 >> 1) + 1;
     unsigned int i = 0;
     g_autofree uint16_t *pids = NULL;
-    uint32_t maxnpid = n->subsys->endgrp.fdp.nrg * n->subsys->endgrp.fdp.nruh;
+    uint32_t maxnpid;
+
+    if (!ns->endgrp || !ns->endgrp->fdp.enabled) {
+        return NVME_FDP_DISABLED | NVME_DNR;
+    }
+
+    maxnpid = n->subsys->endgrp.fdp.nrg * n->subsys->endgrp.fdp.nruh;
 
     if (unlikely(npid >= MIN(NVME_FDP_MAXPIDS, maxnpid))) {
         return NVME_INVALID_FIELD | NVME_DNR;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:14:56 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:14:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815719.1229774 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoK0-0003Zp-Pe; Thu, 10 Oct 2024 08:14:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815719.1229774; Thu, 10 Oct 2024 08:14: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 1syoK0-0003Zh-N2; Thu, 10 Oct 2024 08:14:56 +0000
Received: by outflank-mailman (input) for mailman id 815719;
 Thu, 10 Oct 2024 08:14: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 1syoJy-0003ZZ-SE
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:14: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 1syoJy-0006yF-RZ
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:14:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoJy-0004do-Qu
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:14:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3JAqL+PcLxbSE9d4GhUffszd6Ywp9XAV9S078qcxwhM=; b=ggM6IThwTDYzEtk11iYp1j6/LH
	RB6LsuN0ElcIzHLfgVy002IogOYXfQG4awcnZnzUfABGT5wlsxyvhk+TjRXmvS7dgr/x+u9var5o1
	IQ3Jva80DcgZFJZdLqtjz/5aoR/WqCHFoWK2VzhoBLVBOBPr/3TZlHDC0eBa5e5VZIyI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] linux-user/elfload: Set V in ELF_HWCAP for RISC-V
Message-Id: <E1syoJy-0004do-Qu@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:14:54 +0000

commit ee638bc5b53cff87768b0b7c6d2c4a4e275994f6
Author:     Nathan Egge <negge@xiph.org>
AuthorDate: Thu Aug 3 09:14:24 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    linux-user/elfload: Set V in ELF_HWCAP for RISC-V
    
    Set V bit for hwcap if misa is set.
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1793
    Signed-off-by: Nathan Egge <negge@xiph.org>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Message-Id: <20230803131424.40744-1-negge@xiph.org>
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    (cherry picked from commit 4333f0924c2f2ca8efaebaed8c24f55f77d8b013)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 linux-user/elfload.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 88ef26dc03..a3e78a7e18 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -1679,7 +1679,8 @@ static uint32_t get_elf_hwcap(void)
 #define MISA_BIT(EXT) (1 << (EXT - 'A'))
     RISCVCPU *cpu = RISCV_CPU(thread_cpu);
     uint32_t mask = MISA_BIT('I') | MISA_BIT('M') | MISA_BIT('A')
-                    | MISA_BIT('F') | MISA_BIT('D') | MISA_BIT('C');
+                    | MISA_BIT('F') | MISA_BIT('D') | MISA_BIT('C')
+                    | MISA_BIT('V');
 
     return cpu->env.misa_ext & mask;
 #undef MISA_BIT
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:15:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:15:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815720.1229778 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoKA-0003cR-Qy; Thu, 10 Oct 2024 08:15:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815720.1229778; Thu, 10 Oct 2024 08:15: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 1syoKA-0003cJ-OU; Thu, 10 Oct 2024 08:15:06 +0000
Received: by outflank-mailman (input) for mailman id 815720;
 Thu, 10 Oct 2024 08:15: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 1syoK8-0003c9-VZ
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:15: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 1syoK8-0006yw-Ur
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:15:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoK8-0004gX-U4
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:15:04 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=X2rRFj55PfsAvGm9tz2PB+LLc/yRNsUD7xD9cvJmF8s=; b=neU5wJ65q6hlcpUfESCB+WbqwO
	gV1pHHt9/obmyzKYhOgmBPX3ISkUNjlFcejMJcxS6i348gd+XC21USd8zgm+/nhFydUBNJ+FBLH9c
	DF452jRECnfffnse2CVBGYUXTGLHM785DHQRqjDcDwUGITAfXiXTC4rmNoTdtj1gzK18=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for microblaze
Message-Id: <E1syoK8-0004gX-U4@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:15:04 +0000

commit 43d2db492878f7931457d6d4d9097f9573917c6d
Author:     Richard Henderson <richard.henderson@linaro.org>
AuthorDate: Sat Jun 3 14:55:03 2023 -0700
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for microblaze
    
    Based on gcc's microblaze.h setting BIGGEST_ALIGNMENT to 32 bits.
    
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    (cherry picked from commit e73f27003e777fd9b77d13e71c5268015b8ed2b6)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 include/exec/user/abitypes.h | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/exec/user/abitypes.h b/include/exec/user/abitypes.h
index 743b8bb9ea..beba0a48c7 100644
--- a/include/exec/user/abitypes.h
+++ b/include/exec/user/abitypes.h
@@ -15,7 +15,9 @@
 #define ABI_LLONG_ALIGNMENT 2
 #endif
 
-#if (defined(TARGET_I386) && !defined(TARGET_X86_64)) || defined(TARGET_SH4)
+#if (defined(TARGET_I386) && !defined(TARGET_X86_64)) \
+    || defined(TARGET_SH4) \
+    || defined(TARGET_MICROBLAZE)
 #define ABI_LLONG_ALIGNMENT 4
 #endif
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:15:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:15:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815721.1229782 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoKK-0003f4-Sc; Thu, 10 Oct 2024 08:15:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815721.1229782; Thu, 10 Oct 2024 08:15: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 1syoKK-0003ew-Pu; Thu, 10 Oct 2024 08:15:16 +0000
Received: by outflank-mailman (input) for mailman id 815721;
 Thu, 10 Oct 2024 08:15: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 1syoKJ-0003ej-2d
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:15: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 1syoKJ-0006z4-1z
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:15:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoKJ-0004hI-17
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:15: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=Yg5KsVg5NFquGK6TrIQ6OzbHX3vRJrqnRL7xTdPvIoA=; b=WVsLaQy9ihy3vtUBm3flASGUnM
	aq3P3pmAoLQnIIEe5/Dji+rLCZqEGv4nOHnZJdP+3hxDnHYkBWWAKxD3li83Z+rSd5DtguTLagSjZ
	Qp0Z4ID7r9zHdEXZ/qqde6W296vxB0UQ6q2DzPcagQZGrKuyRSN5vyrT37luv1ZN0CPc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for nios2
Message-Id: <E1syoKJ-0004hI-17@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:15:15 +0000

commit 40cfe12cb6f8b9d3a1172af2e65540773ad17be1
Author:     Richard Henderson <richard.henderson@linaro.org>
AuthorDate: Sat Jun 3 14:58:46 2023 -0700
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    include/exec/user: Set ABI_LLONG_ALIGNMENT to 4 for nios2
    
    Based on gcc's nios2.h setting BIGGEST_ALIGNMENT to 32 bits.
    
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    (cherry picked from commit ea9812d93f9c3e1a308ac33097021c50d581d10e)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 include/exec/user/abitypes.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/exec/user/abitypes.h b/include/exec/user/abitypes.h
index beba0a48c7..6191ce9f74 100644
--- a/include/exec/user/abitypes.h
+++ b/include/exec/user/abitypes.h
@@ -17,7 +17,8 @@
 
 #if (defined(TARGET_I386) && !defined(TARGET_X86_64)) \
     || defined(TARGET_SH4) \
-    || defined(TARGET_MICROBLAZE)
+    || defined(TARGET_MICROBLAZE) \
+    || defined(TARGET_NIOS2)
 #define ABI_LLONG_ALIGNMENT 4
 #endif
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:15:27 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:15:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815722.1229786 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoKU-0003hs-UH; Thu, 10 Oct 2024 08:15:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815722.1229786; Thu, 10 Oct 2024 08:15: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 1syoKU-0003hk-RJ; Thu, 10 Oct 2024 08:15:26 +0000
Received: by outflank-mailman (input) for mailman id 815722;
 Thu, 10 Oct 2024 08:15: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 1syoKT-0003hZ-5Y
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:15: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 1syoKT-0006zB-4q
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:15:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoKT-0004i1-4D
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:15:25 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ds4giD/PcThvX7SuAABcICj1S5WLaaZ1665tgCk7nOU=; b=UtoK7NKOgkShzKPQXT4/37bskl
	h1/+ULYmtU6wE1zhi+WcPH4erjKRCzBoqwS/rCNi/wo5hXGzsRkLnto/UK83dPCNUoffj/z3bD+aw
	Gr0QuS8xZ9NTGO8LTCvziEY+r97mYPtSk8DpXf/hmj+NX4eSw1C/gR9wNWgIWuY0VR7E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] Fixed incorrect LLONG alignment for openrisc and cris
Message-Id: <E1syoKT-0004i1-4D@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:15:25 +0000

commit af0c16fae9532033453f8c208ad1e2e78701de5c
Author:     Luca Bonissi <qemu@bonslack.org>
AuthorDate: Thu Aug 3 02:15:57 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    Fixed incorrect LLONG alignment for openrisc and cris
    
    OpenRISC (or1k) has long long alignment to 4 bytes, but currently not
    defined in abitypes.h. This lead to incorrect packing of /epoll_event/
    structure and eventually infinite loop while waiting for file
    descriptor[s] event[s].
    
    Fixed also CRIS alignments (1 byte for all types).
    
    Signed-off-by: Luca Bonissi <qemu@bonslack.org>
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1770
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (cherry picked from commit 6ee960823da8fd780ae9912c4327b7e85e80d846)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 include/exec/user/abitypes.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/exec/user/abitypes.h b/include/exec/user/abitypes.h
index 6191ce9f74..6178453d94 100644
--- a/include/exec/user/abitypes.h
+++ b/include/exec/user/abitypes.h
@@ -15,8 +15,16 @@
 #define ABI_LLONG_ALIGNMENT 2
 #endif
 
+#ifdef TARGET_CRIS
+#define ABI_SHORT_ALIGNMENT 1
+#define ABI_INT_ALIGNMENT 1
+#define ABI_LONG_ALIGNMENT 1
+#define ABI_LLONG_ALIGNMENT 1
+#endif
+
 #if (defined(TARGET_I386) && !defined(TARGET_X86_64)) \
     || defined(TARGET_SH4) \
+    || defined(TARGET_OPENRISC) \
     || defined(TARGET_MICROBLAZE) \
     || defined(TARGET_NIOS2)
 #define ABI_LLONG_ALIGNMENT 4
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:15:36 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:15:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815723.1229790 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoKe-0003lw-VO; Thu, 10 Oct 2024 08:15:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815723.1229790; Thu, 10 Oct 2024 08:15: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 1syoKe-0003lo-Si; Thu, 10 Oct 2024 08:15:36 +0000
Received: by outflank-mailman (input) for mailman id 815723;
 Thu, 10 Oct 2024 08:15: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 1syoKd-0003le-8P
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:15: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 1syoKd-0006zJ-7m
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:15:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoKd-0004ii-77
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:15: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=emZttNg2lZaS9CFZJPG+E0ImnqHwriw5EyxxS6v9py8=; b=od8CETACK4VLvXewNx/ybDKXN3
	UXdwsMnXcOXKKMa73Drb7bFxLKwuWO71Cy0OO2GaaBcvG+MPm3EqEpBTOSBZO5cyqkcT1JHW1E8kz
	l8Qt8b9q3vmw8QeWqyBbSJLB+fiOIhrwnu3nnOohcBCRfmAOWYorwOKDA3TZQNhR2XeQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/sd/sdhci: Do not force sdhci_mmio_*_ops onto all SD controllers
Message-Id: <E1syoKd-0004ii-77@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:15:35 +0000

commit b4b3aac5b542557c63bc24049b61c2640ad90dd9
Author:     Bernhard Beschow <shentey@gmail.com>
AuthorDate: Sun Jul 9 10:09:50 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/sd/sdhci: Do not force sdhci_mmio_*_ops onto all SD controllers
    
    Since commit c0a55a0c9da2 "hw/sd/sdhci: Support big endian SD host controller
    interfaces" sdhci_common_realize() forces all SD card controllers to use either
    sdhci_mmio_le_ops or sdhci_mmio_be_ops, depending on the "endianness" property.
    However, there are device models which use different MMIO ops: TYPE_IMX_USDHC
    uses usdhc_mmio_ops and TYPE_S3C_SDHCI uses sdhci_s3c_mmio_ops.
    
    Forcing sdhci_mmio_le_ops breaks SD card handling on the "sabrelite" board, for
    example. Fix this by defaulting the io_ops to little endian and switch to big
    endian in sdhci_common_realize() only if there is a matchig big endian variant
    available.
    
    Fixes: c0a55a0c9da2 ("hw/sd/sdhci: Support big endian SD host controller
    interfaces")
    
    Signed-off-by: Bernhard Beschow <shentey@gmail.com>
    Tested-by: Guenter Roeck <linux@roeck-us.net>
    Message-Id: <20230709080950.92489-1-shentey@gmail.com>
    (cherry picked from commit 3b830790151ff231531ef2595793e387dd154efb)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/sd/sdhci.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index 6811f0f1a8..362c2c86aa 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -1382,6 +1382,8 @@ void sdhci_initfn(SDHCIState *s)
 
     s->insert_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, sdhci_raise_insertion_irq, s);
     s->transfer_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, sdhci_data_transfer, s);
+
+    s->io_ops = &sdhci_mmio_le_ops;
 }
 
 void sdhci_uninitfn(SDHCIState *s)
@@ -1399,9 +1401,13 @@ void sdhci_common_realize(SDHCIState *s, Error **errp)
 
     switch (s->endianness) {
     case DEVICE_LITTLE_ENDIAN:
-        s->io_ops = &sdhci_mmio_le_ops;
+        /* s->io_ops is little endian by default */
         break;
     case DEVICE_BIG_ENDIAN:
+        if (s->io_ops != &sdhci_mmio_le_ops) {
+            error_setg(errp, "SD controller doesn't support big endianness");
+            return;
+        }
         s->io_ops = &sdhci_mmio_be_ops;
         break;
     default:
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:15:47 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:15:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815724.1229795 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoKp-0003ok-1G; Thu, 10 Oct 2024 08:15:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815724.1229795; Thu, 10 Oct 2024 08:15: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 1syoKo-0003oc-UA; Thu, 10 Oct 2024 08:15:46 +0000
Received: by outflank-mailman (input) for mailman id 815724;
 Thu, 10 Oct 2024 08:15: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 1syoKn-0003oJ-BD
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:15: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 1syoKn-0006zQ-AZ
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:15:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoKn-0004jS-9w
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:15: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=XSRVIdCTwS/dHwwSQtB4gr8kLT7/uBQY+0DVLjHrp4w=; b=5n4sGPs5J3gxF2i79PZeT9fHfU
	OtJxkphqXvfEsmEtyhvWZTzYp4PwEgDyEHtIQwLa0fGu0bcdOeP7CmdbUNiFcTTjJUrJ9DxOconoz
	7QGh47nNyqsKZYpwKZIoPfbTVjJzuxJtD70FL2TFtOFiVbyjNcftg7HUsIJZj4IzNZDA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] target/s390x: Fix the "ignored match" case in VSTRS
Message-Id: <E1syoKn-0004jS-9w@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:15:45 +0000

commit 179a37924d55e645e660731f0e389d70a277a1c2
Author:     Ilya Leoshkevich <iii@linux.ibm.com>
AuthorDate: Sat Aug 5 01:03:18 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/s390x: Fix the "ignored match" case in VSTRS
    
    Currently the emulation of VSTRS recognizes partial matches in presence
    of \0 in the haystack, which, according to PoP, is not correct:
    
        If the ZS flag is one and a zero byte was detected
        in the second operand, then there can not be a
        partial match ...
    
    Add a check for this. While at it, fold a number of explicitly handled
    special cases into the generic logic.
    
    Cc: qemu-stable@nongnu.org
    Reported-by: Claudio Fontana <cfontana@suse.de>
    Closes: https://lists.gnu.org/archive/html/qemu-devel/2023-08/msg00633.html
    Fixes: 1d706f314191 ("target/s390x: vxeh2: vector string search")
    Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
    Message-Id: <20230804233748.218935-3-iii@linux.ibm.com>
    Tested-by: Claudio Fontana <cfontana@suse.de>
    Acked-by: David Hildenbrand <david@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 791b2b6a930273db694b9ba48bbb406e78715927)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/s390x/tcg/vec_string_helper.c | 54 ++++++++++++------------------------
 1 file changed, 17 insertions(+), 37 deletions(-)

diff --git a/target/s390x/tcg/vec_string_helper.c b/target/s390x/tcg/vec_string_helper.c
index 9b85becdfb..a19f429768 100644
--- a/target/s390x/tcg/vec_string_helper.c
+++ b/target/s390x/tcg/vec_string_helper.c
@@ -474,9 +474,9 @@ DEF_VSTRC_CC_RT_HELPER(32)
 static int vstrs(S390Vector *v1, const S390Vector *v2, const S390Vector *v3,
                  const S390Vector *v4, uint8_t es, bool zs)
 {
-    int substr_elen, substr_0, str_elen, i, j, k, cc;
+    int substr_elen, i, j, k, cc;
     int nelem = 16 >> es;
-    bool eos = false;
+    int str_leftmost_0;
 
     substr_elen = s390_vec_read_element8(v4, 7) >> es;
 
@@ -498,47 +498,20 @@ static int vstrs(S390Vector *v1, const S390Vector *v2, const S390Vector *v3,
     }
 
     /* If ZS, look for eos in the searched string. */
+    str_leftmost_0 = nelem;
     if (zs) {
         for (k = 0; k < nelem; k++) {
             if (s390_vec_read_element(v2, k, es) == 0) {
-                eos = true;
+                str_leftmost_0 = k;
                 break;
             }
         }
-        str_elen = k;
-    } else {
-        str_elen = nelem;
     }
 
-    substr_0 = s390_vec_read_element(v3, 0, es);
-
-    for (k = 0; ; k++) {
-        for (; k < str_elen; k++) {
-            if (s390_vec_read_element(v2, k, es) == substr_0) {
-                break;
-            }
-        }
-
-        /* If we reached the end of the string, no match. */
-        if (k == str_elen) {
-            cc = eos; /* no match (with or without zero char) */
-            goto done;
-        }
-
-        /* If the substring is only one char, match. */
-        if (substr_elen == 1) {
-            cc = 2; /* full match */
-            goto done;
-        }
-
-        /* If the match begins at the last char, we have a partial match. */
-        if (k == str_elen - 1) {
-            cc = 3; /* partial match */
-            goto done;
-        }
-
+    cc = str_leftmost_0 == nelem ? 0 : 1;  /* No match. */
+    for (k = 0; k < nelem; k++) {
         i = MIN(nelem, k + substr_elen);
-        for (j = k + 1; j < i; j++) {
+        for (j = k; j < i; j++) {
             uint32_t e2 = s390_vec_read_element(v2, j, es);
             uint32_t e3 = s390_vec_read_element(v3, j - k, es);
             if (e2 != e3) {
@@ -546,9 +519,16 @@ static int vstrs(S390Vector *v1, const S390Vector *v2, const S390Vector *v3,
             }
         }
         if (j == i) {
-            /* Matched up until "end". */
-            cc = i - k == substr_elen ? 2 : 3; /* full or partial match */
-            goto done;
+            /* All elements matched. */
+            if (k > str_leftmost_0) {
+                cc = 1;  /* Ignored match. */
+                k = nelem;
+            } else if (i - k == substr_elen) {
+                cc = 2;  /* Full match. */
+            } else {
+                cc = 3;  /* Partial match. */
+            }
+            break;
         }
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:15:57 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:15:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815725.1229797 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoKz-0003rd-3U; Thu, 10 Oct 2024 08:15:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815725.1229797; Thu, 10 Oct 2024 08:15: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 1syoKz-0003rV-0z; Thu, 10 Oct 2024 08:15:57 +0000
Received: by outflank-mailman (input) for mailman id 815725;
 Thu, 10 Oct 2024 08:15: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 1syoKx-0003rI-EE
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:15: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 1syoKx-0006zq-DX
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:15:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoKx-0004k8-Cv
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:15: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=8pMKtavx5I4v3twlYkSm5h9GFbD+Ih6oANRQmyqLySg=; b=uMPvHOcxRHvMz/gUvdmgv8t6MU
	Lqqyq/nitn6aHnBVnqHi3LoLzV91n7kXVoyzedXUFjqRDNrw6vxIyiF4RCwYdf9fYVojznfFdbv9f
	tL6C15gJ70wUw5zO2NwCiGNe4HQO8GfFJMb1NvebcVby8esWgLyxSRNNx2duvfdX5AzM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] target/s390x: Use a 16-bit immediate in VREP
Message-Id: <E1syoKx-0004k8-Cv@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:15:55 +0000

commit 14f78932e02c15e59f3a0894a08159cd00712765
Author:     Ilya Leoshkevich <iii@linux.ibm.com>
AuthorDate: Mon Aug 7 18:34:31 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/s390x: Use a 16-bit immediate in VREP
    
    Unlike most other instructions that contain an immediate element index,
    VREP's one is 16-bit, and not 4-bit. The code uses only 8 bits, so
    using, e.g., 0x101 does not lead to a specification exception.
    
    Fix by checking all 16 bits.
    
    Cc: qemu-stable@nongnu.org
    Fixes: 28d08731b1d8 ("s390x/tcg: Implement VECTOR REPLICATE")
    Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
    Message-Id: <20230807163459.849766-1-iii@linux.ibm.com>
    Reviewed-by: David Hildenbrand <david@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 23e87d419f347b6b5f4da3bf70d222acc24cdb64)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/s390x/tcg/translate_vx.c.inc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/s390x/tcg/translate_vx.c.inc b/target/s390x/tcg/translate_vx.c.inc
index f8df121d3d..a6d840d406 100644
--- a/target/s390x/tcg/translate_vx.c.inc
+++ b/target/s390x/tcg/translate_vx.c.inc
@@ -57,7 +57,7 @@
 #define FPF_LONG        3
 #define FPF_EXT         4
 
-static inline bool valid_vec_element(uint8_t enr, MemOp es)
+static inline bool valid_vec_element(uint16_t enr, MemOp es)
 {
     return !(enr & ~(NUM_VEC_ELEMENTS(es) - 1));
 }
@@ -964,7 +964,7 @@ static DisasJumpType op_vpdi(DisasContext *s, DisasOps *o)
 
 static DisasJumpType op_vrep(DisasContext *s, DisasOps *o)
 {
-    const uint8_t enr = get_field(s, i2);
+    const uint16_t enr = get_field(s, i2);
     const uint8_t es = get_field(s, m4);
 
     if (es > ES_64 || !valid_vec_element(enr, es)) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:16:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:16:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815726.1229802 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoL9-0003tr-51; Thu, 10 Oct 2024 08:16:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815726.1229802; Thu, 10 Oct 2024 08:16: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 1syoL9-0003tj-2L; Thu, 10 Oct 2024 08:16:07 +0000
Received: by outflank-mailman (input) for mailman id 815726;
 Thu, 10 Oct 2024 08:16: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 1syoL7-0003tZ-HF
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:16: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 1syoL7-00070B-GT
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:16:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoL7-0004nF-Fo
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:16: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=SwaxFieLrBmvzFcsrvnBLpdxnd5FFuFZlkCca1/U4Ao=; b=F4AZtdLPq8lQhVLzduWR7xM8gi
	xTbfSOuIiMMqNQtzqtyDif7v449UbcVSSHg/MdM0MGEWiIrOhTn4Po1XWkhOLV/1twS5w31OYtwlw
	SGyk0WCAG7WI6tMlrXUkyXG4LLKXkBtYS862kiDOYk2eL4qN3nvmQ45yg2+ZZO7iTDXo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] target/s390x: Fix VSTL with a large length
Message-Id: <E1syoL7-0004nF-Fo@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:16:05 +0000

commit 62ac9cbb6fe2d088dd56cd258c61b033f610fe6f
Author:     Ilya Leoshkevich <iii@linux.ibm.com>
AuthorDate: Sat Aug 5 01:55:33 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/s390x: Fix VSTL with a large length
    
    The length is always truncated to 16 bytes. Do not probe more than
    that.
    
    Cc: qemu-stable@nongnu.org
    Fixes: 0e0a5b49ad58 ("s390x/tcg: Implement VECTOR STORE WITH LENGTH")
    Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
    Message-Id: <20230804235624.263260-1-iii@linux.ibm.com>
    Reviewed-by: David Hildenbrand <david@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 6db3518ba4fcddd71049718f138552999f0d97b4)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/s390x/tcg/vec_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/s390x/tcg/vec_helper.c b/target/s390x/tcg/vec_helper.c
index 48d86722b2..dafc4c3582 100644
--- a/target/s390x/tcg/vec_helper.c
+++ b/target/s390x/tcg/vec_helper.c
@@ -193,7 +193,7 @@ void HELPER(vstl)(CPUS390XState *env, const void *v1, uint64_t addr,
                   uint64_t bytes)
 {
     /* Probe write access before actually modifying memory */
-    probe_write_access(env, addr, bytes, GETPC());
+    probe_write_access(env, addr, MIN(bytes, 16), GETPC());
 
     if (likely(bytes >= 16)) {
         cpu_stq_data_ra(env, addr, s390_vec_read_element64(v1, 0), GETPC());
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:16:19 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:16:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815727.1229808 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoLJ-0003wR-71; Thu, 10 Oct 2024 08:16:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815727.1229808; Thu, 10 Oct 2024 08:16: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 1syoLJ-0003wJ-3d; Thu, 10 Oct 2024 08:16:17 +0000
Received: by outflank-mailman (input) for mailman id 815727;
 Thu, 10 Oct 2024 08:16: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 1syoLH-0003w3-KA
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:16: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 1syoLH-00070M-JW
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:16:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoLH-0004po-Io
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:16: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=rsF/0ZieCsHx7Jkrw1qHEsq+enpQrYZw5lh/ynMOkKQ=; b=OmbvedSedvkhzE1y+ylWIHPBix
	/8HPhk7H5PFEtn/QxPzMTIImfeLj8xKwzJ9Expn1H0mJZWnTL6H6iGFInYDN7dlK+S3tMxDNuBnb/
	t/Q/X0Rm/0UVSIJQJ7BVksF2ZULKu3P99eMb1W9uLIxSaweTUKIgNxTxYGOhT7MWyvzA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] target/s390x: Check reserved bits of VFMIN/VFMAX's M5
Message-Id: <E1syoLH-0004po-Io@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:16:15 +0000

commit 96fd3b85081a119353b9ef3f783c2bc8c63758a2
Author:     Ilya Leoshkevich <iii@linux.ibm.com>
AuthorDate: Sat Aug 5 01:46:10 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/s390x: Check reserved bits of VFMIN/VFMAX's M5
    
    VFMIN and VFMAX should raise a specification exceptions when bits 1-3
    of M5 are set.
    
    Cc: qemu-stable@nongnu.org
    Fixes: da4807527f3b ("s390x/tcg: Implement VECTOR FP (MAXIMUM|MINIMUM)")
    Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
    Message-Id: <20230804234621.252522-1-iii@linux.ibm.com>
    Reviewed-by: David Hildenbrand <david@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 6a2ea6151835aa4f5fee29382a421c13b0e6619f)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/s390x/tcg/translate_vx.c.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/s390x/tcg/translate_vx.c.inc b/target/s390x/tcg/translate_vx.c.inc
index a6d840d406..ec94d39df0 100644
--- a/target/s390x/tcg/translate_vx.c.inc
+++ b/target/s390x/tcg/translate_vx.c.inc
@@ -3047,7 +3047,7 @@ static DisasJumpType op_vfmax(DisasContext *s, DisasOps *o)
     const uint8_t m5 = get_field(s, m5);
     gen_helper_gvec_3_ptr *fn;
 
-    if (m6 == 5 || m6 == 6 || m6 == 7 || m6 >= 13) {
+    if (m6 == 5 || m6 == 6 || m6 == 7 || m6 >= 13 || (m5 & 7)) {
         gen_program_exception(s, PGM_SPECIFICATION);
         return DISAS_NORETURN;
     }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:16:26 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:16:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815728.1229811 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoLS-0003zX-7e; Thu, 10 Oct 2024 08:16:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815728.1229811; Thu, 10 Oct 2024 08:16: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 1syoLS-0003zP-4y; Thu, 10 Oct 2024 08:16:26 +0000
Received: by outflank-mailman (input) for mailman id 815728;
 Thu, 10 Oct 2024 08:16: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 1syoLR-0003zF-N1
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:16: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 1syoLR-00070T-MR
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:16:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoLR-0004qZ-Ln
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:16: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=IWH+wSdpPZe3/RszSe6M43SAwOLCU04rR+QhqBjFs94=; b=AyZt3dzGUBlEa6DV6rY2A5w3lX
	VqSpliaoaTT/mLpAORLZ49OujtDKKq0zgGMRW2b2wVlE9id2OPqfO7M2KcDDoUa7txBadWTWBMDIp
	KU4ZKJWDH3Ol3ZZkiHWN12FETjOD8SvX873ye7wIkQ6rvRs0NRfsRbkKSEkfNtYfLK7o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] include/hw/virtio/virtio-gpu: Fix virtio-gpu with blob on big endian hosts
Message-Id: <E1syoLR-0004qZ-Ln@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:16:25 +0000

commit f2f8e74ff4eeca352981be4c5fdb03f19e58be7d
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Tue Aug 15 14:20:07 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    include/hw/virtio/virtio-gpu: Fix virtio-gpu with blob on big endian hosts
    
    Using "-device virtio-gpu,blob=true" currently does not work on big
    endian hosts (like s390x). The guest kernel prints an error message
    like:
    
     [drm:virtio_gpu_dequeue_ctrl_func [virtio_gpu]] *ERROR* response 0x1200 (command 0x10c)
    
    and the display stays black. When running QEMU with "-d guest_errors",
    it shows an error message like this:
    
     virtio_gpu_create_mapping_iov: nr_entries is too big (83886080 > 16384)
    
    which indicates that this value has not been properly byte-swapped.
    And indeed, the virtio_gpu_create_blob_bswap() function (that should
    swap the fields in the related structure) fails to swap some of the
    entries. After correctly swapping all missing values here, too, the
    virtio-gpu device is now also working with blob=true on s390x hosts.
    
    Fixes: e0933d91b1 ("virtio-gpu: Add virtio_gpu_resource_create_blob")
    Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=2230469
    Message-Id: <20230815122007.928049-1-thuth@redhat.com>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit d194362910138776e8abd6bb3c9fb3693254e95f)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 include/hw/virtio/virtio-gpu-bswap.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/hw/virtio/virtio-gpu-bswap.h b/include/hw/virtio/virtio-gpu-bswap.h
index 9124108485..637a0585d0 100644
--- a/include/hw/virtio/virtio-gpu-bswap.h
+++ b/include/hw/virtio/virtio-gpu-bswap.h
@@ -63,7 +63,10 @@ virtio_gpu_create_blob_bswap(struct virtio_gpu_resource_create_blob *cblob)
 {
     virtio_gpu_ctrl_hdr_bswap(&cblob->hdr);
     le32_to_cpus(&cblob->resource_id);
+    le32_to_cpus(&cblob->blob_mem);
     le32_to_cpus(&cblob->blob_flags);
+    le32_to_cpus(&cblob->nr_entries);
+    le64_to_cpus(&cblob->blob_id);
     le64_to_cpus(&cblob->size);
 }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:16:36 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:16:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815729.1229816 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoLc-0004PM-A2; Thu, 10 Oct 2024 08:16:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815729.1229816; Thu, 10 Oct 2024 08:16: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 1syoLc-0004PE-6P; Thu, 10 Oct 2024 08:16:36 +0000
Received: by outflank-mailman (input) for mailman id 815729;
 Thu, 10 Oct 2024 08:16: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 1syoLb-0004P6-R2
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:16: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 1syoLb-00070a-QK
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:16:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoLb-0004rA-PJ
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:16: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=hPLrgFP3SJDMTOmfgDlOsudjbKuIpQVldSGaOzawJZ8=; b=ga166V40b7UucXDiwAiCEsTfcO
	Oi6sWt+jPaS6SnFa0zBcYVKH7rzX9uK94XpLhoxLmY3UYLHaTRnvxd1a/M5MDMZ46MC/qChqB3L4x
	i4IC451xpb5V+mobqPxrlETanLd7Fb6ZXeMmnQpRFVR1rw3BcQKEYOHBITTr2HCyP+rE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] kvm: Introduce kvm_arch_get_default_type hook
Message-Id: <E1syoLb-0004rA-PJ@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:16:35 +0000

commit aa152711dbed973d7a4ecc725819d3eb280906f1
Author:     Akihiko Odaki <akihiko.odaki@daynix.com>
AuthorDate: Tue Aug 22 17:31:02 2023 +0100
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    kvm: Introduce kvm_arch_get_default_type hook
    
    kvm_arch_get_default_type() returns the default KVM type. This hook is
    particularly useful to derive a KVM type that is valid for "none"
    machine model, which is used by libvirt to probe the availability of
    KVM.
    
    For MIPS, the existing mips_kvm_type() is reused. This function ensures
    the availability of VZ which is mandatory to use KVM on the current
    QEMU.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
    Message-id: 20230727073134.134102-2-akihiko.odaki@daynix.com
    Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
    [PMM: added doc comment for new function]
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    (cherry picked from commit 5e0d65909c6f335d578b90491e165440c99adf81)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 accel/kvm/kvm-all.c      | 4 +++-
 hw/mips/loongson3_virt.c | 2 --
 include/sysemu/kvm.h     | 2 ++
 target/arm/kvm.c         | 5 +++++
 target/i386/kvm/kvm.c    | 5 +++++
 target/mips/kvm.c        | 2 +-
 target/mips/kvm_mips.h   | 9 ---------
 target/ppc/kvm.c         | 5 +++++
 target/riscv/kvm.c       | 5 +++++
 target/s390x/kvm/kvm.c   | 5 +++++
 10 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index cf3a88d90e..4c3ad74a6d 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -2382,7 +2382,7 @@ static int kvm_init(MachineState *ms)
     KVMState *s;
     const KVMCapabilityInfo *missing_cap;
     int ret;
-    int type = 0;
+    int type;
     uint64_t dirty_log_manual_caps;
 
     qemu_mutex_init(&kml_slots_lock);
@@ -2447,6 +2447,8 @@ static int kvm_init(MachineState *ms)
         type = mc->kvm_type(ms, kvm_type);
     } else if (mc->kvm_type) {
         type = mc->kvm_type(ms, NULL);
+    } else {
+        type = kvm_arch_get_default_type(ms);
     }
 
     do {
diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c
index 25534288dd..b4f6bff1b8 100644
--- a/hw/mips/loongson3_virt.c
+++ b/hw/mips/loongson3_virt.c
@@ -29,7 +29,6 @@
 #include "qemu/datadir.h"
 #include "qapi/error.h"
 #include "elf.h"
-#include "kvm_mips.h"
 #include "hw/char/serial.h"
 #include "hw/intc/loongson_liointc.h"
 #include "hw/mips/mips.h"
@@ -617,7 +616,6 @@ static void loongson3v_machine_class_init(ObjectClass *oc, void *data)
     mc->max_cpus = LOONGSON_MAX_VCPUS;
     mc->default_ram_id = "loongson3.highram";
     mc->default_ram_size = 1600 * MiB;
-    mc->kvm_type = mips_kvm_type;
     mc->minimum_page_bits = 14;
 }
 
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
index c8281c07a7..e97ea915a2 100644
--- a/include/sysemu/kvm.h
+++ b/include/sysemu/kvm.h
@@ -369,6 +369,8 @@ int kvm_arch_get_registers(CPUState *cpu);
 
 int kvm_arch_put_registers(CPUState *cpu, int level);
 
+int kvm_arch_get_default_type(MachineState *ms);
+
 int kvm_arch_init(MachineState *ms, KVMState *s);
 
 int kvm_arch_init_vcpu(CPUState *cpu);
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 84da49332c..34bc329b5b 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -247,6 +247,11 @@ int kvm_arm_get_max_vm_ipa_size(MachineState *ms, bool *fixed_ipa)
     return ret > 0 ? ret : 40;
 }
 
+int kvm_arch_get_default_type(MachineState *ms)
+{
+    return 0;
+}
+
 int kvm_arch_init(MachineState *ms, KVMState *s)
 {
     int ret = 0;
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index de531842f6..eb2f4e3238 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -2552,6 +2552,11 @@ static void register_smram_listener(Notifier *n, void *unused)
                                  &smram_address_space, 1, "kvm-smram");
 }
 
+int kvm_arch_get_default_type(MachineState *ms)
+{
+    return 0;
+}
+
 int kvm_arch_init(MachineState *ms, KVMState *s)
 {
     uint64_t identity_base = 0xfffbc000;
diff --git a/target/mips/kvm.c b/target/mips/kvm.c
index c14e8f550f..e98aad01bd 100644
--- a/target/mips/kvm.c
+++ b/target/mips/kvm.c
@@ -1266,7 +1266,7 @@ int kvm_arch_msi_data_to_gsi(uint32_t data)
     abort();
 }
 
-int mips_kvm_type(MachineState *machine, const char *vm_type)
+int kvm_arch_get_default_type(MachineState *machine)
 {
 #if defined(KVM_CAP_MIPS_VZ)
     int r;
diff --git a/target/mips/kvm_mips.h b/target/mips/kvm_mips.h
index 171d53dbe1..c711269d0a 100644
--- a/target/mips/kvm_mips.h
+++ b/target/mips/kvm_mips.h
@@ -25,13 +25,4 @@ void kvm_mips_reset_vcpu(MIPSCPU *cpu);
 int kvm_mips_set_interrupt(MIPSCPU *cpu, int irq, int level);
 int kvm_mips_set_ipi_interrupt(MIPSCPU *cpu, int irq, int level);
 
-#ifdef CONFIG_KVM
-int mips_kvm_type(MachineState *machine, const char *vm_type);
-#else
-static inline int mips_kvm_type(MachineState *machine, const char *vm_type)
-{
-    return 0;
-}
-#endif
-
 #endif /* KVM_MIPS_H */
diff --git a/target/ppc/kvm.c b/target/ppc/kvm.c
index 78f6fc50cd..90a69af926 100644
--- a/target/ppc/kvm.c
+++ b/target/ppc/kvm.c
@@ -107,6 +107,11 @@ static int kvm_ppc_register_host_cpu_type(void);
 static void kvmppc_get_cpu_characteristics(KVMState *s);
 static int kvmppc_get_dec_bits(void);
 
+int kvm_arch_get_default_type(MachineState *ms)
+{
+    return 0;
+}
+
 int kvm_arch_init(MachineState *ms, KVMState *s)
 {
     cap_interrupt_unset = kvm_check_extension(s, KVM_CAP_PPC_UNSET_IRQ);
diff --git a/target/riscv/kvm.c b/target/riscv/kvm.c
index 0f932a5b96..ee0b381400 100644
--- a/target/riscv/kvm.c
+++ b/target/riscv/kvm.c
@@ -426,6 +426,11 @@ int kvm_arch_add_msi_route_post(struct kvm_irq_routing_entry *route,
     return 0;
 }
 
+int kvm_arch_get_default_type(MachineState *ms)
+{
+    return 0;
+}
+
 int kvm_arch_init(MachineState *ms, KVMState *s)
 {
     return 0;
diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c
index 3ac7ec9acf..8ffe140513 100644
--- a/target/s390x/kvm/kvm.c
+++ b/target/s390x/kvm/kvm.c
@@ -340,6 +340,11 @@ static void ccw_machine_class_foreach(ObjectClass *oc, void *opaque)
     mc->default_cpu_type = S390_CPU_TYPE_NAME("host");
 }
 
+int kvm_arch_get_default_type(MachineState *ms)
+{
+    return 0;
+}
+
 int kvm_arch_init(MachineState *ms, KVMState *s)
 {
     object_class_foreach(ccw_machine_class_foreach, TYPE_S390_CCW_MACHINE,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:16:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:16:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815730.1229818 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoLm-0004hf-AU; Thu, 10 Oct 2024 08:16:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815730.1229818; Thu, 10 Oct 2024 08:16: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 1syoLm-0004hX-7o; Thu, 10 Oct 2024 08:16:46 +0000
Received: by outflank-mailman (input) for mailman id 815730;
 Thu, 10 Oct 2024 08:16: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 1syoLl-0004hP-U2
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:16: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 1syoLl-00070i-TJ
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:16:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoLl-0004s0-SY
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:16: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=KNEPX3Stz3HXA2HbGbHATlFm8bDGXN6R2fwSM5s0NkA=; b=baL7IoV/Ih0fpnEKIEGytQqZO3
	KZS75eOlR6GTfodx/OQYdK1qHRbdGAmcqgy6wwjWiiTEBPC5RBQS65BdGjUI2ftsVbEp3thmogXyk
	60ieON5hLbRXFz8CZdgOWfEX24/8FfdL1PR6uOOv4uC9VTYqquJxm+wrxuScTbcHUCBg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] accel/kvm: Specify default IPA size for arm64
Message-Id: <E1syoLl-0004s0-SY@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:16:45 +0000

commit f5cb21416e6fc6a3e2d58f4bb557c929ffe01818
Author:     Akihiko Odaki <akihiko.odaki@daynix.com>
AuthorDate: Tue Aug 22 17:31:02 2023 +0100
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    accel/kvm: Specify default IPA size for arm64
    
    Before this change, the default KVM type, which is used for non-virt
    machine models, was 0.
    
    The kernel documentation says:
    > On arm64, the physical address size for a VM (IPA Size limit) is
    > limited to 40bits by default. The limit can be configured if the host
    > supports the extension KVM_CAP_ARM_VM_IPA_SIZE. When supported, use
    > KVM_VM_TYPE_ARM_IPA_SIZE(IPA_Bits) to set the size in the machine type
    > identifier, where IPA_Bits is the maximum width of any physical
    > address used by the VM. The IPA_Bits is encoded in bits[7-0] of the
    > machine type identifier.
    >
    > e.g, to configure a guest to use 48bit physical address size::
    >
    >     vm_fd = ioctl(dev_fd, KVM_CREATE_VM, KVM_VM_TYPE_ARM_IPA_SIZE(48));
    >
    > The requested size (IPA_Bits) must be:
    >
    >  ==   =========================================================
    >   0   Implies default size, 40bits (for backward compatibility)
    >   N   Implies N bits, where N is a positive integer such that,
    >       32 <= N <= Host_IPA_Limit
    >  ==   =========================================================
    
    > Host_IPA_Limit is the maximum possible value for IPA_Bits on the host
    > and is dependent on the CPU capability and the kernel configuration.
    > The limit can be retrieved using KVM_CAP_ARM_VM_IPA_SIZE of the
    > KVM_CHECK_EXTENSION ioctl() at run-time.
    >
    > Creation of the VM will fail if the requested IPA size (whether it is
    > implicit or explicit) is unsupported on the host.
    https://docs.kernel.org/virt/kvm/api.html#kvm-create-vm
    
    So if Host_IPA_Limit < 40, specifying 0 as the type will fail. This
    actually confused libvirt, which uses "none" machine model to probe the
    KVM availability, on M2 MacBook Air.
    
    Fix this by using Host_IPA_Limit as the default type when
    KVM_CAP_ARM_VM_IPA_SIZE is available.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
    Message-id: 20230727073134.134102-3-akihiko.odaki@daynix.com
    Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    (cherry picked from commit 1ab445af8cd99343f29032b5944023ad7d8edebf)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/arm/kvm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 34bc329b5b..e219f78535 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -249,7 +249,9 @@ int kvm_arm_get_max_vm_ipa_size(MachineState *ms, bool *fixed_ipa)
 
 int kvm_arch_get_default_type(MachineState *ms)
 {
-    return 0;
+    bool fixed_ipa;
+    int size = kvm_arm_get_max_vm_ipa_size(ms, &fixed_ipa);
+    return fixed_ipa ? 0 : size;
 }
 
 int kvm_arch_init(MachineState *ms, KVMState *s)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:16:56 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:16:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815731.1229822 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoLw-00056S-C7; Thu, 10 Oct 2024 08:16:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815731.1229822; Thu, 10 Oct 2024 08:16: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 1syoLw-00056L-9Q; Thu, 10 Oct 2024 08:16:56 +0000
Received: by outflank-mailman (input) for mailman id 815731;
 Thu, 10 Oct 2024 08:16: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 1syoLw-00056F-0d
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:16: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 1syoLv-000715-WE
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:16:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoLv-0004sl-VZ
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:16: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=ToahA8/mxCaIdRi+B8CPMt2qeUqFR36iB2Ud+0aon1c=; b=AC4ZGpx0OsJJcDdDRoLF0jH0eU
	XxKy0lnkdeB9/328UMMCHQw70CiSaJfcvdn/77eO2I3jc7k3nXz0KarAMTtfjXNZaDWIhtvRKW+xo
	vYyc0Qd9VqNuMxPUvBH51ofc8SMj/zdvcBzAXvVuPr+JL0SQdxrHADARoUQafXci9gGg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] target/arm: Fix SME ST1Q
Message-Id: <E1syoLv-0004sl-VZ@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:16:55 +0000

commit 09640031edd4314b8b2b05235f3da8114b4d5d36
Author:     Richard Henderson <richard.henderson@linaro.org>
AuthorDate: Tue Aug 22 17:31:13 2023 +0100
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/arm: Fix SME ST1Q
    
    A typo, noted in the bug report, resulting in an
    incorrect write offset.
    
    Cc: qemu-stable@nongnu.org
    Fixes: 7390e0e9ab8 ("target/arm: Implement SME LD1, ST1")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1833
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20230818214255.146905-1-richard.henderson@linaro.org
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    (cherry picked from commit 4b3520fd93cd49cc56dfcab45d90735cc2e35af7)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/arm/tcg/sme_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/arm/tcg/sme_helper.c b/target/arm/tcg/sme_helper.c
index 1e67fcac30..296826ffe6 100644
--- a/target/arm/tcg/sme_helper.c
+++ b/target/arm/tcg/sme_helper.c
@@ -379,7 +379,7 @@ static inline void HNAME##_host(void *za, intptr_t off, void *host)         \
 {                                                                           \
     uint64_t *ptr = za + off;                                               \
     HOST(host, ptr[BE]);                                                    \
-    HOST(host + 1, ptr[!BE]);                                               \
+    HOST(host + 8, ptr[!BE]);                                               \
 }                                                                           \
 static inline void VNAME##_v_host(void *za, intptr_t off, void *host)       \
 {                                                                           \
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:17:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:17:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815732.1229826 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoM7-0005LF-F0; Thu, 10 Oct 2024 08:17:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815732.1229826; Thu, 10 Oct 2024 08:17: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 1syoM7-0005L7-CK; Thu, 10 Oct 2024 08:17:07 +0000
Received: by outflank-mailman (input) for mailman id 815732;
 Thu, 10 Oct 2024 08:17: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 1syoM6-0005Jj-3r
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:17: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 1syoM6-00071Q-3G
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:17:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoM6-0004tj-2V
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:17: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=WugtHhqJ2/s0PQk5U7HGImMmFdxiI9tnwho7Nf8tW/w=; b=v6xtKa6xiPJGDeUOMAmL2gLGXq
	AXg52kWmKj1+zNajTm5ldest8vZv2sPvTuMS3X55tB/ybXTjF9fPMD8kzIsq6G8l1uXNsMC61UH+h
	xOltIxeawDZ4zhJ0qJMvWdtfHAKhQWzCz4TUx/d/3FiUsEiObogFWr6cXIEMeO2eMr08=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] target/arm: Fix 64-bit SSRA
Message-Id: <E1syoM6-0004tj-2V@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:17:06 +0000

commit d4c0ac705d720e19d9ec5b9fe1c6c7bb22b6913a
Author:     Richard Henderson <richard.henderson@linaro.org>
AuthorDate: Tue Aug 22 17:31:14 2023 +0100
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/arm: Fix 64-bit SSRA
    
    Typo applied byte-wise shift instead of double-word shift.
    
    Cc: qemu-stable@nongnu.org
    Fixes: 631e565450c ("target/arm: Create gen_gvec_[us]sra")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1737
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20230821022025.397682-1-richard.henderson@linaro.org
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    (cherry picked from commit cd1e4db73646006039f25879af3bff55b2295ff3)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/arm/tcg/translate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c
index 1e4d94e58a..e1fe68f73a 100644
--- a/target/arm/tcg/translate.c
+++ b/target/arm/tcg/translate.c
@@ -3063,7 +3063,7 @@ void gen_gvec_ssra(unsigned vece, uint32_t rd_ofs, uint32_t rm_ofs,
           .vece = MO_32 },
         { .fni8 = gen_ssra64_i64,
           .fniv = gen_ssra_vec,
-          .fno = gen_helper_gvec_ssra_b,
+          .fno = gen_helper_gvec_ssra_d,
           .prefer_i64 = TCG_TARGET_REG_BITS == 64,
           .opt_opc = vecop_list,
           .load_dest = true,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:17:17 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:17:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815733.1229830 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoMH-0005tX-Gf; Thu, 10 Oct 2024 08:17:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815733.1229830; Thu, 10 Oct 2024 08:17: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 1syoMH-0005tO-Dr; Thu, 10 Oct 2024 08:17:17 +0000
Received: by outflank-mailman (input) for mailman id 815733;
 Thu, 10 Oct 2024 08:17: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 1syoMG-0005oO-6n
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:17: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 1syoMG-00071Z-65
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:17:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoMG-0004uU-5S
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:17: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=Dlb0NXgxbzmKshWMGbr5lA/axmFUng71+L1wFRYeg1U=; b=L30cpNb9dD3MWb7QtfVgqm9M/q
	Dyd2KbSVqSZSQnkdQ9Br7+aSgpn6deSS7gjEbgs0XBbOKRlIDRjmgcdnOF3qjUijZ6WoxRxrV5Sg+
	lVDMnzp4JYiOpYUI4pZsj0Ud/x++XoE4LceRyNYSnCzPuGFoEGBfU4PduhJGEH3hvsi4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] docs/about/license: Update LICENSE URL
Message-Id: <E1syoMG-0004uU-5S@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:17:16 +0000

commit 3c934310ffdfef69a085b8061d884d222b1d201b
Author:     Philippe Mathieu-Daudé <philmd@linaro.org>
AuthorDate: Tue Aug 22 14:57:16 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    docs/about/license: Update LICENSE URL
    
    In early 2021 (see commit 2ad784339e "docs: update README to use
    GitLab repo URLs") almost all of the code base was converted to
    point to GitLab instead of git.qemu.org. During 2023, git.qemu.org
    switched from a git mirror to a http redirect to GitLab (see [1]).
    
    Update the LICENSE URL to match its previous content, displaying
    the file raw content similarly to gitweb 'blob_plain' format ([2]).
    
    [1] https://lore.kernel.org/qemu-devel/CABgObfZu3mFc8tM20K-yXdt7F-7eV-uKZN4sKDarSeu7DYoRbA@mail.gmail.com/
    [2] https://git-scm.com/docs/gitweb#Documentation/gitweb.txt-blobplain
    
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    Message-ID: <20230822125716.55295-1-philmd@linaro.org>
    (cherry picked from commit 09a3fffae00b042bed8ad9c351b1a58c505fde37)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 docs/about/license.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/about/license.rst b/docs/about/license.rst
index cde3d2d25d..303c55d61b 100644
--- a/docs/about/license.rst
+++ b/docs/about/license.rst
@@ -8,4 +8,4 @@ QEMU is a trademark of Fabrice Bellard.
 QEMU is released under the `GNU General Public
 License <https://www.gnu.org/licenses/gpl-2.0.txt>`__, version 2. Parts
 of QEMU have specific licenses, see file
-`LICENSE <https://git.qemu.org/?p=qemu.git;a=blob_plain;f=LICENSE>`__.
+`LICENSE <https://gitlab.com/qemu-project/qemu/-/raw/master/LICENSE>`__.
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:17:27 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:17:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815734.1229836 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoMR-0006Ia-It; Thu, 10 Oct 2024 08:17:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815734.1229836; Thu, 10 Oct 2024 08:17: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 1syoMR-0006IS-FH; Thu, 10 Oct 2024 08:17:27 +0000
Received: by outflank-mailman (input) for mailman id 815734;
 Thu, 10 Oct 2024 08:17: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 1syoMQ-0006Gm-9v
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:17: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 1syoMQ-00073G-9G
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:17:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoMQ-0004uz-8K
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:17: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=6kylM0TiLRyRvdef6bZlT0FbdSXOGrLdcuWE/4EEKTQ=; b=I5MrcUrOVxnrXqm04I5pN2DZG3
	fiWsK/qhgz6Q8w+pzeubW4bcGVxb9enZuN8JVfOp+veG24fNJ0lnHg2upDz6YV22KajZv6Hv0zYMh
	xgGpxJQGTOMHaLSH/jGl9Zir88g4vFJ7Vre5m4ZNOACLMBmJPfbIYiql8HARJVb3EWbk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] block-migration: Ensure we don't crash during migration cleanup
Message-Id: <E1syoMQ-0004uz-8K@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:17:26 +0000

commit e8bb4dc55a9a8e52f55c17ee9b50d7436a672881
Author:     Fabiano Rosas <farosas@suse.de>
AuthorDate: Mon Jul 31 17:33:38 2023 -0300
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    block-migration: Ensure we don't crash during migration cleanup
    
    We can fail the blk_insert_bs() at init_blk_migration(), leaving the
    BlkMigDevState without a dirty_bitmap and BlockDriverState. Account
    for the possibly missing elements when doing cleanup.
    
    Fix the following crashes:
    
    Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
    0x0000555555ec83ef in bdrv_release_dirty_bitmap (bitmap=0x0) at ../block/dirty-bitmap.c:359
    359         BlockDriverState *bs = bitmap->bs;
     #0  0x0000555555ec83ef in bdrv_release_dirty_bitmap (bitmap=0x0) at ../block/dirty-bitmap.c:359
     #1  0x0000555555bba331 in unset_dirty_tracking () at ../migration/block.c:371
     #2  0x0000555555bbad98 in block_migration_cleanup_bmds () at ../migration/block.c:681
    
    Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
    0x0000555555e971ff in bdrv_op_unblock (bs=0x0, op=BLOCK_OP_TYPE_BACKUP_SOURCE, reason=0x0) at ../block.c:7073
    7073        QLIST_FOREACH_SAFE(blocker, &bs->op_blockers[op], list, next) {
     #0  0x0000555555e971ff in bdrv_op_unblock (bs=0x0, op=BLOCK_OP_TYPE_BACKUP_SOURCE, reason=0x0) at ../block.c:7073
     #1  0x0000555555e9734a in bdrv_op_unblock_all (bs=0x0, reason=0x0) at ../block.c:7095
     #2  0x0000555555bbae13 in block_migration_cleanup_bmds () at ../migration/block.c:690
    
    Signed-off-by: Fabiano Rosas <farosas@suse.de>
    Message-id: 20230731203338.27581-1-farosas@suse.de
    Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
    (cherry picked from commit f187609f27b261702a17f79d20bf252ee0d4f9cd)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 migration/block.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/migration/block.c b/migration/block.c
index b2497bbd32..ece746e788 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -366,7 +366,9 @@ static void unset_dirty_tracking(void)
     BlkMigDevState *bmds;
 
     QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
-        bdrv_release_dirty_bitmap(bmds->dirty_bitmap);
+        if (bmds->dirty_bitmap) {
+            bdrv_release_dirty_bitmap(bmds->dirty_bitmap);
+        }
     }
 }
 
@@ -674,13 +676,18 @@ static int64_t get_remaining_dirty(void)
 static void block_migration_cleanup_bmds(void)
 {
     BlkMigDevState *bmds;
+    BlockDriverState *bs;
     AioContext *ctx;
 
     unset_dirty_tracking();
 
     while ((bmds = QSIMPLEQ_FIRST(&block_mig_state.bmds_list)) != NULL) {
         QSIMPLEQ_REMOVE_HEAD(&block_mig_state.bmds_list, entry);
-        bdrv_op_unblock_all(blk_bs(bmds->blk), bmds->blocker);
+
+        bs = blk_bs(bmds->blk);
+        if (bs) {
+            bdrv_op_unblock_all(bs, bmds->blocker);
+        }
         error_free(bmds->blocker);
 
         /* Save ctx, because bmds->blk can disappear during blk_unref.  */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:17:37 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:17:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815735.1229837 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoMb-0006b6-JH; Thu, 10 Oct 2024 08:17:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815735.1229837; Thu, 10 Oct 2024 08:17: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 1syoMb-0006az-Gn; Thu, 10 Oct 2024 08:17:37 +0000
Received: by outflank-mailman (input) for mailman id 815735;
 Thu, 10 Oct 2024 08:17: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 1syoMa-0006ao-D6
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:17: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 1syoMa-00073N-CB
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:17:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoMa-0004vs-BX
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:17: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=oHk7cZLpbQSpMOvSpBHwxrDo3R0UjW6PmxelJLr6Hjk=; b=LylFFajJSL9ZVVP5j36PZKW8G9
	YdZd1oFM7w7QohlDUQs7pjDU1xNceYjNmB3BtVOyA//54LG9JauthqpEw6/Ybxqd9LT3qK4+H8Idl
	dW1z23IR2WM9tIxIMeUB3zXS/eCPf7ypZej4axvmOol5qTFMOpVMsbQyqQejV1MOejH8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/ppc/e500: fix broken snapshot replay
Message-Id: <E1syoMa-0004vs-BX@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:17:36 +0000

commit fcb49ea23c39dd93b8e1d4e0edae67967d28e001
Author:     Maksim Kostin <maksim.kostin@ispras.ru>
AuthorDate: Wed Aug 9 13:07:33 2023 +0300
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/ppc/e500: fix broken snapshot replay
    
    ppce500_reset_device_tree is registered for system reset, but after
    c4b075318eb1 this function rerandomizes rng-seed via
    qemu_guest_getrandom_nofail. And when loading a snapshot, it tries to read
    EVENT_RANDOM that doesn't exist, so we have an error:
    
      qemu-system-ppc: Missing random event in the replay log
    
    To fix this, use qemu_register_reset_nosnapshotload instead of
    qemu_register_reset.
    
    Reported-by: Vitaly Cheptsov <cheptsov@ispras.ru>
    Fixes: c4b075318eb1 ("hw/ppc: pass random seed to fdt ")
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1634
    Signed-off-by: Maksim Kostin <maksim.kostin@ispras.ru>
    Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    (cherry picked from commit 6ec65b69ba17c954414fa23a397fb8a3fcfb4a43)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ppc/e500.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index 117c9c08ed..27d83a4bf6 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -712,7 +712,7 @@ static int ppce500_prep_device_tree(PPCE500MachineState *machine,
     p->kernel_base = kernel_base;
     p->kernel_size = kernel_size;
 
-    qemu_register_reset(ppce500_reset_device_tree, p);
+    qemu_register_reset_nosnapshotload(ppce500_reset_device_tree, p);
     p->notifier.notify = ppce500_init_notify;
     qemu_add_machine_init_done_notifier(&p->notifier);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:17:47 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:17:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815737.1229854 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoMl-0006ti-SJ; Thu, 10 Oct 2024 08:17:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815737.1229854; Thu, 10 Oct 2024 08:17: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 1syoMl-0006tY-Or; Thu, 10 Oct 2024 08:17:47 +0000
Received: by outflank-mailman (input) for mailman id 815737;
 Thu, 10 Oct 2024 08:17: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 1syoMk-0006t7-Fg
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:17: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 1syoMk-00073V-F6
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:17:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoMk-0004we-EQ
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:17: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=nQmC5xenZ74z1ZpJZ/BihCx77dKm/4gAq/9mE3a+LcM=; b=qo1AJz8+R8AsMxbybfdnkVLEy4
	elXX1tESvJ3QvHAI5CCR9oiZ2qnRqd5j4VWhVS0NflTZz68Ox7m7OPZXjIv74kurtD9HPEpZTuK8r
	C9PbhzdIC5iTIbvAmUH5Y/x0bcXHDZiSHn4u2j6YzpX5uE9JWr7qAmDIVgthgNkjYwkA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] ppc/vof: Fix missed fields in VOF cleanup
Message-Id: <E1syoMk-0004we-EQ@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:17:46 +0000

commit ea25506b5d6439c76a3a6b7b55dd3f861e98eb85
Author:     Nicholas Piggin <npiggin@gmail.com>
AuthorDate: Tue Aug 8 14:19:44 2023 +1000
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    ppc/vof: Fix missed fields in VOF cleanup
    
    Failing to reset the of_instance_last makes ihandle allocation continue
    to increase, which causes record-replay replay fail to match the
    recorded trace.
    
    Not resetting claimed_base makes VOF eventually run out of memory after
    some resets.
    
    Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
    Fixes: fc8c745d501 ("spapr: Implement Open Firmware client interface")
    Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
    Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    (cherry picked from commit 7b8589d7ce7e23f26ff53338d575a5cbd7818e28)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ppc/vof.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/ppc/vof.c b/hw/ppc/vof.c
index 18c3f92317..e3b430a81f 100644
--- a/hw/ppc/vof.c
+++ b/hw/ppc/vof.c
@@ -1024,6 +1024,8 @@ void vof_cleanup(Vof *vof)
     }
     vof->claimed = NULL;
     vof->of_instances = NULL;
+    vof->of_instance_last = 0;
+    vof->claimed_base = 0;
 }
 
 void vof_build_dt(void *fdt, Vof *vof)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:17:57 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:17:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815738.1229856 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoMv-0006zr-TJ; Thu, 10 Oct 2024 08:17:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815738.1229856; Thu, 10 Oct 2024 08:17: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 1syoMv-0006ze-QK; Thu, 10 Oct 2024 08:17:57 +0000
Received: by outflank-mailman (input) for mailman id 815738;
 Thu, 10 Oct 2024 08:17: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 1syoMu-0006z9-Iq
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:17: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 1syoMu-00073v-I9
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:17:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoMu-0004xa-HK
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:17: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=TKtR7s+qXLqXAABNbHPMq6uZhQqIcA8yExQZiUlAE6g=; b=CNa50admyaOeLR9IaWuXEe7TM6
	AY1ITeDhLwVb7epDJQi3zZmutgeJ1fKB0iUNoKD54NGpMLf7LFV4oJPjuFeoGf0z2tPmbSDhFMtdi
	fFeo3jnLnFG6KPrsbvNbUP/yo27XbIWtT//ZBkCq4gH+SZljAMQSVKqs8thWooYw0U2Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] target/ppc: Flush inputs to zero with NJ in ppc_store_vscr
Message-Id: <E1syoMu-0004xa-HK@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:17:56 +0000

commit 956b96f9e25f22a1e66d0dcacfb3621ef8a671b4
Author:     Richard Henderson <richard.henderson@linaro.org>
AuthorDate: Sun Aug 20 19:59:35 2023 -0700
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    target/ppc: Flush inputs to zero with NJ in ppc_store_vscr
    
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1779
    Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
    Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    (cherry picked from commit af03aeb631eeb81a44d2c0ff5b429cd4b5dc2799)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/ppc/cpu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/ppc/cpu.c b/target/ppc/cpu.c
index 1a97b41c6b..6e597680fb 100644
--- a/target/ppc/cpu.c
+++ b/target/ppc/cpu.c
@@ -59,6 +59,7 @@ void ppc_store_vscr(CPUPPCState *env, uint32_t vscr)
     env->vscr_sat.u64[0] = vscr & (1u << VSCR_SAT);
     env->vscr_sat.u64[1] = 0;
     set_flush_to_zero((vscr >> VSCR_NJ) & 1, &env->vec_status);
+    set_flush_inputs_to_zero((vscr >> VSCR_NJ) & 1, &env->vec_status);
 }
 
 uint32_t ppc_get_vscr(CPUPPCState *env)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:18:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:18:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815742.1229859 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoN5-0007AL-UU; Thu, 10 Oct 2024 08:18:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815742.1229859; Thu, 10 Oct 2024 08:18: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 1syoN5-0007AD-Rv; Thu, 10 Oct 2024 08:18:07 +0000
Received: by outflank-mailman (input) for mailman id 815742;
 Thu, 10 Oct 2024 08:18: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 1syoN4-00078b-Lp
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:18: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 1syoN4-00074F-L9
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:18:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoN4-0004zA-KT
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:18: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=CFybvVHkYVJt9mKEz/tmymG9l9OlkZH0YrUws8RfkQI=; b=p0AXZdsiuDHGM7QsWUC+6WUQiD
	Xs2KSMam1K2sqXat33jcQGXsDTsMax0P16vQBnFxj9OTuD3X5VaUvFFqbsHaZpdq9BF0eyX5R0S3+
	6DmhsMXv5CbslkzxU/HJIq6lc5ssQYkLRi3ySq9p+iCLNELbRmfCQ22CuyUDg5/VkUUM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/ide/core: set ERR_STAT in unsupported command completion
Message-Id: <E1syoN4-0004zA-KT@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:18:06 +0000

commit 67894ec9fd512db33a883bd8df01ddac7f9f9780
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:38 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/ide/core: set ERR_STAT in unsupported command completion
    
    Currently, the first time sending an unsupported command
    (e.g. READ LOG DMA EXT) will not have ERR_STAT set in the completion.
    Sending the unsupported command again, will correctly have ERR_STAT set.
    
    When ide_cmd_permitted() returns false, it calls ide_abort_command().
    ide_abort_command() first calls ide_transfer_stop(), which will call
    ide_transfer_halt() and ide_cmd_done(), after that ide_abort_command()
    sets ERR_STAT in status.
    
    ide_cmd_done() for AHCI will call ahci_write_fis_d2h() which writes the
    current status in the FIS, and raises an IRQ. (The status here will not
    have ERR_STAT set!).
    
    Thus, we cannot call ide_transfer_stop() before setting ERR_STAT, as
    ide_transfer_stop() will result in the FIS being written and an IRQ
    being raised.
    
    The reason why it works the second time, is that ERR_STAT will still
    be set from the previous command, so when writing the FIS, the
    completion will correctly have ERR_STAT set.
    
    Set ERR_STAT before writing the FIS (calling cmd_done), so that we will
    raise an error IRQ correctly when receiving an unsupported command.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20230609140844.202795-3-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit c3461c6264a7c8ca15b117e91fe5da786924a784)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/ide/core.c b/hw/ide/core.c
index de48ff9f86..07971c0218 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -533,9 +533,9 @@ BlockAIOCB *ide_issue_trim(
 
 void ide_abort_command(IDEState *s)
 {
-    ide_transfer_stop(s);
     s->status = READY_STAT | ERR_STAT;
     s->error = ABRT_ERR;
+    ide_transfer_stop(s);
 }
 
 static void ide_set_retry(IDEState *s)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:18:18 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:18:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815746.1229863 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoNG-0007GK-08; Thu, 10 Oct 2024 08:18:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815746.1229863; Thu, 10 Oct 2024 08:18: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 1syoNF-0007GD-Ti; Thu, 10 Oct 2024 08:18:17 +0000
Received: by outflank-mailman (input) for mailman id 815746;
 Thu, 10 Oct 2024 08:18: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 1syoNE-0007Fw-Ow
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:18: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 1syoNE-00074N-OJ
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:18:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoNE-00051Z-NN
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:18: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=ci9KLn/u8jcR/mM/zO82ZHWrVdf5msrEIWemDRfBS8Y=; b=kaYVbdTu1ZEBw49dQpAFuHhexJ
	sfUkvMNAAUne4QFR6eqQXzKdLhzzjoz1OKpK6g0t3lYMRhD3LL8Yd/kPX36wXi+omleAW5Y6QTgbM
	j2l0FQ4nA7/JJ2ndoBtIgf4wubOaIsbveuvcJT8+AQ8aF3hNVU9oakgTy1AoHC3emJps=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/ide/ahci: write D2H FIS when processing NCQ command
Message-Id: <E1syoNE-00051Z-NN@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:18:16 +0000

commit 362a4d8658c9370a071b5e598c158d522a3fa60d
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:39 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/ide/ahci: write D2H FIS when processing NCQ command
    
    The way that BUSY + PxCI is cleared for NCQ (FPDMA QUEUED) commands is
    described in SATA 3.5a Gold:
    
    11.15 FPDMA QUEUED command protocol
    DFPDMAQ2: ClearInterfaceBsy
    "Transmit Register Device to Host FIS with the BSY bit cleared to zero
    and the DRQ bit cleared to zero and Interrupt bit cleared to zero to
    mark interface ready for the next command."
    
    PxCI is currently cleared by handle_cmd(), but we don't write the D2H
    FIS to the FIS Receive Area that actually caused PxCI to be cleared.
    
    Similar to how ahci_pio_transfer() calls ahci_write_fis_pio() with an
    additional parameter to write a PIO Setup FIS without raising an IRQ,
    add a parameter to ahci_write_fis_d2h() so that ahci_write_fis_d2h()
    also can write the FIS to the FIS Receive Area without raising an IRQ.
    
    Change process_ncq_command() to call ahci_write_fis_d2h() without
    raising an IRQ (similar to ahci_pio_transfer()), such that the FIS
    Receive Area is in sync with the PxTFD shadow register.
    
    E.g. Linux reads status and error fields from the FIS Receive Area
    directly, so it is wise to keep the FIS Receive Area and the PxTFD
    shadow register in sync.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Message-id: 20230609140844.202795-4-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit 2967dc8209dd27b61a6ab7bad78cf7c6ec58ddb4)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/ahci.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 4e76d6b191..b81da46e3e 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -43,7 +43,7 @@
 static void check_cmd(AHCIState *s, int port);
 static int handle_cmd(AHCIState *s, int port, uint8_t slot);
 static void ahci_reset_port(AHCIState *s, int port);
-static bool ahci_write_fis_d2h(AHCIDevice *ad);
+static bool ahci_write_fis_d2h(AHCIDevice *ad, bool d2h_fis_i);
 static void ahci_init_d2h(AHCIDevice *ad);
 static int ahci_dma_prepare_buf(const IDEDMA *dma, int32_t limit);
 static bool ahci_map_clb_address(AHCIDevice *ad);
@@ -618,7 +618,7 @@ static void ahci_init_d2h(AHCIDevice *ad)
         return;
     }
 
-    if (ahci_write_fis_d2h(ad)) {
+    if (ahci_write_fis_d2h(ad, true)) {
         ad->init_d2h_sent = true;
         /* We're emulating receiving the first Reg H2D Fis from the device;
          * Update the SIG register, but otherwise proceed as normal. */
@@ -850,7 +850,7 @@ static void ahci_write_fis_pio(AHCIDevice *ad, uint16_t len, bool pio_fis_i)
     }
 }
 
-static bool ahci_write_fis_d2h(AHCIDevice *ad)
+static bool ahci_write_fis_d2h(AHCIDevice *ad, bool d2h_fis_i)
 {
     AHCIPortRegs *pr = &ad->port_regs;
     uint8_t *d2h_fis;
@@ -864,7 +864,7 @@ static bool ahci_write_fis_d2h(AHCIDevice *ad)
     d2h_fis = &ad->res_fis[RES_FIS_RFIS];
 
     d2h_fis[0] = SATA_FIS_TYPE_REGISTER_D2H;
-    d2h_fis[1] = (1 << 6); /* interrupt bit */
+    d2h_fis[1] = d2h_fis_i ? (1 << 6) : 0; /* interrupt bit */
     d2h_fis[2] = s->status;
     d2h_fis[3] = s->error;
 
@@ -890,7 +890,10 @@ static bool ahci_write_fis_d2h(AHCIDevice *ad)
         ahci_trigger_irq(ad->hba, ad, AHCI_PORT_IRQ_BIT_TFES);
     }
 
-    ahci_trigger_irq(ad->hba, ad, AHCI_PORT_IRQ_BIT_DHRS);
+    if (d2h_fis_i) {
+        ahci_trigger_irq(ad->hba, ad, AHCI_PORT_IRQ_BIT_DHRS);
+    }
+
     return true;
 }
 
@@ -1120,6 +1123,8 @@ static void process_ncq_command(AHCIState *s, int port, const uint8_t *cmd_fis,
         return;
     }
 
+    ahci_write_fis_d2h(ad, false);
+
     ncq_tfs->used = 1;
     ncq_tfs->drive = ad;
     ncq_tfs->slot = slot;
@@ -1506,7 +1511,7 @@ static void ahci_cmd_done(const IDEDMA *dma)
     }
 
     /* update d2h status */
-    ahci_write_fis_d2h(ad);
+    ahci_write_fis_d2h(ad, true);
 
     if (ad->port_regs.cmd_issue && !ad->check_bh) {
         ad->check_bh = qemu_bh_new_guarded(ahci_check_cmd_bh, ad,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:18:28 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:18:28 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815747.1229868 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoNQ-0007Ka-39; Thu, 10 Oct 2024 08:18:28 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815747.1229868; Thu, 10 Oct 2024 08:18:28 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoNQ-0007KS-0O; Thu, 10 Oct 2024 08:18:28 +0000
Received: by outflank-mailman (input) for mailman id 815747;
 Thu, 10 Oct 2024 08:18: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 1syoNO-0007KE-Rs
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:18: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 1syoNO-00074W-RG
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:18:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoNO-000536-QZ
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:18: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=3WlWi+UIPU1KIZcz7gzk6X9A3s3RH1pN7gfEGuhKVOE=; b=Hg9i/q+Z7nQSERYgsZX9lghi1V
	pKTUOECNGRBDzLkf3iXvgAbK3AX0V7Jo89b5DOfmn7cK+aTWfOzmPNOSKUa0qLvHK+wYUtLA8qdHe
	Y9BpsCdrZ+1pGN/0I16ZbvStpf3CMBGazc9KZrcGPOCobOjj8eoon5Gzf66BlQfxyogY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/ide/ahci: simplify and document PxCI handling
Message-Id: <E1syoNO-000536-QZ@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:18:26 +0000

commit 7bcd32128b227cee1fb39ff242d486ed9fff7648
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:40 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/ide/ahci: simplify and document PxCI handling
    
    The AHCI spec states that:
    For NCQ, PxCI is cleared on command queued successfully.
    
    For non-NCQ, PxCI is cleared on command completed successfully.
    (A non-NCQ command that completes with error does not clear PxCI.)
    
    The current QEMU implementation either clears PxCI in check_cmd(),
    or in ahci_cmd_done().
    
    check_cmd() will clear PxCI for a command if handle_cmd() returns 0.
    handle_cmd() will return -1 if BUSY or DRQ is set.
    
    The QEMU implementation for NCQ commands will currently not set BUSY
    or DRQ, so they will always have PxCI cleared by handle_cmd().
    ahci_cmd_done() will never even get called for NCQ commands.
    
    Non-NCQ commands are executed by ide_bus_exec_cmd().
    Non-NCQ commands in QEMU are implemented either in a sync or in an async
    way.
    
    For non-NCQ commands implemented in a sync way, the command handler will
    return true, and when ide_bus_exec_cmd() sees that a command handler
    returns true, it will call ide_cmd_done() (which will call
    ahci_cmd_done()). For a command implemented in a sync way,
    ahci_cmd_done() will do nothing (since busy_slot is not set). Instead,
    after ide_bus_exec_cmd() has finished, check_cmd() will clear PxCI for
    these commands.
    
    For non-NCQ commands implemented in an async way (using either aiocb or
    pio_aiocb), the command handler will return false, ide_bus_exec_cmd()
    will not call ide_cmd_done(), instead it is expected that the async
    callback function will call ide_cmd_done() once the async command is
    done. handle_cmd() will set busy_slot, if and only if BUSY or DRQ is
    set, and this is checked _after_ ide_bus_exec_cmd() has returned.
    handle_cmd() will return -1, so check_cmd() will not clear PxCI.
    When the async callback calls ide_cmd_done() (which will call
    ahci_cmd_done()), it will see that busy_slot is set, and
    ahci_cmd_done() will clear PxCI.
    
    This seems racy, since busy_slot is set _after_ ide_bus_exec_cmd() has
    returned. The callback might come before busy_slot gets set. And it is
    quite confusing that ahci_cmd_done() will be called for all non-NCQ
    commands when the command is done, but will only clear PxCI in certain
    cases, even though it will always write a D2H FIS and raise an IRQ.
    
    Even worse, in the case where ahci_cmd_done() does not clear PxCI, it
    still raises an IRQ. Host software might thus read an old PxCI value,
    since PxCI is cleared (by check_cmd()) after the IRQ has been raised.
    
    Try to simplify this by always setting busy_slot for non-NCQ commands,
    such that ahci_cmd_done() will always be responsible for clearing PxCI
    for non-NCQ commands.
    
    For NCQ commands, clear PxCI when we receive the D2H FIS, but before
    raising the IRQ, see AHCI 1.3.1, section 5.3.8, states RegFIS:Entry and
    RegFIS:ClearCI.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Message-id: 20230609140844.202795-5-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit e2a5d9b3d9c3d311618160603cc9bc04fbd98796)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/ahci.c | 70 ++++++++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 50 insertions(+), 20 deletions(-)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index b81da46e3e..6299320ffb 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -41,9 +41,10 @@
 #include "trace.h"
 
 static void check_cmd(AHCIState *s, int port);
-static int handle_cmd(AHCIState *s, int port, uint8_t slot);
+static void handle_cmd(AHCIState *s, int port, uint8_t slot);
 static void ahci_reset_port(AHCIState *s, int port);
 static bool ahci_write_fis_d2h(AHCIDevice *ad, bool d2h_fis_i);
+static void ahci_clear_cmd_issue(AHCIDevice *ad, uint8_t slot);
 static void ahci_init_d2h(AHCIDevice *ad);
 static int ahci_dma_prepare_buf(const IDEDMA *dma, int32_t limit);
 static bool ahci_map_clb_address(AHCIDevice *ad);
@@ -591,9 +592,8 @@ static void check_cmd(AHCIState *s, int port)
 
     if ((pr->cmd & PORT_CMD_START) && pr->cmd_issue) {
         for (slot = 0; (slot < 32) && pr->cmd_issue; slot++) {
-            if ((pr->cmd_issue & (1U << slot)) &&
-                !handle_cmd(s, port, slot)) {
-                pr->cmd_issue &= ~(1U << slot);
+            if (pr->cmd_issue & (1U << slot)) {
+                handle_cmd(s, port, slot);
             }
         }
     }
@@ -1123,6 +1123,22 @@ static void process_ncq_command(AHCIState *s, int port, const uint8_t *cmd_fis,
         return;
     }
 
+    /*
+     * A NCQ command clears the bit in PxCI after the command has been QUEUED
+     * successfully (ERROR not set, BUSY and DRQ cleared).
+     *
+     * For NCQ commands, PxCI will always be cleared here.
+     *
+     * (Once the NCQ command is COMPLETED, the device will send a SDB FIS with
+     * the interrupt bit set, which will clear PxSACT and raise an interrupt.)
+     */
+    ahci_clear_cmd_issue(ad, slot);
+
+    /*
+     * In reality, for NCQ commands, PxCI is cleared after receiving a D2H FIS
+     * without the interrupt bit set, but since ahci_write_fis_d2h() can raise
+     * an IRQ on error, we need to call them in reverse order.
+     */
     ahci_write_fis_d2h(ad, false);
 
     ncq_tfs->used = 1;
@@ -1197,6 +1213,7 @@ static void handle_reg_h2d_fis(AHCIState *s, int port,
 {
     IDEState *ide_state = &s->dev[port].port.ifs[0];
     AHCICmdHdr *cmd = get_cmd_header(s, port, slot);
+    AHCIDevice *ad = &s->dev[port];
     uint16_t opts = le16_to_cpu(cmd->opts);
 
     if (cmd_fis[1] & 0x0F) {
@@ -1273,11 +1290,19 @@ static void handle_reg_h2d_fis(AHCIState *s, int port,
     /* Reset transferred byte counter */
     cmd->status = 0;
 
+    /*
+     * A non-NCQ command clears the bit in PxCI after the command has COMPLETED
+     * successfully (ERROR not set, BUSY and DRQ cleared).
+     *
+     * For non-NCQ commands, PxCI will always be cleared by ahci_cmd_done().
+     */
+    ad->busy_slot = slot;
+
     /* We're ready to process the command in FIS byte 2. */
     ide_bus_exec_cmd(&s->dev[port].port, cmd_fis[2]);
 }
 
-static int handle_cmd(AHCIState *s, int port, uint8_t slot)
+static void handle_cmd(AHCIState *s, int port, uint8_t slot)
 {
     IDEState *ide_state;
     uint64_t tbl_addr;
@@ -1288,12 +1313,12 @@ static int handle_cmd(AHCIState *s, int port, uint8_t slot)
     if (s->dev[port].port.ifs[0].status & (BUSY_STAT|DRQ_STAT)) {
         /* Engine currently busy, try again later */
         trace_handle_cmd_busy(s, port);
-        return -1;
+        return;
     }
 
     if (!s->dev[port].lst) {
         trace_handle_cmd_nolist(s, port);
-        return -1;
+        return;
     }
     cmd = get_cmd_header(s, port, slot);
     /* remember current slot handle for later */
@@ -1303,7 +1328,7 @@ static int handle_cmd(AHCIState *s, int port, uint8_t slot)
     ide_state = &s->dev[port].port.ifs[0];
     if (!ide_state->blk) {
         trace_handle_cmd_badport(s, port);
-        return -1;
+        return;
     }
 
     tbl_addr = le64_to_cpu(cmd->tbl_addr);
@@ -1312,7 +1337,7 @@ static int handle_cmd(AHCIState *s, int port, uint8_t slot)
                              DMA_DIRECTION_TO_DEVICE, MEMTXATTRS_UNSPECIFIED);
     if (!cmd_fis) {
         trace_handle_cmd_badfis(s, port);
-        return -1;
+        return;
     } else if (cmd_len != 0x80) {
         ahci_trigger_irq(s, &s->dev[port], AHCI_PORT_IRQ_BIT_HBFS);
         trace_handle_cmd_badmap(s, port, cmd_len);
@@ -1336,15 +1361,6 @@ static int handle_cmd(AHCIState *s, int port, uint8_t slot)
 out:
     dma_memory_unmap(s->as, cmd_fis, cmd_len, DMA_DIRECTION_TO_DEVICE,
                      cmd_len);
-
-    if (s->dev[port].port.ifs[0].status & (BUSY_STAT|DRQ_STAT)) {
-        /* async command, complete later */
-        s->dev[port].busy_slot = slot;
-        return -1;
-    }
-
-    /* done handling the command */
-    return 0;
 }
 
 /* Transfer PIO data between RAM and device */
@@ -1498,6 +1514,16 @@ static int ahci_dma_rw_buf(const IDEDMA *dma, bool is_write)
     return 1;
 }
 
+static void ahci_clear_cmd_issue(AHCIDevice *ad, uint8_t slot)
+{
+    IDEState *ide_state = &ad->port.ifs[0];
+
+    if (!(ide_state->status & (BUSY_STAT | DRQ_STAT))) {
+        ad->port_regs.cmd_issue &= ~(1 << slot);
+    }
+}
+
+/* Non-NCQ command is done - This function is never called for NCQ commands. */
 static void ahci_cmd_done(const IDEDMA *dma)
 {
     AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma);
@@ -1506,11 +1532,15 @@ static void ahci_cmd_done(const IDEDMA *dma)
 
     /* no longer busy */
     if (ad->busy_slot != -1) {
-        ad->port_regs.cmd_issue &= ~(1 << ad->busy_slot);
+        ahci_clear_cmd_issue(ad, ad->busy_slot);
         ad->busy_slot = -1;
     }
 
-    /* update d2h status */
+    /*
+     * In reality, for non-NCQ commands, PxCI is cleared after receiving a D2H
+     * FIS with the interrupt bit set, but since ahci_write_fis_d2h() will raise
+     * an IRQ, we need to call them in reverse order.
+     */
     ahci_write_fis_d2h(ad, true);
 
     if (ad->port_regs.cmd_issue && !ad->check_bh) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:18:38 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:18:38 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815748.1229872 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoNa-0007NP-4J; Thu, 10 Oct 2024 08:18:38 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815748.1229872; Thu, 10 Oct 2024 08:18:38 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoNa-0007NH-1o; Thu, 10 Oct 2024 08:18:38 +0000
Received: by outflank-mailman (input) for mailman id 815748;
 Thu, 10 Oct 2024 08:18:37 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoNY-0007N2-V3
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:18: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 1syoNY-00074d-UO
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:18:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoNY-00054o-Tc
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:18: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=Py+Dk1O0p2B6m3f0ccJCrI1pISjDIe/qcrwnugxH5NE=; b=EY1YUPUj75X8hS6ohx9Wev71Dg
	3ui+Rsg0b+WoBAiWsWJU+m/0RPuUzzANYQGmi4szqX6mxM++21Z1/jOBDl3PvxaXJJGq/YLPQ2y/7
	oBcKDKcsWuoh5IV9OMXDcGfT95BueU94qmf3LNq/V+EoOHjz7zveBL0ZBE0DQoynjM5g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/ide/ahci: PxSACT and PxCI is cleared when PxCMD.ST is cleared
Message-Id: <E1syoNY-00054o-Tc@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:18:36 +0000

commit 2eaf7775fc05d65c9254530ea0fdbbcf910c92cd
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:41 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:41 2023 +0300

    hw/ide/ahci: PxSACT and PxCI is cleared when PxCMD.ST is cleared
    
    According to AHCI 1.3.1 definition of PxSACT:
    This field is cleared when PxCMD.ST is written from a '1' to a '0' by
    software. This field is not cleared by a COMRESET or a software reset.
    
    According to AHCI 1.3.1 definition of PxCI:
    This field is also cleared when PxCMD.ST is written from a '1' to a '0'
    by software.
    
    Clearing PxCMD.ST is part of the error recovery procedure, see
    AHCI 1.3.1, section "6.2 Error Recovery".
    
    If we don't clear PxCI on error recovery, the previous command will
    incorrectly still be marked as pending after error recovery.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20230609140844.202795-6-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit d73b84d0b664e60fffb66f46e84d0db4a8e1c713)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/ahci.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 6299320ffb..a93a1878de 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -329,6 +329,11 @@ static void ahci_port_write(AHCIState *s, int port, int offset, uint32_t val)
         ahci_check_irq(s);
         break;
     case AHCI_PORT_REG_CMD:
+        if ((pr->cmd & PORT_CMD_START) && !(val & PORT_CMD_START)) {
+            pr->scr_act = 0;
+            pr->cmd_issue = 0;
+        }
+
         /* Block any Read-only fields from being set;
          * including LIST_ON and FIS_ON.
          * The spec requires to set ICC bits to zero after the ICC change
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:18:48 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:18:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815749.1229875 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoNk-0007QA-5h; Thu, 10 Oct 2024 08:18:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815749.1229875; Thu, 10 Oct 2024 08:18:48 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoNk-0007Q3-3E; Thu, 10 Oct 2024 08:18:48 +0000
Received: by outflank-mailman (input) for mailman id 815749;
 Thu, 10 Oct 2024 08:18:47 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoNj-0007Ps-1t
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:18:47 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoNj-00074k-18
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:18:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoNj-00055Z-0R
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:18:47 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Ge6cNnPM6jD09H+6WNl1UpCTxHhRqe4s01l3ce5uDVg=; b=FiakyTGln2x0feBouph6bb7OtL
	NYuVmFlEjaGJJX0/5uBr1imjkAtThc4z1c25lODel6Cq4wm+SwQ+V05pMBORqQCBvdD0kd09CqUEw
	JVEzBn4U51C4NDHW/kA/199o+LGMm/mO2DlocwwzDIlv/sUUM30QvLpALYcwvZCO6McA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/ide/ahci: PxCI should not get cleared when ERR_STAT is set
Message-Id: <E1syoNj-00055Z-0R@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:18:47 +0000

commit f7cca09987983644d054fc4f4feb8414dcd624c5
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:42 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:39:58 2023 +0300

    hw/ide/ahci: PxCI should not get cleared when ERR_STAT is set
    
    For NCQ, PxCI is cleared on command queued successfully.
    For non-NCQ, PxCI is cleared on command completed successfully.
    Successfully means ERR_STAT, BUSY and DRQ are all cleared.
    
    A command that has ERR_STAT set, does not get to clear PxCI.
    See AHCI 1.3.1, section 5.3.8, states RegFIS:Entry and RegFIS:ClearCI,
    and 5.3.16.5 ERR:FatalTaskfile.
    
    In the case of non-NCQ commands, not clearing PxCI is needed in order
    for host software to be able to see which command slot that failed.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Message-id: 20230609140844.202795-7-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit 1a16ce64fda11bdf50f0c4ab5d9fdde72c1383a2)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/ahci.c             |   7 ++-
 tests/qtest/libqos/ahci.c | 106 ++++++++++++++++++++++++++++++++++------------
 tests/qtest/libqos/ahci.h |   8 ++--
 3 files changed, 88 insertions(+), 33 deletions(-)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index a93a1878de..a7b487ff33 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1523,7 +1523,8 @@ static void ahci_clear_cmd_issue(AHCIDevice *ad, uint8_t slot)
 {
     IDEState *ide_state = &ad->port.ifs[0];
 
-    if (!(ide_state->status & (BUSY_STAT | DRQ_STAT))) {
+    if (!(ide_state->status & ERR_STAT) &&
+        !(ide_state->status & (BUSY_STAT | DRQ_STAT))) {
         ad->port_regs.cmd_issue &= ~(1 << slot);
     }
 }
@@ -1532,6 +1533,7 @@ static void ahci_clear_cmd_issue(AHCIDevice *ad, uint8_t slot)
 static void ahci_cmd_done(const IDEDMA *dma)
 {
     AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma);
+    IDEState *ide_state = &ad->port.ifs[0];
 
     trace_ahci_cmd_done(ad->hba, ad->port_no);
 
@@ -1548,7 +1550,8 @@ static void ahci_cmd_done(const IDEDMA *dma)
      */
     ahci_write_fis_d2h(ad, true);
 
-    if (ad->port_regs.cmd_issue && !ad->check_bh) {
+    if (!(ide_state->status & ERR_STAT) &&
+        ad->port_regs.cmd_issue && !ad->check_bh) {
         ad->check_bh = qemu_bh_new_guarded(ahci_check_cmd_bh, ad,
                                            &ad->mem_reentrancy_guard);
         qemu_bh_schedule(ad->check_bh);
diff --git a/tests/qtest/libqos/ahci.c b/tests/qtest/libqos/ahci.c
index f53f12aa99..a2c94c6e06 100644
--- a/tests/qtest/libqos/ahci.c
+++ b/tests/qtest/libqos/ahci.c
@@ -404,57 +404,110 @@ void ahci_port_clear(AHCIQState *ahci, uint8_t port)
 /**
  * Check a port for errors.
  */
-void ahci_port_check_error(AHCIQState *ahci, uint8_t port,
-                           uint32_t imask, uint8_t emask)
+void ahci_port_check_error(AHCIQState *ahci, AHCICommand *cmd)
 {
+    uint8_t port = cmd->port;
     uint32_t reg;
 
-    /* The upper 9 bits of the IS register all indicate errors. */
-    reg = ahci_px_rreg(ahci, port, AHCI_PX_IS);
-    reg &= ~imask;
-    reg >>= 23;
-    g_assert_cmphex(reg, ==, 0);
+    /* If expecting TF error, ensure that TFES is set. */
+    if (cmd->errors) {
+        reg = ahci_px_rreg(ahci, port, AHCI_PX_IS);
+        ASSERT_BIT_SET(reg, AHCI_PX_IS_TFES);
+    } else {
+        /* The upper 9 bits of the IS register all indicate errors. */
+        reg = ahci_px_rreg(ahci, port, AHCI_PX_IS);
+        reg &= ~cmd->interrupts;
+        reg >>= 23;
+        g_assert_cmphex(reg, ==, 0);
+    }
 
-    /* The Sata Error Register should be empty. */
+    /* The Sata Error Register should be empty, even when expecting TF error. */
     reg = ahci_px_rreg(ahci, port, AHCI_PX_SERR);
     g_assert_cmphex(reg, ==, 0);
 
+    /* If expecting TF error, and TFES was set, perform error recovery
+     * (see AHCI 1.3 section 6.2.2.1) such that we can send new commands. */
+    if (cmd->errors) {
+        /* This will clear PxCI. */
+        ahci_px_clr(ahci, port, AHCI_PX_CMD, AHCI_PX_CMD_ST);
+
+        /* The port has 500ms to disengage. */
+        usleep(500000);
+        reg = ahci_px_rreg(ahci, port, AHCI_PX_CMD);
+        ASSERT_BIT_CLEAR(reg, AHCI_PX_CMD_CR);
+
+        /* Clear PxIS. */
+        reg = ahci_px_rreg(ahci, port, AHCI_PX_IS);
+        ahci_px_wreg(ahci, port, AHCI_PX_IS, reg);
+
+        /* Check if we need to perform a COMRESET.
+         * Not implemented right now, as there is no reason why our QEMU model
+         * should need a COMRESET when expecting TF error. */
+        reg = ahci_px_rreg(ahci, port, AHCI_PX_TFD);
+        ASSERT_BIT_CLEAR(reg, AHCI_PX_TFD_STS_BSY | AHCI_PX_TFD_STS_DRQ);
+
+        /* Enable issuing new commands. */
+        ahci_px_set(ahci, port, AHCI_PX_CMD, AHCI_PX_CMD_ST);
+    }
+
     /* The TFD also has two error sections. */
     reg = ahci_px_rreg(ahci, port, AHCI_PX_TFD);
-    if (!emask) {
+    if (!cmd->errors) {
         ASSERT_BIT_CLEAR(reg, AHCI_PX_TFD_STS_ERR);
     } else {
         ASSERT_BIT_SET(reg, AHCI_PX_TFD_STS_ERR);
     }
-    ASSERT_BIT_CLEAR(reg, AHCI_PX_TFD_ERR & (~emask << 8));
-    ASSERT_BIT_SET(reg, AHCI_PX_TFD_ERR & (emask << 8));
+    ASSERT_BIT_CLEAR(reg, AHCI_PX_TFD_ERR & (~cmd->errors << 8));
+    ASSERT_BIT_SET(reg, AHCI_PX_TFD_ERR & (cmd->errors << 8));
 }
 
-void ahci_port_check_interrupts(AHCIQState *ahci, uint8_t port,
-                                uint32_t intr_mask)
+void ahci_port_check_interrupts(AHCIQState *ahci, AHCICommand *cmd)
 {
+    uint8_t port = cmd->port;
     uint32_t reg;
 
+    /* If we expect errors, error handling in ahci_port_check_error() will
+     * already have cleared PxIS, so in that case this function cannot verify
+     * and clear expected interrupts. */
+    if (cmd->errors) {
+        return;
+    }
+
     /* Check for expected interrupts */
     reg = ahci_px_rreg(ahci, port, AHCI_PX_IS);
-    ASSERT_BIT_SET(reg, intr_mask);
+    ASSERT_BIT_SET(reg, cmd->interrupts);
 
     /* Clear expected interrupts and assert all interrupts now cleared. */
-    ahci_px_wreg(ahci, port, AHCI_PX_IS, intr_mask);
+    ahci_px_wreg(ahci, port, AHCI_PX_IS, cmd->interrupts);
     g_assert_cmphex(ahci_px_rreg(ahci, port, AHCI_PX_IS), ==, 0);
 }
 
-void ahci_port_check_nonbusy(AHCIQState *ahci, uint8_t port, uint8_t slot)
+void ahci_port_check_nonbusy(AHCIQState *ahci, AHCICommand *cmd)
 {
+    uint8_t slot = cmd->slot;
+    uint8_t port = cmd->port;
     uint32_t reg;
 
-    /* Assert that the command slot is no longer busy (NCQ) */
+    /* For NCQ command with error PxSACT bit should still be set.
+     * For NCQ command without error, PxSACT bit should be cleared.
+     * For non-NCQ command, PxSACT bit should always be cleared. */
     reg = ahci_px_rreg(ahci, port, AHCI_PX_SACT);
-    ASSERT_BIT_CLEAR(reg, (1 << slot));
+    if (cmd->props->ncq && cmd->errors) {
+        ASSERT_BIT_SET(reg, (1 << slot));
+    } else {
+        ASSERT_BIT_CLEAR(reg, (1 << slot));
+    }
 
-    /* Non-NCQ */
+    /* For non-NCQ command with error, PxCI bit should still be set.
+     * For non-NCQ command without error, PxCI bit should be cleared.
+     * For NCQ command without error, PxCI bit should be cleared.
+     * For NCQ command with error, PxCI bit may or may not be cleared. */
     reg = ahci_px_rreg(ahci, port, AHCI_PX_CI);
-    ASSERT_BIT_CLEAR(reg, (1 << slot));
+    if (!cmd->props->ncq && cmd->errors) {
+        ASSERT_BIT_SET(reg, (1 << slot));
+    } else if (!cmd->errors) {
+        ASSERT_BIT_CLEAR(reg, (1 << slot));
+    }
 
     /* And assert that we are generally not busy. */
     reg = ahci_px_rreg(ahci, port, AHCI_PX_TFD);
@@ -1207,9 +1260,10 @@ void ahci_command_wait(AHCIQState *ahci, AHCICommand *cmd)
 
 #define RSET(REG, MASK) (BITSET(ahci_px_rreg(ahci, cmd->port, (REG)), (MASK)))
 
-    while (RSET(AHCI_PX_TFD, AHCI_PX_TFD_STS_BSY) ||
-           RSET(AHCI_PX_CI, 1 << cmd->slot) ||
-           (cmd->props->ncq && RSET(AHCI_PX_SACT, 1 << cmd->slot))) {
+    while (!RSET(AHCI_PX_TFD, AHCI_PX_TFD_STS_ERR) &&
+           (RSET(AHCI_PX_TFD, AHCI_PX_TFD_STS_BSY) ||
+            RSET(AHCI_PX_CI, 1 << cmd->slot) ||
+            (cmd->props->ncq && RSET(AHCI_PX_SACT, 1 << cmd->slot)))) {
         usleep(50);
     }
 
@@ -1226,9 +1280,9 @@ void ahci_command_verify(AHCIQState *ahci, AHCICommand *cmd)
     uint8_t slot = cmd->slot;
     uint8_t port = cmd->port;
 
-    ahci_port_check_error(ahci, port, cmd->interrupts, cmd->errors);
-    ahci_port_check_interrupts(ahci, port, cmd->interrupts);
-    ahci_port_check_nonbusy(ahci, port, slot);
+    ahci_port_check_nonbusy(ahci, cmd);
+    ahci_port_check_error(ahci, cmd);
+    ahci_port_check_interrupts(ahci, cmd);
     ahci_port_check_cmd_sanity(ahci, cmd);
     if (cmd->interrupts & AHCI_PX_IS_DHRS) {
         ahci_port_check_d2h_sanity(ahci, port, slot);
diff --git a/tests/qtest/libqos/ahci.h b/tests/qtest/libqos/ahci.h
index 88835b6228..48017864bf 100644
--- a/tests/qtest/libqos/ahci.h
+++ b/tests/qtest/libqos/ahci.h
@@ -590,11 +590,9 @@ void ahci_set_command_header(AHCIQState *ahci, uint8_t port,
 void ahci_destroy_command(AHCIQState *ahci, uint8_t port, uint8_t slot);
 
 /* AHCI sanity check routines */
-void ahci_port_check_error(AHCIQState *ahci, uint8_t port,
-                           uint32_t imask, uint8_t emask);
-void ahci_port_check_interrupts(AHCIQState *ahci, uint8_t port,
-                                uint32_t intr_mask);
-void ahci_port_check_nonbusy(AHCIQState *ahci, uint8_t port, uint8_t slot);
+void ahci_port_check_error(AHCIQState *ahci, AHCICommand *cmd);
+void ahci_port_check_interrupts(AHCIQState *ahci, AHCICommand *cmd);
+void ahci_port_check_nonbusy(AHCIQState *ahci, AHCICommand *cmd);
 void ahci_port_check_d2h_sanity(AHCIQState *ahci, uint8_t port, uint8_t slot);
 void ahci_port_check_pio_sanity(AHCIQState *ahci, AHCICommand *cmd);
 void ahci_port_check_cmd_sanity(AHCIQState *ahci, AHCICommand *cmd);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:18:58 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:18:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815750.1229879 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoNu-0007Tk-7W; Thu, 10 Oct 2024 08:18:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815750.1229879; Thu, 10 Oct 2024 08:18:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoNu-0007Tc-4i; Thu, 10 Oct 2024 08:18:58 +0000
Received: by outflank-mailman (input) for mailman id 815750;
 Thu, 10 Oct 2024 08:18:57 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoNt-0007TR-51
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:18:57 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoNt-00075G-4D
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:18:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoNt-00056G-3N
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:18:57 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=NYrLA34b8SxHnFm+42ujSu+wSm4M1Sbb6nnGi+2klDc=; b=ptybJdjy5wx5Mo2KTdBvymBd5w
	RPXOL9WcuWM+17P+0Wc2BbyMN0tnlkd3lmFRf7Resv0rFvoeNgK/LKr77nCSBfMDRUfoD/Nizzei/
	228AK8kEwVJ2eIqZD86mYkp1Lfas+HMgToA263uSpe2xwbUaNJn8YReSFPA0khB8XKmw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/ide/ahci: fix ahci_write_fis_sdb()
Message-Id: <E1syoNt-00056G-3N@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:18:57 +0000

commit 9c7e2253eba2e057f11377beb64dd78d12a1e27d
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:43 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    hw/ide/ahci: fix ahci_write_fis_sdb()
    
    When there is an error, we need to raise a TFES error irq, see AHCI 1.3.1,
    5.3.13.1 SDB:Entry.
    
    If ERR_STAT is set, we jump to state ERR:FatalTaskfile, which will raise
    a TFES IRQ unconditionally, regardless if the I bit is set in the FIS or
    not.
    
    Thus, we should never raise a normal IRQ after having sent an error IRQ.
    
    It is valid to signal successfully completed commands as finished in the
    same SDB FIS that generates the error IRQ. The important thing is that
    commands that did not complete successfully (e.g. commands that were
    aborted, do not get the finished bit set).
    
    Before this commit, there was never a TFES IRQ raised on NCQ error.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20230609140844.202795-8-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit 7e85cb0db4c693b4e084a00e66fe73a22ed1688a)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/ahci.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index a7b487ff33..8ce3dd796e 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -806,8 +806,14 @@ static void ahci_write_fis_sdb(AHCIState *s, NCQTransferState *ncq_tfs)
     pr->scr_act &= ~ad->finished;
     ad->finished = 0;
 
-    /* Trigger IRQ if interrupt bit is set (which currently, it always is) */
-    if (sdb_fis->flags & 0x40) {
+    /*
+     * TFES IRQ is always raised if ERR_STAT is set, regardless of I bit.
+     * If ERR_STAT is not set, trigger SDBS IRQ if interrupt bit is set
+     * (which currently, it always is).
+     */
+    if (sdb_fis->status & ERR_STAT) {
+        ahci_trigger_irq(s, ad, AHCI_PORT_IRQ_BIT_TFES);
+    } else if (sdb_fis->flags & 0x40) {
         ahci_trigger_irq(s, ad, AHCI_PORT_IRQ_BIT_SDBS);
     }
 }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:19:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:19:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815751.1229884 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoO4-0007X8-Aw; Thu, 10 Oct 2024 08:19:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815751.1229884; Thu, 10 Oct 2024 08:19:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoO4-0007X0-8E; Thu, 10 Oct 2024 08:19:08 +0000
Received: by outflank-mailman (input) for mailman id 815751;
 Thu, 10 Oct 2024 08:19:07 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoO3-0007Wo-7y
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:19:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoO3-00075c-7J
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:19:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoO3-00057W-6Q
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:19:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9L8qrIRQklo82g5cIn7zw9fe/GSAlttk5emn8IPmFpE=; b=AMslcBUJ8M34IUXbEvHPii11qM
	bpOgI9mUV4REdDgAqBxwNbz7EeGm5uxBfvNUjDKC452t2q2eZTBya4JbKop8PTwZDYKmq+tOq1gSn
	aCdecSi620hYwzYOWPu01bSEZEU4jjHVnCMBQsHF8ekwAxjcOCMIJBzhaFKEp2YlNRMQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/ide/ahci: fix broken SError handling
Message-Id: <E1syoO3-00057W-6Q@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:19:07 +0000

commit 4f6c55371743ba9d6512fcf4a88a5b5b8936037e
Author:     Niklas Cassel <niklas.cassel@wdc.com>
AuthorDate: Fri Jun 9 16:08:44 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    hw/ide/ahci: fix broken SError handling
    
    When encountering an NCQ error, you should not write the NCQ tag to the
    SError register. This is completely wrong.
    
    The SError register has a clear definition, where each bit represents a
    different error, see PxSERR definition in AHCI 1.3.1.
    
    If we write a random value (like the NCQ tag) in SError, e.g. Linux will
    read SError, and will trigger arbitrary error handling depending on the
    NCQ tag that happened to be executing.
    
    In case of success, ncq_cb() will call ncq_finish().
    In case of error, ncq_cb() will call ncq_err() (which will clear
    ncq_tfs->used), and then call ncq_finish(), thus using ncq_tfs->used is
    sufficient to tell if finished should get set or not.
    
    Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-id: 20230609140844.202795-9-nks@flawful.org
    Signed-off-by: John Snow <jsnow@redhat.com>
    (cherry picked from commit 9f89423537653de07ca40c18b5ff5b70b104cc93)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/ide/ahci.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index 8ce3dd796e..29ddd4b6c4 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -1012,7 +1012,6 @@ static void ncq_err(NCQTransferState *ncq_tfs)
 
     ide_state->error = ABRT_ERR;
     ide_state->status = READY_STAT | ERR_STAT;
-    ncq_tfs->drive->port_regs.scr_err |= (1 << ncq_tfs->tag);
     qemu_sglist_destroy(&ncq_tfs->sglist);
     ncq_tfs->used = 0;
 }
@@ -1022,7 +1021,7 @@ static void ncq_finish(NCQTransferState *ncq_tfs)
     /* If we didn't error out, set our finished bit. Errored commands
      * do not get a bit set for the SDB FIS ACT register, nor do they
      * clear the outstanding bit in scr_act (PxSACT). */
-    if (!(ncq_tfs->drive->port_regs.scr_err & (1 << ncq_tfs->tag))) {
+    if (ncq_tfs->used) {
         ncq_tfs->drive->finished |= (1 << ncq_tfs->tag);
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:19:18 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:19:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815752.1229889 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoOE-0007Zx-Cf; Thu, 10 Oct 2024 08:19:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815752.1229889; Thu, 10 Oct 2024 08:19:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoOE-0007Zp-9f; Thu, 10 Oct 2024 08:19:18 +0000
Received: by outflank-mailman (input) for mailman id 815752;
 Thu, 10 Oct 2024 08:19:17 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoOD-0007Za-B4
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:19:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoOD-00075j-AK
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:19:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoOD-00058V-9Y
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:19:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=xTU947tANsVdS/zP3PWlUkFP6jLxY6KTcFEgNHLiaro=; b=eAKMwIdm+xmxZpFL3zH9cwyaTy
	rXJxUgH+J1g+XTQiRmtHnys0wQrVdmEsmFoVJypvE+eiL7DHbxVnGUnRf8g8rj9zQRokQxI5n0K+Z
	QqeMWV5nb4oNVt7vA4fujFc9qqR4xD4w6EVhBH3ZuHkLTOQ1B6Rcrdg2zViZvM8qlSnk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/i2c/aspeed: Fix Tx count and Rx size error in buffer pool mode
Message-Id: <E1syoOD-00058V-9Y@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:19:17 +0000

commit 4a398e64ba8e9c1eced75217d856668c0d17e62e
Author:     Hang Yu <francis_yuu@stu.pku.edu.cn>
AuthorDate: Sat Aug 12 14:52:28 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    hw/i2c/aspeed: Fix Tx count and Rx size error in buffer pool mode
    
    Fixed inconsistency between the regisiter bit field definition header file
    and the ast2600 datasheet. The reg name is I2CD1C:Pool Buffer Control
    Register in old register mode and  I2CC0C: Master/Slave Pool Buffer Control
    Register in new register mode. They share bit field
    [12:8]:Transmit Data Byte Count and bit field
    [29:24]:Actual Received Pool Buffer Size according to the datasheet.
    According to the ast2600 datasheet,the actual Tx count is
    Transmit Data Byte Count plus 1, and the max Rx size is
    Receive Pool Buffer Size plus 1, both in Pool Buffer Control Register.
    The version before forgot to plus 1, and mistake Rx count for Rx size.
    
    Signed-off-by: Hang Yu <francis_yuu@stu.pku.edu.cn>
    Fixes: 3be3d6ccf2ad ("aspeed: i2c: Migrate to registerfields API")
    Reviewed-by: Cédric Le Goater <clg@kaod.org>
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    (cherry picked from commit 97b8aa5ae9ff197394395eda5062ea3681e09c28)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/i2c/aspeed_i2c.c         | 8 ++++----
 include/hw/i2c/aspeed_i2c.h | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/hw/i2c/aspeed_i2c.c b/hw/i2c/aspeed_i2c.c
index 1f071a3811..e485d8bfb8 100644
--- a/hw/i2c/aspeed_i2c.c
+++ b/hw/i2c/aspeed_i2c.c
@@ -236,7 +236,7 @@ static int aspeed_i2c_bus_send(AspeedI2CBus *bus, uint8_t pool_start)
     uint32_t reg_byte_buf = aspeed_i2c_bus_byte_buf_offset(bus);
     uint32_t reg_dma_len = aspeed_i2c_bus_dma_len_offset(bus);
     int pool_tx_count = SHARED_ARRAY_FIELD_EX32(bus->regs, reg_pool_ctrl,
-                                                TX_COUNT);
+                                                TX_COUNT) + 1;
 
     if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_BUFF_EN)) {
         for (i = pool_start; i < pool_tx_count; i++) {
@@ -293,7 +293,7 @@ static void aspeed_i2c_bus_recv(AspeedI2CBus *bus)
     uint32_t reg_dma_len = aspeed_i2c_bus_dma_len_offset(bus);
     uint32_t reg_dma_addr = aspeed_i2c_bus_dma_addr_offset(bus);
     int pool_rx_count = SHARED_ARRAY_FIELD_EX32(bus->regs, reg_pool_ctrl,
-                                                RX_COUNT);
+                                                RX_SIZE) + 1;
 
     if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, RX_BUFF_EN)) {
         uint8_t *pool_base = aic->bus_pool_base(bus);
@@ -418,7 +418,7 @@ static void aspeed_i2c_bus_cmd_dump(AspeedI2CBus *bus)
     uint32_t reg_intr_sts = aspeed_i2c_bus_intr_sts_offset(bus);
     uint32_t reg_dma_len = aspeed_i2c_bus_dma_len_offset(bus);
     if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, RX_BUFF_EN)) {
-        count = SHARED_ARRAY_FIELD_EX32(bus->regs, reg_pool_ctrl, TX_COUNT);
+        count = SHARED_ARRAY_FIELD_EX32(bus->regs, reg_pool_ctrl, TX_COUNT) + 1;
     } else if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, RX_DMA_EN)) {
         count = bus->regs[reg_dma_len];
     } else { /* BYTE mode */
@@ -490,7 +490,7 @@ static void aspeed_i2c_bus_handle_cmd(AspeedI2CBus *bus, uint64_t value)
          */
         if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_BUFF_EN)) {
             if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_pool_ctrl, TX_COUNT)
-                == 1) {
+                == 0) {
                 SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, M_TX_CMD, 0);
             } else {
                 /*
diff --git a/include/hw/i2c/aspeed_i2c.h b/include/hw/i2c/aspeed_i2c.h
index adc904d6c1..91d0e7157c 100644
--- a/include/hw/i2c/aspeed_i2c.h
+++ b/include/hw/i2c/aspeed_i2c.h
@@ -132,9 +132,9 @@ REG32(I2CD_CMD, 0x14) /* I2CD Command/Status */
 REG32(I2CD_DEV_ADDR, 0x18) /* Slave Device Address */
     SHARED_FIELD(SLAVE_DEV_ADDR1, 0, 7)
 REG32(I2CD_POOL_CTRL, 0x1C) /* Pool Buffer Control */
-    SHARED_FIELD(RX_COUNT, 24, 5)
+    SHARED_FIELD(RX_COUNT, 24, 6)
     SHARED_FIELD(RX_SIZE, 16, 5)
-    SHARED_FIELD(TX_COUNT, 9, 5)
+    SHARED_FIELD(TX_COUNT, 8, 5)
     FIELD(I2CD_POOL_CTRL, OFFSET, 2, 6) /* AST2400 */
 REG32(I2CD_BYTE_BUF, 0x20) /* Transmit/Receive Byte Buffer */
     SHARED_FIELD(RX_BUF, 8, 8)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:19:29 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:19:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815753.1229891 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoOP-0007cp-Da; Thu, 10 Oct 2024 08:19:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815753.1229891; Thu, 10 Oct 2024 08:19:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoOP-0007ci-B8; Thu, 10 Oct 2024 08:19:29 +0000
Received: by outflank-mailman (input) for mailman id 815753;
 Thu, 10 Oct 2024 08:19:27 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoON-0007cW-Dt
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:19:27 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoON-00075t-DE
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:19:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoON-00059B-CY
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:19:27 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hTrD86WALSxAhpzX4uyv8cDCsGDXoHJBvtOBFzKiWk4=; b=lefSwLH2QRavPhyMm3I7UQmMey
	gr4+yMpokirJ2/aUcr1q50m+a3l6CLP8oWEAkLpU1g61k3mhVSzjK+/Z9OaOwpv58dpcmsPtGs+aD
	aIRsNz+lP7+P0Wjq+QVJu+gnjvUJ5mGFGdlCynhM3H7C6If60yKNhBZW7MQGFKQwUQ3c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/i2c/aspeed: Fix TXBUF transmission start position error
Message-Id: <E1syoON-00059B-CY@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:19:27 +0000

commit c2ec46c694a176a2ced6d8b62f0ec40569f4a83d
Author:     Hang Yu <francis_yuu@stu.pku.edu.cn>
AuthorDate: Sat Aug 12 14:52:29 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    hw/i2c/aspeed: Fix TXBUF transmission start position error
    
    According to the ast2600 datasheet and the linux aspeed i2c driver,
    the TXBUF transmission start position should be TXBUF[0] instead
    of TXBUF[1],so the arg pool_start is useless,and the address is not
    included in TXBUF.So even if Tx Count equals zero,there is at least
    1 byte data needs to be transmitted,and M_TX_CMD should not be cleared
    at this condition.The driver url is:
    https://github.com/AspeedTech-BMC/linux/blob/aspeed-master-v5.15/drivers/i2c/busses/i2c-ast2600.c
    
    Signed-off-by: Hang Yu <francis_yuu@stu.pku.edu.cn>
    Fixes: 6054fc73e8f4 ("aspeed/i2c: Add support for pool buffer transfers")
    Reviewed-by: Cédric Le Goater <clg@kaod.org>
    Signed-off-by: Cédric Le Goater <clg@kaod.org>
    (cherry picked from commit 961faf3ddbd8ffcdf776bbcf88af0bc97218114a)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/i2c/aspeed_i2c.c | 30 ++++++------------------------
 1 file changed, 6 insertions(+), 24 deletions(-)

diff --git a/hw/i2c/aspeed_i2c.c b/hw/i2c/aspeed_i2c.c
index e485d8bfb8..44905d7899 100644
--- a/hw/i2c/aspeed_i2c.c
+++ b/hw/i2c/aspeed_i2c.c
@@ -226,7 +226,7 @@ static int aspeed_i2c_dma_read(AspeedI2CBus *bus, uint8_t *data)
     return 0;
 }
 
-static int aspeed_i2c_bus_send(AspeedI2CBus *bus, uint8_t pool_start)
+static int aspeed_i2c_bus_send(AspeedI2CBus *bus)
 {
     AspeedI2CClass *aic = ASPEED_I2C_GET_CLASS(bus->controller);
     int ret = -1;
@@ -239,7 +239,7 @@ static int aspeed_i2c_bus_send(AspeedI2CBus *bus, uint8_t pool_start)
                                                 TX_COUNT) + 1;
 
     if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_BUFF_EN)) {
-        for (i = pool_start; i < pool_tx_count; i++) {
+        for (i = 0; i < pool_tx_count; i++) {
             uint8_t *pool_base = aic->bus_pool_base(bus);
 
             trace_aspeed_i2c_bus_send("BUF", i + 1, pool_tx_count,
@@ -273,7 +273,7 @@ static int aspeed_i2c_bus_send(AspeedI2CBus *bus, uint8_t pool_start)
         }
         SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, TX_DMA_EN, 0);
     } else {
-        trace_aspeed_i2c_bus_send("BYTE", pool_start, 1,
+        trace_aspeed_i2c_bus_send("BYTE", 0, 1,
                                   bus->regs[reg_byte_buf]);
         ret = i2c_send(bus->bus, bus->regs[reg_byte_buf]);
     }
@@ -446,10 +446,8 @@ static void aspeed_i2c_bus_cmd_dump(AspeedI2CBus *bus)
  */
 static void aspeed_i2c_bus_handle_cmd(AspeedI2CBus *bus, uint64_t value)
 {
-    uint8_t pool_start = 0;
     uint32_t reg_intr_sts = aspeed_i2c_bus_intr_sts_offset(bus);
     uint32_t reg_cmd = aspeed_i2c_bus_cmd_offset(bus);
-    uint32_t reg_pool_ctrl = aspeed_i2c_bus_pool_ctrl_offset(bus);
     uint32_t reg_dma_len = aspeed_i2c_bus_dma_len_offset(bus);
 
     if (!aspeed_i2c_check_sram(bus)) {
@@ -483,27 +481,11 @@ static void aspeed_i2c_bus_handle_cmd(AspeedI2CBus *bus, uint64_t value)
 
         SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, M_START_CMD, 0);
 
-        /*
-         * The START command is also a TX command, as the slave
-         * address is sent on the bus. Drop the TX flag if nothing
-         * else needs to be sent in this sequence.
-         */
-        if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_BUFF_EN)) {
-            if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_pool_ctrl, TX_COUNT)
-                == 0) {
-                SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, M_TX_CMD, 0);
-            } else {
-                /*
-                 * Increase the start index in the TX pool buffer to
-                 * skip the address byte.
-                 */
-                pool_start++;
-            }
-        } else if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_DMA_EN)) {
+        if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_DMA_EN)) {
             if (bus->regs[reg_dma_len] == 0) {
                 SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, M_TX_CMD, 0);
             }
-        } else {
+        } else if (!SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, TX_BUFF_EN)) {
             SHARED_ARRAY_FIELD_DP32(bus->regs, reg_cmd, M_TX_CMD, 0);
         }
 
@@ -520,7 +502,7 @@ static void aspeed_i2c_bus_handle_cmd(AspeedI2CBus *bus, uint64_t value)
 
     if (SHARED_ARRAY_FIELD_EX32(bus->regs, reg_cmd, M_TX_CMD)) {
         aspeed_i2c_set_state(bus, I2CD_MTXD);
-        if (aspeed_i2c_bus_send(bus, pool_start)) {
+        if (aspeed_i2c_bus_send(bus)) {
             SHARED_ARRAY_FIELD_DP32(bus->regs, reg_intr_sts, TX_NAK, 1);
             i2c_end_transfer(bus->bus);
         } else {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:19:39 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:19:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815754.1229895 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoOZ-0007fX-FA; Thu, 10 Oct 2024 08:19:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815754.1229895; Thu, 10 Oct 2024 08:19:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoOZ-0007fP-Cd; Thu, 10 Oct 2024 08:19:39 +0000
Received: by outflank-mailman (input) for mailman id 815754;
 Thu, 10 Oct 2024 08:19:37 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoOX-0007fC-Gz
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:19:37 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoOX-000766-GJ
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:19:37 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoOX-00059x-Fe
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:19:37 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QjDKkFSKEoeY9bEd0QqLqGNk4oPhmW8MVOd0VfE0j30=; b=guVla7FJIypTvDXGZkSZAnCjgy
	o9EgoOhXS7HbxDYNOrD39meumTkcTT9fW81rWBZsbgBGivhdw/RkGTtHxImLX9MUGRK6OiXpuYDt6
	h7X3ecz+VzI9CN1ym9rukf+XEk3QvAKV1hPpvzKwl1y7PcHIsoqOAY0j/vT86/5Wbe6k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] qemu-options.hx: Rephrase the descriptions of the -hd* and -cdrom options
Message-Id: <E1syoOX-00059x-Fe@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:19:37 +0000

commit 45b61f730d953b713dc2bb8b695d6555a5b8adb6
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Tue Aug 29 15:29:48 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    qemu-options.hx: Rephrase the descriptions of the -hd* and -cdrom options
    
    The current description says that these options will create a device
    on the IDE bus, which is only true on x86. So rephrase these sentences
    a little bit to speak of "default bus" instead.
    
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (cherry picked from commit bcd8e243083c878884e52d609deddbe6be17c730)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 qemu-options.hx | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/qemu-options.hx b/qemu-options.hx
index fdddfab6ff..af8156d2f8 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1174,10 +1174,10 @@ SRST
 ERST
 
 DEF("hda", HAS_ARG, QEMU_OPTION_hda,
-    "-hda/-hdb file  use 'file' as IDE hard disk 0/1 image\n", QEMU_ARCH_ALL)
+    "-hda/-hdb file  use 'file' as hard disk 0/1 image\n", QEMU_ARCH_ALL)
 DEF("hdb", HAS_ARG, QEMU_OPTION_hdb, "", QEMU_ARCH_ALL)
 DEF("hdc", HAS_ARG, QEMU_OPTION_hdc,
-    "-hdc/-hdd file  use 'file' as IDE hard disk 2/3 image\n", QEMU_ARCH_ALL)
+    "-hdc/-hdd file  use 'file' as hard disk 2/3 image\n", QEMU_ARCH_ALL)
 DEF("hdd", HAS_ARG, QEMU_OPTION_hdd, "", QEMU_ARCH_ALL)
 SRST
 ``-hda file``
@@ -1187,18 +1187,22 @@ SRST
 ``-hdc file``
   \ 
 ``-hdd file``
-    Use file as hard disk 0, 1, 2 or 3 image (see the :ref:`disk images`
-    chapter in the System Emulation Users Guide).
+    Use file as hard disk 0, 1, 2 or 3 image on the default bus of the
+    emulated machine (this is for example the IDE bus on most x86 machines,
+    but it can also be SCSI, virtio or something else on other target
+    architectures). See also the :ref:`disk images` chapter in the System
+    Emulation Users Guide.
 ERST
 
 DEF("cdrom", HAS_ARG, QEMU_OPTION_cdrom,
-    "-cdrom file     use 'file' as IDE cdrom image (cdrom is ide1 master)\n",
+    "-cdrom file     use 'file' as CD-ROM image\n",
     QEMU_ARCH_ALL)
 SRST
 ``-cdrom file``
-    Use file as CD-ROM image (you cannot use ``-hdc`` and ``-cdrom`` at
-    the same time). You can use the host CD-ROM by using ``/dev/cdrom``
-    as filename.
+    Use file as CD-ROM image on the default bus of the emulated machine
+    (which is IDE1 master on x86, so you cannot use ``-hdc`` and ``-cdrom``
+    at the same time there). On systems that support it, you can use the
+    host CD-ROM by using ``/dev/cdrom`` as filename.
 ERST
 
 DEF("blockdev", HAS_ARG, QEMU_OPTION_blockdev,
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:19:49 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:19:49 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815755.1229900 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoOj-0007iF-H1; Thu, 10 Oct 2024 08:19:49 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815755.1229900; Thu, 10 Oct 2024 08:19:49 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoOj-0007i7-E6; Thu, 10 Oct 2024 08:19:49 +0000
Received: by outflank-mailman (input) for mailman id 815755;
 Thu, 10 Oct 2024 08:19:47 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoOh-0007hp-L9
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:19:47 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoOh-00076J-JP
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:19:47 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoOh-0005AY-Id
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:19:47 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/SDbubypdT8nvEwwHkzczwTwmFFG1rxJs3H175VF7I4=; b=Bsf2Y1dDe8WNDJSDgqAi5MLLh5
	un7pn+9hhTA/2WTQbDJR4NZNx7kWqFxg+GQPc5oMbjbSg1JzVh+CYmYrov9MRFN/p45TFSIzghGA3
	4m17TcP1z7t56BrD23lyHKVRPNzLtusqPl17H6AiDHgLNS3RiTWwkGpaStVCLfYt/bdo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] docs tests: Fix use of migrate_set_parameter
Message-Id: <E1syoOh-0005AY-Id@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:19:47 +0000

commit 42edb4723afe4a94a7c8011fa7fe02c3846cdc7e
Author:     Markus Armbruster <armbru@redhat.com>
AuthorDate: Fri Aug 25 17:59:22 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    docs tests: Fix use of migrate_set_parameter
    
    docs/multi-thread-compression.txt uses parameter names with
    underscores instead of dashes.  Wrong since day one.
    
    docs/rdma.txt, tests/qemu-iotests/181, and tests/qtest/test-hmp.c are
    wrong the same way since commit cbde7be900d2 (v6.0.0).  Hard to see,
    as test-hmp doesn't check whether the commands work, and iotest 181
    appears to be unaffected.
    
    Fixes: 263170e679df (docs: Add a doc about multiple thread compression)
    Fixes: cbde7be900d2 (migrate: remove QMP/HMP commands for speed, downtime and cache size)
    Signed-off-by: Markus Armbruster <armbru@redhat.com>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (cherry picked from commit b21a6e31a182a5ae7436a444f840d49aac07c94f)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 docs/multi-thread-compression.txt | 12 ++++++------
 docs/rdma.txt                     |  2 +-
 tests/qemu-iotests/181            |  2 +-
 tests/qtest/test-hmp.c            |  6 +++---
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/docs/multi-thread-compression.txt b/docs/multi-thread-compression.txt
index bb88c6bdf1..95b1556f67 100644
--- a/docs/multi-thread-compression.txt
+++ b/docs/multi-thread-compression.txt
@@ -117,13 +117,13 @@ to support the multiple thread compression migration:
     {qemu} migrate_set_capability compress on
 
 3. Set the compression thread count on source:
-    {qemu} migrate_set_parameter compress_threads 12
+    {qemu} migrate_set_parameter compress-threads 12
 
 4. Set the compression level on the source:
-    {qemu} migrate_set_parameter compress_level 1
+    {qemu} migrate_set_parameter compress-level 1
 
 5. Set the decompression thread count on destination:
-    {qemu} migrate_set_parameter decompress_threads 3
+    {qemu} migrate_set_parameter decompress-threads 3
 
 6. Start outgoing migration:
     {qemu} migrate -d tcp:destination.host:4444
@@ -133,9 +133,9 @@ to support the multiple thread compression migration:
 
 The following are the default settings:
     compress: off
-    compress_threads: 8
-    decompress_threads: 2
-    compress_level: 1 (which means best speed)
+    compress-threads: 8
+    decompress-threads: 2
+    compress-level: 1 (which means best speed)
 
 So, only the first two steps are required to use the multiple
 thread compression in migration. You can do more if the default
diff --git a/docs/rdma.txt b/docs/rdma.txt
index 2b4cdea1d8..bd8dd799a9 100644
--- a/docs/rdma.txt
+++ b/docs/rdma.txt
@@ -89,7 +89,7 @@ RUNNING:
 First, set the migration speed to match your hardware's capabilities:
 
 QEMU Monitor Command:
-$ migrate_set_parameter max_bandwidth 40g # or whatever is the MAX of your RDMA device
+$ migrate_set_parameter max-bandwidth 40g # or whatever is the MAX of your RDMA device
 
 Next, on the destination machine, add the following to the QEMU command line:
 
diff --git a/tests/qemu-iotests/181 b/tests/qemu-iotests/181
index cb96d09ae5..dc90a10757 100755
--- a/tests/qemu-iotests/181
+++ b/tests/qemu-iotests/181
@@ -109,7 +109,7 @@ if [ ${QEMU_STATUS[$dest]} -lt 0 ]; then
     _notrun 'Postcopy is not supported'
 fi
 
-_send_qemu_cmd $src 'migrate_set_parameter max_bandwidth 4k' "(qemu)"
+_send_qemu_cmd $src 'migrate_set_parameter max-bandwidth 4k' "(qemu)"
 _send_qemu_cmd $src 'migrate_set_capability postcopy-ram on' "(qemu)"
 _send_qemu_cmd $src "migrate -d unix:${MIG_SOCKET}" "(qemu)"
 _send_qemu_cmd $src 'migrate_start_postcopy' "(qemu)"
diff --git a/tests/qtest/test-hmp.c b/tests/qtest/test-hmp.c
index b4a920df89..e75523f882 100644
--- a/tests/qtest/test-hmp.c
+++ b/tests/qtest/test-hmp.c
@@ -45,9 +45,9 @@ static const char *hmp_cmds[] = {
     "log all",
     "log none",
     "memsave 0 4096 \"/dev/null\"",
-    "migrate_set_parameter xbzrle_cache_size 1",
-    "migrate_set_parameter downtime_limit 1",
-    "migrate_set_parameter max_bandwidth 1",
+    "migrate_set_parameter xbzrle-cache-size 1",
+    "migrate_set_parameter downtime-limit 1",
+    "migrate_set_parameter max-bandwidth 1",
     "netdev_add user,id=net1",
     "set_link net1 off",
     "set_link net1 on",
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:19:59 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:19:59 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815756.1229904 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoOt-00087c-IO; Thu, 10 Oct 2024 08:19:59 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815756.1229904; Thu, 10 Oct 2024 08:19:59 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoOt-00087U-FW; Thu, 10 Oct 2024 08:19:59 +0000
Received: by outflank-mailman (input) for mailman id 815756;
 Thu, 10 Oct 2024 08:19:57 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoOr-00083g-NL
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:19:57 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoOr-00076j-Mb
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:19:57 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoOr-0005BS-Le
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:19:57 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bhBzMgzL4Oq0eCKoMo2wf++BBQIwL75yzn7z6pWnKY4=; b=3VYLFDZvwRUmhnMCj9vu+uJsrR
	f2KJA/DlWcxyVY3lmY+FcHH1X9qDb6fKlLjuExt2Mr/dcYXEgKNIv0LT4z69VR3bHW0ZF3tIJvyvI
	NnhUsSrSB5McWuXJgsm9EFxVGu1AZTL6WOn1jGQ0BF6XOJfDRPzX0TkCCoMVHdntONjI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/net/vmxnet3: Fix guest-triggerable assert()
Message-Id: <E1syoOr-0005BS-Le@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:19:57 +0000

commit c68b844d3376764240afdb3c55d451e4dac11004
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Thu Aug 17 14:56:00 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    hw/net/vmxnet3: Fix guest-triggerable assert()
    
    The assert() that checks for valid MTU sizes can be triggered by
    the guest (e.g. with the reproducer code from the bug ticket
    https://gitlab.com/qemu-project/qemu/-/issues/517 ). Let's avoid
    this problem by simply logging the error and refusing to activate
    the device instead.
    
    Fixes: d05dcd94ae ("net: vmxnet3: validate configuration values during activate")
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    Cc: qemu-stable@nongnu.org
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    [Mjt: change format specifier from %d to %u for uint32_t argument]
    (cherry picked from commit 90a0778421acdf4ca903be64c8ed19378183c944)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/net/vmxnet3.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/net/vmxnet3.c b/hw/net/vmxnet3.c
index cb52db96a2..fd3b9aff5b 100644
--- a/hw/net/vmxnet3.c
+++ b/hw/net/vmxnet3.c
@@ -1439,7 +1439,10 @@ static void vmxnet3_activate_device(VMXNET3State *s)
     vmxnet3_setup_rx_filtering(s);
     /* Cache fields from shared memory */
     s->mtu = VMXNET3_READ_DRV_SHARED32(d, s->drv_shmem, devRead.misc.mtu);
-    assert(VMXNET3_MIN_MTU <= s->mtu && s->mtu <= VMXNET3_MAX_MTU);
+    if (s->mtu < VMXNET3_MIN_MTU || s->mtu > VMXNET3_MAX_MTU) {
+        qemu_log_mask(LOG_GUEST_ERROR, "vmxnet3: Bad MTU size: %u\n", s->mtu);
+        return;
+    }
     VMW_CFPRN("MTU is %u", s->mtu);
 
     s->max_rx_frags =
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:20:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:20:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815757.1229907 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoP3-0000pR-Kf; Thu, 10 Oct 2024 08:20:09 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815757.1229907; Thu, 10 Oct 2024 08:20:09 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoP3-0000pK-IC; Thu, 10 Oct 2024 08:20:09 +0000
Received: by outflank-mailman (input) for mailman id 815757;
 Thu, 10 Oct 2024 08:20:07 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoP1-0000lC-QH
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:20:07 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoP1-00077C-Ph
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:20:07 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoP1-0005Dv-Ox
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:20:07 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=p0JW+WduJU9lDc3XnRLT+oXluA5OEHtw6iNGMX56Pe8=; b=0giMvt58MjfOOqI5U5yaIqrPPP
	PEnT2sycgQWGVUQosjXC5mY8mGnNVKdwpq3XScylxR0v10MsSaYlfxzn2AhvhKZIQHZELuJhmNISC
	EMT2fRfpBrNFsQSawITiOxnOenFqYrdaH+H4Ipnx7yL9+sWK2WhqgU4j7vqVLLvbD4DY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] qxl: don't assert() if device isn't yet initialized
Message-Id: <E1syoP1-0005Dv-Ox@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:20:07 +0000

commit 5929f5309194e46f40b20aa07797f531663e323f
Author:     Marc-André Lureau <marcandre.lureau@redhat.com>
AuthorDate: Mon Aug 14 23:33:30 2023 +0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Sun Sep 10 19:40:11 2023 +0300

    qxl: don't assert() if device isn't yet initialized
    
    If the PCI BAR isn't yet mapped or was unmapped, QXL_IO_SET_MODE will
    assert(). Instead, report a guest bug and keep going.
    
    This can be reproduced with:
    
    cat << EOF | ./qemu-system-x86_64 -vga qxl -m 2048 -nodefaults -qtest stdio
    outl 0xcf8 0x8000101c
    outl 0xcfc 0xc000
    outl 0xcf8 0x80001001
    outl 0xcfc 0x01000000
    outl 0xc006 0x00
    EOF
    
    Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1829
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Reviewed-by: Thomas Huth <thuth@redhat.com>
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (cherry picked from commit 95bef686e490bc3afc3f51f5fc6e20bf260b938c)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/display/qxl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index f1c0eb7dfc..70b73820b2 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -1591,7 +1591,10 @@ static void qxl_set_mode(PCIQXLDevice *d, unsigned int modenr, int loadvm)
     }
 
     d->guest_slots[0].slot = slot;
-    assert(qxl_add_memslot(d, 0, devmem, QXL_SYNC) == 0);
+    if (qxl_add_memslot(d, 0, devmem, QXL_SYNC) != 0) {
+        qxl_set_guest_bug(d, "device isn't initialized yet");
+        return;
+    }
 
     d->guest_primary.surface = surface;
     qxl_create_guest_primary(d, 0, QXL_SYNC);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:20:19 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:20:19 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815758.1229913 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoPD-000114-MY; Thu, 10 Oct 2024 08:20:19 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815758.1229913; Thu, 10 Oct 2024 08:20:19 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoPD-00010w-Jg; Thu, 10 Oct 2024 08:20:19 +0000
Received: by outflank-mailman (input) for mailman id 815758;
 Thu, 10 Oct 2024 08:20:17 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoPB-00010X-TD
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:20:17 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoPB-00077K-Sa
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:20:17 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoPB-0005Eo-Ry
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:20:17 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=saEYsSsaQdcRODjvZ2lk7SJYIJkH+xQOHGu/AIbzu0s=; b=QsIz6zZBhAfvbA6PNpzZTQDs3+
	aCxTZch62B7ru0rcZa5FI3KhQwa11ygC5wg7SN8TxyDuBtiuBN5LlcBB58tgVU2Ub+yZj2pXCB03T
	HBIsysfRrrROpp8Zv62Vk4MIKKEVLgsF1SzU7kGOoGuH8iOLbsa6opsdpm7kLommMUBQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] virtio: Drop out of coroutine context in virtio_load()
Message-Id: <E1syoPB-0005Eo-Ry@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:20:17 +0000

commit 41af7a9bc41c15460a4dbf4d35879d69c460d02a
Author:     Kevin Wolf <kwolf@redhat.com>
AuthorDate: Tue Sep 5 16:50:02 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Mon Sep 11 22:31:56 2023 +0300

    virtio: Drop out of coroutine context in virtio_load()
    
    virtio_load() as a whole should run in coroutine context because it
    reads from the migration stream and we don't want this to block.
    
    However, it calls virtio_set_features_nocheck() and devices don't
    expect their .set_features callback to run in a coroutine and therefore
    call functions that may not be called in coroutine context. To fix this,
    drop out of coroutine context for calling virtio_set_features_nocheck().
    
    Without this fix, the following crash was reported:
    
      #0  __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
      #1  0x00007efc738c05d3 in __pthread_kill_internal (signo=6, threadid=<optimized out>) at pthread_kill.c:78
      #2  0x00007efc73873d26 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
      #3  0x00007efc738477f3 in __GI_abort () at abort.c:79
      #4  0x00007efc7384771b in __assert_fail_base (fmt=0x7efc739dbcb8 "", assertion=assertion@entry=0x560aebfbf5cf "!qemu_in_coroutine()",
         file=file@entry=0x560aebfcd2d4 "../block/graph-lock.c", line=line@entry=275, function=function@entry=0x560aebfcd34d "void bdrv_graph_rdlock_main_loop(void)") at assert.c:92
      #5  0x00007efc7386ccc6 in __assert_fail (assertion=0x560aebfbf5cf "!qemu_in_coroutine()", file=0x560aebfcd2d4 "../block/graph-lock.c", line=275,
         function=0x560aebfcd34d "void bdrv_graph_rdlock_main_loop(void)") at assert.c:101
      #6  0x0000560aebcd8dd6 in bdrv_register_buf ()
      #7  0x0000560aeb97ed97 in ram_block_added.llvm ()
      #8  0x0000560aebb8303f in ram_block_add.llvm ()
      #9  0x0000560aebb834fa in qemu_ram_alloc_internal.llvm ()
      #10 0x0000560aebb2ac98 in vfio_region_mmap ()
      #11 0x0000560aebb3ea0f in vfio_bars_register ()
      #12 0x0000560aebb3c628 in vfio_realize ()
      #13 0x0000560aeb90f0c2 in pci_qdev_realize ()
      #14 0x0000560aebc40305 in device_set_realized ()
      #15 0x0000560aebc48e07 in property_set_bool.llvm ()
      #16 0x0000560aebc46582 in object_property_set ()
      #17 0x0000560aebc4cd58 in object_property_set_qobject ()
      #18 0x0000560aebc46ba7 in object_property_set_bool ()
      #19 0x0000560aeb98b3ca in qdev_device_add_from_qdict ()
      #20 0x0000560aebb1fbaf in virtio_net_set_features ()
      #21 0x0000560aebb46b51 in virtio_set_features_nocheck ()
      #22 0x0000560aebb47107 in virtio_load ()
      #23 0x0000560aeb9ae7ce in vmstate_load_state ()
      #24 0x0000560aeb9d2ee9 in qemu_loadvm_state_main ()
      #25 0x0000560aeb9d45e1 in qemu_loadvm_state ()
      #26 0x0000560aeb9bc32c in process_incoming_migration_co.llvm ()
      #27 0x0000560aebeace56 in coroutine_trampoline.llvm ()
    
    Cc: qemu-stable@nongnu.org
    Buglink: https://issues.redhat.com/browse/RHEL-832
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>
    Message-ID: <20230905145002.46391-3-kwolf@redhat.com>
    Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
    Signed-off-by: Kevin Wolf <kwolf@redhat.com>
    (cherry picked from commit 92e2e6a867334a990f8d29f07ca34e3162fdd6ec)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/virtio/virtio.c | 45 ++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 40 insertions(+), 5 deletions(-)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 98c4819fcc..0010a9a5f1 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2825,8 +2825,9 @@ static int virtio_device_put(QEMUFile *f, void *opaque, size_t size,
 }
 
 /* A wrapper for use as a VMState .get function */
-static int virtio_device_get(QEMUFile *f, void *opaque, size_t size,
-                             const VMStateField *field)
+static int coroutine_mixed_fn
+virtio_device_get(QEMUFile *f, void *opaque, size_t size,
+                  const VMStateField *field)
 {
     VirtIODevice *vdev = VIRTIO_DEVICE(opaque);
     DeviceClass *dc = DEVICE_CLASS(VIRTIO_DEVICE_GET_CLASS(vdev));
@@ -2853,6 +2854,39 @@ static int virtio_set_features_nocheck(VirtIODevice *vdev, uint64_t val)
     return bad ? -1 : 0;
 }
 
+typedef struct VirtioSetFeaturesNocheckData {
+    Coroutine *co;
+    VirtIODevice *vdev;
+    uint64_t val;
+    int ret;
+} VirtioSetFeaturesNocheckData;
+
+static void virtio_set_features_nocheck_bh(void *opaque)
+{
+    VirtioSetFeaturesNocheckData *data = opaque;
+
+    data->ret = virtio_set_features_nocheck(data->vdev, data->val);
+    aio_co_wake(data->co);
+}
+
+static int coroutine_mixed_fn
+virtio_set_features_nocheck_maybe_co(VirtIODevice *vdev, uint64_t val)
+{
+    if (qemu_in_coroutine()) {
+        VirtioSetFeaturesNocheckData data = {
+            .co = qemu_coroutine_self(),
+            .vdev = vdev,
+            .val = val,
+        };
+        aio_bh_schedule_oneshot(qemu_get_current_aio_context(),
+                                virtio_set_features_nocheck_bh, &data);
+        qemu_coroutine_yield();
+        return data.ret;
+    } else {
+        return virtio_set_features_nocheck(vdev, val);
+    }
+}
+
 int virtio_set_features(VirtIODevice *vdev, uint64_t val)
 {
     int ret;
@@ -2906,7 +2940,8 @@ size_t virtio_get_config_size(const VirtIOConfigSizeParams *params,
     return config_size;
 }
 
-int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
+int coroutine_mixed_fn
+virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
 {
     int i, ret;
     int32_t config_len;
@@ -3023,14 +3058,14 @@ int virtio_load(VirtIODevice *vdev, QEMUFile *f, int version_id)
          * host_features.
          */
         uint64_t features64 = vdev->guest_features;
-        if (virtio_set_features_nocheck(vdev, features64) < 0) {
+        if (virtio_set_features_nocheck_maybe_co(vdev, features64) < 0) {
             error_report("Features 0x%" PRIx64 " unsupported. "
                          "Allowed features: 0x%" PRIx64,
                          features64, vdev->host_features);
             return -1;
         }
     } else {
-        if (virtio_set_features_nocheck(vdev, features) < 0) {
+        if (virtio_set_features_nocheck_maybe_co(vdev, features) < 0) {
             error_report("Features 0x%x unsupported. "
                          "Allowed features: 0x%" PRIx64,
                          features, vdev->host_features);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:20:29 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:20:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815759.1229916 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoPN-0001Lf-Ng; Thu, 10 Oct 2024 08:20:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815759.1229916; Thu, 10 Oct 2024 08:20:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoPN-0001LX-L6; Thu, 10 Oct 2024 08:20:29 +0000
Received: by outflank-mailman (input) for mailman id 815759;
 Thu, 10 Oct 2024 08:20:28 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoPL-0001GE-WB
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:20:27 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoPL-00077V-Vb
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:20:27 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoPL-0005FT-Uo
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:20:27 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=zfHtHWkwiVHSQdYRMt+aKFfLAV1Qp+NC5eiVfMPw1Wk=; b=wBk9u1D3k9nSSZLn6bD185ReZb
	naV74FoOG3RK9PrA65xLzQVwJOouWUDX2mCnRCJZuCh0Z9VsGhETq0RI7eVqQTUdFNSkuUb1P9NSx
	lb2qKgwXdDhD45TL6Ar6kDNatBKCyo1YWt7XyAauPOQCNxhGyc9NtE7ZJaUahxFlxh/g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] arm64: Restore trapless ptimer access
Message-Id: <E1syoPL-0005FT-Uo@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:20:27 +0000

commit 53a4e7ef420a2e272907b98fd8ffc199bcdc0e06
Author:     Colton Lewis <coltonlewis@google.com>
AuthorDate: Thu Aug 31 19:00:52 2023 +0000
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Mon Sep 11 22:33:58 2023 +0300

    arm64: Restore trapless ptimer access
    
    Due to recent KVM changes, QEMU is setting a ptimer offset resulting
    in unintended trap and emulate access and a consequent performance
    hit. Filter out the PTIMER_CNT register to restore trapless ptimer
    access.
    
    Quoting Andrew Jones:
    
    Simply reading the CNT register and writing back the same value is
    enough to set an offset, since the timer will have certainly moved
    past whatever value was read by the time it's written.  QEMU
    frequently saves and restores all registers in the get-reg-list array,
    unless they've been explicitly filtered out (with Linux commit
    680232a94c12, KVM_REG_ARM_PTIMER_CNT is now in the array). So, to
    restore trapless ptimer accesses, we need a QEMU patch to filter out
    the register.
    
    See
    https://lore.kernel.org/kvmarm/gsntttsonus5.fsf@coltonlewis-kvm.c.googlers.com/T/#m0770023762a821db2a3f0dd0a7dc6aa54e0d0da9
    for additional context.
    
    Cc: qemu-stable@nongnu.org
    Signed-off-by: Andrew Jones <andrew.jones@linux.dev>
    Signed-off-by: Colton Lewis <coltonlewis@google.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Tested-by: Colton Lewis <coltonlewis@google.com>
    Message-id: 20230831190052.129045-1-coltonlewis@google.com
    Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
    (cherry picked from commit 682814e2a3c883b27f24b9e7cab47313c49acbd4)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/arm/kvm64.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
index 810db33ccb..ed85bcfb5c 100644
--- a/target/arm/kvm64.c
+++ b/target/arm/kvm64.c
@@ -950,6 +950,7 @@ typedef struct CPRegStateLevel {
  */
 static const CPRegStateLevel non_runtime_cpregs[] = {
     { KVM_REG_ARM_TIMER_CNT, KVM_PUT_FULL_STATE },
+    { KVM_REG_ARM_PTIMER_CNT, KVM_PUT_FULL_STATE },
 };
 
 int kvm_arm_cpreg_level(uint64_t regidx)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:20:39 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:20:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815760.1229920 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoPX-0001jW-P6; Thu, 10 Oct 2024 08:20:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815760.1229920; Thu, 10 Oct 2024 08:20:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoPX-0001jO-MU; Thu, 10 Oct 2024 08:20:39 +0000
Received: by outflank-mailman (input) for mailman id 815760;
 Thu, 10 Oct 2024 08:20:38 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoPW-0001bZ-2o
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:20:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoPW-00077d-29
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:20:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoPW-0005GA-1S
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:20:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9yJdbT3Uc/LHPMobHTsZRrcgnENrOClF83ZiXNvNaMg=; b=AmMHsC91yd4BJ/vytPVEUQEBD3
	XULR1DuVu26wizdcr5swUcQ0RWC7uRNNGZ+jQJrTR6gpeI3rSFYON1Ec293S0jYGJcx4Hj0cP2adT
	takQuQpOZSyGu7JpR2zCdFsz7JEX/5Y/BPShnS+bpMtuZu/nJ3uvO0Q/InNTZo/D1Uuk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/char/riscv_htif: Fix printing of console characters on big endian hosts
Message-Id: <E1syoPW-0005GA-1S@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:20:38 +0000

commit 3af03de983108bc8c60a1a274b3e81a9553d4ce1
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Fri Jul 21 11:47:19 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Tue Sep 12 13:37:02 2023 +0300

    hw/char/riscv_htif: Fix printing of console characters on big endian hosts
    
    The character that should be printed is stored in the 64 bit "payload"
    variable. The code currently tries to print it by taking the address
    of the variable and passing this pointer to qemu_chr_fe_write(). However,
    this only works on little endian hosts where the least significant bits
    are stored on the lowest address. To do this in a portable way, we have
    to store the value in an uint8_t variable instead.
    
    Fixes: 5033606780 ("RISC-V HTIF Console")
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Reviewed-by: Bin Meng <bmeng@tinylab.org>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-Id: <20230721094720.902454-2-thuth@redhat.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit c255946e3df4d9660e4f468a456633c24393d468)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/char/riscv_htif.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/char/riscv_htif.c b/hw/char/riscv_htif.c
index 098de50e35..e6e0fa3015 100644
--- a/hw/char/riscv_htif.c
+++ b/hw/char/riscv_htif.c
@@ -190,7 +190,8 @@ static void htif_handle_tohost_write(HTIFState *s, uint64_t val_written)
             s->tohost = 0; /* clear to indicate we read */
             return;
         } else if (cmd == HTIF_CONSOLE_CMD_PUTC) {
-            qemu_chr_fe_write(&s->chr, (uint8_t *)&payload, 1);
+            uint8_t ch = (uint8_t)payload;
+            qemu_chr_fe_write(&s->chr, &ch, 1);
             resp = 0x100 | (uint8_t)payload;
         } else {
             qemu_log("HTIF device %d: unknown command\n", device);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:20:48 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:20:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815761.1229924 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoPg-00029S-Qk; Thu, 10 Oct 2024 08:20:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815761.1229924; Thu, 10 Oct 2024 08:20:48 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoPg-00029K-Nx; Thu, 10 Oct 2024 08:20:48 +0000
Received: by outflank-mailman (input) for mailman id 815761;
 Thu, 10 Oct 2024 08:20:48 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoPg-00027v-5j
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:20:48 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoPg-000780-51
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:20:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoPg-0005Gx-4L
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:20:48 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Y3AfJTYT1nPrBWZjLHy1/0hCYmUfXzSDM5jOaPA4jr0=; b=u4RxeZVBXJJrGNwJ6rk0oXdzLs
	f3j7eMigshjmm4GUn32tVHp57C60k0TU8tnmPF9CvO8waPPUhFiWf8bJXfyXkRfdVdYx4xGd41Ibb
	24t93mQlkz2i/F/ZZRBnZpTyZq8+qr80gLcQv4tp3WjzEfDVkgGMyEQGgbOy/91LJREI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] include/exec: Provide the tswap() functions for target independent code, too
Message-Id: <E1syoPg-0005Gx-4L@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:20:48 +0000

commit aeb931d82b13c50587268f462dcd46b23d2086ff
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Tue Apr 11 20:34:17 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:17:02 2023 +0300

    include/exec: Provide the tswap() functions for target independent code, too
    
    In some cases of target independent code, it would be useful to have access
    to the functions that swap endianess in case it differs between guest and
    host. Thus re-implement the tswapXX() functions in a new header that can be
    included separately. The check whether the swapping is needed continues to
    be done at compile-time for target specific code, while it is done at
    run-time in target-independent code.
    
    Message-Id: <20230411183418.1640500-3-thuth@redhat.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Reviewed-by: Cédric Le Goater <clg@kaod.org>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 24be3369ad63c3882be42dd510a45bad52816fd1)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (trivial change needed for the next commit 058096f1c5
     "hw/char/riscv_htif: Fix the console syscall on big endian hosts")
---
 include/exec/cpu-all.h | 64 +-------------------------------------------
 include/exec/tswap.h   | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+), 63 deletions(-)

diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
index 090922e4a8..ad824fee52 100644
--- a/include/exec/cpu-all.h
+++ b/include/exec/cpu-all.h
@@ -21,6 +21,7 @@
 
 #include "exec/cpu-common.h"
 #include "exec/memory.h"
+#include "exec/tswap.h"
 #include "qemu/thread.h"
 #include "hw/core/cpu.h"
 #include "qemu/rcu.h"
@@ -44,69 +45,6 @@
 #define BSWAP_NEEDED
 #endif
 
-#ifdef BSWAP_NEEDED
-
-static inline uint16_t tswap16(uint16_t s)
-{
-    return bswap16(s);
-}
-
-static inline uint32_t tswap32(uint32_t s)
-{
-    return bswap32(s);
-}
-
-static inline uint64_t tswap64(uint64_t s)
-{
-    return bswap64(s);
-}
-
-static inline void tswap16s(uint16_t *s)
-{
-    *s = bswap16(*s);
-}
-
-static inline void tswap32s(uint32_t *s)
-{
-    *s = bswap32(*s);
-}
-
-static inline void tswap64s(uint64_t *s)
-{
-    *s = bswap64(*s);
-}
-
-#else
-
-static inline uint16_t tswap16(uint16_t s)
-{
-    return s;
-}
-
-static inline uint32_t tswap32(uint32_t s)
-{
-    return s;
-}
-
-static inline uint64_t tswap64(uint64_t s)
-{
-    return s;
-}
-
-static inline void tswap16s(uint16_t *s)
-{
-}
-
-static inline void tswap32s(uint32_t *s)
-{
-}
-
-static inline void tswap64s(uint64_t *s)
-{
-}
-
-#endif
-
 #if TARGET_LONG_SIZE == 4
 #define tswapl(s) tswap32(s)
 #define tswapls(s) tswap32s((uint32_t *)(s))
diff --git a/include/exec/tswap.h b/include/exec/tswap.h
new file mode 100644
index 0000000000..68944a880b
--- /dev/null
+++ b/include/exec/tswap.h
@@ -0,0 +1,72 @@
+/*
+ * Macros for swapping a value if the endianness is different
+ * between the target and the host.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef TSWAP_H
+#define TSWAP_H
+
+#include "hw/core/cpu.h"
+#include "qemu/bswap.h"
+
+/*
+ * If we're in target-specific code, we can hard-code the swapping
+ * condition, otherwise we have to do (slower) run-time checks.
+ */
+#ifdef NEED_CPU_H
+#define target_needs_bswap()  (HOST_BIG_ENDIAN != TARGET_BIG_ENDIAN)
+#else
+#define target_needs_bswap()  (target_words_bigendian() != HOST_BIG_ENDIAN)
+#endif
+
+static inline uint16_t tswap16(uint16_t s)
+{
+    if (target_needs_bswap()) {
+        return bswap16(s);
+    } else {
+        return s;
+    }
+}
+
+static inline uint32_t tswap32(uint32_t s)
+{
+    if (target_needs_bswap()) {
+        return bswap32(s);
+    } else {
+        return s;
+    }
+}
+
+static inline uint64_t tswap64(uint64_t s)
+{
+    if (target_needs_bswap()) {
+        return bswap64(s);
+    } else {
+        return s;
+    }
+}
+
+static inline void tswap16s(uint16_t *s)
+{
+    if (target_needs_bswap()) {
+        *s = bswap16(*s);
+    }
+}
+
+static inline void tswap32s(uint32_t *s)
+{
+    if (target_needs_bswap()) {
+        *s = bswap32(*s);
+    }
+}
+
+static inline void tswap64s(uint64_t *s)
+{
+    if (target_needs_bswap()) {
+        *s = bswap64(*s);
+    }
+}
+
+#endif  /* TSWAP_H */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:20:58 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:20:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815762.1229929 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoPq-0002QB-Sx; Thu, 10 Oct 2024 08:20:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815762.1229929; Thu, 10 Oct 2024 08:20:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoPq-0002Q3-PM; Thu, 10 Oct 2024 08:20:58 +0000
Received: by outflank-mailman (input) for mailman id 815762;
 Thu, 10 Oct 2024 08:20:58 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoPq-0002Pt-8T
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:20:58 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoPq-000789-7o
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:20:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoPq-0005HY-7B
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:20:58 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=FdWuSXGSiloKqKvHlXdcXfQXW2uVWYHqATqVauErMyQ=; b=JKc+3DeNrIYC0oPIoQPTMIqVMs
	6LKSmC95X0BGcbBLAzMfCNuHJ4M6XqgFAgKHgs0R1SUD5U/jYwuGkj9xvCyOB0HdLc9D4qocO4jQ7
	NRoJ0ShDuJxnAerjhAkS2rqY7f+tqlrd5ba+zfSQ/Ltq7QjnPrZh8xFAW1AWyBpHDrV0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/char/riscv_htif: Fix the console syscall on big endian hosts
Message-Id: <E1syoPq-0005HY-7B@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:20:58 +0000

commit a57e4cc6fe81a0b2ca8a32db91ca45df205c4a8f
Author:     Thomas Huth <thuth@redhat.com>
AuthorDate: Fri Jul 21 11:47:20 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    hw/char/riscv_htif: Fix the console syscall on big endian hosts
    
    Values that have been read via cpu_physical_memory_read() from the
    guest's memory have to be swapped in case the host endianess differs
    from the guest.
    
    Fixes: a6e13e31d5 ("riscv_htif: Support console output via proxy syscall")
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Reviewed-by: Bin Meng <bmeng@tinylab.org>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Message-Id: <20230721094720.902454-3-thuth@redhat.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 058096f1c55ab688db7e1d6814aaefc1bcd87f7a)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
    (Mjt: context fix in hw/char/riscv_htif.c for #include)
---
 hw/char/riscv_htif.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/hw/char/riscv_htif.c b/hw/char/riscv_htif.c
index e6e0fa3015..198175e232 100644
--- a/hw/char/riscv_htif.c
+++ b/hw/char/riscv_htif.c
@@ -29,6 +29,7 @@
 #include "chardev/char-fe.h"
 #include "qemu/timer.h"
 #include "qemu/error-report.h"
+#include "exec/tswap.h"
 
 #define RISCV_DEBUG_HTIF 0
 #define HTIF_DEBUG(fmt, ...)                                                   \
@@ -167,11 +168,11 @@ static void htif_handle_tohost_write(HTIFState *s, uint64_t val_written)
             } else {
                 uint64_t syscall[8];
                 cpu_physical_memory_read(payload, syscall, sizeof(syscall));
-                if (syscall[0] == PK_SYS_WRITE &&
-                    syscall[1] == HTIF_DEV_CONSOLE &&
-                    syscall[3] == HTIF_CONSOLE_CMD_PUTC) {
+                if (tswap64(syscall[0]) == PK_SYS_WRITE &&
+                    tswap64(syscall[1]) == HTIF_DEV_CONSOLE &&
+                    tswap64(syscall[3]) == HTIF_CONSOLE_CMD_PUTC) {
                     uint8_t ch;
-                    cpu_physical_memory_read(syscall[2], &ch, 1);
+                    cpu_physical_memory_read(tswap64(syscall[2]), &ch, 1);
                     qemu_chr_fe_write(&s->chr, &ch, 1);
                     resp = 0x100 | (uint8_t)payload;
                 } else {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:21:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:21:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815763.1229932 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoQ0-0002hy-Uy; Thu, 10 Oct 2024 08:21:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815763.1229932; Thu, 10 Oct 2024 08:21:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoQ0-0002hq-SO; Thu, 10 Oct 2024 08:21:08 +0000
Received: by outflank-mailman (input) for mailman id 815763;
 Thu, 10 Oct 2024 08:21:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoQ0-0002hi-D7
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:21:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoQ0-00078W-Au
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:21:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoQ0-0005IW-A6
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:21:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=gCj3Afou0+V81nCXEgzdovkcHDQq75y63JmJ0p9EIgI=; b=e8bex5VVqHTDUL93lsiI4X4hm7
	ielprtsXVyPaFoQbIOF3lkFeYyr0+DAuHXA4kmzJ49iv4a8LjaAUxeee7uCTEiXw7q3U/hQbWmJwX
	beRj6YL2yS6TlZDrQh44CefosiNjlhTGnegiKr+4BZUrbr1bTPTiURlns/zC6NcGAfJI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/intc: Fix upper/lower mtime write calculation
Message-Id: <E1syoQ0-0005IW-A6@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:21:08 +0000

commit fd1a0c89c66c9e03b6cc7a1283856bb2112a9bde
Author:     Jason Chien <jason.chien@sifive.com>
AuthorDate: Fri Jul 28 08:24:38 2023 +0000
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    hw/intc: Fix upper/lower mtime write calculation
    
    When writing the upper mtime, we should keep the original lower mtime
    whose value is given by cpu_riscv_read_rtc() instead of
    cpu_riscv_read_rtc_raw(). The same logic applies to writes to lower mtime.
    
    Signed-off-by: Jason Chien <jason.chien@sifive.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Message-ID: <20230728082502.26439-1-jason.chien@sifive.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit e0922b73baf00c4c19d4ad30d09bb94f7ffea0f4)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/intc/riscv_aclint.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/hw/intc/riscv_aclint.c b/hw/intc/riscv_aclint.c
index b466a6abaf..bf77e29a70 100644
--- a/hw/intc/riscv_aclint.c
+++ b/hw/intc/riscv_aclint.c
@@ -208,11 +208,12 @@ static void riscv_aclint_mtimer_write(void *opaque, hwaddr addr,
         return;
     } else if (addr == mtimer->time_base || addr == mtimer->time_base + 4) {
         uint64_t rtc_r = cpu_riscv_read_rtc_raw(mtimer->timebase_freq);
+        uint64_t rtc = cpu_riscv_read_rtc(mtimer);
 
         if (addr == mtimer->time_base) {
             if (size == 4) {
                 /* time_lo for RV32/RV64 */
-                mtimer->time_delta = ((rtc_r & ~0xFFFFFFFFULL) | value) - rtc_r;
+                mtimer->time_delta = ((rtc & ~0xFFFFFFFFULL) | value) - rtc_r;
             } else {
                 /* time for RV64 */
                 mtimer->time_delta = value - rtc_r;
@@ -220,7 +221,7 @@ static void riscv_aclint_mtimer_write(void *opaque, hwaddr addr,
         } else {
             if (size == 4) {
                 /* time_hi for RV32/RV64 */
-                mtimer->time_delta = (value << 32 | (rtc_r & 0xFFFFFFFF)) - rtc_r;
+                mtimer->time_delta = (value << 32 | (rtc & 0xFFFFFFFF)) - rtc_r;
             } else {
                 qemu_log_mask(LOG_GUEST_ERROR,
                               "aclint-mtimer: invalid time_hi write: %08x",
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:21:20 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:21:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815764.1229935 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoQA-0002qz-W8; Thu, 10 Oct 2024 08:21:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815764.1229935; Thu, 10 Oct 2024 08:21:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoQA-0002qs-Tm; Thu, 10 Oct 2024 08:21:18 +0000
Received: by outflank-mailman (input) for mailman id 815764;
 Thu, 10 Oct 2024 08:21:18 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoQA-0002ql-Ee
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:21:18 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoQA-00078d-Ds
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:21:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoQA-0005JK-D9
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:21:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=/0JLKHrcKcK76YSbLXGvzYpD2QLMM/TpZrkAiS0KoGI=; b=iOfGGLb9LfpEzg/6u3T3PY3ACh
	cSH+3E6j6u2hN7bjcgfyz2hQIbYsjo4BLTj2MhWHCmJXDuQTbEm2mgHFQ6W246yedM1EwhSZROfgY
	ftz2KMZBOHPgH994CUdcp0uA2ZKj9AG4eggREk46CgwuTnvWL7wDyEgvJvH3L38S03ss=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/intc: Make rtc variable names consistent
Message-Id: <E1syoQA-0005JK-D9@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:21:18 +0000

commit c00a9ec0613ca428abaedaf8b7be7b1cbb97d37f
Author:     Jason Chien <jason.chien@sifive.com>
AuthorDate: Fri Jul 28 08:24:39 2023 +0000
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    hw/intc: Make rtc variable names consistent
    
    The variables whose values are given by cpu_riscv_read_rtc() should be named
    "rtc". The variables whose value are given by cpu_riscv_read_rtc_raw()
    should be named "rtc_r".
    
    Signed-off-by: Jason Chien <jason.chien@sifive.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Message-ID: <20230728082502.26439-2-jason.chien@sifive.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 9382a9eafccad8dc6a487ea3a8d2bed03dc35db9)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/intc/riscv_aclint.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/intc/riscv_aclint.c b/hw/intc/riscv_aclint.c
index bf77e29a70..25cf7a5d9d 100644
--- a/hw/intc/riscv_aclint.c
+++ b/hw/intc/riscv_aclint.c
@@ -64,13 +64,13 @@ static void riscv_aclint_mtimer_write_timecmp(RISCVAclintMTimerState *mtimer,
     uint64_t next;
     uint64_t diff;
 
-    uint64_t rtc_r = cpu_riscv_read_rtc(mtimer);
+    uint64_t rtc = cpu_riscv_read_rtc(mtimer);
 
     /* Compute the relative hartid w.r.t the socket */
     hartid = hartid - mtimer->hartid_base;
 
     mtimer->timecmp[hartid] = value;
-    if (mtimer->timecmp[hartid] <= rtc_r) {
+    if (mtimer->timecmp[hartid] <= rtc) {
         /*
          * If we're setting an MTIMECMP value in the "past",
          * immediately raise the timer interrupt
@@ -81,7 +81,7 @@ static void riscv_aclint_mtimer_write_timecmp(RISCVAclintMTimerState *mtimer,
 
     /* otherwise, set up the future timer interrupt */
     qemu_irq_lower(mtimer->timer_irqs[hartid]);
-    diff = mtimer->timecmp[hartid] - rtc_r;
+    diff = mtimer->timecmp[hartid] - rtc;
     /* back to ns (note args switched in muldiv64) */
     uint64_t ns_diff = muldiv64(diff, NANOSECONDS_PER_SECOND, timebase_freq);
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:21:29 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:21:29 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815766.1229940 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoQL-0002to-1r; Thu, 10 Oct 2024 08:21:29 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815766.1229940; Thu, 10 Oct 2024 08:21:29 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoQK-0002tg-VM; Thu, 10 Oct 2024 08:21:28 +0000
Received: by outflank-mailman (input) for mailman id 815766;
 Thu, 10 Oct 2024 08:21:28 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoQK-0002ta-He
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:21:28 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoQK-00078l-Gz
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:21:28 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoQK-0005K5-G5
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:21:28 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wcAKTgKJiAsui//87hmqGHfU7h5unxeFWpTMoZKK6E4=; b=FigIoHWb8f6PxYZ6XZQ/JaLwgY
	K8FoOIDUa5DtM7X5pPcFcnA4iXV4AA8J0GJdWFP/aeLfUS3oEiMb9+kwrSKfwLgP41T8fsWNCjHAc
	saY3IlJhhG1jc2M8xBvuVQTjey/C5ocErV4J7RK+HEkJz1ILwTDfXYeVccUVRGtsIo5E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] linux-user/riscv: Use abi type for target_ucontext
Message-Id: <E1syoQK-0005K5-G5@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:21:28 +0000

commit 9bac2bcf10e25506cc1fc7b69b027399afeb3768
Author:     LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
AuthorDate: Fri Aug 11 13:54:38 2023 +0800
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    linux-user/riscv: Use abi type for target_ucontext
    
    We should not use types dependend on host arch for target_ucontext.
    This bug is found when run rv32 applications.
    
    Signed-off-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com>
    Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Message-ID: <20230811055438.1945-1-zhiwei_liu@linux.alibaba.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit ae7d4d625cab49657b9fc2be09d895afb9bcdaf0)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 linux-user/riscv/signal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/linux-user/riscv/signal.c b/linux-user/riscv/signal.c
index eaa168199a..f989f7f51f 100644
--- a/linux-user/riscv/signal.c
+++ b/linux-user/riscv/signal.c
@@ -38,8 +38,8 @@ struct target_sigcontext {
 }; /* cf. riscv-linux:arch/riscv/include/uapi/asm/ptrace.h */
 
 struct target_ucontext {
-    unsigned long uc_flags;
-    struct target_ucontext *uc_link;
+    abi_ulong uc_flags;
+    abi_ptr uc_link;
     target_stack_t uc_stack;
     target_sigset_t uc_sigmask;
     uint8_t   __unused[1024 / 8 - sizeof(target_sigset_t)];
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:21:39 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:21:39 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815767.1229944 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoQV-0002wY-3f; Thu, 10 Oct 2024 08:21:39 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815767.1229944; Thu, 10 Oct 2024 08:21:39 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoQV-0002wO-0W; Thu, 10 Oct 2024 08:21:39 +0000
Received: by outflank-mailman (input) for mailman id 815767;
 Thu, 10 Oct 2024 08:21:38 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoQU-0002wI-KV
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:21:38 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoQU-00078s-Jt
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:21:38 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoQU-0005Ku-JE
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:21:38 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=HcdrcJxDo0AHYoL6QCp1BoQQk89ss1BP8JgHOE2V0YM=; b=DD6+6JTJhuadvENJQ4cWUWFEtf
	J+44XWDLB1l4eBrUSvFyptrLAK+B+Y/cQmmOXU4PhCMFp8CVe7RPQqYBVcJal95erwZrFVpA86QBG
	KfcaCUMJ4PtMHo8tvFXktu70DacWQe9JIQmpNU0ZGwExPQ8KXnT8lmvs4/b1um8KplL4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/riscv: virt: Fix riscv,pmu DT node path
Message-Id: <E1syoQU-0005Ku-JE@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:21:38 +0000

commit e94ea3c6dbd48d70edca6de0079d5690a82ec35b
Author:     Conor Dooley <conor.dooley@microchip.com>
AuthorDate: Thu Jul 27 15:24:17 2023 +0100
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    hw/riscv: virt: Fix riscv,pmu DT node path
    
    On a dtb dumped from the virt machine, dt-validate complains:
    soc: pmu: {'riscv,event-to-mhpmcounters': [[1, 1, 524281], [2, 2, 524284], [65561, 65561, 524280], [65563, 65563, 524280], [65569, 65569, 524280]], 'compatible': ['riscv,pmu']} should not be valid under {'type': 'object'}
            from schema $id: http://devicetree.org/schemas/simple-bus.yaml#
    That's pretty cryptic, but running the dtb back through dtc produces
    something a lot more reasonable:
    Warning (simple_bus_reg): /soc/pmu: missing or empty reg/ranges property
    
    Moving the riscv,pmu node out of the soc bus solves the problem.
    
    Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
    Acked-by: Alistair Francis <alistair.francis@wdc.com>
    Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Message-ID: <20230727-groom-decline-2c57ce42841c@spud>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 9ff31406312500053ecb5f92df01dd9ce52e635d)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/riscv/virt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index 4e3efbee16..be8f0cb26e 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -731,7 +731,7 @@ static void create_fdt_pmu(RISCVVirtState *s)
     MachineState *ms = MACHINE(s);
     RISCVCPU hart = s->soc[0].harts[0];
 
-    pmu_name = g_strdup_printf("/soc/pmu");
+    pmu_name = g_strdup_printf("/pmu");
     qemu_fdt_add_subnode(ms->fdt, pmu_name);
     qemu_fdt_setprop_string(ms->fdt, pmu_name, "compatible", "riscv,pmu");
     riscv_pmu_generate_fdt_node(ms->fdt, hart.cfg.pmu_num, pmu_name);
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:21:50 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:21:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815768.1229947 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoQg-0002zX-4i; Thu, 10 Oct 2024 08:21:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815768.1229947; Thu, 10 Oct 2024 08:21:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoQg-0002zQ-28; Thu, 10 Oct 2024 08:21:50 +0000
Received: by outflank-mailman (input) for mailman id 815768;
 Thu, 10 Oct 2024 08:21:48 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoQe-0002zC-NO
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:21:48 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoQe-00079I-Mn
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:21:48 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoQe-0005Ld-M6
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:21:48 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=wNCsmWuYYjQoV8/vt3axdTAzjFlL32pBhXPiWdXp6rI=; b=LQfm86rSPYIMYgZfxDAqq49N4z
	5NlVSJkEaDIRmABJof3HeAD9k3lOap3v9wVQrkMe4wtMQT1FvqIIv6JMVFVj1U/IGF4ZgmSapwmR2
	KanGEbOwQ/X11+StZtgjpgz0gytN2pZE7+AS9koGudQJM6z5fF02cZUYos7+gybd2PAg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] target/riscv: fix satp_mode_finalize() when satp_mode.supported = 0
Message-Id: <E1syoQe-0005Ld-M6@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:21:48 +0000

commit 1805e05db3c6d92c750427b1c1371f44fa8e4893
Author:     Daniel Henrique Barboza <dbarboza@ventanamicro.com>
AuthorDate: Thu Aug 17 12:29:03 2023 -0300
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    target/riscv: fix satp_mode_finalize() when satp_mode.supported = 0
    
    In the same emulated RISC-V host, the 'host' KVM CPU takes 4 times
    longer to boot than the 'rv64' KVM CPU.
    
    The reason is an unintended behavior of riscv_cpu_satp_mode_finalize()
    when satp_mode.supported = 0, i.e. when cpu_init() does not set
    satp_mode_max_supported(). satp_mode_max_from_map(map) does:
    
    31 - __builtin_clz(map)
    
    This means that, if satp_mode.supported = 0, satp_mode_supported_max
    wil be '31 - 32'. But this is C, so satp_mode_supported_max will gladly
    set it to UINT_MAX (4294967295). After that, if the user didn't set a
    satp_mode, set_satp_mode_default_map(cpu) will make
    
    cfg.satp_mode.map = cfg.satp_mode.supported
    
    So satp_mode.map = 0. And then satp_mode_map_max will be set to
    satp_mode_max_from_map(cpu->cfg.satp_mode.map), i.e. also UINT_MAX. The
    guard "satp_mode_map_max > satp_mode_supported_max" doesn't protect us
    here since both are UINT_MAX.
    
    And finally we have 2 loops:
    
            for (int i = satp_mode_map_max - 1; i >= 0; --i) {
    
    Which are, in fact, 2 loops from UINT_MAX -1 to -1. This is where the
    extra delay when booting the 'host' CPU is coming from.
    
    Commit 43d1de32f8 already set a precedence for satp_mode.supported = 0
    in a different manner. We're doing the same here. If supported == 0,
    interpret as 'the CPU wants the OS to handle satp mode alone' and skip
    satp_mode_finalize().
    
    We'll also put a guard in satp_mode_max_from_map() to assert out if map
    is 0 since the function is not ready to deal with it.
    
    Cc: Alexandre Ghiti <alexghiti@rivosinc.com>
    Fixes: 6f23aaeb9b ("riscv: Allow user to set the satp mode")
    Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
    Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
    Message-ID: <20230817152903.694926-1-dbarboza@ventanamicro.com>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 3a2fc23563885c219c73c8f24318921daf02f3f2)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/riscv/cpu.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
index 1e97473af2..8c0721c715 100644
--- a/target/riscv/cpu.c
+++ b/target/riscv/cpu.c
@@ -282,6 +282,17 @@ static uint8_t satp_mode_from_str(const char *satp_mode_str)
 
 uint8_t satp_mode_max_from_map(uint32_t map)
 {
+    /*
+     * 'map = 0' will make us return (31 - 32), which C will
+     * happily overflow to UINT_MAX. There's no good result to
+     * return if 'map = 0' (e.g. returning 0 will be ambiguous
+     * with the result for 'map = 1').
+     *
+     * Assert out if map = 0. Callers will have to deal with
+     * it outside of this function.
+     */
+    g_assert(map > 0);
+
     /* map here has at least one bit set, so no problem with clz */
     return 31 - __builtin_clz(map);
 }
@@ -1043,9 +1054,15 @@ static void riscv_cpu_validate_set_extensions(RISCVCPU *cpu, Error **errp)
 static void riscv_cpu_satp_mode_finalize(RISCVCPU *cpu, Error **errp)
 {
     bool rv32 = riscv_cpu_mxl(&cpu->env) == MXL_RV32;
-    uint8_t satp_mode_map_max;
-    uint8_t satp_mode_supported_max =
-                        satp_mode_max_from_map(cpu->cfg.satp_mode.supported);
+    uint8_t satp_mode_map_max, satp_mode_supported_max;
+
+    /* The CPU wants the OS to decide which satp mode to use */
+    if (cpu->cfg.satp_mode.supported == 0) {
+        return;
+    }
+
+    satp_mode_supported_max =
+                    satp_mode_max_from_map(cpu->cfg.satp_mode.supported);
 
     if (cpu->cfg.satp_mode.map == 0) {
         if (cpu->cfg.satp_mode.init == 0) {
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:22:00 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:22:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815769.1229953 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoQq-00031s-75; Thu, 10 Oct 2024 08:22:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815769.1229953; Thu, 10 Oct 2024 08:22:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoQq-00031k-3Z; Thu, 10 Oct 2024 08:22:00 +0000
Received: by outflank-mailman (input) for mailman id 815769;
 Thu, 10 Oct 2024 08:21:58 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoQo-00031c-QL
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:21:58 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoQo-00079Q-Pj
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:21:58 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoQo-0005MI-Ov
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:21:58 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Gp1AYHUCN0zEAoQZjwS61p+65YauIYVRartSXgRuqG0=; b=x8g+0oQfVODYHqP0UQWY5QGZRS
	/0tRLOXIuCSqlKfXdiU6gFh4yuj2ti2QxOAveyhJ+gwiKHukStqmc/3RkGzGKaeVdy2Y9fDTwAQT8
	+q3W1ZyjfyqiKf60I0oAyOPRRxVvr3tBdkF7acy6bgbsbJedH/LWrRagMXg0nUsxwNrU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] target/riscv/pmp.c: respect mseccfg.RLB for pmpaddrX changes
Message-Id: <E1syoQo-0005MI-Ov@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:21:58 +0000

commit 70c97e75d709eadf80845259ea0a0409475102c3
Author:     Leon Schuermann <leons@opentitan.org>
AuthorDate: Tue Aug 29 17:50:46 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    target/riscv/pmp.c: respect mseccfg.RLB for pmpaddrX changes
    
    When the rule-lock bypass (RLB) bit is set in the mseccfg CSR, the PMP
    configuration lock bits must not apply. While this behavior is
    implemented for the pmpcfgX CSRs, this bit is not respected for
    changes to the pmpaddrX CSRs. This patch ensures that pmpaddrX CSR
    writes work even on locked regions when the global rule-lock bypass is
    enabled.
    
    Signed-off-by: Leon Schuermann <leons@opentitan.org>
    Reviewed-by: Mayuresh Chitale <mchitale@ventanamicro.com>
    Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
    Message-ID: <20230829215046.1430463-1-leon@is.currently.online>
    Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
    (cherry picked from commit 4e3adce1244e1ca30ec05874c3eca14911dc0825)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 target/riscv/pmp.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c
index a08cd95658..bcb4baa0a2 100644
--- a/target/riscv/pmp.c
+++ b/target/riscv/pmp.c
@@ -45,6 +45,10 @@ static inline uint8_t pmp_get_a_field(uint8_t cfg)
  */
 static inline int pmp_is_locked(CPURISCVState *env, uint32_t pmp_index)
 {
+    /* mseccfg.RLB is set */
+    if (MSECCFG_RLB_ISSET(env)) {
+        return 0;
+    }
 
     if (env->pmp_state.pmp[pmp_index].cfg_reg & PMP_LOCK) {
         return 1;
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:22:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:22:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815770.1229956 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoR0-00034h-7f; Thu, 10 Oct 2024 08:22:10 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815770.1229956; Thu, 10 Oct 2024 08:22:10 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoR0-00034Z-4z; Thu, 10 Oct 2024 08:22:10 +0000
Received: by outflank-mailman (input) for mailman id 815770;
 Thu, 10 Oct 2024 08:22:08 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoQy-00034H-TL
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:22:08 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoQy-00079v-Sb
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:22:08 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoQy-0005Nt-Rt
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:22:08 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=u0pIPvmSQpcQoXStS3THwYNNc9bQ7V6JYHq/qJoYQgE=; b=DoWi4/3H1Hoaf3NL62hOZ/0o+I
	H64pbx1MeBUHHC1IjuNgvxGxDJUcQuWsxvLllrgUtAVh5UwfwABSOmpVfnxtlWeDFuQCMBmvRPExw
	g6Ez+S26aDCmUFdJj1Dd8s2lJnz7qzmZ2DSRY2x4qY47zl0v00BBwDTBdCqrbQzqbcuY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] hw/tpm: TIS on sysbus: Remove unsupport ppi command line option
Message-Id: <E1syoQy-0005Nt-Rt@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:22:08 +0000

commit 36540b367eb80f1d6a646f691e6a2b75bf57ad61
Author:     Stefan Berger <stefanb@linux.ibm.com>
AuthorDate: Thu Jul 13 13:19:55 2023 -0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    hw/tpm: TIS on sysbus: Remove unsupport ppi command line option
    
    The ppi command line option for the TIS device on sysbus never worked
    and caused an immediate segfault. Remove support for it since it also
    needs support in the firmware and needs testing inside the VM.
    
    Reproducer with the ppi=on option passed:
    
    qemu-system-aarch64 \
       -machine virt,gic-version=3 \
       -m 4G  \
       -nographic -no-acpi \
       -chardev socket,id=chrtpm,path=/tmp/mytpm1/swtpm-sock \
       -tpmdev emulator,id=tpm0,chardev=chrtpm \
       -device tpm-tis-device,tpmdev=tpm0,ppi=on
    [...]
    Segmentation fault (core dumped)
    
    Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
    Reviewed-by: Eric Auger <eric.auger@redhat.com>
    Message-id: 20230713171955.149236-1-stefanb@linux.ibm.com
    (cherry picked from commit 4c46fe2ed492f35f411632c8b5a8442f322bc3f0)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/tpm/tpm_tis_sysbus.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/hw/tpm/tpm_tis_sysbus.c b/hw/tpm/tpm_tis_sysbus.c
index 45e63efd63..6724b3d4f6 100644
--- a/hw/tpm/tpm_tis_sysbus.c
+++ b/hw/tpm/tpm_tis_sysbus.c
@@ -93,7 +93,6 @@ static void tpm_tis_sysbus_reset(DeviceState *dev)
 static Property tpm_tis_sysbus_properties[] = {
     DEFINE_PROP_UINT32("irq", TPMStateSysBus, state.irq_num, TPM_TIS_IRQ),
     DEFINE_PROP_TPMBE("tpmdev", TPMStateSysBus, state.be_driver),
-    DEFINE_PROP_BOOL("ppi", TPMStateSysBus, state.ppi_enabled, false),
     DEFINE_PROP_END_OF_LIST(),
 };
 
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:22:20 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:22:20 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815771.1229960 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoRA-00037f-Al; Thu, 10 Oct 2024 08:22:20 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815771.1229960; Thu, 10 Oct 2024 08:22:20 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoRA-00037X-7f; Thu, 10 Oct 2024 08:22:20 +0000
Received: by outflank-mailman (input) for mailman id 815771;
 Thu, 10 Oct 2024 08:22:19 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoR9-00037P-00
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:22:19 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoR8-0007A2-VZ
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:22:18 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoR8-0005OZ-Ur
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:22:18 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ey9nPC7E6gcQkkTmFEj5e2+WS7yPhxV+rZOE5SDKF04=; b=H4oBQPTs7qmTlrp8O/KOVIRTHC
	NMqgGJYecHbKETFKkBpr8ZtNcBRZ0VAN/bkPwQqVyMFYnIQ1+MQlekJwTkhib3vd9WE+Lf54zNkXl
	6wgu1TGhGE5fHVSVV+EwXSKmWMULC5cux+slh/tZoq50legz6YiZBOGLCgbyfg8e8m4c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] ui: fix crash when there are no active_console
Message-Id: <E1syoR8-0005OZ-Ur@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:22:18 +0000

commit 6c575436cd3e692079fc3e2fe4f54efe77211549
Author:     Marc-André Lureau <marcandre.lureau@redhat.com>
AuthorDate: Mon Sep 11 18:04:47 2023 +0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    ui: fix crash when there are no active_console
    
    Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
    0x0000555555888630 in dpy_ui_info_supported (con=0x0) at ../ui/console.c:812
    812         return con->hw_ops->ui_info != NULL;
    (gdb) bt
    #0  0x0000555555888630 in dpy_ui_info_supported (con=0x0) at ../ui/console.c:812
    #1  0x00005555558a44b1 in protocol_client_msg (vs=0x5555578c76c0, data=0x5555581e93f0 <incomplete sequence \373>, len=24) at ../ui/vnc.c:2585
    #2  0x00005555558a19ac in vnc_client_read (vs=0x5555578c76c0) at ../ui/vnc.c:1607
    #3  0x00005555558a1ac2 in vnc_client_io (ioc=0x5555581eb0e0, condition=G_IO_IN, opaque=0x5555578c76c0) at ../ui/vnc.c:1635
    
    Fixes:
    https://issues.redhat.com/browse/RHEL-2600
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Reviewed-by: Albert Esteve <aesteve@redhat.com>
    (cherry picked from commit 48a35e12faf90a896c5aa4755812201e00d60316)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 ui/console.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ui/console.c b/ui/console.c
index 7461446e71..a327c9f94a 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1707,6 +1707,9 @@ bool dpy_ui_info_supported(QemuConsole *con)
     if (con == NULL) {
         con = active_console;
     }
+    if (con == NULL) {
+        return false;
+    }
 
     return con->hw_ops->ui_info != NULL;
 }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:22:30 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:22:30 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815772.1229964 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoRK-0003AY-C6; Thu, 10 Oct 2024 08:22:30 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815772.1229964; Thu, 10 Oct 2024 08:22:30 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoRK-0003AQ-9N; Thu, 10 Oct 2024 08:22:30 +0000
Received: by outflank-mailman (input) for mailman id 815772;
 Thu, 10 Oct 2024 08:22:29 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoRJ-0003AG-2r
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:22:29 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoRJ-0007Bg-2G
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:22:29 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoRJ-0005PL-1Q
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:22:29 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=0G6BMkW09pmjj84nw9aoC4dK/Wto75JFcTXW62tYons=; b=xJxNqzkp1NMHCdCk+4tEDoXOrj
	JqgHQZAkaC8neLtMuOwrULmde7xRaWJVEbSz6lyOvIlZxNScWYt+cDJEaX9uUsbHv63GpyqNismdB
	ggNSidjdTI5VjBQ255FSIwBkz+kV4TklhMDbthLoKNFPLKDOGnFiyylEaR8H+h9WCcY8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] s390x/ap: fix missing subsystem reset registration
Message-Id: <E1syoRJ-0005PL-1Q@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:22:29 +0000

commit 0ef930a29f432320d979e227a305f927bb15eb09
Author:     Janosch Frank <frankja@linux.ibm.com>
AuthorDate: Wed Aug 23 16:22:15 2023 +0200
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    s390x/ap: fix missing subsystem reset registration
    
    A subsystem reset contains a reset of AP resources which has been
    missing.  Adding the AP bridge to the list of device types that need
    reset fixes this issue.
    
    Reviewed-by: Jason J. Herne <jjherne@linux.ibm.com>
    Reviewed-by: Tony Krowiak <akrowiak@linux.ibm.com>
    Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
    Fixes: a51b3153 ("s390x/ap: base Adjunct Processor (AP) object model")
    Message-ID: <20230823142219.1046522-2-seiden@linux.ibm.com>
    Signed-off-by: Thomas Huth <thuth@redhat.com>
    (cherry picked from commit 297ec01f0b9864ea8209ca0ddc6643b4c0574bdb)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 hw/s390x/s390-virtio-ccw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 0daf445d60..ea048e4667 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -109,6 +109,7 @@ static const char *const reset_dev_types[] = {
     "s390-flic",
     "diag288",
     TYPE_S390_PCI_HOST_BRIDGE,
+    TYPE_AP_BRIDGE,
 };
 
 static void subsystem_reset(void)
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:22:40 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:22:40 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815773.1229968 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoRU-0003DE-DX; Thu, 10 Oct 2024 08:22:40 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815773.1229968; Thu, 10 Oct 2024 08:22:40 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoRU-0003D6-Ah; Thu, 10 Oct 2024 08:22:40 +0000
Received: by outflank-mailman (input) for mailman id 815773;
 Thu, 10 Oct 2024 08:22:39 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoRT-0003Cp-5l
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:22:39 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoRT-0007Br-55
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:22:39 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoRT-0005Q4-4Q
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:22:39 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=kqmx3bGvbUEp3Okjj+14e84Yaggr5wjGt2ma4BWE4AU=; b=7AjpiXDAnIEYCLWCmS2kWbYyUL
	zvD/Did7FSlyXSbcedfgfX5k8TUBlKQKiF6gfFNF6IARy0V1HPbkgJL2nDJ0In9y3cnlb04AMS5pr
	XNXLXgheHttEnHGzngixgJApcYwbpekiJJTYghMDoa90LfkbfYD2IK7cjKuWYjAjytkA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] tpm: fix crash when FD >= 1024 and unnecessary errors due to EINTR
Message-Id: <E1syoRT-0005Q4-4Q@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:22:39 +0000

commit fcf58d6f20d29ee250f542ac8de968700c957134
Author:     Marc-André Lureau <marcandre.lureau@redhat.com>
AuthorDate: Mon Sep 11 17:25:51 2023 +0400
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Wed Sep 20 10:18:14 2023 +0300

    tpm: fix crash when FD >= 1024 and unnecessary errors due to EINTR
    
    Replace select() with poll() to fix a crash when QEMU has a large number
    of FDs. Also use RETRY_ON_EINTR to avoid unnecessary errors due to EINTR.
    
    Cc: qemu-stable@nongnu.org
    Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2020133
    Fixes: 56a3c24ffc ("tpm: Probe for connected TPM 1.2 or TPM 2")
    Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
    Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
    Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
    (cherry picked from commit 8e32ddff69b6b4547cc00592ad816484e160817a)
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 backends/tpm/tpm_util.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/backends/tpm/tpm_util.c b/backends/tpm/tpm_util.c
index a6e6d3e72f..1856589c3b 100644
--- a/backends/tpm/tpm_util.c
+++ b/backends/tpm/tpm_util.c
@@ -112,12 +112,8 @@ static int tpm_util_request(int fd,
                             void *response,
                             size_t responselen)
 {
-    fd_set readfds;
+    GPollFD fds[1] = { {.fd = fd, .events = G_IO_IN } };
     int n;
-    struct timeval tv = {
-        .tv_sec = 1,
-        .tv_usec = 0,
-    };
 
     n = write(fd, request, requestlen);
     if (n < 0) {
@@ -127,11 +123,8 @@ static int tpm_util_request(int fd,
         return -EFAULT;
     }
 
-    FD_ZERO(&readfds);
-    FD_SET(fd, &readfds);
-
     /* wait for a second */
-    n = select(fd + 1, &readfds, NULL, NULL, &tv);
+    n = RETRY_ON_EINTR(g_poll(fds, 1, 1000));
     if (n != 1) {
         return -errno;
     }
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:22:50 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:22:50 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815774.1229972 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoRe-0003Fr-EY; Thu, 10 Oct 2024 08:22:50 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815774.1229972; Thu, 10 Oct 2024 08:22:50 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoRe-0003Fj-C3; Thu, 10 Oct 2024 08:22:50 +0000
Received: by outflank-mailman (input) for mailman id 815774;
 Thu, 10 Oct 2024 08:22:49 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoRd-0003Fa-8O
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:22:49 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoRd-0007CE-7o
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:22:49 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoRd-0005Qs-7B
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:22:49 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=g938UeMQSN6+LvqEpcLutzRx8m5aMDNL0AkaaewzInI=; b=Lw8N8biJ/H3CKWFxmYJcNBqR0S
	JwxL79b1Jdl5h6M7+3gFuTFXxQqjV3FrZ9HQiQrDJWpXU96U74w0ljKFZ3i5zQhwiwe7yxopylxXM
	9NHR2BGE2f5Qv3kGsWzVV9Z2Qf4xKHw/fTMIDXhBzcOLO+hYrvmK/d+pESmQv6tlnoz4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] Update version for 8.0.5 release
Message-Id: <E1syoRd-0005Qs-7B@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:22:49 +0000

commit 6bbce8b464206e6622216b62841cb3e953d56eb8
Author:     Michael Tokarev <mjt@tls.msk.ru>
AuthorDate: Thu Sep 21 19:23:20 2023 +0300
Commit:     Michael Tokarev <mjt@tls.msk.ru>
CommitDate: Thu Sep 21 19:23:20 2023 +0300

    Update version for 8.0.5 release
    
    Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 VERSION | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/VERSION b/VERSION
index 50c496d20c..904be6d4e4 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-8.0.4
+8.0.5
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 08:23:00 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 08:23:00 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815775.1229976 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoRo-0003IT-G5; Thu, 10 Oct 2024 08:23:00 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815775.1229976; Thu, 10 Oct 2024 08:23:00 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syoRo-0003IL-DR; Thu, 10 Oct 2024 08:23:00 +0000
Received: by outflank-mailman (input) for mailman id 815775;
 Thu, 10 Oct 2024 08:22:59 +0000
Received: from mail.xenproject.org ([104.130.215.37])
 by lists.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoRn-0003IC-Bf
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:22:59 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoRn-0007CL-At
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:22:59 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syoRn-0005Re-AA
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 08:22:59 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bb1ZDf6ZP5vr7yFN2qoWlDFqD+/qDgWMbe4m+gDsqkQ=; b=2/It80GfOFvH57wnGrNrnHmJLQ
	AuAnaY5lX9XVjDFpgyUibTD7nRkAoPYI1pGUz3ANyf+0qDuaayKHK/6FrMhn1FEFTL+F3U7unz5tC
	IL7Rif+nPHCSRyfwNzy7jITCq1+YcPVBjKLvC0SBVzpD92B7bsMAlAV524t6LCt88zvA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [qemu-xen stable-4.19] Merge tag 'v8.0.5' into 'staging-4.18'
Message-Id: <E1syoRn-0005Re-AA@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 08:22:59 +0000

commit bdf719c4c535cf14ec4fe8e9cb7a798a5a73fb23
Merge: 6bbce8b464206e6622216b62841cb3e953d56eb8 0df9387c8983e1b1e72d8c574356f572342c03e6
Author:     Anthony PERARD <anthony.perard@citrix.com>
AuthorDate: Wed Oct 9 11:40:12 2024 +0200
Commit:     Anthony PERARD <anthony.perard@citrix.com>
CommitDate: Wed Oct 9 11:40:12 2024 +0200

    Merge tag 'v8.0.5' into 'staging-4.18'

--
generated by git-patchbot for /home/xen/git/qemu-xen.git#stable-4.19


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 09:00:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 09:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815840.1230051 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syp1h-0001sv-PE; Thu, 10 Oct 2024 09:00:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815840.1230051; Thu, 10 Oct 2024 09: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 1syp1h-0001sm-M1; Thu, 10 Oct 2024 09:00:05 +0000
Received: by outflank-mailman (input) for mailman id 815840;
 Thu, 10 Oct 2024 09: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 1syp1f-0001Y0-Tq
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 09: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 1syp1f-0007pZ-Ks
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 09:00:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syp1f-0000u7-Ii
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 09: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=varp5+TOJ+yvcjcPqXCuOZDAFFMV1Op2O55MlaLD5iQ=; b=UmhcUplNzZMoV0C7mup3Nt0xqc
	T8O5BTy5cd2Wga+KCfC2girRcQIo2x7o/7fY4c4BKFpayt+p/HKWQ7w+gFC9gLzjNrPQ9C731qp7b
	Qm1RSssBzIvAWZFvIZ4lu7QVFu+e5WyPIKZNmYXRvEmohdbvls39er9tZDCDcwVEqv+E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/vlapic: Move lapic migration checks to the check hooks
Message-Id: <E1syp1f-0000u7-Ii@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 09:00:03 +0000

commit eb48045d749193c020ec4e1eadceddb070947f18
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Thu Oct 10 10:52:43 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 10 10:52:43 2024 +0200

    x86/vlapic: Move lapic migration checks to the check hooks
    
    While doing this, factor out checks common to architectural and hidden
    state.
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vlapic.c | 84 +++++++++++++++++++++++++++++++----------------
 1 file changed, 56 insertions(+), 28 deletions(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 9a16dd0d77..3363926b48 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -1571,60 +1571,88 @@ static void lapic_load_fixup(struct vlapic *vlapic)
                v, vlapic->loaded.id, vlapic->loaded.ldr, good_ldr);
 }
 
-static int cf_check lapic_load_hidden(struct domain *d, hvm_domain_context_t *h)
-{
-    unsigned int vcpuid = hvm_load_instance(h);
-    struct vcpu *v;
-    struct vlapic *s;
 
+static int lapic_check_common(const struct domain *d, unsigned int vcpuid)
+{
     if ( !has_vlapic(d) )
         return -ENODEV;
 
     /* Which vlapic to load? */
-    if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
+    if ( !domain_vcpu(d, vcpuid) )
     {
-        dprintk(XENLOG_G_ERR, "HVM restore: dom%d has no apic%u\n",
+        dprintk(XENLOG_G_ERR, "HVM restore: dom%d has no vCPU %u\n",
                 d->domain_id, vcpuid);
         return -EINVAL;
     }
-    s = vcpu_vlapic(v);
+
+    return 0;
+}
+
+static int cf_check lapic_check_hidden(const struct domain *d,
+                                       hvm_domain_context_t *h)
+{
+    unsigned int vcpuid = hvm_load_instance(h);
+    struct hvm_hw_lapic s;
+    int rc = lapic_check_common(d, vcpuid);
+
+    if ( rc )
+        return rc;
+
+    if ( hvm_load_entry_zeroextend(LAPIC, h, &s) != 0 )
+        return -ENODATA;
+
+    /* EN=0 with EXTD=1 is illegal */
+    if ( (s.apic_base_msr & (APIC_BASE_ENABLE | APIC_BASE_EXTD)) ==
+         APIC_BASE_EXTD )
+        return -EINVAL;
+
+    return 0;
+}
+
+static int cf_check lapic_load_hidden(struct domain *d, hvm_domain_context_t *h)
+{
+    unsigned int vcpuid = hvm_load_instance(h);
+    struct vcpu *v = d->vcpu[vcpuid];
+    struct vlapic *s = vcpu_vlapic(v);
 
     if ( hvm_load_entry_zeroextend(LAPIC, h, &s->hw) != 0 )
+    {
+        ASSERT_UNREACHABLE();
         return -EINVAL;
+    }
 
     s->loaded.hw = 1;
     if ( s->loaded.regs )
         lapic_load_fixup(s);
 
-    if ( !(s->hw.apic_base_msr & APIC_BASE_ENABLE) &&
-         unlikely(vlapic_x2apic_mode(s)) )
-        return -EINVAL;
-
     hvm_update_vlapic_mode(v);
 
     return 0;
 }
 
-static int cf_check lapic_load_regs(struct domain *d, hvm_domain_context_t *h)
+static int cf_check lapic_check_regs(const struct domain *d,
+                                     hvm_domain_context_t *h)
 {
     unsigned int vcpuid = hvm_load_instance(h);
-    struct vcpu *v;
-    struct vlapic *s;
+    int rc;
 
-    if ( !has_vlapic(d) )
-        return -ENODEV;
+    if ( (rc = lapic_check_common(d, vcpuid)) )
+        return rc;
 
-    /* Which vlapic to load? */
-    if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
-    {
-        dprintk(XENLOG_G_ERR, "HVM restore: dom%d has no apic%u\n",
-                d->domain_id, vcpuid);
-        return -EINVAL;
-    }
-    s = vcpu_vlapic(v);
+    if ( !hvm_get_entry(LAPIC_REGS, h) )
+        return -ENODATA;
+
+    return 0;
+}
+
+static int cf_check lapic_load_regs(struct domain *d, hvm_domain_context_t *h)
+{
+    unsigned int vcpuid = hvm_load_instance(h);
+    struct vcpu *v = d->vcpu[vcpuid];
+    struct vlapic *s = vcpu_vlapic(v);
 
     if ( hvm_load_entry(LAPIC_REGS, h, s->regs) != 0 )
-        return -EINVAL;
+        ASSERT_UNREACHABLE();
 
     s->loaded.id = vlapic_get_reg(s, APIC_ID);
     s->loaded.ldr = vlapic_get_reg(s, APIC_LDR);
@@ -1641,9 +1669,9 @@ static int cf_check lapic_load_regs(struct domain *d, hvm_domain_context_t *h)
     return 0;
 }
 
-HVM_REGISTER_SAVE_RESTORE(LAPIC, lapic_save_hidden, NULL,
+HVM_REGISTER_SAVE_RESTORE(LAPIC, lapic_save_hidden, lapic_check_hidden,
                           lapic_load_hidden, 1, HVMSR_PER_VCPU);
-HVM_REGISTER_SAVE_RESTORE(LAPIC_REGS, lapic_save_regs, NULL,
+HVM_REGISTER_SAVE_RESTORE(LAPIC_REGS, lapic_save_regs, lapic_check_regs,
                           lapic_load_regs, 1, HVMSR_PER_VCPU);
 
 int vlapic_init(struct vcpu *v)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 09:00:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 09:00:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815841.1230054 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syp1r-0002Ku-Qf; Thu, 10 Oct 2024 09:00:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815841.1230054; Thu, 10 Oct 2024 09: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 1syp1r-0002Km-NR; Thu, 10 Oct 2024 09:00:15 +0000
Received: by outflank-mailman (input) for mailman id 815841;
 Thu, 10 Oct 2024 09: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 1syp1p-0002IA-Q4
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 09: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 1syp1p-0007pg-Os
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 09:00:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syp1p-0000wC-N7
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 09: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=+L1L0hQ6ekrXEAKefkaIQBwqyLtOYd1AIXfMk0ovHFc=; b=2RgFNuMNtMYrA1q1mtUDB3tW5o
	3gkBe+0iHBPJQx/SukD0+3QEoTC7k44DhAxOx7eeo72xbqwao8LDVMYm80cmfRuKMtYXziz9iI4zz
	11vVv2DM22TZwoPSsmI8wJHmRQOtkTyHhIl9l3mw2pOE3WikCA3nR9t128/WOv3VorD4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: Update header guards - ARGO
Message-Id: <E1syp1p-0000wC-N7@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 09:00:13 +0000

commit 439f3e6757d9dfb94320c7e9cd293cf1283617f0
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Thu Oct 10 10:53:15 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 10 10:53:15 2024 +0200

    xen: Update header guards - ARGO
    
    Updated header related to ARGO.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Christopher Clark <christopher.w.clark@gmail.com>
---
 xen/include/xen/argo.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/include/xen/argo.h b/xen/include/xen/argo.h
index fd4cfdd55c..3ef62dab19 100644
--- a/xen/include/xen/argo.h
+++ b/xen/include/xen/argo.h
@@ -12,8 +12,8 @@
  * along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef __XEN_ARGO_H__
-#define __XEN_ARGO_H__
+#ifndef XEN__ARGO_H
+#define XEN__ARGO_H
 
 #include <xen/sched.h>
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 09:00:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 09:00:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815842.1230058 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syp21-0002RZ-RO; Thu, 10 Oct 2024 09:00:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815842.1230058; Thu, 10 Oct 2024 09: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 1syp21-0002RS-Op; Thu, 10 Oct 2024 09:00:25 +0000
Received: by outflank-mailman (input) for mailman id 815842;
 Thu, 10 Oct 2024 09: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 1syp1z-0002Oc-Tr
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 09: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 1syp1z-0007ps-T5
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 09:00:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syp1z-0000xV-Qv
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 09: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=Vs+KlnXApZ3lsF53pW1bOyEAOWCrDedZvfPq1WEwqnY=; b=Z4RQN+OjKYvTWj3ABAWmKI9hEa
	DfvQRFkfYvoGAqI1TDMPpfNKI0ldW41qbb+3WBoax3MwzuOORJ6QIRiZcvHiC8zVk9Ik8GxyvxoWV
	a2loyUTc30DeOZXEcBTBvp7ZJCJqI5Erg5p61UCVUNet8GQrJbgcThqy8XDmRKeoY+jk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: restore semicolon after explicit DS prefix
Message-Id: <E1syp1z-0000xV-Qv@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 09:00:23 +0000

commit 4dec51ca72c7096b05fcd28640b5be873bd8f2db
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Oct 10 10:54:15 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 10 10:54:15 2024 +0200

    x86: restore semicolon after explicit DS prefix
    
    It's not unnecessary (as the earlier commit claimed): The integrated
    assembler of Clang up to 11 complains about an "invalid operand for
    instruction".
    
    Fixes: b42cf31d1165 ("x86: use alternative_input() in cache_flush()")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/flushtlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/flushtlb.c b/xen/arch/x86/flushtlb.c
index 2a70c5151b..65be0474a8 100644
--- a/xen/arch/x86/flushtlb.c
+++ b/xen/arch/x86/flushtlb.c
@@ -286,7 +286,7 @@ void cache_flush(const void *addr, unsigned int size)
          * + prefix than a clflush + nop, and hence the prefix is added instead
          * of letting the alternative framework fill the gap by appending nops.
          */
-        alternative_input("ds clflush %[p]",
+        alternative_input("ds; clflush %[p]",/* Semicolon for Clang-IAS < 12 */
                           "data16 clflush %[p]", /* clflushopt */
                            X86_FEATURE_CLFLUSHOPT,
                            [p] "m" (*(const char *)(addr)));
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 09:00:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 09:00:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815843.1230063 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syp2B-0002XD-V0; Thu, 10 Oct 2024 09:00:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815843.1230063; Thu, 10 Oct 2024 09: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 1syp2B-0002X5-QE; Thu, 10 Oct 2024 09:00:35 +0000
Received: by outflank-mailman (input) for mailman id 815843;
 Thu, 10 Oct 2024 09: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 1syp2A-0002WA-0l
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 09: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 1syp29-0007pz-WD
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 09:00:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syp29-0000ya-VD
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 09: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=Q8A2awMh16r5Rx38g7Jb0eHx1jssdbTkytTieULYQFw=; b=dN492rhSlxyJLS8FEHQ6/r4cJO
	TgCm+3Tqi2U5qmS5ezbWFQ3o0esJcQNhfM6IKkB6Hcjh03no/+6aG5TnPJMkFrQOjoMWUDUqSVuQ9
	9vebhO1by0L69mOf6EUWpX18job97G11Iz5mx5bOalJkTpmDHAR7PCDp9NQAyUxo8Lbc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: implement virt_to_maddr()
Message-Id: <E1syp29-0000ya-VD@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 09:00:33 +0000

commit a11b3926c4e65ade35d94c3ebf93b7a54e614732
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Oct 10 10:54:46 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 10 10:54:46 2024 +0200

    xen/riscv: implement virt_to_maddr()
    
    Implement the virt_to_maddr() function to convert virtual addresses
    to machine addresses. The function includes checks for valid address
    ranges, specifically the direct mapping region (DIRECTMAP_VIRT_START)
    and the Xen's Linkage (XEN_VIRT_START) region. If the virtual address
    falls outside of these regions, an assertion will trigger.
    To implement this, the phys_offset variable is made accessible
    outside of riscv/mm.c.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/config.h |  4 ++++
 xen/arch/riscv/include/asm/mm.h     | 22 +++++++++++++++++++++-
 xen/arch/riscv/mm.c                 |  2 +-
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/xen/arch/riscv/include/asm/config.h b/xen/arch/riscv/include/asm/config.h
index ef68281653..ad75871283 100644
--- a/xen/arch/riscv/include/asm/config.h
+++ b/xen/arch/riscv/include/asm/config.h
@@ -155,6 +155,10 @@
 
 #define IDENT_AREA_SIZE 64
 
+#ifndef __ASSEMBLY__
+extern unsigned long phys_offset; /* = load_start - XEN_VIRT_START */
+#endif
+
 #endif /* ASM__RISCV__CONFIG_H */
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/mm.h
index 5c79f3def3..ebb142502e 100644
--- a/xen/arch/riscv/include/asm/mm.h
+++ b/xen/arch/riscv/include/asm/mm.h
@@ -5,6 +5,7 @@
 
 #include <public/xen.h>
 #include <xen/bug.h>
+#include <xen/const.h>
 #include <xen/mm-frame.h>
 #include <xen/pdx.h>
 #include <xen/types.h>
@@ -28,7 +29,26 @@ static inline void *maddr_to_virt(paddr_t ma)
     return NULL;
 }
 
-#define virt_to_maddr(va) ({ BUG_ON("unimplemented"); 0; })
+/*
+ * virt_to_maddr() is expected to work with virtual addresses from either
+ * the directmap region or Xen's linkage (XEN_VIRT_START) region.
+ * Therefore, it is sufficient to check only these regions and assert if `va`
+ * is not within the directmap or Xen's linkage region.
+ */
+static inline unsigned long virt_to_maddr(unsigned long va)
+{
+    if ((va >= DIRECTMAP_VIRT_START) &&
+        (va < (DIRECTMAP_VIRT_START + DIRECTMAP_SIZE)))
+        return directmapoff_to_maddr(va - DIRECTMAP_VIRT_START);
+
+    BUILD_BUG_ON(XEN_VIRT_SIZE != MB(2));
+    ASSERT((va >> (PAGETABLE_ORDER + PAGE_SHIFT)) ==
+           (_AC(XEN_VIRT_START, UL) >> (PAGETABLE_ORDER + PAGE_SHIFT)));
+
+    /* phys_offset = load_start - XEN_VIRT_START */
+    return phys_offset + va;
+}
+#define virt_to_maddr(va) virt_to_maddr((unsigned long)(va))
 
 /* Convert between Xen-heap virtual addresses and machine frame numbers. */
 #define __virt_to_mfn(va)  mfn_x(maddr_to_mfn(virt_to_maddr(va)))
diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c
index 4a628aef83..daa02b2c60 100644
--- a/xen/arch/riscv/mm.c
+++ b/xen/arch/riscv/mm.c
@@ -26,7 +26,7 @@ struct mmu_desc {
     pte_t *pgtbl_base;
 };
 
-static unsigned long __ro_after_init phys_offset;
+unsigned long __ro_after_init phys_offset; /* = load_start - XEN_VIRT_START */
 
 #define LOAD_TO_LINK(addr) ((unsigned long)(addr) - phys_offset)
 #define LINK_TO_LOAD(addr) ((unsigned long)(addr) + phys_offset)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 09:00:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 09:00:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815844.1230066 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syp2K-0002bZ-Vj; Thu, 10 Oct 2024 09:00:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815844.1230066; Thu, 10 Oct 2024 09: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 1syp2K-0002bS-T2; Thu, 10 Oct 2024 09:00:44 +0000
Received: by outflank-mailman (input) for mailman id 815844;
 Thu, 10 Oct 2024 09: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 1syp2K-0002b9-3S
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 09: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 1syp2K-0007q6-2k
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 09:00:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syp2K-000101-1z
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 09: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=+6W5HgxTF5pxmrpmwD2nTzY4CKvWiorjiMaDmAFe/no=; b=FV2pH9tPoiO8vLubX1sd3gKpNf
	zRag/vI4lhzgmBjxiwBLn/Xy6HuY312fCQbRq1ozzqSUxXIzKmqB18rwKJAlekeeAmFGkv3f15/v/
	XoWVpzgxCOeJV5eMAHT6Q5WBCoVHQQplH0GvKfR7st9jCBGOhjItOI/ERhhng2PZu294=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: switch LINK_TO_LOAD() to virt_to_maddr()
Message-Id: <E1syp2K-000101-1z@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 09:00:44 +0000

commit 59ef5d2a953f97c1afdd744e6b6b54aebce5b17d
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Oct 10 10:55:05 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 10 10:55:05 2024 +0200

    xen/riscv: switch LINK_TO_LOAD() to virt_to_maddr()
    
    Use virt_to_maddr() instead of LINK_TO_LOAD as virt_to_maddr()
    covers all the cases where LINK_TO_LOAD() is used.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/mm.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c
index daa02b2c60..27026d803b 100644
--- a/xen/arch/riscv/mm.c
+++ b/xen/arch/riscv/mm.c
@@ -29,7 +29,6 @@ struct mmu_desc {
 unsigned long __ro_after_init phys_offset; /* = load_start - XEN_VIRT_START */
 
 #define LOAD_TO_LINK(addr) ((unsigned long)(addr) - phys_offset)
-#define LINK_TO_LOAD(addr) ((unsigned long)(addr) + phys_offset)
 
 /*
  * It is expected that Xen won't be more then 2 MB.
@@ -122,7 +121,7 @@ static void __init setup_initial_mapping(struct mmu_desc *mmu_desc,
                 unsigned long paddr = (page_addr - map_start) + pa_start;
                 unsigned int permissions = PTE_LEAF_DEFAULT;
                 unsigned long addr = is_identity_mapping
-                                     ? page_addr : LINK_TO_LOAD(page_addr);
+                                     ? page_addr : virt_to_maddr(page_addr);
                 pte_t pte_to_be_written;
 
                 index = pt_index(0, page_addr);
@@ -225,7 +224,7 @@ void __init setup_fixmap_mappings(void)
 
     BUG_ON(pte_is_valid(*pte));
 
-    tmp = paddr_to_pte(LINK_TO_LOAD((unsigned long)&xen_fixmap), PTE_TABLE);
+    tmp = paddr_to_pte(virt_to_maddr(&xen_fixmap), PTE_TABLE);
     write_pte(pte, tmp);
 
     RISCV_FENCE(rw, rw);
@@ -312,7 +311,7 @@ void __init remove_identity_mapping(void)
     pte_t *pgtbl;
     unsigned int index, xen_index;
     unsigned long ident_start =
-        LINK_TO_LOAD(turn_on_mmu) & XEN_PT_LEVEL_MAP_MASK(0);
+        virt_to_maddr(turn_on_mmu) & XEN_PT_LEVEL_MAP_MASK(0);
 
     for ( pgtbl = stage1_pgtbl_root, i = CONFIG_PAGING_LEVELS; i; i-- )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 09:00:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 09:00:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815845.1230069 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syp2V-0002iO-1I; Thu, 10 Oct 2024 09:00:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 815845.1230069; Thu, 10 Oct 2024 09: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 1syp2U-0002iG-UW; Thu, 10 Oct 2024 09:00:54 +0000
Received: by outflank-mailman (input) for mailman id 815845;
 Thu, 10 Oct 2024 09: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 1syp2U-0002i6-6d
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 09: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 1syp2U-0007qU-5m
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 09:00:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syp2U-00011C-4o
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 09: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=9M2X5ZoaJPqvJjNmCyrujd9OH6vuXj4nSSExdX2kSvw=; b=K+Cn8eppZuXxvdIoQnFXwUVw9b
	Ngc2XU7VcB2Li362PERTmnPn5vS83m8e0moBAOm8j7n29enS1EzY/MoEqm+k4d6Vq3SnKD4Sb9EGf
	p1+lvJ7jvbJQMQxXb6hlmC3T6O7OE67o496uuJQKBoY1SKQK1X/QsGthiO+bmbFjTaR0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: register Xen's load address as a boot module
Message-Id: <E1syp2U-00011C-4o@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 09:00:54 +0000

commit 2b49ef4503e2c549c166f439cf0dd331d9a8874c
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Oct 10 10:55:24 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 10 10:55:24 2024 +0200

    xen/riscv: register Xen's load address as a boot module
    
    Avoid using BOOTMOD_XEN region for other purposes or boot modules
    which could result in memory corruption or undefined behaviour.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/setup.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index 6d156c3a40..f531ca38ee 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
 #include <xen/bug.h>
+#include <xen/bootfdt.h>
 #include <xen/compile.h>
 #include <xen/device_tree.h>
 #include <xen/init.h>
@@ -44,6 +45,11 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
               "Please check your bootloader.\n",
               dtb_addr, BOOT_FDT_VIRT_SIZE);
 
+    /* Register Xen's load address as a boot module. */
+    if ( !add_boot_module(BOOTMOD_XEN, virt_to_maddr(_start),
+                          _end - _start, false) )
+        panic("Failed to add BOOTMOD_XEN\n");
+
     printk("All set up\n");
 
     machine_halt();
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 09:11:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 09:11:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.815857.1230084 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sypCK-0002Na-0w; Thu, 10 Oct 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 815857.1230084; Thu, 10 Oct 2024 09:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sypCJ-0002NS-UP; Thu, 10 Oct 2024 09:11:03 +0000
Received: by outflank-mailman (input) for mailman id 815857;
 Thu, 10 Oct 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 1sypCJ-0002NM-8k
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 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 1sypCJ-00080M-6f
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 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 1sypCJ-00026a-5I
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 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=gdW8xdg9d72ROPOcYxpqN3RRzCyr91dmaBJrZIUlEHk=; b=5Dohi0e3zGPjS83mzqpa0j9Ch5
	R3frMaW+r8c7JbUPbysRXQ8+pSb44FBL/UBnSoaYiac9m9cEZocHHih5QNjz70shNIDKiUNLMhWYa
	LMYuc9GO+P+B/HvzJ5SQB5sMYu71STF+NYKEMBGlLbMbsESm9SIrM95EF4t87g1ALqOA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Flask: replace uses of __u32
Message-Id: <E1sypCJ-00026a-5I@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 09:11:03 +0000

commit c73adc9cf8d2ce100878160df351c0ca90b3bf7d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Oct 10 10:59:38 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 10 10:59:38 2024 +0200

    Flask: replace uses of __u32
    
    ... by uint32_t.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/xsm/flask/ss/conditional.h | 4 ++--
 xen/xsm/flask/ss/policydb.h    | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/xsm/flask/ss/conditional.h b/xen/xsm/flask/ss/conditional.h
index 500fe4305a..7067596d69 100644
--- a/xen/xsm/flask/ss/conditional.h
+++ b/xen/xsm/flask/ss/conditional.h
@@ -29,8 +29,8 @@ struct cond_expr {
 #define COND_EQ        6 /* bool == bool */
 #define COND_NEQ    7 /* bool != bool */
 #define COND_LAST    COND_NEQ
-    __u32 expr_type;
-    __u32 bool_val;
+    uint32_t expr_type;
+    uint32_t bool_val;
     struct cond_expr *next;
 };
 
diff --git a/xen/xsm/flask/ss/policydb.h b/xen/xsm/flask/ss/policydb.h
index d3b409a554..b1c26f26bc 100644
--- a/xen/xsm/flask/ss/policydb.h
+++ b/xen/xsm/flask/ss/policydb.h
@@ -131,7 +131,7 @@ struct range_trans {
 
 /* Boolean data type */
 struct cond_bool_datum {
-    __u32 value;        /* internal type value */
+    uint32_t value;        /* internal type value */
     int state;
 };
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 12:55:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 12:55:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816114.1230286 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sysh6-0006E4-VA; Thu, 10 Oct 2024 12:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816114.1230286; Thu, 10 Oct 2024 12: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 1sysh6-0006Dw-SY; Thu, 10 Oct 2024 12:55:04 +0000
Received: by outflank-mailman (input) for mailman id 816114;
 Thu, 10 Oct 2024 12: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 1sysh5-0006Dq-Ut
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 12: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 1sysh5-0003QD-Tn
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 12:55:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sysh5-0008Jv-S3
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 12: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=5gVUYYSaT0doqjiSYc5Y2y1cY8IS/iOT5dPgmmSa/oM=; b=ECenuQdMD42V2Jrk+swof6bFIy
	wA2xccu24eh4jYsCrXxcpB58GwomDvM14L/ZGPWzqYo4p7h5msLPr4coGmTyzootSAOI05AGDccfi
	itl1C+lEi0lszUY9THRBL+XlTa3Wy0YVHYO4WQLJi5lIqdSP9SK8KKpQENRkbKSD2KBA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ocaml/libs: Remove xsd_glue_dev package, package plugin_interface_v1.a
Message-Id: <E1sysh5-0008Jv-S3@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 12:55:03 +0000

commit a592c98f94a1a58838acd3f4cc8b55132b1061c0
Author:     Andrii Sultanov <andrii.sultanov@cloud.com>
AuthorDate: Wed Oct 9 16:15:20 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 10 13:48:12 2024 +0100

    ocaml/libs: Remove xsd_glue_dev package, package plugin_interface_v1.a
    
    xsd_glue_dev packaging is inconsistent with the rest of OCaml packages and
    isn't actually necessary. The .a is needed alongside compiled bytecode files
    during linking and was missed in the initial oxenstored plugin work.
    
    Specify OCAMLCFLAGS along with OCAMLOPTFLAGS.
    
    Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
---
 tools/ocaml/libs/xsd_glue/Makefile | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/ocaml/libs/xsd_glue/Makefile b/tools/ocaml/libs/xsd_glue/Makefile
index f84291f7fe..be68642968 100644
--- a/tools/ocaml/libs/xsd_glue/Makefile
+++ b/tools/ocaml/libs/xsd_glue/Makefile
@@ -5,6 +5,7 @@ include $(OCAML_TOPLEVEL)/common.make
 SUBDIRS= domain_getinfo_plugin_v1
 
 CFLAGS += $(CFLAGS_xeninclude)
+OCAMLCFLAGS += -opaque
 OCAMLOPTFLAGS += -opaque
 
 OBJS = plugin_interface_v1
@@ -28,14 +29,11 @@ OCAML_NOC_LIBRARY = plugin_interface_v1
 install: $(LIBS) META subdirs-install
 	mkdir -p $(OCAMLDESTDIR)
 	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xsd_glue
-	$(OCAMLFIND) install -destdir $(OCAMLDESTDIR) -ldconf ignore xsd_glue META $(INTF) $(LIBS)
-	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xsd_glue_dev
-	$(OCAMLFIND) install -destdir $(OCAMLDESTDIR) -ldconf ignore xsd_glue_dev META $(INTF) $(LIBS) *.ml *.mli
+	$(OCAMLFIND) install -destdir $(OCAMLDESTDIR) -ldconf ignore xsd_glue META $(INTF) $(LIBS) *.a
 
 .PHONY: uninstall
 uninstall: subdirs-uninstall
 	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xsd_glue
-	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xsd_glue_dev
 
 .PHONY: clean
 clean: subdirs-clean
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 13:22:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 13:22:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816155.1230339 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syt7E-0000VM-Ur; Thu, 10 Oct 2024 13:22:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816155.1230339; Thu, 10 Oct 2024 13: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 1syt7E-0000VA-RT; Thu, 10 Oct 2024 13:22:04 +0000
Received: by outflank-mailman (input) for mailman id 816155;
 Thu, 10 Oct 2024 13: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 1syt7E-0000Uy-5F
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 13: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 1syt7D-0003uN-UE
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 13:22:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syt7D-0002aE-T9
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 13: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=1gIyvrsMgRefj4lKOAS6i8kumjnTK6KYPio5TMqjKjM=; b=nCXlmcEH72bbMtprdAKsrxY8Vw
	2KmA0DWThA3tiHAAVFtr2U6OT3RTmgy1zaJMdhW6nzUPv81VWPvh/jmL0+4nyXMR4Y7l1ezNN3GgD
	8w0a9puwXxpQYhESLRZNevcuFqglZtVMWhqH41egv7SgE/dTvzvxa2OFdPJYFZ+b5gKU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] stubdom: add fine grained library config items to Mini-OS configs
Message-Id: <E1syt7D-0002aE-T9@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 13:22:03 +0000

commit b5b9420334229ea295679a6fbb436f2ac3824147
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Oct 10 13:19:46 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 10 14:09:41 2024 +0100

    stubdom: add fine grained library config items to Mini-OS configs
    
    Today Mini-OS can only be configured to use all or no Xen libraries.
    In order to prepare a more fine grained configuration scheme, add per
    library config items to the Mini-OS config files.
    
    As some libraries pull in others, the config files need to be
    extended at build time to reflect those indirect library uses.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 stubdom/.gitignore |  1 +
 stubdom/Makefile   | 49 +++++++++++++++++++++++++++++++++++++------------
 2 files changed, 38 insertions(+), 12 deletions(-)

diff --git a/stubdom/.gitignore b/stubdom/.gitignore
index 10e2547a22..23350446b9 100644
--- a/stubdom/.gitignore
+++ b/stubdom/.gitignore
@@ -1,3 +1,4 @@
+*.gen.cfg
 /*.tar.gz
 /*-minios-config.mk
 /autom4te.cache/
diff --git a/stubdom/Makefile b/stubdom/Makefile
index f8c31fd35d..6ed4253b25 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -342,6 +342,14 @@ endef
 
 $(foreach lib,$(STUB_LIBS),$(eval $(call BUILD_lib,$(lib))))
 
+define GEN_config
+ (cat $< && \
+ for i in $(sort $(APP_LIBS) $(call xenlibs-dependencies,$(APP_LIBS))); do \
+   u=`echo $$i | tr a-z A-Z`; \
+   echo "CONFIG_LIBXEN$$u=y"; \
+ done)
+endef
+
 xenstore/stamp: $(XEN_ROOT)/tools/xenstored/Makefile.common
 	$(do_links)
 
@@ -375,8 +383,12 @@ $(TARGETS_MINIOS): mini-os-%:
 # ioemu
 #######
 
-ioemu-minios-config.mk: $(CURDIR)/ioemu-minios.cfg
-	MINIOS_CONFIG="$<" CONFIG_FILE="$(CURDIR)/$@" $(MAKE) DESTDIR= -C $(MINI_OS) config
+ioemu-minios.gen.cfg: APP_LIBS = evtchn gnttab ctrl guest
+ioemu-minios.gen.cfg: ioemu-minios.cfg Makefile
+	$(GEN_config) >$@
+
+ioemu-minios-config.mk: ioemu-minios.gen.cfg
+	MINIOS_CONFIG="$(CURDIR)/$<" CONFIG_FILE="$(CURDIR)/$@" $(MAKE) DESTDIR= -C $(MINI_OS) config
 
 .PHONY: ioemu
 ioemu: cross-zlib cross-libpci libxenguest ioemu-minios-config.mk
@@ -437,8 +449,12 @@ grub-upstream: grub-$(GRUB_VERSION).tar.gz
 		patch -d $@ -p1 < $$i || exit 1; \
 	done
 
-grub-$(XEN_TARGET_ARCH)-minios-config.mk: $(CURDIR)/grub/minios.cfg
-	MINIOS_CONFIG="$<" CONFIG_FILE="$(CURDIR)/$@" $(MAKE) DESTDIR= -C $(MINI_OS) config
+grub/minios.gen.cfg: APP_LIBS = guest ctrl toollog
+grub/minios.gen.cfg: grub/minios.cfg Makefile
+	$(GEN_config) >$@
+
+grub-$(XEN_TARGET_ARCH)-minios-config.mk: grub/minios.gen.cfg
+	MINIOS_CONFIG="$(CURDIR)/$<" CONFIG_FILE="$(CURDIR)/$@" $(MAKE) DESTDIR= -C $(MINI_OS) config
 
 .PHONY: grub
 grub: cross-polarssl grub-upstream $(CROSS_ROOT) grub-$(XEN_TARGET_ARCH)-minios-config.mk
@@ -449,8 +465,12 @@ grub: cross-polarssl grub-upstream $(CROSS_ROOT) grub-$(XEN_TARGET_ARCH)-minios-
 # xenstore
 ##########
 
-xenstore-minios-config.mk: $(CURDIR)/xenstore-minios.cfg
-	MINIOS_CONFIG="$<" CONFIG_FILE="$(CURDIR)/$@" $(MAKE) DESTDIR= -C $(MINI_OS) config
+xenstore-minios.gen.cfg: APP_LIBS = gnttab evtchn toollog ctrl
+xenstore-minios.gen.cfg: xenstore-minios.cfg Makefile
+	$(GEN_config) >$@
+
+xenstore-minios-config.mk: xenstore-minios.gen.cfg
+	MINIOS_CONFIG="$(CURDIR)/$<" CONFIG_FILE="$(CURDIR)/$@" $(MAKE) DESTDIR= -C $(MINI_OS) config
 
 .PHONY: xenstore
 xenstore: $(CROSS_ROOT) xenstore-minios-config.mk
@@ -460,8 +480,12 @@ xenstore: $(CROSS_ROOT) xenstore-minios-config.mk
 # xenstorepvh
 #############
 
-xenstorepvh-minios-config.mk: $(CURDIR)/xenstorepvh-minios.cfg
-	MINIOS_CONFIG="$<" CONFIG_FILE="$(CURDIR)/$@" $(MAKE) DESTDIR= -C $(MINI_OS) config
+xenstorepvh-minios.gen.cfg: APP_LIBS = gnttab evtchn toollog ctrl
+xenstorepvh-minios.gen.cfg: xenstorepvh-minios.cfg Makefile
+	$(GEN_config) >$@
+
+xenstorepvh-minios-config.mk: xenstorepvh-minios.gen.cfg
+	MINIOS_CONFIG="$(CURDIR)/$<" CONFIG_FILE="$(CURDIR)/$@" $(MAKE) DESTDIR= -C $(MINI_OS) config
 
 .PHONY: xenstorepvh
 xenstorepvh: $(CROSS_ROOT) xenstorepvh-minios-config.mk
@@ -474,7 +498,7 @@ xenstorepvh: $(CROSS_ROOT) xenstorepvh-minios-config.mk
 .PHONY: ioemu-stubdom
 ioemu-stubdom: APP_OBJS=$(CURDIR)/ioemu/i386-stubdom/qemu.a $(CURDIR)/ioemu/i386-stubdom/libqemu.a $(CURDIR)/ioemu/libqemu_common.a
 ioemu-stubdom: mini-os-$(XEN_TARGET_ARCH)-ioemu lwip-$(XEN_TARGET_ARCH) libxenguest ioemu
-	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/ioemu-minios.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS="$(APP_OBJS)"
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/ioemu-minios.gen.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS="$(APP_OBJS)"
 
 .PHONY: c-stubdom
 c-stubdom: mini-os-$(XEN_TARGET_ARCH)-c lwip-$(XEN_TARGET_ARCH) libxenguest c
@@ -490,7 +514,7 @@ vtpmmgr-stubdom: mini-os-$(XEN_TARGET_ARCH)-vtpmmgr vtpmmgr
 
 .PHONY: pv-grub
 pv-grub: mini-os-$(XEN_TARGET_ARCH)-grub libxenguest grub
-	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/grub/minios.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/grub-$(XEN_TARGET_ARCH)/main.a
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/grub/minios.gen.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/grub-$(XEN_TARGET_ARCH)/main.a
 
 .PHONY: pv-grub-if-enabled
 ifneq ($(filter grub,$(STUBDOM_TARGETS)),)
@@ -501,11 +525,11 @@ endif
 
 .PHONY: xenstore-stubdom
 xenstore-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstore libxenguest xenstore
-	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/xenstore-minios.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/xenstore/xenstored.a
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/xenstore-minios.gen.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/xenstore/xenstored.a
 
 .PHONY: xenstorepvh-stubdom
 xenstorepvh-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstorepvh libxenguest xenstorepvh
-	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/xenstorepvh-minios.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/xenstorepvh/xenstored.a
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/xenstorepvh-minios.gen.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/xenstorepvh/xenstored.a
 
 #########
 # install
@@ -607,6 +631,7 @@ clean:
 	rm -fr grub-$(XEN_TARGET_ARCH)
 	rm -f $(STUBDOMPATH)
 	rm -f *-minios-config.mk
+	rm -f *.gen.cfg
 	rm -fr pkg-config
 	-[ ! -d ioemu ] || $(MAKE) DESTDIR= -C ioemu clean
 	-[ ! -d xenstore ] || $(MAKE) -f $(CURDIR)/xenlibs.mk -C xenstore clean
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 14:33:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 14:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816232.1230424 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syuDv-0000sk-Q9; Thu, 10 Oct 2024 14:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816232.1230424; Thu, 10 Oct 2024 14:33:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syuDv-0000sc-NY; Thu, 10 Oct 2024 14:33:03 +0000
Received: by outflank-mailman (input) for mailman id 816232;
 Thu, 10 Oct 2024 14: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 1syuDu-0000sW-Jq
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 14: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 1syuDu-0005GG-Gk
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 14:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syuDu-0001Y3-EF
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 14:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=4nLlcrrjN6BMdr9gCytyxS/1eD/8IkLRq4d6Wjv00Bk=; b=APqpa0Ni8UJiz+liDerllBHOSy
	rdEH07RFc0xuoElRHbVf5nItuTRvoxvc21xOXWZvB64E+TxrFESWH70pHkUejrmhlvQ+6kgtgnv4T
	LaasES46qNpD0FG+rAauCx7dK3JMMjKdpGrY8088Nw4alk6eioTzDOftoreti7DBhbdw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] add config support for each Xen library
Message-Id: <E1syuDu-0001Y3-EF@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 14:33:02 +0000

commit 80ef70f92cb7b95ef48deea1157f2194b10b8c05
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Wed Oct 9 16:05:54 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 10 15:27:04 2024 +0100

    add config support for each Xen library
    
    Instead of Xen libraries being all or nothing (controlled by
    CONFIG_XC), support a dedicated config option for each library
    instead, defaulting to disabled.
    
    As it is no longer needed now, drop the CONFIG_XC support.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 Config.mk | 11 +++++++++--
 Makefile  | 18 +++++++++++++++++-
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/Config.mk b/Config.mk
index f2d1f0a..f59a0cf 100644
--- a/Config.mk
+++ b/Config.mk
@@ -193,6 +193,15 @@ CONFIG-n += CONFIG_9PFRONT
 CONFIG-n += CONFIG_TPM_TIS
 CONFIG-n += CONFIG_TPMBACK
 CONFIG-n += CONFIG_BALLOON
+CONFIG-n += CONFIG_LIBXENCALL
+CONFIG-n += CONFIG_LIBXENCTRL
+CONFIG-n += CONFIG_LIBXENDEVICEMODEL
+CONFIG-n += CONFIG_LIBXENEVTCHN
+CONFIG-n += CONFIG_LIBXENFOREIGNMEMORY
+CONFIG-n += CONFIG_LIBXENGNTTAB
+CONFIG-n += CONFIG_LIBXENGUEST
+CONFIG-n += CONFIG_LIBXENTOOLCORE
+CONFIG-n += CONFIG_LIBXENTOOLLOG
 # Setting CONFIG_USE_XEN_CONSOLE copies all print output to the Xen emergency
 # console apart of standard dom0 handled console.
 CONFIG-n += CONFIG_USE_XEN_CONSOLE
@@ -201,8 +210,6 @@ CONFIG-y += CONFIG_PARAVIRT
 else
 CONFIG-n += CONFIG_PARAVIRT
 endif
-# Support legacy CONFIG_XC value
-CONFIG_XC ?= $(libc)
 
 CONFIG-$(lwip) += CONFIG_LWIP
 
diff --git a/Makefile b/Makefile
index 6c8df8b..ffa8d1a 100644
--- a/Makefile
+++ b/Makefile
@@ -123,23 +123,39 @@ endif
 OBJS := $(filter-out $(OBJ_DIR)/lwip%.o $(LWO), $(OBJS))
 
 ifeq ($(libc),y)
-ifeq ($(CONFIG_XC),y)
+ifeq ($(CONFIG_LIBXENTOOLCORE),y)
 APP_LDLIBS += -L$(TOOLCORE_PATH) -whole-archive -lxentoolcore -no-whole-archive
 LIBS += $(TOOLCORE_PATH)/libxentoolcore.a
+endif
+ifeq ($(CONFIG_LIBXENTOOLLOG),y)
 APP_LDLIBS += -L$(TOOLLOG_PATH) -whole-archive -lxentoollog -no-whole-archive
 LIBS += $(TOOLLOG_PATH)/libxentoollog.a
+endif
+ifeq ($(CONFIG_LIBXENEVTCHN),y)
 APP_LDLIBS += -L$(EVTCHN_PATH) -whole-archive -lxenevtchn -no-whole-archive
 LIBS += $(EVTCHN_PATH)/libxenevtchn.a
+endif
+ifeq ($(CONFIG_LIBXENGNTTAB),y)
 APP_LDLIBS += -L$(GNTTAB_PATH) -whole-archive -lxengnttab -no-whole-archive
 LIBS += $(GNTTAB_PATH)/libxengnttab.a
+endif
+ifeq ($(CONFIG_LIBXENCALL),y)
 APP_LDLIBS += -L$(CALL_PATH) -whole-archive -lxencall -no-whole-archive
 LIBS += $(CALL_PATH)/libxencall.a
+endif
+ifeq ($(CONFIG_LIBXENFOREIGNMEMORY),y)
 APP_LDLIBS += -L$(FOREIGNMEMORY_PATH) -whole-archive -lxenforeignmemory -no-whole-archive
 LIBS += $(FOREIGNMEMORY_PATH)/libxenforeignmemory.a
+endif
+ifeq ($(CONFIG_LIBXENDEVICEMODEL),y)
 APP_LDLIBS += -L$(DEVICEMODEL_PATH) -whole-archive -lxendevicemodel -no-whole-archive
 LIBS += $(DEVICEMODEL_PATH)/libxendevicemodel.a
+endif
+ifeq ($(CONFIG_LIBXENGUEST),y)
 APP_LDLIBS += -L$(GUEST_PATH) -whole-archive -lxenguest -no-whole-archive
 LIBS += $(GUEST_PATH)/libxenguest.a
+endif
+ifeq ($(CONFIG_LIBXENCTRL),y)
 APP_LDLIBS += -L$(CTRL_PATH) -whole-archive -lxenctrl -no-whole-archive
 LIBS += $(CTRL_PATH)/libxenctrl.a
 endif
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 15:33:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 15:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816315.1230517 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syvA1-0006B6-V1; Thu, 10 Oct 2024 15:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816315.1230517; Thu, 10 Oct 2024 15: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 1syvA1-0006Ay-SP; Thu, 10 Oct 2024 15:33:05 +0000
Received: by outflank-mailman (input) for mailman id 816315;
 Thu, 10 Oct 2024 15:33: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 1syv9z-0006Ap-RX
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 15:33: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 1syv9z-0006VT-PE
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 15:33:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syv9z-0007fo-OI
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 15: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=hx5mVi/650XDp5Fiw84ZLBRjhhvDvVxqRh4DtkjZ66A=; b=D4iAuinVEfZHlIWnAubkhdmrQF
	j07msm22UqENgVXwsGhcxtQnIFinSPj2IH2z0pNg+0eHSxMKDu9ui7UGjZYJA0NzAu9viLX8d6unV
	1Ar1rZDF8lto79zym3aNYVot1xHY/MjljwYXEtdjGEStyGZ1o3M4gImZWK0bRiuWE35s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] dt-overlay: Fix NULL pointer dereference
Message-Id: <E1syv9z-0007fo-OI@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 15:33:03 +0000

commit 95f2a5656e65010ee86afd2ac3ad072cdf36a97a
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Oct 4 14:22:15 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Oct 10 16:18:56 2024 +0100

    dt-overlay: Fix NULL pointer dereference
    
    Attempt to attach an overlay (xl dt-overlay attach) to a domain without
    first adding this overlay to Xen (xl dt-overlay add) results in an
    overlay track entry being NULL in handle_attach_overlay_nodes(). This
    leads to NULL pointer dereference and the following data abort crash:
    
    (XEN) Cannot find any matching tracker with input dtbo. Operation is supported only for prior added dtbo.
    (XEN) Data Abort Trap. Syndrome=0x5
    (XEN) Walking Hypervisor VA 0x40 on CPU0 via TTBR 0x0000000046948000
    (XEN) 0TH[0x000] = 0x46940f7f
    (XEN) 1ST[0x000] = 0x0
    (XEN) CPU0: Unexpected Trap: Data Abort
    (XEN) ----[ Xen-4.20-unstable  arm64  debug=y  Not tainted ]----
    ...
    (XEN) Xen call trace:
    (XEN)    [<00000a0000208b30>] dt_overlay_domctl+0x304/0x370 (PC)
    (XEN)    [<00000a0000208b30>] dt_overlay_domctl+0x304/0x370 (LR)
    (XEN)    [<00000a0000274b7c>] arch_do_domctl+0x48/0x328
    
    Fixes: 4c733873b5c2 ("xen/arm: Add XEN_DOMCTL_dt_overlay and device attachment to domains")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/dt-overlay.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/common/dt-overlay.c b/xen/common/dt-overlay.c
index d53b4706cd..8606b14d1e 100644
--- a/xen/common/dt-overlay.c
+++ b/xen/common/dt-overlay.c
@@ -908,8 +908,11 @@ static long handle_attach_overlay_nodes(struct domain *d,
  out:
     spin_unlock(&overlay_lock);
 
-    rangeset_destroy(entry->irq_ranges);
-    rangeset_destroy(entry->iomem_ranges);
+    if ( entry )
+    {
+        rangeset_destroy(entry->irq_ranges);
+        rangeset_destroy(entry->iomem_ranges);
+    }
 
     return rc;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 15:33:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 15:33:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816316.1230522 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syvAC-0006Dg-0E; Thu, 10 Oct 2024 15:33:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816316.1230522; Thu, 10 Oct 2024 15: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 1syvAB-0006DY-Tt; Thu, 10 Oct 2024 15:33:15 +0000
Received: by outflank-mailman (input) for mailman id 816316;
 Thu, 10 Oct 2024 15: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 1syvA9-0006DI-T3
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 15: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 1syvA9-0006Vf-SF
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 15:33:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syvA9-0007gr-RN
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 15: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=ecee+HMHiH9IWBwr8fF04k/G1WG7+h6MhUT9m75Da1s=; b=s7QAyePARAXHleYIA0FmJAZowr
	H+9E9kRR8TJRFykMbl3thLNlrJbT5Muv934KgsehnqSC5D4wxRaJ+c9pjWSAmShrZg+7KqUU2dWFK
	uVZqZvdxM3j/uop7QmSVnDhgsCLi69Jl7i8qhOLWr0Ud/nATV+o0+R1Y+lHk6cxtvW04=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] device-tree: Remove __init from unflatten_dt_alloc()
Message-Id: <E1syvA9-0007gr-RN@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 15:33:13 +0000

commit 656ac422c40b358fdcd8729b2d1ee17d423955cd
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Oct 4 14:22:16 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Oct 10 16:18:56 2024 +0100

    device-tree: Remove __init from unflatten_dt_alloc()
    
    With CONFIG_OVERLAY_DTB=y, unflatten_dt_alloc() is used as part of
    unflatten_dt_node() used during runtime. In case of a binary compiled
    such as unflatten_dt_alloc() does not get inlined (e.g. using -Og),
    attempt to add an overlay to Xen (xl dt-overlay add) results in a crash.
    
    (XEN) Instruction Abort Trap. Syndrome=0x7
    (XEN) Walking Hypervisor VA 0xa00002c8cc0 on CPU2 via TTBR 0x0000000040340000
    (XEN) 0TH[0x014] = 0x4033ff7f
    (XEN) 1ST[0x000] = 0x4033ef7f
    (XEN) 2ND[0x001] = 0x4000004033af7f
    (XEN) 3RD[0x0c8] = 0x0
    (XEN) CPU2: Unexpected Trap: Instruction Abort
    (XEN) ----[ Xen-4.20-unstable  arm64  debug=y  Not tainted ]----
    ...
    (XEN) Xen call trace:
    (XEN)    [<00000a00002c8cc0>] 00000a00002c8cc0 (PC)
    (XEN)    [<00000a0000202410>] device-tree.c#unflatten_dt_node+0xd0/0x504 (LR)
    (XEN)    [<00000a0000204484>] unflatten_device_tree+0x54/0x1a0
    (XEN)    [<00000a000020800c>] dt-overlay.c#handle_add_overlay_nodes+0x290/0x3d4
    (XEN)    [<00000a0000208360>] dt_overlay_sysctl+0x8c/0x110
    (XEN)    [<00000a000027714c>] arch_do_sysctl+0x1c/0x2c
    
    Fixes: 9e9d2c079dc4 ("xen/arm/device: Remove __init from function type")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/device-tree/device-tree.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/common/device-tree/device-tree.c b/xen/common/device-tree/device-tree.c
index 8d1017a49d..d0528c5825 100644
--- a/xen/common/device-tree/device-tree.c
+++ b/xen/common/device-tree/device-tree.c
@@ -120,8 +120,8 @@ void dt_child_set_range(__be32 **cellp, int addrcells, int sizecells,
     dt_set_cell(cellp, sizecells, size);
 }
 
-static void __init *unflatten_dt_alloc(unsigned long *mem, unsigned long size,
-                                       unsigned long align)
+static void *unflatten_dt_alloc(unsigned long *mem, unsigned long size,
+                                unsigned long align)
 {
     void *res;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 15:33:26 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 15:33:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816317.1230526 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syvAM-0006GO-1x; Thu, 10 Oct 2024 15:33:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816317.1230526; Thu, 10 Oct 2024 15:33: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 1syvAL-0006GG-VG; Thu, 10 Oct 2024 15:33:25 +0000
Received: by outflank-mailman (input) for mailman id 816317;
 Thu, 10 Oct 2024 15: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 1syvAK-0006G2-0M
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 15: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 1syvAJ-0006Vt-VS
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 15:33:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syvAJ-0007hb-UT
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 15:33: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=1t68t3V84k+0iQs3VVSorX/IngODgAK9buwqk2/BgjQ=; b=U8n4nsvncAqUyUde36nhqmu+3H
	ypbv1eV6SWA8ZO64AACyfuOlTM3I8FIarOXjS5solDxmZFkznv/FDedtgAaBaSWid8nprQBuF9xh3
	31uta9NUIxUx1qzDeWTrkbyyhJRgXeCCPs0CskPRklQPLV+Hq2eZDkUyC9E129cFqxn0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] dt-overlay: Remove ASSERT_UNREACHABLE from add_nodes()
Message-Id: <E1syvAJ-0007hb-UT@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 15:33:23 +0000

commit 81862825e8139a81c51fece39a05768736e4bf5d
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Oct 4 14:22:17 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Oct 10 16:18:56 2024 +0100

    dt-overlay: Remove ASSERT_UNREACHABLE from add_nodes()
    
    The assumption stated in the comment that the code will never get there
    is incorrect. In overlay_get_nodes_info() we manually combine path from
    target-path property with the node path by adding '/' as a separator.
    This can differ from a path obtained by libfdt due to more advanced
    logic used there which can for instance get rid of excessive slashes.
    In case of incorrect target-path (e.g. target-path = "//axi"), the
    comparison in dt_find_node_by_path_from() can fail triggering the assert
    in debug builds.
    
    Fixes: 0c0facdab6f5 ("xen/arm: Implement device tree node addition functionalities")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/dt-overlay.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/xen/common/dt-overlay.c b/xen/common/dt-overlay.c
index 8606b14d1e..d18bd12bd3 100644
--- a/xen/common/dt-overlay.c
+++ b/xen/common/dt-overlay.c
@@ -596,11 +596,7 @@ static long add_nodes(struct overlay_track *tr, char **nodes_full_path)
         overlay_node = dt_find_node_by_path_from(tr->dt_host_new,
                                                  nodes_full_path[j]);
         if ( overlay_node == NULL )
-        {
-            /* Sanity check. But code will never come here. */
-            ASSERT_UNREACHABLE();
             return -EFAULT;
-        }
 
         /*
          * Find previous and next node to overlay_node in dt_host_new. We will
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 15:33:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 15:33:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816318.1230530 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syvAV-0006Jc-4j; Thu, 10 Oct 2024 15:33:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816318.1230530; Thu, 10 Oct 2024 15:33: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 1syvAV-0006JT-26; Thu, 10 Oct 2024 15:33:35 +0000
Received: by outflank-mailman (input) for mailman id 816318;
 Thu, 10 Oct 2024 15:33: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 1syvAU-0006JK-3E
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 15:33: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 1syvAU-0006W4-2R
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 15:33:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syvAU-0007jr-1O
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 15:33: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=3QFJGO+Upilnuy3CVIiKIkjfR/psDEuLNANOh6IQAco=; b=JtCky/fvmfj4omyseCzPQwj+4S
	QluG2xXvitcqq1pBHyLHQFRS8LqjqSQ7800PIDG9jp/bqLJWhpZcWvX5rSkogQaEnOB484sGSbTRy
	tzPKkl65fV0fL4fRCdYPpSnXJkVwKUPvLOkOTtwvG7tdMNMAjaEtdtPBMUWTh9DB5glA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] dt-overlay: Support target-path being root node
Message-Id: <E1syvAU-0007jr-1O@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 15:33:34 +0000

commit b32d24bcd6b79bb9de5b92dc69642d0c863f0765
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Oct 4 14:22:18 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Oct 10 16:18:56 2024 +0100

    dt-overlay: Support target-path being root node
    
    Even though in most cases device nodes are not present directly under
    the root node, it's a perfectly valid configuration (e.g. Qemu virt
    machine dtb). At the moment, we don't handle this scenario which leads
    to unconditional addition of extra leading '/' in the node full path.
    This makes the attempt to add such device overlay to fail.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/dt-overlay.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/xen/common/dt-overlay.c b/xen/common/dt-overlay.c
index d18bd12bd3..bfa1532509 100644
--- a/xen/common/dt-overlay.c
+++ b/xen/common/dt-overlay.c
@@ -325,6 +325,7 @@ static int overlay_get_nodes_info(const void *fdto, char **nodes_full_path)
             int node_name_len;
             unsigned int target_path_len = strlen(target_path);
             unsigned int node_full_name_len;
+            unsigned int extra_len;
 
             node_name = fdt_get_name(fdto, subnode, &node_name_len);
 
@@ -332,10 +333,13 @@ static int overlay_get_nodes_info(const void *fdto, char **nodes_full_path)
                 return node_name_len;
 
             /*
-             * Magic number 2 is for adding '/' and '\0'. This is done to keep
-             * the node_full_path in the correct full node name format.
+             * Extra length is for adding '/' and '\0' unless the target path is
+             * root in which case we don't add the '/' at the beginning. This is
+             * done to keep the node_full_path in the correct full node name
+             * format.
              */
-            node_full_name_len = target_path_len + node_name_len + 2;
+            extra_len = (target_path_len > 1) ? 2 : 1;
+            node_full_name_len = target_path_len + node_name_len + extra_len;
 
             nodes_full_path[node_num] = xmalloc_bytes(node_full_name_len);
 
@@ -344,9 +348,11 @@ static int overlay_get_nodes_info(const void *fdto, char **nodes_full_path)
 
             memcpy(nodes_full_path[node_num], target_path, target_path_len);
 
-            nodes_full_path[node_num][target_path_len] = '/';
+            /* Target is not root - add separator */
+            if ( target_path_len > 1 )
+                nodes_full_path[node_num][target_path_len++] = '/';
 
-            memcpy(nodes_full_path[node_num] + target_path_len + 1,
+            memcpy(nodes_full_path[node_num] + target_path_len,
                     node_name, node_name_len);
 
             nodes_full_path[node_num][node_full_name_len - 1] = '\0';
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 15:33:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 15:33:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816319.1230534 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syvAf-0006MJ-61; Thu, 10 Oct 2024 15:33:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816319.1230534; Thu, 10 Oct 2024 15:33: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 1syvAf-0006MC-3S; Thu, 10 Oct 2024 15:33:45 +0000
Received: by outflank-mailman (input) for mailman id 816319;
 Thu, 10 Oct 2024 15:33: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 1syvAe-0006M2-6T
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 15:33: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 1syvAe-0006WF-5k
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 15:33:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syvAe-0007kf-4X
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 15:33: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=LKNsqc2xgnN+ftT/KCQOUnwcdc6X1a69CN25uFRNvdk=; b=GcBhzidwqVZqqLEP5btqqx8rey
	NMfFnf6zx+YMh2TTuCIOazzLCOypFaDn8PuJCaQVrU+I8A+huLm2LzwHMTPdmGjtG7wbOa9szKtHu
	EeAUXuuX2kE7uDrliWkeCUYiFH1HYKoUeJPL+pbantgwPMbkAH6TfCfb+8ZoKk6AEF2Y=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] dt-overlay: Ignore nodes that do not have __overlay__ as their subnode
Message-Id: <E1syvAe-0007kf-4X@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 15:33:44 +0000

commit 239b0c8f065dfd044e88815875ec4e24f600ba76
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Oct 4 14:22:19 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Oct 10 16:18:56 2024 +0100

    dt-overlay: Ignore nodes that do not have __overlay__ as their subnode
    
    Assumption stated in the comments as if fdt_for_each_subnode() checks
    for parent < 0 is utterly wrong. If parent is < 0, node offset is set to
    0 (i.e. the very first node in the tree) and the loop's body is executed.
    This incorrect assumption causes overlay_node_count() to also count nodes
    that do not have __overlay__ as their subnode. The same story goes for
    overlay_get_nodes_info(), where we end up requiring each node directly
    under root node to have "target-path" set. DTBOs can specify other nodes
    including special ones like __symbols__, __fixups__ that can be left to
    reduce the number of steps a user needs to do to when it comes to invalid
    phandles.
    
    Fix it by adding checks if overlay < 0 after respective calls to
    fdt_subnode_offset().
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/dt-overlay.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/xen/common/dt-overlay.c b/xen/common/dt-overlay.c
index bfa1532509..4d75b5b36a 100644
--- a/xen/common/dt-overlay.c
+++ b/xen/common/dt-overlay.c
@@ -274,11 +274,9 @@ static unsigned int overlay_node_count(const void *overlay_fdt)
         int overlay;
 
         overlay = fdt_subnode_offset(overlay_fdt, fragment, "__overlay__");
+        if ( overlay < 0 )
+            continue;
 
-        /*
-         * overlay value can be < 0. But fdt_for_each_subnode() loop checks for
-         * overlay >= 0. So, no need for a overlay>=0 check here.
-         */
         fdt_for_each_subnode(subnode, overlay_fdt, overlay)
         {
             num_overlay_nodes++;
@@ -305,6 +303,10 @@ static int overlay_get_nodes_info(const void *fdto, char **nodes_full_path)
         int subnode;
         const char *target_path;
 
+        overlay = fdt_subnode_offset(fdto, fragment, "__overlay__");
+        if ( overlay < 0 )
+            continue;
+
         target = fdt_overlay_target_offset(device_tree_flattened, fdto,
                                            fragment, &target_path);
         if ( target < 0 )
@@ -313,12 +315,6 @@ static int overlay_get_nodes_info(const void *fdto, char **nodes_full_path)
         if ( target_path == NULL )
             return -EINVAL;
 
-        overlay = fdt_subnode_offset(fdto, fragment, "__overlay__");
-
-        /*
-         * overlay value can be < 0. But fdt_for_each_subnode() loop checks for
-         * overlay >= 0. So, no need for a overlay>=0 check here.
-         */
         fdt_for_each_subnode(subnode, fdto, overlay)
         {
             const char *node_name = NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 10 15:33:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 10 Oct 2024 15:33:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816320.1230537 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1syvAp-0006Ot-7O; Thu, 10 Oct 2024 15:33:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816320.1230537; Thu, 10 Oct 2024 15:33: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 1syvAp-0006Om-50; Thu, 10 Oct 2024 15:33:55 +0000
Received: by outflank-mailman (input) for mailman id 816320;
 Thu, 10 Oct 2024 15:33: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 1syvAo-0006Oe-9N
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 15:33: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 1syvAo-0006Wh-8d
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 15:33:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1syvAo-0007lJ-7s
 for xen-changelog@lists.xenproject.org; Thu, 10 Oct 2024 15:33: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=0ITLL1PoWpD02GoY2nmEy2tnAn5irlvuB9zhBo+Nfvo=; b=ugodNOdBAlrDmZ7D7rOifbOO5Y
	UlQI6u3YelwafS5dBiGVY/xjPHhg3TW3BlFexxHIPy6RUq42bQalmRjojZ+ob7OqCaCDeQWREZ4ro
	evQOi5sl4R4vDWhN+LCecru5v/Uum7jAUTv6VHe23USyTQ108DYxfND9WvaoTKyIc1WA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] dt-overlay: Print overlay I/O memory ranges in hex
Message-Id: <E1syvAo-0007lJ-7s@xenbits.xenproject.org>
Date: Thu, 10 Oct 2024 15:33:54 +0000

commit b2c7d7070dd0b311b64598411f52cdfa2a882ea2
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Oct 4 14:22:20 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Oct 10 16:18:56 2024 +0100

    dt-overlay: Print overlay I/O memory ranges in hex
    
    Printing I/O memory rangeset ranges in decimal is not very helpful when
    debugging, so switch to hex by adding RANGESETF_prettyprint_hex flag
    for iomem_ranges rangeset.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/dt-overlay.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/dt-overlay.c b/xen/common/dt-overlay.c
index 4d75b5b36a..5ce00514ef 100644
--- a/xen/common/dt-overlay.c
+++ b/xen/common/dt-overlay.c
@@ -869,7 +869,8 @@ static long handle_attach_overlay_nodes(struct domain *d,
         goto out;
     }
 
-    entry->iomem_ranges = rangeset_new(d, "Overlay: I/O Memory", 0);
+    entry->iomem_ranges = rangeset_new(d, "Overlay: I/O Memory",
+                                       RANGESETF_prettyprint_hex);
     if (entry->iomem_ranges == NULL)
     {
         rc = -ENOMEM;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 06:33:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 06:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816637.1230761 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sz9Cy-0001Zj-B4; Fri, 11 Oct 2024 06:33:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816637.1230761; Fri, 11 Oct 2024 06: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 1sz9Cy-0001Zb-8X; Fri, 11 Oct 2024 06:33:04 +0000
Received: by outflank-mailman (input) for mailman id 816637;
 Fri, 11 Oct 2024 06: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 1sz9Cw-0001ZV-Nt
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06: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 1sz9Cw-00084X-HQ
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sz9Cw-00068J-Dq
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:33:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=g37W5GRU3sOcZcp+A93w70EKTt+hcNHY3dQwKGQs2sQ=; b=wiilFhfjz7HDnsKkt7OpFR79gH
	wBRSjPKAB/nL8D3UOrw/BChCk/YpbOsbvM+D2Az01jXNJovxG81vdZuROIMCEbBKoIIjlcfKWo+Mb
	4LrmXHv/UDR/SUoWOiHeuN6RC8sOguEXMXLjR+PzUCv26YnAMezHC7Lm1OjOUQAv6n5U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: Update header guards - Intel TXT
Message-Id: <E1sz9Cw-00068J-Dq@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 06:33:02 +0000

commit 964c9568eaa58f621384f58e0d275f3b060d781d
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Wed Oct 9 09:53:05 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 9 09:53:05 2024 +0200

    xen: Update header guards - Intel TXT
    
    Update the header related to Intel trusted execution technology.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/tboot.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/tboot.h b/xen/arch/x86/include/asm/tboot.h
index 818d5fa451..15479fe80e 100644
--- a/xen/arch/x86/include/asm/tboot.h
+++ b/xen/arch/x86/include/asm/tboot.h
@@ -34,8 +34,8 @@
  *
  */
 
-#ifndef __TBOOT_H__
-#define __TBOOT_H__
+#ifndef ASM__X86__TBOOT_H
+#define ASM__X86__TBOOT_H
 
 #include <xen/acpi.h>
 
@@ -147,7 +147,7 @@ static inline int tboot_wake_ap(int apicid, unsigned long sipi_vec)
 }
 #endif /* CONFIG_TBOOT */
 
-#endif /* __TBOOT_H__ */
+#endif /* ASM__X86__TBOOT_H */
 
 /*
  * Local variables:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 06:33:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 06:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816638.1230766 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sz9D7-0001b8-CY; Fri, 11 Oct 2024 06:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816638.1230766; Fri, 11 Oct 2024 06: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 1sz9D7-0001b0-9r; Fri, 11 Oct 2024 06:33:13 +0000
Received: by outflank-mailman (input) for mailman id 816638;
 Fri, 11 Oct 2024 06: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 1sz9D6-0001au-LR
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06: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 1sz9D6-00084u-Kh
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sz9D6-00069G-Jj
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06: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=SHYgNFNE4x5Mbbb+5cb36lXU7QIsZYwMGjleEbZau7U=; b=Jou9Kv6Sp4YGExZkFTnKgff+Kt
	F6xLXLmLGVhUTIBjOfcEmb8cf/O/BmeuLXl1oo9UITQyQ5yrR3vtIBrenJ5McOqZvY/yTZkCSHSnJ
	5CQCPJ4p81ldkFST1FeENCym440s9e9qMTR6OFrfVSsM9BUdFDlspg31HkrfXJFRyOjU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: Update header guards - I/O MMU
Message-Id: <E1sz9D6-00069G-Jj@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 06:33:12 +0000

commit 6bbcb97ba45ecdcac9d7359fdecf298bc4c1be1c
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Wed Oct 9 09:53:25 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 9 09:53:25 2024 +0200

    xen: Update header guards - I/O MMU
    
    Update headers related to I/O MMU.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/amd/iommu-defs.h | 6 +++---
 xen/drivers/passthrough/amd/iommu.h      | 6 +++---
 xen/drivers/passthrough/ats.h            | 6 +++---
 xen/drivers/passthrough/vtd/dmar.h       | 6 +++---
 xen/drivers/passthrough/vtd/extern.h     | 6 +++---
 xen/drivers/passthrough/vtd/iommu.h      | 4 ++--
 xen/drivers/passthrough/vtd/vtd.h        | 6 +++---
 xen/include/xen/iommu.h                  | 6 +++---
 8 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu-defs.h b/xen/drivers/passthrough/amd/iommu-defs.h
index c145248f9a..30b094f187 100644
--- a/xen/drivers/passthrough/amd/iommu-defs.h
+++ b/xen/drivers/passthrough/amd/iommu-defs.h
@@ -17,8 +17,8 @@
  * along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef AMD_IOMMU_DEFS_H
-#define AMD_IOMMU_DEFS_H
+#ifndef DRIVERS__PASSTHROUGH__AMD__IOMMU_DEFS_H
+#define DRIVERS__PASSTHROUGH__AMD__IOMMU_DEFS_H
 
 /* IOMMU Event Log entries: in power of 2 increments, minimum of 256 */
 #define IOMMU_EVENT_LOG_DEFAULT_ENTRIES     512
@@ -486,7 +486,7 @@ union amd_iommu_pte {
 #define IOMMU_REG_BASE_ADDR_HIGH_MASK               0x000FFFFFU
 #define IOMMU_REG_BASE_ADDR_HIGH_SHIFT              0
 
-#endif /* AMD_IOMMU_DEFS_H */
+#endif /* DRIVERS__PASSTHROUGH__AMD__IOMMU_DEFS_H */
 
 /*
  * Local variables:
diff --git a/xen/drivers/passthrough/amd/iommu.h b/xen/drivers/passthrough/amd/iommu.h
index 8d6f63d87f..c32e9e9a16 100644
--- a/xen/drivers/passthrough/amd/iommu.h
+++ b/xen/drivers/passthrough/amd/iommu.h
@@ -16,8 +16,8 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
-#ifndef AMD_IOMMU_H
-#define AMD_IOMMU_H
+#ifndef DRIVERS__PASSTHROUGH__AMD__IOMMU_H
+#define DRIVERS__PASSTHROUGH__AMD__IOMMU_H
 
 #include <xen/init.h>
 #include <xen/types.h>
@@ -372,4 +372,4 @@ static inline void iommu_set_addr_hi_to_reg(uint32_t *reg, uint32_t addr)
                          IOMMU_REG_BASE_ADDR_HIGH_SHIFT, reg);
 }
 
-#endif /* AMD_IOMMU_H */
+#endif /* DRIVERS__PASSTHROUGH__AMD__IOMMU_H */
diff --git a/xen/drivers/passthrough/ats.h b/xen/drivers/passthrough/ats.h
index f5e1d254e0..68b1c600eb 100644
--- a/xen/drivers/passthrough/ats.h
+++ b/xen/drivers/passthrough/ats.h
@@ -12,8 +12,8 @@
  * this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _ATS_H_
-#define _ATS_H_
+#ifndef DRIVERS__PASSTHROUGH__ATS_H
+#define DRIVERS__PASSTHROUGH__ATS_H
 
 #include <xen/pci_regs.h>
 
@@ -50,5 +50,5 @@ static inline int pci_ats_device(int seg, int bus, int devfn)
                                    PCI_EXT_CAP_ID_ATS);
 }
 
-#endif /* _ATS_H_ */
+#endif /* DRIVERS__PASSTHROUGH__ATS_H */
 
diff --git a/xen/drivers/passthrough/vtd/dmar.h b/xen/drivers/passthrough/vtd/dmar.h
index 61f71ca5e6..0ff4f36535 100644
--- a/xen/drivers/passthrough/vtd/dmar.h
+++ b/xen/drivers/passthrough/vtd/dmar.h
@@ -17,8 +17,8 @@
  * Copyright (C) Shaohua Li <shaohua.li@intel.com>
  */
 
-#ifndef _DMAR_H_
-#define _DMAR_H_
+#ifndef DRIVERS__PASSTHROUGH__VTD__DMAR_H
+#define DRIVERS__PASSTHROUGH__VTD__DMAR_H
 
 #include <xen/list.h>
 #include <xen/iommu.h>
@@ -171,4 +171,4 @@ int vtd_hw_check(void);
 void disable_pmr(struct vtd_iommu *iommu);
 int is_igd_drhd(struct acpi_drhd_unit *drhd);
 
-#endif /* _DMAR_H_ */
+#endif /* DRIVERS__PASSTHROUGH__VTD__DMAR_H */
diff --git a/xen/drivers/passthrough/vtd/extern.h b/xen/drivers/passthrough/vtd/extern.h
index 667590ee52..c16583c951 100644
--- a/xen/drivers/passthrough/vtd/extern.h
+++ b/xen/drivers/passthrough/vtd/extern.h
@@ -17,8 +17,8 @@
  * Copyright (C) Weidong Han <weidong.han@intel.com>
  */
 
-#ifndef _VTD_EXTERN_H_
-#define _VTD_EXTERN_H_
+#ifndef DRIVERS__PASSTHROUGH__VTD__EXTERN_H
+#define DRIVERS__PASSTHROUGH__VTD__EXTERN_H
 
 #include "dmar.h"
 #include <xen/keyhandler.h>
@@ -114,4 +114,4 @@ void quirk_iommu_caps(struct vtd_iommu *iommu);
 bool platform_supports_intremap(void);
 bool platform_supports_x2apic(void);
 
-#endif // _VTD_EXTERN_H_
+#endif // DRIVERS__PASSTHROUGH__VTD__EXTERN_H
diff --git a/xen/drivers/passthrough/vtd/iommu.h b/xen/drivers/passthrough/vtd/iommu.h
index 78aa8a96f5..29d350b23d 100644
--- a/xen/drivers/passthrough/vtd/iommu.h
+++ b/xen/drivers/passthrough/vtd/iommu.h
@@ -16,8 +16,8 @@
  * Copyright (C) Ashok Raj <ashok.raj@intel.com>
  */
 
-#ifndef _INTEL_IOMMU_H_
-#define _INTEL_IOMMU_H_
+#ifndef DRIVERS__PASSTHROUGH__VTD__IOMMU_H
+#define DRIVERS__PASSTHROUGH__VTD__IOMMU_H
 
 #include <xen/iommu.h>
 #include <asm/msi.h>
diff --git a/xen/drivers/passthrough/vtd/vtd.h b/xen/drivers/passthrough/vtd/vtd.h
index cb2df76eed..8aeff8c1f2 100644
--- a/xen/drivers/passthrough/vtd/vtd.h
+++ b/xen/drivers/passthrough/vtd/vtd.h
@@ -17,8 +17,8 @@
  * Copyright (C) Weidong Han <weidong.han@intel.com>
  */
 
-#ifndef _VTD_H_
-#define _VTD_H_
+#ifndef DRIVERS__PASSTHROUGH__VTD__VTD_H
+#define DRIVERS__PASSTHROUGH__VTD__VTD_H
 
 #include <xen/iommu.h>
 
@@ -72,4 +72,4 @@ struct msi_msg_remap_entry {
     u32	data;		/* msi message data */
 };
 
-#endif // _VTD_H_
+#endif // DRIVERS__PASSTHROUGH__VTD__VTD_H
diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h
index 442ae5322d..b928c67e19 100644
--- a/xen/include/xen/iommu.h
+++ b/xen/include/xen/iommu.h
@@ -16,8 +16,8 @@
  * Copyright (C) Allen Kay <allen.m.kay@intel.com>
  */
 
-#ifndef _IOMMU_H_
-#define _IOMMU_H_
+#ifndef XEN__IOMMU_H
+#define XEN__IOMMU_H
 
 #include <xen/mm-frame.h>
 #include <xen/init.h>
@@ -440,7 +440,7 @@ static inline int iommu_update_ire_from_msi(
 }
 #endif
 
-#endif /* _IOMMU_H_ */
+#endif /* XEN__IOMMU_H */
 
 /*
  * Local variables:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 06:33:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 06:33:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816639.1230769 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sz9DI-0001dk-Dx; Fri, 11 Oct 2024 06:33:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816639.1230769; Fri, 11 Oct 2024 06:33:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sz9DI-0001dd-BL; Fri, 11 Oct 2024 06:33:24 +0000
Received: by outflank-mailman (input) for mailman id 816639;
 Fri, 11 Oct 2024 06: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 1sz9DG-0001dJ-PP
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06: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 1sz9DG-00085A-OZ
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sz9DG-0006AN-NC
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06: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=dPR6Ft2fm8cs3XVmdikaSw2rAqSjkCLu/W3zU0v5clw=; b=qERl9RrLdDqyR9uNyOySYifgDk
	JHdR6RuKGCYjdOzjS6cN8gKKQxmyHnlCRNdpaZLRrG08O+eUto+ECyVheeK8ZHGKqfGr6g/rYiPkk
	yNgOq/ycp40n0c1R0kpeoVjBfBpLaTZ0RvnJrHBTiHHT7pC/VmXVaHb2R4JehiBJR200=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: Update header guards - RISC-V
Message-Id: <E1sz9DG-0006AN-NC@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 06:33:22 +0000

commit b3152931302c9415eecd4f5bc4236bbfee9194a6
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Wed Oct 9 09:53:49 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 9 09:53:49 2024 +0200

    xen: Update header guards - RISC-V
    
    Update headers related to RISC-V.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/acpi.h           | 6 +++---
 xen/arch/riscv/include/asm/asm.h            | 6 +++---
 xen/arch/riscv/include/asm/atomic.h         | 6 +++---
 xen/arch/riscv/include/asm/bitops.h         | 6 +++---
 xen/arch/riscv/include/asm/bug.h            | 6 +++---
 xen/arch/riscv/include/asm/byteorder.h      | 6 +++---
 xen/arch/riscv/include/asm/cache.h          | 6 +++---
 xen/arch/riscv/include/asm/cmpxchg.h        | 6 +++---
 xen/arch/riscv/include/asm/config.h         | 6 +++---
 xen/arch/riscv/include/asm/cpufeature.h     | 6 +++---
 xen/arch/riscv/include/asm/csr.h            | 6 +++---
 xen/arch/riscv/include/asm/current.h        | 6 +++---
 xen/arch/riscv/include/asm/domain.h         | 6 +++---
 xen/arch/riscv/include/asm/early_printk.h   | 6 +++---
 xen/arch/riscv/include/asm/event.h          | 6 +++---
 xen/arch/riscv/include/asm/fence.h          | 6 +++---
 xen/arch/riscv/include/asm/fixmap.h         | 6 +++---
 xen/arch/riscv/include/asm/flushtlb.h       | 6 +++---
 xen/arch/riscv/include/asm/guest_access.h   | 6 +++---
 xen/arch/riscv/include/asm/guest_atomics.h  | 6 +++---
 xen/arch/riscv/include/asm/io.h             | 6 +++---
 xen/arch/riscv/include/asm/irq.h            | 6 +++---
 xen/arch/riscv/include/asm/mm.h             | 6 +++---
 xen/arch/riscv/include/asm/monitor.h        | 6 +++---
 xen/arch/riscv/include/asm/nospec.h         | 6 +++---
 xen/arch/riscv/include/asm/p2m.h            | 6 +++---
 xen/arch/riscv/include/asm/page-bits.h      | 6 +++---
 xen/arch/riscv/include/asm/page.h           | 6 +++---
 xen/arch/riscv/include/asm/pmap.h           | 6 +++---
 xen/arch/riscv/include/asm/processor.h      | 6 +++---
 xen/arch/riscv/include/asm/regs.h           | 6 +++---
 xen/arch/riscv/include/asm/riscv_encoding.h | 4 ++--
 xen/arch/riscv/include/asm/sbi.h            | 6 +++---
 xen/arch/riscv/include/asm/setup.h          | 6 +++---
 xen/arch/riscv/include/asm/smp.h            | 4 ++--
 xen/arch/riscv/include/asm/spinlock.h       | 6 +++---
 xen/arch/riscv/include/asm/string.h         | 6 +++---
 xen/arch/riscv/include/asm/system.h         | 6 +++---
 xen/arch/riscv/include/asm/time.h           | 6 +++---
 xen/arch/riscv/include/asm/traps.h          | 6 +++---
 xen/arch/riscv/include/asm/types.h          | 6 +++---
 41 files changed, 121 insertions(+), 121 deletions(-)

diff --git a/xen/arch/riscv/include/asm/acpi.h b/xen/arch/riscv/include/asm/acpi.h
index 3aef993d81..f0b5e90969 100644
--- a/xen/arch/riscv/include/asm/acpi.h
+++ b/xen/arch/riscv/include/asm/acpi.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 
-#ifndef __ASM_RISCV_ACPI_H
-#define __ASM_RISCV_ACPI_H
+#ifndef ASM__RISCV__ACPI_H
+#define ASM__RISCV__ACPI_H
 
-#endif /* __ASM_RISCV_ACPI_H */
+#endif /* ASM__RISCV__ACPI_H */
diff --git a/xen/arch/riscv/include/asm/asm.h b/xen/arch/riscv/include/asm/asm.h
index 87a3fd250b..8b0403e2e4 100644
--- a/xen/arch/riscv/include/asm/asm.h
+++ b/xen/arch/riscv/include/asm/asm.h
@@ -3,8 +3,8 @@
  * Copyright (C) 2015 Regents of the University of California
  */
 
-#ifndef _ASM_RISCV_ASM_H
-#define _ASM_RISCV_ASM_H
+#ifndef ASM__RISCV__ASM_H
+#define ASM__RISCV__ASM_H
 
 #ifdef __ASSEMBLY__
 #include <xen/linkage.h>
@@ -52,4 +52,4 @@
 #error "Unexpected __SIZEOF_SHORT__"
 #endif
 
-#endif /* _ASM_RISCV_ASM_H */
+#endif /* ASM__RISCV__ASM_H */
diff --git a/xen/arch/riscv/include/asm/atomic.h b/xen/arch/riscv/include/asm/atomic.h
index 9669a3286d..8e0425cea0 100644
--- a/xen/arch/riscv/include/asm/atomic.h
+++ b/xen/arch/riscv/include/asm/atomic.h
@@ -19,8 +19,8 @@
  * Copyright (C) 2024 Vates SAS
  */
 
-#ifndef _ASM_RISCV_ATOMIC_H
-#define _ASM_RISCV_ATOMIC_H
+#ifndef ASM__RISCV__ATOMIC_H
+#define ASM__RISCV__ATOMIC_H
 
 #include <xen/atomic.h>
 
@@ -266,7 +266,7 @@ ATOMIC_OPS()
 #undef ATOMIC_OPS
 #undef ATOMIC_OP
 
-#endif /* _ASM_RISCV_ATOMIC_H */
+#endif /* ASM__RISCV__ATOMIC_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/bitops.h b/xen/arch/riscv/include/asm/bitops.h
index 7f7af3fda1..9a6f576187 100644
--- a/xen/arch/riscv/include/asm/bitops.h
+++ b/xen/arch/riscv/include/asm/bitops.h
@@ -1,8 +1,8 @@
 /* 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
+#ifndef ASM__RISCV__BITOPS_H
+#define ASM__RISCV__BITOPS_H
 
 #include <asm/system.h>
 
@@ -125,7 +125,7 @@ static inline void clear_bit(int nr, volatile void *p)
 #undef NOT
 #undef __AMO
 
-#endif /* _ASM_RISCV_BITOPS_H */
+#endif /* ASM__RISCV__BITOPS_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/bug.h b/xen/arch/riscv/include/asm/bug.h
index e3d41f411a..fa18dba20e 100644
--- a/xen/arch/riscv/include/asm/bug.h
+++ b/xen/arch/riscv/include/asm/bug.h
@@ -4,8 +4,8 @@
  * Copyright (C) 2021-2023 Vates
  *
  */
-#ifndef _ASM_RISCV_BUG_H
-#define _ASM_RISCV_BUG_H
+#ifndef ASM__RISCV__BUG_H
+#define ASM__RISCV__BUG_H
 
 #ifndef __ASSEMBLY__
 
@@ -32,4 +32,4 @@
 
 #endif /* !__ASSEMBLY__ */
 
-#endif /* _ASM_RISCV_BUG_H */
+#endif /* ASM__RISCV__BUG_H */
diff --git a/xen/arch/riscv/include/asm/byteorder.h b/xen/arch/riscv/include/asm/byteorder.h
index 320a03c88f..8ca65e1b33 100644
--- a/xen/arch/riscv/include/asm/byteorder.h
+++ b/xen/arch/riscv/include/asm/byteorder.h
@@ -1,11 +1,11 @@
-#ifndef __ASM_RISCV_BYTEORDER_H__
-#define __ASM_RISCV_BYTEORDER_H__
+#ifndef ASM__RISCV__BYTEORDER_H
+#define ASM__RISCV__BYTEORDER_H
 
 #define __BYTEORDER_HAS_U64__
 
 #include <xen/byteorder/little_endian.h>
 
-#endif /* __ASM_RISCV_BYTEORDER_H__ */
+#endif /* ASM__RISCV__BYTEORDER_H */
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/riscv/include/asm/cache.h b/xen/arch/riscv/include/asm/cache.h
index 69573eb051..9a9e5162ab 100644
--- a/xen/arch/riscv/include/asm/cache.h
+++ b/xen/arch/riscv/include/asm/cache.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 
-#ifndef _ASM_RISCV_CACHE_H
-#define _ASM_RISCV_CACHE_H
+#ifndef ASM__RISCV__CACHE_H
+#define ASM__RISCV__CACHE_H
 
-#endif /* _ASM_RISCV_CACHE_H */
+#endif /* ASM__RISCV__CACHE_H */
diff --git a/xen/arch/riscv/include/asm/cmpxchg.h b/xen/arch/riscv/include/asm/cmpxchg.h
index 47d5299e62..662d3fd5d4 100644
--- a/xen/arch/riscv/include/asm/cmpxchg.h
+++ b/xen/arch/riscv/include/asm/cmpxchg.h
@@ -1,8 +1,8 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /* Copyright (C) 2014 Regents of the University of California */
 
-#ifndef _ASM_RISCV_CMPXCHG_H
-#define _ASM_RISCV_CMPXCHG_H
+#ifndef ASM__RISCV__CMPXCHG_H
+#define ASM__RISCV__CMPXCHG_H
 
 #include <xen/compiler.h>
 #include <xen/lib.h>
@@ -242,7 +242,7 @@ static always_inline unsigned long __cmpxchg(volatile void *ptr,
               sizeof(*(ptr))); \
 })
 
-#endif /* _ASM_RISCV_CMPXCHG_H */
+#endif /* ASM__RISCV__CMPXCHG_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/config.h b/xen/arch/riscv/include/asm/config.h
index 7dbb235685..ef68281653 100644
--- a/xen/arch/riscv/include/asm/config.h
+++ b/xen/arch/riscv/include/asm/config.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
-#ifndef __RISCV_CONFIG_H__
-#define __RISCV_CONFIG_H__
+#ifndef ASM__RISCV__CONFIG_H
+#define ASM__RISCV__CONFIG_H
 
 #include <xen/const.h>
 #include <xen/page-size.h>
@@ -155,7 +155,7 @@
 
 #define IDENT_AREA_SIZE 64
 
-#endif /* __RISCV_CONFIG_H__ */
+#endif /* ASM__RISCV__CONFIG_H */
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/riscv/include/asm/cpufeature.h b/xen/arch/riscv/include/asm/cpufeature.h
index c08b7d67ad..41a792b0b2 100644
--- a/xen/arch/riscv/include/asm/cpufeature.h
+++ b/xen/arch/riscv/include/asm/cpufeature.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_RISCV_CPUFEATURE_H
-#define __ASM_RISCV_CPUFEATURE_H
+#ifndef ASM__RISCV__CPUFEATURE_H
+#define ASM__RISCV__CPUFEATURE_H
 
 #ifndef __ASSEMBLY__
 
@@ -11,7 +11,7 @@ static inline unsigned int cpu_nr_siblings(unsigned int cpu)
 
 #endif /* __ASSEMBLY__ */
 
-#endif /* __ASM_RISCV_CPUFEATURE_H */
+#endif /* ASM__RISCV__CPUFEATURE_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/csr.h b/xen/arch/riscv/include/asm/csr.h
index be57dcce1c..775f1f170f 100644
--- a/xen/arch/riscv/include/asm/csr.h
+++ b/xen/arch/riscv/include/asm/csr.h
@@ -3,8 +3,8 @@
  * Copyright (C) 2015 Regents of the University of California
  */
 
-#ifndef _ASM_RISCV_CSR_H
-#define _ASM_RISCV_CSR_H
+#ifndef ASM__RISCV__CSR_H
+#define ASM__RISCV__CSR_H
 
 #include <asm/asm.h>
 #include <xen/const.h>
@@ -80,4 +80,4 @@
 
 #endif /* __ASSEMBLY__ */
 
-#endif /* _ASM_RISCV_CSR_H */
+#endif /* ASM__RISCV__CSR_H */
diff --git a/xen/arch/riscv/include/asm/current.h b/xen/arch/riscv/include/asm/current.h
index 6f1ec4e190..1485bceea4 100644
--- a/xen/arch/riscv/include/asm/current.h
+++ b/xen/arch/riscv/include/asm/current.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
-#ifndef __ASM_CURRENT_H
-#define __ASM_CURRENT_H
+#ifndef ASM__RISCV__CURRENT_H
+#define ASM__RISCV__CURRENT_H
 
 #include <xen/bug.h>
 #include <xen/cache.h>
@@ -54,4 +54,4 @@ DECLARE_PER_CPU(struct vcpu *, curr_vcpu);
 
 #endif /* __ASSEMBLY__ */
 
-#endif /* __ASM_CURRENT_H */
+#endif /* ASM__RISCV__CURRENT_H */
diff --git a/xen/arch/riscv/include/asm/domain.h b/xen/arch/riscv/include/asm/domain.h
index 027bfa8a93..c3d965a559 100644
--- a/xen/arch/riscv/include/asm/domain.h
+++ b/xen/arch/riscv/include/asm/domain.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_RISCV_DOMAIN_H__
-#define __ASM_RISCV_DOMAIN_H__
+#ifndef ASM__RISCV__DOMAIN_H
+#define ASM__RISCV__DOMAIN_H
 
 #include <xen/xmalloc.h>
 #include <public/hvm/params.h>
@@ -39,7 +39,7 @@ static inline void update_guest_memory_policy(struct vcpu *v,
 
 static inline void arch_vcpu_block(struct vcpu *v) {}
 
-#endif /* __ASM_RISCV_DOMAIN_H__ */
+#endif /* ASM__RISCV__DOMAIN_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/early_printk.h b/xen/arch/riscv/include/asm/early_printk.h
index 85e60df33a..2750045bdd 100644
--- a/xen/arch/riscv/include/asm/early_printk.h
+++ b/xen/arch/riscv/include/asm/early_printk.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
-#ifndef __EARLY_PRINTK_H__
-#define __EARLY_PRINTK_H__
+#ifndef ASM__RISCV__EARLY_PRINTK_H
+#define ASM__RISCV__EARLY_PRINTK_H
 
 #include <xen/early_printk.h>
 
@@ -11,4 +11,4 @@ void early_printk(const char *str);
 static inline void early_printk(const char *s) {};
 #endif
 
-#endif /* __EARLY_PRINTK_H__ */
+#endif /* ASM__RISCV__EARLY_PRINTK_H */
diff --git a/xen/arch/riscv/include/asm/event.h b/xen/arch/riscv/include/asm/event.h
index fbad8543fa..c7bb8c0fa6 100644
--- a/xen/arch/riscv/include/asm/event.h
+++ b/xen/arch/riscv/include/asm/event.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_RISCV_EVENT_H__
-#define __ASM_RISCV_EVENT_H__
+#ifndef ASM__RISCV__EVENT_H
+#define ASM__RISCV__EVENT_H
 
 #include <xen/lib.h>
 
@@ -29,7 +29,7 @@ static inline bool arch_virq_is_global(unsigned int virq)
     return true;
 }
 
-#endif /* __ASM_RISCV_EVENT_H__ */
+#endif /* ASM__RISCV__EVENT_H */
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/riscv/include/asm/fence.h b/xen/arch/riscv/include/asm/fence.h
index 27f46fa897..edfaac49cd 100644
--- a/xen/arch/riscv/include/asm/fence.h
+++ b/xen/arch/riscv/include/asm/fence.h
@@ -1,9 +1,9 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later */
-#ifndef _ASM_RISCV_FENCE_H
-#define _ASM_RISCV_FENCE_H
+#ifndef ASM__RISCV__FENCE_H
+#define ASM__RISCV__FENCE_H
 
 #define RISCV_ACQUIRE_BARRIER   "\tfence r , rw\n"
 #define RISCV_RELEASE_BARRIER   "\tfence rw, w\n"
 #define RISCV_FULL_BARRIER      "\tfence rw, rw\n"
 
-#endif	/* _ASM_RISCV_FENCE_H */
+#endif	/* ASM__RISCV__FENCE_H */
diff --git a/xen/arch/riscv/include/asm/fixmap.h b/xen/arch/riscv/include/asm/fixmap.h
index 63732df36c..818c8ce07b 100644
--- a/xen/arch/riscv/include/asm/fixmap.h
+++ b/xen/arch/riscv/include/asm/fixmap.h
@@ -2,8 +2,8 @@
 /*
  * fixmap.h: compile-time virtual memory allocation
  */
-#ifndef ASM_FIXMAP_H
-#define ASM_FIXMAP_H
+#ifndef ASM__RISCV__FIXMAP_H
+#define ASM__RISCV__FIXMAP_H
 
 #include <xen/bug.h>
 #include <xen/page-size.h>
@@ -43,4 +43,4 @@ static inline unsigned int virt_to_fix(vaddr_t vaddr)
 
 #endif /* __ASSEMBLY__ */
 
-#endif /* ASM_FIXMAP_H */
+#endif /* ASM__RISCV__FIXMAP_H */
diff --git a/xen/arch/riscv/include/asm/flushtlb.h b/xen/arch/riscv/include/asm/flushtlb.h
index 43214f5e95..51c8f753c5 100644
--- a/xen/arch/riscv/include/asm/flushtlb.h
+++ b/xen/arch/riscv/include/asm/flushtlb.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_RISCV_FLUSHTLB_H__
-#define __ASM_RISCV_FLUSHTLB_H__
+#ifndef ASM__RISCV__FLUSHTLB_H
+#define ASM__RISCV__FLUSHTLB_H
 
 #include <xen/bug.h>
 #include <xen/cpumask.h>
@@ -37,7 +37,7 @@ static inline void page_set_tlbflush_timestamp(struct page_info *page)
 /* Flush specified CPUs' TLBs */
 void arch_flush_tlb_mask(const cpumask_t *mask);
 
-#endif /* __ASM_RISCV_FLUSHTLB_H__ */
+#endif /* ASM__RISCV__FLUSHTLB_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/guest_access.h b/xen/arch/riscv/include/asm/guest_access.h
index c55951f538..7cd51fbbde 100644
--- a/xen/arch/riscv/include/asm/guest_access.h
+++ b/xen/arch/riscv/include/asm/guest_access.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_RISCV_GUEST_ACCESS_H__
-#define __ASM_RISCV_GUEST_ACCESS_H__
+#ifndef ASM__RISCV__GUEST_ACCESS_H
+#define ASM__RISCV__GUEST_ACCESS_H
 
 unsigned long raw_copy_to_guest(void *to, const void *from, unsigned len);
 unsigned long raw_copy_from_guest(void *to, const void *from, unsigned len);
@@ -18,7 +18,7 @@ unsigned long raw_clear_guest(void *to, unsigned int len);
 #define guest_handle_okay(hnd, nr) (1)
 #define guest_handle_subrange_okay(hnd, first, last) (1)
 
-#endif /* __ASM_RISCV_GUEST_ACCESS_H__ */
+#endif /* ASM__RISCV__GUEST_ACCESS_H */
 /*
  * Local variables:
  * mode: C
diff --git a/xen/arch/riscv/include/asm/guest_atomics.h b/xen/arch/riscv/include/asm/guest_atomics.h
index de54914454..22a7551804 100644
--- a/xen/arch/riscv/include/asm/guest_atomics.h
+++ b/xen/arch/riscv/include/asm/guest_atomics.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_RISCV_GUEST_ATOMICS_H
-#define __ASM_RISCV_GUEST_ATOMICS_H
+#ifndef ASM__RISCV__GUEST_ATOMICS_H
+#define ASM__RISCV__GUEST_ATOMICS_H
 
 #include <xen/bug.h>
 
@@ -32,7 +32,7 @@ guest_testop(test_and_change_bit)
 
 #define guest_test_bit(d, nr, p) ((void)(d), test_bit(nr, p))
 
-#endif /* __ASM_RISCV_GUEST_ATOMICS_H */
+#endif /* ASM__RISCV__GUEST_ATOMICS_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/io.h b/xen/arch/riscv/include/asm/io.h
index 8d9535e973..55f329dde3 100644
--- a/xen/arch/riscv/include/asm/io.h
+++ b/xen/arch/riscv/include/asm/io.h
@@ -35,8 +35,8 @@
  * Copyright (C) 2024 Vates
  */
 
-#ifndef _ASM_RISCV_IO_H
-#define _ASM_RISCV_IO_H
+#ifndef ASM__RISCV__IO_H
+#define ASM__RISCV__IO_H
 
 #include <asm/byteorder.h>
 
@@ -156,7 +156,7 @@ static inline uint64_t __raw_readq(const volatile void __iomem *addr)
 #define writel(v, c)    ({ __io_bw(); writel_cpu(v, c); __io_aw(); })
 #define writeq(v, c)    ({ __io_bw(); writeq_cpu(v, c); __io_aw(); })
 
-#endif /* _ASM_RISCV_IO_H */
+#endif /* ASM__RISCV__IO_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/irq.h b/xen/arch/riscv/include/asm/irq.h
index 0dfd4d6e8a..2a48da2651 100644
--- a/xen/arch/riscv/include/asm/irq.h
+++ b/xen/arch/riscv/include/asm/irq.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_RISCV_IRQ_H__
-#define __ASM_RISCV_IRQ_H__
+#ifndef ASM__RISCV__IRQ_H
+#define ASM__RISCV__IRQ_H
 
 #include <xen/bug.h>
 
@@ -25,7 +25,7 @@ static inline void arch_move_irqs(struct vcpu *v)
     BUG_ON("unimplemented");
 }
 
-#endif /* __ASM_RISCV_IRQ_H__ */
+#endif /* ASM__RISCV__IRQ_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/mm.h
index 4b7b00b850..5c79f3def3 100644
--- a/xen/arch/riscv/include/asm/mm.h
+++ b/xen/arch/riscv/include/asm/mm.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
-#ifndef _ASM_RISCV_MM_H
-#define _ASM_RISCV_MM_H
+#ifndef ASM__RISCV__MM_H
+#define ASM__RISCV__MM_H
 
 #include <public/xen.h>
 #include <xen/bug.h>
@@ -261,4 +261,4 @@ void setup_fixmap_mappings(void);
 
 void *early_fdt_map(paddr_t fdt_paddr);
 
-#endif /* _ASM_RISCV_MM_H */
+#endif /* ASM__RISCV__MM_H */
diff --git a/xen/arch/riscv/include/asm/monitor.h b/xen/arch/riscv/include/asm/monitor.h
index f4fe2c0690..fb3d3e8e3a 100644
--- a/xen/arch/riscv/include/asm/monitor.h
+++ b/xen/arch/riscv/include/asm/monitor.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_RISCV_MONITOR_H__
-#define __ASM_RISCV_MONITOR_H__
+#ifndef ASM__RISCV__MONITOR_H
+#define ASM__RISCV__MONITOR_H
 
 #include <xen/bug.h>
 
@@ -14,7 +14,7 @@ static inline uint32_t arch_monitor_get_capabilities(struct domain *d)
     return 0;
 }
 
-#endif /* __ASM_RISCV_MONITOR_H__ */
+#endif /* ASM__RISCV__MONITOR_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/nospec.h b/xen/arch/riscv/include/asm/nospec.h
index e30f0a781b..f9b0241c98 100644
--- a/xen/arch/riscv/include/asm/nospec.h
+++ b/xen/arch/riscv/include/asm/nospec.h
@@ -1,8 +1,8 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 /* Copyright (C) 2024 Vates */
 
-#ifndef _ASM_RISCV_NOSPEC_H
-#define _ASM_RISCV_NOSPEC_H
+#ifndef ASM__RISCV__NOSPEC_H
+#define ASM__RISCV__NOSPEC_H
 
 static inline bool evaluate_nospec(bool condition)
 {
@@ -13,7 +13,7 @@ static inline void block_speculation(void)
 {
 }
 
-#endif /* _ASM_RISCV_NOSPEC_H */
+#endif /* ASM__RISCV__NOSPEC_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/p2m.h b/xen/arch/riscv/include/asm/p2m.h
index 26860c0ae7..28f57a74f2 100644
--- a/xen/arch/riscv/include/asm/p2m.h
+++ b/xen/arch/riscv/include/asm/p2m.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_RISCV_P2M_H__
-#define __ASM_RISCV_P2M_H__
+#ifndef ASM__RISCV__P2M_H
+#define ASM__RISCV__P2M_H
 
 #include <xen/errno.h>
 
@@ -93,7 +93,7 @@ static inline void p2m_altp2m_check(struct vcpu *v, uint16_t idx)
     /* Not supported on RISCV. */
 }
 
-#endif /* __ASM_RISCV_P2M_H__ */
+#endif /* ASM__RISCV__P2M_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/page-bits.h b/xen/arch/riscv/include/asm/page-bits.h
index 8f1f474371..788c7d9518 100644
--- a/xen/arch/riscv/include/asm/page-bits.h
+++ b/xen/arch/riscv/include/asm/page-bits.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
-#ifndef __RISCV_PAGE_BITS_H__
-#define __RISCV_PAGE_BITS_H__
+#ifndef ASM__RISCV__PAGE_BITS_H
+#define ASM__RISCV__PAGE_BITS_H
 
 #define PAGE_SHIFT              12 /* 4 KiB Pages */
 #define PADDR_BITS              56 /* 44-bit PPN */
@@ -16,4 +16,4 @@
 
 #define PTE_PPN_SHIFT           10
 
-#endif /* __RISCV_PAGE_BITS_H__ */
+#endif /* ASM__RISCV__PAGE_BITS_H */
diff --git a/xen/arch/riscv/include/asm/page.h b/xen/arch/riscv/include/asm/page.h
index 89fa290697..91b1194b55 100644
--- a/xen/arch/riscv/include/asm/page.h
+++ b/xen/arch/riscv/include/asm/page.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
-#ifndef _ASM_RISCV_PAGE_H
-#define _ASM_RISCV_PAGE_H
+#ifndef ASM__RISCV__PAGE_H
+#define ASM__RISCV__PAGE_H
 
 #ifndef __ASSEMBLY__
 
@@ -182,4 +182,4 @@ static inline pte_t pte_from_mfn(mfn_t mfn, unsigned int flags)
 
 #endif /* __ASSEMBLY__ */
 
-#endif /* _ASM_RISCV_PAGE_H */
+#endif /* ASM__RISCV__PAGE_H */
diff --git a/xen/arch/riscv/include/asm/pmap.h b/xen/arch/riscv/include/asm/pmap.h
index 60065c996f..146dd29f95 100644
--- a/xen/arch/riscv/include/asm/pmap.h
+++ b/xen/arch/riscv/include/asm/pmap.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
-#ifndef ASM_PMAP_H
-#define ASM_PMAP_H
+#ifndef ASM__RISCV__PMAP_H
+#define ASM__RISCV__PMAP_H
 
 #include <xen/bug.h>
 #include <xen/init.h>
@@ -33,4 +33,4 @@ static inline void __init arch_pmap_unmap(unsigned int slot)
     flush_tlb_one_local(FIXMAP_ADDR(slot));
 }
 
-#endif /* ASM_PMAP_H */
+#endif /* ASM__RISCV__PMAP_H */
diff --git a/xen/arch/riscv/include/asm/processor.h b/xen/arch/riscv/include/asm/processor.h
index e42b353b4c..90b8009563 100644
--- a/xen/arch/riscv/include/asm/processor.h
+++ b/xen/arch/riscv/include/asm/processor.h
@@ -7,8 +7,8 @@
  *
  */
 
-#ifndef _ASM_RISCV_PROCESSOR_H
-#define _ASM_RISCV_PROCESSOR_H
+#ifndef ASM__RISCV__PROCESSOR_H
+#define ASM__RISCV__PROCESSOR_H
 
 #ifndef __ASSEMBLY__
 
@@ -93,7 +93,7 @@ static inline void sfence_vma(void)
 
 #endif /* __ASSEMBLY__ */
 
-#endif /* _ASM_RISCV_PROCESSOR_H */
+#endif /* ASM__RISCV__PROCESSOR_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/regs.h b/xen/arch/riscv/include/asm/regs.h
index c70ea2aa0c..218b9455bd 100644
--- a/xen/arch/riscv/include/asm/regs.h
+++ b/xen/arch/riscv/include/asm/regs.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ARM_RISCV_REGS_H__
-#define __ARM_RISCV_REGS_H__
+#ifndef ASM__RISCV__REGS_H
+#define ASM__RISCV__REGS_H
 
 #ifndef __ASSEMBLY__
 
@@ -17,7 +17,7 @@ static inline bool guest_mode(const struct cpu_user_regs *r)
 
 #endif /* __ASSEMBLY__ */
 
-#endif /* __ARM_RISCV_REGS_H__ */
+#endif /* ASM__RISCV__REGS_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/riscv_encoding.h b/xen/arch/riscv/include/asm/riscv_encoding.h
index e31e94e77e..6cc8f4eb45 100644
--- a/xen/arch/riscv/include/asm/riscv_encoding.h
+++ b/xen/arch/riscv/include/asm/riscv_encoding.h
@@ -6,8 +6,8 @@
  *   Anup Patel <anup.patel@wdc.com>
  */
 
-#ifndef __RISCV_ENCODING_H__
-#define __RISCV_ENCODING_H__
+#ifndef ASM__RISCV__RISCV_ENCODING_H
+#define ASM__RISCV__RISCV_ENCODING_H
 
 #define _UL(X) _AC(X, UL)
 #define _ULL(X) _AC(X, ULL)
diff --git a/xen/arch/riscv/include/asm/sbi.h b/xen/arch/riscv/include/asm/sbi.h
index 5947fed779..527d773277 100644
--- a/xen/arch/riscv/include/asm/sbi.h
+++ b/xen/arch/riscv/include/asm/sbi.h
@@ -9,8 +9,8 @@
  * Copyright (c) 2019 Western Digital Corporation or its affiliates.
  */
 
-#ifndef __ASM_RISCV_SBI_H__
-#define __ASM_RISCV_SBI_H__
+#ifndef ASM__RISCV__SBI_H
+#define ASM__RISCV__SBI_H
 
 #include <xen/cpumask.h>
 
@@ -96,4 +96,4 @@ int sbi_remote_sfence_vma(const cpumask_t *cpu_mask, vaddr_t start,
  */
 int sbi_init(void);
 
-#endif /* __ASM_RISCV_SBI_H__ */
+#endif /* ASM__RISCV__SBI_H */
diff --git a/xen/arch/riscv/include/asm/setup.h b/xen/arch/riscv/include/asm/setup.h
index 7613a5dbd0..c0214a9bf2 100644
--- a/xen/arch/riscv/include/asm/setup.h
+++ b/xen/arch/riscv/include/asm/setup.h
@@ -1,11 +1,11 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
-#ifndef __ASM_RISCV_SETUP_H__
-#define __ASM_RISCV_SETUP_H__
+#ifndef ASM__RISCV__SETUP_H
+#define ASM__RISCV__SETUP_H
 
 #define max_init_domid (0)
 
-#endif /* __ASM_RISCV_SETUP_H__ */
+#endif /* ASM__RISCV__SETUP_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/smp.h b/xen/arch/riscv/include/asm/smp.h
index 092b101ff4..5e170b57b3 100644
--- a/xen/arch/riscv/include/asm/smp.h
+++ b/xen/arch/riscv/include/asm/smp.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_RISCV_SMP_H
-#define __ASM_RISCV_SMP_H
+#ifndef ASM__RISCV__SMP_H
+#define ASM__RISCV__SMP_H
 
 #include <xen/cpumask.h>
 #include <xen/percpu.h>
diff --git a/xen/arch/riscv/include/asm/spinlock.h b/xen/arch/riscv/include/asm/spinlock.h
index bf45a7f005..4a607eba52 100644
--- a/xen/arch/riscv/include/asm/spinlock.h
+++ b/xen/arch/riscv/include/asm/spinlock.h
@@ -1,5 +1,5 @@
-#ifndef __ASM_RISCV_SPINLOCK_H
-#define __ASM_RISCV_SPINLOCK_H
+#ifndef ASM__RISCV__SPINLOCK_H
+#define ASM__RISCV__SPINLOCK_H
 
 #define arch_lock_acquire_barrier() smp_mb()
 #define arch_lock_release_barrier() smp_mb()
@@ -12,4 +12,4 @@
     arch_lock_signal();             \
 })
 
-#endif /* __ASM_RISCV_SPINLOCK_H */
+#endif /* ASM__RISCV__SPINLOCK_H */
diff --git a/xen/arch/riscv/include/asm/string.h b/xen/arch/riscv/include/asm/string.h
index a26ba8f5c6..75a2048fb1 100644
--- a/xen/arch/riscv/include/asm/string.h
+++ b/xen/arch/riscv/include/asm/string.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 
-#ifndef _ASM_RISCV_STRING_H
-#define _ASM_RISCV_STRING_H
+#ifndef ASM__RISCV__STRING_H
+#define ASM__RISCV__STRING_H
 
-#endif /* _ASM_RISCV_STRING_H */
+#endif /* ASM__RISCV__STRING_H */
diff --git a/xen/arch/riscv/include/asm/system.h b/xen/arch/riscv/include/asm/system.h
index f76bafd168..7b78d11e04 100644
--- a/xen/arch/riscv/include/asm/system.h
+++ b/xen/arch/riscv/include/asm/system.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
-#ifndef _ASM_RISCV_SYSTEM_H
-#define _ASM_RISCV_SYSTEM_H
+#ifndef ASM__RISCV__SYSTEM_H
+#define ASM__RISCV__SYSTEM_H
 
 #include <xen/stdbool.h>
 
@@ -78,7 +78,7 @@ static inline bool local_irq_is_enabled(void)
 
 #endif /* __ASSEMBLY__ */
 
-#endif /* _ASM_RISCV_SYSTEM_H */
+#endif /* ASM__RISCV__SYSTEM_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/time.h b/xen/arch/riscv/include/asm/time.h
index affeb0506a..fc1572e9b4 100644
--- a/xen/arch/riscv/include/asm/time.h
+++ b/xen/arch/riscv/include/asm/time.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
-#ifndef __ASM_RISCV_TIME_H__
-#define __ASM_RISCV_TIME_H__
+#ifndef ASM__RISCV__TIME_H
+#define ASM__RISCV__TIME_H
 
 #include <xen/bug.h>
 #include <asm/csr.h>
@@ -19,7 +19,7 @@ static inline cycles_t get_cycles(void)
     return csr_read(CSR_TIME);
 }
 
-#endif /* __ASM_RISCV_TIME_H__ */
+#endif /* ASM__RISCV__TIME_H */
 
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/traps.h b/xen/arch/riscv/include/asm/traps.h
index c30118e095..72b8f6c475 100644
--- a/xen/arch/riscv/include/asm/traps.h
+++ b/xen/arch/riscv/include/asm/traps.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
-#ifndef __ASM_TRAPS_H__
-#define __ASM_TRAPS_H__
+#ifndef ASM__RISCV__TRAPS_H
+#define ASM__RISCV__TRAPS_H
 
 #include <asm/processor.h>
 
@@ -13,4 +13,4 @@ void trap_init(void);
 
 #endif /* __ASSEMBLY__ */
 
-#endif /* __ASM_TRAPS_H__ */
+#endif /* ASM__RISCV__TRAPS_H */
diff --git a/xen/arch/riscv/include/asm/types.h b/xen/arch/riscv/include/asm/types.h
index 59358fd698..d801596a20 100644
--- a/xen/arch/riscv/include/asm/types.h
+++ b/xen/arch/riscv/include/asm/types.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
-#ifndef __RISCV_TYPES_H__
-#define __RISCV_TYPES_H__
+#ifndef ASM__RISCV__TYPES_H
+#define ASM__RISCV__TYPES_H
 
 #if defined(CONFIG_RISCV_32)
 
@@ -25,7 +25,7 @@ typedef u64 register_t;
 
 #endif
 
-#endif /* __RISCV_TYPES_H__ */
+#endif /* ASM__RISCV__TYPES_H */
 /*
  * Local variables:
  * mode: C
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 06:33:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 06:33:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816640.1230774 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sz9DS-0001gd-Hy; Fri, 11 Oct 2024 06:33:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816640.1230774; Fri, 11 Oct 2024 06:33:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sz9DS-0001gU-FJ; Fri, 11 Oct 2024 06:33:34 +0000
Received: by outflank-mailman (input) for mailman id 816640;
 Fri, 11 Oct 2024 06: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 1sz9DQ-0001gH-SW
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06: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 1sz9DQ-00085K-Rm
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sz9DQ-0006Cc-Qq
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06: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=V5DVdIgHHqwcCDz9wtLi6s6SQQujCZlKZCmMmEukvbc=; b=i3bdDjg/SnSpyUs6obP4JirLbD
	7f2/wOkFhsLOratn4avSB3Ap/y91w0pVeDjS1Uz9p5OsbtuPQfrPMlB/jRFFl3AGQnkwnRk93p7cr
	fNgru4bvK613YCF+LeYoivi0hiutCLH92KQb/t3l6zuOO7oT9JI+/Gb6Qw6Iz7n3Vbeo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/APIC: Switch flat driver to use phys dst for ext ints
Message-Id: <E1sz9DQ-0006Cc-Qq@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 06:33:32 +0000

commit dcbf8210f3f3a49626341355308010eb92194b85
Author:     Matthew Barnes <matthew.barnes@cloud.com>
AuthorDate: Wed Oct 9 09:54:48 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 9 09:54:48 2024 +0200

    x86/APIC: Switch flat driver to use phys dst for ext ints
    
    External interrupts via logical delivery mode in xAPIC do not benefit
    from targeting multiple CPUs and instead simply bloat up the vector
    space.
    
    However the xAPIC flat driver currently uses logical delivery for
    external interrupts.
    
    This patch switches the xAPIC flat driver to use physical destination
    mode for external interrupts, instead of logical destination mode.
    
    This patch also applies the following non-functional changes:
    - Remove now unused logical flat functions
    - Expand GENAPIC_FLAT and GENAPIC_PHYS macros, and delete them.
    
    Resolves: https://gitlab.com/xen-project/xen/-/issues/194
    Signed-off-by: Matthew Barnes <matthew.barnes@cloud.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/genapic/bigsmp.c      |  8 +++++++-
 xen/arch/x86/genapic/default.c     |  8 +++++++-
 xen/arch/x86/genapic/delivery.c    | 10 ----------
 xen/arch/x86/include/asm/genapic.h | 18 ------------------
 4 files changed, 14 insertions(+), 30 deletions(-)

diff --git a/xen/arch/x86/genapic/bigsmp.c b/xen/arch/x86/genapic/bigsmp.c
index e97e4453a0..b2e7218452 100644
--- a/xen/arch/x86/genapic/bigsmp.c
+++ b/xen/arch/x86/genapic/bigsmp.c
@@ -46,5 +46,11 @@ static int __init cf_check probe_bigsmp(void)
 
 const struct genapic __initconst_cf_clobber apic_bigsmp = {
 	APIC_INIT("bigsmp", probe_bigsmp),
-	GENAPIC_PHYS
+	.int_delivery_mode = dest_Fixed,
+	.int_dest_mode = 0, /* physical delivery */
+	.init_apic_ldr = init_apic_ldr_phys,
+	.vector_allocation_cpumask = vector_allocation_cpumask_phys,
+	.cpu_mask_to_apicid = cpu_mask_to_apicid_phys,
+	.send_IPI_mask = send_IPI_mask_phys,
+	.send_IPI_self = send_IPI_self_legacy
 };
diff --git a/xen/arch/x86/genapic/default.c b/xen/arch/x86/genapic/default.c
index a968836a18..59c79afdb8 100644
--- a/xen/arch/x86/genapic/default.c
+++ b/xen/arch/x86/genapic/default.c
@@ -16,5 +16,11 @@
 /* should be called last. */
 const struct genapic __initconst_cf_clobber apic_default = {
 	APIC_INIT("default", NULL),
-	GENAPIC_FLAT
+	.int_delivery_mode = dest_Fixed,
+	.int_dest_mode = 0, /* physical delivery */
+	.init_apic_ldr = init_apic_ldr_flat,
+	.vector_allocation_cpumask = vector_allocation_cpumask_phys,
+	.cpu_mask_to_apicid = cpu_mask_to_apicid_phys,
+	.send_IPI_mask = send_IPI_mask_flat,
+	.send_IPI_self = send_IPI_self_legacy
 };
diff --git a/xen/arch/x86/genapic/delivery.c b/xen/arch/x86/genapic/delivery.c
index d1f99bf683..3def78f380 100644
--- a/xen/arch/x86/genapic/delivery.c
+++ b/xen/arch/x86/genapic/delivery.c
@@ -19,16 +19,6 @@ void cf_check init_apic_ldr_flat(void)
 	apic_write(APIC_LDR, val);
 }
 
-const cpumask_t *cf_check vector_allocation_cpumask_flat(int cpu)
-{
-	return &cpu_online_map;
-} 
-
-unsigned int cf_check cpu_mask_to_apicid_flat(const cpumask_t *cpumask)
-{
-	return cpumask_bits(cpumask)[0]&0xFF;
-}
-
 /*
  * PHYSICAL DELIVERY MODE (unicast to physical APIC IDs).
  */
diff --git a/xen/arch/x86/include/asm/genapic.h b/xen/arch/x86/include/asm/genapic.h
index a694371c6d..4d39fb9a24 100644
--- a/xen/arch/x86/include/asm/genapic.h
+++ b/xen/arch/x86/include/asm/genapic.h
@@ -44,29 +44,11 @@ extern const struct genapic apic_bigsmp;
 void cf_check send_IPI_self_legacy(uint8_t vector);
 
 void cf_check init_apic_ldr_flat(void);
-unsigned int cf_check cpu_mask_to_apicid_flat(const cpumask_t *cpumask);
 void cf_check send_IPI_mask_flat(const cpumask_t *cpumask, int vector);
-const cpumask_t *cf_check vector_allocation_cpumask_flat(int cpu);
-#define GENAPIC_FLAT \
-	.int_delivery_mode = dest_LowestPrio, \
-	.int_dest_mode = 1 /* logical delivery */, \
-	.init_apic_ldr = init_apic_ldr_flat, \
-	.vector_allocation_cpumask = vector_allocation_cpumask_flat, \
-	.cpu_mask_to_apicid = cpu_mask_to_apicid_flat, \
-	.send_IPI_mask = send_IPI_mask_flat, \
-	.send_IPI_self = send_IPI_self_legacy
 
 void cf_check init_apic_ldr_phys(void);
 unsigned int cf_check cpu_mask_to_apicid_phys(const cpumask_t *cpumask);
 void cf_check send_IPI_mask_phys(const cpumask_t *mask, int vector);
 const cpumask_t *cf_check vector_allocation_cpumask_phys(int cpu);
-#define GENAPIC_PHYS \
-	.int_delivery_mode = dest_Fixed, \
-	.int_dest_mode = 0 /* physical delivery */, \
-	.init_apic_ldr = init_apic_ldr_phys, \
-	.vector_allocation_cpumask = vector_allocation_cpumask_phys, \
-	.cpu_mask_to_apicid = cpu_mask_to_apicid_phys, \
-	.send_IPI_mask = send_IPI_mask_phys, \
-	.send_IPI_self = send_IPI_self_legacy
 
 #endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 06:33:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 06:33:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816641.1230778 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sz9Dc-0001jz-JU; Fri, 11 Oct 2024 06:33:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816641.1230778; Fri, 11 Oct 2024 06:33:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sz9Dc-0001js-Go; Fri, 11 Oct 2024 06:33:44 +0000
Received: by outflank-mailman (input) for mailman id 816641;
 Fri, 11 Oct 2024 06:33: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 1sz9Db-0001jZ-0c
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:33: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 1sz9Da-00085U-W8
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sz9Da-0006Dg-U9
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06: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=5bShOVmuQ7AyKZv00OGz30RrLn4IBK0yaXriTxFeB7M=; b=Xa1Bw0GLPYLzcz8L5nFEuYGpJy
	ZjTPrE3b7Sv1DOu+vYfBOYcxAAGjpdEgpVBa1UwrGDePf/46YZOj8htI3RYrKO5DWtKsWbPW/4hv6
	SNpTZIydHxzcpt90UA2uNKc588YjkDcezc6nAjp/5Np73UMkN/GuwWyNrNZqzreQxzc4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/msr: add log messages to MSR state load error paths
Message-Id: <E1sz9Da-0006Dg-U9@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 06:33:42 +0000

commit 2f413e22fa5eb1c6b8ec04ef1529807a2fbf6c79
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Wed Oct 9 09:55:38 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 9 09:55:38 2024 +0200

    x86/msr: add log messages to MSR state load error paths
    
    Some error paths in the MSR state loading logic don't contain error messages,
    which makes debugging them quite hard without adding extra patches to print the
    information.
    
    Add two new log messages to the MSR state load path that print information
    about the entry that failed to load, for both PV and HVM.
    
    While there also adjust XEN_DOMCTL_set_vcpu_msrs to return -ENXIO in case the
    MSR is unhandled or can't be loaded, so it matches the error code used by HVM
    MSR loading (and it's less ambiguous than -EINVAL).
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domctl.c  | 8 ++++++++
 xen/arch/x86/hvm/hvm.c | 7 +++++++
 2 files changed, 15 insertions(+)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 27d5b3f3d6..37ebcb3abb 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1162,6 +1162,7 @@ long arch_do_domctl(
                 if ( msr.reserved )
                     break;
 
+                ret = -ENXIO;
                 switch ( msr.index )
                 {
                 case MSR_SPEC_CTRL:
@@ -1170,9 +1171,16 @@ long arch_do_domctl(
                 case MSR_AMD64_DR0_ADDRESS_MASK:
                 case MSR_AMD64_DR1_ADDRESS_MASK ... MSR_AMD64_DR3_ADDRESS_MASK:
                     if ( guest_wrmsr(v, msr.index, msr.value) != X86EMUL_OKAY )
+                    {
+                        printk(XENLOG_G_ERR
+                               "%pv load MSR %#x with value %#lx failed\n",
+                               v, msr.index, msr.value);
                         break;
+                    }
                     continue;
                 }
+                printk(XENLOG_G_ERR "%pv attempted load of unhandled MSR %#x\n",
+                       v, msr.index);
                 break;
             }
 
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 7b2e1c9813..3b803e15e0 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1535,10 +1535,17 @@ static int cf_check hvm_load_cpu_msrs(struct domain *d, hvm_domain_context_t *h)
             rc = guest_wrmsr(v, ctxt->msr[i].index, ctxt->msr[i].val);
 
             if ( rc != X86EMUL_OKAY )
+            {
+                printk(XENLOG_G_ERR
+                       "HVM %pv load MSR %#x with value %#lx failed\n",
+                       v, ctxt->msr[i].index, ctxt->msr[i].val);
                 return -ENXIO;
+            }
             break;
 
         default:
+            printk(XENLOG_G_ERR "HVM %pv attempted load of unhandled MSR %#x\n",
+                   v, ctxt->msr[i].index);
             return -ENXIO;
         }
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 06:33:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 06:33:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816645.1230791 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sz9Dm-00021a-Si; Fri, 11 Oct 2024 06:33:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816645.1230791; Fri, 11 Oct 2024 06:33:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sz9Dm-00021S-QD; Fri, 11 Oct 2024 06:33:54 +0000
Received: by outflank-mailman (input) for mailman id 816645;
 Fri, 11 Oct 2024 06:33: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 1sz9Dl-0001vo-3S
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:33: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 1sz9Dl-00085j-2s
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:33:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sz9Dl-0006Eb-22
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:33: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=PVx2Wk5ldlMYtMUTv3NZMi3ZA2YECFjtdvGg629M9UE=; b=rMtu9K126fL55rDHmXIxmSs1+v
	x4hshTdjBOY16OsTcVM7tfKfSU/uk/wLbAK2q/hYMM5xp1TnfokPZzSKYGQLwt7OyenzDreAFBdoB
	GLXW+9+0aZGOAP6DgttEfjv48oMLJy4OWmUo1sRR11Uqwj1kYgVYqkJcPdgBC8RwWl58=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] MAINTAINERS: add myself as maintainer for arm tee
Message-Id: <E1sz9Dl-0006Eb-22@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 06:33:53 +0000

commit 9d278c8c6cd5f8375c913ed8f4d1ce2b50f0ea06
Author:     Bertrand Marquis <bertrand.marquis@arm.com>
AuthorDate: Wed Oct 9 09:56:16 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 9 09:56:16 2024 +0200

    MAINTAINERS: add myself as maintainer for arm tee
    
    With Tee mediators now containing Optee and FF-A implementations, add
    myself as maintainers to have someone handling the FF-A side.
    
    Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index fb0ebf0939..2450b0f9ff 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -516,6 +516,7 @@ F:	stubdom/
 
 TEE MEDIATORS
 M:	Volodymyr Babchuk <volodymyr_babchuk@epam.com>
+M:	Bertrand Marquis <bertrand.marquis@arm.com>
 S:	Supported
 F:	xen/arch/arm/include/asm/tee
 F:	xen/arch/arm/tee/
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 06:34:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 06:34:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816646.1230796 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sz9Dw-00026h-Uu; Fri, 11 Oct 2024 06:34:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816646.1230796; Fri, 11 Oct 2024 06: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 1sz9Dw-00026Z-Rb; Fri, 11 Oct 2024 06:34:04 +0000
Received: by outflank-mailman (input) for mailman id 816646;
 Fri, 11 Oct 2024 06:34: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 1sz9Dv-00025s-7N
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:34: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 1sz9Dv-00086S-6E
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:34:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sz9Dv-0006Gf-5R
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:34: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=InRI89SWinVy29v93W8Lw1ivzOT/8wws13YoxCz62oU=; b=MMVbxOrGrK4azPOkFi5lbBKHES
	zvn8U3Ni7HIaS5chhdFad5ZDZuKfP4do3PguK47vK6QaWCwEIyc3hIKWfA8PiJKiyTXJ8tlZuS++m
	WcCe4rAEod8tHLPE9JPMD3s5DdPgYZ3RWjKL1iSn1j6erC2o8uEFiKGl1KzVB9yt3p4E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] types: replace remaining uses of s64
Message-Id: <E1sz9Dv-0006Gf-5R@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 06:34:03 +0000

commit 6b80ec957c64fc3ca7a32adc504fefd226d7dad0
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Wed Oct 9 09:56:43 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 9 09:56:43 2024 +0200

    types: replace remaining uses of s64
    
    ... and move the type itself to linux-compat.h. An exception being
    arch/arm/arm64/cpufeature.c and arch/arm/include/asm/arm64/cpufeature.h,
    which are to use linux-compat.h instead (the former by including the
    latter).
    
    While doing so
    - correct the type of union uu's uq field in lib/divmod.c,
    - switch a few adjacent types as well, for (a little bit of)
      consistency.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Ross Lagerwall <ross.lagerwall@citrix.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/arm64/livepatch.c              | 18 +++++++++---------
 xen/arch/arm/include/asm/arm64/cpufeature.h |  2 ++
 xen/arch/x86/hvm/vlapic.c                   |  2 +-
 xen/arch/x86/include/asm/hvm/vcpu.h         |  4 ++--
 xen/arch/x86/time.c                         | 22 +++++++++++-----------
 xen/drivers/acpi/apei/erst.c                |  2 +-
 xen/include/acpi/actypes.h                  |  4 ++--
 xen/include/xen/linux-compat.h              |  2 +-
 xen/include/xen/time.h                      |  2 +-
 xen/include/xen/types.h                     |  1 -
 xen/lib/divmod.c                            | 12 ++++++------
 11 files changed, 36 insertions(+), 35 deletions(-)

diff --git a/xen/arch/arm/arm64/livepatch.c b/xen/arch/arm/arm64/livepatch.c
index d80051f9dc..6efe4ec770 100644
--- a/xen/arch/arm/arm64/livepatch.c
+++ b/xen/arch/arm/arm64/livepatch.c
@@ -119,7 +119,7 @@ static u64 do_reloc(enum aarch64_reloc_op reloc_op, void *place, u64 val)
 
 static int reloc_data(enum aarch64_reloc_op op, void *place, u64 val, int len)
 {
-    s64 sval = do_reloc(op, place, val);
+    int64_t sval = do_reloc(op, place, val);
 
     switch ( len )
     {
@@ -136,7 +136,7 @@ static int reloc_data(enum aarch64_reloc_op op, void *place, u64 val, int len)
         break;
 
     case 64:
-        *(s64 *)place = sval;
+        *(int64_t *)place = sval;
         break;
 
     default:
@@ -155,9 +155,9 @@ enum aarch64_insn_movw_imm_type {
 static int reloc_insn_movw(enum aarch64_reloc_op op, void *dest, u64 val,
                            int lsb, enum aarch64_insn_movw_imm_type imm_type)
 {
-    u64 imm;
-    s64 sval;
-    u32 insn = *(u32 *)dest;
+    uint64_t imm;
+    int64_t sval;
+    uint32_t insn = *(uint32_t *)dest;
 
     sval = do_reloc(op, dest, val);
     imm = sval >> lsb;
@@ -200,9 +200,9 @@ static int reloc_insn_movw(enum aarch64_reloc_op op, void *dest, u64 val,
 static int reloc_insn_imm(enum aarch64_reloc_op op, void *dest, u64 val,
                           int lsb, int len, enum aarch64_insn_imm_type imm_type)
 {
-    u64 imm, imm_mask;
-    s64 sval;
-    u32 insn = *(u32 *)dest;
+    uint64_t imm, imm_mask;
+    int64_t sval;
+    uint32_t insn = *(uint32_t *)dest;
 
     /* Calculate the relocation value. */
     sval = do_reloc(op, dest, val);
@@ -220,7 +220,7 @@ static int reloc_insn_imm(enum aarch64_reloc_op op, void *dest, u64 val,
      * Extract the upper value bits (including the sign bit) and
      * shift them to bit 0.
      */
-    sval = (s64)(sval & ~(imm_mask >> 1)) >> (len - 1);
+    sval = (int64_t)(sval & ~(imm_mask >> 1)) >> (len - 1);
 
     /*
      * Overflow has occurred if the upper bits are not all equal to
diff --git a/xen/arch/arm/include/asm/arm64/cpufeature.h b/xen/arch/arm/include/asm/arm64/cpufeature.h
index 1bb503e857..8d5100a557 100644
--- a/xen/arch/arm/include/asm/arm64/cpufeature.h
+++ b/xen/arch/arm/include/asm/arm64/cpufeature.h
@@ -1,6 +1,8 @@
 #ifndef __ASM_ARM_ARM64_CPUFEATURES_H
 #define __ASM_ARM_ARM64_CPUFEATURES_H
 
+#include <xen/linux-compat.h>
+
 /*
  * CPU feature register tracking
  *
diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 992355e511..9a16dd0d77 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -1223,7 +1223,7 @@ void vlapic_tdt_msr_set(struct vlapic *vlapic, uint64_t value)
     if ( value > guest_tsc )
     {
         uint64_t delta = gtsc_to_gtime(v->domain, value - guest_tsc);
-        delta = max_t(s64, delta, 0);
+        delta = max_t(int64_t, delta, 0);
 
         HVM_DBG_LOG(DBG_LEVEL_VLAPIC_TIMER, "delta[0x%016"PRIx64"]", delta);
 
diff --git a/xen/arch/x86/include/asm/hvm/vcpu.h b/xen/arch/x86/include/asm/hvm/vcpu.h
index 64c7a6fede..6d5845780d 100644
--- a/xen/arch/x86/include/asm/hvm/vcpu.h
+++ b/xen/arch/x86/include/asm/hvm/vcpu.h
@@ -134,8 +134,8 @@ struct hvm_vcpu {
     unsigned long       hw_cr[5];
 
     struct vlapic       vlapic;
-    s64                 cache_tsc_offset;
-    u64                 guest_time;
+    int64_t             cache_tsc_offset;
+    uint64_t            guest_time;
 
     /* Lock and list for virtual platform timers. */
     spinlock_t          tm_lock;
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index 29b026735e..bc9f265941 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -66,10 +66,10 @@ struct cpu_time {
 struct platform_timesource {
     const char *id;
     const char *name;
-    u64 frequency;
+    uint64_t frequency;
     /* Post-init this hook may only be invoked via the read_counter() wrapper! */
-    u64 (*read_counter)(void);
-    s64 (*init)(struct platform_timesource *);
+    uint64_t (*read_counter)(void);
+    int64_t (*init)(struct platform_timesource *);
     void (*resume)(struct platform_timesource *);
     int counter_bits;
 };
@@ -368,7 +368,7 @@ static u64 cf_check read_pit_count(void)
     return count32;
 }
 
-static s64 __init cf_check init_pit(struct platform_timesource *pts)
+static int64_t __init cf_check init_pit(struct platform_timesource *pts)
 {
     u8 portb = inb(0x61);
     u64 start, end;
@@ -610,7 +610,7 @@ static u64 cf_check read_pmtimer_count(void)
     return inl(pmtmr_ioport);
 }
 
-static s64 __init cf_check init_pmtimer(struct platform_timesource *pts)
+static int64_t __init cf_check init_pmtimer(struct platform_timesource *pts)
 {
     if ( !pmtmr_ioport || (pmtmr_width != 24 && pmtmr_width != 32) )
         return 0;
@@ -655,7 +655,7 @@ static unsigned int __initdata tsc_flags;
  * Called in verify_tsc_reliability() under reliable TSC conditions
  * thus reusing all the checks already performed there.
  */
-static s64 __init cf_check init_tsc(struct platform_timesource *pts)
+static int64_t __init cf_check init_tsc(struct platform_timesource *pts)
 {
     u64 ret = pts->frequency;
 
@@ -1034,9 +1034,9 @@ static void __init reset_platform_timer(void)
     spin_unlock_irq(&platform_timer_lock);
 }
 
-static s64 __init try_platform_timer(struct platform_timesource *pts)
+static int64_t __init try_platform_timer(struct platform_timesource *pts)
 {
-    s64 rc = pts->init(pts);
+    int64_t rc = pts->init(pts);
 
     if ( rc <= 0 )
         return rc;
@@ -1070,7 +1070,7 @@ static u64 __init init_platform_timer(void)
 
     struct platform_timesource *pts = NULL;
     unsigned int i;
-    s64 rc = -1;
+    int64_t rc = -1;
 
     /* clocksource=tsc is initialized via __initcalls (when CPUs are up). */
     if ( (opt_clocksource[0] != '\0') && strcmp(opt_clocksource, "tsc") )
@@ -1923,7 +1923,7 @@ static void cf_check local_time_calibration(void)
      * Weirdness can happen if we lose sync with the platform timer.
      * We could be smarter here: resync platform timer with local timer?
      */
-    if ( ((s64)stime_elapsed64 < (EPOCH / 2)) )
+    if ( ((int64_t)stime_elapsed64 < (EPOCH / 2)) )
         goto out;
 
     /*
@@ -2398,7 +2398,7 @@ static void __init tsc_check_writability(void)
 
         write_tsc(tsc | (1ULL << 32));
         tmp = rdtsc();
-        if ( ABS((s64)tmp - (s64)tmp2) < (1LL << 31) )
+        if ( ABS((int64_t)tmp - (int64_t)tmp2) < (1LL << 31) )
             what = "only partially";
     }
     else
diff --git a/xen/drivers/acpi/apei/erst.c b/xen/drivers/acpi/apei/erst.c
index e006b3def2..76f799c0ab 100644
--- a/xen/drivers/acpi/apei/erst.c
+++ b/xen/drivers/acpi/apei/erst.c
@@ -105,7 +105,7 @@ static inline int erst_errno(int command_status)
 
 static int erst_timedout(u64 *t, u64 spin_unit)
 {
-	if ((s64)*t < spin_unit) {
+	if ((int64_t)*t < spin_unit) {
 		printk(XENLOG_WARNING "Firmware does not respond in time\n");
 		return 1;
 	}
diff --git a/xen/include/acpi/actypes.h b/xen/include/acpi/actypes.h
index 49e0ab9bb4..a3983423bd 100644
--- a/xen/include/acpi/actypes.h
+++ b/xen/include/acpi/actypes.h
@@ -147,8 +147,8 @@ typedef int INT32;
 
 /*! [End] no source code translation !*/
 
-typedef u64 acpi_native_uint;
-typedef s64 acpi_native_int;
+typedef uint64_t acpi_native_uint;
+typedef int64_t acpi_native_int;
 
 typedef u64 acpi_io_address;
 typedef u64 acpi_physical_address;
diff --git a/xen/include/xen/linux-compat.h b/xen/include/xen/linux-compat.h
index 1f4186102a..656fff883e 100644
--- a/xen/include/xen/linux-compat.h
+++ b/xen/include/xen/linux-compat.h
@@ -15,7 +15,7 @@ typedef int8_t  s8, __s8;
 typedef uint8_t __u8;
 typedef int16_t s16, __s16;
 typedef int32_t s32, __s32;
-typedef int64_t __s64;
+typedef int64_t s64, __s64;
 
 typedef paddr_t phys_addr_t;
 
diff --git a/xen/include/xen/time.h b/xen/include/xen/time.h
index 67c586b736..21e479aac8 100644
--- a/xen/include/xen/time.h
+++ b/xen/include/xen/time.h
@@ -29,7 +29,7 @@ struct vcpu;
  * of real time into system time 
  */
 
-typedef s64 s_time_t;
+typedef int64_t s_time_t;
 #define PRI_stime PRId64
 
 s_time_t get_s_time_fixed(u64 at_tick);
diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h
index 1bcc5a474f..7cb8d2388d 100644
--- a/xen/include/xen/types.h
+++ b/xen/include/xen/types.h
@@ -8,7 +8,6 @@
 typedef uint8_t u8;
 typedef uint16_t u16, __u16;
 typedef uint32_t u32, __u32;
-typedef int64_t s64;
 typedef uint64_t u64, __u64;
 
 #include <asm/types.h>
diff --git a/xen/lib/divmod.c b/xen/lib/divmod.c
index 0be6ccc700..0377d62130 100644
--- a/xen/lib/divmod.c
+++ b/xen/lib/divmod.c
@@ -46,8 +46,8 @@
  * one or more of the following formats.
  */
 union uu {
-    s64            q;              /* as a (signed) quad */
-    s64            uq;             /* as an unsigned quad */
+    int64_t        q;              /* as a (signed) quad */
+    uint64_t       uq;             /* as an unsigned quad */
     long           sl[2];          /* as two signed longs */
     unsigned long  ul[2];          /* as two unsigned longs */
 };
@@ -72,7 +72,7 @@ union uu {
  * and assembly.
  */
 #define CHAR_BIT        8               /* number of bits in a char */
-#define QUAD_BITS       (sizeof(s64) * CHAR_BIT)
+#define QUAD_BITS       (sizeof(int64_t) * CHAR_BIT)
 #define LONG_BITS       (sizeof(long) * CHAR_BIT)
 #define HALF_BITS       (sizeof(long) * CHAR_BIT / 2)
 
@@ -324,7 +324,7 @@ u64 __qdivrem(u64 uq, u64 vq, u64 *arq)
  * Divide two signed quads.
  * Truncates towards zero, as required by C99.
  */
-s64 __divdi3(s64 a, s64 b)
+int64_t __divdi3(int64_t a, int64_t b)
 {
     u64 ua, ub, uq;
     int neg = (a < 0) ^ (b < 0);
@@ -361,7 +361,7 @@ u64 __umoddi3(u64 a, u64 b)
  *  11 % -5 =  1
  * -11 % -5 = -1
  */
-s64 __moddi3(s64 a, s64 b)
+int64_t __moddi3(int64_t a, int64_t b)
 {
     u64 ua, ub, urem;
     int neg = (a < 0);
@@ -374,7 +374,7 @@ s64 __moddi3(s64 a, s64 b)
 /*
  * Quotient and remainder of unsigned long long division
  */
-s64 __ldivmod_helper(s64 a, s64 b, s64 *r)
+int64_t __ldivmod_helper(int64_t a, int64_t b, int64_t *r)
 {
     u64 ua, ub, rem, quot;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 06:34:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 06:34:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816648.1230801 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sz9E7-0002H9-0d; Fri, 11 Oct 2024 06:34:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816648.1230801; Fri, 11 Oct 2024 06: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 1sz9E6-0002Gz-T4; Fri, 11 Oct 2024 06:34:14 +0000
Received: by outflank-mailman (input) for mailman id 816648;
 Fri, 11 Oct 2024 06:34: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 1sz9E5-0002E4-9p
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:34: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 1sz9E5-00086d-9B
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:34:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sz9E5-0006Hh-8R
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:34:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Tt68xVP+tP32ssm9StMzi8lkpduPdl6Iq30N2W3RBgg=; b=wsC4iWDH5a/dB8N56I1H4geIUq
	ryZUD415GjSFjt3rSfQARm+pdvnIZg9093QyoibeinML8/aB34vMB9F+vpwV7gi5tGd4KLZW1Ofrj
	7cPBW5h+IfEvESB8Xpa/N+HE22A6QZpGocplC9E1P+5KgRGvcJ+TtAi9oUq9DN2DoFbg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] MAINTAINERS: Add myself as a reviewer for RISC-V
Message-Id: <E1sz9E5-0006Hh-8R@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 06:34:13 +0000

commit 3b79d825b5719f6654e4c95cdc17d65bb204213a
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Wed Oct 9 09:57:37 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Wed Oct 9 09:57:37 2024 +0200

    MAINTAINERS: Add myself as a reviewer for RISC-V
    
    As an active contributor to Xen's RISC-V port, so add myself
    to the list of reviewers.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 2450b0f9ff..f68ddd7f84 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -485,6 +485,7 @@ RISCV
 R:	Alistair Francis <alistair.francis@wdc.com>
 R:	Bob Eshleman <bobbyeshleman@gmail.com>
 R:	Connor Davis <connojdavis@gmail.com>
+R:	Oleksii Kurochko <oleksii.kurochko@gmail.com>
 S:	Supported
 F:	config/riscv64.mk
 F:	xen/arch/riscv/
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 06:34:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 06:34:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816650.1230804 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sz9EH-0002Nk-3C; Fri, 11 Oct 2024 06:34:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816650.1230804; Fri, 11 Oct 2024 06:34: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 1sz9EH-0002Nd-0W; Fri, 11 Oct 2024 06:34:25 +0000
Received: by outflank-mailman (input) for mailman id 816650;
 Fri, 11 Oct 2024 06:34: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 1sz9EF-0002MC-EK
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:34: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 1sz9EF-00086r-CY
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:34:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sz9EF-0006Id-BM
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:34:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fuXw3FAG6R/sw2Sw3zvAKs/8yERTexAYflxOCctRj4U=; b=XdOFbJkieEGU0FrDnNoAMesTZD
	q99PkBayTZO7EgWs63cPC3nf1zuj8VrVpb0F2br0atN/RZKOYf3hkBs1HV7Lv1wyUBiDWVLHC7IwR
	YiW1Jrr1ocA88uxpCqxYfKINJ8gYW5ukDUKamBDT/4r3xWoKB3IMQvgxWJ48YaLd5pxY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Stop building QEMU in general
Message-Id: <E1sz9EF-0006Id-BM@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 06:34:23 +0000

commit e305256e69b1c943db3ca20173da6ded3db2d252
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sat Jul 13 17:50:30 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 9 15:14:14 2024 +0100

    CI: Stop building QEMU in general
    
    We spend an awful lot of CI time building QEMU, even though most changes don't
    touch the subset of tools/libs/ used by QEMU.  Some numbers taken at a time
    when CI was otherwise quiet:
    
                           With     Without
      Alpine:              13m38s   6m04s
      Debian 12:           10m05s   8m10s
      OpenSUSE Tumbleweed: 11m40s   7m54s
      Ubuntu 24.04:        14m56s   8m06s
    
    which is a >50% improvement in wallclock time in some cases.
    
    The only build we have that needs QEMU is alpine-3.18-gcc-debug.  This is the
    build deployed and used by the QubesOS ADL-* and Zen3p-* jobs.
    
    Xilinx-x86_64 deploys it too, but is PVH-only and doesn't use QEMU.
    
    QEMU is also built by CirrusCI for FreeBSD (fully Clang/LLVM toolchain).
    
    This should help quite a lot with Gitlab CI capacity.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/build.yaml       |  1 +
 automation/scripts/build              |  7 ++-----
 automation/scripts/qemu-deps-check.py | 19 -------------------
 3 files changed, 3 insertions(+), 24 deletions(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index c668736bdc..c2db69ecf8 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -339,6 +339,7 @@ alpine-3.18-gcc-debug:
   extends: .gcc-x86-64-build-debug
   variables:
     CONTAINER: alpine:3.18
+    BUILD_QEMU_XEN: y
 
 debian-bookworm-gcc-debug:
   extends: .gcc-x86-64-build-debug
diff --git a/automation/scripts/build b/automation/scripts/build
index 34416297a4..952599cc25 100755
--- a/automation/scripts/build
+++ b/automation/scripts/build
@@ -91,11 +91,8 @@ else
         cfgargs+=("--with-extra-qemuu-configure-args=\"--disable-werror\"")
     fi
 
-    # Qemu requires Python 3.8 or later, and ninja
-    # and Clang 10 or later
-    if ! type python3 || ! python3 automation/scripts/qemu-deps-check.py \
-            || [[ "$cc_is_clang" == y && "$cc_ver" -lt 0x0a0000 ]] \
-            || ! type ninja; then
+    # QEMU is only for those who ask
+    if [[ "$BUILD_QEMU_XEN" != "y" ]]; then
         cfgargs+=("--with-system-qemu=/bin/false")
     fi
 
diff --git a/automation/scripts/qemu-deps-check.py b/automation/scripts/qemu-deps-check.py
deleted file mode 100755
index f6188afb3e..0000000000
--- a/automation/scripts/qemu-deps-check.py
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-import sys
-
-if sys.version_info < (3, 8):
-    print("Python %d.%d.%d too old" %
-          (sys.version_info.major,
-           sys.version_info.minor,
-           sys.version_info.micro))
-    exit(1)
-
-try:
-    import tomllib
-except ImportError:
-    try:
-        import tomli
-    except ImportError:
-        print("No tomli")
-        exit(1)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 06:34:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 06:34:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816653.1230808 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sz9ER-0002Qh-4f; Fri, 11 Oct 2024 06:34:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816653.1230808; Fri, 11 Oct 2024 06:34: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 1sz9ER-0002Qa-25; Fri, 11 Oct 2024 06:34:35 +0000
Received: by outflank-mailman (input) for mailman id 816653;
 Fri, 11 Oct 2024 06:34: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 1sz9EP-0002QG-Ga
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:34: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 1sz9EP-00087D-Fs
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:34:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sz9EP-0006JY-Ej
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:34:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=9FwvLuR03HkAjsi67ILdJir0uFLG7bVIF73ctoUjuJg=; b=BJbOxesEUPeUeOkNAM+Ai+hVQp
	JNyqLOOOY3uKvOb6Hmltofz/60xuJSkETYEM8UZ7C0pUL8FqaovPf72Ob/oO7eVBYlG6m8ZPrFDiQ
	5q7Co/J+TWsHMbNEnPv1Y6NHh6vJooEtUKVxVYN8aOpp6WtgmwrelnTsfWuyLla4K1Wk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/vlapic: Move lapic migration checks to the check hooks
Message-Id: <E1sz9EP-0006JY-Ej@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 06:34:33 +0000

commit eb48045d749193c020ec4e1eadceddb070947f18
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Thu Oct 10 10:52:43 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 10 10:52:43 2024 +0200

    x86/vlapic: Move lapic migration checks to the check hooks
    
    While doing this, factor out checks common to architectural and hidden
    state.
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/hvm/vlapic.c | 84 +++++++++++++++++++++++++++++++----------------
 1 file changed, 56 insertions(+), 28 deletions(-)

diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c
index 9a16dd0d77..3363926b48 100644
--- a/xen/arch/x86/hvm/vlapic.c
+++ b/xen/arch/x86/hvm/vlapic.c
@@ -1571,60 +1571,88 @@ static void lapic_load_fixup(struct vlapic *vlapic)
                v, vlapic->loaded.id, vlapic->loaded.ldr, good_ldr);
 }
 
-static int cf_check lapic_load_hidden(struct domain *d, hvm_domain_context_t *h)
-{
-    unsigned int vcpuid = hvm_load_instance(h);
-    struct vcpu *v;
-    struct vlapic *s;
 
+static int lapic_check_common(const struct domain *d, unsigned int vcpuid)
+{
     if ( !has_vlapic(d) )
         return -ENODEV;
 
     /* Which vlapic to load? */
-    if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
+    if ( !domain_vcpu(d, vcpuid) )
     {
-        dprintk(XENLOG_G_ERR, "HVM restore: dom%d has no apic%u\n",
+        dprintk(XENLOG_G_ERR, "HVM restore: dom%d has no vCPU %u\n",
                 d->domain_id, vcpuid);
         return -EINVAL;
     }
-    s = vcpu_vlapic(v);
+
+    return 0;
+}
+
+static int cf_check lapic_check_hidden(const struct domain *d,
+                                       hvm_domain_context_t *h)
+{
+    unsigned int vcpuid = hvm_load_instance(h);
+    struct hvm_hw_lapic s;
+    int rc = lapic_check_common(d, vcpuid);
+
+    if ( rc )
+        return rc;
+
+    if ( hvm_load_entry_zeroextend(LAPIC, h, &s) != 0 )
+        return -ENODATA;
+
+    /* EN=0 with EXTD=1 is illegal */
+    if ( (s.apic_base_msr & (APIC_BASE_ENABLE | APIC_BASE_EXTD)) ==
+         APIC_BASE_EXTD )
+        return -EINVAL;
+
+    return 0;
+}
+
+static int cf_check lapic_load_hidden(struct domain *d, hvm_domain_context_t *h)
+{
+    unsigned int vcpuid = hvm_load_instance(h);
+    struct vcpu *v = d->vcpu[vcpuid];
+    struct vlapic *s = vcpu_vlapic(v);
 
     if ( hvm_load_entry_zeroextend(LAPIC, h, &s->hw) != 0 )
+    {
+        ASSERT_UNREACHABLE();
         return -EINVAL;
+    }
 
     s->loaded.hw = 1;
     if ( s->loaded.regs )
         lapic_load_fixup(s);
 
-    if ( !(s->hw.apic_base_msr & APIC_BASE_ENABLE) &&
-         unlikely(vlapic_x2apic_mode(s)) )
-        return -EINVAL;
-
     hvm_update_vlapic_mode(v);
 
     return 0;
 }
 
-static int cf_check lapic_load_regs(struct domain *d, hvm_domain_context_t *h)
+static int cf_check lapic_check_regs(const struct domain *d,
+                                     hvm_domain_context_t *h)
 {
     unsigned int vcpuid = hvm_load_instance(h);
-    struct vcpu *v;
-    struct vlapic *s;
+    int rc;
 
-    if ( !has_vlapic(d) )
-        return -ENODEV;
+    if ( (rc = lapic_check_common(d, vcpuid)) )
+        return rc;
 
-    /* Which vlapic to load? */
-    if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) == NULL )
-    {
-        dprintk(XENLOG_G_ERR, "HVM restore: dom%d has no apic%u\n",
-                d->domain_id, vcpuid);
-        return -EINVAL;
-    }
-    s = vcpu_vlapic(v);
+    if ( !hvm_get_entry(LAPIC_REGS, h) )
+        return -ENODATA;
+
+    return 0;
+}
+
+static int cf_check lapic_load_regs(struct domain *d, hvm_domain_context_t *h)
+{
+    unsigned int vcpuid = hvm_load_instance(h);
+    struct vcpu *v = d->vcpu[vcpuid];
+    struct vlapic *s = vcpu_vlapic(v);
 
     if ( hvm_load_entry(LAPIC_REGS, h, s->regs) != 0 )
-        return -EINVAL;
+        ASSERT_UNREACHABLE();
 
     s->loaded.id = vlapic_get_reg(s, APIC_ID);
     s->loaded.ldr = vlapic_get_reg(s, APIC_LDR);
@@ -1641,9 +1669,9 @@ static int cf_check lapic_load_regs(struct domain *d, hvm_domain_context_t *h)
     return 0;
 }
 
-HVM_REGISTER_SAVE_RESTORE(LAPIC, lapic_save_hidden, NULL,
+HVM_REGISTER_SAVE_RESTORE(LAPIC, lapic_save_hidden, lapic_check_hidden,
                           lapic_load_hidden, 1, HVMSR_PER_VCPU);
-HVM_REGISTER_SAVE_RESTORE(LAPIC_REGS, lapic_save_regs, NULL,
+HVM_REGISTER_SAVE_RESTORE(LAPIC_REGS, lapic_save_regs, lapic_check_regs,
                           lapic_load_regs, 1, HVMSR_PER_VCPU);
 
 int vlapic_init(struct vcpu *v)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 06:34:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 06:34:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816654.1230811 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sz9Eb-0002UD-6I; Fri, 11 Oct 2024 06:34:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816654.1230811; Fri, 11 Oct 2024 06:34: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 1sz9Eb-0002U3-3g; Fri, 11 Oct 2024 06:34:45 +0000
Received: by outflank-mailman (input) for mailman id 816654;
 Fri, 11 Oct 2024 06:34: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 1sz9EZ-0002Tp-JM
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:34: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 1sz9EZ-00087S-In
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:34:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sz9EZ-0006Ld-I1
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:34:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=3pDzfoChNwQKX68MWsgDeYdb7Nylb0qmSsNX2t0UnbY=; b=2l0cuMGXqTL6kSUWVZ1DWNghQw
	gFeg9qbfBtpMDWDyLuQH7KzdwigEk/9hOJuTwAthLZG4CUtN5qwHCYzY/IX9EYFR/DVDkZs21dLPO
	DExQgtqrEX1fIKvXtkpPGa5TIWPB39a2w7Phcxt+x76KBdu5IdX2ajapjH7xs7O1wVi8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: Update header guards - ARGO
Message-Id: <E1sz9EZ-0006Ld-I1@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 06:34:43 +0000

commit 439f3e6757d9dfb94320c7e9cd293cf1283617f0
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Thu Oct 10 10:53:15 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 10 10:53:15 2024 +0200

    xen: Update header guards - ARGO
    
    Updated header related to ARGO.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Christopher Clark <christopher.w.clark@gmail.com>
---
 xen/include/xen/argo.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/include/xen/argo.h b/xen/include/xen/argo.h
index fd4cfdd55c..3ef62dab19 100644
--- a/xen/include/xen/argo.h
+++ b/xen/include/xen/argo.h
@@ -12,8 +12,8 @@
  * along with this program; If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef __XEN_ARGO_H__
-#define __XEN_ARGO_H__
+#ifndef XEN__ARGO_H
+#define XEN__ARGO_H
 
 #include <xen/sched.h>
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 06:34:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 06:34:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816655.1230815 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sz9El-0002XB-8R; Fri, 11 Oct 2024 06:34:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816655.1230815; Fri, 11 Oct 2024 06:34:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sz9El-0002X1-5T; Fri, 11 Oct 2024 06:34:55 +0000
Received: by outflank-mailman (input) for mailman id 816655;
 Fri, 11 Oct 2024 06:34: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 1sz9Ej-0002Wq-NO
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:34: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 1sz9Ej-00087a-Lc
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:34:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sz9Ej-0006Mn-Ky
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:34:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=bKlPF8P1ndez5MnnKTovpSe0uzahON4xmjzzyR91goA=; b=N1kQF2ayQDwlCWPYqvF6VFgBXJ
	+54kjY4s58blMy6FhpndEGDIg1Or0FSER770UWVlJ1PIvOYNEUPK1cM3PcYeBgs2A3qPR2gQ8ONi3
	uMRDMeA1OwEsE388eyO4USXaB3x5ScUvEuy3motoVcpBAlKE6yvUUSvi/Kroe4z0BnfA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: restore semicolon after explicit DS prefix
Message-Id: <E1sz9Ej-0006Mn-Ky@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 06:34:53 +0000

commit 4dec51ca72c7096b05fcd28640b5be873bd8f2db
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Oct 10 10:54:15 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 10 10:54:15 2024 +0200

    x86: restore semicolon after explicit DS prefix
    
    It's not unnecessary (as the earlier commit claimed): The integrated
    assembler of Clang up to 11 complains about an "invalid operand for
    instruction".
    
    Fixes: b42cf31d1165 ("x86: use alternative_input() in cache_flush()")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/flushtlb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/flushtlb.c b/xen/arch/x86/flushtlb.c
index 2a70c5151b..65be0474a8 100644
--- a/xen/arch/x86/flushtlb.c
+++ b/xen/arch/x86/flushtlb.c
@@ -286,7 +286,7 @@ void cache_flush(const void *addr, unsigned int size)
          * + prefix than a clflush + nop, and hence the prefix is added instead
          * of letting the alternative framework fill the gap by appending nops.
          */
-        alternative_input("ds clflush %[p]",
+        alternative_input("ds; clflush %[p]",/* Semicolon for Clang-IAS < 12 */
                           "data16 clflush %[p]", /* clflushopt */
                            X86_FEATURE_CLFLUSHOPT,
                            [p] "m" (*(const char *)(addr)));
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 06:35:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 06:35:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816656.1230820 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sz9Eu-0002aC-9W; Fri, 11 Oct 2024 06:35:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816656.1230820; Fri, 11 Oct 2024 06:35:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sz9Eu-0002a4-6s; Fri, 11 Oct 2024 06:35:04 +0000
Received: by outflank-mailman (input) for mailman id 816656;
 Fri, 11 Oct 2024 06:35: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 1sz9Et-0002Zy-P4
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:35: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 1sz9Et-00088L-OP
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:35:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sz9Et-0006Oc-No
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:35:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=scfW+bhO0RJd7WWRSH8BUWjoxlPyiMIOru+1wK5I3q8=; b=2tySpL+D7jVzj76/SaShmiaTdw
	XNWp7kqjvmMeJQ81PsLg+yyHAtUxXcra2K/d8vxZPNyCW+WofTPjXvtECmOlry008noinm2lFHdYn
	17xgfsuphzLnrXwOZrX6Ye4iFr/r/KcsURNLZAPqBdNkubrE6FgHL9UYs1/j3oCNMHYA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: implement virt_to_maddr()
Message-Id: <E1sz9Et-0006Oc-No@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 06:35:03 +0000

commit a11b3926c4e65ade35d94c3ebf93b7a54e614732
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Oct 10 10:54:46 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 10 10:54:46 2024 +0200

    xen/riscv: implement virt_to_maddr()
    
    Implement the virt_to_maddr() function to convert virtual addresses
    to machine addresses. The function includes checks for valid address
    ranges, specifically the direct mapping region (DIRECTMAP_VIRT_START)
    and the Xen's Linkage (XEN_VIRT_START) region. If the virtual address
    falls outside of these regions, an assertion will trigger.
    To implement this, the phys_offset variable is made accessible
    outside of riscv/mm.c.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/include/asm/config.h |  4 ++++
 xen/arch/riscv/include/asm/mm.h     | 22 +++++++++++++++++++++-
 xen/arch/riscv/mm.c                 |  2 +-
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/xen/arch/riscv/include/asm/config.h b/xen/arch/riscv/include/asm/config.h
index ef68281653..ad75871283 100644
--- a/xen/arch/riscv/include/asm/config.h
+++ b/xen/arch/riscv/include/asm/config.h
@@ -155,6 +155,10 @@
 
 #define IDENT_AREA_SIZE 64
 
+#ifndef __ASSEMBLY__
+extern unsigned long phys_offset; /* = load_start - XEN_VIRT_START */
+#endif
+
 #endif /* ASM__RISCV__CONFIG_H */
 /*
  * Local variables:
diff --git a/xen/arch/riscv/include/asm/mm.h b/xen/arch/riscv/include/asm/mm.h
index 5c79f3def3..ebb142502e 100644
--- a/xen/arch/riscv/include/asm/mm.h
+++ b/xen/arch/riscv/include/asm/mm.h
@@ -5,6 +5,7 @@
 
 #include <public/xen.h>
 #include <xen/bug.h>
+#include <xen/const.h>
 #include <xen/mm-frame.h>
 #include <xen/pdx.h>
 #include <xen/types.h>
@@ -28,7 +29,26 @@ static inline void *maddr_to_virt(paddr_t ma)
     return NULL;
 }
 
-#define virt_to_maddr(va) ({ BUG_ON("unimplemented"); 0; })
+/*
+ * virt_to_maddr() is expected to work with virtual addresses from either
+ * the directmap region or Xen's linkage (XEN_VIRT_START) region.
+ * Therefore, it is sufficient to check only these regions and assert if `va`
+ * is not within the directmap or Xen's linkage region.
+ */
+static inline unsigned long virt_to_maddr(unsigned long va)
+{
+    if ((va >= DIRECTMAP_VIRT_START) &&
+        (va < (DIRECTMAP_VIRT_START + DIRECTMAP_SIZE)))
+        return directmapoff_to_maddr(va - DIRECTMAP_VIRT_START);
+
+    BUILD_BUG_ON(XEN_VIRT_SIZE != MB(2));
+    ASSERT((va >> (PAGETABLE_ORDER + PAGE_SHIFT)) ==
+           (_AC(XEN_VIRT_START, UL) >> (PAGETABLE_ORDER + PAGE_SHIFT)));
+
+    /* phys_offset = load_start - XEN_VIRT_START */
+    return phys_offset + va;
+}
+#define virt_to_maddr(va) virt_to_maddr((unsigned long)(va))
 
 /* Convert between Xen-heap virtual addresses and machine frame numbers. */
 #define __virt_to_mfn(va)  mfn_x(maddr_to_mfn(virt_to_maddr(va)))
diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c
index 4a628aef83..daa02b2c60 100644
--- a/xen/arch/riscv/mm.c
+++ b/xen/arch/riscv/mm.c
@@ -26,7 +26,7 @@ struct mmu_desc {
     pte_t *pgtbl_base;
 };
 
-static unsigned long __ro_after_init phys_offset;
+unsigned long __ro_after_init phys_offset; /* = load_start - XEN_VIRT_START */
 
 #define LOAD_TO_LINK(addr) ((unsigned long)(addr) - phys_offset)
 #define LINK_TO_LOAD(addr) ((unsigned long)(addr) + phys_offset)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 06:35:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 06:35:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816657.1230824 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sz9F4-0002dh-BC; Fri, 11 Oct 2024 06:35:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816657.1230824; Fri, 11 Oct 2024 06:35:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sz9F4-0002dZ-8Q; Fri, 11 Oct 2024 06:35:14 +0000
Received: by outflank-mailman (input) for mailman id 816657;
 Fri, 11 Oct 2024 06:35: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 1sz9F3-0002dP-Rp
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:35: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 1sz9F3-00088c-R9
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:35:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sz9F3-0006QN-QW
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:35:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=LHJ9t6/Pe/eucu9aeU483EsaFnDVl6fDM1Epu4i2OBE=; b=FK17YWqdA1jeYOWeuXQzwQG7Ww
	pdIXP2PkeVW/W9Tb5LYnTnV9whsmRuXSSehfYZ6om/25ciVK1dIwXFy94rjRtbBjl3JYOWvyIsNbt
	kRFWmHF4f9xROiTT61i96vI38p5syAPbGQ3m8btfxHokOV2tnAbINx5SwW9OUFGytrGs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: switch LINK_TO_LOAD() to virt_to_maddr()
Message-Id: <E1sz9F3-0006QN-QW@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 06:35:13 +0000

commit 59ef5d2a953f97c1afdd744e6b6b54aebce5b17d
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Oct 10 10:55:05 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 10 10:55:05 2024 +0200

    xen/riscv: switch LINK_TO_LOAD() to virt_to_maddr()
    
    Use virt_to_maddr() instead of LINK_TO_LOAD as virt_to_maddr()
    covers all the cases where LINK_TO_LOAD() is used.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/mm.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c
index daa02b2c60..27026d803b 100644
--- a/xen/arch/riscv/mm.c
+++ b/xen/arch/riscv/mm.c
@@ -29,7 +29,6 @@ struct mmu_desc {
 unsigned long __ro_after_init phys_offset; /* = load_start - XEN_VIRT_START */
 
 #define LOAD_TO_LINK(addr) ((unsigned long)(addr) - phys_offset)
-#define LINK_TO_LOAD(addr) ((unsigned long)(addr) + phys_offset)
 
 /*
  * It is expected that Xen won't be more then 2 MB.
@@ -122,7 +121,7 @@ static void __init setup_initial_mapping(struct mmu_desc *mmu_desc,
                 unsigned long paddr = (page_addr - map_start) + pa_start;
                 unsigned int permissions = PTE_LEAF_DEFAULT;
                 unsigned long addr = is_identity_mapping
-                                     ? page_addr : LINK_TO_LOAD(page_addr);
+                                     ? page_addr : virt_to_maddr(page_addr);
                 pte_t pte_to_be_written;
 
                 index = pt_index(0, page_addr);
@@ -225,7 +224,7 @@ void __init setup_fixmap_mappings(void)
 
     BUG_ON(pte_is_valid(*pte));
 
-    tmp = paddr_to_pte(LINK_TO_LOAD((unsigned long)&xen_fixmap), PTE_TABLE);
+    tmp = paddr_to_pte(virt_to_maddr(&xen_fixmap), PTE_TABLE);
     write_pte(pte, tmp);
 
     RISCV_FENCE(rw, rw);
@@ -312,7 +311,7 @@ void __init remove_identity_mapping(void)
     pte_t *pgtbl;
     unsigned int index, xen_index;
     unsigned long ident_start =
-        LINK_TO_LOAD(turn_on_mmu) & XEN_PT_LEVEL_MAP_MASK(0);
+        virt_to_maddr(turn_on_mmu) & XEN_PT_LEVEL_MAP_MASK(0);
 
     for ( pgtbl = stage1_pgtbl_root, i = CONFIG_PAGING_LEVELS; i; i-- )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 06:35:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 06:35:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816658.1230828 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sz9FE-0002gg-CU; Fri, 11 Oct 2024 06:35:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816658.1230828; Fri, 11 Oct 2024 06:35:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1sz9FE-0002gY-9t; Fri, 11 Oct 2024 06:35:24 +0000
Received: by outflank-mailman (input) for mailman id 816658;
 Fri, 11 Oct 2024 06:35: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 1sz9FD-0002gS-V8
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:35: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 1sz9FD-00088o-UR
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:35:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1sz9FD-0006Rm-TN
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 06:35:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=MBzXIF7wrl0yj45AIe9kW3Du1VmM/WPsOKGeL3xmldg=; b=g0iUnmU+dzBbX3p+3nCo1VQs54
	s9ah1zKdNTb3qrO+EFM2cXLS5pdwCy0gSvjjhTSpJN3R6uqs3rvR7qQsRf/hz8GftO94PONylZwny
	L8Bni03uxMWu2t6OFzLo7v5Ky1DGoz/DntxZ3b/a1bXq5GxZSVXH+W/wTUcEKVMFt62A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: register Xen's load address as a boot module
Message-Id: <E1sz9FD-0006Rm-TN@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 06:35:23 +0000

commit 2b49ef4503e2c549c166f439cf0dd331d9a8874c
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Thu Oct 10 10:55:24 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 10 10:55:24 2024 +0200

    xen/riscv: register Xen's load address as a boot module
    
    Avoid using BOOTMOD_XEN region for other purposes or boot modules
    which could result in memory corruption or undefined behaviour.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/setup.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index 6d156c3a40..f531ca38ee 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0-only */
 
 #include <xen/bug.h>
+#include <xen/bootfdt.h>
 #include <xen/compile.h>
 #include <xen/device_tree.h>
 #include <xen/init.h>
@@ -44,6 +45,11 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
               "Please check your bootloader.\n",
               dtb_addr, BOOT_FDT_VIRT_SIZE);
 
+    /* Register Xen's load address as a boot module. */
+    if ( !add_boot_module(BOOTMOD_XEN, virt_to_maddr(_start),
+                          _end - _start, false) )
+        panic("Failed to add BOOTMOD_XEN\n");
+
     printk("All set up\n");
 
     machine_halt();
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 10:22:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 10:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816909.1231001 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1szCmb-0005va-Db; Fri, 11 Oct 2024 10:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816909.1231001; Fri, 11 Oct 2024 10: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 1szCmb-0005vS-B5; Fri, 11 Oct 2024 10:22:05 +0000
Received: by outflank-mailman (input) for mailman id 816909;
 Fri, 11 Oct 2024 10: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 1szCma-0005vF-0t
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 10: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 1szCmZ-00055k-Vf
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 10:22:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1szCmZ-0006ZI-R7
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 10: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=IIUyKeCq8upMX1XbsYh6DLR6i0+j2cle/RxPvScVOpg=; b=0TINneh1Ieb/RQZjDQfGN9Lbxl
	Ea/jmZqj6uTw/cLkE+GRqvOkQVAmM1NmBNfn53rQaPwRnArJoU6uFv4q8hD0a5zhwQb1yrWgDGrk/
	z5E6PnIiTwCceOB2m7h+4alTOnfZWlJLsCrk84COr/etLatuG2ylIKEN1Gmv2JjoGjHI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] config: update Mini-OS commit
Message-Id: <E1szCmZ-0006ZI-R7@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 10:22:03 +0000

commit 906cee8718589146e02da3391f292be12e5baa92
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Oct 10 17:54:57 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 11 11:09:52 2024 +0100

    config: update Mini-OS commit
    
    Update the Mini-OS upstream revision.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index 1a3938b6c4..6dd2f9439c 100644
--- a/Config.mk
+++ b/Config.mk
@@ -224,7 +224,7 @@ QEMU_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/qemu-xen.git
 QEMU_UPSTREAM_REVISION ?= master
 
 MINIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/mini-os.git
-MINIOS_UPSTREAM_REVISION ?= 8b038c7411ae7e823eaf6d15d5efbe037a07197a
+MINIOS_UPSTREAM_REVISION ?= 80ef70f92cb7b95ef48deea1157f2194b10b8c05
 
 SEABIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/seabios.git
 SEABIOS_UPSTREAM_REVISION ?= rel-1.16.3
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 10:22:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 10:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816910.1231006 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1szCml-0005xK-Ev; Fri, 11 Oct 2024 10:22:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816910.1231006; Fri, 11 Oct 2024 10: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 1szCml-0005xC-CN; Fri, 11 Oct 2024 10:22:15 +0000
Received: by outflank-mailman (input) for mailman id 816910;
 Fri, 11 Oct 2024 10: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 1szCmk-0005wv-5O
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 10: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 1szCmk-000569-3d
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 10:22:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1szCmk-0006a8-1V
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 10: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=iohIvr1x92zhyAh1nQjH1Rp0HrUkWyfhu+Irn8DKegU=; b=WB3bQywFM0A0v2Epgdp/D8UHpW
	F/FPwauQC42BteCCiknqw6tmZpsvrQCvx0rtvLuI1yMi6+DO4UN4Hk7nzcgSqzf12/5f+qKIXiI0I
	63pCtYzls5WsLQ2j3MPF5L06/J6HBs5ddlAdSLdvxS9AMgaynv2gm76RqrsOLlBkbo60=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] tools/xenstored: remove unneeded libxenguest reference
Message-Id: <E1szCmk-0006a8-1V@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 10:22:14 +0000

commit 45333e28885b27b77eb5778214a580f4760c9eaf
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Oct 10 17:54:58 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 11 11:09:52 2024 +0100

    tools/xenstored: remove unneeded libxenguest reference
    
    Today the xenstored Makefile contains an unneeded reference to the
    not used libxenguest library.
    
    Remove it.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/xenstored/Makefile.common | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tools/xenstored/Makefile.common b/tools/xenstored/Makefile.common
index ef63ef650c..27fdb3b49e 100644
--- a/tools/xenstored/Makefile.common
+++ b/tools/xenstored/Makefile.common
@@ -13,7 +13,6 @@ XENSTORED_OBJS-$(CONFIG_MiniOS) += minios.o lu_minios.o
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
 CFLAGS += $(CFLAGS_libxenevtchn)
 CFLAGS += $(CFLAGS_libxenctrl)
-CFLAGS += $(CFLAGS_libxenguest)
 CFLAGS += $(CFLAGS_libxentoolcore)
 
 $(XENSTORED_OBJS-y): CFLAGS += $(CFLAGS_libxengnttab)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 10:22:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 10:22:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.816911.1231009 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1szCmv-0005zm-GB; Fri, 11 Oct 2024 10:22:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 816911.1231009; Fri, 11 Oct 2024 10: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 1szCmv-0005zf-Dj; Fri, 11 Oct 2024 10:22:25 +0000
Received: by outflank-mailman (input) for mailman id 816911;
 Fri, 11 Oct 2024 10:22: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 1szCmu-0005zW-7X
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 10:22: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 1szCmu-00057s-6g
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 10:22:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1szCmu-0006b3-5j
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 10:22: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=dbHWYFM+427CYdWxA9ty8JAuLMqSmDVYseULFbogl/I=; b=YC617oqfoBTRWng8JMt6oSff2H
	W9/IMu1MR/gXlnbAnmSYHBl/EY1f44zRdvc36+tgV3Ydb05S+F//enpQZmQp+eOd8ppsMNKJRkzr0
	d8+1pP8jwzEvC+jAfii1Ph6S/9B2ajHPaCgrP9h2WTqvPrZXIyslnnSdRnA8C7xy8GfE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] stubdom: use real lib dependencies for xenstore stubdoms
Message-Id: <E1szCmu-0006b3-5j@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 10:22:24 +0000

commit 76a54badf890f56ff72644593c0fbc72138e13aa
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Oct 10 17:54:59 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 11 11:09:52 2024 +0100

    stubdom: use real lib dependencies for xenstore stubdoms
    
    Today the build of Xenstore stubdoms depend on libxenguest just because
    libxenguest depends on all needed libraries. In reality there is no
    dependency on libxenguest for Xenstore stubdoms.
    
    Use the actual dependencies instead.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 stubdom/Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/stubdom/Makefile b/stubdom/Makefile
index 6ed4253b25..2a81af28a1 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -523,12 +523,14 @@ else
 pv-grub-if-enabled:
 endif
 
+XENSTORE_DEPS := libxenevtchn libxengnttab libxenctrl
+
 .PHONY: xenstore-stubdom
-xenstore-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstore libxenguest xenstore
+xenstore-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstore $(XENSTORE_DEPS) xenstore
 	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/xenstore-minios.gen.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/xenstore/xenstored.a
 
 .PHONY: xenstorepvh-stubdom
-xenstorepvh-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstorepvh libxenguest xenstorepvh
+xenstorepvh-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstorepvh $(XENSTORE_DEPS) xenstorepvh
 	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/xenstorepvh-minios.gen.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/xenstorepvh/xenstored.a
 
 #########
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 19:22:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 19:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.817332.1231362 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1szLD8-0002uA-SZ; Fri, 11 Oct 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 817332.1231362; Fri, 11 Oct 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 1szLD8-0002u2-Px; Fri, 11 Oct 2024 19:22:02 +0000
Received: by outflank-mailman (input) for mailman id 817332;
 Fri, 11 Oct 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 1szLD7-0002tw-J1
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 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 1szLD7-0006gb-H6
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 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 1szLD7-0005q7-FO
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 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=d6Jtw0AxErEukiAyOE3MkgZufbYpdED/hryB+E6fyzE=; b=HeNVHgPxJZFXhJ0/Qj05n2rEN8
	bojBdAAP0vBXUurTjMT+xVD0H2VcCpeXNF4C5605ZWKCK/UB6urrSePkucvII8Q9lvJBRpFARnSRY
	KKfU/XiD0G6NukClKMe1xGFxoFC80HotAKjM4c1ZjkEuwdh3AZihp7BQLR/+zARDtxbo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Flask: replace uses of __u32
Message-Id: <E1szLD7-0005q7-FO@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 19:22:01 +0000

commit c73adc9cf8d2ce100878160df351c0ca90b3bf7d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Oct 10 10:59:38 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 10 10:59:38 2024 +0200

    Flask: replace uses of __u32
    
    ... by uint32_t.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/xsm/flask/ss/conditional.h | 4 ++--
 xen/xsm/flask/ss/policydb.h    | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/xsm/flask/ss/conditional.h b/xen/xsm/flask/ss/conditional.h
index 500fe4305a..7067596d69 100644
--- a/xen/xsm/flask/ss/conditional.h
+++ b/xen/xsm/flask/ss/conditional.h
@@ -29,8 +29,8 @@ struct cond_expr {
 #define COND_EQ        6 /* bool == bool */
 #define COND_NEQ    7 /* bool != bool */
 #define COND_LAST    COND_NEQ
-    __u32 expr_type;
-    __u32 bool_val;
+    uint32_t expr_type;
+    uint32_t bool_val;
     struct cond_expr *next;
 };
 
diff --git a/xen/xsm/flask/ss/policydb.h b/xen/xsm/flask/ss/policydb.h
index d3b409a554..b1c26f26bc 100644
--- a/xen/xsm/flask/ss/policydb.h
+++ b/xen/xsm/flask/ss/policydb.h
@@ -131,7 +131,7 @@ struct range_trans {
 
 /* Boolean data type */
 struct cond_bool_datum {
-    __u32 value;        /* internal type value */
+    uint32_t value;        /* internal type value */
     int state;
 };
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 19:22:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 19:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.817333.1231367 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1szLDI-0002vg-U8; Fri, 11 Oct 2024 19:22:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 817333.1231367; Fri, 11 Oct 2024 19: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 1szLDI-0002vY-RN; Fri, 11 Oct 2024 19:22:12 +0000
Received: by outflank-mailman (input) for mailman id 817333;
 Fri, 11 Oct 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 1szLDH-0002vS-MA
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 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 1szLDH-0006h4-KI
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 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 1szLDH-0005rC-JQ
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 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=Y1Y6EmzO/qhAVfMxXCMfwOBRR98UbXZLUaKlIx7qVpg=; b=M5W9pj4FOrgKk0RqN6IRIUDcLn
	uNA05htsykXjmIwc7QSThaMXG1MqT/x5LeB5D9CdrsA92pyaZLraGcPzTNFK/XuJ9K38dtL9ExHJF
	IcqmUf2Bg0iH3KXgptSp1TQfLVqUChYMMyyZicNWE+n9kSnflq7CvPeAWDh48mVN9m9E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ocaml/libs: Remove xsd_glue_dev package, package plugin_interface_v1.a
Message-Id: <E1szLDH-0005rC-JQ@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 19:22:11 +0000

commit a592c98f94a1a58838acd3f4cc8b55132b1061c0
Author:     Andrii Sultanov <andrii.sultanov@cloud.com>
AuthorDate: Wed Oct 9 16:15:20 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 10 13:48:12 2024 +0100

    ocaml/libs: Remove xsd_glue_dev package, package plugin_interface_v1.a
    
    xsd_glue_dev packaging is inconsistent with the rest of OCaml packages and
    isn't actually necessary. The .a is needed alongside compiled bytecode files
    during linking and was missed in the initial oxenstored plugin work.
    
    Specify OCAMLCFLAGS along with OCAMLOPTFLAGS.
    
    Signed-off-by: Andrii Sultanov <andrii.sultanov@cloud.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
---
 tools/ocaml/libs/xsd_glue/Makefile | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/tools/ocaml/libs/xsd_glue/Makefile b/tools/ocaml/libs/xsd_glue/Makefile
index f84291f7fe..be68642968 100644
--- a/tools/ocaml/libs/xsd_glue/Makefile
+++ b/tools/ocaml/libs/xsd_glue/Makefile
@@ -5,6 +5,7 @@ include $(OCAML_TOPLEVEL)/common.make
 SUBDIRS= domain_getinfo_plugin_v1
 
 CFLAGS += $(CFLAGS_xeninclude)
+OCAMLCFLAGS += -opaque
 OCAMLOPTFLAGS += -opaque
 
 OBJS = plugin_interface_v1
@@ -28,14 +29,11 @@ OCAML_NOC_LIBRARY = plugin_interface_v1
 install: $(LIBS) META subdirs-install
 	mkdir -p $(OCAMLDESTDIR)
 	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xsd_glue
-	$(OCAMLFIND) install -destdir $(OCAMLDESTDIR) -ldconf ignore xsd_glue META $(INTF) $(LIBS)
-	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xsd_glue_dev
-	$(OCAMLFIND) install -destdir $(OCAMLDESTDIR) -ldconf ignore xsd_glue_dev META $(INTF) $(LIBS) *.ml *.mli
+	$(OCAMLFIND) install -destdir $(OCAMLDESTDIR) -ldconf ignore xsd_glue META $(INTF) $(LIBS) *.a
 
 .PHONY: uninstall
 uninstall: subdirs-uninstall
 	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xsd_glue
-	$(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xsd_glue_dev
 
 .PHONY: clean
 clean: subdirs-clean
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 19:22:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 19:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.817334.1231371 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1szLDS-0002y6-Vr; Fri, 11 Oct 2024 19:22:22 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 817334.1231371; Fri, 11 Oct 2024 19: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 1szLDS-0002xw-Sv; Fri, 11 Oct 2024 19:22:22 +0000
Received: by outflank-mailman (input) for mailman id 817334;
 Fri, 11 Oct 2024 19: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 1szLDR-0002xk-QA
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 19: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 1szLDR-0006hZ-PH
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 19:22:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1szLDR-0005s5-MR
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 19: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=0dtzGbCYBPF1Ks5w/2k50I2KrMbW81xNFJkIQAF9M18=; b=5BNgITOm/RjlLHP/hJrRtJ/eQ6
	eII1zakcq739oRsZcxdBYNIAwYPnUqnzE4lLkFwYiVxXBnPl1M856n8312ploPBwfPif6MGJnNy+R
	CRsQ8sHFtEHcQEh33D/AqKbF5dRUHQeZ9vu2Zx6sDaL2/jq9Yi0Vblz3YNaMmtoYZfCU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] stubdom: add fine grained library config items to Mini-OS configs
Message-Id: <E1szLDR-0005s5-MR@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 19:22:21 +0000

commit b5b9420334229ea295679a6fbb436f2ac3824147
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Oct 10 13:19:46 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 10 14:09:41 2024 +0100

    stubdom: add fine grained library config items to Mini-OS configs
    
    Today Mini-OS can only be configured to use all or no Xen libraries.
    In order to prepare a more fine grained configuration scheme, add per
    library config items to the Mini-OS config files.
    
    As some libraries pull in others, the config files need to be
    extended at build time to reflect those indirect library uses.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
---
 stubdom/.gitignore |  1 +
 stubdom/Makefile   | 49 +++++++++++++++++++++++++++++++++++++------------
 2 files changed, 38 insertions(+), 12 deletions(-)

diff --git a/stubdom/.gitignore b/stubdom/.gitignore
index 10e2547a22..23350446b9 100644
--- a/stubdom/.gitignore
+++ b/stubdom/.gitignore
@@ -1,3 +1,4 @@
+*.gen.cfg
 /*.tar.gz
 /*-minios-config.mk
 /autom4te.cache/
diff --git a/stubdom/Makefile b/stubdom/Makefile
index f8c31fd35d..6ed4253b25 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -342,6 +342,14 @@ endef
 
 $(foreach lib,$(STUB_LIBS),$(eval $(call BUILD_lib,$(lib))))
 
+define GEN_config
+ (cat $< && \
+ for i in $(sort $(APP_LIBS) $(call xenlibs-dependencies,$(APP_LIBS))); do \
+   u=`echo $$i | tr a-z A-Z`; \
+   echo "CONFIG_LIBXEN$$u=y"; \
+ done)
+endef
+
 xenstore/stamp: $(XEN_ROOT)/tools/xenstored/Makefile.common
 	$(do_links)
 
@@ -375,8 +383,12 @@ $(TARGETS_MINIOS): mini-os-%:
 # ioemu
 #######
 
-ioemu-minios-config.mk: $(CURDIR)/ioemu-minios.cfg
-	MINIOS_CONFIG="$<" CONFIG_FILE="$(CURDIR)/$@" $(MAKE) DESTDIR= -C $(MINI_OS) config
+ioemu-minios.gen.cfg: APP_LIBS = evtchn gnttab ctrl guest
+ioemu-minios.gen.cfg: ioemu-minios.cfg Makefile
+	$(GEN_config) >$@
+
+ioemu-minios-config.mk: ioemu-minios.gen.cfg
+	MINIOS_CONFIG="$(CURDIR)/$<" CONFIG_FILE="$(CURDIR)/$@" $(MAKE) DESTDIR= -C $(MINI_OS) config
 
 .PHONY: ioemu
 ioemu: cross-zlib cross-libpci libxenguest ioemu-minios-config.mk
@@ -437,8 +449,12 @@ grub-upstream: grub-$(GRUB_VERSION).tar.gz
 		patch -d $@ -p1 < $$i || exit 1; \
 	done
 
-grub-$(XEN_TARGET_ARCH)-minios-config.mk: $(CURDIR)/grub/minios.cfg
-	MINIOS_CONFIG="$<" CONFIG_FILE="$(CURDIR)/$@" $(MAKE) DESTDIR= -C $(MINI_OS) config
+grub/minios.gen.cfg: APP_LIBS = guest ctrl toollog
+grub/minios.gen.cfg: grub/minios.cfg Makefile
+	$(GEN_config) >$@
+
+grub-$(XEN_TARGET_ARCH)-minios-config.mk: grub/minios.gen.cfg
+	MINIOS_CONFIG="$(CURDIR)/$<" CONFIG_FILE="$(CURDIR)/$@" $(MAKE) DESTDIR= -C $(MINI_OS) config
 
 .PHONY: grub
 grub: cross-polarssl grub-upstream $(CROSS_ROOT) grub-$(XEN_TARGET_ARCH)-minios-config.mk
@@ -449,8 +465,12 @@ grub: cross-polarssl grub-upstream $(CROSS_ROOT) grub-$(XEN_TARGET_ARCH)-minios-
 # xenstore
 ##########
 
-xenstore-minios-config.mk: $(CURDIR)/xenstore-minios.cfg
-	MINIOS_CONFIG="$<" CONFIG_FILE="$(CURDIR)/$@" $(MAKE) DESTDIR= -C $(MINI_OS) config
+xenstore-minios.gen.cfg: APP_LIBS = gnttab evtchn toollog ctrl
+xenstore-minios.gen.cfg: xenstore-minios.cfg Makefile
+	$(GEN_config) >$@
+
+xenstore-minios-config.mk: xenstore-minios.gen.cfg
+	MINIOS_CONFIG="$(CURDIR)/$<" CONFIG_FILE="$(CURDIR)/$@" $(MAKE) DESTDIR= -C $(MINI_OS) config
 
 .PHONY: xenstore
 xenstore: $(CROSS_ROOT) xenstore-minios-config.mk
@@ -460,8 +480,12 @@ xenstore: $(CROSS_ROOT) xenstore-minios-config.mk
 # xenstorepvh
 #############
 
-xenstorepvh-minios-config.mk: $(CURDIR)/xenstorepvh-minios.cfg
-	MINIOS_CONFIG="$<" CONFIG_FILE="$(CURDIR)/$@" $(MAKE) DESTDIR= -C $(MINI_OS) config
+xenstorepvh-minios.gen.cfg: APP_LIBS = gnttab evtchn toollog ctrl
+xenstorepvh-minios.gen.cfg: xenstorepvh-minios.cfg Makefile
+	$(GEN_config) >$@
+
+xenstorepvh-minios-config.mk: xenstorepvh-minios.gen.cfg
+	MINIOS_CONFIG="$(CURDIR)/$<" CONFIG_FILE="$(CURDIR)/$@" $(MAKE) DESTDIR= -C $(MINI_OS) config
 
 .PHONY: xenstorepvh
 xenstorepvh: $(CROSS_ROOT) xenstorepvh-minios-config.mk
@@ -474,7 +498,7 @@ xenstorepvh: $(CROSS_ROOT) xenstorepvh-minios-config.mk
 .PHONY: ioemu-stubdom
 ioemu-stubdom: APP_OBJS=$(CURDIR)/ioemu/i386-stubdom/qemu.a $(CURDIR)/ioemu/i386-stubdom/libqemu.a $(CURDIR)/ioemu/libqemu_common.a
 ioemu-stubdom: mini-os-$(XEN_TARGET_ARCH)-ioemu lwip-$(XEN_TARGET_ARCH) libxenguest ioemu
-	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/ioemu-minios.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS="$(APP_OBJS)"
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/ioemu-minios.gen.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< LWIPDIR=$(CURDIR)/lwip-$(XEN_TARGET_ARCH) APP_OBJS="$(APP_OBJS)"
 
 .PHONY: c-stubdom
 c-stubdom: mini-os-$(XEN_TARGET_ARCH)-c lwip-$(XEN_TARGET_ARCH) libxenguest c
@@ -490,7 +514,7 @@ vtpmmgr-stubdom: mini-os-$(XEN_TARGET_ARCH)-vtpmmgr vtpmmgr
 
 .PHONY: pv-grub
 pv-grub: mini-os-$(XEN_TARGET_ARCH)-grub libxenguest grub
-	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/grub/minios.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/grub-$(XEN_TARGET_ARCH)/main.a
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/grub/minios.gen.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/grub-$(XEN_TARGET_ARCH)/main.a
 
 .PHONY: pv-grub-if-enabled
 ifneq ($(filter grub,$(STUBDOM_TARGETS)),)
@@ -501,11 +525,11 @@ endif
 
 .PHONY: xenstore-stubdom
 xenstore-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstore libxenguest xenstore
-	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/xenstore-minios.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/xenstore/xenstored.a
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/xenstore-minios.gen.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/xenstore/xenstored.a
 
 .PHONY: xenstorepvh-stubdom
 xenstorepvh-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstorepvh libxenguest xenstorepvh
-	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/xenstorepvh-minios.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/xenstorepvh/xenstored.a
+	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/xenstorepvh-minios.gen.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/xenstorepvh/xenstored.a
 
 #########
 # install
@@ -607,6 +631,7 @@ clean:
 	rm -fr grub-$(XEN_TARGET_ARCH)
 	rm -f $(STUBDOMPATH)
 	rm -f *-minios-config.mk
+	rm -f *.gen.cfg
 	rm -fr pkg-config
 	-[ ! -d ioemu ] || $(MAKE) DESTDIR= -C ioemu clean
 	-[ ! -d xenstore ] || $(MAKE) -f $(CURDIR)/xenlibs.mk -C xenstore clean
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 19:22:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 19:22:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.817335.1231374 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1szLDd-00030T-0u; Fri, 11 Oct 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 817335.1231374; Fri, 11 Oct 2024 19: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 1szLDc-00030L-UX; Fri, 11 Oct 2024 19:22:32 +0000
Received: by outflank-mailman (input) for mailman id 817335;
 Fri, 11 Oct 2024 19: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 1szLDb-000308-Tu
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 19: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 1szLDb-0006jE-TA
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 19:22:31 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1szLDb-0005su-RS
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 19: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=i6S9DTOiEB3z9lQAcvCymJ+GvM8plQIx2JUCm9TntpI=; b=GmtK0EFA1fCAlidC9UbZNWTMPE
	pbCbTFuIuRRxJGG+0484QNIzW0SXA2OVKfrTiFyjU+mCFTG0m4l9kfLfundPqhPzNbmi+59j5qLFz
	ybxwCFSliPfIriJ0O90LnLn+2dQLH7/pdCYMMWOHepPsAyd8XrKisaU8P4ohVXt2O+jE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] dt-overlay: Fix NULL pointer dereference
Message-Id: <E1szLDb-0005su-RS@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 19:22:31 +0000

commit 95f2a5656e65010ee86afd2ac3ad072cdf36a97a
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Oct 4 14:22:15 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Oct 10 16:18:56 2024 +0100

    dt-overlay: Fix NULL pointer dereference
    
    Attempt to attach an overlay (xl dt-overlay attach) to a domain without
    first adding this overlay to Xen (xl dt-overlay add) results in an
    overlay track entry being NULL in handle_attach_overlay_nodes(). This
    leads to NULL pointer dereference and the following data abort crash:
    
    (XEN) Cannot find any matching tracker with input dtbo. Operation is supported only for prior added dtbo.
    (XEN) Data Abort Trap. Syndrome=0x5
    (XEN) Walking Hypervisor VA 0x40 on CPU0 via TTBR 0x0000000046948000
    (XEN) 0TH[0x000] = 0x46940f7f
    (XEN) 1ST[0x000] = 0x0
    (XEN) CPU0: Unexpected Trap: Data Abort
    (XEN) ----[ Xen-4.20-unstable  arm64  debug=y  Not tainted ]----
    ...
    (XEN) Xen call trace:
    (XEN)    [<00000a0000208b30>] dt_overlay_domctl+0x304/0x370 (PC)
    (XEN)    [<00000a0000208b30>] dt_overlay_domctl+0x304/0x370 (LR)
    (XEN)    [<00000a0000274b7c>] arch_do_domctl+0x48/0x328
    
    Fixes: 4c733873b5c2 ("xen/arm: Add XEN_DOMCTL_dt_overlay and device attachment to domains")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/dt-overlay.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/common/dt-overlay.c b/xen/common/dt-overlay.c
index d53b4706cd..8606b14d1e 100644
--- a/xen/common/dt-overlay.c
+++ b/xen/common/dt-overlay.c
@@ -908,8 +908,11 @@ static long handle_attach_overlay_nodes(struct domain *d,
  out:
     spin_unlock(&overlay_lock);
 
-    rangeset_destroy(entry->irq_ranges);
-    rangeset_destroy(entry->iomem_ranges);
+    if ( entry )
+    {
+        rangeset_destroy(entry->irq_ranges);
+        rangeset_destroy(entry->iomem_ranges);
+    }
 
     return rc;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 19:22:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 19:22:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.817336.1231379 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1szLDn-00033D-3F; Fri, 11 Oct 2024 19:22:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 817336.1231379; Fri, 11 Oct 2024 19:22:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1szLDm-000335-W7; Fri, 11 Oct 2024 19:22:42 +0000
Received: by outflank-mailman (input) for mailman id 817336;
 Fri, 11 Oct 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 1szLDm-00032p-0r
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 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 1szLDm-0006jL-07
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 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 1szLDl-0005tl-VU
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 2024 19: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=W49yMhQxZPhKTZ4Vg+9gFHAick58/91En079Z4ajO+c=; b=wNXCqW0RwUm7CXJ4cDXdDBKDBn
	tGJbMKcbSbnKrdS4JjNYhxFZhV+RC2nqpw1fAbmeHqRdd6K8c282dxyjSABEZ9RVnk9319wFbEHbT
	WHU/dMp9SKZAPvGoaZZJlQw/D2mS2b02Hkkfure8OD9Ac12Vp0AuxP4AQn8OhwofM8SE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] device-tree: Remove __init from unflatten_dt_alloc()
Message-Id: <E1szLDl-0005tl-VU@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 19:22:41 +0000

commit 656ac422c40b358fdcd8729b2d1ee17d423955cd
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Oct 4 14:22:16 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Oct 10 16:18:56 2024 +0100

    device-tree: Remove __init from unflatten_dt_alloc()
    
    With CONFIG_OVERLAY_DTB=y, unflatten_dt_alloc() is used as part of
    unflatten_dt_node() used during runtime. In case of a binary compiled
    such as unflatten_dt_alloc() does not get inlined (e.g. using -Og),
    attempt to add an overlay to Xen (xl dt-overlay add) results in a crash.
    
    (XEN) Instruction Abort Trap. Syndrome=0x7
    (XEN) Walking Hypervisor VA 0xa00002c8cc0 on CPU2 via TTBR 0x0000000040340000
    (XEN) 0TH[0x014] = 0x4033ff7f
    (XEN) 1ST[0x000] = 0x4033ef7f
    (XEN) 2ND[0x001] = 0x4000004033af7f
    (XEN) 3RD[0x0c8] = 0x0
    (XEN) CPU2: Unexpected Trap: Instruction Abort
    (XEN) ----[ Xen-4.20-unstable  arm64  debug=y  Not tainted ]----
    ...
    (XEN) Xen call trace:
    (XEN)    [<00000a00002c8cc0>] 00000a00002c8cc0 (PC)
    (XEN)    [<00000a0000202410>] device-tree.c#unflatten_dt_node+0xd0/0x504 (LR)
    (XEN)    [<00000a0000204484>] unflatten_device_tree+0x54/0x1a0
    (XEN)    [<00000a000020800c>] dt-overlay.c#handle_add_overlay_nodes+0x290/0x3d4
    (XEN)    [<00000a0000208360>] dt_overlay_sysctl+0x8c/0x110
    (XEN)    [<00000a000027714c>] arch_do_sysctl+0x1c/0x2c
    
    Fixes: 9e9d2c079dc4 ("xen/arm/device: Remove __init from function type")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/device-tree/device-tree.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/common/device-tree/device-tree.c b/xen/common/device-tree/device-tree.c
index 8d1017a49d..d0528c5825 100644
--- a/xen/common/device-tree/device-tree.c
+++ b/xen/common/device-tree/device-tree.c
@@ -120,8 +120,8 @@ void dt_child_set_range(__be32 **cellp, int addrcells, int sizecells,
     dt_set_cell(cellp, sizecells, size);
 }
 
-static void __init *unflatten_dt_alloc(unsigned long *mem, unsigned long size,
-                                       unsigned long align)
+static void *unflatten_dt_alloc(unsigned long *mem, unsigned long size,
+                                unsigned long align)
 {
     void *res;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 19:22:53 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 19:22:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.817337.1231382 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1szLDx-00036R-41; Fri, 11 Oct 2024 19:22:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 817337.1231382; Fri, 11 Oct 2024 19:22:53 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1szLDx-00036J-1S; Fri, 11 Oct 2024 19:22:53 +0000
Received: by outflank-mailman (input) for mailman id 817337;
 Fri, 11 Oct 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 1szLDw-000367-4d
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 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 1szLDw-0006jS-3s
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 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 1szLDw-0005uY-2G
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 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=uqBJB6Yj07S1gzPvVr732dE/dNclCV2zdugy7+IRS2c=; b=SuzAn4TRYZeQRd2jxC9NDffsIP
	eFm4zHT5wKc4D6xzKMO/xfAIqZQPb4u9mZtdpQ9csfbmgn3WappPH5dchBmvW5/ZuRASiAXmtCOlG
	f8K2qqEqTXtU5eqDXLp6wlAzJPF61yEEanAIBlwUHO7EQd8Uz2YpN73rysu3KvHr+vB4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] dt-overlay: Remove ASSERT_UNREACHABLE from add_nodes()
Message-Id: <E1szLDw-0005uY-2G@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 19:22:52 +0000

commit 81862825e8139a81c51fece39a05768736e4bf5d
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Oct 4 14:22:17 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Oct 10 16:18:56 2024 +0100

    dt-overlay: Remove ASSERT_UNREACHABLE from add_nodes()
    
    The assumption stated in the comment that the code will never get there
    is incorrect. In overlay_get_nodes_info() we manually combine path from
    target-path property with the node path by adding '/' as a separator.
    This can differ from a path obtained by libfdt due to more advanced
    logic used there which can for instance get rid of excessive slashes.
    In case of incorrect target-path (e.g. target-path = "//axi"), the
    comparison in dt_find_node_by_path_from() can fail triggering the assert
    in debug builds.
    
    Fixes: 0c0facdab6f5 ("xen/arm: Implement device tree node addition functionalities")
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/common/dt-overlay.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/xen/common/dt-overlay.c b/xen/common/dt-overlay.c
index 8606b14d1e..d18bd12bd3 100644
--- a/xen/common/dt-overlay.c
+++ b/xen/common/dt-overlay.c
@@ -596,11 +596,7 @@ static long add_nodes(struct overlay_track *tr, char **nodes_full_path)
         overlay_node = dt_find_node_by_path_from(tr->dt_host_new,
                                                  nodes_full_path[j]);
         if ( overlay_node == NULL )
-        {
-            /* Sanity check. But code will never come here. */
-            ASSERT_UNREACHABLE();
             return -EFAULT;
-        }
 
         /*
          * Find previous and next node to overlay_node in dt_host_new. We will
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 19:23:03 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 19:23:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.817338.1231387 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1szLE7-00039E-6L; Fri, 11 Oct 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 817338.1231387; Fri, 11 Oct 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 1szLE7-000397-36; Fri, 11 Oct 2024 19:23:03 +0000
Received: by outflank-mailman (input) for mailman id 817338;
 Fri, 11 Oct 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 1szLE6-00038x-7W
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 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 1szLE6-0006jp-6s
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 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 1szLE6-0005vA-62
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 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=CT1RVV6oQ4vrabcI5EzIgiNLu7dO6dN71hJuhrmxSVA=; b=H4Ljz8NiPFwFCrF2DZcXFSwMPU
	qBPJqdhZKf3cVQPoksFCS3NICdA9EH8i217e4dIFMN55QPtxZf/j0z5mbKQwktF9o9sDvJ/QVEJQb
	dg2oIe/QcGQ85fEp9XrrSfIGhmS4hMcv6gbuQnfmgGLxdxxBHYY0zN/DXlv47F6bNcrs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] dt-overlay: Support target-path being root node
Message-Id: <E1szLE6-0005vA-62@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 19:23:02 +0000

commit b32d24bcd6b79bb9de5b92dc69642d0c863f0765
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Oct 4 14:22:18 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Oct 10 16:18:56 2024 +0100

    dt-overlay: Support target-path being root node
    
    Even though in most cases device nodes are not present directly under
    the root node, it's a perfectly valid configuration (e.g. Qemu virt
    machine dtb). At the moment, we don't handle this scenario which leads
    to unconditional addition of extra leading '/' in the node full path.
    This makes the attempt to add such device overlay to fail.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/dt-overlay.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/xen/common/dt-overlay.c b/xen/common/dt-overlay.c
index d18bd12bd3..bfa1532509 100644
--- a/xen/common/dt-overlay.c
+++ b/xen/common/dt-overlay.c
@@ -325,6 +325,7 @@ static int overlay_get_nodes_info(const void *fdto, char **nodes_full_path)
             int node_name_len;
             unsigned int target_path_len = strlen(target_path);
             unsigned int node_full_name_len;
+            unsigned int extra_len;
 
             node_name = fdt_get_name(fdto, subnode, &node_name_len);
 
@@ -332,10 +333,13 @@ static int overlay_get_nodes_info(const void *fdto, char **nodes_full_path)
                 return node_name_len;
 
             /*
-             * Magic number 2 is for adding '/' and '\0'. This is done to keep
-             * the node_full_path in the correct full node name format.
+             * Extra length is for adding '/' and '\0' unless the target path is
+             * root in which case we don't add the '/' at the beginning. This is
+             * done to keep the node_full_path in the correct full node name
+             * format.
              */
-            node_full_name_len = target_path_len + node_name_len + 2;
+            extra_len = (target_path_len > 1) ? 2 : 1;
+            node_full_name_len = target_path_len + node_name_len + extra_len;
 
             nodes_full_path[node_num] = xmalloc_bytes(node_full_name_len);
 
@@ -344,9 +348,11 @@ static int overlay_get_nodes_info(const void *fdto, char **nodes_full_path)
 
             memcpy(nodes_full_path[node_num], target_path, target_path_len);
 
-            nodes_full_path[node_num][target_path_len] = '/';
+            /* Target is not root - add separator */
+            if ( target_path_len > 1 )
+                nodes_full_path[node_num][target_path_len++] = '/';
 
-            memcpy(nodes_full_path[node_num] + target_path_len + 1,
+            memcpy(nodes_full_path[node_num] + target_path_len,
                     node_name, node_name_len);
 
             nodes_full_path[node_num][node_full_name_len - 1] = '\0';
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 19:23:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 19:23:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.817339.1231391 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1szLEI-0003Ci-8r; Fri, 11 Oct 2024 19:23:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 817339.1231391; Fri, 11 Oct 2024 19:23:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1szLEI-0003Ca-6G; Fri, 11 Oct 2024 19:23:14 +0000
Received: by outflank-mailman (input) for mailman id 817339;
 Fri, 11 Oct 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 1szLEG-0003CH-BY
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 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 1szLEG-0006kC-Ay
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 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 1szLEG-0005vd-95
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 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=Sid9RCDaiThm/QPhJEC06Bi/alV9t3iUrUnV5AHs1qU=; b=2FtRC1wk3nP8TcxD1mFigA1FPc
	QRCLVVpMWUnQAayQQe6ax+KwXbhIT691yEYRFT3js+LlBbu9IHodE60vrg+ebnSxC5SqgGk+o1iRG
	m/l5x876UgIOQdmGeCAPHYBn/AfV8DoPiAN+IJT8d9WVnb6EfGnYK4JLRy9Ume0+5Buk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] dt-overlay: Ignore nodes that do not have __overlay__ as their subnode
Message-Id: <E1szLEG-0005vd-95@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 19:23:12 +0000

commit 239b0c8f065dfd044e88815875ec4e24f600ba76
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Oct 4 14:22:19 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Oct 10 16:18:56 2024 +0100

    dt-overlay: Ignore nodes that do not have __overlay__ as their subnode
    
    Assumption stated in the comments as if fdt_for_each_subnode() checks
    for parent < 0 is utterly wrong. If parent is < 0, node offset is set to
    0 (i.e. the very first node in the tree) and the loop's body is executed.
    This incorrect assumption causes overlay_node_count() to also count nodes
    that do not have __overlay__ as their subnode. The same story goes for
    overlay_get_nodes_info(), where we end up requiring each node directly
    under root node to have "target-path" set. DTBOs can specify other nodes
    including special ones like __symbols__, __fixups__ that can be left to
    reduce the number of steps a user needs to do to when it comes to invalid
    phandles.
    
    Fix it by adding checks if overlay < 0 after respective calls to
    fdt_subnode_offset().
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/dt-overlay.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/xen/common/dt-overlay.c b/xen/common/dt-overlay.c
index bfa1532509..4d75b5b36a 100644
--- a/xen/common/dt-overlay.c
+++ b/xen/common/dt-overlay.c
@@ -274,11 +274,9 @@ static unsigned int overlay_node_count(const void *overlay_fdt)
         int overlay;
 
         overlay = fdt_subnode_offset(overlay_fdt, fragment, "__overlay__");
+        if ( overlay < 0 )
+            continue;
 
-        /*
-         * overlay value can be < 0. But fdt_for_each_subnode() loop checks for
-         * overlay >= 0. So, no need for a overlay>=0 check here.
-         */
         fdt_for_each_subnode(subnode, overlay_fdt, overlay)
         {
             num_overlay_nodes++;
@@ -305,6 +303,10 @@ static int overlay_get_nodes_info(const void *fdto, char **nodes_full_path)
         int subnode;
         const char *target_path;
 
+        overlay = fdt_subnode_offset(fdto, fragment, "__overlay__");
+        if ( overlay < 0 )
+            continue;
+
         target = fdt_overlay_target_offset(device_tree_flattened, fdto,
                                            fragment, &target_path);
         if ( target < 0 )
@@ -313,12 +315,6 @@ static int overlay_get_nodes_info(const void *fdto, char **nodes_full_path)
         if ( target_path == NULL )
             return -EINVAL;
 
-        overlay = fdt_subnode_offset(fdto, fragment, "__overlay__");
-
-        /*
-         * overlay value can be < 0. But fdt_for_each_subnode() loop checks for
-         * overlay >= 0. So, no need for a overlay>=0 check here.
-         */
         fdt_for_each_subnode(subnode, fdto, overlay)
         {
             const char *node_name = NULL;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Fri Oct 11 19:23:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 11 Oct 2024 19:23:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.817340.1231395 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1szLES-0003F3-AG; Fri, 11 Oct 2024 19:23:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 817340.1231395; Fri, 11 Oct 2024 19:23:24 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1szLES-0003Ew-7h; Fri, 11 Oct 2024 19:23:24 +0000
Received: by outflank-mailman (input) for mailman id 817340;
 Fri, 11 Oct 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 1szLEQ-0003Eg-Es
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 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 1szLEQ-0006kL-Dn
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 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 1szLEQ-0005wv-D6
 for xen-changelog@lists.xenproject.org; Fri, 11 Oct 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=OAFBm/Oet65PHYEOlHXjdIOAeokjLyIv7KGTWBQHZSg=; b=KQFrgrbVroNoJteiqtDdD0ADxA
	EIrvJlV8MxS0hR7Kg3++yp96nTPqbi0jWBIQDJIkmKFGhXlJVRLwDwFo9UIhEr2Df81N1Gvz/ZZU5
	Q9doLsEv7QAG8sZ6dYpall8nSi+0VoXT5UEfiIw0qMA8mSs6IoAq3YrA1U+8YG0iSJxA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] dt-overlay: Print overlay I/O memory ranges in hex
Message-Id: <E1szLEQ-0005wv-D6@xenbits.xenproject.org>
Date: Fri, 11 Oct 2024 19:23:22 +0000

commit b2c7d7070dd0b311b64598411f52cdfa2a882ea2
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Fri Oct 4 14:22:20 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Oct 10 16:18:56 2024 +0100

    dt-overlay: Print overlay I/O memory ranges in hex
    
    Printing I/O memory rangeset ranges in decimal is not very helpful when
    debugging, so switch to hex by adding RANGESETF_prettyprint_hex flag
    for iomem_ranges rangeset.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/common/dt-overlay.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/xen/common/dt-overlay.c b/xen/common/dt-overlay.c
index 4d75b5b36a..5ce00514ef 100644
--- a/xen/common/dt-overlay.c
+++ b/xen/common/dt-overlay.c
@@ -869,7 +869,8 @@ static long handle_attach_overlay_nodes(struct domain *d,
         goto out;
     }
 
-    entry->iomem_ranges = rangeset_new(d, "Overlay: I/O Memory", 0);
+    entry->iomem_ranges = rangeset_new(d, "Overlay: I/O Memory",
+                                       RANGESETF_prettyprint_hex);
     if (entry->iomem_ranges == NULL)
     {
         rc = -ENOMEM;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Oct 12 11:22:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 12 Oct 2024 11:22:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.817673.1231542 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1szaCA-0005TT-W4; Sat, 12 Oct 2024 11:22:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 817673.1231542; Sat, 12 Oct 2024 11:22:02 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1szaCA-0005TL-T8; Sat, 12 Oct 2024 11:22:02 +0000
Received: by outflank-mailman (input) for mailman id 817673;
 Sat, 12 Oct 2024 11: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 1szaCA-0005TF-BF
 for xen-changelog@lists.xenproject.org; Sat, 12 Oct 2024 11: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 1szaCA-0007sf-9F
 for xen-changelog@lists.xenproject.org; Sat, 12 Oct 2024 11:22:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1szaCA-0007aB-7r
 for xen-changelog@lists.xenproject.org; Sat, 12 Oct 2024 11: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=ysiiempc47Eed5cKxy/Rvgg/mHZu6JGXwoXKZo7KqmY=; b=13t5yqsDFybbCmbXAdXLByqtwd
	sBSJGUg7NkQXlvwfSGjJZ9yP37Fr5v2BCTIyL+OfOf05LoDs9Yca1lLFpIJNMFCuOl+oTZo3MJyb+
	0kIx/NIapO61nQFDQufdNgWXS0xOvDX8cqJVE9E5sRUR3q3G4gllzp7s96od/VO4YOPw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] config: update Mini-OS commit
Message-Id: <E1szaCA-0007aB-7r@xenbits.xenproject.org>
Date: Sat, 12 Oct 2024 11:22:02 +0000

commit 906cee8718589146e02da3391f292be12e5baa92
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Oct 10 17:54:57 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 11 11:09:52 2024 +0100

    config: update Mini-OS commit
    
    Update the Mini-OS upstream revision.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index 1a3938b6c4..6dd2f9439c 100644
--- a/Config.mk
+++ b/Config.mk
@@ -224,7 +224,7 @@ QEMU_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/qemu-xen.git
 QEMU_UPSTREAM_REVISION ?= master
 
 MINIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/mini-os.git
-MINIOS_UPSTREAM_REVISION ?= 8b038c7411ae7e823eaf6d15d5efbe037a07197a
+MINIOS_UPSTREAM_REVISION ?= 80ef70f92cb7b95ef48deea1157f2194b10b8c05
 
 SEABIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/seabios.git
 SEABIOS_UPSTREAM_REVISION ?= rel-1.16.3
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Oct 12 11:22:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 12 Oct 2024 11:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.817674.1231545 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1szaCL-0005VK-1L; Sat, 12 Oct 2024 11:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 817674.1231545; Sat, 12 Oct 2024 11: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 1szaCK-0005VD-Us; Sat, 12 Oct 2024 11:22:12 +0000
Received: by outflank-mailman (input) for mailman id 817674;
 Sat, 12 Oct 2024 11: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 1szaCK-0005V5-F0
 for xen-changelog@lists.xenproject.org; Sat, 12 Oct 2024 11: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 1szaCK-0007sn-EI
 for xen-changelog@lists.xenproject.org; Sat, 12 Oct 2024 11:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1szaCK-0007bK-Ba
 for xen-changelog@lists.xenproject.org; Sat, 12 Oct 2024 11: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=gl0WcwehlmusfkikEYcYDZK50f72aI88QuUAZDn+Rww=; b=Duzh4I9W/FDDoXdHkCW7lVzmq4
	QbwErJ/tW1L2CMWweeqzsUkzzkqK7Am2E/HupIiy45U0N3uSfSvvArsAX/iGny0lUitQAq96a+KTV
	LHa5QfZFVCwfq0PWMDr+Qby4QKuQ7uIbkBhh86Kq2Qh9wPglhm0D+z6HLAR4Kr/iEW54=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] tools/xenstored: remove unneeded libxenguest reference
Message-Id: <E1szaCK-0007bK-Ba@xenbits.xenproject.org>
Date: Sat, 12 Oct 2024 11:22:12 +0000

commit 45333e28885b27b77eb5778214a580f4760c9eaf
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Oct 10 17:54:58 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 11 11:09:52 2024 +0100

    tools/xenstored: remove unneeded libxenguest reference
    
    Today the xenstored Makefile contains an unneeded reference to the
    not used libxenguest library.
    
    Remove it.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/xenstored/Makefile.common | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tools/xenstored/Makefile.common b/tools/xenstored/Makefile.common
index ef63ef650c..27fdb3b49e 100644
--- a/tools/xenstored/Makefile.common
+++ b/tools/xenstored/Makefile.common
@@ -13,7 +13,6 @@ XENSTORED_OBJS-$(CONFIG_MiniOS) += minios.o lu_minios.o
 CFLAGS += -include $(XEN_ROOT)/tools/config.h
 CFLAGS += $(CFLAGS_libxenevtchn)
 CFLAGS += $(CFLAGS_libxenctrl)
-CFLAGS += $(CFLAGS_libxenguest)
 CFLAGS += $(CFLAGS_libxentoolcore)
 
 $(XENSTORED_OBJS-y): CFLAGS += $(CFLAGS_libxengnttab)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sat Oct 12 11:22:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 12 Oct 2024 11:22:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.817675.1231550 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1szaCV-0005Z0-3j; Sat, 12 Oct 2024 11:22:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 817675.1231550; Sat, 12 Oct 2024 11:22:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1szaCV-0005Yt-13; Sat, 12 Oct 2024 11:22:23 +0000
Received: by outflank-mailman (input) for mailman id 817675;
 Sat, 12 Oct 2024 11: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 1szaCU-0005Yl-J5
 for xen-changelog@lists.xenproject.org; Sat, 12 Oct 2024 11: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 1szaCU-0007tj-IG
 for xen-changelog@lists.xenproject.org; Sat, 12 Oct 2024 11:22:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1szaCU-0007cM-GL
 for xen-changelog@lists.xenproject.org; Sat, 12 Oct 2024 11: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=grHGk8mY9fOw5gUmnvuUT3UBx0UkJhzPW9R0gbZUgeA=; b=nKND1FkqziRQJcWWfSBYF4Gjge
	szIylYZI1U+s7mY6GzNM5D5SyuZxCc/+esH9dZ2epF6mWXDUb1iIHJ17/iFzPg/tK0767EELAjeUZ
	GkOZ80Ccx12omO6HOKkY1IpDtjl5ozrK6aAcb49YghU8Xy0zyRnklI++y8ujtH+e+PQA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] stubdom: use real lib dependencies for xenstore stubdoms
Message-Id: <E1szaCU-0007cM-GL@xenbits.xenproject.org>
Date: Sat, 12 Oct 2024 11:22:22 +0000

commit 76a54badf890f56ff72644593c0fbc72138e13aa
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Thu Oct 10 17:54:59 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 11 11:09:52 2024 +0100

    stubdom: use real lib dependencies for xenstore stubdoms
    
    Today the build of Xenstore stubdoms depend on libxenguest just because
    libxenguest depends on all needed libraries. In reality there is no
    dependency on libxenguest for Xenstore stubdoms.
    
    Use the actual dependencies instead.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 stubdom/Makefile | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/stubdom/Makefile b/stubdom/Makefile
index 6ed4253b25..2a81af28a1 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -523,12 +523,14 @@ else
 pv-grub-if-enabled:
 endif
 
+XENSTORE_DEPS := libxenevtchn libxengnttab libxenctrl
+
 .PHONY: xenstore-stubdom
-xenstore-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstore libxenguest xenstore
+xenstore-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstore $(XENSTORE_DEPS) xenstore
 	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/xenstore-minios.gen.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/xenstore/xenstored.a
 
 .PHONY: xenstorepvh-stubdom
-xenstorepvh-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstorepvh libxenguest xenstorepvh
+xenstorepvh-stubdom: mini-os-$(XEN_TARGET_ARCH)-xenstorepvh $(XENSTORE_DEPS) xenstorepvh
 	DEF_CPPFLAGS="$(TARGET_CPPFLAGS)" DEF_CFLAGS="$(TARGET_CFLAGS)" DEF_LDFLAGS="$(TARGET_LDFLAGS)" MINIOS_CONFIG="$(CURDIR)/xenstorepvh-minios.gen.cfg" $(MAKE) DESTDIR= -C $(MINI_OS) OBJ_DIR=$(CURDIR)/$< APP_OBJS=$(CURDIR)/xenstorepvh/xenstored.a
 
 #########
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Oct 14 15:22:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 14 Oct 2024 15:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.818739.1232024 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0MtZ-0000uX-Si; Mon, 14 Oct 2024 15:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 818739.1232024; Mon, 14 Oct 2024 15: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 1t0MtZ-0000uN-Pz; Mon, 14 Oct 2024 15:22:05 +0000
Received: by outflank-mailman (input) for mailman id 818739;
 Mon, 14 Oct 2024 15: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 1t0MtY-0000uB-Ba
 for xen-changelog@lists.xenproject.org; Mon, 14 Oct 2024 15: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 1t0MtX-0005uW-Bu
 for xen-changelog@lists.xenproject.org; Mon, 14 Oct 2024 15:22:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0MtX-0001iU-9i
 for xen-changelog@lists.xenproject.org; Mon, 14 Oct 2024 15: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=biaj0Sc0TBP/zVaCKks/y6FbN3n8R51Ar/LxJYAQDn0=; b=mgyddJDupEu/xEEqqN8a70j7f7
	mc8WXFh91p+EVxelC918fvUYCtseM9z/Ih5SfIeNHOzvxoDweAoNUGwNnTM83/mQ59CSJoKFLonIs
	4Q6O4/oU2L0hVjMUTGqdM4knDyLLGmKWrJvBfAxrXomWGRt3h05gt+vKKV/GIcj73l7c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/spinlock: Fix UBSAN "load of address with insufficient space" in lock_prof_init()
Message-Id: <E1t0MtX-0001iU-9i@xenbits.xenproject.org>
Date: Mon, 14 Oct 2024 15:22:03 +0000

commit 542ac112fc68c66cfafc577e252404c21da4f75b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Oct 14 15:30:28 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Oct 14 16:14:26 2024 +0100

    xen/spinlock: Fix UBSAN "load of address with insufficient space" in lock_prof_init()
    
    UBSAN complains:
    
      (XEN) ================================================================================
      (XEN) UBSAN: Undefined behaviour in common/spinlock.c:794:10
      (XEN) load of address ffff82d040ae24c8 with insufficient space
      (XEN) for an object of type 'struct lock_profile *'
      (XEN) ----[ Xen-4.20-unstable  x86_64  debug=y ubsan=y  Tainted:   C    ]----
    
    This shows up with GCC-14, but not with GCC-12.  I have not bisected further.
    
    Either way, the types for __lock_profile_{start,end} are incorrect.
    
    They are an array of struct lock_profile pointers.  Correct the extern's
    types, and adjust the loop to match.
    
    No practical change.
    
    Reported-by: Andreas Glashauser <ag@andreasglashauser.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 xen/common/spinlock.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
index 0b87738445..38caa10a2e 100644
--- a/xen/common/spinlock.c
+++ b/xen/common/spinlock.c
@@ -608,9 +608,6 @@ struct lock_profile_anc {
 typedef void lock_profile_subfunc(struct lock_profile *data, int32_t type,
     int32_t idx, void *par);
 
-extern struct lock_profile *__lock_profile_start;
-extern struct lock_profile *__lock_profile_end;
-
 static s_time_t lock_profile_start;
 static struct lock_profile_anc lock_profile_ancs[] = {
     [LOCKPROF_TYPE_GLOBAL] = { .name = "Global" },
@@ -780,13 +777,16 @@ void _lock_profile_deregister_struct(
     spin_unlock(&lock_profile_lock);
 }
 
+extern struct lock_profile *__lock_profile_start[];
+extern struct lock_profile *__lock_profile_end[];
+
 static int __init cf_check lock_prof_init(void)
 {
     struct lock_profile **q;
 
     BUILD_BUG_ON(ARRAY_SIZE(lock_profile_ancs) != LOCKPROF_TYPE_N);
 
-    for ( q = &__lock_profile_start; q < &__lock_profile_end; q++ )
+    for ( q = __lock_profile_start; q < __lock_profile_end; q++ )
     {
         (*q)->next = lock_profile_glb_q.elem_q;
         lock_profile_glb_q.elem_q = *q;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 15 02:33:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 15 Oct 2024 02:33:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.818946.1232228 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0XMt-0007So-9u; Tue, 15 Oct 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 818946.1232228; Tue, 15 Oct 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 1t0XMt-0007Sg-7H; Tue, 15 Oct 2024 02:33:03 +0000
Received: by outflank-mailman (input) for mailman id 818946;
 Tue, 15 Oct 2024 02: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 1t0XMr-0007Sa-Sk
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 02: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 1t0XMr-0001Yv-Ms
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 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 1t0XMr-0006qu-Kh
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 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=UjTweM/Z0AYUPkr5mYV+1ILGSugJMSTLO4zUgRS031M=; b=w2s7rDqmXOgvziUL9cI04e/+y0
	N4yQf8GrSQR8Ey2t2TrNngZuYLQyvi8KweSNzbV4Uxl8u3TTXQci31pTFMVki547IjWsBs1GW6hKf
	1NY2ALLjfpj7pjz+53CJgv6kEvGHfdneWmuAyGKr6GU2EMTO4lCsPWA/NSqQamjpcsKQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/spinlock: Fix UBSAN "load of address with insufficient space" in lock_prof_init()
Message-Id: <E1t0XMr-0006qu-Kh@xenbits.xenproject.org>
Date: Tue, 15 Oct 2024 02:33:01 +0000

commit 542ac112fc68c66cfafc577e252404c21da4f75b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Oct 14 15:30:28 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Oct 14 16:14:26 2024 +0100

    xen/spinlock: Fix UBSAN "load of address with insufficient space" in lock_prof_init()
    
    UBSAN complains:
    
      (XEN) ================================================================================
      (XEN) UBSAN: Undefined behaviour in common/spinlock.c:794:10
      (XEN) load of address ffff82d040ae24c8 with insufficient space
      (XEN) for an object of type 'struct lock_profile *'
      (XEN) ----[ Xen-4.20-unstable  x86_64  debug=y ubsan=y  Tainted:   C    ]----
    
    This shows up with GCC-14, but not with GCC-12.  I have not bisected further.
    
    Either way, the types for __lock_profile_{start,end} are incorrect.
    
    They are an array of struct lock_profile pointers.  Correct the extern's
    types, and adjust the loop to match.
    
    No practical change.
    
    Reported-by: Andreas Glashauser <ag@andreasglashauser.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
---
 xen/common/spinlock.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
index 0b87738445..38caa10a2e 100644
--- a/xen/common/spinlock.c
+++ b/xen/common/spinlock.c
@@ -608,9 +608,6 @@ struct lock_profile_anc {
 typedef void lock_profile_subfunc(struct lock_profile *data, int32_t type,
     int32_t idx, void *par);
 
-extern struct lock_profile *__lock_profile_start;
-extern struct lock_profile *__lock_profile_end;
-
 static s_time_t lock_profile_start;
 static struct lock_profile_anc lock_profile_ancs[] = {
     [LOCKPROF_TYPE_GLOBAL] = { .name = "Global" },
@@ -780,13 +777,16 @@ void _lock_profile_deregister_struct(
     spin_unlock(&lock_profile_lock);
 }
 
+extern struct lock_profile *__lock_profile_start[];
+extern struct lock_profile *__lock_profile_end[];
+
 static int __init cf_check lock_prof_init(void)
 {
     struct lock_profile **q;
 
     BUILD_BUG_ON(ARRAY_SIZE(lock_profile_ancs) != LOCKPROF_TYPE_N);
 
-    for ( q = &__lock_profile_start; q < &__lock_profile_end; q++ )
+    for ( q = __lock_profile_start; q < __lock_profile_end; q++ )
     {
         (*q)->next = lock_profile_glb_q.elem_q;
         lock_profile_glb_q.elem_q = *q;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Oct 15 12:33:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 15 Oct 2024 12:33:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819148.1232407 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0gjZ-0002m7-4a; Tue, 15 Oct 2024 12:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 819148.1232407; Tue, 15 Oct 2024 12: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 1t0gjZ-0002lz-25; Tue, 15 Oct 2024 12:33:05 +0000
Received: by outflank-mailman (input) for mailman id 819148;
 Tue, 15 Oct 2024 12:33: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 1t0gjX-0002le-Kj
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:33: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 1t0gjX-0000lN-Cq
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:33:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0gjX-0004IV-Bu
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12: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=FGXaUOeis2r9gg8DsX1BCqDqSm/SO/J3BsWaGO7P9dU=; b=CBqtfXvbnNxOzP+Em/nZuRgpao
	624iZjwfWWIqKAvUROLQoqBsX3y13KfsfixucXkai9VledcmWrQUz3uLcOs4du9xhjrgHa31da1Pb
	rB7fd68a1s8fbbRt14TjAOOGzQH39mqJUu/47aTNesaYN1BFz8nwprW/Q5vbn/k8aTN0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: introduce DECL_SECTION_WITH_LADDR
Message-Id: <E1t0gjX-0004IV-Bu@xenbits.xenproject.org>
Date: Tue, 15 Oct 2024 12:33:03 +0000

commit 17d32cf2ecc1f22d2738cc9301485b4e8d356e33
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Oct 15 14:19:07 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 15 14:19:07 2024 +0200

    xen: introduce DECL_SECTION_WITH_LADDR
    
    Introduce DECL_SECTION_WITH_LADDR in order to signal whether
    DECL_SECTION() should specify a load address or not.
    
    Update {ppc,x86}/xen.lds.S to use DECL_SECTION_WITH_LADDR.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/ppc/xen.lds.S    | 2 ++
 xen/arch/x86/xen.lds.S    | 6 ++++--
 xen/include/xen/xen.lds.h | 6 ++++++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/xen/arch/ppc/xen.lds.S b/xen/arch/ppc/xen.lds.S
index 0c4b94814b..30b4a6ced8 100644
--- a/xen/arch/ppc/xen.lds.S
+++ b/xen/arch/ppc/xen.lds.S
@@ -1,4 +1,6 @@
 #include <xen/lib.h>
+
+#define DECL_SECTION_WITH_LADDR
 #include <xen/xen.lds.h>
 
 OUTPUT_ARCH(powerpc:common64)
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 94079fc164..35693f6e33 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -3,6 +3,10 @@
 
 #include <xen/cache.h>
 #include <xen/lib.h>
+
+#ifndef EFI
+# define DECL_SECTION_WITH_LADDR
+#endif
 #include <xen/xen.lds.h>
 #include <asm/page.h>
 
@@ -10,9 +14,7 @@
 
 #define FORMAT "pei-x86-64"
 #undef __XEN_VIRT_START
-#undef DECL_SECTION
 #define __XEN_VIRT_START __image_base__
-#define DECL_SECTION(x) x :
 
 ENTRY(efi_start)
 
diff --git a/xen/include/xen/xen.lds.h b/xen/include/xen/xen.lds.h
index 24b8900ffe..c6178bdc42 100644
--- a/xen/include/xen/xen.lds.h
+++ b/xen/include/xen/xen.lds.h
@@ -5,6 +5,8 @@
  * Common macros to be used in architecture specific linker scripts.
  */
 
+#ifdef DECL_SECTION_WITH_LADDR
+
 /*
  * Declare a section whose load address is based at PA 0 rather than
  * Xen's virtual base address.
@@ -15,6 +17,10 @@
 # define DECL_SECTION(x) x : AT(ADDR(x) - __XEN_VIRT_START)
 #endif
 
+#else /* !DECL_SECTION_WITH_LADDR */
+#define DECL_SECTION(x) x :
+#endif
+
 /*
  * To avoid any confusion, please note that the EFI macro does not correspond
  * to EFI support and is used when linking a native EFI (i.e. PE/COFF) binary,
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 15 12:33:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 15 Oct 2024 12:33:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819151.1232411 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0gjj-0002oY-5v; Tue, 15 Oct 2024 12:33:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 819151.1232411; Tue, 15 Oct 2024 12: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 1t0gjj-0002oQ-3U; Tue, 15 Oct 2024 12:33:15 +0000
Received: by outflank-mailman (input) for mailman id 819151;
 Tue, 15 Oct 2024 12: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 1t0gjh-0002oB-H6
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12: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 1t0gjh-0000lp-GL
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:33:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0gjh-0004JC-F2
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12: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=sDY57ZQJ1P3+ShbRJESPdr/esVN7H/XTnSsMcpgAJH4=; b=2tSxGCMCZG9PruYv0Uojqjg9tw
	yX488EHu9U0by79RnxXVmwJzB92lhhcuTt/PBZ83assM0BZZWX3g1JZpx1Jzcnbong3/xBMjvWJKT
	0XT2ae4k8MWAMQGOJDl5Gza7eKZCJa4FxxwSyWQ2Q+uoWdYxRy/krzm/8yX4jUdVUod0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen: define ACPI and DT device info sections macros
Message-Id: <E1t0gjh-0004JC-F2@xenbits.xenproject.org>
Date: Tue, 15 Oct 2024 12:33:13 +0000

commit 083344a05d6d94ef8de2963148df6af95508d4f9
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Oct 15 14:20:05 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 15 14:20:05 2024 +0200

    xen: define ACPI and DT device info sections macros
    
    Introduce macros to define device information sections based on
    the configuration of ACPI or device tree support. These sections
    are required for common code of device initialization and getting
    an information about a device.
    
    These macros are expected to be used across different
    architectures (Arm, PPC, RISC-V), so they are moved to
    the common xen/xen.lds.h, based on their original definition
    in Arm.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/xen.lds.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/xen/include/xen/xen.lds.h b/xen/include/xen/xen.lds.h
index c6178bdc42..16a9b1ba03 100644
--- a/xen/include/xen/xen.lds.h
+++ b/xen/include/xen/xen.lds.h
@@ -120,6 +120,14 @@
 
 /* List of constructs other than *_SECTIONS in alphabetical order. */
 
+#define ACPI_DEV_INFO        \
+  . = ALIGN(POINTER_ALIGN);  \
+  DECL_SECTION(.adev.info) { \
+      _asdevice = .;         \
+      *(.adev.info)          \
+      _aedevice = .;         \
+  } :text
+
 #define BUGFRAMES                               \
     __start_bug_frames_0 = .;                   \
     *(.bug_frames.0)                            \
@@ -137,6 +145,14 @@
     *(.bug_frames.3)                            \
     __stop_bug_frames_3 = .;
 
+#define DT_DEV_INFO         \
+  . = ALIGN(POINTER_ALIGN); \
+  DECL_SECTION(.dev.info) { \
+       _sdevice = .;        \
+       *(.dev.info)         \
+       _edevice = .;        \
+  } :text
+
 #ifdef CONFIG_HYPFS
 #define HYPFS_PARAM              \
        . = ALIGN(POINTER_ALIGN); \
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 15 12:33:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 15 Oct 2024 12:33:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819152.1232415 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0gjt-0002sW-7T; Tue, 15 Oct 2024 12:33:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 819152.1232415; Tue, 15 Oct 2024 12: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 1t0gjt-0002sO-4q; Tue, 15 Oct 2024 12:33:25 +0000
Received: by outflank-mailman (input) for mailman id 819152;
 Tue, 15 Oct 2024 12:33: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 1t0gjr-0002sE-K7
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:33: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 1t0gjr-0000ly-JO
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:33:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0gjr-0004Jn-IS
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:33: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=Pfj/voQCwAmcWQo7MeTKOIsF1BSHqvW1SxG3eN8AkTQ=; b=1q3rO5GhC4XpJLDNjr/vBl6qRn
	ZoQ9lFDNBYXgz2+ulIP/CUzWdzKd1mHys0jVidgw3dDCHEgIn/+Tq4ieYZwZd95eOvdtuYhuMa8Jc
	RpiI+JCEgUGKW6GgHIy8GMlPcm5idah6C38JKDluAcYeu5vnKlOxiLVYOgimAIUgahEk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: use {DT,ACPI}_DEV_INFO for device info sections
Message-Id: <E1t0gjr-0004Jn-IS@xenbits.xenproject.org>
Date: Tue, 15 Oct 2024 12:33:23 +0000

commit 31f31b624ab655e45ea345aa62eecf62897be06d
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Oct 15 14:20:43 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 15 14:20:43 2024 +0200

    xen/arm: use {DT,ACPI}_DEV_INFO for device info sections
    
    Refactor arm/xen.lds.S by replacing the inline definitions for
    device info sections with the newly introduced {DT,ACPI}_DEV_INFO
    macros from xen/xen.lds.h.
    
    Change alignment of DT_DEV_INFO and ACPI_DEV_INFO sections from
    8 to POINTER_ALIGN as struct acpi_device_desc and struct device_desc
    don't have any uint64_t's so it is safe to do that.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/xen.lds.S | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
index 0987052f1a..5b9abc9a2d 100644
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -124,20 +124,10 @@ SECTIONS
       _eplatform = .;
   } :text
 
-  . = ALIGN(8);
-  .dev.info : {
-      _sdevice = .;
-      *(.dev.info)
-      _edevice = .;
-  } :text
+  DT_DEV_INFO
 
 #ifdef CONFIG_ACPI
-  . = ALIGN(8);
-  .adev.info : {
-      _asdevice = .;
-      *(.adev.info)
-      _aedevice = .;
-  } :text
+  ACPI_DEV_INFO
 #endif
 
   . = ALIGN(8);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 15 12:33:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 15 Oct 2024 12:33:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819153.1232419 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0gk3-0002wH-8u; Tue, 15 Oct 2024 12:33:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 819153.1232419; Tue, 15 Oct 2024 12:33: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 1t0gk3-0002w9-6L; Tue, 15 Oct 2024 12:33:35 +0000
Received: by outflank-mailman (input) for mailman id 819153;
 Tue, 15 Oct 2024 12:33: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 1t0gk1-0002vx-Nf
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:33: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 1t0gk1-0000m6-MT
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:33:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0gk1-0004KR-LY
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:33: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=wy1yRu65uwmV+SRp8pLm3fSprF+FOqc52zT7f/r19i0=; b=SK91Z3qzDLyRl9dYp5zLXQq6ag
	5Lhd0LiPKcvlJWFMTeTV/gGKHVo8H65piL0kEV/vGSK6cJ5kF9rK59vlNcCVcyzuerSAIKsQ8xA/0
	PHYx/YI1mkaH2OksDYcp040Nf4GXXWH7ss3QC6A2z21gXPbnWt6YfN3WyG2+kUmXA+Ts=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/ppc: add section for device information in linker script
Message-Id: <E1t0gk1-0004KR-LY@xenbits.xenproject.org>
Date: Tue, 15 Oct 2024 12:33:33 +0000

commit 7a87b5e05ca6aeb4c9453c1c55cbca2c29dd7e7d
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Oct 15 14:21:04 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 15 14:21:04 2024 +0200

    xen/ppc: add section for device information in linker script
    
    Introduce a new `.dev.info` section in the PPC linker script to
    handle device-specific information. This section is required by
    common code (common/device.c: device_init(), device_get_class() ).
    This section is aligned to `POINTER_ALIGN`, with `_sdevice` and `_edevice`
    marking the start and end of the section, respectively.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Shawn Anastasio <sanastasio@raptorengineering.com>
---
 xen/arch/ppc/xen.lds.S | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/ppc/xen.lds.S b/xen/arch/ppc/xen.lds.S
index 30b4a6ced8..3f2a7676ec 100644
--- a/xen/arch/ppc/xen.lds.S
+++ b/xen/arch/ppc/xen.lds.S
@@ -96,6 +96,8 @@ SECTIONS
         CONSTRUCTORS
     } :text
 
+    DT_DEV_INFO                       /* Devicetree based device info */
+
     . = ALIGN(PAGE_SIZE);             /* Init code and data */
     __init_begin = .;
     DECL_SECTION(.init.text) {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 15 12:33:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 15 Oct 2024 12:33:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819154.1232423 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0gkD-0002zT-Ab; Tue, 15 Oct 2024 12:33:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 819154.1232423; Tue, 15 Oct 2024 12:33: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 1t0gkD-0002zL-7v; Tue, 15 Oct 2024 12:33:45 +0000
Received: by outflank-mailman (input) for mailman id 819154;
 Tue, 15 Oct 2024 12:33: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 1t0gkB-0002yk-QE
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:33: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 1t0gkB-0000mE-PZ
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:33:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0gkB-0004L8-OZ
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:33: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=KL1CNgI5610EGTSMrwwwOJPsv1veg+stLsgXrM+dnSI=; b=XKIxFoK7mGUFX6quAvpeMB/nzG
	SiTdSzv9Qo933xkD24e03f4RMdyFxKFn63+HmbONxTG1vzB1wxE+artMSqcO9YTnLWkxE+lbHjz6l
	S7JV3ngzSV6EAYVSXMT2taJWwukblff7rL9DuQY4tAfT+6isNwFZh18SIj6jbXr3+ETU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: add section for device information in linker script
Message-Id: <E1t0gkB-0004L8-OZ@xenbits.xenproject.org>
Date: Tue, 15 Oct 2024 12:33:43 +0000

commit af2a1339c4bd9dcde980beeed0e2f5b3739522fd
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Oct 15 14:21:14 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 15 14:21:14 2024 +0200

    xen/riscv: add section for device information in linker script
    
    Introduce a new `.dev.info` section in the RISC-V linker script to
    handle device-specific information. This section is required by
    common code (common/device.c: device_init(), device_get_class() ).
    This section is aligned to `POINTER_ALIGN`, with `_sdevice` and `_edevice`
    marking the start and end of the section, respectively.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/xen.lds.S | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/riscv/xen.lds.S b/xen/arch/riscv/xen.lds.S
index 558a5a992a..dffc6ae119 100644
--- a/xen/arch/riscv/xen.lds.S
+++ b/xen/arch/riscv/xen.lds.S
@@ -91,6 +91,8 @@ SECTIONS
         CONSTRUCTORS
     } :text
 
+    DT_DEV_INFO                       /* Devicetree based device info */
+
     . = ALIGN(PAGE_SIZE);             /* Init code and data */
     __init_begin = .;
     .init.text : {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 15 12:33:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 15 Oct 2024 12:33:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819155.1232427 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0gkN-00032O-Br; Tue, 15 Oct 2024 12:33:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 819155.1232427; Tue, 15 Oct 2024 12:33: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 1t0gkN-00032H-9P; Tue, 15 Oct 2024 12:33:55 +0000
Received: by outflank-mailman (input) for mailman id 819155;
 Tue, 15 Oct 2024 12:33: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 1t0gkL-00031z-TJ
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:33: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 1t0gkL-0000mM-Sb
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:33:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0gkL-0004Ll-Rh
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:33: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=IzKeEW8sOtmIMfATg4lB+A4KtOXzT06HS6vqi1CNBfg=; b=cAlwnX5LzLE4IcYiZ2MAXjnMPH
	G7a1cmnA6XrONusjwIr9sXIr0uFZ/kgiLHxu/4CAP8LqkA5oaYUytXDJKPctrNI5dUETU8DJO5RJJ
	Gyi3aWBgtfjkEJe7ErSNXkd+zeGtvvmb9sVDFgiyq0r6WgMtP2IaAPA/ArMYwv/nylJM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/common: move device initialization code to common code
Message-Id: <E1t0gkL-0004Ll-Rh@xenbits.xenproject.org>
Date: Tue, 15 Oct 2024 12:33:53 +0000

commit ed896312f2e4e238266830a0452a1af5fa7aecbc
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Oct 15 14:22:00 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 15 14:22:00 2024 +0200

    xen/common: move device initialization code to common code
    
    Remove the device initialization code from `xen/arch/arm/device.c`
    and move it to the common code to avoid duplication and make it accessible
    for both ARM and other architectures.
    device_get_class(), device_init(), _sdevice[] and _edevice[] are wrapped by
    "#ifdef CONFIG_HAS_DEVICE_TREE" for the case if an arch doesn't support
    device tree.
    
    Remove unnecessary inclusions of <asm/device.h> and <xen/init.h> from
    `xen/arch/arm/device.c` as no code in the file relies on these headers.
    Fix the inclusion order by moving <asm/setup.h> after <xen/*> headers to
    resolve a compilation error:
       ./include/public/xen.h:968:35: error: unknown type name 'uint64_t'
        968 | __DEFINE_XEN_GUEST_HANDLE(uint64, uint64_t);
            |                                   ^~~~~~~~
       ./include/public/arch-arm.h:191:21: note: in definition of macro '___DEFINE_XEN_GUEST_HANDLE'
       191 |     typedef union { type *p; uint64_aligned_t q; }              \
           |                     ^~~~
       ./include/public/xen.h:968:1: note: in expansion of macro '__DEFINE_XEN_GUEST_HANDLE'
       968 | __DEFINE_XEN_GUEST_HANDLE(uint64, uint64_t);
    because <asm/setup.h> includes <public/version.h>, which in turn includes
    "xen.h", which requires <xen/types.h> to be processed correctly.
    Additionally, add <xen/device_tree.h> to `device.c` as functions from this
    header are used within the file.
    
    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/device.c | 71 ++------------------------------------------
 xen/common/Makefile   |  2 ++
 xen/common/device.c   | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 86 insertions(+), 69 deletions(-)

diff --git a/xen/arch/arm/device.c b/xen/arch/arm/device.c
index 3e02cff008..5610cddcba 100644
--- a/xen/arch/arm/device.c
+++ b/xen/arch/arm/device.c
@@ -8,79 +8,12 @@
  * Copyright (C) 2013 Linaro Limited.
  */
 
-#include <asm/device.h>
-#include <asm/setup.h>
+#include <xen/device_tree.h>
 #include <xen/errno.h>
-#include <xen/init.h>
 #include <xen/iocap.h>
 #include <xen/lib.h>
 
-extern const struct device_desc _sdevice[], _edevice[];
-
-#ifdef CONFIG_ACPI
-extern const struct acpi_device_desc _asdevice[], _aedevice[];
-#endif
-
-int __init device_init(struct dt_device_node *dev, enum device_class class,
-                       const void *data)
-{
-    const struct device_desc *desc;
-
-    ASSERT(dev != NULL);
-
-    if ( !dt_device_is_available(dev) || dt_device_for_passthrough(dev) )
-        return  -ENODEV;
-
-    for ( desc = _sdevice; desc != _edevice; desc++ )
-    {
-        if ( desc->class != class )
-            continue;
-
-        if ( dt_match_node(desc->dt_match, dev) )
-        {
-            ASSERT(desc->init != NULL);
-
-            return desc->init(dev, data);
-        }
-
-    }
-
-    return -EBADF;
-}
-
-#ifdef CONFIG_ACPI
-int __init acpi_device_init(enum device_class class, const void *data, int class_type)
-{
-    const struct acpi_device_desc *desc;
-
-    for ( desc = _asdevice; desc != _aedevice; desc++ )
-    {
-        if ( ( desc->class != class ) || ( desc->class_type != class_type ) )
-            continue;
-
-        ASSERT(desc->init != NULL);
-
-        return desc->init(data);
-    }
-
-    return -EBADF;
-}
-#endif
-
-enum device_class device_get_class(const struct dt_device_node *dev)
-{
-    const struct device_desc *desc;
-
-    ASSERT(dev != NULL);
-
-    for ( desc = _sdevice; desc != _edevice; desc++ )
-    {
-        if ( dt_match_node(desc->dt_match, dev) )
-            return desc->class;
-    }
-
-    return DEVICE_UNKNOWN;
-}
+#include <asm/setup.h>
 
 int map_irq_to_domain(struct domain *d, unsigned int irq,
                       bool need_mapping, const char *devname)
diff --git a/xen/common/Makefile b/xen/common/Makefile
index f90bb00d23..fc48cbf688 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -6,6 +6,8 @@ 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.o
+obj-$(filter-out $(CONFIG_X86),$(CONFIG_ACPI)) += device.o
 obj-$(CONFIG_HAS_DEVICE_TREE) += device-tree/
 obj-$(CONFIG_IOREQ_SERVER) += dm.o
 obj-y += domain.o
diff --git a/xen/common/device.c b/xen/common/device.c
new file mode 100644
index 0000000000..33e0d58f2f
--- /dev/null
+++ b/xen/common/device.c
@@ -0,0 +1,82 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Based on the code from:
+ *   xen/arch/arm/device.c
+ */
+
+#include <xen/bug.h>
+#include <xen/device_tree.h>
+#include <xen/errno.h>
+#include <xen/init.h>
+
+#include <asm/device.h>
+
+#ifdef CONFIG_HAS_DEVICE_TREE
+
+extern const struct device_desc _sdevice[], _edevice[];
+
+int __init device_init(struct dt_device_node *dev, enum device_class class,
+                       const void *data)
+{
+    const struct device_desc *desc;
+
+    ASSERT(dev != NULL);
+
+    if ( !dt_device_is_available(dev) || dt_device_for_passthrough(dev) )
+        return  -ENODEV;
+
+    for ( desc = _sdevice; desc != _edevice; desc++ )
+    {
+        if ( desc->class != class )
+            continue;
+
+        if ( dt_match_node(desc->dt_match, dev) )
+        {
+            ASSERT(desc->init != NULL);
+
+            return desc->init(dev, data);
+        }
+    }
+
+    return -EBADF;
+}
+
+enum device_class device_get_class(const struct dt_device_node *dev)
+{
+    const struct device_desc *desc;
+
+    ASSERT(dev != NULL);
+
+    for ( desc = _sdevice; desc != _edevice; desc++ )
+    {
+        if ( dt_match_node(desc->dt_match, dev) )
+            return desc->class;
+    }
+
+    return DEVICE_UNKNOWN;
+}
+
+#endif
+
+#ifdef CONFIG_ACPI
+
+extern const struct acpi_device_desc _asdevice[], _aedevice[];
+
+int __init acpi_device_init(enum device_class class, const void *data, int class_type)
+{
+    const struct acpi_device_desc *desc;
+
+    for ( desc = _asdevice; desc != _aedevice; desc++ )
+    {
+        if ( ( desc->class != class ) || ( desc->class_type != class_type ) )
+            continue;
+
+        ASSERT(desc->init != NULL);
+
+        return desc->init(data);
+    }
+
+    return -EBADF;
+}
+
+#endif
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 15 12:34:05 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 15 Oct 2024 12:34:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819156.1232431 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0gkX-00035X-Ds; Tue, 15 Oct 2024 12:34:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 819156.1232431; Tue, 15 Oct 2024 12:34: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 1t0gkX-00035P-Ar; Tue, 15 Oct 2024 12:34:05 +0000
Received: by outflank-mailman (input) for mailman id 819156;
 Tue, 15 Oct 2024 12:34: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 1t0gkV-000354-WB
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:34: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 1t0gkV-0000mk-VV
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:34:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0gkV-0004Mu-Ul
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:34: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=88QvBgklc6awKNz1yoGFTJqIA5du2pQ58V6f155OMdY=; b=4ctu6V6mfZRuFEkcoDtEX+3Qwq
	lSKsnU4dNgulS+HROxNzxECOtBr685AIA+I6XpAjMS5VpYgeMOILqKZLDEmfBdrm1hrwZvwJ2SVSx
	1wFJnA13RLvEWFcNrsE3qpppFGIi8DklnOqdGDhXUi4F5ml2jDNtLlrODXZ+MCvtDDiU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/vpci: address violations of MISRA C Rule 16.3
Message-Id: <E1t0gkV-0004Mu-Ul@xenbits.xenproject.org>
Date: Tue, 15 Oct 2024 12:34:03 +0000

commit 028148788f044a287a8714ef1080bf83f3e766ec
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Tue Oct 15 14:22:56 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 15 14:22:56 2024 +0200

    xen/vpci: address violations of MISRA C Rule 16.3
    
    Address violations of MISRA C:2012 Rule 16.3:
    "An unconditional `break' statement shall terminate every
    switch-clause".
    
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/vpci/msix.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/drivers/vpci/msix.c b/xen/drivers/vpci/msix.c
index fbe710ab92..5bb4444ce2 100644
--- a/xen/drivers/vpci/msix.c
+++ b/xen/drivers/vpci/msix.c
@@ -364,6 +364,7 @@ static int adjacent_read(const struct domain *d, const struct vpci_msix *msix,
 
     default:
         ASSERT_UNREACHABLE();
+        break;
     }
     spin_unlock(&vpci->lock);
 
@@ -512,6 +513,7 @@ static int adjacent_write(const struct domain *d, const struct vpci_msix *msix,
 
     default:
         ASSERT_UNREACHABLE();
+        break;
     }
     spin_unlock(&vpci->lock);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 15 12:34:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 15 Oct 2024 12:34:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819157.1232434 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0gkh-00039G-GO; Tue, 15 Oct 2024 12:34:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 819157.1232434; Tue, 15 Oct 2024 12:34: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 1t0gkh-000399-Dw; Tue, 15 Oct 2024 12:34:15 +0000
Received: by outflank-mailman (input) for mailman id 819157;
 Tue, 15 Oct 2024 12:34: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 1t0gkg-00038u-3M
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:34: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 1t0gkg-0000nH-2e
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:34:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0gkg-0004O9-1H
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:34: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=Yvrd+1BMD8mz1EuHS1Jr5dAYXyCI+xkQil5zKIqPYjo=; b=ZrM6EzkpjT5tJy2Fd4kK/8ijLu
	zNaF5VacFuktHkm9R9E/dC9i7go6J4htUoNjAZdNMiekfzS5w2slpIobgmqa4kTCx1rob8O6kdSVc
	D2B3IrM8QpP7w5G8+6inFzQZ1arTokpFIOEogN40vAxIk6qr7UI8EWibCJQL7ARZbA7s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: initialize bootinfo from dtb
Message-Id: <E1t0gkg-0004O9-1H@xenbits.xenproject.org>
Date: Tue, 15 Oct 2024 12:34:14 +0000

commit de709f76472257c87450ecad9c54d097143d691b
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Oct 15 14:23:19 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 15 14:23:19 2024 +0200

    xen/riscv: initialize bootinfo from dtb
    
    Parse DTB during startup, allowing memory banks and reserved
    memory regions to be set up, along with early device tree node
    (chosen, "xen,domain", "reserved-memory", etc) handling.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/setup.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index f531ca38ee..63feea14c7 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -50,6 +50,9 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
                           _end - _start, false) )
         panic("Failed to add BOOTMOD_XEN\n");
 
+    if ( !boot_fdt_info(device_tree_flattened, dtb_addr) )
+        BUG();
+
     printk("All set up\n");
 
     machine_halt();
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 15 12:34:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 15 Oct 2024 12:34:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819158.1232439 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0gkr-0003CZ-II; Tue, 15 Oct 2024 12:34:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 819158.1232439; Tue, 15 Oct 2024 12:34: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 1t0gkr-0003CN-Fb; Tue, 15 Oct 2024 12:34:25 +0000
Received: by outflank-mailman (input) for mailman id 819158;
 Tue, 15 Oct 2024 12:34: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 1t0gkq-0003C8-6F
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:34: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 1t0gkq-0000nP-5b
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:34:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0gkq-0004PG-4i
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:34: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=rgdjqqvdYQP4PzvZAt7ahro6jN56a1a3NUpVvX3YIXc=; b=A/mqlmkZxUOCgSDbAXHU10sGrs
	RaXhhzylQRQauz63Zf8HkfYDf6y1WKf017K89CnwCC9WzH/9TX4f1Zx1pZanHpTM4VWT8OfN6+IHk
	pT3v9IdhgriO9JvvChTBRAA3AXLQKp6Sc+ErFQHAw9PymmYFB9U58eShkxChI4mWONLU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/riscv: parse and handle fdt command line
Message-Id: <E1t0gkq-0004PG-4i@xenbits.xenproject.org>
Date: Tue, 15 Oct 2024 12:34:24 +0000

commit 8c858d04ac5c154517664afe01db67e5ced816ad
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Oct 15 14:23:41 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 15 14:23:41 2024 +0200

    xen/riscv: parse and handle fdt command line
    
    Receive Xen's command line passed by DTB using boot_fdt_cmdline()
    and passed it to cmdline_parse() for further procesinng and setup
    of Xen-specific parameters.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/setup.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index 63feea14c7..e29bd75d7c 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -27,6 +27,8 @@ unsigned char __initdata cpu0_boot_stack[STACK_SIZE]
 void __init noreturn start_xen(unsigned long bootcpu_id,
                                paddr_t dtb_addr)
 {
+    const char *cmdline;
+
     remove_identity_mapping();
 
     set_processor_id(0);
@@ -53,6 +55,10 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
     if ( !boot_fdt_info(device_tree_flattened, dtb_addr) )
         BUG();
 
+    cmdline = boot_fdt_cmdline(device_tree_flattened);
+    printk("Command line: %s\n", cmdline);
+    cmdline_parse(cmdline);
+
     printk("All set up\n");
 
     machine_halt();
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 15 12:34:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 15 Oct 2024 12:34:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819159.1232443 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0gl1-0003Ey-Jf; Tue, 15 Oct 2024 12:34:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 819159.1232443; Tue, 15 Oct 2024 12:34: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 1t0gl1-0003Eq-H9; Tue, 15 Oct 2024 12:34:35 +0000
Received: by outflank-mailman (input) for mailman id 819159;
 Tue, 15 Oct 2024 12:34: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 1t0gl0-0003Eh-9C
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:34: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 1t0gl0-0000nX-8S
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:34:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0gl0-0004QW-7i
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:34: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=5/D81aXoAUSR8AAR9u5EkMhDARvO60EHJn/dnj6445Q=; b=e8Pss2NGaRVIwJ1/DAG2TteGUy
	b2zfOeMZJwiJt8rtXBpVriUxr4zL9Po6dk14oCexJCsYLVKS4joRQUux4iz8bJTRYMfKxd2Ip81hI
	eHKTUGlasy1q5474cip1g+a6NfQpCntN0/SsGnDH+/gjvQlFGPBziGZqvScBLfFKr0tw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] iommu/amd-vi: do not error if device referenced in IVMD is not behind any IOMMU
Message-Id: <E1t0gl0-0004QW-7i@xenbits.xenproject.org>
Date: Tue, 15 Oct 2024 12:34:34 +0000

commit 2defb544900a11f93104ac68d2f8beba89d4bd02
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Oct 15 14:23:59 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 15 14:23:59 2024 +0200

    iommu/amd-vi: do not error if device referenced in IVMD is not behind any IOMMU
    
    IVMD table contains restrictions about memory which must be mandatory assigned
    to devices (and which permissions it should use), or memory that should be
    never accessible to devices.
    
    Some hardware however contains ranges in IVMD that reference devices outside of
    the IVHD tables (in other words, devices not behind any IOMMU).  Such mismatch
    will cause Xen to fail in register_range_for_device(), ultimately leading to
    the IOMMU being disabled, and Xen crashing as x2APIC support might be already
    enabled and relying on the IOMMU functionality.
    
    Relax IVMD parsing: allow IVMD blocks to reference devices not assigned to any
    IOMMU.  It's impossible for Xen to fulfill the requirement in the IVMD block if
    the device is not behind any IOMMU, but it's no worse than booting without
    IOMMU support, and thus not parsing ACPI IVRS in the first place.
    
    Reported-by: Willi Junga <xenproject@ymy.be>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/amd/iommu_acpi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu_acpi.c b/xen/drivers/passthrough/amd/iommu_acpi.c
index 3f5508eba0..c416120326 100644
--- a/xen/drivers/passthrough/amd/iommu_acpi.c
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c
@@ -248,8 +248,9 @@ static int __init register_range_for_device(
     iommu = find_iommu_for_device(seg, bdf);
     if ( !iommu )
     {
-        AMD_IOMMU_ERROR("IVMD: no IOMMU for Dev_Id %#x\n", bdf);
-        return -ENODEV;
+        AMD_IOMMU_WARN("IVMD: no IOMMU for device %pp - ignoring constrain\n",
+                       &PCI_SBDF(seg, bdf));
+        return 0;
     }
     req = ivrs_mappings[bdf].dte_requestor_id;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 15 12:34:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 15 Oct 2024 12:34:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819160.1232449 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0glB-0003Hf-ME; Tue, 15 Oct 2024 12:34:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 819160.1232449; Tue, 15 Oct 2024 12:34: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 1t0glB-0003HX-IU; Tue, 15 Oct 2024 12:34:45 +0000
Received: by outflank-mailman (input) for mailman id 819160;
 Tue, 15 Oct 2024 12:34: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 1t0glA-0003H4-Cv
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:34: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 1t0glA-0000nf-CD
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:34:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0glA-0004RQ-AS
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:34: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=6WyGgJnHTWgfjG4RvVNOSKiqU9T2OFlb6NsbF2twEXA=; b=3dTwYYr3LPO+YYNv8ZAgqol9Ol
	Du+DDvU2jL93DMnFdDv6ZyqGEj4jiEF8hB4Ickaxe2uaEwnNxK7QgBJhMluWDvZJ7HpmMTZiQhgcr
	qj+DMLfK/NXxgyj6nDqmp6gRKmJetbgw3TiSIYRdONfUKZ/wFDtt0SF0ZVQP5Ueyln5A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Prep work for 32bit object changes
Message-Id: <E1t0glA-0004RQ-AS@xenbits.xenproject.org>
Date: Tue, 15 Oct 2024 12:34:44 +0000

commit 93af5cc4dffbd316f607d5abc8a16293cdb75840
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Tue Oct 15 14:24:25 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 15 14:24:25 2024 +0200

    x86/boot: Prep work for 32bit object changes
    
    Broken out of the subsequent patch for clarity.
    
     * Rename head-bin-objs to obj32
     * Use a .32.o suffix to distinguish these objects
     * Factor out $(LD32)
    
    No functional change.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/boot/Makefile | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index ff0f965876..1199291d2b 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -1,15 +1,16 @@
 obj-bin-y += head.o
 
-head-bin-objs := cmdline.o reloc.o
+obj32 := cmdline.32.o
+obj32 += reloc.32.o
 
-nocov-y   += $(head-bin-objs)
-noubsan-y += $(head-bin-objs)
-targets   += $(head-bin-objs)
+nocov-y   += $(obj32)
+noubsan-y += $(obj32)
+targets   += $(obj32)
 
-head-bin-objs := $(addprefix $(obj)/,$(head-bin-objs))
+obj32 := $(addprefix $(obj)/,$(obj32))
 
 $(obj)/head.o: AFLAGS-y += -Wa$(comma)-I$(obj)
-$(obj)/head.o: $(head-bin-objs:.o=.bin)
+$(obj)/head.o: $(obj32:.32.o=.bin)
 
 CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS))
 $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
@@ -18,16 +19,20 @@ CFLAGS_x86_32 += -nostdinc -include $(filter %/include/xen/config.h,$(XEN_CFLAGS
 CFLAGS_x86_32 += $(filter -I% -O%,$(XEN_CFLAGS)) -D__XEN__
 
 # override for 32bit binaries
-$(head-bin-objs): CFLAGS_stack_boundary :=
-$(head-bin-objs): XEN_CFLAGS := $(CFLAGS_x86_32) -fpic
+$(obj32): CFLAGS_stack_boundary :=
+$(obj32): XEN_CFLAGS := $(CFLAGS_x86_32) -fpic
+
+$(obj)/%.32.o: $(src)/%.c FORCE
+	$(call if_changed_rule,cc_o_c)
 
 LDFLAGS_DIRECT-$(call ld-option,--warn-rwx-segments) := --no-warn-rwx-segments
 LDFLAGS_DIRECT += $(LDFLAGS_DIRECT-y)
+LD32 := $(LD) $(subst x86_64,i386,$(LDFLAGS_DIRECT))
 
 %.bin: %.lnk
 	$(OBJCOPY) -j .text -O binary $< $@
 
-%.lnk: %.o $(src)/build32.lds
-	$(LD) $(subst x86_64,i386,$(LDFLAGS_DIRECT)) -N -T $(filter %.lds,$^) -o $@ $<
+%.lnk: %.32.o $(src)/build32.lds
+	$(LD32) -N -T $(filter %.lds,$^) -o $@ $<
 
 clean-files := *.lnk *.bin
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 15 12:34:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 15 Oct 2024 12:34:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819161.1232450 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0glL-0003KT-MO; Tue, 15 Oct 2024 12:34:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 819161.1232450; Tue, 15 Oct 2024 12:34:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0glL-0003KM-Ju; Tue, 15 Oct 2024 12:34:55 +0000
Received: by outflank-mailman (input) for mailman id 819161;
 Tue, 15 Oct 2024 12:34: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 1t0glK-0003KD-Fd
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:34: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 1t0glK-0000nn-F5
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:34:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0glK-0004UD-EM
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 12:34: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=iWkz/mQzQI/jvzAvSU66Zk3RjkQJ27jIcXLWjcILFA4=; b=k4/6t5fULsazn8nuKGOZGuRNe3
	Wq+L9ZGbX1plQHUPlkBq4Izx/3wf4fBxdjhDU2NOeL5ggBjz4zQVwjpm2g55yVByAiYq2pXvUhpH0
	iihs2o4FmZ4KHwKcsF+Fof8+8Db1RPZ9ZLDTlXWNGZMINWH3LWJrEoA1GxFQ1X7EK3ek=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/public: add comments regarding interface version bumps
Message-Id: <E1t0glK-0004UD-EM@xenbits.xenproject.org>
Date: Tue, 15 Oct 2024 12:34:54 +0000

commit 3f6ee3db2e878398cfcde725399b4d1b04e92269
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Oct 15 14:24:45 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 15 14:24:45 2024 +0200

    xen/public: add comments regarding interface version bumps
    
    domctl.h and sysctl.h have an interface version, which needs to be
    bumped in case of incompatible modifications of the interface.
    
    In order to avoid misunderstandings, add a comment to both headers
    specifying in which cases a bump is needed.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/include/public/domctl.h | 10 ++++++++++
 xen/include/public/sysctl.h | 10 ++++++++++
 2 files changed, 20 insertions(+)

diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index e1028fc524..353f831e40 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -21,6 +21,16 @@
 #include "hvm/save.h"
 #include "memory.h"
 
+/*
+ * The interface version needs to be incremented by 1 in case the interface
+ * is modified in an incompatible way AND if the version hasn't been
+ * incremented in the current development cycle already.
+ * Pure additions (e.g. new sub-commands) or compatible interface changes
+ * (e.g. adding semantics to 0-checked input fields or data to zeroed output
+ * fields) don't require a change of the version.
+ *
+ * Last version bump: Xen 4.19
+ */
 #define XEN_DOMCTL_INTERFACE_VERSION 0x00000017
 
 /*
diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
index b2a5a724db..b0fec271d3 100644
--- a/xen/include/public/sysctl.h
+++ b/xen/include/public/sysctl.h
@@ -18,6 +18,16 @@
 #include "domctl.h"
 #include "physdev.h"
 
+/*
+ * The interface version needs to be incremented by 1 in case the interface
+ * is modified in an incompatible way AND if the version hasn't been
+ * incremented in the current development cycle already.
+ * Pure additions (e.g. new sub-commands) or compatible interface changes
+ * (e.g. adding semantics to 0-checked input fields or data to zeroed output
+ * fields) don't require a change of the version.
+ *
+ * Last version bump: Xen 4.17
+ */
 #define XEN_SYSCTL_INTERFACE_VERSION 0x00000015
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 15 17:55:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 15 Oct 2024 17:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819313.1232606 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0llB-00083d-MG; Tue, 15 Oct 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 819313.1232606; Tue, 15 Oct 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 1t0llB-00083V-JQ; Tue, 15 Oct 2024 17:55:05 +0000
Received: by outflank-mailman (input) for mailman id 819313;
 Tue, 15 Oct 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 1t0llA-00083P-Id
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 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 1t0llA-0006gB-6u
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 17:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0llA-0006b7-54
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 17: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=Dfhsn+T7GtOgrikCEn1pBoVis3vQkjhmIaswfOA10CY=; b=yHvTBd9umpOG3JxVfAKWQgAVT5
	WWLKK5CI52rZ+bCl1bbgIlzffxcwmOIv0r8LacpBWc7L3F0c65Fm1VPLcVqM5qjf9NIl7Kb5u30rz
	RMfmSeTlUxuu9clVBgi53ynd9hT5waW7XXXaLACr4RI2XUQUmrXOMESM1Lgx4i8EEsRY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Align mbi2.c stack to 16 bytes
Message-Id: <E1t0llA-0006b7-54@xenbits.xenproject.org>
Date: Tue, 15 Oct 2024 17:55:04 +0000

commit f4c3300d88189ab18b6459e22e1aa945ab1d3f6f
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Tue Oct 15 09:25:12 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 15 18:20:57 2024 +0100

    x86/boot: Align mbi2.c stack to 16 bytes
    
    Most of Xen is built with a stack alignment of 8 bytes, but the UEFI spec
    mandates 16 and UEFI services will fault if the stack is misaligned.
    
    While the caller of efi_multiboot2_prelude() takes care to align the stack,
    mbi2.c accidentally got the Xen-wide default of 8, and has a 50% chance of
    crashing depending on how many variables the compiler decided to spill to the
    stack.
    
    Compile mbi2.c with the appropriate alignment for UEFI functionality.
    
    Also take the opportunity to make it a fully .init object.
    
    Fixes: eb21ce14d709 ('x86/boot: Rewrite EFI/MBI2 code partly in C')
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    [rewrite the commit message]
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/efi/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/efi/Makefile b/xen/arch/x86/efi/Makefile
index 7e2b5c07de..c6678652fc 100644
--- a/xen/arch/x86/efi/Makefile
+++ b/xen/arch/x86/efi/Makefile
@@ -9,11 +9,11 @@ $(obj)/%.o: $(src)/%.ihex FORCE
 $(obj)/boot.init.o: $(obj)/buildid.o
 
 $(call cc-option-add,cflags-stack-boundary,CC,-mpreferred-stack-boundary=4)
-$(addprefix $(obj)/,$(EFIOBJ-y)): CFLAGS_stack_boundary := $(cflags-stack-boundary)
+$(addprefix $(obj)/,$(EFIOBJ-y) mbi2.init.o): CFLAGS_stack_boundary := $(cflags-stack-boundary)
 
 obj-y := common-stub.o stub.o
 obj-$(XEN_BUILD_EFI) := $(filter-out %.init.o,$(EFIOBJ-y))
 obj-bin-$(XEN_BUILD_EFI) := $(filter %.init.o,$(EFIOBJ-y))
-obj-bin-y += mbi2.o
+obj-bin-y += mbi2.init.o
 extra-$(XEN_BUILD_EFI) += buildid.o relocs-dummy.o
 nocov-$(XEN_BUILD_EFI) += stub.o
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 15 17:55:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 15 Oct 2024 17:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819315.1232609 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0llK-00085b-Oe; Tue, 15 Oct 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 819315.1232609; Tue, 15 Oct 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 1t0llK-00085T-M3; Tue, 15 Oct 2024 17:55:14 +0000
Received: by outflank-mailman (input) for mailman id 819315;
 Tue, 15 Oct 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 1t0llK-00085G-Cj
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 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 1t0llK-0006gK-BD
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 17:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0llK-0006c8-8y
 for xen-changelog@lists.xenproject.org; Tue, 15 Oct 2024 17: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=lOlUBaaFmAOrVoBq0l2drElqopvtrEGb0Gxn9dB9tiE=; b=lrFH2HFU/7tVQLlJgf/gUT0wDx
	8NWD4pk53shaRlj7h7y51jaK7pSP48JPCAJZ8qgr+Jbdp9Dy/tvANonKwGlKSgWIG4hIPtxuP0h5F
	x4SkU55YGnMEf9zkPJRPKguZL9CrxtD6+7awvvotl87wJeiQjop98qzxqGx5gMDfBmFc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Improve MBI2 structure check
Message-Id: <E1t0llK-0006c8-8y@xenbits.xenproject.org>
Date: Tue, 15 Oct 2024 17:55:14 +0000

commit 47990ecef286606794d607d4ca8703d71c98d659
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Tue Oct 15 09:25:13 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 15 18:22:07 2024 +0100

    x86/boot: Improve MBI2 structure check
    
    Tag structure should contain at least the tag header.
    Entire tag structure must be contained inside MBI2 data.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/arch/x86/efi/mbi2.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/efi/mbi2.c b/xen/arch/x86/efi/mbi2.c
index 55a1777483..d2f0f0ee61 100644
--- a/xen/arch/x86/efi/mbi2.c
+++ b/xen/arch/x86/efi/mbi2.c
@@ -13,6 +13,7 @@ efi_multiboot2_prelude(uint32_t magic, const multiboot2_fixed_t *mbi)
     EFI_HANDLE ImageHandle = NULL;
     EFI_SYSTEM_TABLE *SystemTable = NULL;
     const char *cmdline = NULL;
+    const void *const mbi_raw = (const void *)mbi;
     bool have_bs = false;
 
     if ( magic != MULTIBOOT2_BOOTLOADER_MAGIC )
@@ -21,8 +22,10 @@ efi_multiboot2_prelude(uint32_t magic, const multiboot2_fixed_t *mbi)
     /* Skip Multiboot2 information fixed part. */
     tag = _p(ROUNDUP((unsigned long)(mbi + 1), MULTIBOOT2_TAG_ALIGN));
 
-    for ( ; (const void *)tag - (const void *)mbi < mbi->total_size &&
-            tag->type != MULTIBOOT2_TAG_TYPE_END;
+    for ( ; (const void *)(tag + 1) - mbi_raw <= mbi->total_size &&
+            tag->type != MULTIBOOT2_TAG_TYPE_END &&
+            tag->size >= sizeof(*tag) &&
+            (const void *)tag + tag->size - mbi_raw <= mbi->total_size;
           tag = _p(ROUNDUP((unsigned long)tag + tag->size,
                    MULTIBOOT2_TAG_ALIGN)) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 16 05:33:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 16 Oct 2024 05:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819518.1232849 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0wed-00084Q-DF; Wed, 16 Oct 2024 05:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 819518.1232849; Wed, 16 Oct 2024 05: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 1t0wed-00084I-AR; Wed, 16 Oct 2024 05:33:03 +0000
Received: by outflank-mailman (input) for mailman id 819518;
 Wed, 16 Oct 2024 05: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 1t0wec-00084A-2Z
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05: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 1t0wec-0002OX-1o
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05:33:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0web-00057w-VW
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05: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=3ONTUBIDxj6Vv6ABXnPyI5EAkWyEXyZamSCj1HhDGK8=; b=gmzjFOQDD2uLKdEGDkUz0nE4vz
	filr//BLHG6IRSW+6/JUkIcG4pUDsL9n6TgETAPY8wn/aTEIzXBA2+ORn9CgShhDRX7AMaI4Tv6l3
	4BFXlsW0CCuLhKt9PlH8yNCZBmTB/3V2EBi5Q1zZIxzbd2x6I50Y+yoFCoNe8NYatMq8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: introduce DECL_SECTION_WITH_LADDR
Message-Id: <E1t0web-00057w-VW@xenbits.xenproject.org>
Date: Wed, 16 Oct 2024 05:33:01 +0000

commit 17d32cf2ecc1f22d2738cc9301485b4e8d356e33
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Oct 15 14:19:07 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 15 14:19:07 2024 +0200

    xen: introduce DECL_SECTION_WITH_LADDR
    
    Introduce DECL_SECTION_WITH_LADDR in order to signal whether
    DECL_SECTION() should specify a load address or not.
    
    Update {ppc,x86}/xen.lds.S to use DECL_SECTION_WITH_LADDR.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/ppc/xen.lds.S    | 2 ++
 xen/arch/x86/xen.lds.S    | 6 ++++--
 xen/include/xen/xen.lds.h | 6 ++++++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/xen/arch/ppc/xen.lds.S b/xen/arch/ppc/xen.lds.S
index 0c4b94814b..30b4a6ced8 100644
--- a/xen/arch/ppc/xen.lds.S
+++ b/xen/arch/ppc/xen.lds.S
@@ -1,4 +1,6 @@
 #include <xen/lib.h>
+
+#define DECL_SECTION_WITH_LADDR
 #include <xen/xen.lds.h>
 
 OUTPUT_ARCH(powerpc:common64)
diff --git a/xen/arch/x86/xen.lds.S b/xen/arch/x86/xen.lds.S
index 94079fc164..35693f6e33 100644
--- a/xen/arch/x86/xen.lds.S
+++ b/xen/arch/x86/xen.lds.S
@@ -3,6 +3,10 @@
 
 #include <xen/cache.h>
 #include <xen/lib.h>
+
+#ifndef EFI
+# define DECL_SECTION_WITH_LADDR
+#endif
 #include <xen/xen.lds.h>
 #include <asm/page.h>
 
@@ -10,9 +14,7 @@
 
 #define FORMAT "pei-x86-64"
 #undef __XEN_VIRT_START
-#undef DECL_SECTION
 #define __XEN_VIRT_START __image_base__
-#define DECL_SECTION(x) x :
 
 ENTRY(efi_start)
 
diff --git a/xen/include/xen/xen.lds.h b/xen/include/xen/xen.lds.h
index 24b8900ffe..c6178bdc42 100644
--- a/xen/include/xen/xen.lds.h
+++ b/xen/include/xen/xen.lds.h
@@ -5,6 +5,8 @@
  * Common macros to be used in architecture specific linker scripts.
  */
 
+#ifdef DECL_SECTION_WITH_LADDR
+
 /*
  * Declare a section whose load address is based at PA 0 rather than
  * Xen's virtual base address.
@@ -15,6 +17,10 @@
 # define DECL_SECTION(x) x : AT(ADDR(x) - __XEN_VIRT_START)
 #endif
 
+#else /* !DECL_SECTION_WITH_LADDR */
+#define DECL_SECTION(x) x :
+#endif
+
 /*
  * To avoid any confusion, please note that the EFI macro does not correspond
  * to EFI support and is used when linking a native EFI (i.e. PE/COFF) binary,
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 16 05:33:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 16 Oct 2024 05:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819519.1232854 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0wen-000872-GO; Wed, 16 Oct 2024 05:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 819519.1232854; Wed, 16 Oct 2024 05: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 1t0wen-00086u-Dq; Wed, 16 Oct 2024 05:33:13 +0000
Received: by outflank-mailman (input) for mailman id 819519;
 Wed, 16 Oct 2024 05: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 1t0wem-00086i-6v
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05: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 1t0wem-0002Ok-5o
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05:33:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0wem-00058k-44
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05: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=ZPTeqSeYzHLHhY4dUvSpvLuCqZRMxNHAIfFF7bwuEAI=; b=K27y6lF/tq/wq4lDMHFNUUYN2v
	sCcrCToiP++99lz98sAl1pZJUN/4FWQqWu73nIsb+OOOYr3qeSr/eVtEIRI1NCFE30UHkVENN728J
	8zRGimM8LYdLw+FIEO61EXD7T8zv50g9Mh2HYzZUQGWhfi6ShITXvKhx909jDDdHF0dA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen: define ACPI and DT device info sections macros
Message-Id: <E1t0wem-00058k-44@xenbits.xenproject.org>
Date: Wed, 16 Oct 2024 05:33:12 +0000

commit 083344a05d6d94ef8de2963148df6af95508d4f9
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Oct 15 14:20:05 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 15 14:20:05 2024 +0200

    xen: define ACPI and DT device info sections macros
    
    Introduce macros to define device information sections based on
    the configuration of ACPI or device tree support. These sections
    are required for common code of device initialization and getting
    an information about a device.
    
    These macros are expected to be used across different
    architectures (Arm, PPC, RISC-V), so they are moved to
    the common xen/xen.lds.h, based on their original definition
    in Arm.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/include/xen/xen.lds.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/xen/include/xen/xen.lds.h b/xen/include/xen/xen.lds.h
index c6178bdc42..16a9b1ba03 100644
--- a/xen/include/xen/xen.lds.h
+++ b/xen/include/xen/xen.lds.h
@@ -120,6 +120,14 @@
 
 /* List of constructs other than *_SECTIONS in alphabetical order. */
 
+#define ACPI_DEV_INFO        \
+  . = ALIGN(POINTER_ALIGN);  \
+  DECL_SECTION(.adev.info) { \
+      _asdevice = .;         \
+      *(.adev.info)          \
+      _aedevice = .;         \
+  } :text
+
 #define BUGFRAMES                               \
     __start_bug_frames_0 = .;                   \
     *(.bug_frames.0)                            \
@@ -137,6 +145,14 @@
     *(.bug_frames.3)                            \
     __stop_bug_frames_3 = .;
 
+#define DT_DEV_INFO         \
+  . = ALIGN(POINTER_ALIGN); \
+  DECL_SECTION(.dev.info) { \
+       _sdevice = .;        \
+       *(.dev.info)         \
+       _edevice = .;        \
+  } :text
+
 #ifdef CONFIG_HYPFS
 #define HYPFS_PARAM              \
        . = ALIGN(POINTER_ALIGN); \
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 16 05:33:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 16 Oct 2024 05:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819520.1232857 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0wex-00089u-Hy; Wed, 16 Oct 2024 05:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 819520.1232857; Wed, 16 Oct 2024 05: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 1t0wex-00089m-FN; Wed, 16 Oct 2024 05:33:23 +0000
Received: by outflank-mailman (input) for mailman id 819520;
 Wed, 16 Oct 2024 05: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 1t0wew-00089b-Aa
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05: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 1t0wew-0002Os-9g
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0wew-00059U-7x
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05: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=EalU/dnXC9HctKjcjLvrNxEWsWExioxj6xKTXyKYw04=; b=d+N9/vI30ISBtNpwqBaeI/xjqJ
	LmszmJKZ85lBetQeivcwO8+kk+U6QjuQ48qUblgUR34fGF+5dwtn9CXLujjzHe5xjqRdtV/02NKdd
	K4h6uf8AHag/8mAZY8x55NFeIOZoQQeF63/bSijoRA/mE5p3Fd4cQWU7kgHWdvvYI+AI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: use {DT,ACPI}_DEV_INFO for device info sections
Message-Id: <E1t0wew-00059U-7x@xenbits.xenproject.org>
Date: Wed, 16 Oct 2024 05:33:22 +0000

commit 31f31b624ab655e45ea345aa62eecf62897be06d
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Oct 15 14:20:43 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 15 14:20:43 2024 +0200

    xen/arm: use {DT,ACPI}_DEV_INFO for device info sections
    
    Refactor arm/xen.lds.S by replacing the inline definitions for
    device info sections with the newly introduced {DT,ACPI}_DEV_INFO
    macros from xen/xen.lds.h.
    
    Change alignment of DT_DEV_INFO and ACPI_DEV_INFO sections from
    8 to POINTER_ALIGN as struct acpi_device_desc and struct device_desc
    don't have any uint64_t's so it is safe to do that.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Reviewed-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/arch/arm/xen.lds.S | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/xen/arch/arm/xen.lds.S b/xen/arch/arm/xen.lds.S
index 0987052f1a..5b9abc9a2d 100644
--- a/xen/arch/arm/xen.lds.S
+++ b/xen/arch/arm/xen.lds.S
@@ -124,20 +124,10 @@ SECTIONS
       _eplatform = .;
   } :text
 
-  . = ALIGN(8);
-  .dev.info : {
-      _sdevice = .;
-      *(.dev.info)
-      _edevice = .;
-  } :text
+  DT_DEV_INFO
 
 #ifdef CONFIG_ACPI
-  . = ALIGN(8);
-  .adev.info : {
-      _asdevice = .;
-      *(.adev.info)
-      _aedevice = .;
-  } :text
+  ACPI_DEV_INFO
 #endif
 
   . = ALIGN(8);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 16 05:33:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 16 Oct 2024 05:33:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819521.1232861 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0wf8-0008CT-JD; Wed, 16 Oct 2024 05:33:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 819521.1232861; Wed, 16 Oct 2024 05:33:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0wf8-0008CM-Gm; Wed, 16 Oct 2024 05:33:34 +0000
Received: by outflank-mailman (input) for mailman id 819521;
 Wed, 16 Oct 2024 05: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 1t0wf6-0008C8-E9
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05: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 1t0wf6-0002PJ-Cm
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0wf6-0005Ad-Bt
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05: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=0CYrv/8JvADwLcGtvqcXgIGDweotVvMzOWT/WQ3WTvU=; b=lGVGuJrYsMqCHHrYuugqpN/g3J
	hWiKr8/JhkDByYol7ahSqwu2XZc2uYHDmpPCqINlIt9KT+9yvUBcqKUN2o0rIK9aZtGEpkor5cnK/
	l02jubO3sTYKEVSStjK+XgSvzbldWom0XI/NpNBw6/WtUFFpipzHmlcwkfXNjUlblucs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/ppc: add section for device information in linker script
Message-Id: <E1t0wf6-0005Ad-Bt@xenbits.xenproject.org>
Date: Wed, 16 Oct 2024 05:33:32 +0000

commit 7a87b5e05ca6aeb4c9453c1c55cbca2c29dd7e7d
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Oct 15 14:21:04 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 15 14:21:04 2024 +0200

    xen/ppc: add section for device information in linker script
    
    Introduce a new `.dev.info` section in the PPC linker script to
    handle device-specific information. This section is required by
    common code (common/device.c: device_init(), device_get_class() ).
    This section is aligned to `POINTER_ALIGN`, with `_sdevice` and `_edevice`
    marking the start and end of the section, respectively.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Shawn Anastasio <sanastasio@raptorengineering.com>
---
 xen/arch/ppc/xen.lds.S | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/ppc/xen.lds.S b/xen/arch/ppc/xen.lds.S
index 30b4a6ced8..3f2a7676ec 100644
--- a/xen/arch/ppc/xen.lds.S
+++ b/xen/arch/ppc/xen.lds.S
@@ -96,6 +96,8 @@ SECTIONS
         CONSTRUCTORS
     } :text
 
+    DT_DEV_INFO                       /* Devicetree based device info */
+
     . = ALIGN(PAGE_SIZE);             /* Init code and data */
     __init_begin = .;
     DECL_SECTION(.init.text) {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 16 05:33:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 16 Oct 2024 05:33:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819522.1232866 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0wfI-0008FS-Kw; Wed, 16 Oct 2024 05:33:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 819522.1232866; Wed, 16 Oct 2024 05:33:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0wfI-0008FK-ID; Wed, 16 Oct 2024 05:33:44 +0000
Received: by outflank-mailman (input) for mailman id 819522;
 Wed, 16 Oct 2024 05: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 1t0wfG-0008F0-Ge
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05: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 1t0wfG-0002PQ-G0
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05:33:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0wfG-0005DL-Ez
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05: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=W6u+Qslt3ENFrtOO1QkzzHJTYtEhaq0lZfbeqsDwQ+U=; b=yAapQKzQs77Olj5JP9L68VXf4e
	HrPHPSzeUXRK2RpdtC7R1rJbXleWdcz91yPuJj/QbjP3hUXlSV9eif9kdk+DzH4gfvSxsIYecVWtB
	vs3iKVlUIYikYu+UVO+Bpa7DSXPZXdlOwsRLVPT8G6V6sMHdpe46d3qwqkedyz9F9scs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: add section for device information in linker script
Message-Id: <E1t0wfG-0005DL-Ez@xenbits.xenproject.org>
Date: Wed, 16 Oct 2024 05:33:42 +0000

commit af2a1339c4bd9dcde980beeed0e2f5b3739522fd
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Oct 15 14:21:14 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 15 14:21:14 2024 +0200

    xen/riscv: add section for device information in linker script
    
    Introduce a new `.dev.info` section in the RISC-V linker script to
    handle device-specific information. This section is required by
    common code (common/device.c: device_init(), device_get_class() ).
    This section is aligned to `POINTER_ALIGN`, with `_sdevice` and `_edevice`
    marking the start and end of the section, respectively.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/xen.lds.S | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/arch/riscv/xen.lds.S b/xen/arch/riscv/xen.lds.S
index 558a5a992a..dffc6ae119 100644
--- a/xen/arch/riscv/xen.lds.S
+++ b/xen/arch/riscv/xen.lds.S
@@ -91,6 +91,8 @@ SECTIONS
         CONSTRUCTORS
     } :text
 
+    DT_DEV_INFO                       /* Devicetree based device info */
+
     . = ALIGN(PAGE_SIZE);             /* Init code and data */
     __init_begin = .;
     .init.text : {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 16 05:33:53 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 16 Oct 2024 05:33:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819523.1232870 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0wfR-0008IJ-M8; Wed, 16 Oct 2024 05:33:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 819523.1232870; Wed, 16 Oct 2024 05: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 1t0wfR-0008IB-JY; Wed, 16 Oct 2024 05:33:53 +0000
Received: by outflank-mailman (input) for mailman id 819523;
 Wed, 16 Oct 2024 05: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 1t0wfQ-0008I1-K1
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05: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 1t0wfQ-0002R6-J7
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05:33:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0wfQ-0005E4-ID
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05: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=SbshSSGnRzqhYawH9gMzRyuTvZ2emiTksnj9odL5HUQ=; b=rYQvwGZ19a3XAIGR0o2hgmFd4d
	gMJ3lfKLYeGGw+Z0Tkw6o96YkoIUf6JdpTS8pgl10GzMt1ZRdBK3U437uy0h/w0G/nyROJkWFf4vi
	qWS4GtPciQeKqrJkulL7IetUcWru2wNSwN+BhWJwEmSp3Lss6w8DlD2mgJ+lKRTfVwpA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/common: move device initialization code to common code
Message-Id: <E1t0wfQ-0005E4-ID@xenbits.xenproject.org>
Date: Wed, 16 Oct 2024 05:33:52 +0000

commit ed896312f2e4e238266830a0452a1af5fa7aecbc
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Oct 15 14:22:00 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 15 14:22:00 2024 +0200

    xen/common: move device initialization code to common code
    
    Remove the device initialization code from `xen/arch/arm/device.c`
    and move it to the common code to avoid duplication and make it accessible
    for both ARM and other architectures.
    device_get_class(), device_init(), _sdevice[] and _edevice[] are wrapped by
    "#ifdef CONFIG_HAS_DEVICE_TREE" for the case if an arch doesn't support
    device tree.
    
    Remove unnecessary inclusions of <asm/device.h> and <xen/init.h> from
    `xen/arch/arm/device.c` as no code in the file relies on these headers.
    Fix the inclusion order by moving <asm/setup.h> after <xen/*> headers to
    resolve a compilation error:
       ./include/public/xen.h:968:35: error: unknown type name 'uint64_t'
        968 | __DEFINE_XEN_GUEST_HANDLE(uint64, uint64_t);
            |                                   ^~~~~~~~
       ./include/public/arch-arm.h:191:21: note: in definition of macro '___DEFINE_XEN_GUEST_HANDLE'
       191 |     typedef union { type *p; uint64_aligned_t q; }              \
           |                     ^~~~
       ./include/public/xen.h:968:1: note: in expansion of macro '__DEFINE_XEN_GUEST_HANDLE'
       968 | __DEFINE_XEN_GUEST_HANDLE(uint64, uint64_t);
    because <asm/setup.h> includes <public/version.h>, which in turn includes
    "xen.h", which requires <xen/types.h> to be processed correctly.
    Additionally, add <xen/device_tree.h> to `device.c` as functions from this
    header are used within the file.
    
    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/device.c | 71 ++------------------------------------------
 xen/common/Makefile   |  2 ++
 xen/common/device.c   | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 86 insertions(+), 69 deletions(-)

diff --git a/xen/arch/arm/device.c b/xen/arch/arm/device.c
index 3e02cff008..5610cddcba 100644
--- a/xen/arch/arm/device.c
+++ b/xen/arch/arm/device.c
@@ -8,79 +8,12 @@
  * Copyright (C) 2013 Linaro Limited.
  */
 
-#include <asm/device.h>
-#include <asm/setup.h>
+#include <xen/device_tree.h>
 #include <xen/errno.h>
-#include <xen/init.h>
 #include <xen/iocap.h>
 #include <xen/lib.h>
 
-extern const struct device_desc _sdevice[], _edevice[];
-
-#ifdef CONFIG_ACPI
-extern const struct acpi_device_desc _asdevice[], _aedevice[];
-#endif
-
-int __init device_init(struct dt_device_node *dev, enum device_class class,
-                       const void *data)
-{
-    const struct device_desc *desc;
-
-    ASSERT(dev != NULL);
-
-    if ( !dt_device_is_available(dev) || dt_device_for_passthrough(dev) )
-        return  -ENODEV;
-
-    for ( desc = _sdevice; desc != _edevice; desc++ )
-    {
-        if ( desc->class != class )
-            continue;
-
-        if ( dt_match_node(desc->dt_match, dev) )
-        {
-            ASSERT(desc->init != NULL);
-
-            return desc->init(dev, data);
-        }
-
-    }
-
-    return -EBADF;
-}
-
-#ifdef CONFIG_ACPI
-int __init acpi_device_init(enum device_class class, const void *data, int class_type)
-{
-    const struct acpi_device_desc *desc;
-
-    for ( desc = _asdevice; desc != _aedevice; desc++ )
-    {
-        if ( ( desc->class != class ) || ( desc->class_type != class_type ) )
-            continue;
-
-        ASSERT(desc->init != NULL);
-
-        return desc->init(data);
-    }
-
-    return -EBADF;
-}
-#endif
-
-enum device_class device_get_class(const struct dt_device_node *dev)
-{
-    const struct device_desc *desc;
-
-    ASSERT(dev != NULL);
-
-    for ( desc = _sdevice; desc != _edevice; desc++ )
-    {
-        if ( dt_match_node(desc->dt_match, dev) )
-            return desc->class;
-    }
-
-    return DEVICE_UNKNOWN;
-}
+#include <asm/setup.h>
 
 int map_irq_to_domain(struct domain *d, unsigned int irq,
                       bool need_mapping, const char *devname)
diff --git a/xen/common/Makefile b/xen/common/Makefile
index f90bb00d23..fc48cbf688 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -6,6 +6,8 @@ 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.o
+obj-$(filter-out $(CONFIG_X86),$(CONFIG_ACPI)) += device.o
 obj-$(CONFIG_HAS_DEVICE_TREE) += device-tree/
 obj-$(CONFIG_IOREQ_SERVER) += dm.o
 obj-y += domain.o
diff --git a/xen/common/device.c b/xen/common/device.c
new file mode 100644
index 0000000000..33e0d58f2f
--- /dev/null
+++ b/xen/common/device.c
@@ -0,0 +1,82 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Based on the code from:
+ *   xen/arch/arm/device.c
+ */
+
+#include <xen/bug.h>
+#include <xen/device_tree.h>
+#include <xen/errno.h>
+#include <xen/init.h>
+
+#include <asm/device.h>
+
+#ifdef CONFIG_HAS_DEVICE_TREE
+
+extern const struct device_desc _sdevice[], _edevice[];
+
+int __init device_init(struct dt_device_node *dev, enum device_class class,
+                       const void *data)
+{
+    const struct device_desc *desc;
+
+    ASSERT(dev != NULL);
+
+    if ( !dt_device_is_available(dev) || dt_device_for_passthrough(dev) )
+        return  -ENODEV;
+
+    for ( desc = _sdevice; desc != _edevice; desc++ )
+    {
+        if ( desc->class != class )
+            continue;
+
+        if ( dt_match_node(desc->dt_match, dev) )
+        {
+            ASSERT(desc->init != NULL);
+
+            return desc->init(dev, data);
+        }
+    }
+
+    return -EBADF;
+}
+
+enum device_class device_get_class(const struct dt_device_node *dev)
+{
+    const struct device_desc *desc;
+
+    ASSERT(dev != NULL);
+
+    for ( desc = _sdevice; desc != _edevice; desc++ )
+    {
+        if ( dt_match_node(desc->dt_match, dev) )
+            return desc->class;
+    }
+
+    return DEVICE_UNKNOWN;
+}
+
+#endif
+
+#ifdef CONFIG_ACPI
+
+extern const struct acpi_device_desc _asdevice[], _aedevice[];
+
+int __init acpi_device_init(enum device_class class, const void *data, int class_type)
+{
+    const struct acpi_device_desc *desc;
+
+    for ( desc = _asdevice; desc != _aedevice; desc++ )
+    {
+        if ( ( desc->class != class ) || ( desc->class_type != class_type ) )
+            continue;
+
+        ASSERT(desc->init != NULL);
+
+        return desc->init(data);
+    }
+
+    return -EBADF;
+}
+
+#endif
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 16 05:34:03 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 16 Oct 2024 05:34:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819524.1232873 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0wfb-0008LB-NX; Wed, 16 Oct 2024 05:34:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 819524.1232873; Wed, 16 Oct 2024 05: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 1t0wfb-0008L3-L1; Wed, 16 Oct 2024 05:34:03 +0000
Received: by outflank-mailman (input) for mailman id 819524;
 Wed, 16 Oct 2024 05: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 1t0wfa-0008Kt-Mt
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05: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 1t0wfa-0002RQ-M8
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05:34:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0wfa-0005FQ-LG
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05: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=zM4WWm52dTKtHb1pjFSX51Vl+B1LDDPo2PAxUf8gCpM=; b=dUW+iGKAaSet3UFxcqfY2Vio3C
	B0t7OydCGhl5ddgZKWbV6uT7ay8DpAJgGQnJRFpHQwXsc9IDI8B21azhhT9LtwMF9q0FBvfeaUima
	mM82tLQT4GSrQsz6lnZZoji2kY/VTyWEdpycEAD3BxNsLopd2xaZDAF1L8sH/lRdTlyA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/vpci: address violations of MISRA C Rule 16.3
Message-Id: <E1t0wfa-0005FQ-LG@xenbits.xenproject.org>
Date: Wed, 16 Oct 2024 05:34:02 +0000

commit 028148788f044a287a8714ef1080bf83f3e766ec
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Tue Oct 15 14:22:56 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 15 14:22:56 2024 +0200

    xen/vpci: address violations of MISRA C Rule 16.3
    
    Address violations of MISRA C:2012 Rule 16.3:
    "An unconditional `break' statement shall terminate every
    switch-clause".
    
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/vpci/msix.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/drivers/vpci/msix.c b/xen/drivers/vpci/msix.c
index fbe710ab92..5bb4444ce2 100644
--- a/xen/drivers/vpci/msix.c
+++ b/xen/drivers/vpci/msix.c
@@ -364,6 +364,7 @@ static int adjacent_read(const struct domain *d, const struct vpci_msix *msix,
 
     default:
         ASSERT_UNREACHABLE();
+        break;
     }
     spin_unlock(&vpci->lock);
 
@@ -512,6 +513,7 @@ static int adjacent_write(const struct domain *d, const struct vpci_msix *msix,
 
     default:
         ASSERT_UNREACHABLE();
+        break;
     }
     spin_unlock(&vpci->lock);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 16 05:34:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 16 Oct 2024 05:34:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819525.1232878 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0wfl-0008Nj-On; Wed, 16 Oct 2024 05:34:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 819525.1232878; Wed, 16 Oct 2024 05: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 1t0wfl-0008Nb-MO; Wed, 16 Oct 2024 05:34:13 +0000
Received: by outflank-mailman (input) for mailman id 819525;
 Wed, 16 Oct 2024 05:34: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 1t0wfl-0008NR-2i
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05:34: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 1t0wfk-0002RX-P7
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05:34:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0wfk-0005GU-OM
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05: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=BYMzEQjZpWKIlOR7DrHZgnio9CyBqdHlA3TCb01Bb30=; b=oNmo8+3JAnM0nWWmuoJDZsD4Xv
	1FzwunoKhnVLp9+1xfDuMMpvCmC0at8FxQP1kluWSRWv3AgcpbYIZt3H2IvVKi56+1Wze9Gd4KKsX
	U2Jy9aWjVCHVtPXtEwwRdY8VMYe3TSjHO0uI0MCi9YdXQ0daF0A6DIheVCHyWwOn9tQA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: initialize bootinfo from dtb
Message-Id: <E1t0wfk-0005GU-OM@xenbits.xenproject.org>
Date: Wed, 16 Oct 2024 05:34:12 +0000

commit de709f76472257c87450ecad9c54d097143d691b
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Oct 15 14:23:19 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 15 14:23:19 2024 +0200

    xen/riscv: initialize bootinfo from dtb
    
    Parse DTB during startup, allowing memory banks and reserved
    memory regions to be set up, along with early device tree node
    (chosen, "xen,domain", "reserved-memory", etc) handling.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/setup.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index f531ca38ee..63feea14c7 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -50,6 +50,9 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
                           _end - _start, false) )
         panic("Failed to add BOOTMOD_XEN\n");
 
+    if ( !boot_fdt_info(device_tree_flattened, dtb_addr) )
+        BUG();
+
     printk("All set up\n");
 
     machine_halt();
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 16 05:34:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 16 Oct 2024 05:34:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819526.1232882 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0wfv-0008QI-QR; Wed, 16 Oct 2024 05:34:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 819526.1232882; Wed, 16 Oct 2024 05:34:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0wfv-0008QA-Ns; Wed, 16 Oct 2024 05:34:23 +0000
Received: by outflank-mailman (input) for mailman id 819526;
 Wed, 16 Oct 2024 05: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 1t0wfu-0008Q3-Si
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05: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 1t0wfu-0002Re-S0
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05:34:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0wfu-0005HZ-RE
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05: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=sTu3rgkWAHmsMFvZiluEWSayJENXHDaENX+mHlaRafc=; b=smm7x20jj9XMoQBdUpv6z5Oflo
	P+sBnYkOIlwIM7KfvR3/90Yx5dOdtHag0e7Yudv/pFT0iGCm39oNIWT7IRtNmjaI6p38hPJxNGBlw
	cBW7WGhnS4WmskjBZRPpG67jMx9fOz1ejtapKAunoXsXSD3NrbRYvSvxerMYDYJSXTY4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/riscv: parse and handle fdt command line
Message-Id: <E1t0wfu-0005HZ-RE@xenbits.xenproject.org>
Date: Wed, 16 Oct 2024 05:34:22 +0000

commit 8c858d04ac5c154517664afe01db67e5ced816ad
Author:     Oleksii Kurochko <oleksii.kurochko@gmail.com>
AuthorDate: Tue Oct 15 14:23:41 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 15 14:23:41 2024 +0200

    xen/riscv: parse and handle fdt command line
    
    Receive Xen's command line passed by DTB using boot_fdt_cmdline()
    and passed it to cmdline_parse() for further procesinng and setup
    of Xen-specific parameters.
    
    Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/riscv/setup.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c
index 63feea14c7..e29bd75d7c 100644
--- a/xen/arch/riscv/setup.c
+++ b/xen/arch/riscv/setup.c
@@ -27,6 +27,8 @@ unsigned char __initdata cpu0_boot_stack[STACK_SIZE]
 void __init noreturn start_xen(unsigned long bootcpu_id,
                                paddr_t dtb_addr)
 {
+    const char *cmdline;
+
     remove_identity_mapping();
 
     set_processor_id(0);
@@ -53,6 +55,10 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
     if ( !boot_fdt_info(device_tree_flattened, dtb_addr) )
         BUG();
 
+    cmdline = boot_fdt_cmdline(device_tree_flattened);
+    printk("Command line: %s\n", cmdline);
+    cmdline_parse(cmdline);
+
     printk("All set up\n");
 
     machine_halt();
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 16 05:34:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 16 Oct 2024 05:34:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819527.1232886 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0wg5-0008T9-TF; Wed, 16 Oct 2024 05:34:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 819527.1232886; Wed, 16 Oct 2024 05:34:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0wg5-0008T1-Qg; Wed, 16 Oct 2024 05:34:33 +0000
Received: by outflank-mailman (input) for mailman id 819527;
 Wed, 16 Oct 2024 05:34: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 1t0wg4-0008St-Vh
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05: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 1t0wg4-0002S1-V0
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05:34:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0wg4-0005J7-U9
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05: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=0kRR1YsXZMGoHK2Dsgv5URrg/Ox/x+0W+e51j6BVLjQ=; b=6zL0G9vIpkc2dwqF3u9/IurOrn
	HAd39k9LOj0HtmzPcXOtFe1BTgF+vRVWjbQFNo+Yj0VuFV5uNBRSD+tM8yjS6jRhwOy8e7YAjMaZp
	WAbYy/9GpxrExMIcpxsaG5gNZ2cV+nGFsbcUyzhwp0WXTxQuUGDASqQvT6gsPTZweJl0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] iommu/amd-vi: do not error if device referenced in IVMD is not behind any IOMMU
Message-Id: <E1t0wg4-0005J7-U9@xenbits.xenproject.org>
Date: Wed, 16 Oct 2024 05:34:32 +0000

commit 2defb544900a11f93104ac68d2f8beba89d4bd02
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Oct 15 14:23:59 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 15 14:23:59 2024 +0200

    iommu/amd-vi: do not error if device referenced in IVMD is not behind any IOMMU
    
    IVMD table contains restrictions about memory which must be mandatory assigned
    to devices (and which permissions it should use), or memory that should be
    never accessible to devices.
    
    Some hardware however contains ranges in IVMD that reference devices outside of
    the IVHD tables (in other words, devices not behind any IOMMU).  Such mismatch
    will cause Xen to fail in register_range_for_device(), ultimately leading to
    the IOMMU being disabled, and Xen crashing as x2APIC support might be already
    enabled and relying on the IOMMU functionality.
    
    Relax IVMD parsing: allow IVMD blocks to reference devices not assigned to any
    IOMMU.  It's impossible for Xen to fulfill the requirement in the IVMD block if
    the device is not behind any IOMMU, but it's no worse than booting without
    IOMMU support, and thus not parsing ACPI IVRS in the first place.
    
    Reported-by: Willi Junga <xenproject@ymy.be>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/drivers/passthrough/amd/iommu_acpi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu_acpi.c b/xen/drivers/passthrough/amd/iommu_acpi.c
index 3f5508eba0..c416120326 100644
--- a/xen/drivers/passthrough/amd/iommu_acpi.c
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c
@@ -248,8 +248,9 @@ static int __init register_range_for_device(
     iommu = find_iommu_for_device(seg, bdf);
     if ( !iommu )
     {
-        AMD_IOMMU_ERROR("IVMD: no IOMMU for Dev_Id %#x\n", bdf);
-        return -ENODEV;
+        AMD_IOMMU_WARN("IVMD: no IOMMU for device %pp - ignoring constrain\n",
+                       &PCI_SBDF(seg, bdf));
+        return 0;
     }
     req = ivrs_mappings[bdf].dte_requestor_id;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 16 05:34:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 16 Oct 2024 05:34:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819528.1232890 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0wgF-0008Vj-Uu; Wed, 16 Oct 2024 05:34:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 819528.1232890; Wed, 16 Oct 2024 05:34:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0wgF-0008Vb-SC; Wed, 16 Oct 2024 05:34:43 +0000
Received: by outflank-mailman (input) for mailman id 819528;
 Wed, 16 Oct 2024 05:34: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 1t0wgF-0008VT-2J
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05:34: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 1t0wgF-0002S8-1b
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05:34:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0wgF-0005K1-0q
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05:34:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=YM9XdCQk9s9Pi5lFLnBDW1sn3guvo+aOqVlrZCY3fdo=; b=0gxcTVw14A6S8Fer5f2TQoPwaK
	QCLCjP0STCEQWUdKFHw0fTSh95yn2osOjKUk3F5XMBrTBZ24GjnELabBLwkBo0D1nSgbpciE7FwLJ
	dveWFhveg2b/4AL/hrFzMTlmZQj/yeFsSjpB+EbkWCxRd1x5YuyRGcP/sL4XhzbuPnpg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Prep work for 32bit object changes
Message-Id: <E1t0wgF-0005K1-0q@xenbits.xenproject.org>
Date: Wed, 16 Oct 2024 05:34:43 +0000

commit 93af5cc4dffbd316f607d5abc8a16293cdb75840
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Tue Oct 15 14:24:25 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 15 14:24:25 2024 +0200

    x86/boot: Prep work for 32bit object changes
    
    Broken out of the subsequent patch for clarity.
    
     * Rename head-bin-objs to obj32
     * Use a .32.o suffix to distinguish these objects
     * Factor out $(LD32)
    
    No functional change.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/boot/Makefile | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index ff0f965876..1199291d2b 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -1,15 +1,16 @@
 obj-bin-y += head.o
 
-head-bin-objs := cmdline.o reloc.o
+obj32 := cmdline.32.o
+obj32 += reloc.32.o
 
-nocov-y   += $(head-bin-objs)
-noubsan-y += $(head-bin-objs)
-targets   += $(head-bin-objs)
+nocov-y   += $(obj32)
+noubsan-y += $(obj32)
+targets   += $(obj32)
 
-head-bin-objs := $(addprefix $(obj)/,$(head-bin-objs))
+obj32 := $(addprefix $(obj)/,$(obj32))
 
 $(obj)/head.o: AFLAGS-y += -Wa$(comma)-I$(obj)
-$(obj)/head.o: $(head-bin-objs:.o=.bin)
+$(obj)/head.o: $(obj32:.32.o=.bin)
 
 CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS))
 $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
@@ -18,16 +19,20 @@ CFLAGS_x86_32 += -nostdinc -include $(filter %/include/xen/config.h,$(XEN_CFLAGS
 CFLAGS_x86_32 += $(filter -I% -O%,$(XEN_CFLAGS)) -D__XEN__
 
 # override for 32bit binaries
-$(head-bin-objs): CFLAGS_stack_boundary :=
-$(head-bin-objs): XEN_CFLAGS := $(CFLAGS_x86_32) -fpic
+$(obj32): CFLAGS_stack_boundary :=
+$(obj32): XEN_CFLAGS := $(CFLAGS_x86_32) -fpic
+
+$(obj)/%.32.o: $(src)/%.c FORCE
+	$(call if_changed_rule,cc_o_c)
 
 LDFLAGS_DIRECT-$(call ld-option,--warn-rwx-segments) := --no-warn-rwx-segments
 LDFLAGS_DIRECT += $(LDFLAGS_DIRECT-y)
+LD32 := $(LD) $(subst x86_64,i386,$(LDFLAGS_DIRECT))
 
 %.bin: %.lnk
 	$(OBJCOPY) -j .text -O binary $< $@
 
-%.lnk: %.o $(src)/build32.lds
-	$(LD) $(subst x86_64,i386,$(LDFLAGS_DIRECT)) -N -T $(filter %.lds,$^) -o $@ $<
+%.lnk: %.32.o $(src)/build32.lds
+	$(LD32) -N -T $(filter %.lds,$^) -o $@ $<
 
 clean-files := *.lnk *.bin
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 16 05:34:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 16 Oct 2024 05:34:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.819529.1232894 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t0wgQ-000077-07; Wed, 16 Oct 2024 05:34:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 819529.1232894; Wed, 16 Oct 2024 05:34: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 1t0wgP-00006z-Tf; Wed, 16 Oct 2024 05:34:53 +0000
Received: by outflank-mailman (input) for mailman id 819529;
 Wed, 16 Oct 2024 05:34: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 1t0wgP-00006r-5D
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05:34: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 1t0wgP-0002SF-4b
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05:34:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t0wgP-0005Mn-3n
 for xen-changelog@lists.xenproject.org; Wed, 16 Oct 2024 05:34:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=fLhpttTdpcKfezaYOllHV+hdQ9wggXpZ5NHrn75AlMw=; b=W2GQGGWt0tYr2PryAQ6Fwsndk4
	zt4liH8CpRXXMKZ+GlcaB8aSDlac2aDolekUuU5Smt76fWQaTULfOcqIqcKSCyD450E9pUZbFTie7
	pgfbhG9xNB2uqCesjktGpZ+Ip3Er156YPGlkFo3mb7Kwhj1aNyliaeeWrGRAV10LOGQQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/public: add comments regarding interface version bumps
Message-Id: <E1t0wgP-0005Mn-3n@xenbits.xenproject.org>
Date: Wed, 16 Oct 2024 05:34:53 +0000

commit 3f6ee3db2e878398cfcde725399b4d1b04e92269
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Oct 15 14:24:45 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 15 14:24:45 2024 +0200

    xen/public: add comments regarding interface version bumps
    
    domctl.h and sysctl.h have an interface version, which needs to be
    bumped in case of incompatible modifications of the interface.
    
    In order to avoid misunderstandings, add a comment to both headers
    specifying in which cases a bump is needed.
    
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/include/public/domctl.h | 10 ++++++++++
 xen/include/public/sysctl.h | 10 ++++++++++
 2 files changed, 20 insertions(+)

diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h
index e1028fc524..353f831e40 100644
--- a/xen/include/public/domctl.h
+++ b/xen/include/public/domctl.h
@@ -21,6 +21,16 @@
 #include "hvm/save.h"
 #include "memory.h"
 
+/*
+ * The interface version needs to be incremented by 1 in case the interface
+ * is modified in an incompatible way AND if the version hasn't been
+ * incremented in the current development cycle already.
+ * Pure additions (e.g. new sub-commands) or compatible interface changes
+ * (e.g. adding semantics to 0-checked input fields or data to zeroed output
+ * fields) don't require a change of the version.
+ *
+ * Last version bump: Xen 4.19
+ */
 #define XEN_DOMCTL_INTERFACE_VERSION 0x00000017
 
 /*
diff --git a/xen/include/public/sysctl.h b/xen/include/public/sysctl.h
index b2a5a724db..b0fec271d3 100644
--- a/xen/include/public/sysctl.h
+++ b/xen/include/public/sysctl.h
@@ -18,6 +18,16 @@
 #include "domctl.h"
 #include "physdev.h"
 
+/*
+ * The interface version needs to be incremented by 1 in case the interface
+ * is modified in an incompatible way AND if the version hasn't been
+ * incremented in the current development cycle already.
+ * Pure additions (e.g. new sub-commands) or compatible interface changes
+ * (e.g. adding semantics to 0-checked input fields or data to zeroed output
+ * fields) don't require a change of the version.
+ *
+ * Last version bump: Xen 4.17
+ */
 #define XEN_SYSCTL_INTERFACE_VERSION 0x00000015
 
 /*
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 17 07:22:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 17 Oct 2024 07:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.820423.1233909 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t1Kpf-0006CZ-3E; Thu, 17 Oct 2024 07:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 820423.1233909; Thu, 17 Oct 2024 07: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 1t1Kpf-0006CR-0c; Thu, 17 Oct 2024 07:22:03 +0000
Received: by outflank-mailman (input) for mailman id 820423;
 Thu, 17 Oct 2024 07: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 1t1Kpe-0006CL-2s
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 07: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 1t1Kpd-0004jA-Vs
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 07:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t1Kpd-0005Ov-Tf
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 07: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=2lEDYBbrK/KwuufkLRWxZ2K+/k5zIrLodU3LNMAF9TI=; b=l7FaSyL+VrPhFL8gy5ZDI3354D
	f91BGSm7rfbTOHKpT75l30Dk7HEQdSWLkfXvoFlloHV+QQA4CZT39Q+hP4tpkWAafzx3xsbS6LNJN
	wSpcN4HFDAgxnbpku13lWA/2i57w7j5EAsZg4RCxaddijPJ9IflSoKHiDFLohsgJxEeo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Align mbi2.c stack to 16 bytes
Message-Id: <E1t1Kpd-0005Ov-Tf@xenbits.xenproject.org>
Date: Thu, 17 Oct 2024 07:22:01 +0000

commit f4c3300d88189ab18b6459e22e1aa945ab1d3f6f
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Tue Oct 15 09:25:12 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 15 18:20:57 2024 +0100

    x86/boot: Align mbi2.c stack to 16 bytes
    
    Most of Xen is built with a stack alignment of 8 bytes, but the UEFI spec
    mandates 16 and UEFI services will fault if the stack is misaligned.
    
    While the caller of efi_multiboot2_prelude() takes care to align the stack,
    mbi2.c accidentally got the Xen-wide default of 8, and has a 50% chance of
    crashing depending on how many variables the compiler decided to spill to the
    stack.
    
    Compile mbi2.c with the appropriate alignment for UEFI functionality.
    
    Also take the opportunity to make it a fully .init object.
    
    Fixes: eb21ce14d709 ('x86/boot: Rewrite EFI/MBI2 code partly in C')
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    [rewrite the commit message]
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/efi/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/efi/Makefile b/xen/arch/x86/efi/Makefile
index 7e2b5c07de..c6678652fc 100644
--- a/xen/arch/x86/efi/Makefile
+++ b/xen/arch/x86/efi/Makefile
@@ -9,11 +9,11 @@ $(obj)/%.o: $(src)/%.ihex FORCE
 $(obj)/boot.init.o: $(obj)/buildid.o
 
 $(call cc-option-add,cflags-stack-boundary,CC,-mpreferred-stack-boundary=4)
-$(addprefix $(obj)/,$(EFIOBJ-y)): CFLAGS_stack_boundary := $(cflags-stack-boundary)
+$(addprefix $(obj)/,$(EFIOBJ-y) mbi2.init.o): CFLAGS_stack_boundary := $(cflags-stack-boundary)
 
 obj-y := common-stub.o stub.o
 obj-$(XEN_BUILD_EFI) := $(filter-out %.init.o,$(EFIOBJ-y))
 obj-bin-$(XEN_BUILD_EFI) := $(filter %.init.o,$(EFIOBJ-y))
-obj-bin-y += mbi2.o
+obj-bin-y += mbi2.init.o
 extra-$(XEN_BUILD_EFI) += buildid.o relocs-dummy.o
 nocov-$(XEN_BUILD_EFI) += stub.o
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 17 07:22:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 17 Oct 2024 07:22:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.820424.1233912 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t1Kpp-0006ER-4e; Thu, 17 Oct 2024 07:22:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 820424.1233912; Thu, 17 Oct 2024 07: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 1t1Kpp-0006EK-1z; Thu, 17 Oct 2024 07:22:13 +0000
Received: by outflank-mailman (input) for mailman id 820424;
 Thu, 17 Oct 2024 07: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 1t1Kpo-0006Dl-4T
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 07: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 1t1Kpo-0004jG-3F
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 07:22:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t1Kpo-0005QH-1n
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 07: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=yQhCjHtkgsoXVPTE/vGAJlwRu7qbfKazP97NKEEVkms=; b=momhMwCJs7wNkih8F/EheqHHRw
	PTh2Afw8TeT7ArfZVqVfNNLqz8OPgatB5jWdGBleuiHKOzLuHJ/A/rJ9lmQFUGqFYygVif77ntZ+q
	/Mgt71aQRKRaQGX1D34+IFt1Lpujek2rlYPhzhfLZtOmNlSUp8fqJflsN8s3Bby4a7ls=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Improve MBI2 structure check
Message-Id: <E1t1Kpo-0005QH-1n@xenbits.xenproject.org>
Date: Thu, 17 Oct 2024 07:22:12 +0000

commit 47990ecef286606794d607d4ca8703d71c98d659
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Tue Oct 15 09:25:13 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 15 18:22:07 2024 +0100

    x86/boot: Improve MBI2 structure check
    
    Tag structure should contain at least the tag header.
    Entire tag structure must be contained inside MBI2 data.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/arch/x86/efi/mbi2.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/efi/mbi2.c b/xen/arch/x86/efi/mbi2.c
index 55a1777483..d2f0f0ee61 100644
--- a/xen/arch/x86/efi/mbi2.c
+++ b/xen/arch/x86/efi/mbi2.c
@@ -13,6 +13,7 @@ efi_multiboot2_prelude(uint32_t magic, const multiboot2_fixed_t *mbi)
     EFI_HANDLE ImageHandle = NULL;
     EFI_SYSTEM_TABLE *SystemTable = NULL;
     const char *cmdline = NULL;
+    const void *const mbi_raw = (const void *)mbi;
     bool have_bs = false;
 
     if ( magic != MULTIBOOT2_BOOTLOADER_MAGIC )
@@ -21,8 +22,10 @@ efi_multiboot2_prelude(uint32_t magic, const multiboot2_fixed_t *mbi)
     /* Skip Multiboot2 information fixed part. */
     tag = _p(ROUNDUP((unsigned long)(mbi + 1), MULTIBOOT2_TAG_ALIGN));
 
-    for ( ; (const void *)tag - (const void *)mbi < mbi->total_size &&
-            tag->type != MULTIBOOT2_TAG_TYPE_END;
+    for ( ; (const void *)(tag + 1) - mbi_raw <= mbi->total_size &&
+            tag->type != MULTIBOOT2_TAG_TYPE_END &&
+            tag->size >= sizeof(*tag) &&
+            (const void *)tag + tag->size - mbi_raw <= mbi->total_size;
           tag = _p(ROUNDUP((unsigned long)tag + tag->size,
                    MULTIBOOT2_TAG_ALIGN)) )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 17 12:22:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 17 Oct 2024 12:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.820553.1234046 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t1PW1-0004I0-Cg; Thu, 17 Oct 2024 12:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 820553.1234046; Thu, 17 Oct 2024 12: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 1t1PW1-0004Hs-A8; Thu, 17 Oct 2024 12:22:05 +0000
Received: by outflank-mailman (input) for mailman id 820553;
 Thu, 17 Oct 2024 12: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 1t1PW0-0004HK-5D
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 12: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 1t1PW0-0001zr-4Y
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 12:22:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t1PW0-0003GP-2b
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 12:22: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=ScUmpO9swaonYa86R2nJZx4ge376mLdG7V4Kp6gJhdU=; b=G/qVcpCpdBsdCriWqaXriy9INi
	sMduyGe6oyUlzK6YWWVB+qHT3VfPJhOX2NkUqiPTehzTW0YDWv9BUBanbgis3sNAhc+CqolrUTrAz
	wmok9+Pn1sB+3hrSbDTvvryjzlgDI3wrDADNiK/3kdizQKayhkBDGtgQ1VOGv07drE9o=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] docs: update documentation of reboot param
Message-Id: <E1t1PW0-0003GP-2b@xenbits.xenproject.org>
Date: Thu, 17 Oct 2024 12:22:04 +0000

commit 330d4e62508defa708b55f1b612f42b6a2e2842b
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Oct 17 14:13:50 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 17 14:13:50 2024 +0200

    docs: update documentation of reboot param
    
    Reflect changed default mode, and fix formatting of `efi` value.
    
    Fixes: d81dd3130351 ("x86/shutdown: change default reboot method preference")
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/xen-command-line.pandoc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 5ce63044ad..293dbc1a95 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2139,7 +2139,7 @@ callbacks are safe to be executed. Expressed in milliseconds; maximum is
 ### reboot (x86)
 > `= t[riple] | k[bd] | a[cpi] | p[ci] | P[ower] | e[fi] | n[o] [, [w]arm | [c]old]`
 
-> Default: `0`
+> Default: system dependent
 
 Specify the host reboot method.
 
@@ -2153,14 +2153,14 @@ Specify the host reboot method.
 
 `kbd` instructs Xen to reboot the host via the keyboard controller.
 
-`acpi` instructs Xen to reboot the host using RESET_REG in the ACPI FADT.
+`acpi` instructs Xen to reboot the host using RESET_REG in the ACPI FADT (this
+is default mode if available).
 
 `pci` instructs Xen to reboot the host using PCI reset register (port CF9).
 
 `Power` instructs Xen to power-cycle the host using PCI reset register (port CF9).
 
-'efi' instructs Xen to reboot using the EFI reboot call (in EFI mode by
- default it will use that method first).
+`efi` instructs Xen to reboot using the EFI reboot call.
 
 `xen` instructs Xen to reboot using Xen's SCHEDOP hypercall (this is the default
 when running nested Xen)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 17 12:22:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 17 Oct 2024 12:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.820554.1234050 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t1PWB-0004Jv-EE; Thu, 17 Oct 2024 12:22:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 820554.1234050; Thu, 17 Oct 2024 12: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 1t1PWB-0004Jg-BZ; Thu, 17 Oct 2024 12:22:15 +0000
Received: by outflank-mailman (input) for mailman id 820554;
 Thu, 17 Oct 2024 12: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 1t1PWA-0004Ja-An
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 12: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 1t1PWA-0001zx-8x
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 12:22:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t1PWA-0003HO-6r
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 12: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=55K9VBBEdPgv7sznmX4CoUUKkDPf1zZxeR0oCDItxyU=; b=SDaPiirCD/LAq61aSZ3s+3aQDH
	EjpqrvD0mbnu3jtt5uiT93TfAKmsEaM2CEg8XQbse4yIOhGgLmaWF4qxIT4tH82l5T1AXBc9CfYbP
	sU2jZxhe903lpfz1FXSz5jXQHQfXJKDOT5vLj0k64oHu20tX69IkZpyQU0U2SLFmST7g=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul/test: correct loop body indentation in evex-disp8.c:test_one()
Message-Id: <E1t1PWA-0003HO-6r@xenbits.xenproject.org>
Date: Thu, 17 Oct 2024 12:22:14 +0000

commit 09d22fe15cb11254d06413d15fd578093d7fe062
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Oct 17 14:14:31 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 17 14:14:31 2024 +0200

    x86emul/test: correct loop body indentation in evex-disp8.c:test_one()
    
    For some reason I entirely consistently screwed these up.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
---
 tools/tests/x86_emulator/evex-disp8.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/tools/tests/x86_emulator/evex-disp8.c b/tools/tests/x86_emulator/evex-disp8.c
index 902e157bd4..0e9351fcfd 100644
--- a/tools/tests/x86_emulator/evex-disp8.c
+++ b/tools/tests/x86_emulator/evex-disp8.c
@@ -905,8 +905,8 @@ static void test_one(const struct test *test, enum vl vl,
         goto fail;
 
     for ( i = 0; i < (test->scale == SC_vl ? vsz : esz); ++i )
-         if ( accessed[i] )
-             goto fail;
+        if ( accessed[i] )
+            goto fail;
 
     n = test->scale == SC_vl ? vsz : esz;
     if ( !sg )
@@ -917,13 +917,13 @@ static void test_one(const struct test *test, enum vl vl,
         ++n;
 
     for ( ; i < n; ++i )
-         if ( accessed[i] != (sg ? (vsz / esz) >> (test->opc & 1 & !evex.w)
-                                 : 1) )
-             goto fail;
+        if ( accessed[i] != (sg ? (vsz / esz) >> (test->opc & 1 & !evex.w)
+                                : 1) )
+            goto fail;
 
     for ( ; i < ARRAY_SIZE(accessed); ++i )
-         if ( accessed[i] )
-             goto fail;
+        if ( accessed[i] )
+            goto fail;
 
     /* Also check the broadcast case, if available. */
     if ( test->vsz >= VSZ_el || test->scale != SC_vl )
@@ -954,14 +954,14 @@ static void test_one(const struct test *test, enum vl vl,
         goto fail;
 
     for ( i = 0; i < esz; ++i )
-         if ( accessed[i] )
-             goto fail;
+        if ( accessed[i] )
+            goto fail;
     for ( ; i < esz * 2; ++i )
-         if ( accessed[i] != 1 )
-             goto fail;
+        if ( accessed[i] != 1 )
+            goto fail;
     for ( ; i < ARRAY_SIZE(accessed); ++i )
-         if ( accessed[i] )
-             goto fail;
+        if ( accessed[i] )
+            goto fail;
 
     return;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 17 12:22:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 17 Oct 2024 12:22:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.820555.1234053 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t1PWL-0004MZ-FH; Thu, 17 Oct 2024 12:22:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 820555.1234053; Thu, 17 Oct 2024 12: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 1t1PWL-0004MS-Cr; Thu, 17 Oct 2024 12:22:25 +0000
Received: by outflank-mailman (input) for mailman id 820555;
 Thu, 17 Oct 2024 12:22: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 1t1PWK-0004MI-DQ
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 12:22: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 1t1PWK-000209-C6
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 12:22:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t1PWK-0003IE-B2
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 12:22: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=zfD/WBwSz+vBBg+2nAov6Gyce+MEDm6iIqcE4aixHQQ=; b=CafoqMjAnbvNo7+lgPS9lw5mHP
	cXz62eAyEIs9w0OoLzEPJo6o+uwEBWdTFXFG393G8ehJTM5PmgnyP4f4C1YzydU1b26/IaBufVsGK
	++G+vzeyvOK6Vx5EUa5dQ2/zftPGrLVP/Fbx6VJSN+sj30Dn84HjFFgzjZGRmHgw/5Wc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86emul/test: drop Xeon Phi S/G prefetch special case
Message-Id: <E1t1PWK-0003IE-B2@xenbits.xenproject.org>
Date: Thu, 17 Oct 2024 12:22:24 +0000

commit b3ca3caaf36efa3eaea0cce909f75e12b0fb6a1d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Oct 17 14:14:51 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 17 14:14:51 2024 +0200

    x86emul/test: drop Xeon Phi S/G prefetch special case
    
    Another leftover from the dropping of Xeon Phi support.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/x86_emulator/evex-disp8.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/tests/x86_emulator/evex-disp8.c b/tools/tests/x86_emulator/evex-disp8.c
index 0e9351fcfd..efb6c70637 100644
--- a/tools/tests/x86_emulator/evex-disp8.c
+++ b/tools/tests/x86_emulator/evex-disp8.c
@@ -911,10 +911,8 @@ static void test_one(const struct test *test, enum vl vl,
     n = test->scale == SC_vl ? vsz : esz;
     if ( !sg )
         n += vsz;
-    else if ( !strstr(test->mnemonic, "pf") )
-        n += esz;
     else
-        ++n;
+        n += esz;
 
     for ( ; i < n; ++i )
         if ( accessed[i] != (sg ? (vsz / esz) >> (test->opc & 1 & !evex.w)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 17 14:44:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 17 Oct 2024 14:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.820665.1234212 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t1RjQ-00038R-UK; Thu, 17 Oct 2024 14:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 820665.1234212; Thu, 17 Oct 2024 14: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 1t1RjQ-00038K-RX; Thu, 17 Oct 2024 14:44:04 +0000
Received: by outflank-mailman (input) for mailman id 820665;
 Thu, 17 Oct 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 1t1RjQ-000387-5Y
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 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 1t1RjQ-0004Ri-4i
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 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 1t1RjQ-0001ah-3h
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 14: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=zX3MyHEc0LvJGrGjzC1E2y3ZWd3xU0+uJ4hbFthdPSc=; b=sv6iawYCphtomPzco34pSE6Miy
	49XI7tLXVkd9uyL72+Lgp0oY8uGiNyLOnesfD6Gwis6kbIAyBXEgxS4z+Rg5bvZRMyQAD5Jb3L3k+
	k+pXhghkfVrBq8C8omO3cF3DxVFWs/mVz63l2jqm00kXFYl1ucsCRcuU30A1/Zt8LkDk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] device-tree: Move dt-overlay.c to common/device-tree/
Message-Id: <E1t1RjQ-0001ah-3h@xenbits.xenproject.org>
Date: Thu, 17 Oct 2024 14:44:04 +0000

commit 1e81d2df4f48f37d2086bc75199c75ca93cace92
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Thu Oct 10 12:57:46 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Oct 17 15:40:47 2024 +0100

    device-tree: Move dt-overlay.c to common/device-tree/
    
    The code is DT specific and as such should be placed under common
    directory for DT related files. Update MAINTAINERS file accordingly
    and drop the line with a path from a top-level comment in dt-overlay.c.
    It serves no purpose and requires being updated on every code movement.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 MAINTAINERS                         |    1 -
 xen/common/Makefile                 |    1 -
 xen/common/device-tree/Makefile     |    1 +
 xen/common/device-tree/dt-overlay.c | 1007 ++++++++++++++++++++++++++++++++++
 xen/common/dt-overlay.c             | 1009 -----------------------------------
 5 files changed, 1008 insertions(+), 1011 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index f68ddd7f84..3bba2c8c31 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -292,7 +292,6 @@ M:	Michal Orzel <michal.orzel@amd.com>
 S:	Supported
 F:	xen/common/libfdt/
 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
diff --git a/xen/common/Makefile b/xen/common/Makefile
index fc48cbf688..b279b09bfb 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -11,7 +11,6 @@ obj-$(filter-out $(CONFIG_X86),$(CONFIG_ACPI)) += device.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
 obj-y += event_2l.o
 obj-y += event_channel.o
 obj-y += event_fifo.o
diff --git a/xen/common/device-tree/Makefile b/xen/common/device-tree/Makefile
index 990abd571a..58052d074e 100644
--- a/xen/common/device-tree/Makefile
+++ b/xen/common/device-tree/Makefile
@@ -1,3 +1,4 @@
 obj-y += bootfdt.init.o
 obj-y += bootinfo.init.o
 obj-y += device-tree.o
+obj-$(CONFIG_OVERLAY_DTB) += dt-overlay.o
diff --git a/xen/common/device-tree/dt-overlay.c b/xen/common/device-tree/dt-overlay.c
new file mode 100644
index 0000000000..97fb99eaaa
--- /dev/null
+++ b/xen/common/device-tree/dt-overlay.c
@@ -0,0 +1,1007 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Device tree overlay support in Xen.
+ *
+ * Copyright (C) 2023, Advanced Micro Devices, Inc. All Rights Reserved.
+ * Written by Vikram Garhwal <vikram.garhwal@amd.com>
+ *
+ */
+#include <asm/domain_build.h>
+#include <xen/dt-overlay.h>
+#include <xen/guest_access.h>
+#include <xen/iocap.h>
+#include <xen/libfdt/libfdt.h>
+#include <xen/xmalloc.h>
+
+#define DT_OVERLAY_MAX_SIZE KB(500)
+
+static LIST_HEAD(overlay_tracker);
+static DEFINE_SPINLOCK(overlay_lock);
+
+/* Find last descendants of the device_node. */
+static struct dt_device_node *
+find_last_descendants_node(const struct dt_device_node *device_node)
+{
+    struct dt_device_node *child_node;
+
+    for ( child_node = device_node->child; child_node->sibling != NULL;
+          child_node = child_node->sibling );
+
+    /* If last child_node also have children. */
+    if ( child_node->child )
+        child_node = find_last_descendants_node(child_node);
+
+    return child_node;
+}
+
+/*
+ * Returns next node to the input node. If node has children then return
+ * last descendant's next node.
+*/
+static struct dt_device_node *
+dt_find_next_node(struct dt_device_node *dt, const struct dt_device_node *node)
+{
+    struct dt_device_node *np;
+
+    dt_for_each_device_node(dt, np)
+        if ( np == node )
+            break;
+
+    if ( np->child )
+        np = find_last_descendants_node(np);
+
+    return np->allnext;
+}
+
+static int dt_overlay_remove_node(struct dt_device_node *device_node)
+{
+    struct dt_device_node *np;
+    struct dt_device_node *parent_node;
+    struct dt_device_node *last_descendant = device_node->child;
+
+    parent_node = device_node->parent;
+
+    /* Check if we are trying to remove "/" i.e. root node. */
+    if ( parent_node == NULL )
+    {
+        dt_dprintk("%s's parent node not found\n", device_node->name);
+        return -EFAULT;
+    }
+
+    /* Sanity check for linking between parent and child node. */
+    np = parent_node->child;
+    if ( np == NULL )
+    {
+        dt_dprintk("parent node %s's not found\n", parent_node->name);
+        return -EFAULT;
+    }
+
+    /* If node to be removed is only child node or first child. */
+    if ( !dt_node_cmp(np->full_name, device_node->full_name) )
+    {
+        parent_node->child = np->sibling;
+
+        /*
+         * Iterate over all child nodes of device_node. Given that we are
+         * removing a node, we need to remove all it's descendants too.
+         * Reason behind finding last_descendant:
+         * If device_node has multiple children, device_node->allnext will point
+         * to first_child and first_child->allnext will be a sibling. When the
+         * device_node and it's all children are removed, parent_node->allnext
+         * should point to node next to last children.
+         */
+        if ( last_descendant )
+        {
+            last_descendant = find_last_descendants_node(device_node);
+            parent_node->allnext = last_descendant->allnext;
+        }
+        else
+            parent_node->allnext = np->allnext;
+
+        return 0;
+    }
+
+    for ( np = parent_node->child; np->sibling != NULL; np = np->sibling )
+    {
+        if ( !dt_node_cmp(np->sibling->full_name, device_node->full_name) )
+        {
+            /* Found the node. Now we remove it. */
+            np->sibling = np->sibling->sibling;
+
+            if ( np->child )
+                np = find_last_descendants_node(np);
+
+            /*
+             * Iterate over all child nodes of device_node. Given that we are
+             * removing parent node, we need to remove all it's descendants too.
+             */
+            if ( last_descendant )
+                last_descendant = find_last_descendants_node(device_node);
+
+            if ( last_descendant )
+                np->allnext = last_descendant->allnext;
+            else
+                np->allnext = np->allnext->allnext;
+
+            break;
+        }
+    }
+
+    return 0;
+}
+
+static int dt_overlay_add_node(struct dt_device_node *device_node,
+                               const char *parent_node_path)
+{
+    struct dt_device_node *parent_node;
+    struct dt_device_node *next_node;
+
+    parent_node = dt_find_node_by_path(parent_node_path);
+
+    if ( parent_node == NULL )
+    {
+        dt_dprintk("Parent node %s not found. Overlay node will not be added\n",
+                   parent_node_path);
+        return -EINVAL;
+    }
+
+    /* If parent has no child. */
+    if ( parent_node->child == NULL )
+    {
+        next_node = parent_node->allnext;
+        device_node->parent = parent_node;
+        parent_node->allnext = device_node;
+        parent_node->child = device_node;
+    }
+    else
+    {
+        struct dt_device_node *np;
+        /*
+         * If parent has at least one child node.
+         * Iterate to the last child node of parent.
+         */
+        for ( np = parent_node->child; np->sibling != NULL; np = np->sibling );
+
+        /* Iterate over all child nodes of np node. */
+        if ( np->child )
+        {
+            struct dt_device_node *np_last_descendant;
+
+            np_last_descendant = find_last_descendants_node(np);
+
+            next_node = np_last_descendant->allnext;
+            np_last_descendant->allnext = device_node;
+        }
+        else
+        {
+            next_node = np->allnext;
+            np->allnext = device_node;
+        }
+
+        device_node->parent = parent_node;
+        np->sibling = device_node;
+        np->sibling->sibling = NULL;
+    }
+
+    /* Iterate over all child nodes of device_node to add children too. */
+    if ( device_node->child )
+    {
+        struct dt_device_node *device_node_last_descendant;
+
+        device_node_last_descendant = find_last_descendants_node(device_node);
+
+        /* Plug next_node at the end of last children of device_node. */
+        device_node_last_descendant->allnext = next_node;
+    }
+    else
+    {
+        /* Now plug next_node at the end of device_node. */
+        device_node->allnext = next_node;
+    }
+
+    return 0;
+}
+
+/* Basic sanity check for the dtbo tool stack provided to Xen. */
+static int check_overlay_fdt(const void *overlay_fdt, uint32_t overlay_fdt_size)
+{
+    if ( (fdt_totalsize(overlay_fdt) != overlay_fdt_size) ||
+          fdt_check_header(overlay_fdt) )
+    {
+        printk(XENLOG_ERR "The overlay FDT is not a valid Flat Device Tree\n");
+        return -EINVAL;
+    }
+
+    return 0;
+}
+
+static int irq_remove_cb(unsigned long s, unsigned long e, void *dom,
+                         unsigned long *c)
+{
+    int rc;
+    struct domain *d = dom;
+
+    /*
+     * TODO: We don't handle shared IRQs for now. So, it is assumed that
+     * the IRQs was not shared with another devices.
+     * TODO: Undo the IRQ routing.
+     */
+    rc = irq_deny_access(d, s);
+    if ( rc )
+    {
+        printk(XENLOG_ERR "unable to revoke access for irq %lu\n", s);
+    }
+    else
+        *c += e - s + 1;
+
+    return rc;
+
+}
+
+static int iomem_remove_cb(unsigned long s, unsigned long e, void *dom,
+                           unsigned long *c)
+{
+    int rc;
+    struct domain *d = dom;
+
+    /*
+    * Remove mmio access.
+    * TODO: Support for remove/add the mapping in P2M.
+    */
+    rc = iomem_deny_access(d, s, e);
+    if ( rc )
+    {
+        printk(XENLOG_ERR "Unable to remove %pd access to %#lx - %#lx\n",
+               d, s, e);
+    }
+    else
+        *c += e - s + 1;
+
+    return rc;
+}
+
+/* Count number of nodes till one level of __overlay__ tag. */
+static unsigned int overlay_node_count(const void *overlay_fdt)
+{
+    unsigned int num_overlay_nodes = 0;
+    int fragment;
+
+    fdt_for_each_subnode(fragment, overlay_fdt, 0)
+    {
+        int subnode;
+        int overlay;
+
+        overlay = fdt_subnode_offset(overlay_fdt, fragment, "__overlay__");
+        if ( overlay < 0 )
+            continue;
+
+        fdt_for_each_subnode(subnode, overlay_fdt, overlay)
+        {
+            num_overlay_nodes++;
+        }
+    }
+
+    return num_overlay_nodes;
+}
+
+/*
+ * overlay_get_nodes_info gets full name with path for all the nodes which
+ * are in one level of __overlay__ tag. This is useful when checking node for
+ * duplication i.e. dtbo tries to add nodes which already exists in device tree.
+ */
+static int overlay_get_nodes_info(const void *fdto, char **nodes_full_path)
+{
+    int fragment;
+    unsigned int node_num = 0;
+
+    fdt_for_each_subnode(fragment, fdto, 0)
+    {
+        int target;
+        int overlay;
+        int subnode;
+        const char *target_path;
+
+        overlay = fdt_subnode_offset(fdto, fragment, "__overlay__");
+        if ( overlay < 0 )
+            continue;
+
+        target = fdt_overlay_target_offset(device_tree_flattened, fdto,
+                                           fragment, &target_path);
+        if ( target < 0 )
+            return target;
+
+        if ( target_path == NULL )
+            return -EINVAL;
+
+        fdt_for_each_subnode(subnode, fdto, overlay)
+        {
+            const char *node_name = NULL;
+            int node_name_len;
+            unsigned int target_path_len = strlen(target_path);
+            unsigned int node_full_name_len;
+            unsigned int extra_len;
+
+            node_name = fdt_get_name(fdto, subnode, &node_name_len);
+
+            if ( node_name == NULL )
+                return node_name_len;
+
+            /*
+             * Extra length is for adding '/' and '\0' unless the target path is
+             * root in which case we don't add the '/' at the beginning. This is
+             * done to keep the node_full_path in the correct full node name
+             * format.
+             */
+            extra_len = (target_path_len > 1) ? 2 : 1;
+            node_full_name_len = target_path_len + node_name_len + extra_len;
+
+            nodes_full_path[node_num] = xmalloc_bytes(node_full_name_len);
+
+            if ( nodes_full_path[node_num] == NULL )
+                return -ENOMEM;
+
+            memcpy(nodes_full_path[node_num], target_path, target_path_len);
+
+            /* Target is not root - add separator */
+            if ( target_path_len > 1 )
+                nodes_full_path[node_num][target_path_len++] = '/';
+
+            memcpy(nodes_full_path[node_num] + target_path_len,
+                    node_name, node_name_len);
+
+            nodes_full_path[node_num][node_full_name_len - 1] = '\0';
+
+            node_num++;
+        }
+    }
+
+    return 0;
+}
+
+/* This function should be called with the overlay_lock taken */
+static struct overlay_track *
+find_track_entry_from_tracker(const void *overlay_fdt,
+                              uint32_t overlay_fdt_size)
+{
+    struct overlay_track *entry, *temp;
+    bool found_entry = false;
+
+    ASSERT(spin_is_locked(&overlay_lock));
+
+    /*
+     * First check if dtbo is correct i.e. it should one of the dtbo which was
+     * used when dynamically adding the node.
+     * Limitation: Cases with same node names but different property are not
+     * supported currently. We are relying on user to provide the same dtbo
+     * as it was used when adding the nodes.
+     */
+    list_for_each_entry_safe( entry, temp, &overlay_tracker, entry )
+    {
+        if ( memcmp(entry->overlay_fdt, overlay_fdt, overlay_fdt_size) == 0 )
+        {
+            found_entry = true;
+            break;
+        }
+    }
+
+    if ( !found_entry )
+    {
+        printk(XENLOG_ERR "Cannot find any matching tracker with input dtbo."
+               " Operation is supported only for prior added dtbo.\n");
+        return NULL;
+    }
+
+    return entry;
+}
+
+/* Check if node itself can be removed and remove node from IOMMU. */
+static int remove_node_resources(struct dt_device_node *device_node)
+{
+    int rc = 0;
+    unsigned int len;
+    domid_t domid;
+
+    domid = dt_device_used_by(device_node);
+
+    dt_dprintk("Checking if node %s is used by any domain\n",
+               device_node->full_name);
+
+    /* Remove the node if only it's assigned to hardware domain or domain io. */
+    if ( domid != hardware_domain->domain_id && domid != DOMID_IO )
+    {
+        printk(XENLOG_ERR "Device %s is being used by domain %u. Removing nodes failed\n",
+               device_node->full_name, domid);
+        return -EINVAL;
+    }
+
+    /* Check if iommu property exists. */
+    if ( dt_get_property(device_node, "iommus", &len) )
+    {
+        if ( dt_device_is_protected(device_node) )
+        {
+            rc = iommu_remove_dt_device(device_node);
+            if ( rc < 0 )
+                return rc;
+        }
+    }
+
+    return rc;
+}
+
+/* Remove all descendants from IOMMU. */
+static int
+remove_descendant_nodes_resources(const struct dt_device_node *device_node)
+{
+    int rc = 0;
+    struct dt_device_node *child_node;
+
+    for ( child_node = device_node->child; child_node != NULL;
+         child_node = child_node->sibling )
+    {
+        if ( child_node->child )
+        {
+            rc = remove_descendant_nodes_resources(child_node);
+            if ( rc )
+                return rc;
+        }
+
+        rc = remove_node_resources(child_node);
+        if ( rc )
+            return rc;
+    }
+
+    return rc;
+}
+
+/* Remove nodes from dt_host. */
+static int remove_nodes(const struct overlay_track *tracker)
+{
+    int rc = 0;
+    struct dt_device_node *overlay_node;
+    unsigned int j;
+    struct domain *d = hardware_domain;
+
+    for ( j = 0; j < tracker->num_nodes; j++ )
+    {
+        overlay_node = (struct dt_device_node *)tracker->nodes_address[j];
+        if ( overlay_node == NULL )
+            return -EINVAL;
+
+        write_lock(&dt_host_lock);
+
+        rc = remove_descendant_nodes_resources(overlay_node);
+        if ( rc )
+        {
+            write_unlock(&dt_host_lock);
+            return rc;
+        }
+
+        rc = remove_node_resources(overlay_node);
+        if ( rc )
+        {
+            write_unlock(&dt_host_lock);
+            return rc;
+        }
+
+        dt_dprintk("Removing node: %s\n", overlay_node->full_name);
+
+        rc = dt_overlay_remove_node(overlay_node);
+        if ( rc )
+        {
+            write_unlock(&dt_host_lock);
+            return rc;
+        }
+
+        write_unlock(&dt_host_lock);
+    }
+
+    /* Remove IRQ access. */
+    if ( tracker->irq_ranges )
+    {
+        rc = rangeset_consume_ranges(tracker->irq_ranges, irq_remove_cb, d);
+        if ( rc )
+            return rc;
+    }
+
+   /* Remove mmio access. */
+    if ( tracker->iomem_ranges )
+    {
+        rc = rangeset_consume_ranges(tracker->iomem_ranges, iomem_remove_cb, d);
+        if ( rc )
+            return rc;
+    }
+
+    return rc;
+}
+
+/*
+ * First finds the device node to remove. Check if the device is being used by
+ * any dom and finally remove it from dt_host. IOMMU is already being taken care
+ * while destroying the domain.
+ */
+static long handle_remove_overlay_nodes(const void *overlay_fdt,
+                                        uint32_t overlay_fdt_size)
+{
+    int rc;
+    struct overlay_track *entry;
+
+    rc = check_overlay_fdt(overlay_fdt, overlay_fdt_size);
+    if ( rc )
+        return rc;
+
+    spin_lock(&overlay_lock);
+
+    entry = find_track_entry_from_tracker(overlay_fdt, overlay_fdt_size);
+    if ( entry == NULL )
+    {
+        rc = -EINVAL;
+        goto out;
+
+    }
+
+    rc = remove_nodes(entry);
+    if ( rc )
+    {
+        printk(XENLOG_ERR "Removing node failed\n");
+        goto out;
+    }
+
+    list_del(&entry->entry);
+
+    xfree(entry->dt_host_new);
+    xfree(entry->fdt);
+    xfree(entry->overlay_fdt);
+
+    xfree(entry->nodes_address);
+
+    rangeset_destroy(entry->irq_ranges);
+    rangeset_destroy(entry->iomem_ranges);
+
+    xfree(entry);
+
+ out:
+    spin_unlock(&overlay_lock);
+    return rc;
+}
+
+static void free_nodes_full_path(unsigned int num_nodes, char **nodes_full_path)
+{
+    unsigned int i;
+
+    if ( nodes_full_path == NULL )
+        return;
+
+    for ( i = 0; i < num_nodes && nodes_full_path[i] != NULL; i++ )
+    {
+        xfree(nodes_full_path[i]);
+    }
+
+    xfree(nodes_full_path);
+}
+
+static long add_nodes(struct overlay_track *tr, char **nodes_full_path)
+
+{
+    int rc;
+    unsigned int j;
+    struct dt_device_node *overlay_node;
+
+    for ( j = 0; j < tr->num_nodes; j++ )
+    {
+        struct dt_device_node *prev_node, *next_node;
+
+        dt_dprintk("Adding node: %s\n", nodes_full_path[j]);
+
+        /* Find the newly added node in tr->dt_host_new by it's full path. */
+        overlay_node = dt_find_node_by_path_from(tr->dt_host_new,
+                                                 nodes_full_path[j]);
+        if ( overlay_node == NULL )
+            return -EFAULT;
+
+        /*
+         * Find previous and next node to overlay_node in dt_host_new. We will
+         * need these nodes to fix the dt_host_new mapping. When overlay_node is
+         * take out of dt_host_new tree and added to dt_host, link between
+         * previous node and next_node is broken. We will need to refresh
+         * dt_host_new with correct linking for any other overlay nodes
+         * extraction in future.
+         */
+        dt_for_each_device_node(tr->dt_host_new, prev_node)
+            if ( prev_node->allnext == overlay_node )
+                break;
+
+        next_node = dt_find_next_node(tr->dt_host_new, overlay_node);
+
+        write_lock(&dt_host_lock);
+
+        /* Add the node to dt_host. */
+        rc = dt_overlay_add_node(overlay_node, overlay_node->parent->full_name);
+        if ( rc )
+        {
+            write_unlock(&dt_host_lock);
+
+            /* Node not added in dt_host. */
+            return rc;
+        }
+
+        prev_node->allnext = next_node;
+
+        overlay_node = dt_find_node_by_path(overlay_node->full_name);
+        if ( overlay_node == NULL )
+        {
+            /* Sanity check. But code will never come here. */
+            ASSERT_UNREACHABLE();
+            return -EFAULT;
+        }
+
+        write_unlock(&dt_host_lock);
+
+        /* Keep overlay_node address in tracker. */
+        tr->nodes_address[j] = (unsigned long)overlay_node;
+    }
+
+    return 0;
+}
+/*
+ * Adds device tree nodes under target node.
+ * We use tr->dt_host_new to unflatten the updated device_tree_flattened.
+ */
+static long handle_add_overlay_nodes(void *overlay_fdt,
+                                     uint32_t overlay_fdt_size)
+{
+    int rc;
+    unsigned int j;
+    struct dt_device_node *overlay_node;
+    struct overlay_track *tr = NULL;
+    char **nodes_full_path = NULL;
+    unsigned int new_fdt_size;
+
+    tr = xzalloc(struct overlay_track);
+    if ( tr == NULL )
+        return -ENOMEM;
+
+    new_fdt_size = fdt_totalsize(device_tree_flattened) +
+                                 fdt_totalsize(overlay_fdt);
+
+    tr->fdt = xzalloc_bytes(new_fdt_size);
+    if ( tr->fdt == NULL )
+    {
+        xfree(tr);
+        return -ENOMEM;
+    }
+
+    tr->num_nodes = overlay_node_count(overlay_fdt);
+    if ( tr->num_nodes == 0 )
+    {
+        xfree(tr->fdt);
+        xfree(tr);
+        return -ENOMEM;
+    }
+
+    tr->nodes_address = xzalloc_bytes(tr->num_nodes * sizeof(unsigned long));
+    if ( tr->nodes_address == NULL )
+    {
+        xfree(tr->fdt);
+        xfree(tr);
+        return -ENOMEM;
+    }
+
+    rc = check_overlay_fdt(overlay_fdt, overlay_fdt_size);
+    if ( rc )
+    {
+        xfree(tr->nodes_address);
+        xfree(tr->fdt);
+        xfree(tr);
+        return rc;
+    }
+
+    /*
+     * Keep a copy of overlay_fdt as fdt_overlay_apply will change the input
+     * overlay's content(magic) when applying overlay.
+     */
+    tr->overlay_fdt = xzalloc_bytes(overlay_fdt_size);
+    if ( tr->overlay_fdt == NULL )
+    {
+        xfree(tr->nodes_address);
+        xfree(tr->fdt);
+        xfree(tr);
+        return -ENOMEM;
+    }
+
+    memcpy(tr->overlay_fdt, overlay_fdt, overlay_fdt_size);
+
+    spin_lock(&overlay_lock);
+
+    memcpy(tr->fdt, device_tree_flattened,
+           fdt_totalsize(device_tree_flattened));
+
+    /* Open tr->fdt with more space to accommodate the overlay_fdt. */
+    rc = fdt_open_into(tr->fdt, tr->fdt, new_fdt_size);
+    if ( rc )
+    {
+        printk(XENLOG_ERR "Increasing fdt size to accommodate overlay_fdt failed with error %d\n",
+               rc);
+        goto err;
+    }
+
+    nodes_full_path = xzalloc_bytes(tr->num_nodes * sizeof(char *));
+    if ( nodes_full_path == NULL )
+    {
+        rc = -ENOMEM;
+        goto err;
+    }
+
+    /*
+     * overlay_get_nodes_info is called to get the node information from dtbo.
+     * This is done before fdt_overlay_apply() because the overlay apply will
+     * erase the magic of overlay_fdt.
+     */
+    rc = overlay_get_nodes_info(overlay_fdt, nodes_full_path);
+    if ( rc )
+    {
+        printk(XENLOG_ERR "Getting nodes information failed with error %d\n",
+               rc);
+        goto err;
+    }
+
+    rc = fdt_overlay_apply(tr->fdt, overlay_fdt);
+    if ( rc )
+    {
+        printk(XENLOG_ERR "Adding overlay node failed with error %d\n", rc);
+        goto err;
+    }
+
+    /*
+     * Check if any of the node already exists in dt_host. If node already exits
+     * we can return here as this overlay_fdt is not suitable for overlay ops.
+     */
+    for ( j = 0; j < tr->num_nodes; j++ )
+    {
+        overlay_node = dt_find_node_by_path(nodes_full_path[j]);
+        if ( overlay_node != NULL )
+        {
+            printk(XENLOG_ERR "node %s exists in device tree\n",
+                   nodes_full_path[j]);
+            rc = -EINVAL;
+            goto err;
+        }
+    }
+
+    /*
+     * Unflatten the tr->fdt into a new dt_host.
+     * TODO: Check and add alias_scan() if it's needed for overlay in future.
+     */
+    rc = unflatten_device_tree(tr->fdt, &tr->dt_host_new);
+    if ( rc )
+    {
+        printk(XENLOG_ERR "unflatten_device_tree failed with error %d\n", rc);
+        goto err;
+    }
+
+    rc = add_nodes(tr, nodes_full_path);
+    if ( rc )
+    {
+        printk(XENLOG_ERR "Adding nodes failed. Removing the partially added nodes.\n");
+        goto remove_node;
+    }
+
+    INIT_LIST_HEAD(&tr->entry);
+    list_add_tail(&tr->entry, &overlay_tracker);
+
+    spin_unlock(&overlay_lock);
+
+    free_nodes_full_path(tr->num_nodes, nodes_full_path);
+
+    return rc;
+
+/*
+ * Failure case. We need to remove the nodes, free tracker(if tr exists) and
+ * tr->dt_host_new.
+ */
+ remove_node:
+    tr->num_nodes = j;
+    rc = remove_nodes(tr);
+
+    if ( rc )
+    {
+        /*
+         * User needs to provide right overlay. Incorrect node information
+         * example parent node doesn't exist in dt_host etc can cause memory
+         * leaks as removing_nodes() will fail and this means nodes memory is
+         * not freed from tracker. Which may cause memory leaks. Ideally, these
+         * device tree related mistakes will be caught by fdt_overlay_apply()
+         * but given that we don't manage that code keeping this warning message
+         * is better here.
+         */
+        printk(XENLOG_ERR "Removing node failed.\n");
+        spin_unlock(&overlay_lock);
+
+        free_nodes_full_path(tr->num_nodes, nodes_full_path);
+
+        return rc;
+    }
+
+ err:
+    spin_unlock(&overlay_lock);
+
+    if ( tr->dt_host_new )
+        xfree(tr->dt_host_new);
+
+    free_nodes_full_path(tr->num_nodes, nodes_full_path);
+
+    xfree(tr->overlay_fdt);
+    xfree(tr->nodes_address);
+    xfree(tr->fdt);
+
+    xfree(tr);
+
+    return rc;
+}
+
+static long handle_attach_overlay_nodes(struct domain *d,
+                                        const void *overlay_fdt,
+                                        uint32_t overlay_fdt_size)
+{
+    int rc;
+    unsigned int j;
+    struct overlay_track *entry;
+
+    rc = check_overlay_fdt(overlay_fdt, overlay_fdt_size);
+    if ( rc )
+        return rc;
+
+    spin_lock(&overlay_lock);
+
+    entry = find_track_entry_from_tracker(overlay_fdt, overlay_fdt_size);
+    if ( entry == NULL )
+    {
+        rc = -EINVAL;
+        goto out;
+    }
+
+    entry->irq_ranges = rangeset_new(d, "Overlays: Interrupts", 0);
+    if (entry->irq_ranges == NULL)
+    {
+        rc = -ENOMEM;
+        printk(XENLOG_ERR "Creating IRQ rangeset failed");
+        goto out;
+    }
+
+    entry->iomem_ranges = rangeset_new(d, "Overlay: I/O Memory",
+                                       RANGESETF_prettyprint_hex);
+    if (entry->iomem_ranges == NULL)
+    {
+        rc = -ENOMEM;
+        printk(XENLOG_ERR "Creating IOMMU rangeset failed");
+        goto out;
+    }
+
+    for ( j = 0; j < entry->num_nodes; j++ )
+    {
+        struct dt_device_node *overlay_node;
+
+        overlay_node = (struct dt_device_node *)entry->nodes_address[j];
+        if ( overlay_node == NULL )
+        {
+            rc = -EINVAL;
+            goto out;
+        }
+
+        write_lock(&dt_host_lock);
+        rc = handle_device(d, overlay_node, p2m_mmio_direct_c,
+                           entry->iomem_ranges, entry->irq_ranges);
+        write_unlock(&dt_host_lock);
+        if ( rc )
+        {
+            printk(XENLOG_ERR "Adding IRQ and IOMMU failed\n");
+            goto out;
+        }
+    }
+
+    spin_unlock(&overlay_lock);
+
+    return 0;
+
+ out:
+    spin_unlock(&overlay_lock);
+
+    if ( entry )
+    {
+        rangeset_destroy(entry->irq_ranges);
+        rangeset_destroy(entry->iomem_ranges);
+    }
+
+    return rc;
+}
+
+long dt_overlay_sysctl(struct xen_sysctl_dt_overlay *op)
+{
+    long ret;
+    void *overlay_fdt;
+
+    if ( op->overlay_op != XEN_SYSCTL_DT_OVERLAY_ADD &&
+         op->overlay_op != XEN_SYSCTL_DT_OVERLAY_REMOVE )
+        return -EOPNOTSUPP;
+
+    if ( op->overlay_fdt_size == 0 ||
+         op->overlay_fdt_size > DT_OVERLAY_MAX_SIZE )
+        return -EINVAL;
+
+    if ( op->pad[0] || op->pad[1] || op->pad[2] )
+        return -EINVAL;
+
+    overlay_fdt = xmalloc_bytes(op->overlay_fdt_size);
+
+    if ( overlay_fdt == NULL )
+        return -ENOMEM;
+
+    ret = copy_from_guest(overlay_fdt, op->overlay_fdt, op->overlay_fdt_size);
+    if ( ret )
+    {
+        gprintk(XENLOG_ERR, "copy from guest failed\n");
+        xfree(overlay_fdt);
+
+        return -EFAULT;
+    }
+
+    if ( op->overlay_op == XEN_SYSCTL_DT_OVERLAY_REMOVE )
+        ret = handle_remove_overlay_nodes(overlay_fdt, op->overlay_fdt_size);
+    else
+        ret = handle_add_overlay_nodes(overlay_fdt, op->overlay_fdt_size);
+
+    xfree(overlay_fdt);
+
+    return ret;
+}
+
+long dt_overlay_domctl(struct domain *d, struct xen_domctl_dt_overlay *op)
+{
+    long ret;
+    void *overlay_fdt;
+
+    if ( op->overlay_op != XEN_DOMCTL_DT_OVERLAY_ATTACH )
+        return -EOPNOTSUPP;
+
+    if ( op->overlay_fdt_size == 0 ||
+         op->overlay_fdt_size > DT_OVERLAY_MAX_SIZE )
+        return -EINVAL;
+
+    if ( op->pad[0] || op->pad[1] || op->pad[2] )
+        return -EINVAL;
+
+    /* TODO: add support for non-1:1 domains using xen,reg */
+    if ( !is_domain_direct_mapped(d) )
+        return -EOPNOTSUPP;
+
+    overlay_fdt = xmalloc_bytes(op->overlay_fdt_size);
+
+    if ( overlay_fdt == NULL )
+        return -ENOMEM;
+
+    ret = copy_from_guest(overlay_fdt, op->overlay_fdt, op->overlay_fdt_size);
+    if ( ret )
+    {
+        gprintk(XENLOG_ERR, "copy from guest failed\n");
+        xfree(overlay_fdt);
+
+        return -EFAULT;
+    }
+
+    if ( op->overlay_op == XEN_DOMCTL_DT_OVERLAY_ATTACH )
+        ret = handle_attach_overlay_nodes(d, overlay_fdt, op->overlay_fdt_size);
+    else
+        ret = -EOPNOTSUPP;
+
+    xfree(overlay_fdt);
+
+    return ret;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/common/dt-overlay.c b/xen/common/dt-overlay.c
deleted file mode 100644
index 5ce00514ef..0000000000
--- a/xen/common/dt-overlay.c
+++ /dev/null
@@ -1,1009 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * xen/common/dt-overlay.c
- *
- * Device tree overlay support in Xen.
- *
- * Copyright (C) 2023, Advanced Micro Devices, Inc. All Rights Reserved.
- * Written by Vikram Garhwal <vikram.garhwal@amd.com>
- *
- */
-#include <asm/domain_build.h>
-#include <xen/dt-overlay.h>
-#include <xen/guest_access.h>
-#include <xen/iocap.h>
-#include <xen/libfdt/libfdt.h>
-#include <xen/xmalloc.h>
-
-#define DT_OVERLAY_MAX_SIZE KB(500)
-
-static LIST_HEAD(overlay_tracker);
-static DEFINE_SPINLOCK(overlay_lock);
-
-/* Find last descendants of the device_node. */
-static struct dt_device_node *
-find_last_descendants_node(const struct dt_device_node *device_node)
-{
-    struct dt_device_node *child_node;
-
-    for ( child_node = device_node->child; child_node->sibling != NULL;
-          child_node = child_node->sibling );
-
-    /* If last child_node also have children. */
-    if ( child_node->child )
-        child_node = find_last_descendants_node(child_node);
-
-    return child_node;
-}
-
-/*
- * Returns next node to the input node. If node has children then return
- * last descendant's next node.
-*/
-static struct dt_device_node *
-dt_find_next_node(struct dt_device_node *dt, const struct dt_device_node *node)
-{
-    struct dt_device_node *np;
-
-    dt_for_each_device_node(dt, np)
-        if ( np == node )
-            break;
-
-    if ( np->child )
-        np = find_last_descendants_node(np);
-
-    return np->allnext;
-}
-
-static int dt_overlay_remove_node(struct dt_device_node *device_node)
-{
-    struct dt_device_node *np;
-    struct dt_device_node *parent_node;
-    struct dt_device_node *last_descendant = device_node->child;
-
-    parent_node = device_node->parent;
-
-    /* Check if we are trying to remove "/" i.e. root node. */
-    if ( parent_node == NULL )
-    {
-        dt_dprintk("%s's parent node not found\n", device_node->name);
-        return -EFAULT;
-    }
-
-    /* Sanity check for linking between parent and child node. */
-    np = parent_node->child;
-    if ( np == NULL )
-    {
-        dt_dprintk("parent node %s's not found\n", parent_node->name);
-        return -EFAULT;
-    }
-
-    /* If node to be removed is only child node or first child. */
-    if ( !dt_node_cmp(np->full_name, device_node->full_name) )
-    {
-        parent_node->child = np->sibling;
-
-        /*
-         * Iterate over all child nodes of device_node. Given that we are
-         * removing a node, we need to remove all it's descendants too.
-         * Reason behind finding last_descendant:
-         * If device_node has multiple children, device_node->allnext will point
-         * to first_child and first_child->allnext will be a sibling. When the
-         * device_node and it's all children are removed, parent_node->allnext
-         * should point to node next to last children.
-         */
-        if ( last_descendant )
-        {
-            last_descendant = find_last_descendants_node(device_node);
-            parent_node->allnext = last_descendant->allnext;
-        }
-        else
-            parent_node->allnext = np->allnext;
-
-        return 0;
-    }
-
-    for ( np = parent_node->child; np->sibling != NULL; np = np->sibling )
-    {
-        if ( !dt_node_cmp(np->sibling->full_name, device_node->full_name) )
-        {
-            /* Found the node. Now we remove it. */
-            np->sibling = np->sibling->sibling;
-
-            if ( np->child )
-                np = find_last_descendants_node(np);
-
-            /*
-             * Iterate over all child nodes of device_node. Given that we are
-             * removing parent node, we need to remove all it's descendants too.
-             */
-            if ( last_descendant )
-                last_descendant = find_last_descendants_node(device_node);
-
-            if ( last_descendant )
-                np->allnext = last_descendant->allnext;
-            else
-                np->allnext = np->allnext->allnext;
-
-            break;
-        }
-    }
-
-    return 0;
-}
-
-static int dt_overlay_add_node(struct dt_device_node *device_node,
-                               const char *parent_node_path)
-{
-    struct dt_device_node *parent_node;
-    struct dt_device_node *next_node;
-
-    parent_node = dt_find_node_by_path(parent_node_path);
-
-    if ( parent_node == NULL )
-    {
-        dt_dprintk("Parent node %s not found. Overlay node will not be added\n",
-                   parent_node_path);
-        return -EINVAL;
-    }
-
-    /* If parent has no child. */
-    if ( parent_node->child == NULL )
-    {
-        next_node = parent_node->allnext;
-        device_node->parent = parent_node;
-        parent_node->allnext = device_node;
-        parent_node->child = device_node;
-    }
-    else
-    {
-        struct dt_device_node *np;
-        /*
-         * If parent has at least one child node.
-         * Iterate to the last child node of parent.
-         */
-        for ( np = parent_node->child; np->sibling != NULL; np = np->sibling );
-
-        /* Iterate over all child nodes of np node. */
-        if ( np->child )
-        {
-            struct dt_device_node *np_last_descendant;
-
-            np_last_descendant = find_last_descendants_node(np);
-
-            next_node = np_last_descendant->allnext;
-            np_last_descendant->allnext = device_node;
-        }
-        else
-        {
-            next_node = np->allnext;
-            np->allnext = device_node;
-        }
-
-        device_node->parent = parent_node;
-        np->sibling = device_node;
-        np->sibling->sibling = NULL;
-    }
-
-    /* Iterate over all child nodes of device_node to add children too. */
-    if ( device_node->child )
-    {
-        struct dt_device_node *device_node_last_descendant;
-
-        device_node_last_descendant = find_last_descendants_node(device_node);
-
-        /* Plug next_node at the end of last children of device_node. */
-        device_node_last_descendant->allnext = next_node;
-    }
-    else
-    {
-        /* Now plug next_node at the end of device_node. */
-        device_node->allnext = next_node;
-    }
-
-    return 0;
-}
-
-/* Basic sanity check for the dtbo tool stack provided to Xen. */
-static int check_overlay_fdt(const void *overlay_fdt, uint32_t overlay_fdt_size)
-{
-    if ( (fdt_totalsize(overlay_fdt) != overlay_fdt_size) ||
-          fdt_check_header(overlay_fdt) )
-    {
-        printk(XENLOG_ERR "The overlay FDT is not a valid Flat Device Tree\n");
-        return -EINVAL;
-    }
-
-    return 0;
-}
-
-static int irq_remove_cb(unsigned long s, unsigned long e, void *dom,
-                         unsigned long *c)
-{
-    int rc;
-    struct domain *d = dom;
-
-    /*
-     * TODO: We don't handle shared IRQs for now. So, it is assumed that
-     * the IRQs was not shared with another devices.
-     * TODO: Undo the IRQ routing.
-     */
-    rc = irq_deny_access(d, s);
-    if ( rc )
-    {
-        printk(XENLOG_ERR "unable to revoke access for irq %lu\n", s);
-    }
-    else
-        *c += e - s + 1;
-
-    return rc;
-
-}
-
-static int iomem_remove_cb(unsigned long s, unsigned long e, void *dom,
-                           unsigned long *c)
-{
-    int rc;
-    struct domain *d = dom;
-
-    /*
-    * Remove mmio access.
-    * TODO: Support for remove/add the mapping in P2M.
-    */
-    rc = iomem_deny_access(d, s, e);
-    if ( rc )
-    {
-        printk(XENLOG_ERR "Unable to remove %pd access to %#lx - %#lx\n",
-               d, s, e);
-    }
-    else
-        *c += e - s + 1;
-
-    return rc;
-}
-
-/* Count number of nodes till one level of __overlay__ tag. */
-static unsigned int overlay_node_count(const void *overlay_fdt)
-{
-    unsigned int num_overlay_nodes = 0;
-    int fragment;
-
-    fdt_for_each_subnode(fragment, overlay_fdt, 0)
-    {
-        int subnode;
-        int overlay;
-
-        overlay = fdt_subnode_offset(overlay_fdt, fragment, "__overlay__");
-        if ( overlay < 0 )
-            continue;
-
-        fdt_for_each_subnode(subnode, overlay_fdt, overlay)
-        {
-            num_overlay_nodes++;
-        }
-    }
-
-    return num_overlay_nodes;
-}
-
-/*
- * overlay_get_nodes_info gets full name with path for all the nodes which
- * are in one level of __overlay__ tag. This is useful when checking node for
- * duplication i.e. dtbo tries to add nodes which already exists in device tree.
- */
-static int overlay_get_nodes_info(const void *fdto, char **nodes_full_path)
-{
-    int fragment;
-    unsigned int node_num = 0;
-
-    fdt_for_each_subnode(fragment, fdto, 0)
-    {
-        int target;
-        int overlay;
-        int subnode;
-        const char *target_path;
-
-        overlay = fdt_subnode_offset(fdto, fragment, "__overlay__");
-        if ( overlay < 0 )
-            continue;
-
-        target = fdt_overlay_target_offset(device_tree_flattened, fdto,
-                                           fragment, &target_path);
-        if ( target < 0 )
-            return target;
-
-        if ( target_path == NULL )
-            return -EINVAL;
-
-        fdt_for_each_subnode(subnode, fdto, overlay)
-        {
-            const char *node_name = NULL;
-            int node_name_len;
-            unsigned int target_path_len = strlen(target_path);
-            unsigned int node_full_name_len;
-            unsigned int extra_len;
-
-            node_name = fdt_get_name(fdto, subnode, &node_name_len);
-
-            if ( node_name == NULL )
-                return node_name_len;
-
-            /*
-             * Extra length is for adding '/' and '\0' unless the target path is
-             * root in which case we don't add the '/' at the beginning. This is
-             * done to keep the node_full_path in the correct full node name
-             * format.
-             */
-            extra_len = (target_path_len > 1) ? 2 : 1;
-            node_full_name_len = target_path_len + node_name_len + extra_len;
-
-            nodes_full_path[node_num] = xmalloc_bytes(node_full_name_len);
-
-            if ( nodes_full_path[node_num] == NULL )
-                return -ENOMEM;
-
-            memcpy(nodes_full_path[node_num], target_path, target_path_len);
-
-            /* Target is not root - add separator */
-            if ( target_path_len > 1 )
-                nodes_full_path[node_num][target_path_len++] = '/';
-
-            memcpy(nodes_full_path[node_num] + target_path_len,
-                    node_name, node_name_len);
-
-            nodes_full_path[node_num][node_full_name_len - 1] = '\0';
-
-            node_num++;
-        }
-    }
-
-    return 0;
-}
-
-/* This function should be called with the overlay_lock taken */
-static struct overlay_track *
-find_track_entry_from_tracker(const void *overlay_fdt,
-                              uint32_t overlay_fdt_size)
-{
-    struct overlay_track *entry, *temp;
-    bool found_entry = false;
-
-    ASSERT(spin_is_locked(&overlay_lock));
-
-    /*
-     * First check if dtbo is correct i.e. it should one of the dtbo which was
-     * used when dynamically adding the node.
-     * Limitation: Cases with same node names but different property are not
-     * supported currently. We are relying on user to provide the same dtbo
-     * as it was used when adding the nodes.
-     */
-    list_for_each_entry_safe( entry, temp, &overlay_tracker, entry )
-    {
-        if ( memcmp(entry->overlay_fdt, overlay_fdt, overlay_fdt_size) == 0 )
-        {
-            found_entry = true;
-            break;
-        }
-    }
-
-    if ( !found_entry )
-    {
-        printk(XENLOG_ERR "Cannot find any matching tracker with input dtbo."
-               " Operation is supported only for prior added dtbo.\n");
-        return NULL;
-    }
-
-    return entry;
-}
-
-/* Check if node itself can be removed and remove node from IOMMU. */
-static int remove_node_resources(struct dt_device_node *device_node)
-{
-    int rc = 0;
-    unsigned int len;
-    domid_t domid;
-
-    domid = dt_device_used_by(device_node);
-
-    dt_dprintk("Checking if node %s is used by any domain\n",
-               device_node->full_name);
-
-    /* Remove the node if only it's assigned to hardware domain or domain io. */
-    if ( domid != hardware_domain->domain_id && domid != DOMID_IO )
-    {
-        printk(XENLOG_ERR "Device %s is being used by domain %u. Removing nodes failed\n",
-               device_node->full_name, domid);
-        return -EINVAL;
-    }
-
-    /* Check if iommu property exists. */
-    if ( dt_get_property(device_node, "iommus", &len) )
-    {
-        if ( dt_device_is_protected(device_node) )
-        {
-            rc = iommu_remove_dt_device(device_node);
-            if ( rc < 0 )
-                return rc;
-        }
-    }
-
-    return rc;
-}
-
-/* Remove all descendants from IOMMU. */
-static int
-remove_descendant_nodes_resources(const struct dt_device_node *device_node)
-{
-    int rc = 0;
-    struct dt_device_node *child_node;
-
-    for ( child_node = device_node->child; child_node != NULL;
-         child_node = child_node->sibling )
-    {
-        if ( child_node->child )
-        {
-            rc = remove_descendant_nodes_resources(child_node);
-            if ( rc )
-                return rc;
-        }
-
-        rc = remove_node_resources(child_node);
-        if ( rc )
-            return rc;
-    }
-
-    return rc;
-}
-
-/* Remove nodes from dt_host. */
-static int remove_nodes(const struct overlay_track *tracker)
-{
-    int rc = 0;
-    struct dt_device_node *overlay_node;
-    unsigned int j;
-    struct domain *d = hardware_domain;
-
-    for ( j = 0; j < tracker->num_nodes; j++ )
-    {
-        overlay_node = (struct dt_device_node *)tracker->nodes_address[j];
-        if ( overlay_node == NULL )
-            return -EINVAL;
-
-        write_lock(&dt_host_lock);
-
-        rc = remove_descendant_nodes_resources(overlay_node);
-        if ( rc )
-        {
-            write_unlock(&dt_host_lock);
-            return rc;
-        }
-
-        rc = remove_node_resources(overlay_node);
-        if ( rc )
-        {
-            write_unlock(&dt_host_lock);
-            return rc;
-        }
-
-        dt_dprintk("Removing node: %s\n", overlay_node->full_name);
-
-        rc = dt_overlay_remove_node(overlay_node);
-        if ( rc )
-        {
-            write_unlock(&dt_host_lock);
-            return rc;
-        }
-
-        write_unlock(&dt_host_lock);
-    }
-
-    /* Remove IRQ access. */
-    if ( tracker->irq_ranges )
-    {
-        rc = rangeset_consume_ranges(tracker->irq_ranges, irq_remove_cb, d);
-        if ( rc )
-            return rc;
-    }
-
-   /* Remove mmio access. */
-    if ( tracker->iomem_ranges )
-    {
-        rc = rangeset_consume_ranges(tracker->iomem_ranges, iomem_remove_cb, d);
-        if ( rc )
-            return rc;
-    }
-
-    return rc;
-}
-
-/*
- * First finds the device node to remove. Check if the device is being used by
- * any dom and finally remove it from dt_host. IOMMU is already being taken care
- * while destroying the domain.
- */
-static long handle_remove_overlay_nodes(const void *overlay_fdt,
-                                        uint32_t overlay_fdt_size)
-{
-    int rc;
-    struct overlay_track *entry;
-
-    rc = check_overlay_fdt(overlay_fdt, overlay_fdt_size);
-    if ( rc )
-        return rc;
-
-    spin_lock(&overlay_lock);
-
-    entry = find_track_entry_from_tracker(overlay_fdt, overlay_fdt_size);
-    if ( entry == NULL )
-    {
-        rc = -EINVAL;
-        goto out;
-
-    }
-
-    rc = remove_nodes(entry);
-    if ( rc )
-    {
-        printk(XENLOG_ERR "Removing node failed\n");
-        goto out;
-    }
-
-    list_del(&entry->entry);
-
-    xfree(entry->dt_host_new);
-    xfree(entry->fdt);
-    xfree(entry->overlay_fdt);
-
-    xfree(entry->nodes_address);
-
-    rangeset_destroy(entry->irq_ranges);
-    rangeset_destroy(entry->iomem_ranges);
-
-    xfree(entry);
-
- out:
-    spin_unlock(&overlay_lock);
-    return rc;
-}
-
-static void free_nodes_full_path(unsigned int num_nodes, char **nodes_full_path)
-{
-    unsigned int i;
-
-    if ( nodes_full_path == NULL )
-        return;
-
-    for ( i = 0; i < num_nodes && nodes_full_path[i] != NULL; i++ )
-    {
-        xfree(nodes_full_path[i]);
-    }
-
-    xfree(nodes_full_path);
-}
-
-static long add_nodes(struct overlay_track *tr, char **nodes_full_path)
-
-{
-    int rc;
-    unsigned int j;
-    struct dt_device_node *overlay_node;
-
-    for ( j = 0; j < tr->num_nodes; j++ )
-    {
-        struct dt_device_node *prev_node, *next_node;
-
-        dt_dprintk("Adding node: %s\n", nodes_full_path[j]);
-
-        /* Find the newly added node in tr->dt_host_new by it's full path. */
-        overlay_node = dt_find_node_by_path_from(tr->dt_host_new,
-                                                 nodes_full_path[j]);
-        if ( overlay_node == NULL )
-            return -EFAULT;
-
-        /*
-         * Find previous and next node to overlay_node in dt_host_new. We will
-         * need these nodes to fix the dt_host_new mapping. When overlay_node is
-         * take out of dt_host_new tree and added to dt_host, link between
-         * previous node and next_node is broken. We will need to refresh
-         * dt_host_new with correct linking for any other overlay nodes
-         * extraction in future.
-         */
-        dt_for_each_device_node(tr->dt_host_new, prev_node)
-            if ( prev_node->allnext == overlay_node )
-                break;
-
-        next_node = dt_find_next_node(tr->dt_host_new, overlay_node);
-
-        write_lock(&dt_host_lock);
-
-        /* Add the node to dt_host. */
-        rc = dt_overlay_add_node(overlay_node, overlay_node->parent->full_name);
-        if ( rc )
-        {
-            write_unlock(&dt_host_lock);
-
-            /* Node not added in dt_host. */
-            return rc;
-        }
-
-        prev_node->allnext = next_node;
-
-        overlay_node = dt_find_node_by_path(overlay_node->full_name);
-        if ( overlay_node == NULL )
-        {
-            /* Sanity check. But code will never come here. */
-            ASSERT_UNREACHABLE();
-            return -EFAULT;
-        }
-
-        write_unlock(&dt_host_lock);
-
-        /* Keep overlay_node address in tracker. */
-        tr->nodes_address[j] = (unsigned long)overlay_node;
-    }
-
-    return 0;
-}
-/*
- * Adds device tree nodes under target node.
- * We use tr->dt_host_new to unflatten the updated device_tree_flattened.
- */
-static long handle_add_overlay_nodes(void *overlay_fdt,
-                                     uint32_t overlay_fdt_size)
-{
-    int rc;
-    unsigned int j;
-    struct dt_device_node *overlay_node;
-    struct overlay_track *tr = NULL;
-    char **nodes_full_path = NULL;
-    unsigned int new_fdt_size;
-
-    tr = xzalloc(struct overlay_track);
-    if ( tr == NULL )
-        return -ENOMEM;
-
-    new_fdt_size = fdt_totalsize(device_tree_flattened) +
-                                 fdt_totalsize(overlay_fdt);
-
-    tr->fdt = xzalloc_bytes(new_fdt_size);
-    if ( tr->fdt == NULL )
-    {
-        xfree(tr);
-        return -ENOMEM;
-    }
-
-    tr->num_nodes = overlay_node_count(overlay_fdt);
-    if ( tr->num_nodes == 0 )
-    {
-        xfree(tr->fdt);
-        xfree(tr);
-        return -ENOMEM;
-    }
-
-    tr->nodes_address = xzalloc_bytes(tr->num_nodes * sizeof(unsigned long));
-    if ( tr->nodes_address == NULL )
-    {
-        xfree(tr->fdt);
-        xfree(tr);
-        return -ENOMEM;
-    }
-
-    rc = check_overlay_fdt(overlay_fdt, overlay_fdt_size);
-    if ( rc )
-    {
-        xfree(tr->nodes_address);
-        xfree(tr->fdt);
-        xfree(tr);
-        return rc;
-    }
-
-    /*
-     * Keep a copy of overlay_fdt as fdt_overlay_apply will change the input
-     * overlay's content(magic) when applying overlay.
-     */
-    tr->overlay_fdt = xzalloc_bytes(overlay_fdt_size);
-    if ( tr->overlay_fdt == NULL )
-    {
-        xfree(tr->nodes_address);
-        xfree(tr->fdt);
-        xfree(tr);
-        return -ENOMEM;
-    }
-
-    memcpy(tr->overlay_fdt, overlay_fdt, overlay_fdt_size);
-
-    spin_lock(&overlay_lock);
-
-    memcpy(tr->fdt, device_tree_flattened,
-           fdt_totalsize(device_tree_flattened));
-
-    /* Open tr->fdt with more space to accommodate the overlay_fdt. */
-    rc = fdt_open_into(tr->fdt, tr->fdt, new_fdt_size);
-    if ( rc )
-    {
-        printk(XENLOG_ERR "Increasing fdt size to accommodate overlay_fdt failed with error %d\n",
-               rc);
-        goto err;
-    }
-
-    nodes_full_path = xzalloc_bytes(tr->num_nodes * sizeof(char *));
-    if ( nodes_full_path == NULL )
-    {
-        rc = -ENOMEM;
-        goto err;
-    }
-
-    /*
-     * overlay_get_nodes_info is called to get the node information from dtbo.
-     * This is done before fdt_overlay_apply() because the overlay apply will
-     * erase the magic of overlay_fdt.
-     */
-    rc = overlay_get_nodes_info(overlay_fdt, nodes_full_path);
-    if ( rc )
-    {
-        printk(XENLOG_ERR "Getting nodes information failed with error %d\n",
-               rc);
-        goto err;
-    }
-
-    rc = fdt_overlay_apply(tr->fdt, overlay_fdt);
-    if ( rc )
-    {
-        printk(XENLOG_ERR "Adding overlay node failed with error %d\n", rc);
-        goto err;
-    }
-
-    /*
-     * Check if any of the node already exists in dt_host. If node already exits
-     * we can return here as this overlay_fdt is not suitable for overlay ops.
-     */
-    for ( j = 0; j < tr->num_nodes; j++ )
-    {
-        overlay_node = dt_find_node_by_path(nodes_full_path[j]);
-        if ( overlay_node != NULL )
-        {
-            printk(XENLOG_ERR "node %s exists in device tree\n",
-                   nodes_full_path[j]);
-            rc = -EINVAL;
-            goto err;
-        }
-    }
-
-    /*
-     * Unflatten the tr->fdt into a new dt_host.
-     * TODO: Check and add alias_scan() if it's needed for overlay in future.
-     */
-    rc = unflatten_device_tree(tr->fdt, &tr->dt_host_new);
-    if ( rc )
-    {
-        printk(XENLOG_ERR "unflatten_device_tree failed with error %d\n", rc);
-        goto err;
-    }
-
-    rc = add_nodes(tr, nodes_full_path);
-    if ( rc )
-    {
-        printk(XENLOG_ERR "Adding nodes failed. Removing the partially added nodes.\n");
-        goto remove_node;
-    }
-
-    INIT_LIST_HEAD(&tr->entry);
-    list_add_tail(&tr->entry, &overlay_tracker);
-
-    spin_unlock(&overlay_lock);
-
-    free_nodes_full_path(tr->num_nodes, nodes_full_path);
-
-    return rc;
-
-/*
- * Failure case. We need to remove the nodes, free tracker(if tr exists) and
- * tr->dt_host_new.
- */
- remove_node:
-    tr->num_nodes = j;
-    rc = remove_nodes(tr);
-
-    if ( rc )
-    {
-        /*
-         * User needs to provide right overlay. Incorrect node information
-         * example parent node doesn't exist in dt_host etc can cause memory
-         * leaks as removing_nodes() will fail and this means nodes memory is
-         * not freed from tracker. Which may cause memory leaks. Ideally, these
-         * device tree related mistakes will be caught by fdt_overlay_apply()
-         * but given that we don't manage that code keeping this warning message
-         * is better here.
-         */
-        printk(XENLOG_ERR "Removing node failed.\n");
-        spin_unlock(&overlay_lock);
-
-        free_nodes_full_path(tr->num_nodes, nodes_full_path);
-
-        return rc;
-    }
-
- err:
-    spin_unlock(&overlay_lock);
-
-    if ( tr->dt_host_new )
-        xfree(tr->dt_host_new);
-
-    free_nodes_full_path(tr->num_nodes, nodes_full_path);
-
-    xfree(tr->overlay_fdt);
-    xfree(tr->nodes_address);
-    xfree(tr->fdt);
-
-    xfree(tr);
-
-    return rc;
-}
-
-static long handle_attach_overlay_nodes(struct domain *d,
-                                        const void *overlay_fdt,
-                                        uint32_t overlay_fdt_size)
-{
-    int rc;
-    unsigned int j;
-    struct overlay_track *entry;
-
-    rc = check_overlay_fdt(overlay_fdt, overlay_fdt_size);
-    if ( rc )
-        return rc;
-
-    spin_lock(&overlay_lock);
-
-    entry = find_track_entry_from_tracker(overlay_fdt, overlay_fdt_size);
-    if ( entry == NULL )
-    {
-        rc = -EINVAL;
-        goto out;
-    }
-
-    entry->irq_ranges = rangeset_new(d, "Overlays: Interrupts", 0);
-    if (entry->irq_ranges == NULL)
-    {
-        rc = -ENOMEM;
-        printk(XENLOG_ERR "Creating IRQ rangeset failed");
-        goto out;
-    }
-
-    entry->iomem_ranges = rangeset_new(d, "Overlay: I/O Memory",
-                                       RANGESETF_prettyprint_hex);
-    if (entry->iomem_ranges == NULL)
-    {
-        rc = -ENOMEM;
-        printk(XENLOG_ERR "Creating IOMMU rangeset failed");
-        goto out;
-    }
-
-    for ( j = 0; j < entry->num_nodes; j++ )
-    {
-        struct dt_device_node *overlay_node;
-
-        overlay_node = (struct dt_device_node *)entry->nodes_address[j];
-        if ( overlay_node == NULL )
-        {
-            rc = -EINVAL;
-            goto out;
-        }
-
-        write_lock(&dt_host_lock);
-        rc = handle_device(d, overlay_node, p2m_mmio_direct_c,
-                           entry->iomem_ranges, entry->irq_ranges);
-        write_unlock(&dt_host_lock);
-        if ( rc )
-        {
-            printk(XENLOG_ERR "Adding IRQ and IOMMU failed\n");
-            goto out;
-        }
-    }
-
-    spin_unlock(&overlay_lock);
-
-    return 0;
-
- out:
-    spin_unlock(&overlay_lock);
-
-    if ( entry )
-    {
-        rangeset_destroy(entry->irq_ranges);
-        rangeset_destroy(entry->iomem_ranges);
-    }
-
-    return rc;
-}
-
-long dt_overlay_sysctl(struct xen_sysctl_dt_overlay *op)
-{
-    long ret;
-    void *overlay_fdt;
-
-    if ( op->overlay_op != XEN_SYSCTL_DT_OVERLAY_ADD &&
-         op->overlay_op != XEN_SYSCTL_DT_OVERLAY_REMOVE )
-        return -EOPNOTSUPP;
-
-    if ( op->overlay_fdt_size == 0 ||
-         op->overlay_fdt_size > DT_OVERLAY_MAX_SIZE )
-        return -EINVAL;
-
-    if ( op->pad[0] || op->pad[1] || op->pad[2] )
-        return -EINVAL;
-
-    overlay_fdt = xmalloc_bytes(op->overlay_fdt_size);
-
-    if ( overlay_fdt == NULL )
-        return -ENOMEM;
-
-    ret = copy_from_guest(overlay_fdt, op->overlay_fdt, op->overlay_fdt_size);
-    if ( ret )
-    {
-        gprintk(XENLOG_ERR, "copy from guest failed\n");
-        xfree(overlay_fdt);
-
-        return -EFAULT;
-    }
-
-    if ( op->overlay_op == XEN_SYSCTL_DT_OVERLAY_REMOVE )
-        ret = handle_remove_overlay_nodes(overlay_fdt, op->overlay_fdt_size);
-    else
-        ret = handle_add_overlay_nodes(overlay_fdt, op->overlay_fdt_size);
-
-    xfree(overlay_fdt);
-
-    return ret;
-}
-
-long dt_overlay_domctl(struct domain *d, struct xen_domctl_dt_overlay *op)
-{
-    long ret;
-    void *overlay_fdt;
-
-    if ( op->overlay_op != XEN_DOMCTL_DT_OVERLAY_ATTACH )
-        return -EOPNOTSUPP;
-
-    if ( op->overlay_fdt_size == 0 ||
-         op->overlay_fdt_size > DT_OVERLAY_MAX_SIZE )
-        return -EINVAL;
-
-    if ( op->pad[0] || op->pad[1] || op->pad[2] )
-        return -EINVAL;
-
-    /* TODO: add support for non-1:1 domains using xen,reg */
-    if ( !is_domain_direct_mapped(d) )
-        return -EOPNOTSUPP;
-
-    overlay_fdt = xmalloc_bytes(op->overlay_fdt_size);
-
-    if ( overlay_fdt == NULL )
-        return -ENOMEM;
-
-    ret = copy_from_guest(overlay_fdt, op->overlay_fdt, op->overlay_fdt_size);
-    if ( ret )
-    {
-        gprintk(XENLOG_ERR, "copy from guest failed\n");
-        xfree(overlay_fdt);
-
-        return -EFAULT;
-    }
-
-    if ( op->overlay_op == XEN_DOMCTL_DT_OVERLAY_ATTACH )
-        ret = handle_attach_overlay_nodes(d, overlay_fdt, op->overlay_fdt_size);
-    else
-        ret = -EOPNOTSUPP;
-
-    xfree(overlay_fdt);
-
-    return ret;
-}
-
-/*
- * 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 Oct 17 14:44:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 17 Oct 2024 14:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.820668.1234217 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t1Rjb-0003FI-20; Thu, 17 Oct 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 820668.1234217; Thu, 17 Oct 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 1t1Rja-0003FB-Vc; Thu, 17 Oct 2024 14:44:14 +0000
Received: by outflank-mailman (input) for mailman id 820668;
 Thu, 17 Oct 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 1t1Rja-0003Ey-AJ
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 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 1t1Rja-0004Rm-9C
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 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 1t1Rja-0001c5-6w
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 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=jgkyVdk8L+xt1gEHCq4bphdCr9P5usgtzvWCFe9JJ6k=; b=q2e5V5eiR8tHJDXJ+BmiGepkoX
	PxxDn6MhjoI0CoSA5WrK3+4unP0Xt6o//Fly8YUSRf4lWqL1MUC6cl3EbYOXVzQpQ7WHLmud5vzYW
	KtNbxMKlYuMlCgNqkqfXQG6piBDkOk5HRkYCqhsTb3ZAdc/ylSagKJvuxXwoo3KC5Il4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: dom0less: cope with missing /gic phandle
Message-Id: <E1t1Rja-0001c5-6w@xenbits.xenproject.org>
Date: Thu, 17 Oct 2024 14:44:14 +0000

commit 081683ea578da56dd20b9dc22a64d03c893b47ba
Author:     Stewart Hildebrand <stewart.hildebrand@amd.com>
AuthorDate: Fri Oct 11 17:19:56 2024 -0400
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Oct 17 15:42:11 2024 +0100

    xen/arm: dom0less: cope with missing /gic phandle
    
    If a partial DT has a /gic node, but no references to it, dtc may omit
    the phandle property. With the phandle property missing,
    fdt_get_phandle() returns 0, leading Xen to generate a malformed domU
    dtb due to invalid interrupt-parent phandle references. 0 is an invalid
    phandle value. Add a zero check, and fall back to GUEST_PHANDLE_GIC.
    
    Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/dom0less-build.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index 09b65e44ae..f328a044e9 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -554,7 +554,10 @@ static int __init domain_handle_dtb_bootmodule(struct domain *d,
          */
         if ( dt_node_cmp(name, "gic") == 0 )
         {
-            kinfo->phandle_gic = fdt_get_phandle(pfdt, node_next);
+            uint32_t phandle_gic = fdt_get_phandle(pfdt, node_next);
+
+            if ( phandle_gic != 0 )
+                kinfo->phandle_gic = phandle_gic;
             continue;
         }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 17 22:55:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 17 Oct 2024 22:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.821392.1235173 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t1ZOb-0005Uj-2s; Thu, 17 Oct 2024 22:55:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 821392.1235173; Thu, 17 Oct 2024 22: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 1t1ZOb-0005Ub-0E; Thu, 17 Oct 2024 22:55:05 +0000
Received: by outflank-mailman (input) for mailman id 821392;
 Thu, 17 Oct 2024 22: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 1t1ZOa-0005UV-74
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 22: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 1t1ZOa-0005hU-5e
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 22:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t1ZOa-0005TA-3V
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 22: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=MT3mfIFFq+QB2jBWKG7msg5NmB7v0rMP/SmtxhRXOVY=; b=nENVWb510anTth4UFZfOlVShdB
	X5ywPCqHX2B8jg73KnHkIpym/SOriM8rvk0vVLJDs/dq19kLqe4ZdLcFfSjYsOvLxXf1qhokBMb3i
	jQeHoBEwKaqQ7qyE0c4Q6D3GzzBQBmWfFXSj5ro3i8U/gTcZ4Vw/I10VC8EUSlEBB3UY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: move x86 boot module counting into a new boot_info struct
Message-Id: <E1t1ZOa-0005TA-3V@xenbits.xenproject.org>
Date: Thu, 17 Oct 2024 22:55:04 +0000

commit 038826b61e852469b1a54690dba6d142aceb1f20
Author:     Christopher Clark <christopher.w.clark@gmail.com>
AuthorDate: Thu Oct 17 13:02:41 2024 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 17 23:42:51 2024 +0100

    x86/boot: move x86 boot module counting into a new boot_info struct
    
    An initial step towards a non-multiboot internal representation of boot
    modules for common code, starting with x86 setup and converting the fields
    that are accessed for the startup calculations.
    
    Introduce a new header, <asm/bootinfo.h>, and populate it with a new boot_info
    structure initially containing a count of the number of boot modules.
    
    No functional change intended.
    
    Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com>
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/bootinfo.h | 29 ++++++++++++++++
 xen/arch/x86/include/asm/setup.h    |  2 ++
 xen/arch/x86/setup.c                | 66 +++++++++++++++++++++++--------------
 3 files changed, 73 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm/bootinfo.h
new file mode 100644
index 0000000000..385579e2b5
--- /dev/null
+++ b/xen/arch/x86/include/asm/bootinfo.h
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (c) 2024 Christopher Clark <christopher.w.clark@gmail.com>
+ * Copyright (c) 2024 Apertus Solutions, LLC
+ * Author: Daniel P. Smith <dpsmith@apertussolutions.com>
+ */
+
+#ifndef X86_BOOTINFO_H
+#define X86_BOOTINFO_H
+
+/*
+ * Xen internal representation of information provided by the
+ * bootloader/environment, or derived from the information.
+ */
+struct boot_info {
+    unsigned int nr_modules;
+};
+
+#endif /* X86_BOOTINFO_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h
index d75589178b..3d18952118 100644
--- a/xen/arch/x86/include/asm/setup.h
+++ b/xen/arch/x86/include/asm/setup.h
@@ -32,6 +32,8 @@ int construct_dom0(
     const char *cmdline);
 void setup_io_bitmap(struct domain *d);
 
+extern struct boot_info xen_boot_info;
+
 unsigned long initial_images_nrpages(nodeid_t node);
 void discard_initial_images(void);
 void *bootstrap_map(const module_t *mod);
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index a6e77c9ed9..7464c3d49b 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -32,6 +32,7 @@
 #include <compat/xen.h>
 #endif
 #include <xen/bitops.h>
+#include <asm/bootinfo.h>
 #include <asm/smp.h>
 #include <asm/processor.h>
 #include <asm/mpspec.h>
@@ -274,16 +275,30 @@ static int __init cf_check parse_acpi_param(const char *s)
 custom_param("acpi", parse_acpi_param);
 
 static const module_t *__initdata initial_images;
-static unsigned int __initdata nr_initial_images;
+
+struct boot_info __initdata xen_boot_info = {
+};
+
+static struct boot_info *__init multiboot_fill_boot_info(unsigned long mbi_p)
+{
+    struct boot_info *bi = &xen_boot_info;
+    const multiboot_info_t *mbi = __va(mbi_p);
+
+    if ( mbi->flags & MBI_MODULES )
+        bi->nr_modules = mbi->mods_count;
+
+    return bi;
+}
 
 unsigned long __init initial_images_nrpages(nodeid_t node)
 {
+    struct boot_info *bi = &xen_boot_info;
     unsigned long node_start = node_start_pfn(node);
     unsigned long node_end = node_end_pfn(node);
     unsigned long nr;
     unsigned int i;
 
-    for ( nr = i = 0; i < nr_initial_images; ++i )
+    for ( nr = i = 0; i < bi->nr_modules; ++i )
     {
         unsigned long start = initial_images[i].mod_start;
         unsigned long end = start + PFN_UP(initial_images[i].mod_end);
@@ -297,9 +312,10 @@ unsigned long __init initial_images_nrpages(nodeid_t node)
 
 void __init discard_initial_images(void)
 {
+    struct boot_info *bi = &xen_boot_info;
     unsigned int i;
 
-    for ( i = 0; i < nr_initial_images; ++i )
+    for ( i = 0; i < bi->nr_modules; ++i )
     {
         uint64_t start = (uint64_t)initial_images[i].mod_start << PAGE_SHIFT;
 
@@ -307,7 +323,7 @@ void __init discard_initial_images(void)
                            start + PAGE_ALIGN(initial_images[i].mod_end));
     }
 
-    nr_initial_images = 0;
+    bi->nr_modules = 0;
     initial_images = NULL;
 }
 
@@ -969,6 +985,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     void *bsp_stack;
     struct cpu_info *info = get_cpu_info(), *bsp_info;
     unsigned int initrdidx, num_parked = 0;
+    struct boot_info *bi;
     multiboot_info_t *mbi;
     module_t *mod;
     unsigned long nr_pages, raw_max_page, modules_headroom, module_map[1];
@@ -1015,6 +1032,8 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
         mod = __va(mbi->mods_addr);
     }
 
+    bi = multiboot_fill_boot_info(mbi_p);
+
     loader = (mbi->flags & MBI_LOADERNAME) ? __va(mbi->boot_loader_name)
                                            : "unknown";
 
@@ -1122,18 +1141,18 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
            bootsym(boot_edd_info_nr));
 
     /* Check that we have at least one Multiboot module. */
-    if ( !(mbi->flags & MBI_MODULES) || (mbi->mods_count == 0) )
+    if ( !bi->nr_modules )
         panic("dom0 kernel not specified. Check bootloader configuration\n");
 
     /* Check that we don't have a silly number of modules. */
-    if ( mbi->mods_count > sizeof(module_map) * 8 )
+    if ( bi->nr_modules > sizeof(module_map) * 8 )
     {
-        mbi->mods_count = sizeof(module_map) * 8;
-        printk("Excessive multiboot modules - using the first %u only\n",
-               mbi->mods_count);
+        bi->nr_modules = sizeof(module_map) * 8;
+        printk("Excessive boot modules - using the first %u only\n",
+               bi->nr_modules);
     }
 
-    bitmap_fill(module_map, mbi->mods_count);
+    bitmap_fill(module_map, bi->nr_modules);
     __clear_bit(0, module_map); /* Dom0 kernel is always first */
 
     if ( pvh_boot )
@@ -1306,9 +1325,8 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     kexec_reserve_area();
 
     initial_images = mod;
-    nr_initial_images = mbi->mods_count;
 
-    for ( i = 0; !efi_enabled(EFI_LOADER) && i < mbi->mods_count; i++ )
+    for ( i = 0; !efi_enabled(EFI_LOADER) && i < bi->nr_modules; i++ )
     {
         if ( mod[i].mod_start & (PAGE_SIZE - 1) )
             panic("Bootloader didn't honor module alignment request\n");
@@ -1332,8 +1350,8 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
          * respective reserve_e820_ram() invocation below. No need to
          * query efi_boot_mem_unused() here, though.
          */
-        mod[mbi->mods_count].mod_start = virt_to_mfn(_stext);
-        mod[mbi->mods_count].mod_end = __2M_rwdata_end - _stext;
+        mod[bi->nr_modules].mod_start = virt_to_mfn(_stext);
+        mod[bi->nr_modules].mod_end = __2M_rwdata_end - _stext;
     }
 
     modules_headroom = bzimage_headroom(bootstrap_map(mod), mod->mod_end);
@@ -1393,7 +1411,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
         {
             /* Don't overlap with modules. */
             end = consider_modules(s, e, reloc_size + mask,
-                                   mod, mbi->mods_count, -1);
+                                   mod, bi->nr_modules, -1);
             end &= ~mask;
         }
         else
@@ -1414,7 +1432,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
         }
 
         /* Is the region suitable for relocating the multiboot modules? */
-        for ( j = mbi->mods_count - 1; j >= 0; j-- )
+        for ( j = bi->nr_modules - 1; j >= 0; j-- )
         {
             /*
              * 'headroom' is a guess for the decompressed size and
@@ -1429,7 +1447,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
 
             /* Don't overlap with other modules (or Xen itself). */
             end = consider_modules(s, e, size, mod,
-                                   mbi->mods_count + relocated, j);
+                                   bi->nr_modules + relocated, j);
 
             if ( highmem_start && end > highmem_start )
                 continue;
@@ -1456,7 +1474,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
         {
             /* Don't overlap with modules (or Xen itself). */
             e = consider_modules(s, e, PAGE_ALIGN(kexec_crash_area.size), mod,
-                                 mbi->mods_count + relocated, -1);
+                                 bi->nr_modules + relocated, -1);
             if ( s >= e )
                 break;
             if ( e > kexec_crash_area_limit )
@@ -1471,7 +1489,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
 
     if ( modules_headroom && !mod->reserved )
         panic("Not enough memory to relocate the dom0 kernel image\n");
-    for ( i = 0; i < mbi->mods_count; ++i )
+    for ( i = 0; i < bi->nr_modules; ++i )
     {
         uint64_t s = (uint64_t)mod[i].mod_start << PAGE_SHIFT;
 
@@ -1551,7 +1569,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
                     ASSERT(j);
                 }
                 map_e = boot_e820.map[j].addr + boot_e820.map[j].size;
-                for ( j = 0; j < mbi->mods_count; ++j )
+                for ( j = 0; j < bi->nr_modules; ++j )
                 {
                     uint64_t end = pfn_to_paddr(mod[j].mod_start) +
                                    mod[j].mod_end;
@@ -1626,7 +1644,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
         }
     }
 
-    for ( i = 0; i < mbi->mods_count; ++i )
+    for ( i = 0; i < bi->nr_modules; ++i )
     {
         set_pdx_range(mod[i].mod_start,
                       mod[i].mod_start + PFN_UP(mod[i].mod_end));
@@ -2011,8 +2029,8 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
            cpu_has_nx ? XENLOG_INFO : XENLOG_WARNING "Warning: ",
            cpu_has_nx ? "" : "not ");
 
-    initrdidx = find_first_bit(module_map, mbi->mods_count);
-    if ( bitmap_weight(module_map, mbi->mods_count) > 1 )
+    initrdidx = find_first_bit(module_map, bi->nr_modules);
+    if ( bitmap_weight(module_map, bi->nr_modules) > 1 )
         printk(XENLOG_WARNING
                "Multiple initrd candidates, picking module #%u\n",
                initrdidx);
@@ -2022,7 +2040,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
      * above our heap. The second module, if present, is an initrd ramdisk.
      */
     dom0 = create_dom0(mod, modules_headroom,
-                       initrdidx < mbi->mods_count ? mod + initrdidx : NULL,
+                       initrdidx < bi->nr_modules ? mod + initrdidx : NULL,
                        kextra, loader);
     if ( !dom0 )
         panic("Could not set up DOM0 guest OS\n");
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 17 22:55:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 17 Oct 2024 22:55:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.821393.1235178 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t1ZOl-0005WM-4I; Thu, 17 Oct 2024 22:55:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 821393.1235178; Thu, 17 Oct 2024 22: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 1t1ZOl-0005WE-1g; Thu, 17 Oct 2024 22:55:15 +0000
Received: by outflank-mailman (input) for mailman id 821393;
 Thu, 17 Oct 2024 22: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 1t1ZOk-0005W6-BT
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 22: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 1t1ZOk-0005he-8p
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 22:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t1ZOk-0005UK-7s
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 22: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=enhgLuYzeVzynldFkdJkayM2armU92EXFOK5ezGXbtU=; b=aJgCrju3FIoaY2P3STNx7tzMjU
	J506mZZZ1Mf7u01etDtJ44C//DrbOnREBrC0WDY1UrqoUz3IbNGrW53BiQODLzfXDYpJlnPNBTgpM
	N6SvZ4QoCSjbSuPwtRssnlgqCt7IQBX7WUfn9JbP7k+E4944WeTks/7KCFwd1QCLKjZY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: move boot loader name to boot info
Message-Id: <E1t1ZOk-0005UK-7s@xenbits.xenproject.org>
Date: Thu, 17 Oct 2024 22:55:14 +0000

commit b438c5fbf4c02145f6ecc8642290d46bf1957388
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Thu Oct 17 13:02:42 2024 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 17 23:42:51 2024 +0100

    x86/boot: move boot loader name to boot info
    
    Transition the incoming boot loader name to be held in struct boot_info.
    
    No functional change intended.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/bootinfo.h |  2 ++
 xen/arch/x86/setup.c                | 17 +++++++++--------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm/bootinfo.h
index 385579e2b5..f066110f4b 100644
--- a/xen/arch/x86/include/asm/bootinfo.h
+++ b/xen/arch/x86/include/asm/bootinfo.h
@@ -13,6 +13,8 @@
  * bootloader/environment, or derived from the information.
  */
 struct boot_info {
+    const char *loader;
+
     unsigned int nr_modules;
 };
 
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 7464c3d49b..9e22528f4b 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -277,6 +277,7 @@ custom_param("acpi", parse_acpi_param);
 static const module_t *__initdata initial_images;
 
 struct boot_info __initdata xen_boot_info = {
+    .loader = "unknown",
 };
 
 static struct boot_info *__init multiboot_fill_boot_info(unsigned long mbi_p)
@@ -287,6 +288,9 @@ static struct boot_info *__init multiboot_fill_boot_info(unsigned long mbi_p)
     if ( mbi->flags & MBI_MODULES )
         bi->nr_modules = mbi->mods_count;
 
+    if ( mbi->flags & MBI_LOADERNAME )
+        bi->loader = __va(mbi->boot_loader_name);
+
     return bi;
 }
 
@@ -980,7 +984,7 @@ static struct domain *__init create_dom0(const module_t *image,
 
 void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
 {
-    const char *memmap_type = NULL, *loader, *cmdline = "";
+    const char *memmap_type = NULL, *cmdline = "";
     char *kextra;
     void *bsp_stack;
     struct cpu_info *info = get_cpu_info(), *bsp_info;
@@ -1034,12 +1038,9 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
 
     bi = multiboot_fill_boot_info(mbi_p);
 
-    loader = (mbi->flags & MBI_LOADERNAME) ? __va(mbi->boot_loader_name)
-                                           : "unknown";
-
     /* Parse the command-line options. */
     if ( mbi->flags & MBI_CMDLINE )
-        cmdline = cmdline_cook(__va(mbi->cmdline), loader);
+        cmdline = cmdline_cook(__va(mbi->cmdline), bi->loader);
 
     if ( (kextra = strstr(cmdline, " -- ")) != NULL )
     {
@@ -1080,7 +1081,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     if ( pvh_boot )
         pvh_print_info();
 
-    printk("Bootloader: %s\n", loader);
+    printk("Bootloader: %s\n", bi->loader);
 
     printk("Command line: %s\n", cmdline);
 
@@ -1173,7 +1174,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
         l3_bootmap[l3_table_offset(BOOTSTRAP_MAP_BASE)] =
             l3e_from_paddr(__pa(l2_bootmap), __PAGE_HYPERVISOR);
 
-        memmap_type = loader;
+        memmap_type = bi->loader;
     }
     else if ( efi_enabled(EFI_BOOT) )
         memmap_type = "EFI";
@@ -2041,7 +2042,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
      */
     dom0 = create_dom0(mod, modules_headroom,
                        initrdidx < bi->nr_modules ? mod + initrdidx : NULL,
-                       kextra, loader);
+                       kextra, bi->loader);
     if ( !dom0 )
         panic("Could not set up DOM0 guest OS\n");
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 17 22:55:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 17 Oct 2024 22:55:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.821394.1235182 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t1ZOv-0005Yt-5b; Thu, 17 Oct 2024 22:55:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 821394.1235182; Thu, 17 Oct 2024 22: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 1t1ZOv-0005Ym-3B; Thu, 17 Oct 2024 22:55:25 +0000
Received: by outflank-mailman (input) for mailman id 821394;
 Thu, 17 Oct 2024 22: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 1t1ZOu-0005Ye-FE
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 22: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 1t1ZOu-0005hr-CV
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 22:55:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t1ZOu-0005Vc-Ay
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 22: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=388ukijktKxn8dFCh9UW7ZlrkQ7bpp8o9U+GZ6jcAb0=; b=c6Qu4iFXsHTgjCDm4KOplU486+
	L1N9y90BT86gu2gQbJab1XPXky+IGpr7aI6NREo009udon+5FWnieXMUh+h9Id/iTxLF0bANiT6BO
	PD2wWjlanW+ezpjAOIzJIaIe024d3QCQEFtRHuLP9ugFycbxSG9qWjqZzRDoJ4kWtb2I=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: move cmdline to boot info
Message-Id: <E1t1ZOu-0005Vc-Ay@xenbits.xenproject.org>
Date: Thu, 17 Oct 2024 22:55:24 +0000

commit 29aaded97dacd3120842aeeafa91a4a8e6d45180
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Thu Oct 17 13:02:43 2024 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 17 23:42:51 2024 +0100

    x86/boot: move cmdline to boot info
    
    Transition Xen's command line to being held in struct boot_info.
    
    No functional change intended.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/bootinfo.h |  1 +
 xen/arch/x86/setup.c                | 17 ++++++++++-------
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm/bootinfo.h
index f066110f4b..c980f0bdb7 100644
--- a/xen/arch/x86/include/asm/bootinfo.h
+++ b/xen/arch/x86/include/asm/bootinfo.h
@@ -14,6 +14,7 @@
  */
 struct boot_info {
     const char *loader;
+    const char *cmdline;
 
     unsigned int nr_modules;
 };
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 9e22528f4b..01e35b9659 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -274,10 +274,13 @@ static int __init cf_check parse_acpi_param(const char *s)
 }
 custom_param("acpi", parse_acpi_param);
 
+static const char *cmdline_cook(const char *p, const char *loader_name);
+
 static const module_t *__initdata initial_images;
 
 struct boot_info __initdata xen_boot_info = {
     .loader = "unknown",
+    .cmdline = "",
 };
 
 static struct boot_info *__init multiboot_fill_boot_info(unsigned long mbi_p)
@@ -291,6 +294,9 @@ static struct boot_info *__init multiboot_fill_boot_info(unsigned long mbi_p)
     if ( mbi->flags & MBI_LOADERNAME )
         bi->loader = __va(mbi->boot_loader_name);
 
+    if ( mbi->flags & MBI_CMDLINE )
+        bi->cmdline = cmdline_cook(__va(mbi->cmdline), bi->loader);
+
     return bi;
 }
 
@@ -984,7 +990,7 @@ static struct domain *__init create_dom0(const module_t *image,
 
 void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
 {
-    const char *memmap_type = NULL, *cmdline = "";
+    const char *memmap_type = NULL;
     char *kextra;
     void *bsp_stack;
     struct cpu_info *info = get_cpu_info(), *bsp_info;
@@ -1039,10 +1045,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     bi = multiboot_fill_boot_info(mbi_p);
 
     /* Parse the command-line options. */
-    if ( mbi->flags & MBI_CMDLINE )
-        cmdline = cmdline_cook(__va(mbi->cmdline), bi->loader);
-
-    if ( (kextra = strstr(cmdline, " -- ")) != NULL )
+    if ( (kextra = strstr(bi->cmdline, " -- ")) != NULL )
     {
         /*
          * Options after ' -- ' separator belong to dom0.
@@ -1053,7 +1056,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
         kextra += 3;
         while ( kextra[1] == ' ' ) kextra++;
     }
-    cmdline_parse(cmdline);
+    cmdline_parse(bi->cmdline);
 
     /* Must be after command line argument parsing and before
      * allocing any xenheap structures wanted in lower memory. */
@@ -1083,7 +1086,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
 
     printk("Bootloader: %s\n", bi->loader);
 
-    printk("Command line: %s\n", cmdline);
+    printk("Command line: %s\n", bi->cmdline);
 
     printk("Xen image load base address: %#lx\n", xen_phys_start);
     if ( hypervisor_name )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 17 22:55:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 17 Oct 2024 22:55:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.821395.1235186 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t1ZP5-0005bG-7P; Thu, 17 Oct 2024 22:55:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 821395.1235186; Thu, 17 Oct 2024 22: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 1t1ZP5-0005b8-4c; Thu, 17 Oct 2024 22:55:35 +0000
Received: by outflank-mailman (input) for mailman id 821395;
 Thu, 17 Oct 2024 22: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 1t1ZP4-0005ay-GG
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 22: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 1t1ZP4-0005i3-FW
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 22:55:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t1ZP4-0005WZ-Eh
 for xen-changelog@lists.xenproject.org; Thu, 17 Oct 2024 22: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=xp3l4DZ5Ix2HfEyZfp6smmCC+v0sLLc6HdYNathuHmk=; b=mD7Jy7DDdxUFvclAg1Z01AmGU5
	BDB1HowWWvQ8bjZlDPvI6p6cAhCeVM45kcaf/358JIChAKfioc4GKJLey/QnTlnb1uNFMeWzluzIX
	DlN3iGCckeDxKLHLJkh9zQQkW2sBjI8a2QBB8WbMhZM44OPpxG2c9KkUNr3j+SyokAMI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: move mmap info to boot info
Message-Id: <E1t1ZP4-0005WZ-Eh@xenbits.xenproject.org>
Date: Thu, 17 Oct 2024 22:55:34 +0000

commit a285d2ac2e524c808091062c67142cf5924b56f6
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Thu Oct 17 13:02:44 2024 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 17 23:42:51 2024 +0100

    x86/boot: move mmap info to boot info
    
    Transition the memory map info to be held in struct boot_info.
    
    No functional change intended.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/bootinfo.h |  5 +++++
 xen/arch/x86/setup.c                | 12 +++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm/bootinfo.h
index c980f0bdb7..e7821e0603 100644
--- a/xen/arch/x86/include/asm/bootinfo.h
+++ b/xen/arch/x86/include/asm/bootinfo.h
@@ -8,6 +8,8 @@
 #ifndef X86_BOOTINFO_H
 #define X86_BOOTINFO_H
 
+#include <xen/types.h>
+
 /*
  * Xen internal representation of information provided by the
  * bootloader/environment, or derived from the information.
@@ -16,6 +18,9 @@ struct boot_info {
     const char *loader;
     const char *cmdline;
 
+    paddr_t memmap_addr;
+    size_t memmap_length;
+
     unsigned int nr_modules;
 };
 
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 01e35b9659..163f5620da 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -297,6 +297,12 @@ static struct boot_info *__init multiboot_fill_boot_info(unsigned long mbi_p)
     if ( mbi->flags & MBI_CMDLINE )
         bi->cmdline = cmdline_cook(__va(mbi->cmdline), bi->loader);
 
+    if ( mbi->flags & MBI_MEMMAP )
+    {
+        bi->memmap_addr   = mbi->mmap_addr;
+        bi->memmap_length = mbi->mmap_length;
+    }
+
     return bi;
 }
 
@@ -1187,13 +1193,13 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     {
         memmap_type = "Xen-e820";
     }
-    else if ( mbi->flags & MBI_MEMMAP )
+    else if ( bi->memmap_length )
     {
         memmap_type = "Multiboot-e820";
-        while ( bytes < mbi->mmap_length &&
+        while ( bytes < bi->memmap_length &&
                 e820_raw.nr_map < ARRAY_SIZE(e820_raw.map) )
         {
-            memory_map_t *map = __va(mbi->mmap_addr + bytes);
+            memory_map_t *map = __va(bi->memmap_addr + bytes);
 
             /*
              * This is a gross workaround for a BIOS bug. Some bootloaders do
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Oct 18 10:22:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 18 Oct 2024 10:22:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.821732.1235655 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t1k7R-0006lw-3w; Fri, 18 Oct 2024 10:22:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 821732.1235655; Fri, 18 Oct 2024 10: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 1t1k7R-0006ln-16; Fri, 18 Oct 2024 10:22:05 +0000
Received: by outflank-mailman (input) for mailman id 821732;
 Fri, 18 Oct 2024 10: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 1t1k7P-0006lh-Se
 for xen-changelog@lists.xenproject.org; Fri, 18 Oct 2024 10: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 1t1k7P-0001co-PO
 for xen-changelog@lists.xenproject.org; Fri, 18 Oct 2024 10:22:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t1k7P-0001p0-Nr
 for xen-changelog@lists.xenproject.org; Fri, 18 Oct 2024 10: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=2rbJMC2Ipuft0cmj7vD0Q4IhCCavPqhx2cI8ZEzsDg4=; b=CuJXpNvehgYV6FpiJRqFJySjLC
	OUOQ1DxppZrS/KYp/+McYlShVJAlg0VmmL4Ot1txH+hAsBPwBDBncmFlukv9yN7bmXo1+cufo6HGT
	A491PceVJBHoAY3VeQy4q4NDrJClXxj+4FhuHqOah2LQks1UuEDOlJzwHewMSZ4L/Wyg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: split bootstrap_map_addr() out of bootstrap_map()
Message-Id: <E1t1k7P-0001p0-Nr@xenbits.xenproject.org>
Date: Fri, 18 Oct 2024 10:22:03 +0000

commit 572010c552b210f07e633473bd0c1129af4d0b50
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Oct 17 13:02:56 2024 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 18 01:32:32 2024 +0100

    x86/boot: split bootstrap_map_addr() out of bootstrap_map()
    
    Using an interface based on addresses directly, not modules.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 xen/arch/x86/setup.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 163f5620da..6746ed8cce 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -425,24 +425,22 @@ static void __init normalise_cpu_order(void)
  * Ensure a given physical memory range is present in the bootstrap mappings.
  * Use superpage mappings to ensure that pagetable memory needn't be allocated.
  */
-void *__init bootstrap_map(const module_t *mod)
+static void *__init bootstrap_map_addr(paddr_t start, paddr_t end)
 {
     static unsigned long __initdata map_cur = BOOTSTRAP_MAP_BASE;
-    uint64_t start, end, mask = (1L << L2_PAGETABLE_SHIFT) - 1;
+    uint64_t mask = (1L << L2_PAGETABLE_SHIFT) - 1;
     void *ret;
 
     if ( system_state != SYS_STATE_early_boot )
-        return mod ? mfn_to_virt(mod->mod_start) : NULL;
+        return end ? maddr_to_virt(start) : NULL;
 
-    if ( !mod )
+    if ( !end )
     {
         destroy_xen_mappings(BOOTSTRAP_MAP_BASE, BOOTSTRAP_MAP_LIMIT);
         map_cur = BOOTSTRAP_MAP_BASE;
         return NULL;
     }
 
-    start = (uint64_t)mod->mod_start << PAGE_SHIFT;
-    end = start + mod->mod_end;
     if ( start >= end )
         return NULL;
 
@@ -458,6 +456,15 @@ void *__init bootstrap_map(const module_t *mod)
     return ret;
 }
 
+void *__init bootstrap_map(const module_t *mod)
+{
+    if ( !mod )
+        return bootstrap_map_addr(0, 0);
+
+    return bootstrap_map_addr(pfn_to_paddr(mod->mod_start),
+                              pfn_to_paddr(mod->mod_start) + mod->mod_end);
+}
+
 static void __init move_memory(
     uint64_t dst, uint64_t src, unsigned int size)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Oct 18 10:22:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 18 Oct 2024 10:22:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.821733.1235658 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t1k7b-0006nW-4w; Fri, 18 Oct 2024 10:22:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 821733.1235658; Fri, 18 Oct 2024 10: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 1t1k7b-0006nP-2V; Fri, 18 Oct 2024 10:22:15 +0000
Received: by outflank-mailman (input) for mailman id 821733;
 Fri, 18 Oct 2024 10: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 1t1k7Z-0006nH-UK
 for xen-changelog@lists.xenproject.org; Fri, 18 Oct 2024 10: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 1t1k7Z-0001cu-TV
 for xen-changelog@lists.xenproject.org; Fri, 18 Oct 2024 10:22:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t1k7Z-0001pz-RQ
 for xen-changelog@lists.xenproject.org; Fri, 18 Oct 2024 10: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=tmjk6q65iwsNahreJkDKDqIQMTWDq/XU4YBBpe8cUlg=; b=hmOqkfHFDPV28Ec7vj9xDcWAvW
	9BTdmyjOZ9AVCm/MGpIQeD/JOKSDwL7AYeSxyCZ7McrOGWEe7WyLHUmC2pzKr72LlgnZFoyTSsSoJ
	2HdFFMnY+G9aEPbuH65rF8mrFLrr0nT+Pb4PuGpAxF0ziugakNvSnx8SX9FmuAK/IToo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: Fix URL to the gitlab container registry documentation
Message-Id: <E1t1k7Z-0001pz-RQ@xenbits.xenproject.org>
Date: Fri, 18 Oct 2024 10:22:13 +0000

commit 0bcf66d05a3d425e22b995020ca31bdbcaf48823
Author:     Javi Merino <javi.merino@cloud.com>
AuthorDate: Thu Oct 17 17:20:19 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 18 10:56:41 2024 +0100

    automation: Fix URL to the gitlab container registry documentation
    
    The gitlab documentation is now at
    https://docs.gitlab.com/ee/administration/packages/container_registry.html
    
    Signed-off-by: Javi Merino <javi.merino@cloud.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/automation/build/README.md b/automation/build/README.md
index bd0c0e0418..ecc898680c 100644
--- a/automation/build/README.md
+++ b/automation/build/README.md
@@ -110,7 +110,7 @@ make -C automation/build opensuse/tumbleweed-x86_64 PUSH=1
 
 [BuildKit]: https://docs.docker.com/build/buildkit/
 [registry]: https://gitlab.com/xen-project/xen/container_registry
-[registry help]: https://gitlab.com/help/user/project/container_registry
+[registry help]: https://docs.gitlab.com/ee/user/packages/container_registry/
 
 
 Building/Running container for a different architecture
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Oct 18 10:22:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 18 Oct 2024 10:22:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.821734.1235662 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t1k7l-0006q4-6R; Fri, 18 Oct 2024 10:22:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 821734.1235662; Fri, 18 Oct 2024 10: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 1t1k7l-0006pw-3v; Fri, 18 Oct 2024 10:22:25 +0000
Received: by outflank-mailman (input) for mailman id 821734;
 Fri, 18 Oct 2024 10:22: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 1t1k7k-0006ph-1c
 for xen-changelog@lists.xenproject.org; Fri, 18 Oct 2024 10:22: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 1t1k7k-0001d9-0o
 for xen-changelog@lists.xenproject.org; Fri, 18 Oct 2024 10:22:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t1k7j-0001qf-VZ
 for xen-changelog@lists.xenproject.org; Fri, 18 Oct 2024 10: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=/PGcEuKxKxdc/f4Pahh67iUcG3GSPxND9OPRekSXQYY=; b=epgwz7UnwkN0cSwK9qKjyVdXEP
	Of0hF4UV3+PJ2CaISb+l1cJJNghbk8V//cw4LxV0ejMf4i/75IJV3YOVcVIxT/I+98JLs05n1A1+Q
	9tB1oT4hHczIyb3Bk9GdkZCSFOQXFfEKOo7KrdE+xE2GExOs2ydmhCEUy45T8dVvo/kU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] ocaml/libs: Fill build failure due to unused variable in ocaml macro
Message-Id: <E1t1k7j-0001qf-VZ@xenbits.xenproject.org>
Date: Fri, 18 Oct 2024 10:22:23 +0000

commit d84f6870fe18565c93937224fc0e1a2b69aa529a
Author:     Javi Merino <javi.merino@cloud.com>
AuthorDate: Thu Oct 17 17:20:20 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 18 10:56:41 2024 +0100

    ocaml/libs: Fill build failure due to unused variable in ocaml macro
    
    On Fedora 40, the build fails with:
    
        In file included from domain_getinfo_stubs_v1.c:10:
        domain_getinfo_stubs_v1.c: In function 'xsd_glue_failwith':
        /usr/lib64/ocaml/caml/memory.h:275:29: error: unused variable 'caml__frame' [-Werror=unused-variable]
          275 |   struct caml__roots_block *caml__frame = *caml_local_roots_ptr
              |                             ^~~~~~~~~~~
        domain_getinfo_stubs_v1.c:48:9: note: in expansion of macro 'CAMLparam0'
          48 |         CAMLparam0();
             |         ^~~~~~~~~~
        cc1: all warnings being treated as errors
    
    The CAMLparam0 macro is defined in /usr/lib64/ocaml/caml/memory.h:255 as:
    
        #define CAMLparam0()                                                    \
          struct caml__roots_block** caml_local_roots_ptr =                     \
            (DO_CHECK_CAML_STATE ? Caml_check_caml_state() : (void)0,           \
             &CAML_LOCAL_ROOTS);                                                \
          struct caml__roots_block *caml__frame = *caml_local_roots_ptr
    
    We can't modify the macro.  But, it turns out there's a CAMLnoreturn macro
    with the sole purpose of masking this warning.
    
    Fixes: a6576011a4d2 ("ocaml/libs: Implement a dynamically-loaded plugin for Xenctrl.domain_getinfo")
    Signed-off-by: Javi Merino <javi.merino@cloud.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
---
 .../libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_stubs_v1.c     | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_stubs_v1.c b/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_stubs_v1.c
index 7be386f4d4..963cec8883 100644
--- a/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_stubs_v1.c
+++ b/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_stubs_v1.c
@@ -69,6 +69,7 @@ static void Noreturn xsd_glue_failwith(
 	free(str);
 
 	caml_raise_with_arg(*caml_named_value("xsg.error_v1"), msg);
+	CAMLnoreturn;
 }
 #define xsd_glue_failwith(xch) xsd_glue_failwith(xch, __func__, __LINE__)
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Oct 18 10:22:36 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 18 Oct 2024 10:22:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.821735.1235667 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t1k7w-0006tP-80; Fri, 18 Oct 2024 10:22:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 821735.1235667; Fri, 18 Oct 2024 10:22: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 1t1k7w-0006tH-5I; Fri, 18 Oct 2024 10:22:36 +0000
Received: by outflank-mailman (input) for mailman id 821735;
 Fri, 18 Oct 2024 10:22: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 1t1k7u-0006t3-68
 for xen-changelog@lists.xenproject.org; Fri, 18 Oct 2024 10:22: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 1t1k7u-0001dH-5T
 for xen-changelog@lists.xenproject.org; Fri, 18 Oct 2024 10:22:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t1k7u-0001rX-2r
 for xen-changelog@lists.xenproject.org; Fri, 18 Oct 2024 10:22: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=Clz5nzqUzPz3mN5+Ot87Nleob2u/jleNJgDOxvHdbcE=; b=in8ZkehRLDkCMdwHql0UFc7Oq/
	K3elCTzZ9qrr4yUxPZc8DXgajwGRBNOirGCoTDO5XeNLeqzCHwlwwFkUEEgaEuiWS12SDxTV9QjCE
	T6p306Go02YDWJREz4/oLsQynjHJ8PA00kdhZNSgLpU7/dH00dQYJ+7odLU8WvrEMayw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CI: Refresh and upgrade the Fedora container
Message-Id: <E1t1k7u-0001rX-2r@xenbits.xenproject.org>
Date: Fri, 18 Oct 2024 10:22:34 +0000

commit 6e085825cb073255cc9d5db32b496284b89290d3
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Oct 17 17:20:21 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 18 10:56:41 2024 +0100

    CI: Refresh and upgrade the Fedora container
    
    Fedora 29 is long out of date.  Move forward 5 years to Fedora 40.
    
    Include all the usual improvements.  Rework the container to be non-root, use
    heredocs for legibility, and switch to the new naming scheme.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Javi Merino <javi.merino@cloud.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/fedora/29.dockerfile        | 46 -----------------
 automation/build/fedora/40-x86_64.dockerfile | 77 ++++++++++++++++++++++++++++
 automation/gitlab-ci/build.yaml              |  8 +--
 automation/scripts/containerize              |  2 +-
 4 files changed, 82 insertions(+), 51 deletions(-)

diff --git a/automation/build/fedora/29.dockerfile b/automation/build/fedora/29.dockerfile
deleted file mode 100644
index d5f017ac72..0000000000
--- a/automation/build/fedora/29.dockerfile
+++ /dev/null
@@ -1,46 +0,0 @@
-# syntax=docker/dockerfile:1
-FROM --platform=linux/amd64 fedora:29
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="xen-devel@lists.xenproject.org"
-
-# install Xen depends
-RUN dnf -y install \
-        clang \
-        gcc \
-        gcc-c++ \
-        ncurses-devel \
-        zlib-devel \
-        python-devel \
-        python3-devel \
-        libuuid-devel \
-        pkgconfig \
-        flex \
-        bison \
-        libaio-devel \
-        glib2-devel \
-        yajl-devel \
-        pixman-devel \
-        glibc-devel \
-        make \
-        binutils \
-        git \
-        wget \
-        acpica-tools \
-        python-markdown \
-        patch \
-        checkpolicy \
-        dev86 \
-        xz-devel \
-        bzip2 \
-        nasm \
-        ocaml \
-        ocaml-findlib \
-        golang \
-        # QEMU
-        ninja-build \
-    && dnf clean all && \
-    rm -rf /var/cache/dnf
-
-RUN useradd --create-home user
-USER user
-WORKDIR /build
diff --git a/automation/build/fedora/40-x86_64.dockerfile b/automation/build/fedora/40-x86_64.dockerfile
new file mode 100644
index 0000000000..7d4d4cc2ac
--- /dev/null
+++ b/automation/build/fedora/40-x86_64.dockerfile
@@ -0,0 +1,77 @@
+# syntax=docker/dockerfile:1
+FROM --platform=linux/amd64 fedora:40
+LABEL maintainer.name="The Xen Project"
+LABEL maintainer.email="xen-devel@lists.xenproject.org"
+
+RUN <<EOF
+    set -e
+
+    useradd --create-home user
+
+    dnf -y update
+
+    DEPS=(
+        # Xen
+        binutils
+        gcc
+        make
+        python3
+        # Kconfig
+        bison
+        flex
+        # Flask
+        checkpolicy
+
+        # Tools (general)
+        git-core
+        gzip
+        patch
+        perl-interpreter
+        perl-File-Find
+        pkgconfig
+        wget
+        # libxenguest dombuilder
+        bzip2-devel
+        libzstd-devel
+        lzo-devel
+        xz-devel
+        zlib-devel
+        # libacpi
+        acpica-tools
+        # libxl
+        libuuid-devel
+        yajl-devel
+        # xen-foreign
+        diffutils
+        # RomBIOS
+        dev86
+        # Header Check
+        gcc-c++
+        # xentop
+        ncurses-devel
+        # Python bindings
+        python3-devel
+        python3-setuptools
+        # Ocaml bindings/oxenstored
+        ocaml
+        ocaml-findlib
+        # Golang bindings
+        golang
+
+        # Stubdom download/extract
+        bzip2
+
+        # Qemu build
+        glib2-devel
+        pixman-devel
+        ninja-build
+    )
+
+    dnf -y --setopt=install_weak_deps=False install "${DEPS[@]}"
+
+    dnf clean all
+    rm -rf /var/cache/dnf
+EOF
+
+USER user
+WORKDIR /build
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index c2db69ecf8..09dd9e6ccb 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -579,15 +579,15 @@ debian-bookworm-32-gcc-debug:
   variables:
     CONTAINER: debian:bookworm-i386
 
-fedora-gcc:
+fedora-40-x86_64-gcc:
   extends: .gcc-x86-64-build
   variables:
-    CONTAINER: fedora:29
+    CONTAINER: fedora:40-x86_64
 
-fedora-gcc-debug:
+fedora-40-x86_64-gcc-debug:
   extends: .gcc-x86-64-build-debug
   variables:
-    CONTAINER: fedora:29
+    CONTAINER: fedora:40-x86_64
 
 ubuntu-16.04-x86_64-clang:
   extends: .clang-x86-64-build
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index 7607b78f76..6ac02c42d1 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -28,7 +28,7 @@ case "_${CONTAINER}" in
     _alpine-arm64v8) CONTAINER="${BASE}/alpine:3.18-arm64v8" ;;
     _archlinux|_arch) CONTAINER="${BASE}/archlinux:current" ;;
     _centos7) CONTAINER="${BASE}/centos:7" ;;
-    _fedora) CONTAINER="${BASE}/fedora:29";;
+    _fedora) CONTAINER="${BASE}/fedora:40-x86_64";;
     _bullseye-ppc64le) CONTAINER="${BASE}/debian:11-ppc64le" ;;
     _bookworm-ppc64le) CONTAINER="${BASE}/debian:12-ppc64le" ;;
     _bullseye-riscv64) CONTAINER="${BASE}/debian:11-riscv64" ;;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Oct 18 10:44:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 18 Oct 2024 10:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.821748.1235682 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t1kSj-0001Xs-2W; Fri, 18 Oct 2024 10:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 821748.1235682; Fri, 18 Oct 2024 10: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 1t1kSi-0001Xk-Vv; Fri, 18 Oct 2024 10:44:04 +0000
Received: by outflank-mailman (input) for mailman id 821748;
 Fri, 18 Oct 2024 10: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 1t1kSi-0001Xe-JP
 for xen-changelog@lists.xenproject.org; Fri, 18 Oct 2024 10: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 1t1kSi-00020F-Cb
 for xen-changelog@lists.xenproject.org; Fri, 18 Oct 2024 10:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t1kSi-0004Ii-Am
 for xen-changelog@lists.xenproject.org; Fri, 18 Oct 2024 10: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=ZgjgkMzEzry+DsgeGNBPWcZIyk6UD48yMZWchC9ijg4=; b=dz7TO9a4MvPC8ClGp89fcPhg5X
	iwx+n0Nip+C+z4WOkOOb9XYjARw8Uqvt6MLmFOb6ZcmKCZH9oqH1Kt7ME+kJRtNrwC2grSSJl65iF
	mQJTvZT1F7uFOeMVds4oIzg6Nwx8+RJUi1E9gUJHc3/fjHXYxI9G+JmQf3lNhWewNN9A=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Further simplify CR4 handling in dom0_construct_pv()
Message-Id: <E1t1kSi-0004Ii-Am@xenbits.xenproject.org>
Date: Fri, 18 Oct 2024 10:44:04 +0000

commit 4c21b6affb4c5a3afe22cbc144362091de063366
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 30 18:49:53 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 18 11:30:34 2024 +0100

    x86/boot: Further simplify CR4 handling in dom0_construct_pv()
    
    The logic would be more robust disabling SMAP based on its precense in CR4,
    rather than SMAP's accociation with a synthetic feature.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/pv/dom0_build.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 262edb6bf2..ee9ecdc2ab 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -1057,6 +1057,7 @@ int __init dom0_construct_pv(struct domain *d,
                              module_t *initrd,
                              const char *cmdline)
 {
+    unsigned long cr4 = read_cr4();
     int rc;
 
     /*
@@ -1064,19 +1065,19 @@ int __init dom0_construct_pv(struct domain *d,
      * prevents us needing to write construct_dom0() in terms of
      * copy_{to,from}_user().
      */
-    if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
+    if ( cr4 & X86_CR4_SMAP )
     {
         if ( IS_ENABLED(CONFIG_PV32) )
             cr4_pv32_mask &= ~X86_CR4_SMAP;
 
-        write_cr4(read_cr4() & ~X86_CR4_SMAP);
+        write_cr4(cr4 & ~X86_CR4_SMAP);
     }
 
     rc = dom0_construct(d, image, image_headroom, initrd, cmdline);
 
-    if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
+    if ( cr4 & X86_CR4_SMAP )
     {
-        write_cr4(read_cr4() | X86_CR4_SMAP);
+        write_cr4(cr4);
 
         if ( IS_ENABLED(CONFIG_PV32) )
             cr4_pv32_mask |= X86_CR4_SMAP;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Oct 18 22:44:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 18 Oct 2024 22:44:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.822241.1236235 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t1vhV-0004bM-2M; Fri, 18 Oct 2024 22:44:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 822241.1236235; Fri, 18 Oct 2024 22: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 1t1vhU-0004bE-Vm; Fri, 18 Oct 2024 22:44:04 +0000
Received: by outflank-mailman (input) for mailman id 822241;
 Fri, 18 Oct 2024 22: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 1t1vhU-0004b8-70
 for xen-changelog@lists.xenproject.org; Fri, 18 Oct 2024 22: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 1t1vhU-0006nG-6A
 for xen-changelog@lists.xenproject.org; Fri, 18 Oct 2024 22:44:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t1vhU-0000wJ-57
 for xen-changelog@lists.xenproject.org; Fri, 18 Oct 2024 22: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=3RdI4F+MslByzz+0W/1W8FURGAEHTjwibA833/oTDsA=; b=fUmWElhH9q12IJlfbq2uk0Dk82
	d8xWLWHx5ZYFLgew/2PvBEzM9tJ2hObDxhEovrVhHFPC3a8skS6E5VObN9XsLe1k4yz4bCBt56CsX
	EURjCLlrkgUTAqmgVXxv2isISDrZhSKU2fc0eBHxkq5eLQCWDGMFs4eieJyK8JEeLe10=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Update deprecated SPDX license identifiers
Message-Id: <E1t1vhU-0000wJ-57@xenbits.xenproject.org>
Date: Fri, 18 Oct 2024 22:44:04 +0000

commit 0710b38921ec6740d75148b6b400b6aa44314d2d
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Fri Oct 18 14:57:25 2024 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Fri Oct 18 23:34:11 2024 +0100

    Update deprecated SPDX license identifiers
    
    As specified in LICENSES/GPL-2.0:
    - GPL-2.0 -> GPL-2.0-only;
    - GPL-2.0+ -> GPL-2.0-or-later.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com> [RISC-V]
---
 CODING_STYLE                                 | 2 +-
 xen/arch/arm/alternative.c                   | 2 +-
 xen/arch/arm/arm32/mmu/mm.c                  | 2 +-
 xen/arch/arm/arm64/mmu/mm.c                  | 2 +-
 xen/arch/arm/cpuerrata.c                     | 2 +-
 xen/arch/arm/cpufeature.c                    | 2 +-
 xen/arch/arm/dm.c                            | 2 +-
 xen/arch/arm/domain_build.c                  | 2 +-
 xen/arch/arm/domctl.c                        | 2 +-
 xen/arch/arm/early_printk.c                  | 2 +-
 xen/arch/arm/gic-v3-its.c                    | 2 +-
 xen/arch/arm/gic-v3-lpi.c                    | 2 +-
 xen/arch/arm/guest_atomics.c                 | 2 +-
 xen/arch/arm/guest_walk.c                    | 2 +-
 xen/arch/arm/guestcopy.c                     | 2 +-
 xen/arch/arm/hvm.c                           | 2 +-
 xen/arch/arm/include/asm/nospec.h            | 2 +-
 xen/arch/arm/ioreq.c                         | 2 +-
 xen/arch/arm/kernel.c                        | 2 +-
 xen/arch/arm/livepatch.c                     | 2 +-
 xen/arch/arm/mem_access.c                    | 2 +-
 xen/arch/arm/mmu/p2m.c                       | 2 +-
 xen/arch/arm/monitor.c                       | 2 +-
 xen/arch/arm/p2m.c                           | 2 +-
 xen/arch/arm/physdev.c                       | 2 +-
 xen/arch/arm/platform_hypercall.c            | 2 +-
 xen/arch/arm/shutdown.c                      | 2 +-
 xen/arch/arm/smp.c                           | 2 +-
 xen/arch/arm/sysctl.c                        | 2 +-
 xen/arch/arm/vgic-v3-its.c                   | 2 +-
 xen/arch/arm/vm_event.c                      | 2 +-
 xen/arch/arm/vpl011.c                        | 2 +-
 xen/arch/arm/vsmc.c                          | 2 +-
 xen/arch/riscv/early_printk.c                | 2 +-
 xen/arch/riscv/include/asm/acpi.h            | 2 +-
 xen/arch/riscv/include/asm/bitops.h          | 2 +-
 xen/arch/riscv/include/asm/bug.h             | 2 +-
 xen/arch/riscv/include/asm/cache.h           | 2 +-
 xen/arch/riscv/include/asm/string.h          | 2 +-
 xen/arch/x86/cpu/mcheck/intel-nonfatal.c     | 2 +-
 xen/arch/x86/debug.c                         | 2 +-
 xen/arch/x86/hvm/svm/nestedhvm.h             | 2 +-
 xen/arch/x86/hvm/svm/svm.h                   | 2 +-
 xen/arch/x86/include/asm/gdbsx.h             | 2 +-
 xen/arch/x86/include/asm/guest/hyperv-tlfs.h | 2 +-
 xen/arch/x86/include/asm/intel-family.h      | 2 +-
 xen/arch/x86/include/asm/nospec.h            | 2 +-
 xen/arch/x86/include/asm/prot-key.h          | 2 +-
 xen/common/device-tree/bootfdt.c             | 2 +-
 xen/common/sched/boot-cpupool.c              | 2 +-
 xen/include/asm-generic/atomic-ops.h         | 2 +-
 xen/include/asm-generic/monitor.h            | 2 +-
 xen/include/xen/alternative-call.h           | 2 +-
 xen/include/xen/nospec.h                     | 2 +-
 xen/include/xen/unaligned.h                  | 2 +-
 xen/tools/kconfig/expr.h                     | 2 +-
 xen/tools/kconfig/images.h                   | 2 +-
 xen/tools/kconfig/lexer.l                    | 2 +-
 xen/tools/kconfig/list.h                     | 2 +-
 xen/tools/kconfig/lkc.h                      | 2 +-
 xen/tools/kconfig/lkc_proto.h                | 2 +-
 xen/tools/kconfig/lxdialog/checklist.c       | 2 +-
 xen/tools/kconfig/lxdialog/dialog.h          | 2 +-
 xen/tools/kconfig/lxdialog/inputbox.c        | 2 +-
 xen/tools/kconfig/lxdialog/menubox.c         | 2 +-
 xen/tools/kconfig/lxdialog/textbox.c         | 2 +-
 xen/tools/kconfig/lxdialog/util.c            | 2 +-
 xen/tools/kconfig/lxdialog/yesno.c           | 2 +-
 xen/tools/kconfig/nconf.h                    | 2 +-
 xen/tools/kconfig/parser.y                   | 2 +-
 xen/tools/kconfig/qconf.h                    | 2 +-
 71 files changed, 71 insertions(+), 71 deletions(-)

diff --git a/CODING_STYLE b/CODING_STYLE
index 554c69a16a..e3b1da6048 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -20,7 +20,7 @@ SPDX
 New files should start with a single-line SPDX comment to express the
 license, e.g.:
 
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 
 See LICENSES/ for a list of licenses and SPDX tags currently used.
 
diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c
index c56caba010..d99b507093 100644
--- a/xen/arch/arm/alternative.c
+++ b/xen/arch/arm/alternative.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * alternative runtime patching
  * inspired by the x86 version
diff --git a/xen/arch/arm/arm32/mmu/mm.c b/xen/arch/arm/arm32/mmu/mm.c
index 30a7aa1e8e..063611412b 100644
--- a/xen/arch/arm/arm32/mmu/mm.c
+++ b/xen/arch/arm/arm32/mmu/mm.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 
 #include <xen/init.h>
 #include <xen/lib.h>
diff --git a/xen/arch/arm/arm64/mmu/mm.c b/xen/arch/arm/arm64/mmu/mm.c
index 0de4f3c079..671eaadbc1 100644
--- a/xen/arch/arm/arm64/mmu/mm.c
+++ b/xen/arch/arm/arm64/mmu/mm.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 
 #include <xen/init.h>
 #include <xen/mm.h>
diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
index afd0605922..eef9c0ea0e 100644
--- a/xen/arch/arm/cpuerrata.c
+++ b/xen/arch/arm/cpuerrata.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #include <xen/cpu.h>
 #include <xen/cpumask.h>
 #include <xen/init.h>
diff --git a/xen/arch/arm/cpufeature.c b/xen/arch/arm/cpufeature.c
index b45dbe3c66..1a80738571 100644
--- a/xen/arch/arm/cpufeature.c
+++ b/xen/arch/arm/cpufeature.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Contains CPU feature definitions
  *
diff --git a/xen/arch/arm/dm.c b/xen/arch/arm/dm.c
index 5569efa121..773a0a2592 100644
--- a/xen/arch/arm/dm.c
+++ b/xen/arch/arm/dm.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (c) 2019 Arm ltd.
  */
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 669970c86f..2c30792de8 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #include <xen/init.h>
 #include <xen/compile.h>
 #include <xen/lib.h>
diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c
index 12a12ee781..9d047065ba 100644
--- a/xen/arch/arm/domctl.c
+++ b/xen/arch/arm/domctl.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /******************************************************************************
  * Arch-specific domctl.c
  *
diff --git a/xen/arch/arm/early_printk.c b/xen/arch/arm/early_printk.c
index 03cbe0fb88..9c54f77c78 100644
--- a/xen/arch/arm/early_printk.c
+++ b/xen/arch/arm/early_printk.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * printk() for use before the final page tables are setup.
  *
diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
index 55bed3fe87..5fd83af25a 100644
--- a/xen/arch/arm/gic-v3-its.c
+++ b/xen/arch/arm/gic-v3-its.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * xen/arch/arm/gic-v3-its.c
  *
diff --git a/xen/arch/arm/gic-v3-lpi.c b/xen/arch/arm/gic-v3-lpi.c
index eb0a5535e4..de4b0eb4a4 100644
--- a/xen/arch/arm/gic-v3-lpi.c
+++ b/xen/arch/arm/gic-v3-lpi.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * xen/arch/arm/gic-v3-lpi.c
  *
diff --git a/xen/arch/arm/guest_atomics.c b/xen/arch/arm/guest_atomics.c
index 6ba77f082d..678b57d197 100644
--- a/xen/arch/arm/guest_atomics.c
+++ b/xen/arch/arm/guest_atomics.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * arch/arm/guest_atomics.c
  */
diff --git a/xen/arch/arm/guest_walk.c b/xen/arch/arm/guest_walk.c
index 2f7d3a0da7..09fe486598 100644
--- a/xen/arch/arm/guest_walk.c
+++ b/xen/arch/arm/guest_walk.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Guest page table walk
  * Copyright (c) 2017 Sergej Proskurin <proskurin@sec.in.tum.de>
diff --git a/xen/arch/arm/guestcopy.c b/xen/arch/arm/guestcopy.c
index 6716b03561..497e785ec4 100644
--- a/xen/arch/arm/guestcopy.c
+++ b/xen/arch/arm/guestcopy.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #include <xen/domain_page.h>
 #include <xen/guest_access.h>
 #include <xen/lib.h>
diff --git a/xen/arch/arm/hvm.c b/xen/arch/arm/hvm.c
index 0989309fea..86e49bf474 100644
--- a/xen/arch/arm/hvm.c
+++ b/xen/arch/arm/hvm.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * arch/arm/hvm.c
  *
diff --git a/xen/arch/arm/include/asm/nospec.h b/xen/arch/arm/include/asm/nospec.h
index efac51fc03..9c70eed605 100644
--- a/xen/arch/arm/include/asm/nospec.h
+++ b/xen/arch/arm/include/asm/nospec.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
 
 #ifndef _ASM_ARM_NOSPEC_H
diff --git a/xen/arch/arm/ioreq.c b/xen/arch/arm/ioreq.c
index 2e829d2e7f..b4211f0159 100644
--- a/xen/arch/arm/ioreq.c
+++ b/xen/arch/arm/ioreq.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * arm/ioreq.c: hardware virtual machine I/O emulation
  *
diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index 674388fa11..669d143cee 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Kernel image loading.
  *
diff --git a/xen/arch/arm/livepatch.c b/xen/arch/arm/livepatch.c
index bbca1e5a5e..037746d952 100644
--- a/xen/arch/arm/livepatch.c
+++ b/xen/arch/arm/livepatch.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  *  Copyright (C) 2016 Citrix Systems R&D Ltd.
  */
diff --git a/xen/arch/arm/mem_access.c b/xen/arch/arm/mem_access.c
index 31db846354..0ec3462364 100644
--- a/xen/arch/arm/mem_access.c
+++ b/xen/arch/arm/mem_access.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * arch/arm/mem_access.c
  *
diff --git a/xen/arch/arm/mmu/p2m.c b/xen/arch/arm/mmu/p2m.c
index 1725cca649..bfa312cc8a 100644
--- a/xen/arch/arm/mmu/p2m.c
+++ b/xen/arch/arm/mmu/p2m.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #include <xen/cpu.h>
 #include <xen/domain_page.h>
 #include <xen/ioreq.h>
diff --git a/xen/arch/arm/monitor.c b/xen/arch/arm/monitor.c
index 6c93a9e993..49f5df8513 100644
--- a/xen/arch/arm/monitor.c
+++ b/xen/arch/arm/monitor.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * arch/arm/monitor.c
  *
diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 2465c266e9..65b70955e3 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #include <xen/iocap.h>
 #include <xen/lib.h>
 #include <xen/sched.h>
diff --git a/xen/arch/arm/physdev.c b/xen/arch/arm/physdev.c
index 7b1682ee10..d63a8bf5ae 100644
--- a/xen/arch/arm/physdev.c
+++ b/xen/arch/arm/physdev.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /******************************************************************************
  * Arch-specific physdev.c
  *
diff --git a/xen/arch/arm/platform_hypercall.c b/xen/arch/arm/platform_hypercall.c
index fde4bc3e58..ac55622426 100644
--- a/xen/arch/arm/platform_hypercall.c
+++ b/xen/arch/arm/platform_hypercall.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /******************************************************************************
  * platform_hypercall.c
  *
diff --git a/xen/arch/arm/shutdown.c b/xen/arch/arm/shutdown.c
index 205a5e7f8c..c9778e5786 100644
--- a/xen/arch/arm/shutdown.c
+++ b/xen/arch/arm/shutdown.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #include <xen/console.h>
 #include <xen/cpu.h>
 #include <xen/delay.h>
diff --git a/xen/arch/arm/smp.c b/xen/arch/arm/smp.c
index bb65a08fc1..c11bba93ad 100644
--- a/xen/arch/arm/smp.c
+++ b/xen/arch/arm/smp.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #include <xen/mm.h>
 #include <asm/system.h>
 #include <asm/smp.h>
diff --git a/xen/arch/arm/sysctl.c b/xen/arch/arm/sysctl.c
index 5cda0dc674..32cab4feff 100644
--- a/xen/arch/arm/sysctl.c
+++ b/xen/arch/arm/sysctl.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /******************************************************************************
  * Arch-specific sysctl.c
  *
diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c
index 70b5aeb822..c65c1dbf52 100644
--- a/xen/arch/arm/vgic-v3-its.c
+++ b/xen/arch/arm/vgic-v3-its.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * xen/arch/arm/vgic-v3-its.c
  *
diff --git a/xen/arch/arm/vm_event.c b/xen/arch/arm/vm_event.c
index ccfd25bbbc..31812d9da3 100644
--- a/xen/arch/arm/vm_event.c
+++ b/xen/arch/arm/vm_event.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * arch/arm/vm_event.c
  *
diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c
index 7856b4b5f5..1fc3114cce 100644
--- a/xen/arch/arm/vpl011.c
+++ b/xen/arch/arm/vpl011.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * arch/arm/vpl011.c
  *
diff --git a/xen/arch/arm/vsmc.c b/xen/arch/arm/vsmc.c
index 7f2f5eb9ce..f679cced7f 100644
--- a/xen/arch/arm/vsmc.c
+++ b/xen/arch/arm/vsmc.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * xen/arch/arm/vsmc.c
  *
diff --git a/xen/arch/riscv/early_printk.c b/xen/arch/riscv/early_printk.c
index 610c814f54..634141354c 100644
--- a/xen/arch/riscv/early_printk.c
+++ b/xen/arch/riscv/early_printk.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * RISC-V early printk using SBI
  *
diff --git a/xen/arch/riscv/include/asm/acpi.h b/xen/arch/riscv/include/asm/acpi.h
index f0b5e90969..0c553bd6b8 100644
--- a/xen/arch/riscv/include/asm/acpi.h
+++ b/xen/arch/riscv/include/asm/acpi.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 
 #ifndef ASM__RISCV__ACPI_H
 #define ASM__RISCV__ACPI_H
diff --git a/xen/arch/riscv/include/asm/bitops.h b/xen/arch/riscv/include/asm/bitops.h
index 9a6f576187..d22eec1e87 100644
--- a/xen/arch/riscv/include/asm/bitops.h
+++ b/xen/arch/riscv/include/asm/bitops.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /* Copyright (C) 2012 Regents of the University of California */
 
 #ifndef ASM__RISCV__BITOPS_H
diff --git a/xen/arch/riscv/include/asm/bug.h b/xen/arch/riscv/include/asm/bug.h
index fa18dba20e..c395b809c6 100644
--- a/xen/arch/riscv/include/asm/bug.h
+++ b/xen/arch/riscv/include/asm/bug.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (C) 2012 Regents of the University of California
  * Copyright (C) 2021-2023 Vates
diff --git a/xen/arch/riscv/include/asm/cache.h b/xen/arch/riscv/include/asm/cache.h
index 9a9e5162ab..d4cf1ac8e2 100644
--- a/xen/arch/riscv/include/asm/cache.h
+++ b/xen/arch/riscv/include/asm/cache.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 
 #ifndef ASM__RISCV__CACHE_H
 #define ASM__RISCV__CACHE_H
diff --git a/xen/arch/riscv/include/asm/string.h b/xen/arch/riscv/include/asm/string.h
index 75a2048fb1..a20af81f67 100644
--- a/xen/arch/riscv/include/asm/string.h
+++ b/xen/arch/riscv/include/asm/string.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 
 #ifndef ASM__RISCV__STRING_H
 #define ASM__RISCV__STRING_H
diff --git a/xen/arch/x86/cpu/mcheck/intel-nonfatal.c b/xen/arch/x86/cpu/mcheck/intel-nonfatal.c
index 092a828812..607c0f88c9 100644
--- a/xen/arch/x86/cpu/mcheck/intel-nonfatal.c
+++ b/xen/arch/x86/cpu/mcheck/intel-nonfatal.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Non Fatal Machine Check Exception Reporting
  * (C) Copyright 2002 Dave Jones. <davej@codemonkey.org.uk>
diff --git a/xen/arch/x86/debug.c b/xen/arch/x86/debug.c
index b10f1f12b6..e99e663ba5 100644
--- a/xen/arch/x86/debug.c
+++ b/xen/arch/x86/debug.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (C) 2023 XenServer.
  */
diff --git a/xen/arch/x86/hvm/svm/nestedhvm.h b/xen/arch/x86/hvm/svm/nestedhvm.h
index 43245e13de..9bfed5ffd7 100644
--- a/xen/arch/x86/hvm/svm/nestedhvm.h
+++ b/xen/arch/x86/hvm/svm/nestedhvm.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * nestedsvm.h: Nested Virtualization
  *
diff --git a/xen/arch/x86/hvm/svm/svm.h b/xen/arch/x86/hvm/svm/svm.h
index 8dbf37ff49..beeaaab4f7 100644
--- a/xen/arch/x86/hvm/svm/svm.h
+++ b/xen/arch/x86/hvm/svm/svm.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * svm.h: SVM Architecture related definitions
  *
diff --git a/xen/arch/x86/include/asm/gdbsx.h b/xen/arch/x86/include/asm/gdbsx.h
index e906be9ea3..6315a7cfeb 100644
--- a/xen/arch/x86/include/asm/gdbsx.h
+++ b/xen/arch/x86/include/asm/gdbsx.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #ifndef __X86_GDBX_H__
 #define __X86_GDBX_H__
 
diff --git a/xen/arch/x86/include/asm/guest/hyperv-tlfs.h b/xen/arch/x86/include/asm/guest/hyperv-tlfs.h
index a6915ad731..79cfc90dd8 100644
--- a/xen/arch/x86/include/asm/guest/hyperv-tlfs.h
+++ b/xen/arch/x86/include/asm/guest/hyperv-tlfs.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 
 /*
  * This file contains definitions from Hyper-V Hypervisor Top-Level Functional
diff --git a/xen/arch/x86/include/asm/intel-family.h b/xen/arch/x86/include/asm/intel-family.h
index d44dd3f69f..ab20cce124 100644
--- a/xen/arch/x86/include/asm/intel-family.h
+++ b/xen/arch/x86/include/asm/intel-family.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #ifndef _ASM_X86_INTEL_FAMILY_H
 #define _ASM_X86_INTEL_FAMILY_H
 
diff --git a/xen/arch/x86/include/asm/nospec.h b/xen/arch/x86/include/asm/nospec.h
index e058a3bb0e..150e78e884 100644
--- a/xen/arch/x86/include/asm/nospec.h
+++ b/xen/arch/x86/include/asm/nospec.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
 
 #ifndef _ASM_X86_NOSPEC_H
diff --git a/xen/arch/x86/include/asm/prot-key.h b/xen/arch/x86/include/asm/prot-key.h
index 0dcd31b7ea..0cbecc2df4 100644
--- a/xen/arch/x86/include/asm/prot-key.h
+++ b/xen/arch/x86/include/asm/prot-key.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (c) 2021-2022 Citrix Systems Ltd.
  */
diff --git a/xen/common/device-tree/bootfdt.c b/xen/common/device-tree/bootfdt.c
index 911a630e7d..927f59c64b 100644
--- a/xen/common/device-tree/bootfdt.c
+++ b/xen/common/device-tree/bootfdt.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Early Device Tree
  *
diff --git a/xen/common/sched/boot-cpupool.c b/xen/common/sched/boot-cpupool.c
index feeac3b704..641f3495cb 100644
--- a/xen/common/sched/boot-cpupool.c
+++ b/xen/common/sched/boot-cpupool.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * xen/common/boot_cpupools.c
  *
diff --git a/xen/include/asm-generic/atomic-ops.h b/xen/include/asm-generic/atomic-ops.h
index 98dd907942..769583b766 100644
--- a/xen/include/asm-generic/atomic-ops.h
+++ b/xen/include/asm-generic/atomic-ops.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * The header provides default implementations for every xen/atomic.h-provided
  * forward inline declaration that can be synthesized from other atomic
diff --git a/xen/include/asm-generic/monitor.h b/xen/include/asm-generic/monitor.h
index 1ade289099..cad2b6ff24 100644
--- a/xen/include/asm-generic/monitor.h
+++ b/xen/include/asm-generic/monitor.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * include/asm-generic/monitor.h
  *
diff --git a/xen/include/xen/alternative-call.h b/xen/include/xen/alternative-call.h
index 10f7d7637e..62672b7324 100644
--- a/xen/include/xen/alternative-call.h
+++ b/xen/include/xen/alternative-call.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #ifndef XEN_ALTERNATIVE_CALL
 #define XEN_ALTERNATIVE_CALL
 
diff --git a/xen/include/xen/nospec.h b/xen/include/xen/nospec.h
index 828dbd4e0a..c8167a8a24 100644
--- a/xen/include/xen/nospec.h
+++ b/xen/include/xen/nospec.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /* Copyright(c) 2018 Linus Torvalds. All rights reserved. */
 /* Copyright(c) 2018 Alexei Starovoitov. All rights reserved. */
 /* Copyright(c) 2018 Intel Corporation. All rights reserved. */
diff --git a/xen/include/xen/unaligned.h b/xen/include/xen/unaligned.h
index d9bb599e65..8c8b08338b 100644
--- a/xen/include/xen/unaligned.h
+++ b/xen/include/xen/unaligned.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #ifndef __XEN_UNALIGNED_H__
 #define __XEN_UNALIGNED_H__
 
diff --git a/xen/tools/kconfig/expr.h b/xen/tools/kconfig/expr.h
index 017843c9a4..fd08add33f 100644
--- a/xen/tools/kconfig/expr.h
+++ b/xen/tools/kconfig/expr.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
  */
diff --git a/xen/tools/kconfig/images.h b/xen/tools/kconfig/images.h
index d8ff614bd0..565466511d 100644
--- a/xen/tools/kconfig/images.h
+++ b/xen/tools/kconfig/images.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
  */
diff --git a/xen/tools/kconfig/lexer.l b/xen/tools/kconfig/lexer.l
index 4b7339ff4c..1e57543900 100644
--- a/xen/tools/kconfig/lexer.l
+++ b/xen/tools/kconfig/lexer.l
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
  */
diff --git a/xen/tools/kconfig/list.h b/xen/tools/kconfig/list.h
index 45cb237ab7..979cd516d6 100644
--- a/xen/tools/kconfig/list.h
+++ b/xen/tools/kconfig/list.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #ifndef LIST_H
 #define LIST_H
 
diff --git a/xen/tools/kconfig/lkc.h b/xen/tools/kconfig/lkc.h
index 4fb16f3166..18282e7b0b 100644
--- a/xen/tools/kconfig/lkc.h
+++ b/xen/tools/kconfig/lkc.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
  */
diff --git a/xen/tools/kconfig/lkc_proto.h b/xen/tools/kconfig/lkc_proto.h
index f9ab98238a..7598a2ef20 100644
--- a/xen/tools/kconfig/lkc_proto.h
+++ b/xen/tools/kconfig/lkc_proto.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #include <stdarg.h>
 
 /* confdata.c */
diff --git a/xen/tools/kconfig/lxdialog/checklist.c b/xen/tools/kconfig/lxdialog/checklist.c
index fd161cfff1..29960ed000 100644
--- a/xen/tools/kconfig/lxdialog/checklist.c
+++ b/xen/tools/kconfig/lxdialog/checklist.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  checklist.c -- implements the checklist box
  *
diff --git a/xen/tools/kconfig/lxdialog/dialog.h b/xen/tools/kconfig/lxdialog/dialog.h
index 68b565e3c4..3930d93a4a 100644
--- a/xen/tools/kconfig/lxdialog/dialog.h
+++ b/xen/tools/kconfig/lxdialog/dialog.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  *  dialog.h -- common declarations for all dialog modules
  *
diff --git a/xen/tools/kconfig/lxdialog/inputbox.c b/xen/tools/kconfig/lxdialog/inputbox.c
index 1dcfb288ee..b8b6f15779 100644
--- a/xen/tools/kconfig/lxdialog/inputbox.c
+++ b/xen/tools/kconfig/lxdialog/inputbox.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  inputbox.c -- implements the input box
  *
diff --git a/xen/tools/kconfig/lxdialog/menubox.c b/xen/tools/kconfig/lxdialog/menubox.c
index 58c2f8afe5..4287745566 100644
--- a/xen/tools/kconfig/lxdialog/menubox.c
+++ b/xen/tools/kconfig/lxdialog/menubox.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  menubox.c -- implements the menu box
  *
diff --git a/xen/tools/kconfig/lxdialog/textbox.c b/xen/tools/kconfig/lxdialog/textbox.c
index 4e339b1266..b5987735b0 100644
--- a/xen/tools/kconfig/lxdialog/textbox.c
+++ b/xen/tools/kconfig/lxdialog/textbox.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  textbox.c -- implements the text box
  *
diff --git a/xen/tools/kconfig/lxdialog/util.c b/xen/tools/kconfig/lxdialog/util.c
index 1b490d4af0..0de2b05352 100644
--- a/xen/tools/kconfig/lxdialog/util.c
+++ b/xen/tools/kconfig/lxdialog/util.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  util.c
  *
diff --git a/xen/tools/kconfig/lxdialog/yesno.c b/xen/tools/kconfig/lxdialog/yesno.c
index bcaac9b7ba..ff1db42b3d 100644
--- a/xen/tools/kconfig/lxdialog/yesno.c
+++ b/xen/tools/kconfig/lxdialog/yesno.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  yesno.c -- implements the yes/no box
  *
diff --git a/xen/tools/kconfig/nconf.h b/xen/tools/kconfig/nconf.h
index fa5245eb93..eab138b30d 100644
--- a/xen/tools/kconfig/nconf.h
+++ b/xen/tools/kconfig/nconf.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com>
  *
diff --git a/xen/tools/kconfig/parser.y b/xen/tools/kconfig/parser.y
index 822fc89fc8..5bac26bd91 100644
--- a/xen/tools/kconfig/parser.y
+++ b/xen/tools/kconfig/parser.y
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
  */
diff --git a/xen/tools/kconfig/qconf.h b/xen/tools/kconfig/qconf.h
index 45bfe9b2b9..61ecd5bdab 100644
--- a/xen/tools/kconfig/qconf.h
+++ b/xen/tools/kconfig/qconf.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
  */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Fri Oct 18 22:44:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 18 Oct 2024 22:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.822242.1236238 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t1vhf-0004dX-54; Fri, 18 Oct 2024 22:44:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 822242.1236238; Fri, 18 Oct 2024 22: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 1t1vhf-0004dP-2N; Fri, 18 Oct 2024 22:44:15 +0000
Received: by outflank-mailman (input) for mailman id 822242;
 Fri, 18 Oct 2024 22: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 1t1vhe-0004dI-BW
 for xen-changelog@lists.xenproject.org; Fri, 18 Oct 2024 22: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 1t1vhe-0006nh-9f
 for xen-changelog@lists.xenproject.org; Fri, 18 Oct 2024 22:44:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t1vhe-0000xQ-8I
 for xen-changelog@lists.xenproject.org; Fri, 18 Oct 2024 22: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=jCiLwd2PhmsN4LsgRzhF0uCBiVLF/hGDe3Vln131enc=; b=WmOExVl/7TQ80SjLYTKgHOp+oG
	5ygEZf5COwTQAnS55L1AgQkSCi0APYyixanhCD1dXKUmOCxmrPDQOHC1CbC+Ige5Ugm4B0tFaL9SN
	lptyHuBBm7RMg4IqhlugpOBJI0YDK6KFJ7TXx6d234Wtjy32GtOtxYSa+eruhS+4ep3U=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Add NXP LINFlexD UART Driver
Message-Id: <E1t1vhe-0000xQ-8I@xenbits.xenproject.org>
Date: Fri, 18 Oct 2024 22:44:14 +0000

commit 6ba3b1f8285fbca53c8f6eeb587a1364cbe17939
Author:     Andrei Cherechesu <andrei.cherechesu@nxp.com>
AuthorDate: Mon Sep 30 14:47:07 2024 +0300
Commit:     Julien Grall <julien@xen.org>
CommitDate: Fri Oct 18 23:37:33 2024 +0100

    xen/arm: Add NXP LINFlexD UART Driver
    
    The LINFlexD UART is an UART controller available on NXP S32
    processors family targeting automotive (for example: S32G2, S32G3,
    S32R).
    
    S32G3 Reference Manual:
    https://www.nxp.com/webapp/Download?colCode=RMS32G3.
    
    Signed-off-by: Andrei Cherechesu <andrei.cherechesu@nxp.com>
    Signed-off-by: Peter van der Perk <peter.vander.perk@nxp.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/linflex-uart.h |  63 ++++++
 xen/drivers/char/Kconfig                |   8 +
 xen/drivers/char/Makefile               |   1 +
 xen/drivers/char/linflex-uart.c         | 381 ++++++++++++++++++++++++++++++++
 4 files changed, 453 insertions(+)

diff --git a/xen/arch/arm/include/asm/linflex-uart.h b/xen/arch/arm/include/asm/linflex-uart.h
new file mode 100644
index 0000000000..95dcbcb476
--- /dev/null
+++ b/xen/arch/arm/include/asm/linflex-uart.h
@@ -0,0 +1,63 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * xen/arch/arm/include/asm/linflex-uart.h
+ *
+ * Common constant definition between early printk and the UART driver
+ * for NXP LINFlexD UART.
+ *
+ * Andrei Cherechesu <andrei.cherechesu@nxp.com>
+ * Copyright 2018, 2021, 2024 NXP
+ */
+
+#ifndef __ASM_ARM_LINFLEX_UART_H
+#define __ASM_ARM_LINFLEX_UART_H
+
+/* 32-bit register offsets */
+#define LINCR1          (0x0)
+#define LINIER          (0x4)
+#define LINSR           (0x8)
+#define UARTCR          (0x10)
+#define UARTSR          (0x14)
+#define LINFBRR         (0x24)
+#define LINIBRR         (0x28)
+#define BDRL            (0x38)
+#define BDRM            (0x3C)
+#define UARTPTO         (0x50)
+
+#define LINCR1_INIT         BIT(0, U)
+#define LINCR1_MME          BIT(4, U)
+#define LINCR1_BF           BIT(7, U)
+
+#define LINSR_LINS          GENMASK(15, 12)
+#define LINSR_LINS_INIT     BIT(12, U)
+
+#define LINIER_DRIE         BIT(2, U)
+#define LINIER_DTIE         BIT(1, U)
+
+#define UARTCR_UART         BIT(0, U)
+#define UARTCR_WL0          BIT(1, U)
+#define UARTCR_PC0          BIT(3, U)
+#define UARTCR_TXEN         BIT(4, U)
+#define UARTCR_RXEN         BIT(5, U)
+#define UARTCR_PC1          BIT(6, U)
+#define UARTCR_TFBM         BIT(8, U)
+#define UARTCR_RFBM         BIT(9, U)
+#define UARTCR_RDFLRFC      GENMASK(12, 10)
+#define UARTCR_TDFLTFC      GENMASK(15, 13)
+#define UARTCR_ROSE         BIT(23, U)
+#define UARTCR_OSR_SHIFT    (24)
+#define UARTCR_OSR          GENMASK(27, UARTCR_OSR_SHIFT)
+
+#define UARTSR_DTFTFF       BIT(1, U)
+#define UARTSR_DRFRFE       BIT(2, U)
+
+#endif /* __ASM_ARM_LINFLEX_UART_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/drivers/char/Kconfig b/xen/drivers/char/Kconfig
index 3f836ab301..e175d07c02 100644
--- a/xen/drivers/char/Kconfig
+++ b/xen/drivers/char/Kconfig
@@ -13,6 +13,14 @@ config HAS_CADENCE_UART
 	  This selects the Xilinx Zynq Cadence UART. If you have a Xilinx Zynq
 	  based board, say Y.
 
+config HAS_LINFLEX
+	bool "NXP LINFlexD UART driver"
+	default y
+	depends on ARM_64
+	help
+	  This selects the NXP LINFlexD UART. If you have an NXP S32G or S32R
+	  based board, say Y.
+
 config HAS_IMX_LPUART
 	bool "i.MX LPUART driver"
 	default y
diff --git a/xen/drivers/char/Makefile b/xen/drivers/char/Makefile
index e7e374775d..d3b987da1d 100644
--- a/xen/drivers/char/Makefile
+++ b/xen/drivers/char/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_HAS_SCIF) += scif-uart.o
 obj-$(CONFIG_HAS_EHCI) += ehci-dbgp.o
 obj-$(CONFIG_XHCI) += xhci-dbc.o
 obj-$(CONFIG_HAS_IMX_LPUART) += imx-lpuart.o
+obj-$(CONFIG_HAS_LINFLEX) += linflex-uart.o
 obj-$(CONFIG_ARM) += arm-uart.o
 obj-y += serial.o
 obj-$(CONFIG_XEN_GUEST) += xen_pv_console.o
diff --git a/xen/drivers/char/linflex-uart.c b/xen/drivers/char/linflex-uart.c
new file mode 100644
index 0000000000..2fa195cbf6
--- /dev/null
+++ b/xen/drivers/char/linflex-uart.c
@@ -0,0 +1,381 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * xen/drivers/char/linflex-uart.c
+ *
+ * Driver for NXP LINFlexD UART.
+ *
+ * Andrei Cherechesu <andrei.cherechesu@nxp.com>
+ * Copyright 2018, 2021-2022, 2024 NXP
+ */
+
+#include <xen/config.h>
+#include <xen/console.h>
+#include <xen/errno.h>
+#include <xen/init.h>
+#include <xen/irq.h>
+#include <xen/mm.h>
+#include <xen/serial.h>
+#include <asm/device.h>
+#include <asm/io.h>
+#include <asm/linflex-uart.h>
+
+#define LINFLEX_CLK_FREQ        (125000000)
+#define LINFLEX_MAX_BAUDRATE    (2000000)
+#define LINFLEX_BAUDRATE        (115200)
+#define LINFLEX_LDIV_MULTIPLIER (16)
+
+static struct linflex_uart {
+    uint32_t baud, clock_hz;
+    uint32_t irq;
+    char __iomem *regs;
+    struct irqaction irqaction;
+    struct vuart_info vuart;
+} linflex_com;
+
+static uint32_t linflex_uart_readl(const struct linflex_uart *uart,
+                                   uint32_t off)
+{
+    return readl(uart->regs + off);
+}
+
+static void linflex_uart_writel(const struct linflex_uart *uart, uint32_t off,
+                                uint32_t val)
+{
+    writel(val, uart->regs + off);
+}
+
+static void linflex_uart_writeb(const struct linflex_uart *uart, uint32_t off,
+                                uint8_t val)
+{
+    writeb(val, uart->regs + off);
+}
+
+static uint32_t linflex_uart_get_osr(uint32_t uartcr)
+{
+    return (uartcr & UARTCR_OSR) >> UARTCR_OSR_SHIFT;
+}
+
+static bool linflex_uart_tx_fifo_mode(const struct linflex_uart *uart)
+{
+    return !!(linflex_uart_readl(uart, UARTCR) & UARTCR_TFBM);
+}
+
+static bool linflex_uart_rx_fifo_mode(const struct linflex_uart *uart)
+{
+    return !!(linflex_uart_readl(uart, UARTCR) & UARTCR_RFBM);
+}
+
+static uint32_t linflex_uart_ldiv_multiplier(const struct linflex_uart *uart)
+{
+    uint32_t uartcr, mul = LINFLEX_LDIV_MULTIPLIER;
+
+    uartcr = linflex_uart_readl(uart, UARTCR);
+    if ( uartcr & UARTCR_ROSE )
+        mul = linflex_uart_get_osr(uartcr);
+
+    return mul;
+}
+
+static void linflex_uart_flush(struct serial_port *port)
+{
+    const struct linflex_uart *uart = port->uart;
+
+    if ( linflex_uart_tx_fifo_mode(uart) )
+        while ( linflex_uart_readl(uart, UARTCR) & UARTCR_TDFLTFC )
+            cpu_relax();
+
+    if ( linflex_uart_rx_fifo_mode(uart) )
+        while ( linflex_uart_readl(uart, UARTCR) & UARTCR_RDFLRFC )
+            cpu_relax();
+}
+
+static void __init linflex_uart_init_preirq(struct serial_port *port)
+{
+    struct linflex_uart *uart = port->uart;
+    uint32_t ibr, fbr, divisr, dividr, ctrl;
+
+    /* Disable RX/TX before init mode */
+    ctrl = linflex_uart_readl(uart, UARTCR);
+    ctrl &= ~(UARTCR_RXEN | UARTCR_TXEN);
+    linflex_uart_writel(uart, UARTCR, ctrl);
+
+    /*
+     * Smoothen the transition from early_printk by waiting
+     * for all pending characters to transmit
+     */
+    linflex_uart_flush(port);
+
+    /* Init mode */
+    ctrl = LINCR1_INIT;
+    linflex_uart_writel(uart, LINCR1, ctrl);
+
+    /* Waiting for init mode entry */
+    while ( (linflex_uart_readl(uart, LINSR) & LINSR_LINS) != LINSR_LINS_INIT )
+        cpu_relax();
+
+    /* Set Master Mode */
+    ctrl |= LINCR1_MME;
+    linflex_uart_writel(uart, LINCR1, ctrl);
+
+    if ( uart->baud > LINFLEX_MAX_BAUDRATE )
+        uart->baud = LINFLEX_MAX_BAUDRATE;
+
+    /* Provide data bits, parity, stop bit, etc */
+    divisr = uart->clock_hz;
+    dividr = uart->baud * linflex_uart_ldiv_multiplier(uart);
+
+    ibr = divisr / dividr;
+    fbr = ((divisr % dividr) * 16 / dividr) & 0xF;
+
+    linflex_uart_writel(uart, LINIBRR, ibr);
+    linflex_uart_writel(uart, LINFBRR, fbr);
+
+    /* Set preset timeout register value */
+    linflex_uart_writel(uart, UARTPTO, 0xF);
+
+    /* Setting UARTCR[UART] bit is required for writing other bits in UARTCR */
+    linflex_uart_writel(uart, UARTCR, UARTCR_UART);
+
+    /* 8 bit data, no parity, UART mode, Buffer mode */
+    linflex_uart_writel(uart, UARTCR, UARTCR_PC1 | UARTCR_PC0 | UARTCR_WL0 |
+                        UARTCR_UART);
+
+    /* end init mode */
+    ctrl = linflex_uart_readl(uart, LINCR1);
+    ctrl &= ~LINCR1_INIT;
+    linflex_uart_writel(uart, LINCR1, ctrl);
+
+    /* Enable RX/TX after exiting init mode */
+    ctrl = linflex_uart_readl(uart, UARTCR);
+    ctrl |= UARTCR_RXEN | UARTCR_TXEN;
+    linflex_uart_writel(uart, UARTCR, ctrl);
+}
+
+static void linflex_uart_interrupt(int irq, void *data)
+{
+    struct serial_port *port = data;
+    const struct linflex_uart *uart = port->uart;
+    uint32_t sts;
+
+    sts = linflex_uart_readl(uart, UARTSR);
+
+    if ( sts & UARTSR_DRFRFE )
+        serial_rx_interrupt(port);
+
+    if ( sts & UARTSR_DTFTFF )
+        serial_tx_interrupt(port);
+}
+
+static void __init linflex_uart_init_postirq(struct serial_port *port)
+{
+    struct linflex_uart *uart = port->uart;
+    uint32_t temp;
+
+    uart->irqaction.handler = linflex_uart_interrupt;
+    uart->irqaction.name = "linflex_uart";
+    uart->irqaction.dev_id = port;
+
+    if ( setup_irq(uart->irq, 0, &uart->irqaction) != 0 )
+    {
+        printk("linflex-uart: Failed to allocate IRQ %d\n", uart->irq);
+        return;
+    }
+
+    /* Enable interrupts */
+    temp = linflex_uart_readl(uart, LINIER);
+    temp |= (LINIER_DRIE | LINIER_DTIE);
+    linflex_uart_writel(uart, LINIER, temp);
+    printk("linflex-uart: IRQ %d enabled\n", uart->irq);
+}
+
+static int linflex_uart_tx_ready(struct serial_port *port)
+{
+    const struct linflex_uart *uart = port->uart;
+
+    if ( linflex_uart_tx_fifo_mode(uart) )
+        return (linflex_uart_readl(uart, UARTSR) & UARTSR_DTFTFF) == 0 ? 1 : 0;
+
+    /*
+     * Buffer Mode => TX is waited to be ready after sending a char,
+     * so we can assume it is always ready before.
+     */
+    return 1;
+}
+
+static void linflex_uart_putc(struct serial_port *port, char c)
+{
+    const struct linflex_uart *uart = port->uart;
+    uint32_t uartsr;
+
+    if ( c == '\n' )
+        linflex_uart_putc(port, '\r');
+
+    linflex_uart_writeb(uart, BDRL, c);
+
+    /* Buffer Mode */
+    if ( !linflex_uart_tx_fifo_mode(uart) )
+    {
+        while ( (linflex_uart_readl(uart, UARTSR) & UARTSR_DTFTFF) == 0 )
+                cpu_relax();
+
+        uartsr = linflex_uart_readl(uart, UARTSR) | (UARTSR_DTFTFF);
+        linflex_uart_writel(uart, UARTSR, uartsr);
+    }
+}
+
+static int linflex_uart_getc(struct serial_port *port, char *pc)
+{
+    const struct linflex_uart *uart = port->uart;
+    uint32_t ch, uartsr, rx_fifo_mode;
+
+    rx_fifo_mode = linflex_uart_rx_fifo_mode(uart);
+
+    if ( rx_fifo_mode )
+        while ( linflex_uart_readl(uart, UARTSR) & UARTSR_DRFRFE )
+            cpu_relax();
+    else
+        while ( !(linflex_uart_readl(uart, UARTSR) & UARTSR_DRFRFE) )
+            cpu_relax();
+
+    ch = linflex_uart_readl(uart, BDRM);
+    *pc = ch & 0xff;
+
+    if ( !rx_fifo_mode ) {
+        uartsr = linflex_uart_readl(uart, UARTSR) | UARTSR_DRFRFE;
+        linflex_uart_writel(uart, UARTSR, uartsr);
+    }
+
+    return 1;
+}
+
+static int __init linflex_uart_irq(struct serial_port *port)
+{
+    const struct linflex_uart *uart = port->uart;
+
+    return ((uart->irq > 0) ? uart->irq : -1);
+}
+
+static const struct vuart_info *linflex_vuart_info(struct serial_port *port)
+{
+    const struct linflex_uart *uart = port->uart;
+
+    return &uart->vuart;
+}
+
+static void linflex_uart_start_tx(struct serial_port *port)
+{
+    const struct linflex_uart *uart = port->uart;
+    uint32_t temp;
+
+    temp = linflex_uart_readl(uart, LINIER);
+    linflex_uart_writel(uart, LINIER, temp | LINIER_DTIE);
+}
+
+static void linflex_uart_stop_tx(struct serial_port *port)
+{
+    const struct linflex_uart *uart = port->uart;
+    uint32_t temp;
+
+    temp = linflex_uart_readl(uart, LINIER);
+    temp &= ~(LINIER_DTIE);
+    linflex_uart_writel(uart, LINIER, temp);
+}
+
+static struct uart_driver __read_mostly linflex_uart_driver = {
+    .init_preirq = linflex_uart_init_preirq,
+    .init_postirq = linflex_uart_init_postirq,
+    .tx_ready = linflex_uart_tx_ready,
+    .putc = linflex_uart_putc,
+    .flush = linflex_uart_flush,
+    .getc = linflex_uart_getc,
+    .irq = linflex_uart_irq,
+    .start_tx = linflex_uart_start_tx,
+    .stop_tx = linflex_uart_stop_tx,
+    .vuart_info = linflex_vuart_info,
+};
+
+static int __init linflex_uart_init(struct dt_device_node *dev, const void *data)
+{
+    const char *config = data;
+    struct linflex_uart *uart;
+    paddr_t addr, size;
+    uint32_t baud = 0;
+    int res;
+
+    if ( strcmp(config, "") )
+    {
+        baud = simple_strtoul(config, &config, 10);
+        if ( strcmp(config, "") )
+            printk("linflex-uart: Only baud rate is configurable, discarding other options: %s\n",
+                   config);
+    }
+    else
+    {
+        /* Configuration not provided, use a default one */
+        baud = LINFLEX_BAUDRATE;
+        printk("linflex-uart: Baud rate not provided, using %d as default\n",
+               baud);
+    }
+
+    uart = &linflex_com;
+
+    res = dt_device_get_paddr(dev, 0, &addr, &size);
+    if ( res )
+    {
+        printk("linflex-uart: Unable to retrieve the base address of the UART\n");
+        return res;
+    }
+
+    res = platform_get_irq(dev, 0);
+    if ( res < 0 )
+    {
+        printk("linflex-uart: Unable to retrieve the IRQ\n");
+        return -EINVAL;
+    }
+    uart->irq = res;
+
+    uart->regs = ioremap_nocache(addr, size);
+    if ( !uart->regs )
+    {
+        printk("linflex-uart: Unable to map the UART memory\n");
+        return -ENOMEM;
+    }
+
+    uart->baud = baud;
+    uart->clock_hz = LINFLEX_CLK_FREQ;
+
+    uart->vuart.base_addr = addr;
+    uart->vuart.size = size;
+    uart->vuart.data_off = BDRL;
+    uart->vuart.status_off = UARTSR;
+    uart->vuart.status = UARTSR_DTFTFF;
+
+    /* Register with generic serial driver */
+    serial_register_uart(SERHND_DTUART, &linflex_uart_driver, uart);
+
+    dt_device_set_used_by(dev, DOMID_XEN);
+
+    return 0;
+}
+
+static const struct dt_device_match linflex_uart_dt_compat[] __initconst =
+{
+    DT_MATCH_COMPATIBLE("nxp,s32g2-linflexuart"),
+    DT_MATCH_COMPATIBLE("nxp,s32g3-linflexuart"),
+    DT_MATCH_COMPATIBLE("fsl,s32v234-linflexuart"),
+    { /* sentinel */ },
+};
+
+DT_DEVICE_START(linflex_uart, "NXP LINFlexD UART", DEVICE_SERIAL)
+    .dt_match = linflex_uart_dt_compat,
+    .init = linflex_uart_init,
+DT_DEVICE_END
+
+/*
+ * 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 Fri Oct 18 22:44:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Fri, 18 Oct 2024 22:44:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.822243.1236243 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t1vhp-0004fz-6a; Fri, 18 Oct 2024 22:44:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 822243.1236243; Fri, 18 Oct 2024 22: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 1t1vhp-0004fp-3s; Fri, 18 Oct 2024 22:44:25 +0000
Received: by outflank-mailman (input) for mailman id 822243;
 Fri, 18 Oct 2024 22: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 1t1vho-0004fh-Do
 for xen-changelog@lists.xenproject.org; Fri, 18 Oct 2024 22: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 1t1vho-0006ns-D9
 for xen-changelog@lists.xenproject.org; Fri, 18 Oct 2024 22:44:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t1vho-0000zK-Bf
 for xen-changelog@lists.xenproject.org; Fri, 18 Oct 2024 22: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=8KUdyMgF4uucrxBrRKnnvfXsnsjjNvqCE6Q4D3npZiQ=; b=mMN0tLszc/odhIilHLG42K3Vaq
	AUHz7VMZw+E8jVffGciABlyd1PINAf7yRpyd5yPgZLLPl4BvdB10N3lAgoNGjiuiUfijhPMpgEdpI
	d6hYiZ7sW71VtQ1VnlWcgePJU4KqCs6Dc3BmZ6L6h27eNIdIrrIq1/liUZN11riaXt1E=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/arm: Add NXP LINFlexD UART early printk support
Message-Id: <E1t1vho-0000zK-Bf@xenbits.xenproject.org>
Date: Fri, 18 Oct 2024 22:44:24 +0000

commit e9f227685e7204cb2293576ee5b745b828cb3cd7
Author:     Andrei Cherechesu <andrei.cherechesu@nxp.com>
AuthorDate: Mon Sep 30 14:47:08 2024 +0300
Commit:     Julien Grall <julien@xen.org>
CommitDate: Fri Oct 18 23:37:33 2024 +0100

    xen/arm: Add NXP LINFlexD UART early printk support
    
    This adds support for early printk debug via the NXP LINFlexD
    UART controller.
    
    Signed-off-by: Andrei Cherechesu <andrei.cherechesu@nxp.com>
    Signed-off-by: Peter van der Perk <peter.vander.perk@nxp.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/Kconfig.debug           | 12 ++++++++
 xen/arch/arm/arm64/debug-linflex.inc | 58 ++++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+)

diff --git a/xen/arch/arm/Kconfig.debug b/xen/arch/arm/Kconfig.debug
index 2fa0acd2a3..7660e599c0 100644
--- a/xen/arch/arm/Kconfig.debug
+++ b/xen/arch/arm/Kconfig.debug
@@ -44,6 +44,14 @@ choice
 			Say Y here if you wish the early printk to direct their
 			output to a i.MX LPUART.
 
+	config EARLY_UART_CHOICE_LINFLEX
+		select EARLY_UART_LINFLEX
+		depends on ARM_64
+		bool "Early printk via NXP LINFlexD UART"
+		help
+			Say Y here if you wish the early printk to direct their
+			output to an NXP LINFlexD UART.
+
 	config EARLY_UART_CHOICE_MESON
 		select EARLY_UART_MESON
 		depends on ARM_64
@@ -89,6 +97,9 @@ config EARLY_UART_EXYNOS4210
 config EARLY_UART_IMX_LPUART
 	select EARLY_PRINTK
 	bool
+config EARLY_UART_LINFLEX
+	select EARLY_PRINTK
+	bool
 config EARLY_UART_MESON
 	select EARLY_PRINTK
 	bool
@@ -167,6 +178,7 @@ config EARLY_PRINTK_INC
 	default "debug-cadence.inc" if EARLY_UART_CADENCE
 	default "debug-exynos4210.inc" if EARLY_UART_EXYNOS4210
 	default "debug-imx-lpuart.inc" if EARLY_UART_IMX_LPUART
+	default "debug-linflex.inc" if EARLY_UART_LINFLEX
 	default "debug-meson.inc" if EARLY_UART_MESON
 	default "debug-mvebu.inc" if EARLY_UART_MVEBU
 	default "debug-pl011.inc" if EARLY_UART_PL011
diff --git a/xen/arch/arm/arm64/debug-linflex.inc b/xen/arch/arm/arm64/debug-linflex.inc
new file mode 100644
index 0000000000..cf4f5ce224
--- /dev/null
+++ b/xen/arch/arm/arm64/debug-linflex.inc
@@ -0,0 +1,58 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * xen/arch/arm/arm64/debug-linflex.inc
+ *
+ * NXP LINFlexD UART specific debug code
+ *
+ * Andrei Cherechesu <andrei.cherechesu@nxp.com>
+ * Copyright 2018, 2021, 2023-2024 NXP
+ */
+
+#include <asm/asm_defns.h>
+#include <asm/linflex-uart.h>
+
+/*
+ * wait LINFlexD UART to be ready to transmit
+ * xb: register which contains the UART base address
+ * c: scratch register number
+ */
+.macro early_uart_ready xb, c
+    ldr   w\c, [\xb, #UARTCR]       /* <= Control Register */
+    and   w\c, w\c, #UARTCR_TFBM    /* Check Buffer/FIFO (0/1) Mode */
+    cbz   w\c, 2f                   /* Buffer Mode => return */
+1:
+    ldrb  w\c, [\xb, #UARTSR]       /* <= Status Register */
+    tst   w\c, #UARTSR_DTFTFF       /* FIFO Mode => Check DTF bit */
+    b.ne  1b
+2:
+.endm
+
+/*
+ * LINFlexD UART transmit character
+ * xb: register which contains the UART base address
+ * wt: register which contains the character to transmit
+ */
+.macro early_uart_transmit xb, wt
+    strb  \wt, [\xb, #BDRL]
+
+    ldr   \wt, [\xb, #UARTCR]       /* <= Control Register */
+    and   \wt, \wt, #UARTCR_TFBM    /* Check Buffer/FIFO (0/1) Mode */
+    cbnz  \wt, 2f                   /* FIFO Mode => goto exit */
+
+3:  /* Buffer Mode */
+    ldrb  \wt, [\xb, #UARTSR]       /* <= Status Register */
+    and   \wt, \wt, #UARTSR_DTFTFF  /* Check Transmission Completed */
+    cbz   \wt, 3b
+
+    ldr   \wt, [\xb, #UARTSR]       /* <= Status Register */
+    orr   \wt, \wt, #UARTSR_DTFTFF  /* Clear DTF bit */
+    str   \wt, [\xb, #UARTSR]
+2:
+.endm
+
+/*
+ * Local variables:
+ * mode: ASM
+ * indent-tabs-mode: nil
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sat Oct 19 18:33:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sat, 19 Oct 2024 18:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.822660.1236612 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2EG9-0008Ur-6O; Sat, 19 Oct 2024 18:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 822660.1236612; Sat, 19 Oct 2024 18: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 1t2EG9-0008Uj-3l; Sat, 19 Oct 2024 18:33:05 +0000
Received: by outflank-mailman (input) for mailman id 822660;
 Sat, 19 Oct 2024 18:33: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 1t2EG7-0008Ud-Ti
 for xen-changelog@lists.xenproject.org; Sat, 19 Oct 2024 18:33: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 1t2EG7-00047S-RE
 for xen-changelog@lists.xenproject.org; Sat, 19 Oct 2024 18:33:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t2EG7-0006Tl-NW
 for xen-changelog@lists.xenproject.org; Sat, 19 Oct 2024 18: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=SrX8AxukPiUaII2YiAjYQVzn4PiO2kaPvi7qeuhKI+A=; b=hz0iH3gIwmoM4RogKPENjZ2I+b
	O0oaoSGFmpjOAN2A4qAjE97aHM1ExYzhcaoBQ+ITl+NGzoHBqPZDSRTMnAdIVQDo1FFpw7nk5IM0B
	XhvSCHMsT5r3l4XMYNt15F0Kr5L2q6B/vEGF0WNMmW7Q3AMyV2xnc0b40rxBRhOoDsbw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Fix PVH boot following the start of the MBI->BI conversion
Message-Id: <E1t2EG7-0006Tl-NW@xenbits.xenproject.org>
Date: Sat, 19 Oct 2024 18:33:03 +0000

commit 73785a4c7727cd7a888c7d16ca6a77c3ed0161d7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sat Oct 19 19:15:04 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Sat Oct 19 19:25:36 2024 +0100

    x86/boot: Fix PVH boot following the start of the MBI->BI conversion
    
    pvh_init() sets up the mbi pointer, but leaves mbi_p at 0.  This isn't
    compatbile with multiboot_fill_boot_info() starting from the physical address,
    in order to remove the use of the mbi pointer.
    
    Fixes: 038826b61e85 ("x86/boot: move x86 boot module counting into a new boot_info struct")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/setup.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 6746ed8cce..bfede5064e 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1048,6 +1048,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     {
         ASSERT(mbi_p == 0);
         pvh_init(&mbi, &mod);
+        mbi_p = __pa(mbi);
     }
     else
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Sun Oct 20 06:11:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 20 Oct 2024 06:11:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.822725.1236656 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2P9b-0003aw-JD; Sun, 20 Oct 2024 06:11:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 822725.1236656; Sun, 20 Oct 2024 06: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 1t2P9b-0003ap-Gi; Sun, 20 Oct 2024 06:11:03 +0000
Received: by outflank-mailman (input) for mailman id 822725;
 Sun, 20 Oct 2024 06: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 1t2P9a-0003aj-AZ
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06: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 1t2P9a-0007vV-7c
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t2P9a-0002Zk-4k
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06: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=3BX22byuJyjw8Hinuk3wefpqXhdDsYIny3PJMUTHfBc=; b=WkAsjhJPQTiEYl7iCd7i9rcziE
	BgYxXDS+u/AkTuXk+ekSEluD9mpFNKca61YfqefF8JT7lHlKEbnWlaWUa2qUAV7ehfg+9hsgJVxVI
	BCkyX9fbFunxznYiilzKzaGYgNpsvW8kfwq25yLgwwrUToHGAROfbc2IWgC3mqRCSakg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] docs: update documentation of reboot param
Message-Id: <E1t2P9a-0002Zk-4k@xenbits.xenproject.org>
Date: Sun, 20 Oct 2024 06:11:02 +0000

commit 330d4e62508defa708b55f1b612f42b6a2e2842b
Author:     Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu Oct 17 14:13:50 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 17 14:13:50 2024 +0200

    docs: update documentation of reboot param
    
    Reflect changed default mode, and fix formatting of `efi` value.
    
    Fixes: d81dd3130351 ("x86/shutdown: change default reboot method preference")
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 docs/misc/xen-command-line.pandoc | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line.pandoc
index 5ce63044ad..293dbc1a95 100644
--- a/docs/misc/xen-command-line.pandoc
+++ b/docs/misc/xen-command-line.pandoc
@@ -2139,7 +2139,7 @@ callbacks are safe to be executed. Expressed in milliseconds; maximum is
 ### reboot (x86)
 > `= t[riple] | k[bd] | a[cpi] | p[ci] | P[ower] | e[fi] | n[o] [, [w]arm | [c]old]`
 
-> Default: `0`
+> Default: system dependent
 
 Specify the host reboot method.
 
@@ -2153,14 +2153,14 @@ Specify the host reboot method.
 
 `kbd` instructs Xen to reboot the host via the keyboard controller.
 
-`acpi` instructs Xen to reboot the host using RESET_REG in the ACPI FADT.
+`acpi` instructs Xen to reboot the host using RESET_REG in the ACPI FADT (this
+is default mode if available).
 
 `pci` instructs Xen to reboot the host using PCI reset register (port CF9).
 
 `Power` instructs Xen to power-cycle the host using PCI reset register (port CF9).
 
-'efi' instructs Xen to reboot using the EFI reboot call (in EFI mode by
- default it will use that method first).
+`efi` instructs Xen to reboot using the EFI reboot call.
 
 `xen` instructs Xen to reboot using Xen's SCHEDOP hypercall (this is the default
 when running nested Xen)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Oct 20 06:11:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 20 Oct 2024 06:11:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.822726.1236662 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2P9l-0003cn-L8; Sun, 20 Oct 2024 06:11:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 822726.1236662; Sun, 20 Oct 2024 06: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 1t2P9l-0003cf-IL; Sun, 20 Oct 2024 06:11:13 +0000
Received: by outflank-mailman (input) for mailman id 822726;
 Sun, 20 Oct 2024 06: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 1t2P9k-0003cV-EL
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06: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 1t2P9k-0007va-DZ
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t2P9k-0002aR-9t
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06: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=XCFxkIkFFEAeSK+sUiGm0HZp0xpo6TI6d2TW8/3Ufqc=; b=IAzSrpWRvwo9qFGKXzJZ+a0Pbd
	r2TxTyim4qn/vmXAAgKbP89wbqyssXeyHtNkWTqBP4BGYA6qut9WagMVoTNdqeE4SbhWLof0XYYkw
	Xlyd6TWviw4GYnC2177fG4557nj8f6pucNQRlUupyfg4Lk/ssPSLzQ0nGZxtOPQpGxY0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul/test: correct loop body indentation in evex-disp8.c:test_one()
Message-Id: <E1t2P9k-0002aR-9t@xenbits.xenproject.org>
Date: Sun, 20 Oct 2024 06:11:12 +0000

commit 09d22fe15cb11254d06413d15fd578093d7fe062
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Oct 17 14:14:31 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 17 14:14:31 2024 +0200

    x86emul/test: correct loop body indentation in evex-disp8.c:test_one()
    
    For some reason I entirely consistently screwed these up.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
---
 tools/tests/x86_emulator/evex-disp8.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/tools/tests/x86_emulator/evex-disp8.c b/tools/tests/x86_emulator/evex-disp8.c
index 902e157bd4..0e9351fcfd 100644
--- a/tools/tests/x86_emulator/evex-disp8.c
+++ b/tools/tests/x86_emulator/evex-disp8.c
@@ -905,8 +905,8 @@ static void test_one(const struct test *test, enum vl vl,
         goto fail;
 
     for ( i = 0; i < (test->scale == SC_vl ? vsz : esz); ++i )
-         if ( accessed[i] )
-             goto fail;
+        if ( accessed[i] )
+            goto fail;
 
     n = test->scale == SC_vl ? vsz : esz;
     if ( !sg )
@@ -917,13 +917,13 @@ static void test_one(const struct test *test, enum vl vl,
         ++n;
 
     for ( ; i < n; ++i )
-         if ( accessed[i] != (sg ? (vsz / esz) >> (test->opc & 1 & !evex.w)
-                                 : 1) )
-             goto fail;
+        if ( accessed[i] != (sg ? (vsz / esz) >> (test->opc & 1 & !evex.w)
+                                : 1) )
+            goto fail;
 
     for ( ; i < ARRAY_SIZE(accessed); ++i )
-         if ( accessed[i] )
-             goto fail;
+        if ( accessed[i] )
+            goto fail;
 
     /* Also check the broadcast case, if available. */
     if ( test->vsz >= VSZ_el || test->scale != SC_vl )
@@ -954,14 +954,14 @@ static void test_one(const struct test *test, enum vl vl,
         goto fail;
 
     for ( i = 0; i < esz; ++i )
-         if ( accessed[i] )
-             goto fail;
+        if ( accessed[i] )
+            goto fail;
     for ( ; i < esz * 2; ++i )
-         if ( accessed[i] != 1 )
-             goto fail;
+        if ( accessed[i] != 1 )
+            goto fail;
     for ( ; i < ARRAY_SIZE(accessed); ++i )
-         if ( accessed[i] )
-             goto fail;
+        if ( accessed[i] )
+            goto fail;
 
     return;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Oct 20 06:11:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 20 Oct 2024 06:11:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.822727.1236665 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2P9v-0003fc-MQ; Sun, 20 Oct 2024 06:11:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 822727.1236665; Sun, 20 Oct 2024 06: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 1t2P9v-0003fU-Ji; Sun, 20 Oct 2024 06:11:23 +0000
Received: by outflank-mailman (input) for mailman id 822727;
 Sun, 20 Oct 2024 06: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 1t2P9u-0003fI-Jg
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06: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 1t2P9u-0007vl-Is
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t2P9u-0002be-Fq
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06: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=SVO+XFwJ5V6P7O5TZaJLyFxgqSiKUn443OtPPNRI5DE=; b=5rvdJAeTUgPBVTbUI0pa2gh81H
	GBWXmJn+kPhHGeADEvdVB2Mfo8BXIGBVecOj0ZQkFDWsACaMfo6b2cMn0p0oF+8NgevoCv/or/Xuc
	23RX2Z9PNk+9uyWrz9eQ16giZSKsfJFuyIE0TzoAT/EHaCELTnIpeWWtl7BJRnAMauB0=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86emul/test: drop Xeon Phi S/G prefetch special case
Message-Id: <E1t2P9u-0002be-Fq@xenbits.xenproject.org>
Date: Sun, 20 Oct 2024 06:11:22 +0000

commit b3ca3caaf36efa3eaea0cce909f75e12b0fb6a1d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Oct 17 14:14:51 2024 +0200
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 17 14:14:51 2024 +0200

    x86emul/test: drop Xeon Phi S/G prefetch special case
    
    Another leftover from the dropping of Xeon Phi support.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 tools/tests/x86_emulator/evex-disp8.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/tools/tests/x86_emulator/evex-disp8.c b/tools/tests/x86_emulator/evex-disp8.c
index 0e9351fcfd..efb6c70637 100644
--- a/tools/tests/x86_emulator/evex-disp8.c
+++ b/tools/tests/x86_emulator/evex-disp8.c
@@ -911,10 +911,8 @@ static void test_one(const struct test *test, enum vl vl,
     n = test->scale == SC_vl ? vsz : esz;
     if ( !sg )
         n += vsz;
-    else if ( !strstr(test->mnemonic, "pf") )
-        n += esz;
     else
-        ++n;
+        n += esz;
 
     for ( ; i < n; ++i )
         if ( accessed[i] != (sg ? (vsz / esz) >> (test->opc & 1 & !evex.w)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Oct 20 06:11:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 20 Oct 2024 06:11:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.822728.1236668 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PA5-0003iD-O0; Sun, 20 Oct 2024 06:11:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 822728.1236668; Sun, 20 Oct 2024 06: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 1t2PA5-0003i6-LJ; Sun, 20 Oct 2024 06:11:33 +0000
Received: by outflank-mailman (input) for mailman id 822728;
 Sun, 20 Oct 2024 06: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 1t2PA4-0003hv-Oj
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06: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 1t2PA4-0007w8-Mk
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t2PA4-0002cO-LA
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06: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=psvOQrQ7OHeb0MjzDcWvupbtBjj8D1Xk5+ExW2YHzFU=; b=ku2+h9e2yvOJuilf5RyMM7t75T
	YEa/Umzkz8oGlc6ucUPUglvRy+3bz1LC7Xa30y4gXVt+pbmSooa5CCHUO3X0dJSXdiBux4iUsizmP
	tfjRNdZobOeS+eshI77DfJ2eknKxye2vS28+y+DE5N4mJLnYCO9I3/+DPQKuHSQT4kbM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] device-tree: Move dt-overlay.c to common/device-tree/
Message-Id: <E1t2PA4-0002cO-LA@xenbits.xenproject.org>
Date: Sun, 20 Oct 2024 06:11:32 +0000

commit 1e81d2df4f48f37d2086bc75199c75ca93cace92
Author:     Michal Orzel <michal.orzel@amd.com>
AuthorDate: Thu Oct 10 12:57:46 2024 +0200
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Oct 17 15:40:47 2024 +0100

    device-tree: Move dt-overlay.c to common/device-tree/
    
    The code is DT specific and as such should be placed under common
    directory for DT related files. Update MAINTAINERS file accordingly
    and drop the line with a path from a top-level comment in dt-overlay.c.
    It serves no purpose and requires being updated on every code movement.
    
    Signed-off-by: Michal Orzel <michal.orzel@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 MAINTAINERS                         |    1 -
 xen/common/Makefile                 |    1 -
 xen/common/device-tree/Makefile     |    1 +
 xen/common/device-tree/dt-overlay.c | 1007 ++++++++++++++++++++++++++++++++++
 xen/common/dt-overlay.c             | 1009 -----------------------------------
 5 files changed, 1008 insertions(+), 1011 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index f68ddd7f84..3bba2c8c31 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -292,7 +292,6 @@ M:	Michal Orzel <michal.orzel@amd.com>
 S:	Supported
 F:	xen/common/libfdt/
 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
diff --git a/xen/common/Makefile b/xen/common/Makefile
index fc48cbf688..b279b09bfb 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -11,7 +11,6 @@ obj-$(filter-out $(CONFIG_X86),$(CONFIG_ACPI)) += device.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
 obj-y += event_2l.o
 obj-y += event_channel.o
 obj-y += event_fifo.o
diff --git a/xen/common/device-tree/Makefile b/xen/common/device-tree/Makefile
index 990abd571a..58052d074e 100644
--- a/xen/common/device-tree/Makefile
+++ b/xen/common/device-tree/Makefile
@@ -1,3 +1,4 @@
 obj-y += bootfdt.init.o
 obj-y += bootinfo.init.o
 obj-y += device-tree.o
+obj-$(CONFIG_OVERLAY_DTB) += dt-overlay.o
diff --git a/xen/common/device-tree/dt-overlay.c b/xen/common/device-tree/dt-overlay.c
new file mode 100644
index 0000000000..97fb99eaaa
--- /dev/null
+++ b/xen/common/device-tree/dt-overlay.c
@@ -0,0 +1,1007 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Device tree overlay support in Xen.
+ *
+ * Copyright (C) 2023, Advanced Micro Devices, Inc. All Rights Reserved.
+ * Written by Vikram Garhwal <vikram.garhwal@amd.com>
+ *
+ */
+#include <asm/domain_build.h>
+#include <xen/dt-overlay.h>
+#include <xen/guest_access.h>
+#include <xen/iocap.h>
+#include <xen/libfdt/libfdt.h>
+#include <xen/xmalloc.h>
+
+#define DT_OVERLAY_MAX_SIZE KB(500)
+
+static LIST_HEAD(overlay_tracker);
+static DEFINE_SPINLOCK(overlay_lock);
+
+/* Find last descendants of the device_node. */
+static struct dt_device_node *
+find_last_descendants_node(const struct dt_device_node *device_node)
+{
+    struct dt_device_node *child_node;
+
+    for ( child_node = device_node->child; child_node->sibling != NULL;
+          child_node = child_node->sibling );
+
+    /* If last child_node also have children. */
+    if ( child_node->child )
+        child_node = find_last_descendants_node(child_node);
+
+    return child_node;
+}
+
+/*
+ * Returns next node to the input node. If node has children then return
+ * last descendant's next node.
+*/
+static struct dt_device_node *
+dt_find_next_node(struct dt_device_node *dt, const struct dt_device_node *node)
+{
+    struct dt_device_node *np;
+
+    dt_for_each_device_node(dt, np)
+        if ( np == node )
+            break;
+
+    if ( np->child )
+        np = find_last_descendants_node(np);
+
+    return np->allnext;
+}
+
+static int dt_overlay_remove_node(struct dt_device_node *device_node)
+{
+    struct dt_device_node *np;
+    struct dt_device_node *parent_node;
+    struct dt_device_node *last_descendant = device_node->child;
+
+    parent_node = device_node->parent;
+
+    /* Check if we are trying to remove "/" i.e. root node. */
+    if ( parent_node == NULL )
+    {
+        dt_dprintk("%s's parent node not found\n", device_node->name);
+        return -EFAULT;
+    }
+
+    /* Sanity check for linking between parent and child node. */
+    np = parent_node->child;
+    if ( np == NULL )
+    {
+        dt_dprintk("parent node %s's not found\n", parent_node->name);
+        return -EFAULT;
+    }
+
+    /* If node to be removed is only child node or first child. */
+    if ( !dt_node_cmp(np->full_name, device_node->full_name) )
+    {
+        parent_node->child = np->sibling;
+
+        /*
+         * Iterate over all child nodes of device_node. Given that we are
+         * removing a node, we need to remove all it's descendants too.
+         * Reason behind finding last_descendant:
+         * If device_node has multiple children, device_node->allnext will point
+         * to first_child and first_child->allnext will be a sibling. When the
+         * device_node and it's all children are removed, parent_node->allnext
+         * should point to node next to last children.
+         */
+        if ( last_descendant )
+        {
+            last_descendant = find_last_descendants_node(device_node);
+            parent_node->allnext = last_descendant->allnext;
+        }
+        else
+            parent_node->allnext = np->allnext;
+
+        return 0;
+    }
+
+    for ( np = parent_node->child; np->sibling != NULL; np = np->sibling )
+    {
+        if ( !dt_node_cmp(np->sibling->full_name, device_node->full_name) )
+        {
+            /* Found the node. Now we remove it. */
+            np->sibling = np->sibling->sibling;
+
+            if ( np->child )
+                np = find_last_descendants_node(np);
+
+            /*
+             * Iterate over all child nodes of device_node. Given that we are
+             * removing parent node, we need to remove all it's descendants too.
+             */
+            if ( last_descendant )
+                last_descendant = find_last_descendants_node(device_node);
+
+            if ( last_descendant )
+                np->allnext = last_descendant->allnext;
+            else
+                np->allnext = np->allnext->allnext;
+
+            break;
+        }
+    }
+
+    return 0;
+}
+
+static int dt_overlay_add_node(struct dt_device_node *device_node,
+                               const char *parent_node_path)
+{
+    struct dt_device_node *parent_node;
+    struct dt_device_node *next_node;
+
+    parent_node = dt_find_node_by_path(parent_node_path);
+
+    if ( parent_node == NULL )
+    {
+        dt_dprintk("Parent node %s not found. Overlay node will not be added\n",
+                   parent_node_path);
+        return -EINVAL;
+    }
+
+    /* If parent has no child. */
+    if ( parent_node->child == NULL )
+    {
+        next_node = parent_node->allnext;
+        device_node->parent = parent_node;
+        parent_node->allnext = device_node;
+        parent_node->child = device_node;
+    }
+    else
+    {
+        struct dt_device_node *np;
+        /*
+         * If parent has at least one child node.
+         * Iterate to the last child node of parent.
+         */
+        for ( np = parent_node->child; np->sibling != NULL; np = np->sibling );
+
+        /* Iterate over all child nodes of np node. */
+        if ( np->child )
+        {
+            struct dt_device_node *np_last_descendant;
+
+            np_last_descendant = find_last_descendants_node(np);
+
+            next_node = np_last_descendant->allnext;
+            np_last_descendant->allnext = device_node;
+        }
+        else
+        {
+            next_node = np->allnext;
+            np->allnext = device_node;
+        }
+
+        device_node->parent = parent_node;
+        np->sibling = device_node;
+        np->sibling->sibling = NULL;
+    }
+
+    /* Iterate over all child nodes of device_node to add children too. */
+    if ( device_node->child )
+    {
+        struct dt_device_node *device_node_last_descendant;
+
+        device_node_last_descendant = find_last_descendants_node(device_node);
+
+        /* Plug next_node at the end of last children of device_node. */
+        device_node_last_descendant->allnext = next_node;
+    }
+    else
+    {
+        /* Now plug next_node at the end of device_node. */
+        device_node->allnext = next_node;
+    }
+
+    return 0;
+}
+
+/* Basic sanity check for the dtbo tool stack provided to Xen. */
+static int check_overlay_fdt(const void *overlay_fdt, uint32_t overlay_fdt_size)
+{
+    if ( (fdt_totalsize(overlay_fdt) != overlay_fdt_size) ||
+          fdt_check_header(overlay_fdt) )
+    {
+        printk(XENLOG_ERR "The overlay FDT is not a valid Flat Device Tree\n");
+        return -EINVAL;
+    }
+
+    return 0;
+}
+
+static int irq_remove_cb(unsigned long s, unsigned long e, void *dom,
+                         unsigned long *c)
+{
+    int rc;
+    struct domain *d = dom;
+
+    /*
+     * TODO: We don't handle shared IRQs for now. So, it is assumed that
+     * the IRQs was not shared with another devices.
+     * TODO: Undo the IRQ routing.
+     */
+    rc = irq_deny_access(d, s);
+    if ( rc )
+    {
+        printk(XENLOG_ERR "unable to revoke access for irq %lu\n", s);
+    }
+    else
+        *c += e - s + 1;
+
+    return rc;
+
+}
+
+static int iomem_remove_cb(unsigned long s, unsigned long e, void *dom,
+                           unsigned long *c)
+{
+    int rc;
+    struct domain *d = dom;
+
+    /*
+    * Remove mmio access.
+    * TODO: Support for remove/add the mapping in P2M.
+    */
+    rc = iomem_deny_access(d, s, e);
+    if ( rc )
+    {
+        printk(XENLOG_ERR "Unable to remove %pd access to %#lx - %#lx\n",
+               d, s, e);
+    }
+    else
+        *c += e - s + 1;
+
+    return rc;
+}
+
+/* Count number of nodes till one level of __overlay__ tag. */
+static unsigned int overlay_node_count(const void *overlay_fdt)
+{
+    unsigned int num_overlay_nodes = 0;
+    int fragment;
+
+    fdt_for_each_subnode(fragment, overlay_fdt, 0)
+    {
+        int subnode;
+        int overlay;
+
+        overlay = fdt_subnode_offset(overlay_fdt, fragment, "__overlay__");
+        if ( overlay < 0 )
+            continue;
+
+        fdt_for_each_subnode(subnode, overlay_fdt, overlay)
+        {
+            num_overlay_nodes++;
+        }
+    }
+
+    return num_overlay_nodes;
+}
+
+/*
+ * overlay_get_nodes_info gets full name with path for all the nodes which
+ * are in one level of __overlay__ tag. This is useful when checking node for
+ * duplication i.e. dtbo tries to add nodes which already exists in device tree.
+ */
+static int overlay_get_nodes_info(const void *fdto, char **nodes_full_path)
+{
+    int fragment;
+    unsigned int node_num = 0;
+
+    fdt_for_each_subnode(fragment, fdto, 0)
+    {
+        int target;
+        int overlay;
+        int subnode;
+        const char *target_path;
+
+        overlay = fdt_subnode_offset(fdto, fragment, "__overlay__");
+        if ( overlay < 0 )
+            continue;
+
+        target = fdt_overlay_target_offset(device_tree_flattened, fdto,
+                                           fragment, &target_path);
+        if ( target < 0 )
+            return target;
+
+        if ( target_path == NULL )
+            return -EINVAL;
+
+        fdt_for_each_subnode(subnode, fdto, overlay)
+        {
+            const char *node_name = NULL;
+            int node_name_len;
+            unsigned int target_path_len = strlen(target_path);
+            unsigned int node_full_name_len;
+            unsigned int extra_len;
+
+            node_name = fdt_get_name(fdto, subnode, &node_name_len);
+
+            if ( node_name == NULL )
+                return node_name_len;
+
+            /*
+             * Extra length is for adding '/' and '\0' unless the target path is
+             * root in which case we don't add the '/' at the beginning. This is
+             * done to keep the node_full_path in the correct full node name
+             * format.
+             */
+            extra_len = (target_path_len > 1) ? 2 : 1;
+            node_full_name_len = target_path_len + node_name_len + extra_len;
+
+            nodes_full_path[node_num] = xmalloc_bytes(node_full_name_len);
+
+            if ( nodes_full_path[node_num] == NULL )
+                return -ENOMEM;
+
+            memcpy(nodes_full_path[node_num], target_path, target_path_len);
+
+            /* Target is not root - add separator */
+            if ( target_path_len > 1 )
+                nodes_full_path[node_num][target_path_len++] = '/';
+
+            memcpy(nodes_full_path[node_num] + target_path_len,
+                    node_name, node_name_len);
+
+            nodes_full_path[node_num][node_full_name_len - 1] = '\0';
+
+            node_num++;
+        }
+    }
+
+    return 0;
+}
+
+/* This function should be called with the overlay_lock taken */
+static struct overlay_track *
+find_track_entry_from_tracker(const void *overlay_fdt,
+                              uint32_t overlay_fdt_size)
+{
+    struct overlay_track *entry, *temp;
+    bool found_entry = false;
+
+    ASSERT(spin_is_locked(&overlay_lock));
+
+    /*
+     * First check if dtbo is correct i.e. it should one of the dtbo which was
+     * used when dynamically adding the node.
+     * Limitation: Cases with same node names but different property are not
+     * supported currently. We are relying on user to provide the same dtbo
+     * as it was used when adding the nodes.
+     */
+    list_for_each_entry_safe( entry, temp, &overlay_tracker, entry )
+    {
+        if ( memcmp(entry->overlay_fdt, overlay_fdt, overlay_fdt_size) == 0 )
+        {
+            found_entry = true;
+            break;
+        }
+    }
+
+    if ( !found_entry )
+    {
+        printk(XENLOG_ERR "Cannot find any matching tracker with input dtbo."
+               " Operation is supported only for prior added dtbo.\n");
+        return NULL;
+    }
+
+    return entry;
+}
+
+/* Check if node itself can be removed and remove node from IOMMU. */
+static int remove_node_resources(struct dt_device_node *device_node)
+{
+    int rc = 0;
+    unsigned int len;
+    domid_t domid;
+
+    domid = dt_device_used_by(device_node);
+
+    dt_dprintk("Checking if node %s is used by any domain\n",
+               device_node->full_name);
+
+    /* Remove the node if only it's assigned to hardware domain or domain io. */
+    if ( domid != hardware_domain->domain_id && domid != DOMID_IO )
+    {
+        printk(XENLOG_ERR "Device %s is being used by domain %u. Removing nodes failed\n",
+               device_node->full_name, domid);
+        return -EINVAL;
+    }
+
+    /* Check if iommu property exists. */
+    if ( dt_get_property(device_node, "iommus", &len) )
+    {
+        if ( dt_device_is_protected(device_node) )
+        {
+            rc = iommu_remove_dt_device(device_node);
+            if ( rc < 0 )
+                return rc;
+        }
+    }
+
+    return rc;
+}
+
+/* Remove all descendants from IOMMU. */
+static int
+remove_descendant_nodes_resources(const struct dt_device_node *device_node)
+{
+    int rc = 0;
+    struct dt_device_node *child_node;
+
+    for ( child_node = device_node->child; child_node != NULL;
+         child_node = child_node->sibling )
+    {
+        if ( child_node->child )
+        {
+            rc = remove_descendant_nodes_resources(child_node);
+            if ( rc )
+                return rc;
+        }
+
+        rc = remove_node_resources(child_node);
+        if ( rc )
+            return rc;
+    }
+
+    return rc;
+}
+
+/* Remove nodes from dt_host. */
+static int remove_nodes(const struct overlay_track *tracker)
+{
+    int rc = 0;
+    struct dt_device_node *overlay_node;
+    unsigned int j;
+    struct domain *d = hardware_domain;
+
+    for ( j = 0; j < tracker->num_nodes; j++ )
+    {
+        overlay_node = (struct dt_device_node *)tracker->nodes_address[j];
+        if ( overlay_node == NULL )
+            return -EINVAL;
+
+        write_lock(&dt_host_lock);
+
+        rc = remove_descendant_nodes_resources(overlay_node);
+        if ( rc )
+        {
+            write_unlock(&dt_host_lock);
+            return rc;
+        }
+
+        rc = remove_node_resources(overlay_node);
+        if ( rc )
+        {
+            write_unlock(&dt_host_lock);
+            return rc;
+        }
+
+        dt_dprintk("Removing node: %s\n", overlay_node->full_name);
+
+        rc = dt_overlay_remove_node(overlay_node);
+        if ( rc )
+        {
+            write_unlock(&dt_host_lock);
+            return rc;
+        }
+
+        write_unlock(&dt_host_lock);
+    }
+
+    /* Remove IRQ access. */
+    if ( tracker->irq_ranges )
+    {
+        rc = rangeset_consume_ranges(tracker->irq_ranges, irq_remove_cb, d);
+        if ( rc )
+            return rc;
+    }
+
+   /* Remove mmio access. */
+    if ( tracker->iomem_ranges )
+    {
+        rc = rangeset_consume_ranges(tracker->iomem_ranges, iomem_remove_cb, d);
+        if ( rc )
+            return rc;
+    }
+
+    return rc;
+}
+
+/*
+ * First finds the device node to remove. Check if the device is being used by
+ * any dom and finally remove it from dt_host. IOMMU is already being taken care
+ * while destroying the domain.
+ */
+static long handle_remove_overlay_nodes(const void *overlay_fdt,
+                                        uint32_t overlay_fdt_size)
+{
+    int rc;
+    struct overlay_track *entry;
+
+    rc = check_overlay_fdt(overlay_fdt, overlay_fdt_size);
+    if ( rc )
+        return rc;
+
+    spin_lock(&overlay_lock);
+
+    entry = find_track_entry_from_tracker(overlay_fdt, overlay_fdt_size);
+    if ( entry == NULL )
+    {
+        rc = -EINVAL;
+        goto out;
+
+    }
+
+    rc = remove_nodes(entry);
+    if ( rc )
+    {
+        printk(XENLOG_ERR "Removing node failed\n");
+        goto out;
+    }
+
+    list_del(&entry->entry);
+
+    xfree(entry->dt_host_new);
+    xfree(entry->fdt);
+    xfree(entry->overlay_fdt);
+
+    xfree(entry->nodes_address);
+
+    rangeset_destroy(entry->irq_ranges);
+    rangeset_destroy(entry->iomem_ranges);
+
+    xfree(entry);
+
+ out:
+    spin_unlock(&overlay_lock);
+    return rc;
+}
+
+static void free_nodes_full_path(unsigned int num_nodes, char **nodes_full_path)
+{
+    unsigned int i;
+
+    if ( nodes_full_path == NULL )
+        return;
+
+    for ( i = 0; i < num_nodes && nodes_full_path[i] != NULL; i++ )
+    {
+        xfree(nodes_full_path[i]);
+    }
+
+    xfree(nodes_full_path);
+}
+
+static long add_nodes(struct overlay_track *tr, char **nodes_full_path)
+
+{
+    int rc;
+    unsigned int j;
+    struct dt_device_node *overlay_node;
+
+    for ( j = 0; j < tr->num_nodes; j++ )
+    {
+        struct dt_device_node *prev_node, *next_node;
+
+        dt_dprintk("Adding node: %s\n", nodes_full_path[j]);
+
+        /* Find the newly added node in tr->dt_host_new by it's full path. */
+        overlay_node = dt_find_node_by_path_from(tr->dt_host_new,
+                                                 nodes_full_path[j]);
+        if ( overlay_node == NULL )
+            return -EFAULT;
+
+        /*
+         * Find previous and next node to overlay_node in dt_host_new. We will
+         * need these nodes to fix the dt_host_new mapping. When overlay_node is
+         * take out of dt_host_new tree and added to dt_host, link between
+         * previous node and next_node is broken. We will need to refresh
+         * dt_host_new with correct linking for any other overlay nodes
+         * extraction in future.
+         */
+        dt_for_each_device_node(tr->dt_host_new, prev_node)
+            if ( prev_node->allnext == overlay_node )
+                break;
+
+        next_node = dt_find_next_node(tr->dt_host_new, overlay_node);
+
+        write_lock(&dt_host_lock);
+
+        /* Add the node to dt_host. */
+        rc = dt_overlay_add_node(overlay_node, overlay_node->parent->full_name);
+        if ( rc )
+        {
+            write_unlock(&dt_host_lock);
+
+            /* Node not added in dt_host. */
+            return rc;
+        }
+
+        prev_node->allnext = next_node;
+
+        overlay_node = dt_find_node_by_path(overlay_node->full_name);
+        if ( overlay_node == NULL )
+        {
+            /* Sanity check. But code will never come here. */
+            ASSERT_UNREACHABLE();
+            return -EFAULT;
+        }
+
+        write_unlock(&dt_host_lock);
+
+        /* Keep overlay_node address in tracker. */
+        tr->nodes_address[j] = (unsigned long)overlay_node;
+    }
+
+    return 0;
+}
+/*
+ * Adds device tree nodes under target node.
+ * We use tr->dt_host_new to unflatten the updated device_tree_flattened.
+ */
+static long handle_add_overlay_nodes(void *overlay_fdt,
+                                     uint32_t overlay_fdt_size)
+{
+    int rc;
+    unsigned int j;
+    struct dt_device_node *overlay_node;
+    struct overlay_track *tr = NULL;
+    char **nodes_full_path = NULL;
+    unsigned int new_fdt_size;
+
+    tr = xzalloc(struct overlay_track);
+    if ( tr == NULL )
+        return -ENOMEM;
+
+    new_fdt_size = fdt_totalsize(device_tree_flattened) +
+                                 fdt_totalsize(overlay_fdt);
+
+    tr->fdt = xzalloc_bytes(new_fdt_size);
+    if ( tr->fdt == NULL )
+    {
+        xfree(tr);
+        return -ENOMEM;
+    }
+
+    tr->num_nodes = overlay_node_count(overlay_fdt);
+    if ( tr->num_nodes == 0 )
+    {
+        xfree(tr->fdt);
+        xfree(tr);
+        return -ENOMEM;
+    }
+
+    tr->nodes_address = xzalloc_bytes(tr->num_nodes * sizeof(unsigned long));
+    if ( tr->nodes_address == NULL )
+    {
+        xfree(tr->fdt);
+        xfree(tr);
+        return -ENOMEM;
+    }
+
+    rc = check_overlay_fdt(overlay_fdt, overlay_fdt_size);
+    if ( rc )
+    {
+        xfree(tr->nodes_address);
+        xfree(tr->fdt);
+        xfree(tr);
+        return rc;
+    }
+
+    /*
+     * Keep a copy of overlay_fdt as fdt_overlay_apply will change the input
+     * overlay's content(magic) when applying overlay.
+     */
+    tr->overlay_fdt = xzalloc_bytes(overlay_fdt_size);
+    if ( tr->overlay_fdt == NULL )
+    {
+        xfree(tr->nodes_address);
+        xfree(tr->fdt);
+        xfree(tr);
+        return -ENOMEM;
+    }
+
+    memcpy(tr->overlay_fdt, overlay_fdt, overlay_fdt_size);
+
+    spin_lock(&overlay_lock);
+
+    memcpy(tr->fdt, device_tree_flattened,
+           fdt_totalsize(device_tree_flattened));
+
+    /* Open tr->fdt with more space to accommodate the overlay_fdt. */
+    rc = fdt_open_into(tr->fdt, tr->fdt, new_fdt_size);
+    if ( rc )
+    {
+        printk(XENLOG_ERR "Increasing fdt size to accommodate overlay_fdt failed with error %d\n",
+               rc);
+        goto err;
+    }
+
+    nodes_full_path = xzalloc_bytes(tr->num_nodes * sizeof(char *));
+    if ( nodes_full_path == NULL )
+    {
+        rc = -ENOMEM;
+        goto err;
+    }
+
+    /*
+     * overlay_get_nodes_info is called to get the node information from dtbo.
+     * This is done before fdt_overlay_apply() because the overlay apply will
+     * erase the magic of overlay_fdt.
+     */
+    rc = overlay_get_nodes_info(overlay_fdt, nodes_full_path);
+    if ( rc )
+    {
+        printk(XENLOG_ERR "Getting nodes information failed with error %d\n",
+               rc);
+        goto err;
+    }
+
+    rc = fdt_overlay_apply(tr->fdt, overlay_fdt);
+    if ( rc )
+    {
+        printk(XENLOG_ERR "Adding overlay node failed with error %d\n", rc);
+        goto err;
+    }
+
+    /*
+     * Check if any of the node already exists in dt_host. If node already exits
+     * we can return here as this overlay_fdt is not suitable for overlay ops.
+     */
+    for ( j = 0; j < tr->num_nodes; j++ )
+    {
+        overlay_node = dt_find_node_by_path(nodes_full_path[j]);
+        if ( overlay_node != NULL )
+        {
+            printk(XENLOG_ERR "node %s exists in device tree\n",
+                   nodes_full_path[j]);
+            rc = -EINVAL;
+            goto err;
+        }
+    }
+
+    /*
+     * Unflatten the tr->fdt into a new dt_host.
+     * TODO: Check and add alias_scan() if it's needed for overlay in future.
+     */
+    rc = unflatten_device_tree(tr->fdt, &tr->dt_host_new);
+    if ( rc )
+    {
+        printk(XENLOG_ERR "unflatten_device_tree failed with error %d\n", rc);
+        goto err;
+    }
+
+    rc = add_nodes(tr, nodes_full_path);
+    if ( rc )
+    {
+        printk(XENLOG_ERR "Adding nodes failed. Removing the partially added nodes.\n");
+        goto remove_node;
+    }
+
+    INIT_LIST_HEAD(&tr->entry);
+    list_add_tail(&tr->entry, &overlay_tracker);
+
+    spin_unlock(&overlay_lock);
+
+    free_nodes_full_path(tr->num_nodes, nodes_full_path);
+
+    return rc;
+
+/*
+ * Failure case. We need to remove the nodes, free tracker(if tr exists) and
+ * tr->dt_host_new.
+ */
+ remove_node:
+    tr->num_nodes = j;
+    rc = remove_nodes(tr);
+
+    if ( rc )
+    {
+        /*
+         * User needs to provide right overlay. Incorrect node information
+         * example parent node doesn't exist in dt_host etc can cause memory
+         * leaks as removing_nodes() will fail and this means nodes memory is
+         * not freed from tracker. Which may cause memory leaks. Ideally, these
+         * device tree related mistakes will be caught by fdt_overlay_apply()
+         * but given that we don't manage that code keeping this warning message
+         * is better here.
+         */
+        printk(XENLOG_ERR "Removing node failed.\n");
+        spin_unlock(&overlay_lock);
+
+        free_nodes_full_path(tr->num_nodes, nodes_full_path);
+
+        return rc;
+    }
+
+ err:
+    spin_unlock(&overlay_lock);
+
+    if ( tr->dt_host_new )
+        xfree(tr->dt_host_new);
+
+    free_nodes_full_path(tr->num_nodes, nodes_full_path);
+
+    xfree(tr->overlay_fdt);
+    xfree(tr->nodes_address);
+    xfree(tr->fdt);
+
+    xfree(tr);
+
+    return rc;
+}
+
+static long handle_attach_overlay_nodes(struct domain *d,
+                                        const void *overlay_fdt,
+                                        uint32_t overlay_fdt_size)
+{
+    int rc;
+    unsigned int j;
+    struct overlay_track *entry;
+
+    rc = check_overlay_fdt(overlay_fdt, overlay_fdt_size);
+    if ( rc )
+        return rc;
+
+    spin_lock(&overlay_lock);
+
+    entry = find_track_entry_from_tracker(overlay_fdt, overlay_fdt_size);
+    if ( entry == NULL )
+    {
+        rc = -EINVAL;
+        goto out;
+    }
+
+    entry->irq_ranges = rangeset_new(d, "Overlays: Interrupts", 0);
+    if (entry->irq_ranges == NULL)
+    {
+        rc = -ENOMEM;
+        printk(XENLOG_ERR "Creating IRQ rangeset failed");
+        goto out;
+    }
+
+    entry->iomem_ranges = rangeset_new(d, "Overlay: I/O Memory",
+                                       RANGESETF_prettyprint_hex);
+    if (entry->iomem_ranges == NULL)
+    {
+        rc = -ENOMEM;
+        printk(XENLOG_ERR "Creating IOMMU rangeset failed");
+        goto out;
+    }
+
+    for ( j = 0; j < entry->num_nodes; j++ )
+    {
+        struct dt_device_node *overlay_node;
+
+        overlay_node = (struct dt_device_node *)entry->nodes_address[j];
+        if ( overlay_node == NULL )
+        {
+            rc = -EINVAL;
+            goto out;
+        }
+
+        write_lock(&dt_host_lock);
+        rc = handle_device(d, overlay_node, p2m_mmio_direct_c,
+                           entry->iomem_ranges, entry->irq_ranges);
+        write_unlock(&dt_host_lock);
+        if ( rc )
+        {
+            printk(XENLOG_ERR "Adding IRQ and IOMMU failed\n");
+            goto out;
+        }
+    }
+
+    spin_unlock(&overlay_lock);
+
+    return 0;
+
+ out:
+    spin_unlock(&overlay_lock);
+
+    if ( entry )
+    {
+        rangeset_destroy(entry->irq_ranges);
+        rangeset_destroy(entry->iomem_ranges);
+    }
+
+    return rc;
+}
+
+long dt_overlay_sysctl(struct xen_sysctl_dt_overlay *op)
+{
+    long ret;
+    void *overlay_fdt;
+
+    if ( op->overlay_op != XEN_SYSCTL_DT_OVERLAY_ADD &&
+         op->overlay_op != XEN_SYSCTL_DT_OVERLAY_REMOVE )
+        return -EOPNOTSUPP;
+
+    if ( op->overlay_fdt_size == 0 ||
+         op->overlay_fdt_size > DT_OVERLAY_MAX_SIZE )
+        return -EINVAL;
+
+    if ( op->pad[0] || op->pad[1] || op->pad[2] )
+        return -EINVAL;
+
+    overlay_fdt = xmalloc_bytes(op->overlay_fdt_size);
+
+    if ( overlay_fdt == NULL )
+        return -ENOMEM;
+
+    ret = copy_from_guest(overlay_fdt, op->overlay_fdt, op->overlay_fdt_size);
+    if ( ret )
+    {
+        gprintk(XENLOG_ERR, "copy from guest failed\n");
+        xfree(overlay_fdt);
+
+        return -EFAULT;
+    }
+
+    if ( op->overlay_op == XEN_SYSCTL_DT_OVERLAY_REMOVE )
+        ret = handle_remove_overlay_nodes(overlay_fdt, op->overlay_fdt_size);
+    else
+        ret = handle_add_overlay_nodes(overlay_fdt, op->overlay_fdt_size);
+
+    xfree(overlay_fdt);
+
+    return ret;
+}
+
+long dt_overlay_domctl(struct domain *d, struct xen_domctl_dt_overlay *op)
+{
+    long ret;
+    void *overlay_fdt;
+
+    if ( op->overlay_op != XEN_DOMCTL_DT_OVERLAY_ATTACH )
+        return -EOPNOTSUPP;
+
+    if ( op->overlay_fdt_size == 0 ||
+         op->overlay_fdt_size > DT_OVERLAY_MAX_SIZE )
+        return -EINVAL;
+
+    if ( op->pad[0] || op->pad[1] || op->pad[2] )
+        return -EINVAL;
+
+    /* TODO: add support for non-1:1 domains using xen,reg */
+    if ( !is_domain_direct_mapped(d) )
+        return -EOPNOTSUPP;
+
+    overlay_fdt = xmalloc_bytes(op->overlay_fdt_size);
+
+    if ( overlay_fdt == NULL )
+        return -ENOMEM;
+
+    ret = copy_from_guest(overlay_fdt, op->overlay_fdt, op->overlay_fdt_size);
+    if ( ret )
+    {
+        gprintk(XENLOG_ERR, "copy from guest failed\n");
+        xfree(overlay_fdt);
+
+        return -EFAULT;
+    }
+
+    if ( op->overlay_op == XEN_DOMCTL_DT_OVERLAY_ATTACH )
+        ret = handle_attach_overlay_nodes(d, overlay_fdt, op->overlay_fdt_size);
+    else
+        ret = -EOPNOTSUPP;
+
+    xfree(overlay_fdt);
+
+    return ret;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/common/dt-overlay.c b/xen/common/dt-overlay.c
deleted file mode 100644
index 5ce00514ef..0000000000
--- a/xen/common/dt-overlay.c
+++ /dev/null
@@ -1,1009 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * xen/common/dt-overlay.c
- *
- * Device tree overlay support in Xen.
- *
- * Copyright (C) 2023, Advanced Micro Devices, Inc. All Rights Reserved.
- * Written by Vikram Garhwal <vikram.garhwal@amd.com>
- *
- */
-#include <asm/domain_build.h>
-#include <xen/dt-overlay.h>
-#include <xen/guest_access.h>
-#include <xen/iocap.h>
-#include <xen/libfdt/libfdt.h>
-#include <xen/xmalloc.h>
-
-#define DT_OVERLAY_MAX_SIZE KB(500)
-
-static LIST_HEAD(overlay_tracker);
-static DEFINE_SPINLOCK(overlay_lock);
-
-/* Find last descendants of the device_node. */
-static struct dt_device_node *
-find_last_descendants_node(const struct dt_device_node *device_node)
-{
-    struct dt_device_node *child_node;
-
-    for ( child_node = device_node->child; child_node->sibling != NULL;
-          child_node = child_node->sibling );
-
-    /* If last child_node also have children. */
-    if ( child_node->child )
-        child_node = find_last_descendants_node(child_node);
-
-    return child_node;
-}
-
-/*
- * Returns next node to the input node. If node has children then return
- * last descendant's next node.
-*/
-static struct dt_device_node *
-dt_find_next_node(struct dt_device_node *dt, const struct dt_device_node *node)
-{
-    struct dt_device_node *np;
-
-    dt_for_each_device_node(dt, np)
-        if ( np == node )
-            break;
-
-    if ( np->child )
-        np = find_last_descendants_node(np);
-
-    return np->allnext;
-}
-
-static int dt_overlay_remove_node(struct dt_device_node *device_node)
-{
-    struct dt_device_node *np;
-    struct dt_device_node *parent_node;
-    struct dt_device_node *last_descendant = device_node->child;
-
-    parent_node = device_node->parent;
-
-    /* Check if we are trying to remove "/" i.e. root node. */
-    if ( parent_node == NULL )
-    {
-        dt_dprintk("%s's parent node not found\n", device_node->name);
-        return -EFAULT;
-    }
-
-    /* Sanity check for linking between parent and child node. */
-    np = parent_node->child;
-    if ( np == NULL )
-    {
-        dt_dprintk("parent node %s's not found\n", parent_node->name);
-        return -EFAULT;
-    }
-
-    /* If node to be removed is only child node or first child. */
-    if ( !dt_node_cmp(np->full_name, device_node->full_name) )
-    {
-        parent_node->child = np->sibling;
-
-        /*
-         * Iterate over all child nodes of device_node. Given that we are
-         * removing a node, we need to remove all it's descendants too.
-         * Reason behind finding last_descendant:
-         * If device_node has multiple children, device_node->allnext will point
-         * to first_child and first_child->allnext will be a sibling. When the
-         * device_node and it's all children are removed, parent_node->allnext
-         * should point to node next to last children.
-         */
-        if ( last_descendant )
-        {
-            last_descendant = find_last_descendants_node(device_node);
-            parent_node->allnext = last_descendant->allnext;
-        }
-        else
-            parent_node->allnext = np->allnext;
-
-        return 0;
-    }
-
-    for ( np = parent_node->child; np->sibling != NULL; np = np->sibling )
-    {
-        if ( !dt_node_cmp(np->sibling->full_name, device_node->full_name) )
-        {
-            /* Found the node. Now we remove it. */
-            np->sibling = np->sibling->sibling;
-
-            if ( np->child )
-                np = find_last_descendants_node(np);
-
-            /*
-             * Iterate over all child nodes of device_node. Given that we are
-             * removing parent node, we need to remove all it's descendants too.
-             */
-            if ( last_descendant )
-                last_descendant = find_last_descendants_node(device_node);
-
-            if ( last_descendant )
-                np->allnext = last_descendant->allnext;
-            else
-                np->allnext = np->allnext->allnext;
-
-            break;
-        }
-    }
-
-    return 0;
-}
-
-static int dt_overlay_add_node(struct dt_device_node *device_node,
-                               const char *parent_node_path)
-{
-    struct dt_device_node *parent_node;
-    struct dt_device_node *next_node;
-
-    parent_node = dt_find_node_by_path(parent_node_path);
-
-    if ( parent_node == NULL )
-    {
-        dt_dprintk("Parent node %s not found. Overlay node will not be added\n",
-                   parent_node_path);
-        return -EINVAL;
-    }
-
-    /* If parent has no child. */
-    if ( parent_node->child == NULL )
-    {
-        next_node = parent_node->allnext;
-        device_node->parent = parent_node;
-        parent_node->allnext = device_node;
-        parent_node->child = device_node;
-    }
-    else
-    {
-        struct dt_device_node *np;
-        /*
-         * If parent has at least one child node.
-         * Iterate to the last child node of parent.
-         */
-        for ( np = parent_node->child; np->sibling != NULL; np = np->sibling );
-
-        /* Iterate over all child nodes of np node. */
-        if ( np->child )
-        {
-            struct dt_device_node *np_last_descendant;
-
-            np_last_descendant = find_last_descendants_node(np);
-
-            next_node = np_last_descendant->allnext;
-            np_last_descendant->allnext = device_node;
-        }
-        else
-        {
-            next_node = np->allnext;
-            np->allnext = device_node;
-        }
-
-        device_node->parent = parent_node;
-        np->sibling = device_node;
-        np->sibling->sibling = NULL;
-    }
-
-    /* Iterate over all child nodes of device_node to add children too. */
-    if ( device_node->child )
-    {
-        struct dt_device_node *device_node_last_descendant;
-
-        device_node_last_descendant = find_last_descendants_node(device_node);
-
-        /* Plug next_node at the end of last children of device_node. */
-        device_node_last_descendant->allnext = next_node;
-    }
-    else
-    {
-        /* Now plug next_node at the end of device_node. */
-        device_node->allnext = next_node;
-    }
-
-    return 0;
-}
-
-/* Basic sanity check for the dtbo tool stack provided to Xen. */
-static int check_overlay_fdt(const void *overlay_fdt, uint32_t overlay_fdt_size)
-{
-    if ( (fdt_totalsize(overlay_fdt) != overlay_fdt_size) ||
-          fdt_check_header(overlay_fdt) )
-    {
-        printk(XENLOG_ERR "The overlay FDT is not a valid Flat Device Tree\n");
-        return -EINVAL;
-    }
-
-    return 0;
-}
-
-static int irq_remove_cb(unsigned long s, unsigned long e, void *dom,
-                         unsigned long *c)
-{
-    int rc;
-    struct domain *d = dom;
-
-    /*
-     * TODO: We don't handle shared IRQs for now. So, it is assumed that
-     * the IRQs was not shared with another devices.
-     * TODO: Undo the IRQ routing.
-     */
-    rc = irq_deny_access(d, s);
-    if ( rc )
-    {
-        printk(XENLOG_ERR "unable to revoke access for irq %lu\n", s);
-    }
-    else
-        *c += e - s + 1;
-
-    return rc;
-
-}
-
-static int iomem_remove_cb(unsigned long s, unsigned long e, void *dom,
-                           unsigned long *c)
-{
-    int rc;
-    struct domain *d = dom;
-
-    /*
-    * Remove mmio access.
-    * TODO: Support for remove/add the mapping in P2M.
-    */
-    rc = iomem_deny_access(d, s, e);
-    if ( rc )
-    {
-        printk(XENLOG_ERR "Unable to remove %pd access to %#lx - %#lx\n",
-               d, s, e);
-    }
-    else
-        *c += e - s + 1;
-
-    return rc;
-}
-
-/* Count number of nodes till one level of __overlay__ tag. */
-static unsigned int overlay_node_count(const void *overlay_fdt)
-{
-    unsigned int num_overlay_nodes = 0;
-    int fragment;
-
-    fdt_for_each_subnode(fragment, overlay_fdt, 0)
-    {
-        int subnode;
-        int overlay;
-
-        overlay = fdt_subnode_offset(overlay_fdt, fragment, "__overlay__");
-        if ( overlay < 0 )
-            continue;
-
-        fdt_for_each_subnode(subnode, overlay_fdt, overlay)
-        {
-            num_overlay_nodes++;
-        }
-    }
-
-    return num_overlay_nodes;
-}
-
-/*
- * overlay_get_nodes_info gets full name with path for all the nodes which
- * are in one level of __overlay__ tag. This is useful when checking node for
- * duplication i.e. dtbo tries to add nodes which already exists in device tree.
- */
-static int overlay_get_nodes_info(const void *fdto, char **nodes_full_path)
-{
-    int fragment;
-    unsigned int node_num = 0;
-
-    fdt_for_each_subnode(fragment, fdto, 0)
-    {
-        int target;
-        int overlay;
-        int subnode;
-        const char *target_path;
-
-        overlay = fdt_subnode_offset(fdto, fragment, "__overlay__");
-        if ( overlay < 0 )
-            continue;
-
-        target = fdt_overlay_target_offset(device_tree_flattened, fdto,
-                                           fragment, &target_path);
-        if ( target < 0 )
-            return target;
-
-        if ( target_path == NULL )
-            return -EINVAL;
-
-        fdt_for_each_subnode(subnode, fdto, overlay)
-        {
-            const char *node_name = NULL;
-            int node_name_len;
-            unsigned int target_path_len = strlen(target_path);
-            unsigned int node_full_name_len;
-            unsigned int extra_len;
-
-            node_name = fdt_get_name(fdto, subnode, &node_name_len);
-
-            if ( node_name == NULL )
-                return node_name_len;
-
-            /*
-             * Extra length is for adding '/' and '\0' unless the target path is
-             * root in which case we don't add the '/' at the beginning. This is
-             * done to keep the node_full_path in the correct full node name
-             * format.
-             */
-            extra_len = (target_path_len > 1) ? 2 : 1;
-            node_full_name_len = target_path_len + node_name_len + extra_len;
-
-            nodes_full_path[node_num] = xmalloc_bytes(node_full_name_len);
-
-            if ( nodes_full_path[node_num] == NULL )
-                return -ENOMEM;
-
-            memcpy(nodes_full_path[node_num], target_path, target_path_len);
-
-            /* Target is not root - add separator */
-            if ( target_path_len > 1 )
-                nodes_full_path[node_num][target_path_len++] = '/';
-
-            memcpy(nodes_full_path[node_num] + target_path_len,
-                    node_name, node_name_len);
-
-            nodes_full_path[node_num][node_full_name_len - 1] = '\0';
-
-            node_num++;
-        }
-    }
-
-    return 0;
-}
-
-/* This function should be called with the overlay_lock taken */
-static struct overlay_track *
-find_track_entry_from_tracker(const void *overlay_fdt,
-                              uint32_t overlay_fdt_size)
-{
-    struct overlay_track *entry, *temp;
-    bool found_entry = false;
-
-    ASSERT(spin_is_locked(&overlay_lock));
-
-    /*
-     * First check if dtbo is correct i.e. it should one of the dtbo which was
-     * used when dynamically adding the node.
-     * Limitation: Cases with same node names but different property are not
-     * supported currently. We are relying on user to provide the same dtbo
-     * as it was used when adding the nodes.
-     */
-    list_for_each_entry_safe( entry, temp, &overlay_tracker, entry )
-    {
-        if ( memcmp(entry->overlay_fdt, overlay_fdt, overlay_fdt_size) == 0 )
-        {
-            found_entry = true;
-            break;
-        }
-    }
-
-    if ( !found_entry )
-    {
-        printk(XENLOG_ERR "Cannot find any matching tracker with input dtbo."
-               " Operation is supported only for prior added dtbo.\n");
-        return NULL;
-    }
-
-    return entry;
-}
-
-/* Check if node itself can be removed and remove node from IOMMU. */
-static int remove_node_resources(struct dt_device_node *device_node)
-{
-    int rc = 0;
-    unsigned int len;
-    domid_t domid;
-
-    domid = dt_device_used_by(device_node);
-
-    dt_dprintk("Checking if node %s is used by any domain\n",
-               device_node->full_name);
-
-    /* Remove the node if only it's assigned to hardware domain or domain io. */
-    if ( domid != hardware_domain->domain_id && domid != DOMID_IO )
-    {
-        printk(XENLOG_ERR "Device %s is being used by domain %u. Removing nodes failed\n",
-               device_node->full_name, domid);
-        return -EINVAL;
-    }
-
-    /* Check if iommu property exists. */
-    if ( dt_get_property(device_node, "iommus", &len) )
-    {
-        if ( dt_device_is_protected(device_node) )
-        {
-            rc = iommu_remove_dt_device(device_node);
-            if ( rc < 0 )
-                return rc;
-        }
-    }
-
-    return rc;
-}
-
-/* Remove all descendants from IOMMU. */
-static int
-remove_descendant_nodes_resources(const struct dt_device_node *device_node)
-{
-    int rc = 0;
-    struct dt_device_node *child_node;
-
-    for ( child_node = device_node->child; child_node != NULL;
-         child_node = child_node->sibling )
-    {
-        if ( child_node->child )
-        {
-            rc = remove_descendant_nodes_resources(child_node);
-            if ( rc )
-                return rc;
-        }
-
-        rc = remove_node_resources(child_node);
-        if ( rc )
-            return rc;
-    }
-
-    return rc;
-}
-
-/* Remove nodes from dt_host. */
-static int remove_nodes(const struct overlay_track *tracker)
-{
-    int rc = 0;
-    struct dt_device_node *overlay_node;
-    unsigned int j;
-    struct domain *d = hardware_domain;
-
-    for ( j = 0; j < tracker->num_nodes; j++ )
-    {
-        overlay_node = (struct dt_device_node *)tracker->nodes_address[j];
-        if ( overlay_node == NULL )
-            return -EINVAL;
-
-        write_lock(&dt_host_lock);
-
-        rc = remove_descendant_nodes_resources(overlay_node);
-        if ( rc )
-        {
-            write_unlock(&dt_host_lock);
-            return rc;
-        }
-
-        rc = remove_node_resources(overlay_node);
-        if ( rc )
-        {
-            write_unlock(&dt_host_lock);
-            return rc;
-        }
-
-        dt_dprintk("Removing node: %s\n", overlay_node->full_name);
-
-        rc = dt_overlay_remove_node(overlay_node);
-        if ( rc )
-        {
-            write_unlock(&dt_host_lock);
-            return rc;
-        }
-
-        write_unlock(&dt_host_lock);
-    }
-
-    /* Remove IRQ access. */
-    if ( tracker->irq_ranges )
-    {
-        rc = rangeset_consume_ranges(tracker->irq_ranges, irq_remove_cb, d);
-        if ( rc )
-            return rc;
-    }
-
-   /* Remove mmio access. */
-    if ( tracker->iomem_ranges )
-    {
-        rc = rangeset_consume_ranges(tracker->iomem_ranges, iomem_remove_cb, d);
-        if ( rc )
-            return rc;
-    }
-
-    return rc;
-}
-
-/*
- * First finds the device node to remove. Check if the device is being used by
- * any dom and finally remove it from dt_host. IOMMU is already being taken care
- * while destroying the domain.
- */
-static long handle_remove_overlay_nodes(const void *overlay_fdt,
-                                        uint32_t overlay_fdt_size)
-{
-    int rc;
-    struct overlay_track *entry;
-
-    rc = check_overlay_fdt(overlay_fdt, overlay_fdt_size);
-    if ( rc )
-        return rc;
-
-    spin_lock(&overlay_lock);
-
-    entry = find_track_entry_from_tracker(overlay_fdt, overlay_fdt_size);
-    if ( entry == NULL )
-    {
-        rc = -EINVAL;
-        goto out;
-
-    }
-
-    rc = remove_nodes(entry);
-    if ( rc )
-    {
-        printk(XENLOG_ERR "Removing node failed\n");
-        goto out;
-    }
-
-    list_del(&entry->entry);
-
-    xfree(entry->dt_host_new);
-    xfree(entry->fdt);
-    xfree(entry->overlay_fdt);
-
-    xfree(entry->nodes_address);
-
-    rangeset_destroy(entry->irq_ranges);
-    rangeset_destroy(entry->iomem_ranges);
-
-    xfree(entry);
-
- out:
-    spin_unlock(&overlay_lock);
-    return rc;
-}
-
-static void free_nodes_full_path(unsigned int num_nodes, char **nodes_full_path)
-{
-    unsigned int i;
-
-    if ( nodes_full_path == NULL )
-        return;
-
-    for ( i = 0; i < num_nodes && nodes_full_path[i] != NULL; i++ )
-    {
-        xfree(nodes_full_path[i]);
-    }
-
-    xfree(nodes_full_path);
-}
-
-static long add_nodes(struct overlay_track *tr, char **nodes_full_path)
-
-{
-    int rc;
-    unsigned int j;
-    struct dt_device_node *overlay_node;
-
-    for ( j = 0; j < tr->num_nodes; j++ )
-    {
-        struct dt_device_node *prev_node, *next_node;
-
-        dt_dprintk("Adding node: %s\n", nodes_full_path[j]);
-
-        /* Find the newly added node in tr->dt_host_new by it's full path. */
-        overlay_node = dt_find_node_by_path_from(tr->dt_host_new,
-                                                 nodes_full_path[j]);
-        if ( overlay_node == NULL )
-            return -EFAULT;
-
-        /*
-         * Find previous and next node to overlay_node in dt_host_new. We will
-         * need these nodes to fix the dt_host_new mapping. When overlay_node is
-         * take out of dt_host_new tree and added to dt_host, link between
-         * previous node and next_node is broken. We will need to refresh
-         * dt_host_new with correct linking for any other overlay nodes
-         * extraction in future.
-         */
-        dt_for_each_device_node(tr->dt_host_new, prev_node)
-            if ( prev_node->allnext == overlay_node )
-                break;
-
-        next_node = dt_find_next_node(tr->dt_host_new, overlay_node);
-
-        write_lock(&dt_host_lock);
-
-        /* Add the node to dt_host. */
-        rc = dt_overlay_add_node(overlay_node, overlay_node->parent->full_name);
-        if ( rc )
-        {
-            write_unlock(&dt_host_lock);
-
-            /* Node not added in dt_host. */
-            return rc;
-        }
-
-        prev_node->allnext = next_node;
-
-        overlay_node = dt_find_node_by_path(overlay_node->full_name);
-        if ( overlay_node == NULL )
-        {
-            /* Sanity check. But code will never come here. */
-            ASSERT_UNREACHABLE();
-            return -EFAULT;
-        }
-
-        write_unlock(&dt_host_lock);
-
-        /* Keep overlay_node address in tracker. */
-        tr->nodes_address[j] = (unsigned long)overlay_node;
-    }
-
-    return 0;
-}
-/*
- * Adds device tree nodes under target node.
- * We use tr->dt_host_new to unflatten the updated device_tree_flattened.
- */
-static long handle_add_overlay_nodes(void *overlay_fdt,
-                                     uint32_t overlay_fdt_size)
-{
-    int rc;
-    unsigned int j;
-    struct dt_device_node *overlay_node;
-    struct overlay_track *tr = NULL;
-    char **nodes_full_path = NULL;
-    unsigned int new_fdt_size;
-
-    tr = xzalloc(struct overlay_track);
-    if ( tr == NULL )
-        return -ENOMEM;
-
-    new_fdt_size = fdt_totalsize(device_tree_flattened) +
-                                 fdt_totalsize(overlay_fdt);
-
-    tr->fdt = xzalloc_bytes(new_fdt_size);
-    if ( tr->fdt == NULL )
-    {
-        xfree(tr);
-        return -ENOMEM;
-    }
-
-    tr->num_nodes = overlay_node_count(overlay_fdt);
-    if ( tr->num_nodes == 0 )
-    {
-        xfree(tr->fdt);
-        xfree(tr);
-        return -ENOMEM;
-    }
-
-    tr->nodes_address = xzalloc_bytes(tr->num_nodes * sizeof(unsigned long));
-    if ( tr->nodes_address == NULL )
-    {
-        xfree(tr->fdt);
-        xfree(tr);
-        return -ENOMEM;
-    }
-
-    rc = check_overlay_fdt(overlay_fdt, overlay_fdt_size);
-    if ( rc )
-    {
-        xfree(tr->nodes_address);
-        xfree(tr->fdt);
-        xfree(tr);
-        return rc;
-    }
-
-    /*
-     * Keep a copy of overlay_fdt as fdt_overlay_apply will change the input
-     * overlay's content(magic) when applying overlay.
-     */
-    tr->overlay_fdt = xzalloc_bytes(overlay_fdt_size);
-    if ( tr->overlay_fdt == NULL )
-    {
-        xfree(tr->nodes_address);
-        xfree(tr->fdt);
-        xfree(tr);
-        return -ENOMEM;
-    }
-
-    memcpy(tr->overlay_fdt, overlay_fdt, overlay_fdt_size);
-
-    spin_lock(&overlay_lock);
-
-    memcpy(tr->fdt, device_tree_flattened,
-           fdt_totalsize(device_tree_flattened));
-
-    /* Open tr->fdt with more space to accommodate the overlay_fdt. */
-    rc = fdt_open_into(tr->fdt, tr->fdt, new_fdt_size);
-    if ( rc )
-    {
-        printk(XENLOG_ERR "Increasing fdt size to accommodate overlay_fdt failed with error %d\n",
-               rc);
-        goto err;
-    }
-
-    nodes_full_path = xzalloc_bytes(tr->num_nodes * sizeof(char *));
-    if ( nodes_full_path == NULL )
-    {
-        rc = -ENOMEM;
-        goto err;
-    }
-
-    /*
-     * overlay_get_nodes_info is called to get the node information from dtbo.
-     * This is done before fdt_overlay_apply() because the overlay apply will
-     * erase the magic of overlay_fdt.
-     */
-    rc = overlay_get_nodes_info(overlay_fdt, nodes_full_path);
-    if ( rc )
-    {
-        printk(XENLOG_ERR "Getting nodes information failed with error %d\n",
-               rc);
-        goto err;
-    }
-
-    rc = fdt_overlay_apply(tr->fdt, overlay_fdt);
-    if ( rc )
-    {
-        printk(XENLOG_ERR "Adding overlay node failed with error %d\n", rc);
-        goto err;
-    }
-
-    /*
-     * Check if any of the node already exists in dt_host. If node already exits
-     * we can return here as this overlay_fdt is not suitable for overlay ops.
-     */
-    for ( j = 0; j < tr->num_nodes; j++ )
-    {
-        overlay_node = dt_find_node_by_path(nodes_full_path[j]);
-        if ( overlay_node != NULL )
-        {
-            printk(XENLOG_ERR "node %s exists in device tree\n",
-                   nodes_full_path[j]);
-            rc = -EINVAL;
-            goto err;
-        }
-    }
-
-    /*
-     * Unflatten the tr->fdt into a new dt_host.
-     * TODO: Check and add alias_scan() if it's needed for overlay in future.
-     */
-    rc = unflatten_device_tree(tr->fdt, &tr->dt_host_new);
-    if ( rc )
-    {
-        printk(XENLOG_ERR "unflatten_device_tree failed with error %d\n", rc);
-        goto err;
-    }
-
-    rc = add_nodes(tr, nodes_full_path);
-    if ( rc )
-    {
-        printk(XENLOG_ERR "Adding nodes failed. Removing the partially added nodes.\n");
-        goto remove_node;
-    }
-
-    INIT_LIST_HEAD(&tr->entry);
-    list_add_tail(&tr->entry, &overlay_tracker);
-
-    spin_unlock(&overlay_lock);
-
-    free_nodes_full_path(tr->num_nodes, nodes_full_path);
-
-    return rc;
-
-/*
- * Failure case. We need to remove the nodes, free tracker(if tr exists) and
- * tr->dt_host_new.
- */
- remove_node:
-    tr->num_nodes = j;
-    rc = remove_nodes(tr);
-
-    if ( rc )
-    {
-        /*
-         * User needs to provide right overlay. Incorrect node information
-         * example parent node doesn't exist in dt_host etc can cause memory
-         * leaks as removing_nodes() will fail and this means nodes memory is
-         * not freed from tracker. Which may cause memory leaks. Ideally, these
-         * device tree related mistakes will be caught by fdt_overlay_apply()
-         * but given that we don't manage that code keeping this warning message
-         * is better here.
-         */
-        printk(XENLOG_ERR "Removing node failed.\n");
-        spin_unlock(&overlay_lock);
-
-        free_nodes_full_path(tr->num_nodes, nodes_full_path);
-
-        return rc;
-    }
-
- err:
-    spin_unlock(&overlay_lock);
-
-    if ( tr->dt_host_new )
-        xfree(tr->dt_host_new);
-
-    free_nodes_full_path(tr->num_nodes, nodes_full_path);
-
-    xfree(tr->overlay_fdt);
-    xfree(tr->nodes_address);
-    xfree(tr->fdt);
-
-    xfree(tr);
-
-    return rc;
-}
-
-static long handle_attach_overlay_nodes(struct domain *d,
-                                        const void *overlay_fdt,
-                                        uint32_t overlay_fdt_size)
-{
-    int rc;
-    unsigned int j;
-    struct overlay_track *entry;
-
-    rc = check_overlay_fdt(overlay_fdt, overlay_fdt_size);
-    if ( rc )
-        return rc;
-
-    spin_lock(&overlay_lock);
-
-    entry = find_track_entry_from_tracker(overlay_fdt, overlay_fdt_size);
-    if ( entry == NULL )
-    {
-        rc = -EINVAL;
-        goto out;
-    }
-
-    entry->irq_ranges = rangeset_new(d, "Overlays: Interrupts", 0);
-    if (entry->irq_ranges == NULL)
-    {
-        rc = -ENOMEM;
-        printk(XENLOG_ERR "Creating IRQ rangeset failed");
-        goto out;
-    }
-
-    entry->iomem_ranges = rangeset_new(d, "Overlay: I/O Memory",
-                                       RANGESETF_prettyprint_hex);
-    if (entry->iomem_ranges == NULL)
-    {
-        rc = -ENOMEM;
-        printk(XENLOG_ERR "Creating IOMMU rangeset failed");
-        goto out;
-    }
-
-    for ( j = 0; j < entry->num_nodes; j++ )
-    {
-        struct dt_device_node *overlay_node;
-
-        overlay_node = (struct dt_device_node *)entry->nodes_address[j];
-        if ( overlay_node == NULL )
-        {
-            rc = -EINVAL;
-            goto out;
-        }
-
-        write_lock(&dt_host_lock);
-        rc = handle_device(d, overlay_node, p2m_mmio_direct_c,
-                           entry->iomem_ranges, entry->irq_ranges);
-        write_unlock(&dt_host_lock);
-        if ( rc )
-        {
-            printk(XENLOG_ERR "Adding IRQ and IOMMU failed\n");
-            goto out;
-        }
-    }
-
-    spin_unlock(&overlay_lock);
-
-    return 0;
-
- out:
-    spin_unlock(&overlay_lock);
-
-    if ( entry )
-    {
-        rangeset_destroy(entry->irq_ranges);
-        rangeset_destroy(entry->iomem_ranges);
-    }
-
-    return rc;
-}
-
-long dt_overlay_sysctl(struct xen_sysctl_dt_overlay *op)
-{
-    long ret;
-    void *overlay_fdt;
-
-    if ( op->overlay_op != XEN_SYSCTL_DT_OVERLAY_ADD &&
-         op->overlay_op != XEN_SYSCTL_DT_OVERLAY_REMOVE )
-        return -EOPNOTSUPP;
-
-    if ( op->overlay_fdt_size == 0 ||
-         op->overlay_fdt_size > DT_OVERLAY_MAX_SIZE )
-        return -EINVAL;
-
-    if ( op->pad[0] || op->pad[1] || op->pad[2] )
-        return -EINVAL;
-
-    overlay_fdt = xmalloc_bytes(op->overlay_fdt_size);
-
-    if ( overlay_fdt == NULL )
-        return -ENOMEM;
-
-    ret = copy_from_guest(overlay_fdt, op->overlay_fdt, op->overlay_fdt_size);
-    if ( ret )
-    {
-        gprintk(XENLOG_ERR, "copy from guest failed\n");
-        xfree(overlay_fdt);
-
-        return -EFAULT;
-    }
-
-    if ( op->overlay_op == XEN_SYSCTL_DT_OVERLAY_REMOVE )
-        ret = handle_remove_overlay_nodes(overlay_fdt, op->overlay_fdt_size);
-    else
-        ret = handle_add_overlay_nodes(overlay_fdt, op->overlay_fdt_size);
-
-    xfree(overlay_fdt);
-
-    return ret;
-}
-
-long dt_overlay_domctl(struct domain *d, struct xen_domctl_dt_overlay *op)
-{
-    long ret;
-    void *overlay_fdt;
-
-    if ( op->overlay_op != XEN_DOMCTL_DT_OVERLAY_ATTACH )
-        return -EOPNOTSUPP;
-
-    if ( op->overlay_fdt_size == 0 ||
-         op->overlay_fdt_size > DT_OVERLAY_MAX_SIZE )
-        return -EINVAL;
-
-    if ( op->pad[0] || op->pad[1] || op->pad[2] )
-        return -EINVAL;
-
-    /* TODO: add support for non-1:1 domains using xen,reg */
-    if ( !is_domain_direct_mapped(d) )
-        return -EOPNOTSUPP;
-
-    overlay_fdt = xmalloc_bytes(op->overlay_fdt_size);
-
-    if ( overlay_fdt == NULL )
-        return -ENOMEM;
-
-    ret = copy_from_guest(overlay_fdt, op->overlay_fdt, op->overlay_fdt_size);
-    if ( ret )
-    {
-        gprintk(XENLOG_ERR, "copy from guest failed\n");
-        xfree(overlay_fdt);
-
-        return -EFAULT;
-    }
-
-    if ( op->overlay_op == XEN_DOMCTL_DT_OVERLAY_ATTACH )
-        ret = handle_attach_overlay_nodes(d, overlay_fdt, op->overlay_fdt_size);
-    else
-        ret = -EOPNOTSUPP;
-
-    xfree(overlay_fdt);
-
-    return ret;
-}
-
-/*
- * 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 Sun Oct 20 06:11:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 20 Oct 2024 06:11:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.822730.1236672 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PAF-0003lI-RG; Sun, 20 Oct 2024 06:11:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 822730.1236672; Sun, 20 Oct 2024 06: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 1t2PAF-0003lA-Oo; Sun, 20 Oct 2024 06:11:43 +0000
Received: by outflank-mailman (input) for mailman id 822730;
 Sun, 20 Oct 2024 06: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 1t2PAE-0003l0-Qw
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06: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 1t2PAE-0007wF-QD
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t2PAE-0002dK-Ou
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06: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=rciVtq2T555UjU+U77PsR2Vikawefrl5PFKhkH2keX4=; b=b7KQX14wNLRpzWxkX5kKp8v6Ip
	OdqRHiVK2UU16W2Wd/Qa9vUj6ri30TD5d1VBHzGTZxykblyJP4Hv5ymKQVgfOCz1YXPDURe9sLpeD
	jHYT6Pcutv42loZMjoG0D09HxoNOEXMC2itQYMe1cK4YTG8lqhlcLTrAvikB+PkFpXVA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: dom0less: cope with missing /gic phandle
Message-Id: <E1t2PAE-0002dK-Ou@xenbits.xenproject.org>
Date: Sun, 20 Oct 2024 06:11:42 +0000

commit 081683ea578da56dd20b9dc22a64d03c893b47ba
Author:     Stewart Hildebrand <stewart.hildebrand@amd.com>
AuthorDate: Fri Oct 11 17:19:56 2024 -0400
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Oct 17 15:42:11 2024 +0100

    xen/arm: dom0less: cope with missing /gic phandle
    
    If a partial DT has a /gic node, but no references to it, dtc may omit
    the phandle property. With the phandle property missing,
    fdt_get_phandle() returns 0, leading Xen to generate a malformed domU
    dtb due to invalid interrupt-parent phandle references. 0 is an invalid
    phandle value. Add a zero check, and fall back to GUEST_PHANDLE_GIC.
    
    Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 xen/arch/arm/dom0less-build.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c
index 09b65e44ae..f328a044e9 100644
--- a/xen/arch/arm/dom0less-build.c
+++ b/xen/arch/arm/dom0less-build.c
@@ -554,7 +554,10 @@ static int __init domain_handle_dtb_bootmodule(struct domain *d,
          */
         if ( dt_node_cmp(name, "gic") == 0 )
         {
-            kinfo->phandle_gic = fdt_get_phandle(pfdt, node_next);
+            uint32_t phandle_gic = fdt_get_phandle(pfdt, node_next);
+
+            if ( phandle_gic != 0 )
+                kinfo->phandle_gic = phandle_gic;
             continue;
         }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Oct 20 06:11:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 20 Oct 2024 06:11:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.822731.1236677 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PAQ-0003o3-Sx; Sun, 20 Oct 2024 06:11:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 822731.1236677; Sun, 20 Oct 2024 06:11:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PAQ-0003nw-QK; Sun, 20 Oct 2024 06:11:54 +0000
Received: by outflank-mailman (input) for mailman id 822731;
 Sun, 20 Oct 2024 06:11: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 1t2PAO-0003nj-Vl
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:11: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 1t2PAO-0007wP-Uz
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t2PAO-0002eB-SQ
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:11:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=2c2sOVxRaEkVs4lTaQ4WFv9H41i1GzV+Cv/tJSoS3tw=; b=6UCVBqyam6sZ/TayeBAQoeoUyn
	BW6EUMV6rZX/rRGSZv5fwycXaBA2HPBNrQ4vjh0ufkFHNY/vnoUXhYYIVX5PsDs40VEQw8tSh7pO9
	8/SZSudiHuyOM+h4PB860Jg3aTd72676nixNYFFphgAl/GaMaEoFXhEPQsaAajblhmuk=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: move x86 boot module counting into a new boot_info struct
Message-Id: <E1t2PAO-0002eB-SQ@xenbits.xenproject.org>
Date: Sun, 20 Oct 2024 06:11:52 +0000

commit 038826b61e852469b1a54690dba6d142aceb1f20
Author:     Christopher Clark <christopher.w.clark@gmail.com>
AuthorDate: Thu Oct 17 13:02:41 2024 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 17 23:42:51 2024 +0100

    x86/boot: move x86 boot module counting into a new boot_info struct
    
    An initial step towards a non-multiboot internal representation of boot
    modules for common code, starting with x86 setup and converting the fields
    that are accessed for the startup calculations.
    
    Introduce a new header, <asm/bootinfo.h>, and populate it with a new boot_info
    structure initially containing a count of the number of boot modules.
    
    No functional change intended.
    
    Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com>
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/bootinfo.h | 29 ++++++++++++++++
 xen/arch/x86/include/asm/setup.h    |  2 ++
 xen/arch/x86/setup.c                | 66 +++++++++++++++++++++++--------------
 3 files changed, 73 insertions(+), 24 deletions(-)

diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm/bootinfo.h
new file mode 100644
index 0000000000..385579e2b5
--- /dev/null
+++ b/xen/arch/x86/include/asm/bootinfo.h
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (c) 2024 Christopher Clark <christopher.w.clark@gmail.com>
+ * Copyright (c) 2024 Apertus Solutions, LLC
+ * Author: Daniel P. Smith <dpsmith@apertussolutions.com>
+ */
+
+#ifndef X86_BOOTINFO_H
+#define X86_BOOTINFO_H
+
+/*
+ * Xen internal representation of information provided by the
+ * bootloader/environment, or derived from the information.
+ */
+struct boot_info {
+    unsigned int nr_modules;
+};
+
+#endif /* X86_BOOTINFO_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h
index d75589178b..3d18952118 100644
--- a/xen/arch/x86/include/asm/setup.h
+++ b/xen/arch/x86/include/asm/setup.h
@@ -32,6 +32,8 @@ int construct_dom0(
     const char *cmdline);
 void setup_io_bitmap(struct domain *d);
 
+extern struct boot_info xen_boot_info;
+
 unsigned long initial_images_nrpages(nodeid_t node);
 void discard_initial_images(void);
 void *bootstrap_map(const module_t *mod);
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index a6e77c9ed9..7464c3d49b 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -32,6 +32,7 @@
 #include <compat/xen.h>
 #endif
 #include <xen/bitops.h>
+#include <asm/bootinfo.h>
 #include <asm/smp.h>
 #include <asm/processor.h>
 #include <asm/mpspec.h>
@@ -274,16 +275,30 @@ static int __init cf_check parse_acpi_param(const char *s)
 custom_param("acpi", parse_acpi_param);
 
 static const module_t *__initdata initial_images;
-static unsigned int __initdata nr_initial_images;
+
+struct boot_info __initdata xen_boot_info = {
+};
+
+static struct boot_info *__init multiboot_fill_boot_info(unsigned long mbi_p)
+{
+    struct boot_info *bi = &xen_boot_info;
+    const multiboot_info_t *mbi = __va(mbi_p);
+
+    if ( mbi->flags & MBI_MODULES )
+        bi->nr_modules = mbi->mods_count;
+
+    return bi;
+}
 
 unsigned long __init initial_images_nrpages(nodeid_t node)
 {
+    struct boot_info *bi = &xen_boot_info;
     unsigned long node_start = node_start_pfn(node);
     unsigned long node_end = node_end_pfn(node);
     unsigned long nr;
     unsigned int i;
 
-    for ( nr = i = 0; i < nr_initial_images; ++i )
+    for ( nr = i = 0; i < bi->nr_modules; ++i )
     {
         unsigned long start = initial_images[i].mod_start;
         unsigned long end = start + PFN_UP(initial_images[i].mod_end);
@@ -297,9 +312,10 @@ unsigned long __init initial_images_nrpages(nodeid_t node)
 
 void __init discard_initial_images(void)
 {
+    struct boot_info *bi = &xen_boot_info;
     unsigned int i;
 
-    for ( i = 0; i < nr_initial_images; ++i )
+    for ( i = 0; i < bi->nr_modules; ++i )
     {
         uint64_t start = (uint64_t)initial_images[i].mod_start << PAGE_SHIFT;
 
@@ -307,7 +323,7 @@ void __init discard_initial_images(void)
                            start + PAGE_ALIGN(initial_images[i].mod_end));
     }
 
-    nr_initial_images = 0;
+    bi->nr_modules = 0;
     initial_images = NULL;
 }
 
@@ -969,6 +985,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     void *bsp_stack;
     struct cpu_info *info = get_cpu_info(), *bsp_info;
     unsigned int initrdidx, num_parked = 0;
+    struct boot_info *bi;
     multiboot_info_t *mbi;
     module_t *mod;
     unsigned long nr_pages, raw_max_page, modules_headroom, module_map[1];
@@ -1015,6 +1032,8 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
         mod = __va(mbi->mods_addr);
     }
 
+    bi = multiboot_fill_boot_info(mbi_p);
+
     loader = (mbi->flags & MBI_LOADERNAME) ? __va(mbi->boot_loader_name)
                                            : "unknown";
 
@@ -1122,18 +1141,18 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
            bootsym(boot_edd_info_nr));
 
     /* Check that we have at least one Multiboot module. */
-    if ( !(mbi->flags & MBI_MODULES) || (mbi->mods_count == 0) )
+    if ( !bi->nr_modules )
         panic("dom0 kernel not specified. Check bootloader configuration\n");
 
     /* Check that we don't have a silly number of modules. */
-    if ( mbi->mods_count > sizeof(module_map) * 8 )
+    if ( bi->nr_modules > sizeof(module_map) * 8 )
     {
-        mbi->mods_count = sizeof(module_map) * 8;
-        printk("Excessive multiboot modules - using the first %u only\n",
-               mbi->mods_count);
+        bi->nr_modules = sizeof(module_map) * 8;
+        printk("Excessive boot modules - using the first %u only\n",
+               bi->nr_modules);
     }
 
-    bitmap_fill(module_map, mbi->mods_count);
+    bitmap_fill(module_map, bi->nr_modules);
     __clear_bit(0, module_map); /* Dom0 kernel is always first */
 
     if ( pvh_boot )
@@ -1306,9 +1325,8 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     kexec_reserve_area();
 
     initial_images = mod;
-    nr_initial_images = mbi->mods_count;
 
-    for ( i = 0; !efi_enabled(EFI_LOADER) && i < mbi->mods_count; i++ )
+    for ( i = 0; !efi_enabled(EFI_LOADER) && i < bi->nr_modules; i++ )
     {
         if ( mod[i].mod_start & (PAGE_SIZE - 1) )
             panic("Bootloader didn't honor module alignment request\n");
@@ -1332,8 +1350,8 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
          * respective reserve_e820_ram() invocation below. No need to
          * query efi_boot_mem_unused() here, though.
          */
-        mod[mbi->mods_count].mod_start = virt_to_mfn(_stext);
-        mod[mbi->mods_count].mod_end = __2M_rwdata_end - _stext;
+        mod[bi->nr_modules].mod_start = virt_to_mfn(_stext);
+        mod[bi->nr_modules].mod_end = __2M_rwdata_end - _stext;
     }
 
     modules_headroom = bzimage_headroom(bootstrap_map(mod), mod->mod_end);
@@ -1393,7 +1411,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
         {
             /* Don't overlap with modules. */
             end = consider_modules(s, e, reloc_size + mask,
-                                   mod, mbi->mods_count, -1);
+                                   mod, bi->nr_modules, -1);
             end &= ~mask;
         }
         else
@@ -1414,7 +1432,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
         }
 
         /* Is the region suitable for relocating the multiboot modules? */
-        for ( j = mbi->mods_count - 1; j >= 0; j-- )
+        for ( j = bi->nr_modules - 1; j >= 0; j-- )
         {
             /*
              * 'headroom' is a guess for the decompressed size and
@@ -1429,7 +1447,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
 
             /* Don't overlap with other modules (or Xen itself). */
             end = consider_modules(s, e, size, mod,
-                                   mbi->mods_count + relocated, j);
+                                   bi->nr_modules + relocated, j);
 
             if ( highmem_start && end > highmem_start )
                 continue;
@@ -1456,7 +1474,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
         {
             /* Don't overlap with modules (or Xen itself). */
             e = consider_modules(s, e, PAGE_ALIGN(kexec_crash_area.size), mod,
-                                 mbi->mods_count + relocated, -1);
+                                 bi->nr_modules + relocated, -1);
             if ( s >= e )
                 break;
             if ( e > kexec_crash_area_limit )
@@ -1471,7 +1489,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
 
     if ( modules_headroom && !mod->reserved )
         panic("Not enough memory to relocate the dom0 kernel image\n");
-    for ( i = 0; i < mbi->mods_count; ++i )
+    for ( i = 0; i < bi->nr_modules; ++i )
     {
         uint64_t s = (uint64_t)mod[i].mod_start << PAGE_SHIFT;
 
@@ -1551,7 +1569,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
                     ASSERT(j);
                 }
                 map_e = boot_e820.map[j].addr + boot_e820.map[j].size;
-                for ( j = 0; j < mbi->mods_count; ++j )
+                for ( j = 0; j < bi->nr_modules; ++j )
                 {
                     uint64_t end = pfn_to_paddr(mod[j].mod_start) +
                                    mod[j].mod_end;
@@ -1626,7 +1644,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
         }
     }
 
-    for ( i = 0; i < mbi->mods_count; ++i )
+    for ( i = 0; i < bi->nr_modules; ++i )
     {
         set_pdx_range(mod[i].mod_start,
                       mod[i].mod_start + PFN_UP(mod[i].mod_end));
@@ -2011,8 +2029,8 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
            cpu_has_nx ? XENLOG_INFO : XENLOG_WARNING "Warning: ",
            cpu_has_nx ? "" : "not ");
 
-    initrdidx = find_first_bit(module_map, mbi->mods_count);
-    if ( bitmap_weight(module_map, mbi->mods_count) > 1 )
+    initrdidx = find_first_bit(module_map, bi->nr_modules);
+    if ( bitmap_weight(module_map, bi->nr_modules) > 1 )
         printk(XENLOG_WARNING
                "Multiple initrd candidates, picking module #%u\n",
                initrdidx);
@@ -2022,7 +2040,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
      * above our heap. The second module, if present, is an initrd ramdisk.
      */
     dom0 = create_dom0(mod, modules_headroom,
-                       initrdidx < mbi->mods_count ? mod + initrdidx : NULL,
+                       initrdidx < bi->nr_modules ? mod + initrdidx : NULL,
                        kextra, loader);
     if ( !dom0 )
         panic("Could not set up DOM0 guest OS\n");
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Oct 20 06:12:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 20 Oct 2024 06:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.822732.1236681 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PAa-0003r0-V1; Sun, 20 Oct 2024 06:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 822732.1236681; Sun, 20 Oct 2024 06:12:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PAa-0003qr-S5; Sun, 20 Oct 2024 06:12:04 +0000
Received: by outflank-mailman (input) for mailman id 822732;
 Sun, 20 Oct 2024 06:12: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 1t2PAZ-0003qh-41
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:12: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 1t2PAZ-0007wj-3F
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:12:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t2PAZ-0002fn-0y
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:12:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ibv/4TCGepWGBA37KbQfmpr4SWaf/DNH21QtDZbwCY4=; b=0RqL9121mZMlvviLJ85oMMdoN+
	qenKw1PQa3gFEDprUXLvv7hS6snvj8mq8puyNo0c9aaX5fTT5nTxbvkSKmRr6ta2G4WnBwca8sOmF
	yTQhFSCjNTZHG9YfgvFVGtBu7Ze4ydWXz0yH8AIesModK4hqK9fyuzuvmLP/lhmxtLKY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: move boot loader name to boot info
Message-Id: <E1t2PAZ-0002fn-0y@xenbits.xenproject.org>
Date: Sun, 20 Oct 2024 06:12:03 +0000

commit b438c5fbf4c02145f6ecc8642290d46bf1957388
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Thu Oct 17 13:02:42 2024 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 17 23:42:51 2024 +0100

    x86/boot: move boot loader name to boot info
    
    Transition the incoming boot loader name to be held in struct boot_info.
    
    No functional change intended.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/bootinfo.h |  2 ++
 xen/arch/x86/setup.c                | 17 +++++++++--------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm/bootinfo.h
index 385579e2b5..f066110f4b 100644
--- a/xen/arch/x86/include/asm/bootinfo.h
+++ b/xen/arch/x86/include/asm/bootinfo.h
@@ -13,6 +13,8 @@
  * bootloader/environment, or derived from the information.
  */
 struct boot_info {
+    const char *loader;
+
     unsigned int nr_modules;
 };
 
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 7464c3d49b..9e22528f4b 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -277,6 +277,7 @@ custom_param("acpi", parse_acpi_param);
 static const module_t *__initdata initial_images;
 
 struct boot_info __initdata xen_boot_info = {
+    .loader = "unknown",
 };
 
 static struct boot_info *__init multiboot_fill_boot_info(unsigned long mbi_p)
@@ -287,6 +288,9 @@ static struct boot_info *__init multiboot_fill_boot_info(unsigned long mbi_p)
     if ( mbi->flags & MBI_MODULES )
         bi->nr_modules = mbi->mods_count;
 
+    if ( mbi->flags & MBI_LOADERNAME )
+        bi->loader = __va(mbi->boot_loader_name);
+
     return bi;
 }
 
@@ -980,7 +984,7 @@ static struct domain *__init create_dom0(const module_t *image,
 
 void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
 {
-    const char *memmap_type = NULL, *loader, *cmdline = "";
+    const char *memmap_type = NULL, *cmdline = "";
     char *kextra;
     void *bsp_stack;
     struct cpu_info *info = get_cpu_info(), *bsp_info;
@@ -1034,12 +1038,9 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
 
     bi = multiboot_fill_boot_info(mbi_p);
 
-    loader = (mbi->flags & MBI_LOADERNAME) ? __va(mbi->boot_loader_name)
-                                           : "unknown";
-
     /* Parse the command-line options. */
     if ( mbi->flags & MBI_CMDLINE )
-        cmdline = cmdline_cook(__va(mbi->cmdline), loader);
+        cmdline = cmdline_cook(__va(mbi->cmdline), bi->loader);
 
     if ( (kextra = strstr(cmdline, " -- ")) != NULL )
     {
@@ -1080,7 +1081,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     if ( pvh_boot )
         pvh_print_info();
 
-    printk("Bootloader: %s\n", loader);
+    printk("Bootloader: %s\n", bi->loader);
 
     printk("Command line: %s\n", cmdline);
 
@@ -1173,7 +1174,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
         l3_bootmap[l3_table_offset(BOOTSTRAP_MAP_BASE)] =
             l3e_from_paddr(__pa(l2_bootmap), __PAGE_HYPERVISOR);
 
-        memmap_type = loader;
+        memmap_type = bi->loader;
     }
     else if ( efi_enabled(EFI_BOOT) )
         memmap_type = "EFI";
@@ -2041,7 +2042,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
      */
     dom0 = create_dom0(mod, modules_headroom,
                        initrdidx < bi->nr_modules ? mod + initrdidx : NULL,
-                       kextra, loader);
+                       kextra, bi->loader);
     if ( !dom0 )
         panic("Could not set up DOM0 guest OS\n");
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Oct 20 06:12:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 20 Oct 2024 06:12:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.822733.1236685 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PAl-0003tZ-0S; Sun, 20 Oct 2024 06:12:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 822733.1236685; Sun, 20 Oct 2024 06:12:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PAk-0003tR-Th; Sun, 20 Oct 2024 06:12:14 +0000
Received: by outflank-mailman (input) for mailman id 822733;
 Sun, 20 Oct 2024 06:12: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 1t2PAj-0003tH-7m
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:12: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 1t2PAj-0007ws-70
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:12:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t2PAj-0002h9-5M
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:12:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=ercsbpPFGx5socvM97lhtAlMZNj3mt4Ko3TQ6wb0Y7c=; b=exQdb+UtoBnaob5ctt1HTg/Y01
	xMNYoNX7pKYp37RGIVfuRuOl6IEiRt5LyDpfcWwpVK23SNi2MwU0kHinYih+J93Aun5vaYDvVbxTM
	lCryKK8W95Qnal9S4ezbmvzp6oFo6QQqIRLHYJ9bqB5NyiCPf0/uVdqPjvJwBQHPQSDQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: move cmdline to boot info
Message-Id: <E1t2PAj-0002h9-5M@xenbits.xenproject.org>
Date: Sun, 20 Oct 2024 06:12:13 +0000

commit 29aaded97dacd3120842aeeafa91a4a8e6d45180
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Thu Oct 17 13:02:43 2024 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 17 23:42:51 2024 +0100

    x86/boot: move cmdline to boot info
    
    Transition Xen's command line to being held in struct boot_info.
    
    No functional change intended.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/bootinfo.h |  1 +
 xen/arch/x86/setup.c                | 17 ++++++++++-------
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm/bootinfo.h
index f066110f4b..c980f0bdb7 100644
--- a/xen/arch/x86/include/asm/bootinfo.h
+++ b/xen/arch/x86/include/asm/bootinfo.h
@@ -14,6 +14,7 @@
  */
 struct boot_info {
     const char *loader;
+    const char *cmdline;
 
     unsigned int nr_modules;
 };
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 9e22528f4b..01e35b9659 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -274,10 +274,13 @@ static int __init cf_check parse_acpi_param(const char *s)
 }
 custom_param("acpi", parse_acpi_param);
 
+static const char *cmdline_cook(const char *p, const char *loader_name);
+
 static const module_t *__initdata initial_images;
 
 struct boot_info __initdata xen_boot_info = {
     .loader = "unknown",
+    .cmdline = "",
 };
 
 static struct boot_info *__init multiboot_fill_boot_info(unsigned long mbi_p)
@@ -291,6 +294,9 @@ static struct boot_info *__init multiboot_fill_boot_info(unsigned long mbi_p)
     if ( mbi->flags & MBI_LOADERNAME )
         bi->loader = __va(mbi->boot_loader_name);
 
+    if ( mbi->flags & MBI_CMDLINE )
+        bi->cmdline = cmdline_cook(__va(mbi->cmdline), bi->loader);
+
     return bi;
 }
 
@@ -984,7 +990,7 @@ static struct domain *__init create_dom0(const module_t *image,
 
 void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
 {
-    const char *memmap_type = NULL, *cmdline = "";
+    const char *memmap_type = NULL;
     char *kextra;
     void *bsp_stack;
     struct cpu_info *info = get_cpu_info(), *bsp_info;
@@ -1039,10 +1045,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     bi = multiboot_fill_boot_info(mbi_p);
 
     /* Parse the command-line options. */
-    if ( mbi->flags & MBI_CMDLINE )
-        cmdline = cmdline_cook(__va(mbi->cmdline), bi->loader);
-
-    if ( (kextra = strstr(cmdline, " -- ")) != NULL )
+    if ( (kextra = strstr(bi->cmdline, " -- ")) != NULL )
     {
         /*
          * Options after ' -- ' separator belong to dom0.
@@ -1053,7 +1056,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
         kextra += 3;
         while ( kextra[1] == ' ' ) kextra++;
     }
-    cmdline_parse(cmdline);
+    cmdline_parse(bi->cmdline);
 
     /* Must be after command line argument parsing and before
      * allocing any xenheap structures wanted in lower memory. */
@@ -1083,7 +1086,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
 
     printk("Bootloader: %s\n", bi->loader);
 
-    printk("Command line: %s\n", cmdline);
+    printk("Command line: %s\n", bi->cmdline);
 
     printk("Xen image load base address: %#lx\n", xen_phys_start);
     if ( hypervisor_name )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Oct 20 06:12:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 20 Oct 2024 06:12:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.822734.1236689 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PAv-0003w3-2D; Sun, 20 Oct 2024 06:12:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 822734.1236689; Sun, 20 Oct 2024 06:12: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 1t2PAu-0003vv-VF; Sun, 20 Oct 2024 06:12:24 +0000
Received: by outflank-mailman (input) for mailman id 822734;
 Sun, 20 Oct 2024 06:12: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 1t2PAt-0003vk-Ah
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:12: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 1t2PAt-0007x1-9w
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:12:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t2PAt-0002iX-9B
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:12:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=pgfGCZgQuIO4Fm/V2An98zebN1bAounOf18koy/Yii0=; b=luPKDyS71ZsiJUzXB05nuzTEA9
	FpEVXxCXb6FeV7R6bi8v+iihofMhhDhrXtTMqNRGZRMo1H0i9li/h/kcGoRzsvmKOGSN/NRvyiBBz
	e3jk6eNtIW/O9+/3M/I1YbM2s1jYdr50Yj0+O7qJLKb6F92dS0LOyZ1rWq9MkFnV7I1k=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: move mmap info to boot info
Message-Id: <E1t2PAt-0002iX-9B@xenbits.xenproject.org>
Date: Sun, 20 Oct 2024 06:12:23 +0000

commit a285d2ac2e524c808091062c67142cf5924b56f6
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Thu Oct 17 13:02:44 2024 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 17 23:42:51 2024 +0100

    x86/boot: move mmap info to boot info
    
    Transition the memory map info to be held in struct boot_info.
    
    No functional change intended.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/bootinfo.h |  5 +++++
 xen/arch/x86/setup.c                | 12 +++++++++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm/bootinfo.h
index c980f0bdb7..e7821e0603 100644
--- a/xen/arch/x86/include/asm/bootinfo.h
+++ b/xen/arch/x86/include/asm/bootinfo.h
@@ -8,6 +8,8 @@
 #ifndef X86_BOOTINFO_H
 #define X86_BOOTINFO_H
 
+#include <xen/types.h>
+
 /*
  * Xen internal representation of information provided by the
  * bootloader/environment, or derived from the information.
@@ -16,6 +18,9 @@ struct boot_info {
     const char *loader;
     const char *cmdline;
 
+    paddr_t memmap_addr;
+    size_t memmap_length;
+
     unsigned int nr_modules;
 };
 
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 01e35b9659..163f5620da 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -297,6 +297,12 @@ static struct boot_info *__init multiboot_fill_boot_info(unsigned long mbi_p)
     if ( mbi->flags & MBI_CMDLINE )
         bi->cmdline = cmdline_cook(__va(mbi->cmdline), bi->loader);
 
+    if ( mbi->flags & MBI_MEMMAP )
+    {
+        bi->memmap_addr   = mbi->mmap_addr;
+        bi->memmap_length = mbi->mmap_length;
+    }
+
     return bi;
 }
 
@@ -1187,13 +1193,13 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     {
         memmap_type = "Xen-e820";
     }
-    else if ( mbi->flags & MBI_MEMMAP )
+    else if ( bi->memmap_length )
     {
         memmap_type = "Multiboot-e820";
-        while ( bytes < mbi->mmap_length &&
+        while ( bytes < bi->memmap_length &&
                 e820_raw.nr_map < ARRAY_SIZE(e820_raw.map) )
         {
-            memory_map_t *map = __va(mbi->mmap_addr + bytes);
+            memory_map_t *map = __va(bi->memmap_addr + bytes);
 
             /*
              * This is a gross workaround for a BIOS bug. Some bootloaders do
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Oct 20 06:12:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 20 Oct 2024 06:12:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.822735.1236694 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PB5-0003zH-5x; Sun, 20 Oct 2024 06:12:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 822735.1236694; Sun, 20 Oct 2024 06:12: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 1t2PB5-0003z9-2E; Sun, 20 Oct 2024 06:12:35 +0000
Received: by outflank-mailman (input) for mailman id 822735;
 Sun, 20 Oct 2024 06:12: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 1t2PB3-0003yw-EF
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:12: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 1t2PB3-0007xR-DV
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:12:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t2PB3-0002jF-C9
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:12:33 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Q6D+tw2CqQBcmj9+LZBmt4rkoXBEyB2l0ts8bDJN0no=; b=PB75fmNa9UkniKeoSYQ1qP6dYy
	zh8VdGsNbreLTQ+pFJ/LaTyA9g004TCeJcxqPtFMQC+yjiInuIlXnKymmOAC8eksyjSTwtoI5CCw7
	I3JDmM5ZmvEe1cyGqs675jF5fWWhxE/Ar4woPxE/fNPxGIlXQ5wu1dXQ3b8jnAgwS2iw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: split bootstrap_map_addr() out of bootstrap_map()
Message-Id: <E1t2PB3-0002jF-C9@xenbits.xenproject.org>
Date: Sun, 20 Oct 2024 06:12:33 +0000

commit 572010c552b210f07e633473bd0c1129af4d0b50
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Oct 17 13:02:56 2024 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 18 01:32:32 2024 +0100

    x86/boot: split bootstrap_map_addr() out of bootstrap_map()
    
    Using an interface based on addresses directly, not modules.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
---
 xen/arch/x86/setup.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 163f5620da..6746ed8cce 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -425,24 +425,22 @@ static void __init normalise_cpu_order(void)
  * Ensure a given physical memory range is present in the bootstrap mappings.
  * Use superpage mappings to ensure that pagetable memory needn't be allocated.
  */
-void *__init bootstrap_map(const module_t *mod)
+static void *__init bootstrap_map_addr(paddr_t start, paddr_t end)
 {
     static unsigned long __initdata map_cur = BOOTSTRAP_MAP_BASE;
-    uint64_t start, end, mask = (1L << L2_PAGETABLE_SHIFT) - 1;
+    uint64_t mask = (1L << L2_PAGETABLE_SHIFT) - 1;
     void *ret;
 
     if ( system_state != SYS_STATE_early_boot )
-        return mod ? mfn_to_virt(mod->mod_start) : NULL;
+        return end ? maddr_to_virt(start) : NULL;
 
-    if ( !mod )
+    if ( !end )
     {
         destroy_xen_mappings(BOOTSTRAP_MAP_BASE, BOOTSTRAP_MAP_LIMIT);
         map_cur = BOOTSTRAP_MAP_BASE;
         return NULL;
     }
 
-    start = (uint64_t)mod->mod_start << PAGE_SHIFT;
-    end = start + mod->mod_end;
     if ( start >= end )
         return NULL;
 
@@ -458,6 +456,15 @@ void *__init bootstrap_map(const module_t *mod)
     return ret;
 }
 
+void *__init bootstrap_map(const module_t *mod)
+{
+    if ( !mod )
+        return bootstrap_map_addr(0, 0);
+
+    return bootstrap_map_addr(pfn_to_paddr(mod->mod_start),
+                              pfn_to_paddr(mod->mod_start) + mod->mod_end);
+}
+
 static void __init move_memory(
     uint64_t dst, uint64_t src, unsigned int size)
 {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Oct 20 06:12:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 20 Oct 2024 06:12:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.822736.1236696 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PBF-00041h-65; Sun, 20 Oct 2024 06:12:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 822736.1236696; Sun, 20 Oct 2024 06:12: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 1t2PBF-00041a-3i; Sun, 20 Oct 2024 06:12:45 +0000
Received: by outflank-mailman (input) for mailman id 822736;
 Sun, 20 Oct 2024 06:12: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 1t2PBD-00041S-HD
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:12: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 1t2PBD-0007xZ-GY
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:12:43 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t2PBD-0002k1-Ff
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:12:43 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=VLu2SR+0UtOgfHrnsIWqLM43Uy4apb4dqjMKtHMEjmo=; b=nUN7aDsbRN/xsuFb/6mnwrj4zl
	bUoqG3/OZOpF7/WublsESYeZ0/qlzD1BCPJL1XZbcaCyhwNQ9h+orK1oTggkejfLN3OhbGs+oUyZn
	n86y3onHzLgS++C+YRDs7+TVOKYRy0aBXkURVIZdW4kFzQmz2kPBp7KWIvWz+w2GM5gM=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: Fix URL to the gitlab container registry documentation
Message-Id: <E1t2PBD-0002k1-Ff@xenbits.xenproject.org>
Date: Sun, 20 Oct 2024 06:12:43 +0000

commit 0bcf66d05a3d425e22b995020ca31bdbcaf48823
Author:     Javi Merino <javi.merino@cloud.com>
AuthorDate: Thu Oct 17 17:20:19 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 18 10:56:41 2024 +0100

    automation: Fix URL to the gitlab container registry documentation
    
    The gitlab documentation is now at
    https://docs.gitlab.com/ee/administration/packages/container_registry.html
    
    Signed-off-by: Javi Merino <javi.merino@cloud.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/automation/build/README.md b/automation/build/README.md
index bd0c0e0418..ecc898680c 100644
--- a/automation/build/README.md
+++ b/automation/build/README.md
@@ -110,7 +110,7 @@ make -C automation/build opensuse/tumbleweed-x86_64 PUSH=1
 
 [BuildKit]: https://docs.docker.com/build/buildkit/
 [registry]: https://gitlab.com/xen-project/xen/container_registry
-[registry help]: https://gitlab.com/help/user/project/container_registry
+[registry help]: https://docs.gitlab.com/ee/user/packages/container_registry/
 
 
 Building/Running container for a different architecture
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Oct 20 06:12:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 20 Oct 2024 06:12:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.822737.1236701 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PBP-00044I-7s; Sun, 20 Oct 2024 06:12:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 822737.1236701; Sun, 20 Oct 2024 06:12:55 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PBP-00044B-5H; Sun, 20 Oct 2024 06:12:55 +0000
Received: by outflank-mailman (input) for mailman id 822737;
 Sun, 20 Oct 2024 06:12: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 1t2PBN-000440-Jy
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:12: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 1t2PBN-0007xm-JE
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:12:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t2PBN-0002kz-Ic
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:12:53 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=TeL7yWPl5FbDFCQKOzvaktbrA1r3cw7da8JbjfYP87g=; b=6W7ORFt3iNxa3+1Bqni+yk3SsW
	nkRSaBh9dtG6A5C2wZz98IYtVgb45ciq8rwHjUCUFSovLg1upA1abZzD7aGi3jNm0qzVpFM3tovof
	2V4nGaHYRnLtx4sSwZXbOhYQPeroyCyhjkDrm4GX7lpqgSDic9z088IbbmrvQCkRXECQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] ocaml/libs: Fill build failure due to unused variable in ocaml macro
Message-Id: <E1t2PBN-0002kz-Ic@xenbits.xenproject.org>
Date: Sun, 20 Oct 2024 06:12:53 +0000

commit d84f6870fe18565c93937224fc0e1a2b69aa529a
Author:     Javi Merino <javi.merino@cloud.com>
AuthorDate: Thu Oct 17 17:20:20 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 18 10:56:41 2024 +0100

    ocaml/libs: Fill build failure due to unused variable in ocaml macro
    
    On Fedora 40, the build fails with:
    
        In file included from domain_getinfo_stubs_v1.c:10:
        domain_getinfo_stubs_v1.c: In function 'xsd_glue_failwith':
        /usr/lib64/ocaml/caml/memory.h:275:29: error: unused variable 'caml__frame' [-Werror=unused-variable]
          275 |   struct caml__roots_block *caml__frame = *caml_local_roots_ptr
              |                             ^~~~~~~~~~~
        domain_getinfo_stubs_v1.c:48:9: note: in expansion of macro 'CAMLparam0'
          48 |         CAMLparam0();
             |         ^~~~~~~~~~
        cc1: all warnings being treated as errors
    
    The CAMLparam0 macro is defined in /usr/lib64/ocaml/caml/memory.h:255 as:
    
        #define CAMLparam0()                                                    \
          struct caml__roots_block** caml_local_roots_ptr =                     \
            (DO_CHECK_CAML_STATE ? Caml_check_caml_state() : (void)0,           \
             &CAML_LOCAL_ROOTS);                                                \
          struct caml__roots_block *caml__frame = *caml_local_roots_ptr
    
    We can't modify the macro.  But, it turns out there's a CAMLnoreturn macro
    with the sole purpose of masking this warning.
    
    Fixes: a6576011a4d2 ("ocaml/libs: Implement a dynamically-loaded plugin for Xenctrl.domain_getinfo")
    Signed-off-by: Javi Merino <javi.merino@cloud.com>
    Acked-by: Christian Lindig <christian.lindig@cloud.com>
---
 .../libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_stubs_v1.c     | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_stubs_v1.c b/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_stubs_v1.c
index 7be386f4d4..963cec8883 100644
--- a/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_stubs_v1.c
+++ b/tools/ocaml/libs/xsd_glue/domain_getinfo_plugin_v1/domain_getinfo_stubs_v1.c
@@ -69,6 +69,7 @@ static void Noreturn xsd_glue_failwith(
 	free(str);
 
 	caml_raise_with_arg(*caml_named_value("xsg.error_v1"), msg);
+	CAMLnoreturn;
 }
 #define xsd_glue_failwith(xch) xsd_glue_failwith(xch, __func__, __LINE__)
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Oct 20 06:13:05 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 20 Oct 2024 06:13:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.822738.1236705 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PBZ-00047D-9J; Sun, 20 Oct 2024 06:13:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 822738.1236705; Sun, 20 Oct 2024 06:13:05 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PBZ-000474-6h; Sun, 20 Oct 2024 06:13:05 +0000
Received: by outflank-mailman (input) for mailman id 822738;
 Sun, 20 Oct 2024 06:13: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 1t2PBX-00046r-Mt
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:13: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 1t2PBX-0007yA-MC
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:13:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t2PBX-0002lu-LN
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:13:03 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=RnqjoU9N4y4NV2/6KFhqNIs2cpijnTldY/3nLhR7F9I=; b=pbYTeDzvSqaSLaiYoc9CrTVsMK
	3dBlftOM9s359HKr8id/iyrDtOK64QHZpp1blu4vbqeRu0S9PuI8coNHGXL93QCVi24Ga3B7S/Mfd
	z7UEzxliNuKisZm7ID+zQHWkHECHMVF7+rKdspf2tToGprNcmP8+3AIO9z8k64O/7Tv4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Refresh and upgrade the Fedora container
Message-Id: <E1t2PBX-0002lu-LN@xenbits.xenproject.org>
Date: Sun, 20 Oct 2024 06:13:03 +0000

commit 6e085825cb073255cc9d5db32b496284b89290d3
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Oct 17 17:20:21 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 18 10:56:41 2024 +0100

    CI: Refresh and upgrade the Fedora container
    
    Fedora 29 is long out of date.  Move forward 5 years to Fedora 40.
    
    Include all the usual improvements.  Rework the container to be non-root, use
    heredocs for legibility, and switch to the new naming scheme.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Javi Merino <javi.merino@cloud.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/build/fedora/29.dockerfile        | 46 -----------------
 automation/build/fedora/40-x86_64.dockerfile | 77 ++++++++++++++++++++++++++++
 automation/gitlab-ci/build.yaml              |  8 +--
 automation/scripts/containerize              |  2 +-
 4 files changed, 82 insertions(+), 51 deletions(-)

diff --git a/automation/build/fedora/29.dockerfile b/automation/build/fedora/29.dockerfile
deleted file mode 100644
index d5f017ac72..0000000000
--- a/automation/build/fedora/29.dockerfile
+++ /dev/null
@@ -1,46 +0,0 @@
-# syntax=docker/dockerfile:1
-FROM --platform=linux/amd64 fedora:29
-LABEL maintainer.name="The Xen Project" \
-      maintainer.email="xen-devel@lists.xenproject.org"
-
-# install Xen depends
-RUN dnf -y install \
-        clang \
-        gcc \
-        gcc-c++ \
-        ncurses-devel \
-        zlib-devel \
-        python-devel \
-        python3-devel \
-        libuuid-devel \
-        pkgconfig \
-        flex \
-        bison \
-        libaio-devel \
-        glib2-devel \
-        yajl-devel \
-        pixman-devel \
-        glibc-devel \
-        make \
-        binutils \
-        git \
-        wget \
-        acpica-tools \
-        python-markdown \
-        patch \
-        checkpolicy \
-        dev86 \
-        xz-devel \
-        bzip2 \
-        nasm \
-        ocaml \
-        ocaml-findlib \
-        golang \
-        # QEMU
-        ninja-build \
-    && dnf clean all && \
-    rm -rf /var/cache/dnf
-
-RUN useradd --create-home user
-USER user
-WORKDIR /build
diff --git a/automation/build/fedora/40-x86_64.dockerfile b/automation/build/fedora/40-x86_64.dockerfile
new file mode 100644
index 0000000000..7d4d4cc2ac
--- /dev/null
+++ b/automation/build/fedora/40-x86_64.dockerfile
@@ -0,0 +1,77 @@
+# syntax=docker/dockerfile:1
+FROM --platform=linux/amd64 fedora:40
+LABEL maintainer.name="The Xen Project"
+LABEL maintainer.email="xen-devel@lists.xenproject.org"
+
+RUN <<EOF
+    set -e
+
+    useradd --create-home user
+
+    dnf -y update
+
+    DEPS=(
+        # Xen
+        binutils
+        gcc
+        make
+        python3
+        # Kconfig
+        bison
+        flex
+        # Flask
+        checkpolicy
+
+        # Tools (general)
+        git-core
+        gzip
+        patch
+        perl-interpreter
+        perl-File-Find
+        pkgconfig
+        wget
+        # libxenguest dombuilder
+        bzip2-devel
+        libzstd-devel
+        lzo-devel
+        xz-devel
+        zlib-devel
+        # libacpi
+        acpica-tools
+        # libxl
+        libuuid-devel
+        yajl-devel
+        # xen-foreign
+        diffutils
+        # RomBIOS
+        dev86
+        # Header Check
+        gcc-c++
+        # xentop
+        ncurses-devel
+        # Python bindings
+        python3-devel
+        python3-setuptools
+        # Ocaml bindings/oxenstored
+        ocaml
+        ocaml-findlib
+        # Golang bindings
+        golang
+
+        # Stubdom download/extract
+        bzip2
+
+        # Qemu build
+        glib2-devel
+        pixman-devel
+        ninja-build
+    )
+
+    dnf -y --setopt=install_weak_deps=False install "${DEPS[@]}"
+
+    dnf clean all
+    rm -rf /var/cache/dnf
+EOF
+
+USER user
+WORKDIR /build
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index c2db69ecf8..09dd9e6ccb 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -579,15 +579,15 @@ debian-bookworm-32-gcc-debug:
   variables:
     CONTAINER: debian:bookworm-i386
 
-fedora-gcc:
+fedora-40-x86_64-gcc:
   extends: .gcc-x86-64-build
   variables:
-    CONTAINER: fedora:29
+    CONTAINER: fedora:40-x86_64
 
-fedora-gcc-debug:
+fedora-40-x86_64-gcc-debug:
   extends: .gcc-x86-64-build-debug
   variables:
-    CONTAINER: fedora:29
+    CONTAINER: fedora:40-x86_64
 
 ubuntu-16.04-x86_64-clang:
   extends: .clang-x86-64-build
diff --git a/automation/scripts/containerize b/automation/scripts/containerize
index 7607b78f76..6ac02c42d1 100755
--- a/automation/scripts/containerize
+++ b/automation/scripts/containerize
@@ -28,7 +28,7 @@ case "_${CONTAINER}" in
     _alpine-arm64v8) CONTAINER="${BASE}/alpine:3.18-arm64v8" ;;
     _archlinux|_arch) CONTAINER="${BASE}/archlinux:current" ;;
     _centos7) CONTAINER="${BASE}/centos:7" ;;
-    _fedora) CONTAINER="${BASE}/fedora:29";;
+    _fedora) CONTAINER="${BASE}/fedora:40-x86_64";;
     _bullseye-ppc64le) CONTAINER="${BASE}/debian:11-ppc64le" ;;
     _bookworm-ppc64le) CONTAINER="${BASE}/debian:12-ppc64le" ;;
     _bullseye-riscv64) CONTAINER="${BASE}/debian:11-riscv64" ;;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Oct 20 06:13:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 20 Oct 2024 06:13:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.822739.1236709 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PBj-00049n-AZ; Sun, 20 Oct 2024 06:13:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 822739.1236709; Sun, 20 Oct 2024 06:13:15 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PBj-00049f-83; Sun, 20 Oct 2024 06:13:15 +0000
Received: by outflank-mailman (input) for mailman id 822739;
 Sun, 20 Oct 2024 06:13: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 1t2PBh-00049V-Pw
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:13: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 1t2PBh-0007yH-PF
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:13:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t2PBh-0002nL-OQ
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:13:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=1K8ywelG060rMHyrUGL1g4Sh24HeR6ygIZA596MKLPA=; b=ClGjXuHVYvfIKPiTCOOL5Alwyh
	M/IAc6rhXvfHaQCm73iEcimqMRtP0N57TwaSicum1ft1AloCNANY8V+e9IEOizRCudVf6AnooCrCu
	tf5QeuVdopLhTyqp3YztrrlQ5v/L8TB7PwcDAhhBwgPGflUxLsbpgRUrMPOtXiMp66RQ=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Further simplify CR4 handling in dom0_construct_pv()
Message-Id: <E1t2PBh-0002nL-OQ@xenbits.xenproject.org>
Date: Sun, 20 Oct 2024 06:13:13 +0000

commit 4c21b6affb4c5a3afe22cbc144362091de063366
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Fri Aug 30 18:49:53 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Fri Oct 18 11:30:34 2024 +0100

    x86/boot: Further simplify CR4 handling in dom0_construct_pv()
    
    The logic would be more robust disabling SMAP based on its precense in CR4,
    rather than SMAP's accociation with a synthetic feature.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/pv/dom0_build.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 262edb6bf2..ee9ecdc2ab 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -1057,6 +1057,7 @@ int __init dom0_construct_pv(struct domain *d,
                              module_t *initrd,
                              const char *cmdline)
 {
+    unsigned long cr4 = read_cr4();
     int rc;
 
     /*
@@ -1064,19 +1065,19 @@ int __init dom0_construct_pv(struct domain *d,
      * prevents us needing to write construct_dom0() in terms of
      * copy_{to,from}_user().
      */
-    if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
+    if ( cr4 & X86_CR4_SMAP )
     {
         if ( IS_ENABLED(CONFIG_PV32) )
             cr4_pv32_mask &= ~X86_CR4_SMAP;
 
-        write_cr4(read_cr4() & ~X86_CR4_SMAP);
+        write_cr4(cr4 & ~X86_CR4_SMAP);
     }
 
     rc = dom0_construct(d, image, image_headroom, initrd, cmdline);
 
-    if ( boot_cpu_has(X86_FEATURE_XEN_SMAP) )
+    if ( cr4 & X86_CR4_SMAP )
     {
-        write_cr4(read_cr4() | X86_CR4_SMAP);
+        write_cr4(cr4);
 
         if ( IS_ENABLED(CONFIG_PV32) )
             cr4_pv32_mask |= X86_CR4_SMAP;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Oct 20 06:13:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 20 Oct 2024 06:13:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.822740.1236712 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PBt-0004CP-C6; Sun, 20 Oct 2024 06:13:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 822740.1236712; Sun, 20 Oct 2024 06:13:25 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PBt-0004CI-9U; Sun, 20 Oct 2024 06:13:25 +0000
Received: by outflank-mailman (input) for mailman id 822740;
 Sun, 20 Oct 2024 06:13: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 1t2PBr-0004C8-Ut
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:13: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 1t2PBr-0007zv-U9
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:13:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t2PBr-0002py-TR
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:13:23 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=QhXIu/Gropx4mlHwNPbxnJLG+qtCqVtXJVsiDU4fmwE=; b=aDh5wVJZAUnQfyhVPvxt3v7/q3
	F4lazkd5e36O8eIupvoN5Pi0qzf7AKi4+5b9WRmdqEdWS3VzJP2j9h4Fod159FLowcNnhmLQCB11h
	9nepVPuw/FFsMEh8JZ/H3b5GqQANd1kpLHA0PkOSNl1Z4e7Z/+u7a4RH4hrUdLrueVgA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Update deprecated SPDX license identifiers
Message-Id: <E1t2PBr-0002py-TR@xenbits.xenproject.org>
Date: Sun, 20 Oct 2024 06:13:23 +0000

commit 0710b38921ec6740d75148b6b400b6aa44314d2d
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Fri Oct 18 14:57:25 2024 +0100
Commit:     Julien Grall <julien@xen.org>
CommitDate: Fri Oct 18 23:34:11 2024 +0100

    Update deprecated SPDX license identifiers
    
    As specified in LICENSES/GPL-2.0:
    - GPL-2.0 -> GPL-2.0-only;
    - GPL-2.0+ -> GPL-2.0-or-later.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com> [RISC-V]
---
 CODING_STYLE                                 | 2 +-
 xen/arch/arm/alternative.c                   | 2 +-
 xen/arch/arm/arm32/mmu/mm.c                  | 2 +-
 xen/arch/arm/arm64/mmu/mm.c                  | 2 +-
 xen/arch/arm/cpuerrata.c                     | 2 +-
 xen/arch/arm/cpufeature.c                    | 2 +-
 xen/arch/arm/dm.c                            | 2 +-
 xen/arch/arm/domain_build.c                  | 2 +-
 xen/arch/arm/domctl.c                        | 2 +-
 xen/arch/arm/early_printk.c                  | 2 +-
 xen/arch/arm/gic-v3-its.c                    | 2 +-
 xen/arch/arm/gic-v3-lpi.c                    | 2 +-
 xen/arch/arm/guest_atomics.c                 | 2 +-
 xen/arch/arm/guest_walk.c                    | 2 +-
 xen/arch/arm/guestcopy.c                     | 2 +-
 xen/arch/arm/hvm.c                           | 2 +-
 xen/arch/arm/include/asm/nospec.h            | 2 +-
 xen/arch/arm/ioreq.c                         | 2 +-
 xen/arch/arm/kernel.c                        | 2 +-
 xen/arch/arm/livepatch.c                     | 2 +-
 xen/arch/arm/mem_access.c                    | 2 +-
 xen/arch/arm/mmu/p2m.c                       | 2 +-
 xen/arch/arm/monitor.c                       | 2 +-
 xen/arch/arm/p2m.c                           | 2 +-
 xen/arch/arm/physdev.c                       | 2 +-
 xen/arch/arm/platform_hypercall.c            | 2 +-
 xen/arch/arm/shutdown.c                      | 2 +-
 xen/arch/arm/smp.c                           | 2 +-
 xen/arch/arm/sysctl.c                        | 2 +-
 xen/arch/arm/vgic-v3-its.c                   | 2 +-
 xen/arch/arm/vm_event.c                      | 2 +-
 xen/arch/arm/vpl011.c                        | 2 +-
 xen/arch/arm/vsmc.c                          | 2 +-
 xen/arch/riscv/early_printk.c                | 2 +-
 xen/arch/riscv/include/asm/acpi.h            | 2 +-
 xen/arch/riscv/include/asm/bitops.h          | 2 +-
 xen/arch/riscv/include/asm/bug.h             | 2 +-
 xen/arch/riscv/include/asm/cache.h           | 2 +-
 xen/arch/riscv/include/asm/string.h          | 2 +-
 xen/arch/x86/cpu/mcheck/intel-nonfatal.c     | 2 +-
 xen/arch/x86/debug.c                         | 2 +-
 xen/arch/x86/hvm/svm/nestedhvm.h             | 2 +-
 xen/arch/x86/hvm/svm/svm.h                   | 2 +-
 xen/arch/x86/include/asm/gdbsx.h             | 2 +-
 xen/arch/x86/include/asm/guest/hyperv-tlfs.h | 2 +-
 xen/arch/x86/include/asm/intel-family.h      | 2 +-
 xen/arch/x86/include/asm/nospec.h            | 2 +-
 xen/arch/x86/include/asm/prot-key.h          | 2 +-
 xen/common/device-tree/bootfdt.c             | 2 +-
 xen/common/sched/boot-cpupool.c              | 2 +-
 xen/include/asm-generic/atomic-ops.h         | 2 +-
 xen/include/asm-generic/monitor.h            | 2 +-
 xen/include/xen/alternative-call.h           | 2 +-
 xen/include/xen/nospec.h                     | 2 +-
 xen/include/xen/unaligned.h                  | 2 +-
 xen/tools/kconfig/expr.h                     | 2 +-
 xen/tools/kconfig/images.h                   | 2 +-
 xen/tools/kconfig/lexer.l                    | 2 +-
 xen/tools/kconfig/list.h                     | 2 +-
 xen/tools/kconfig/lkc.h                      | 2 +-
 xen/tools/kconfig/lkc_proto.h                | 2 +-
 xen/tools/kconfig/lxdialog/checklist.c       | 2 +-
 xen/tools/kconfig/lxdialog/dialog.h          | 2 +-
 xen/tools/kconfig/lxdialog/inputbox.c        | 2 +-
 xen/tools/kconfig/lxdialog/menubox.c         | 2 +-
 xen/tools/kconfig/lxdialog/textbox.c         | 2 +-
 xen/tools/kconfig/lxdialog/util.c            | 2 +-
 xen/tools/kconfig/lxdialog/yesno.c           | 2 +-
 xen/tools/kconfig/nconf.h                    | 2 +-
 xen/tools/kconfig/parser.y                   | 2 +-
 xen/tools/kconfig/qconf.h                    | 2 +-
 71 files changed, 71 insertions(+), 71 deletions(-)

diff --git a/CODING_STYLE b/CODING_STYLE
index 554c69a16a..e3b1da6048 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -20,7 +20,7 @@ SPDX
 New files should start with a single-line SPDX comment to express the
 license, e.g.:
 
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 
 See LICENSES/ for a list of licenses and SPDX tags currently used.
 
diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c
index c56caba010..d99b507093 100644
--- a/xen/arch/arm/alternative.c
+++ b/xen/arch/arm/alternative.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * alternative runtime patching
  * inspired by the x86 version
diff --git a/xen/arch/arm/arm32/mmu/mm.c b/xen/arch/arm/arm32/mmu/mm.c
index 30a7aa1e8e..063611412b 100644
--- a/xen/arch/arm/arm32/mmu/mm.c
+++ b/xen/arch/arm/arm32/mmu/mm.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 
 #include <xen/init.h>
 #include <xen/lib.h>
diff --git a/xen/arch/arm/arm64/mmu/mm.c b/xen/arch/arm/arm64/mmu/mm.c
index 0de4f3c079..671eaadbc1 100644
--- a/xen/arch/arm/arm64/mmu/mm.c
+++ b/xen/arch/arm/arm64/mmu/mm.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 
 #include <xen/init.h>
 #include <xen/mm.h>
diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
index afd0605922..eef9c0ea0e 100644
--- a/xen/arch/arm/cpuerrata.c
+++ b/xen/arch/arm/cpuerrata.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #include <xen/cpu.h>
 #include <xen/cpumask.h>
 #include <xen/init.h>
diff --git a/xen/arch/arm/cpufeature.c b/xen/arch/arm/cpufeature.c
index b45dbe3c66..1a80738571 100644
--- a/xen/arch/arm/cpufeature.c
+++ b/xen/arch/arm/cpufeature.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Contains CPU feature definitions
  *
diff --git a/xen/arch/arm/dm.c b/xen/arch/arm/dm.c
index 5569efa121..773a0a2592 100644
--- a/xen/arch/arm/dm.c
+++ b/xen/arch/arm/dm.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (c) 2019 Arm ltd.
  */
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 669970c86f..2c30792de8 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #include <xen/init.h>
 #include <xen/compile.h>
 #include <xen/lib.h>
diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c
index 12a12ee781..9d047065ba 100644
--- a/xen/arch/arm/domctl.c
+++ b/xen/arch/arm/domctl.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /******************************************************************************
  * Arch-specific domctl.c
  *
diff --git a/xen/arch/arm/early_printk.c b/xen/arch/arm/early_printk.c
index 03cbe0fb88..9c54f77c78 100644
--- a/xen/arch/arm/early_printk.c
+++ b/xen/arch/arm/early_printk.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * printk() for use before the final page tables are setup.
  *
diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
index 55bed3fe87..5fd83af25a 100644
--- a/xen/arch/arm/gic-v3-its.c
+++ b/xen/arch/arm/gic-v3-its.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * xen/arch/arm/gic-v3-its.c
  *
diff --git a/xen/arch/arm/gic-v3-lpi.c b/xen/arch/arm/gic-v3-lpi.c
index eb0a5535e4..de4b0eb4a4 100644
--- a/xen/arch/arm/gic-v3-lpi.c
+++ b/xen/arch/arm/gic-v3-lpi.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * xen/arch/arm/gic-v3-lpi.c
  *
diff --git a/xen/arch/arm/guest_atomics.c b/xen/arch/arm/guest_atomics.c
index 6ba77f082d..678b57d197 100644
--- a/xen/arch/arm/guest_atomics.c
+++ b/xen/arch/arm/guest_atomics.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * arch/arm/guest_atomics.c
  */
diff --git a/xen/arch/arm/guest_walk.c b/xen/arch/arm/guest_walk.c
index 2f7d3a0da7..09fe486598 100644
--- a/xen/arch/arm/guest_walk.c
+++ b/xen/arch/arm/guest_walk.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Guest page table walk
  * Copyright (c) 2017 Sergej Proskurin <proskurin@sec.in.tum.de>
diff --git a/xen/arch/arm/guestcopy.c b/xen/arch/arm/guestcopy.c
index 6716b03561..497e785ec4 100644
--- a/xen/arch/arm/guestcopy.c
+++ b/xen/arch/arm/guestcopy.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #include <xen/domain_page.h>
 #include <xen/guest_access.h>
 #include <xen/lib.h>
diff --git a/xen/arch/arm/hvm.c b/xen/arch/arm/hvm.c
index 0989309fea..86e49bf474 100644
--- a/xen/arch/arm/hvm.c
+++ b/xen/arch/arm/hvm.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * arch/arm/hvm.c
  *
diff --git a/xen/arch/arm/include/asm/nospec.h b/xen/arch/arm/include/asm/nospec.h
index efac51fc03..9c70eed605 100644
--- a/xen/arch/arm/include/asm/nospec.h
+++ b/xen/arch/arm/include/asm/nospec.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
 
 #ifndef _ASM_ARM_NOSPEC_H
diff --git a/xen/arch/arm/ioreq.c b/xen/arch/arm/ioreq.c
index 2e829d2e7f..b4211f0159 100644
--- a/xen/arch/arm/ioreq.c
+++ b/xen/arch/arm/ioreq.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * arm/ioreq.c: hardware virtual machine I/O emulation
  *
diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index 674388fa11..669d143cee 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Kernel image loading.
  *
diff --git a/xen/arch/arm/livepatch.c b/xen/arch/arm/livepatch.c
index bbca1e5a5e..037746d952 100644
--- a/xen/arch/arm/livepatch.c
+++ b/xen/arch/arm/livepatch.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  *  Copyright (C) 2016 Citrix Systems R&D Ltd.
  */
diff --git a/xen/arch/arm/mem_access.c b/xen/arch/arm/mem_access.c
index 31db846354..0ec3462364 100644
--- a/xen/arch/arm/mem_access.c
+++ b/xen/arch/arm/mem_access.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * arch/arm/mem_access.c
  *
diff --git a/xen/arch/arm/mmu/p2m.c b/xen/arch/arm/mmu/p2m.c
index 1725cca649..bfa312cc8a 100644
--- a/xen/arch/arm/mmu/p2m.c
+++ b/xen/arch/arm/mmu/p2m.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #include <xen/cpu.h>
 #include <xen/domain_page.h>
 #include <xen/ioreq.h>
diff --git a/xen/arch/arm/monitor.c b/xen/arch/arm/monitor.c
index 6c93a9e993..49f5df8513 100644
--- a/xen/arch/arm/monitor.c
+++ b/xen/arch/arm/monitor.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * arch/arm/monitor.c
  *
diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 2465c266e9..65b70955e3 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #include <xen/iocap.h>
 #include <xen/lib.h>
 #include <xen/sched.h>
diff --git a/xen/arch/arm/physdev.c b/xen/arch/arm/physdev.c
index 7b1682ee10..d63a8bf5ae 100644
--- a/xen/arch/arm/physdev.c
+++ b/xen/arch/arm/physdev.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /******************************************************************************
  * Arch-specific physdev.c
  *
diff --git a/xen/arch/arm/platform_hypercall.c b/xen/arch/arm/platform_hypercall.c
index fde4bc3e58..ac55622426 100644
--- a/xen/arch/arm/platform_hypercall.c
+++ b/xen/arch/arm/platform_hypercall.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /******************************************************************************
  * platform_hypercall.c
  *
diff --git a/xen/arch/arm/shutdown.c b/xen/arch/arm/shutdown.c
index 205a5e7f8c..c9778e5786 100644
--- a/xen/arch/arm/shutdown.c
+++ b/xen/arch/arm/shutdown.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #include <xen/console.h>
 #include <xen/cpu.h>
 #include <xen/delay.h>
diff --git a/xen/arch/arm/smp.c b/xen/arch/arm/smp.c
index bb65a08fc1..c11bba93ad 100644
--- a/xen/arch/arm/smp.c
+++ b/xen/arch/arm/smp.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #include <xen/mm.h>
 #include <asm/system.h>
 #include <asm/smp.h>
diff --git a/xen/arch/arm/sysctl.c b/xen/arch/arm/sysctl.c
index 5cda0dc674..32cab4feff 100644
--- a/xen/arch/arm/sysctl.c
+++ b/xen/arch/arm/sysctl.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /******************************************************************************
  * Arch-specific sysctl.c
  *
diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c
index 70b5aeb822..c65c1dbf52 100644
--- a/xen/arch/arm/vgic-v3-its.c
+++ b/xen/arch/arm/vgic-v3-its.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * xen/arch/arm/vgic-v3-its.c
  *
diff --git a/xen/arch/arm/vm_event.c b/xen/arch/arm/vm_event.c
index ccfd25bbbc..31812d9da3 100644
--- a/xen/arch/arm/vm_event.c
+++ b/xen/arch/arm/vm_event.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * arch/arm/vm_event.c
  *
diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c
index 7856b4b5f5..1fc3114cce 100644
--- a/xen/arch/arm/vpl011.c
+++ b/xen/arch/arm/vpl011.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * arch/arm/vpl011.c
  *
diff --git a/xen/arch/arm/vsmc.c b/xen/arch/arm/vsmc.c
index 7f2f5eb9ce..f679cced7f 100644
--- a/xen/arch/arm/vsmc.c
+++ b/xen/arch/arm/vsmc.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * xen/arch/arm/vsmc.c
  *
diff --git a/xen/arch/riscv/early_printk.c b/xen/arch/riscv/early_printk.c
index 610c814f54..634141354c 100644
--- a/xen/arch/riscv/early_printk.c
+++ b/xen/arch/riscv/early_printk.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * RISC-V early printk using SBI
  *
diff --git a/xen/arch/riscv/include/asm/acpi.h b/xen/arch/riscv/include/asm/acpi.h
index f0b5e90969..0c553bd6b8 100644
--- a/xen/arch/riscv/include/asm/acpi.h
+++ b/xen/arch/riscv/include/asm/acpi.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 
 #ifndef ASM__RISCV__ACPI_H
 #define ASM__RISCV__ACPI_H
diff --git a/xen/arch/riscv/include/asm/bitops.h b/xen/arch/riscv/include/asm/bitops.h
index 9a6f576187..d22eec1e87 100644
--- a/xen/arch/riscv/include/asm/bitops.h
+++ b/xen/arch/riscv/include/asm/bitops.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /* Copyright (C) 2012 Regents of the University of California */
 
 #ifndef ASM__RISCV__BITOPS_H
diff --git a/xen/arch/riscv/include/asm/bug.h b/xen/arch/riscv/include/asm/bug.h
index fa18dba20e..c395b809c6 100644
--- a/xen/arch/riscv/include/asm/bug.h
+++ b/xen/arch/riscv/include/asm/bug.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (C) 2012 Regents of the University of California
  * Copyright (C) 2021-2023 Vates
diff --git a/xen/arch/riscv/include/asm/cache.h b/xen/arch/riscv/include/asm/cache.h
index 9a9e5162ab..d4cf1ac8e2 100644
--- a/xen/arch/riscv/include/asm/cache.h
+++ b/xen/arch/riscv/include/asm/cache.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 
 #ifndef ASM__RISCV__CACHE_H
 #define ASM__RISCV__CACHE_H
diff --git a/xen/arch/riscv/include/asm/string.h b/xen/arch/riscv/include/asm/string.h
index 75a2048fb1..a20af81f67 100644
--- a/xen/arch/riscv/include/asm/string.h
+++ b/xen/arch/riscv/include/asm/string.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 
 #ifndef ASM__RISCV__STRING_H
 #define ASM__RISCV__STRING_H
diff --git a/xen/arch/x86/cpu/mcheck/intel-nonfatal.c b/xen/arch/x86/cpu/mcheck/intel-nonfatal.c
index 092a828812..607c0f88c9 100644
--- a/xen/arch/x86/cpu/mcheck/intel-nonfatal.c
+++ b/xen/arch/x86/cpu/mcheck/intel-nonfatal.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Non Fatal Machine Check Exception Reporting
  * (C) Copyright 2002 Dave Jones. <davej@codemonkey.org.uk>
diff --git a/xen/arch/x86/debug.c b/xen/arch/x86/debug.c
index b10f1f12b6..e99e663ba5 100644
--- a/xen/arch/x86/debug.c
+++ b/xen/arch/x86/debug.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (C) 2023 XenServer.
  */
diff --git a/xen/arch/x86/hvm/svm/nestedhvm.h b/xen/arch/x86/hvm/svm/nestedhvm.h
index 43245e13de..9bfed5ffd7 100644
--- a/xen/arch/x86/hvm/svm/nestedhvm.h
+++ b/xen/arch/x86/hvm/svm/nestedhvm.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * nestedsvm.h: Nested Virtualization
  *
diff --git a/xen/arch/x86/hvm/svm/svm.h b/xen/arch/x86/hvm/svm/svm.h
index 8dbf37ff49..beeaaab4f7 100644
--- a/xen/arch/x86/hvm/svm/svm.h
+++ b/xen/arch/x86/hvm/svm/svm.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * svm.h: SVM Architecture related definitions
  *
diff --git a/xen/arch/x86/include/asm/gdbsx.h b/xen/arch/x86/include/asm/gdbsx.h
index e906be9ea3..6315a7cfeb 100644
--- a/xen/arch/x86/include/asm/gdbsx.h
+++ b/xen/arch/x86/include/asm/gdbsx.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #ifndef __X86_GDBX_H__
 #define __X86_GDBX_H__
 
diff --git a/xen/arch/x86/include/asm/guest/hyperv-tlfs.h b/xen/arch/x86/include/asm/guest/hyperv-tlfs.h
index a6915ad731..79cfc90dd8 100644
--- a/xen/arch/x86/include/asm/guest/hyperv-tlfs.h
+++ b/xen/arch/x86/include/asm/guest/hyperv-tlfs.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 
 /*
  * This file contains definitions from Hyper-V Hypervisor Top-Level Functional
diff --git a/xen/arch/x86/include/asm/intel-family.h b/xen/arch/x86/include/asm/intel-family.h
index d44dd3f69f..ab20cce124 100644
--- a/xen/arch/x86/include/asm/intel-family.h
+++ b/xen/arch/x86/include/asm/intel-family.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #ifndef _ASM_X86_INTEL_FAMILY_H
 #define _ASM_X86_INTEL_FAMILY_H
 
diff --git a/xen/arch/x86/include/asm/nospec.h b/xen/arch/x86/include/asm/nospec.h
index e058a3bb0e..150e78e884 100644
--- a/xen/arch/x86/include/asm/nospec.h
+++ b/xen/arch/x86/include/asm/nospec.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
 
 #ifndef _ASM_X86_NOSPEC_H
diff --git a/xen/arch/x86/include/asm/prot-key.h b/xen/arch/x86/include/asm/prot-key.h
index 0dcd31b7ea..0cbecc2df4 100644
--- a/xen/arch/x86/include/asm/prot-key.h
+++ b/xen/arch/x86/include/asm/prot-key.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (c) 2021-2022 Citrix Systems Ltd.
  */
diff --git a/xen/common/device-tree/bootfdt.c b/xen/common/device-tree/bootfdt.c
index 911a630e7d..927f59c64b 100644
--- a/xen/common/device-tree/bootfdt.c
+++ b/xen/common/device-tree/bootfdt.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Early Device Tree
  *
diff --git a/xen/common/sched/boot-cpupool.c b/xen/common/sched/boot-cpupool.c
index feeac3b704..641f3495cb 100644
--- a/xen/common/sched/boot-cpupool.c
+++ b/xen/common/sched/boot-cpupool.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * xen/common/boot_cpupools.c
  *
diff --git a/xen/include/asm-generic/atomic-ops.h b/xen/include/asm-generic/atomic-ops.h
index 98dd907942..769583b766 100644
--- a/xen/include/asm-generic/atomic-ops.h
+++ b/xen/include/asm-generic/atomic-ops.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * The header provides default implementations for every xen/atomic.h-provided
  * forward inline declaration that can be synthesized from other atomic
diff --git a/xen/include/asm-generic/monitor.h b/xen/include/asm-generic/monitor.h
index 1ade289099..cad2b6ff24 100644
--- a/xen/include/asm-generic/monitor.h
+++ b/xen/include/asm-generic/monitor.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * include/asm-generic/monitor.h
  *
diff --git a/xen/include/xen/alternative-call.h b/xen/include/xen/alternative-call.h
index 10f7d7637e..62672b7324 100644
--- a/xen/include/xen/alternative-call.h
+++ b/xen/include/xen/alternative-call.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #ifndef XEN_ALTERNATIVE_CALL
 #define XEN_ALTERNATIVE_CALL
 
diff --git a/xen/include/xen/nospec.h b/xen/include/xen/nospec.h
index 828dbd4e0a..c8167a8a24 100644
--- a/xen/include/xen/nospec.h
+++ b/xen/include/xen/nospec.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /* Copyright(c) 2018 Linus Torvalds. All rights reserved. */
 /* Copyright(c) 2018 Alexei Starovoitov. All rights reserved. */
 /* Copyright(c) 2018 Intel Corporation. All rights reserved. */
diff --git a/xen/include/xen/unaligned.h b/xen/include/xen/unaligned.h
index d9bb599e65..8c8b08338b 100644
--- a/xen/include/xen/unaligned.h
+++ b/xen/include/xen/unaligned.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #ifndef __XEN_UNALIGNED_H__
 #define __XEN_UNALIGNED_H__
 
diff --git a/xen/tools/kconfig/expr.h b/xen/tools/kconfig/expr.h
index 017843c9a4..fd08add33f 100644
--- a/xen/tools/kconfig/expr.h
+++ b/xen/tools/kconfig/expr.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
  */
diff --git a/xen/tools/kconfig/images.h b/xen/tools/kconfig/images.h
index d8ff614bd0..565466511d 100644
--- a/xen/tools/kconfig/images.h
+++ b/xen/tools/kconfig/images.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
  */
diff --git a/xen/tools/kconfig/lexer.l b/xen/tools/kconfig/lexer.l
index 4b7339ff4c..1e57543900 100644
--- a/xen/tools/kconfig/lexer.l
+++ b/xen/tools/kconfig/lexer.l
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
  */
diff --git a/xen/tools/kconfig/list.h b/xen/tools/kconfig/list.h
index 45cb237ab7..979cd516d6 100644
--- a/xen/tools/kconfig/list.h
+++ b/xen/tools/kconfig/list.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #ifndef LIST_H
 #define LIST_H
 
diff --git a/xen/tools/kconfig/lkc.h b/xen/tools/kconfig/lkc.h
index 4fb16f3166..18282e7b0b 100644
--- a/xen/tools/kconfig/lkc.h
+++ b/xen/tools/kconfig/lkc.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
  */
diff --git a/xen/tools/kconfig/lkc_proto.h b/xen/tools/kconfig/lkc_proto.h
index f9ab98238a..7598a2ef20 100644
--- a/xen/tools/kconfig/lkc_proto.h
+++ b/xen/tools/kconfig/lkc_proto.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 #include <stdarg.h>
 
 /* confdata.c */
diff --git a/xen/tools/kconfig/lxdialog/checklist.c b/xen/tools/kconfig/lxdialog/checklist.c
index fd161cfff1..29960ed000 100644
--- a/xen/tools/kconfig/lxdialog/checklist.c
+++ b/xen/tools/kconfig/lxdialog/checklist.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  checklist.c -- implements the checklist box
  *
diff --git a/xen/tools/kconfig/lxdialog/dialog.h b/xen/tools/kconfig/lxdialog/dialog.h
index 68b565e3c4..3930d93a4a 100644
--- a/xen/tools/kconfig/lxdialog/dialog.h
+++ b/xen/tools/kconfig/lxdialog/dialog.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 /*
  *  dialog.h -- common declarations for all dialog modules
  *
diff --git a/xen/tools/kconfig/lxdialog/inputbox.c b/xen/tools/kconfig/lxdialog/inputbox.c
index 1dcfb288ee..b8b6f15779 100644
--- a/xen/tools/kconfig/lxdialog/inputbox.c
+++ b/xen/tools/kconfig/lxdialog/inputbox.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  inputbox.c -- implements the input box
  *
diff --git a/xen/tools/kconfig/lxdialog/menubox.c b/xen/tools/kconfig/lxdialog/menubox.c
index 58c2f8afe5..4287745566 100644
--- a/xen/tools/kconfig/lxdialog/menubox.c
+++ b/xen/tools/kconfig/lxdialog/menubox.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  menubox.c -- implements the menu box
  *
diff --git a/xen/tools/kconfig/lxdialog/textbox.c b/xen/tools/kconfig/lxdialog/textbox.c
index 4e339b1266..b5987735b0 100644
--- a/xen/tools/kconfig/lxdialog/textbox.c
+++ b/xen/tools/kconfig/lxdialog/textbox.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  textbox.c -- implements the text box
  *
diff --git a/xen/tools/kconfig/lxdialog/util.c b/xen/tools/kconfig/lxdialog/util.c
index 1b490d4af0..0de2b05352 100644
--- a/xen/tools/kconfig/lxdialog/util.c
+++ b/xen/tools/kconfig/lxdialog/util.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  util.c
  *
diff --git a/xen/tools/kconfig/lxdialog/yesno.c b/xen/tools/kconfig/lxdialog/yesno.c
index bcaac9b7ba..ff1db42b3d 100644
--- a/xen/tools/kconfig/lxdialog/yesno.c
+++ b/xen/tools/kconfig/lxdialog/yesno.c
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0+
+// SPDX-License-Identifier: GPL-2.0-or-later
 /*
  *  yesno.c -- implements the yes/no box
  *
diff --git a/xen/tools/kconfig/nconf.h b/xen/tools/kconfig/nconf.h
index fa5245eb93..eab138b30d 100644
--- a/xen/tools/kconfig/nconf.h
+++ b/xen/tools/kconfig/nconf.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (C) 2008 Nir Tzachar <nir.tzachar@gmail.com>
  *
diff --git a/xen/tools/kconfig/parser.y b/xen/tools/kconfig/parser.y
index 822fc89fc8..5bac26bd91 100644
--- a/xen/tools/kconfig/parser.y
+++ b/xen/tools/kconfig/parser.y
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
  */
diff --git a/xen/tools/kconfig/qconf.h b/xen/tools/kconfig/qconf.h
index 45bfe9b2b9..61ecd5bdab 100644
--- a/xen/tools/kconfig/qconf.h
+++ b/xen/tools/kconfig/qconf.h
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0 */
+/* SPDX-License-Identifier: GPL-2.0-only */
 /*
  * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
  */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Oct 20 06:13:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 20 Oct 2024 06:13:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.822741.1236716 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PC2-0004FK-FX; Sun, 20 Oct 2024 06:13:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 822741.1236716; Sun, 20 Oct 2024 06:13:34 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PC2-0004FD-D6; Sun, 20 Oct 2024 06:13:34 +0000
Received: by outflank-mailman (input) for mailman id 822741;
 Sun, 20 Oct 2024 06:13: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 1t2PC2-0004F7-1U
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:13: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 1t2PC2-00080K-0l
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:13:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t2PC2-0002sV-02
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:13: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=sNCHT7uYQIXcvuyOoHI6+50TpHnxyiEflChmOA8is4E=; b=wCoSIaF3/ws8uMRM0Mm1OVds1B
	CmvmSmTq9BNotvW2mI65Fns1d5ETmDKM9PBnoM/5WgRYC5RI4p5JXqgdnrZSSm06WInR5Yt16vFEg
	uPxgCJTvlzYaYPpGSdFJk++Vji4khErytud5EN9pr5cmdqj/Iu74gyamqCdP3X5CqRws=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Add NXP LINFlexD UART Driver
Message-Id: <E1t2PC2-0002sV-02@xenbits.xenproject.org>
Date: Sun, 20 Oct 2024 06:13:34 +0000

commit 6ba3b1f8285fbca53c8f6eeb587a1364cbe17939
Author:     Andrei Cherechesu <andrei.cherechesu@nxp.com>
AuthorDate: Mon Sep 30 14:47:07 2024 +0300
Commit:     Julien Grall <julien@xen.org>
CommitDate: Fri Oct 18 23:37:33 2024 +0100

    xen/arm: Add NXP LINFlexD UART Driver
    
    The LINFlexD UART is an UART controller available on NXP S32
    processors family targeting automotive (for example: S32G2, S32G3,
    S32R).
    
    S32G3 Reference Manual:
    https://www.nxp.com/webapp/Download?colCode=RMS32G3.
    
    Signed-off-by: Andrei Cherechesu <andrei.cherechesu@nxp.com>
    Signed-off-by: Peter van der Perk <peter.vander.perk@nxp.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/include/asm/linflex-uart.h |  63 ++++++
 xen/drivers/char/Kconfig                |   8 +
 xen/drivers/char/Makefile               |   1 +
 xen/drivers/char/linflex-uart.c         | 381 ++++++++++++++++++++++++++++++++
 4 files changed, 453 insertions(+)

diff --git a/xen/arch/arm/include/asm/linflex-uart.h b/xen/arch/arm/include/asm/linflex-uart.h
new file mode 100644
index 0000000000..95dcbcb476
--- /dev/null
+++ b/xen/arch/arm/include/asm/linflex-uart.h
@@ -0,0 +1,63 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * xen/arch/arm/include/asm/linflex-uart.h
+ *
+ * Common constant definition between early printk and the UART driver
+ * for NXP LINFlexD UART.
+ *
+ * Andrei Cherechesu <andrei.cherechesu@nxp.com>
+ * Copyright 2018, 2021, 2024 NXP
+ */
+
+#ifndef __ASM_ARM_LINFLEX_UART_H
+#define __ASM_ARM_LINFLEX_UART_H
+
+/* 32-bit register offsets */
+#define LINCR1          (0x0)
+#define LINIER          (0x4)
+#define LINSR           (0x8)
+#define UARTCR          (0x10)
+#define UARTSR          (0x14)
+#define LINFBRR         (0x24)
+#define LINIBRR         (0x28)
+#define BDRL            (0x38)
+#define BDRM            (0x3C)
+#define UARTPTO         (0x50)
+
+#define LINCR1_INIT         BIT(0, U)
+#define LINCR1_MME          BIT(4, U)
+#define LINCR1_BF           BIT(7, U)
+
+#define LINSR_LINS          GENMASK(15, 12)
+#define LINSR_LINS_INIT     BIT(12, U)
+
+#define LINIER_DRIE         BIT(2, U)
+#define LINIER_DTIE         BIT(1, U)
+
+#define UARTCR_UART         BIT(0, U)
+#define UARTCR_WL0          BIT(1, U)
+#define UARTCR_PC0          BIT(3, U)
+#define UARTCR_TXEN         BIT(4, U)
+#define UARTCR_RXEN         BIT(5, U)
+#define UARTCR_PC1          BIT(6, U)
+#define UARTCR_TFBM         BIT(8, U)
+#define UARTCR_RFBM         BIT(9, U)
+#define UARTCR_RDFLRFC      GENMASK(12, 10)
+#define UARTCR_TDFLTFC      GENMASK(15, 13)
+#define UARTCR_ROSE         BIT(23, U)
+#define UARTCR_OSR_SHIFT    (24)
+#define UARTCR_OSR          GENMASK(27, UARTCR_OSR_SHIFT)
+
+#define UARTSR_DTFTFF       BIT(1, U)
+#define UARTSR_DRFRFE       BIT(2, U)
+
+#endif /* __ASM_ARM_LINFLEX_UART_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff --git a/xen/drivers/char/Kconfig b/xen/drivers/char/Kconfig
index 3f836ab301..e175d07c02 100644
--- a/xen/drivers/char/Kconfig
+++ b/xen/drivers/char/Kconfig
@@ -13,6 +13,14 @@ config HAS_CADENCE_UART
 	  This selects the Xilinx Zynq Cadence UART. If you have a Xilinx Zynq
 	  based board, say Y.
 
+config HAS_LINFLEX
+	bool "NXP LINFlexD UART driver"
+	default y
+	depends on ARM_64
+	help
+	  This selects the NXP LINFlexD UART. If you have an NXP S32G or S32R
+	  based board, say Y.
+
 config HAS_IMX_LPUART
 	bool "i.MX LPUART driver"
 	default y
diff --git a/xen/drivers/char/Makefile b/xen/drivers/char/Makefile
index e7e374775d..d3b987da1d 100644
--- a/xen/drivers/char/Makefile
+++ b/xen/drivers/char/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_HAS_SCIF) += scif-uart.o
 obj-$(CONFIG_HAS_EHCI) += ehci-dbgp.o
 obj-$(CONFIG_XHCI) += xhci-dbc.o
 obj-$(CONFIG_HAS_IMX_LPUART) += imx-lpuart.o
+obj-$(CONFIG_HAS_LINFLEX) += linflex-uart.o
 obj-$(CONFIG_ARM) += arm-uart.o
 obj-y += serial.o
 obj-$(CONFIG_XEN_GUEST) += xen_pv_console.o
diff --git a/xen/drivers/char/linflex-uart.c b/xen/drivers/char/linflex-uart.c
new file mode 100644
index 0000000000..2fa195cbf6
--- /dev/null
+++ b/xen/drivers/char/linflex-uart.c
@@ -0,0 +1,381 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * xen/drivers/char/linflex-uart.c
+ *
+ * Driver for NXP LINFlexD UART.
+ *
+ * Andrei Cherechesu <andrei.cherechesu@nxp.com>
+ * Copyright 2018, 2021-2022, 2024 NXP
+ */
+
+#include <xen/config.h>
+#include <xen/console.h>
+#include <xen/errno.h>
+#include <xen/init.h>
+#include <xen/irq.h>
+#include <xen/mm.h>
+#include <xen/serial.h>
+#include <asm/device.h>
+#include <asm/io.h>
+#include <asm/linflex-uart.h>
+
+#define LINFLEX_CLK_FREQ        (125000000)
+#define LINFLEX_MAX_BAUDRATE    (2000000)
+#define LINFLEX_BAUDRATE        (115200)
+#define LINFLEX_LDIV_MULTIPLIER (16)
+
+static struct linflex_uart {
+    uint32_t baud, clock_hz;
+    uint32_t irq;
+    char __iomem *regs;
+    struct irqaction irqaction;
+    struct vuart_info vuart;
+} linflex_com;
+
+static uint32_t linflex_uart_readl(const struct linflex_uart *uart,
+                                   uint32_t off)
+{
+    return readl(uart->regs + off);
+}
+
+static void linflex_uart_writel(const struct linflex_uart *uart, uint32_t off,
+                                uint32_t val)
+{
+    writel(val, uart->regs + off);
+}
+
+static void linflex_uart_writeb(const struct linflex_uart *uart, uint32_t off,
+                                uint8_t val)
+{
+    writeb(val, uart->regs + off);
+}
+
+static uint32_t linflex_uart_get_osr(uint32_t uartcr)
+{
+    return (uartcr & UARTCR_OSR) >> UARTCR_OSR_SHIFT;
+}
+
+static bool linflex_uart_tx_fifo_mode(const struct linflex_uart *uart)
+{
+    return !!(linflex_uart_readl(uart, UARTCR) & UARTCR_TFBM);
+}
+
+static bool linflex_uart_rx_fifo_mode(const struct linflex_uart *uart)
+{
+    return !!(linflex_uart_readl(uart, UARTCR) & UARTCR_RFBM);
+}
+
+static uint32_t linflex_uart_ldiv_multiplier(const struct linflex_uart *uart)
+{
+    uint32_t uartcr, mul = LINFLEX_LDIV_MULTIPLIER;
+
+    uartcr = linflex_uart_readl(uart, UARTCR);
+    if ( uartcr & UARTCR_ROSE )
+        mul = linflex_uart_get_osr(uartcr);
+
+    return mul;
+}
+
+static void linflex_uart_flush(struct serial_port *port)
+{
+    const struct linflex_uart *uart = port->uart;
+
+    if ( linflex_uart_tx_fifo_mode(uart) )
+        while ( linflex_uart_readl(uart, UARTCR) & UARTCR_TDFLTFC )
+            cpu_relax();
+
+    if ( linflex_uart_rx_fifo_mode(uart) )
+        while ( linflex_uart_readl(uart, UARTCR) & UARTCR_RDFLRFC )
+            cpu_relax();
+}
+
+static void __init linflex_uart_init_preirq(struct serial_port *port)
+{
+    struct linflex_uart *uart = port->uart;
+    uint32_t ibr, fbr, divisr, dividr, ctrl;
+
+    /* Disable RX/TX before init mode */
+    ctrl = linflex_uart_readl(uart, UARTCR);
+    ctrl &= ~(UARTCR_RXEN | UARTCR_TXEN);
+    linflex_uart_writel(uart, UARTCR, ctrl);
+
+    /*
+     * Smoothen the transition from early_printk by waiting
+     * for all pending characters to transmit
+     */
+    linflex_uart_flush(port);
+
+    /* Init mode */
+    ctrl = LINCR1_INIT;
+    linflex_uart_writel(uart, LINCR1, ctrl);
+
+    /* Waiting for init mode entry */
+    while ( (linflex_uart_readl(uart, LINSR) & LINSR_LINS) != LINSR_LINS_INIT )
+        cpu_relax();
+
+    /* Set Master Mode */
+    ctrl |= LINCR1_MME;
+    linflex_uart_writel(uart, LINCR1, ctrl);
+
+    if ( uart->baud > LINFLEX_MAX_BAUDRATE )
+        uart->baud = LINFLEX_MAX_BAUDRATE;
+
+    /* Provide data bits, parity, stop bit, etc */
+    divisr = uart->clock_hz;
+    dividr = uart->baud * linflex_uart_ldiv_multiplier(uart);
+
+    ibr = divisr / dividr;
+    fbr = ((divisr % dividr) * 16 / dividr) & 0xF;
+
+    linflex_uart_writel(uart, LINIBRR, ibr);
+    linflex_uart_writel(uart, LINFBRR, fbr);
+
+    /* Set preset timeout register value */
+    linflex_uart_writel(uart, UARTPTO, 0xF);
+
+    /* Setting UARTCR[UART] bit is required for writing other bits in UARTCR */
+    linflex_uart_writel(uart, UARTCR, UARTCR_UART);
+
+    /* 8 bit data, no parity, UART mode, Buffer mode */
+    linflex_uart_writel(uart, UARTCR, UARTCR_PC1 | UARTCR_PC0 | UARTCR_WL0 |
+                        UARTCR_UART);
+
+    /* end init mode */
+    ctrl = linflex_uart_readl(uart, LINCR1);
+    ctrl &= ~LINCR1_INIT;
+    linflex_uart_writel(uart, LINCR1, ctrl);
+
+    /* Enable RX/TX after exiting init mode */
+    ctrl = linflex_uart_readl(uart, UARTCR);
+    ctrl |= UARTCR_RXEN | UARTCR_TXEN;
+    linflex_uart_writel(uart, UARTCR, ctrl);
+}
+
+static void linflex_uart_interrupt(int irq, void *data)
+{
+    struct serial_port *port = data;
+    const struct linflex_uart *uart = port->uart;
+    uint32_t sts;
+
+    sts = linflex_uart_readl(uart, UARTSR);
+
+    if ( sts & UARTSR_DRFRFE )
+        serial_rx_interrupt(port);
+
+    if ( sts & UARTSR_DTFTFF )
+        serial_tx_interrupt(port);
+}
+
+static void __init linflex_uart_init_postirq(struct serial_port *port)
+{
+    struct linflex_uart *uart = port->uart;
+    uint32_t temp;
+
+    uart->irqaction.handler = linflex_uart_interrupt;
+    uart->irqaction.name = "linflex_uart";
+    uart->irqaction.dev_id = port;
+
+    if ( setup_irq(uart->irq, 0, &uart->irqaction) != 0 )
+    {
+        printk("linflex-uart: Failed to allocate IRQ %d\n", uart->irq);
+        return;
+    }
+
+    /* Enable interrupts */
+    temp = linflex_uart_readl(uart, LINIER);
+    temp |= (LINIER_DRIE | LINIER_DTIE);
+    linflex_uart_writel(uart, LINIER, temp);
+    printk("linflex-uart: IRQ %d enabled\n", uart->irq);
+}
+
+static int linflex_uart_tx_ready(struct serial_port *port)
+{
+    const struct linflex_uart *uart = port->uart;
+
+    if ( linflex_uart_tx_fifo_mode(uart) )
+        return (linflex_uart_readl(uart, UARTSR) & UARTSR_DTFTFF) == 0 ? 1 : 0;
+
+    /*
+     * Buffer Mode => TX is waited to be ready after sending a char,
+     * so we can assume it is always ready before.
+     */
+    return 1;
+}
+
+static void linflex_uart_putc(struct serial_port *port, char c)
+{
+    const struct linflex_uart *uart = port->uart;
+    uint32_t uartsr;
+
+    if ( c == '\n' )
+        linflex_uart_putc(port, '\r');
+
+    linflex_uart_writeb(uart, BDRL, c);
+
+    /* Buffer Mode */
+    if ( !linflex_uart_tx_fifo_mode(uart) )
+    {
+        while ( (linflex_uart_readl(uart, UARTSR) & UARTSR_DTFTFF) == 0 )
+                cpu_relax();
+
+        uartsr = linflex_uart_readl(uart, UARTSR) | (UARTSR_DTFTFF);
+        linflex_uart_writel(uart, UARTSR, uartsr);
+    }
+}
+
+static int linflex_uart_getc(struct serial_port *port, char *pc)
+{
+    const struct linflex_uart *uart = port->uart;
+    uint32_t ch, uartsr, rx_fifo_mode;
+
+    rx_fifo_mode = linflex_uart_rx_fifo_mode(uart);
+
+    if ( rx_fifo_mode )
+        while ( linflex_uart_readl(uart, UARTSR) & UARTSR_DRFRFE )
+            cpu_relax();
+    else
+        while ( !(linflex_uart_readl(uart, UARTSR) & UARTSR_DRFRFE) )
+            cpu_relax();
+
+    ch = linflex_uart_readl(uart, BDRM);
+    *pc = ch & 0xff;
+
+    if ( !rx_fifo_mode ) {
+        uartsr = linflex_uart_readl(uart, UARTSR) | UARTSR_DRFRFE;
+        linflex_uart_writel(uart, UARTSR, uartsr);
+    }
+
+    return 1;
+}
+
+static int __init linflex_uart_irq(struct serial_port *port)
+{
+    const struct linflex_uart *uart = port->uart;
+
+    return ((uart->irq > 0) ? uart->irq : -1);
+}
+
+static const struct vuart_info *linflex_vuart_info(struct serial_port *port)
+{
+    const struct linflex_uart *uart = port->uart;
+
+    return &uart->vuart;
+}
+
+static void linflex_uart_start_tx(struct serial_port *port)
+{
+    const struct linflex_uart *uart = port->uart;
+    uint32_t temp;
+
+    temp = linflex_uart_readl(uart, LINIER);
+    linflex_uart_writel(uart, LINIER, temp | LINIER_DTIE);
+}
+
+static void linflex_uart_stop_tx(struct serial_port *port)
+{
+    const struct linflex_uart *uart = port->uart;
+    uint32_t temp;
+
+    temp = linflex_uart_readl(uart, LINIER);
+    temp &= ~(LINIER_DTIE);
+    linflex_uart_writel(uart, LINIER, temp);
+}
+
+static struct uart_driver __read_mostly linflex_uart_driver = {
+    .init_preirq = linflex_uart_init_preirq,
+    .init_postirq = linflex_uart_init_postirq,
+    .tx_ready = linflex_uart_tx_ready,
+    .putc = linflex_uart_putc,
+    .flush = linflex_uart_flush,
+    .getc = linflex_uart_getc,
+    .irq = linflex_uart_irq,
+    .start_tx = linflex_uart_start_tx,
+    .stop_tx = linflex_uart_stop_tx,
+    .vuart_info = linflex_vuart_info,
+};
+
+static int __init linflex_uart_init(struct dt_device_node *dev, const void *data)
+{
+    const char *config = data;
+    struct linflex_uart *uart;
+    paddr_t addr, size;
+    uint32_t baud = 0;
+    int res;
+
+    if ( strcmp(config, "") )
+    {
+        baud = simple_strtoul(config, &config, 10);
+        if ( strcmp(config, "") )
+            printk("linflex-uart: Only baud rate is configurable, discarding other options: %s\n",
+                   config);
+    }
+    else
+    {
+        /* Configuration not provided, use a default one */
+        baud = LINFLEX_BAUDRATE;
+        printk("linflex-uart: Baud rate not provided, using %d as default\n",
+               baud);
+    }
+
+    uart = &linflex_com;
+
+    res = dt_device_get_paddr(dev, 0, &addr, &size);
+    if ( res )
+    {
+        printk("linflex-uart: Unable to retrieve the base address of the UART\n");
+        return res;
+    }
+
+    res = platform_get_irq(dev, 0);
+    if ( res < 0 )
+    {
+        printk("linflex-uart: Unable to retrieve the IRQ\n");
+        return -EINVAL;
+    }
+    uart->irq = res;
+
+    uart->regs = ioremap_nocache(addr, size);
+    if ( !uart->regs )
+    {
+        printk("linflex-uart: Unable to map the UART memory\n");
+        return -ENOMEM;
+    }
+
+    uart->baud = baud;
+    uart->clock_hz = LINFLEX_CLK_FREQ;
+
+    uart->vuart.base_addr = addr;
+    uart->vuart.size = size;
+    uart->vuart.data_off = BDRL;
+    uart->vuart.status_off = UARTSR;
+    uart->vuart.status = UARTSR_DTFTFF;
+
+    /* Register with generic serial driver */
+    serial_register_uart(SERHND_DTUART, &linflex_uart_driver, uart);
+
+    dt_device_set_used_by(dev, DOMID_XEN);
+
+    return 0;
+}
+
+static const struct dt_device_match linflex_uart_dt_compat[] __initconst =
+{
+    DT_MATCH_COMPATIBLE("nxp,s32g2-linflexuart"),
+    DT_MATCH_COMPATIBLE("nxp,s32g3-linflexuart"),
+    DT_MATCH_COMPATIBLE("fsl,s32v234-linflexuart"),
+    { /* sentinel */ },
+};
+
+DT_DEVICE_START(linflex_uart, "NXP LINFlexD UART", DEVICE_SERIAL)
+    .dt_match = linflex_uart_dt_compat,
+    .init = linflex_uart_init,
+DT_DEVICE_END
+
+/*
+ * 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 Sun Oct 20 06:13:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 20 Oct 2024 06:13:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.822742.1236720 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PCC-0004Hf-HD; Sun, 20 Oct 2024 06:13:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 822742.1236720; Sun, 20 Oct 2024 06:13:44 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PCC-0004HY-Eb; Sun, 20 Oct 2024 06:13:44 +0000
Received: by outflank-mailman (input) for mailman id 822742;
 Sun, 20 Oct 2024 06:13: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 1t2PCC-0004HS-4J
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:13: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 1t2PCC-00080R-3Y
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:13:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t2PCC-0002tv-2s
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:13: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=vofCq9pTHllqfnMlUxUAVEiRRGYeJSE8C9qI/+DW3Mc=; b=l6/27hwJ0a4HKsz6t9pz7AeEyL
	++e6AAu2OWyYTxj39NZ5rrbRqOEcsUy9vW3W9/bZhFMEa+L5eMXomDdt73t6SWn82HKNpLM0YWl/o
	HbcZ+zuiSETvdkVOEcy7OvwqNUcAeM1qXUppZAUDdLA+9SRe2L6uTBMDTD1YrtGxmiBc=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/arm: Add NXP LINFlexD UART early printk support
Message-Id: <E1t2PCC-0002tv-2s@xenbits.xenproject.org>
Date: Sun, 20 Oct 2024 06:13:44 +0000

commit e9f227685e7204cb2293576ee5b745b828cb3cd7
Author:     Andrei Cherechesu <andrei.cherechesu@nxp.com>
AuthorDate: Mon Sep 30 14:47:08 2024 +0300
Commit:     Julien Grall <julien@xen.org>
CommitDate: Fri Oct 18 23:37:33 2024 +0100

    xen/arm: Add NXP LINFlexD UART early printk support
    
    This adds support for early printk debug via the NXP LINFlexD
    UART controller.
    
    Signed-off-by: Andrei Cherechesu <andrei.cherechesu@nxp.com>
    Signed-off-by: Peter van der Perk <peter.vander.perk@nxp.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
---
 xen/arch/arm/Kconfig.debug           | 12 ++++++++
 xen/arch/arm/arm64/debug-linflex.inc | 58 ++++++++++++++++++++++++++++++++++++
 2 files changed, 70 insertions(+)

diff --git a/xen/arch/arm/Kconfig.debug b/xen/arch/arm/Kconfig.debug
index 2fa0acd2a3..7660e599c0 100644
--- a/xen/arch/arm/Kconfig.debug
+++ b/xen/arch/arm/Kconfig.debug
@@ -44,6 +44,14 @@ choice
 			Say Y here if you wish the early printk to direct their
 			output to a i.MX LPUART.
 
+	config EARLY_UART_CHOICE_LINFLEX
+		select EARLY_UART_LINFLEX
+		depends on ARM_64
+		bool "Early printk via NXP LINFlexD UART"
+		help
+			Say Y here if you wish the early printk to direct their
+			output to an NXP LINFlexD UART.
+
 	config EARLY_UART_CHOICE_MESON
 		select EARLY_UART_MESON
 		depends on ARM_64
@@ -89,6 +97,9 @@ config EARLY_UART_EXYNOS4210
 config EARLY_UART_IMX_LPUART
 	select EARLY_PRINTK
 	bool
+config EARLY_UART_LINFLEX
+	select EARLY_PRINTK
+	bool
 config EARLY_UART_MESON
 	select EARLY_PRINTK
 	bool
@@ -167,6 +178,7 @@ config EARLY_PRINTK_INC
 	default "debug-cadence.inc" if EARLY_UART_CADENCE
 	default "debug-exynos4210.inc" if EARLY_UART_EXYNOS4210
 	default "debug-imx-lpuart.inc" if EARLY_UART_IMX_LPUART
+	default "debug-linflex.inc" if EARLY_UART_LINFLEX
 	default "debug-meson.inc" if EARLY_UART_MESON
 	default "debug-mvebu.inc" if EARLY_UART_MVEBU
 	default "debug-pl011.inc" if EARLY_UART_PL011
diff --git a/xen/arch/arm/arm64/debug-linflex.inc b/xen/arch/arm/arm64/debug-linflex.inc
new file mode 100644
index 0000000000..cf4f5ce224
--- /dev/null
+++ b/xen/arch/arm/arm64/debug-linflex.inc
@@ -0,0 +1,58 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * xen/arch/arm/arm64/debug-linflex.inc
+ *
+ * NXP LINFlexD UART specific debug code
+ *
+ * Andrei Cherechesu <andrei.cherechesu@nxp.com>
+ * Copyright 2018, 2021, 2023-2024 NXP
+ */
+
+#include <asm/asm_defns.h>
+#include <asm/linflex-uart.h>
+
+/*
+ * wait LINFlexD UART to be ready to transmit
+ * xb: register which contains the UART base address
+ * c: scratch register number
+ */
+.macro early_uart_ready xb, c
+    ldr   w\c, [\xb, #UARTCR]       /* <= Control Register */
+    and   w\c, w\c, #UARTCR_TFBM    /* Check Buffer/FIFO (0/1) Mode */
+    cbz   w\c, 2f                   /* Buffer Mode => return */
+1:
+    ldrb  w\c, [\xb, #UARTSR]       /* <= Status Register */
+    tst   w\c, #UARTSR_DTFTFF       /* FIFO Mode => Check DTF bit */
+    b.ne  1b
+2:
+.endm
+
+/*
+ * LINFlexD UART transmit character
+ * xb: register which contains the UART base address
+ * wt: register which contains the character to transmit
+ */
+.macro early_uart_transmit xb, wt
+    strb  \wt, [\xb, #BDRL]
+
+    ldr   \wt, [\xb, #UARTCR]       /* <= Control Register */
+    and   \wt, \wt, #UARTCR_TFBM    /* Check Buffer/FIFO (0/1) Mode */
+    cbnz  \wt, 2f                   /* FIFO Mode => goto exit */
+
+3:  /* Buffer Mode */
+    ldrb  \wt, [\xb, #UARTSR]       /* <= Status Register */
+    and   \wt, \wt, #UARTSR_DTFTFF  /* Check Transmission Completed */
+    cbz   \wt, 3b
+
+    ldr   \wt, [\xb, #UARTSR]       /* <= Status Register */
+    orr   \wt, \wt, #UARTSR_DTFTFF  /* Clear DTF bit */
+    str   \wt, [\xb, #UARTSR]
+2:
+.endm
+
+/*
+ * Local variables:
+ * mode: ASM
+ * indent-tabs-mode: nil
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Sun Oct 20 06:13:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Sun, 20 Oct 2024 06:13:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.822743.1236726 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PCM-0004KV-Ix; Sun, 20 Oct 2024 06:13:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 822743.1236726; Sun, 20 Oct 2024 06:13:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2PCM-0004KN-G4; Sun, 20 Oct 2024 06:13:54 +0000
Received: by outflank-mailman (input) for mailman id 822743;
 Sun, 20 Oct 2024 06:13: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 1t2PCM-0004KD-79
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:13: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 1t2PCM-00080Y-6Q
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:13:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t2PCM-0002un-5h
 for xen-changelog@lists.xenproject.org; Sun, 20 Oct 2024 06:13:54 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=5P+cG6lOHdI2P6/nO7X7PUh/QHUnhNt1oJA9GglTZQM=; b=19Wq1haKFHRfJzj0UIGOHWUkP5
	cX9ble78frF1Js3IfSJY/l1j+N/fJPgzaM11QO3Al6c84kvIMCLUv5c+rl5Shx1JtPRSLiaw4ycS/
	LgEv/blm9RkTYotK5ptWyOFsAreOQ8p4nnGw4NMqkNSAG6qO1iy136AS166LIlxRzBFA=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Fix PVH boot following the start of the MBI->BI conversion
Message-Id: <E1t2PCM-0002un-5h@xenbits.xenproject.org>
Date: Sun, 20 Oct 2024 06:13:54 +0000

commit 73785a4c7727cd7a888c7d16ca6a77c3ed0161d7
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Sat Oct 19 19:15:04 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Sat Oct 19 19:25:36 2024 +0100

    x86/boot: Fix PVH boot following the start of the MBI->BI conversion
    
    pvh_init() sets up the mbi pointer, but leaves mbi_p at 0.  This isn't
    compatbile with multiboot_fill_boot_info() starting from the physical address,
    in order to remove the use of the mbi pointer.
    
    Fixes: 038826b61e85 ("x86/boot: move x86 boot module counting into a new boot_info struct")
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/setup.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 6746ed8cce..bfede5064e 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1048,6 +1048,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     {
         ASSERT(mbi_p == 0);
         pvh_init(&mbi, &mod);
+        mbi_p = __pa(mbi);
     }
     else
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Mon Oct 21 11:44:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 21 Oct 2024 11:44:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.823402.1237392 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2qpQ-0001Cq-TY; Mon, 21 Oct 2024 11:44:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 823402.1237392; Mon, 21 Oct 2024 11: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 1t2qpQ-0001Cj-Qq; Mon, 21 Oct 2024 11:44:04 +0000
Received: by outflank-mailman (input) for mailman id 823402;
 Mon, 21 Oct 2024 11: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 1t2qpP-0001Cd-Dn
 for xen-changelog@lists.xenproject.org; Mon, 21 Oct 2024 11: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 1t2qpP-0007WY-Aa
 for xen-changelog@lists.xenproject.org; Mon, 21 Oct 2024 11:44:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t2qpP-0004Ki-7h
 for xen-changelog@lists.xenproject.org; Mon, 21 Oct 2024 11: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=L3uIc9leOJKyKg6V2JQqjgvo0NjBwTbSkfONLeP/ghs=; b=69x0+EbX4mU5gWk/AIE04fMOOX
	Ex5oBKg85t2DIv/aiug7qsSqEq8bQXmsvCry+7jZqJXBfKNmaXm6EQQeLvIqd0AR05thEpcVG0CeL
	vR7vXIzccNP17NcQsR+yNwj+a3+dkaF+32AAAyWurBfVK/wH/gEtMQBcTPB0Q5AJ3E4s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: introduce struct boot_module
Message-Id: <E1t2qpP-0004Ki-7h@xenbits.xenproject.org>
Date: Mon, 21 Oct 2024 11:44:03 +0000

commit 7cf6e073e47f7c7edfe764ce904df283ec7ddad8
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Sun Oct 20 20:45:36 2024 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Oct 21 10:31:18 2024 +0100

    x86/boot: introduce struct boot_module
    
    This will introduce a new struct boot_module to provide a rich state
    representation around modules provided by the boot loader. Support is for 64
    boot modules, one held in reserve for Xen, and up to 63 can be provided by the
    boot loader. The array of struct boot_modules will be accessible via a
    reference held in struct boot_info.
    
    A temporary `mod` parameter is included in struct boot_module to ease the
    transition from using Multiboot v1 structures over to struct boot_module. Once
    the transition is complete, the parameter will be dropped from the structure.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/bootinfo.h | 10 ++++++++++
 xen/arch/x86/setup.c                | 26 ++++++++++++++++++++++++--
 2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm/bootinfo.h
index e7821e0603..ffa4434067 100644
--- a/xen/arch/x86/include/asm/bootinfo.h
+++ b/xen/arch/x86/include/asm/bootinfo.h
@@ -8,8 +8,17 @@
 #ifndef X86_BOOTINFO_H
 #define X86_BOOTINFO_H
 
+#include <xen/multiboot.h>
 #include <xen/types.h>
 
+/* Max number of boot modules a bootloader can provide in addition to Xen */
+#define MAX_NR_BOOTMODS 63
+
+struct boot_module {
+    /* Transitionary only */
+    module_t *mod;
+};
+
 /*
  * Xen internal representation of information provided by the
  * bootloader/environment, or derived from the information.
@@ -22,6 +31,7 @@ struct boot_info {
     size_t memmap_length;
 
     unsigned int nr_modules;
+    struct boot_module mods[MAX_NR_BOOTMODS + 1];
 };
 
 #endif /* X86_BOOTINFO_H */
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index bfede5064e..db670258d6 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -287,6 +287,8 @@ static struct boot_info *__init multiboot_fill_boot_info(unsigned long mbi_p)
 {
     struct boot_info *bi = &xen_boot_info;
     const multiboot_info_t *mbi = __va(mbi_p);
+    module_t *mods = __va(mbi->mods_addr);
+    unsigned int i;
 
     if ( mbi->flags & MBI_MODULES )
         bi->nr_modules = mbi->mods_count;
@@ -303,6 +305,21 @@ static struct boot_info *__init multiboot_fill_boot_info(unsigned long mbi_p)
         bi->memmap_length = mbi->mmap_length;
     }
 
+    /*
+     * The multiboot entry point will reserve mods_count + 1 instances of
+     * module_t, with the last one being for Xen. First iterate over nr_modules
+     * module_t entries, or MAX_NR_BOOTMODS if more than the max was passed.
+     *
+     * As the Xen entry may be beyond MAX_NR_BOOTMODS, explicitly set the last
+     * entry in mods to point at the last module_t entry which the entry point
+     * reserved for Xen.
+     */
+    for ( i = 0; i < MAX_NR_BOOTMODS && i < bi->nr_modules; i++ )
+        bi->mods[i].mod = &mods[i];
+
+    /* Variable 'i' should be one entry past the last module. */
+    bi->mods[i].mod = &mods[bi->nr_modules];
+
     return bi;
 }
 
@@ -1163,9 +1180,14 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
         panic("dom0 kernel not specified. Check bootloader configuration\n");
 
     /* Check that we don't have a silly number of modules. */
-    if ( bi->nr_modules > sizeof(module_map) * 8 )
+    if ( bi->nr_modules > MAX_NR_BOOTMODS )
     {
-        bi->nr_modules = sizeof(module_map) * 8;
+        /*
+         * Only MAX_NR_BOOTMODS were populated in bootinfo, truncate nr_modules
+         * now that it can be report that an excess number of modules were
+         * passed.
+         */
+        bi->nr_modules = MAX_NR_BOOTMODS;
         printk("Excessive boot modules - using the first %u only\n",
                bi->nr_modules);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Oct 21 18:33:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 21 Oct 2024 18:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.823911.1237994 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2xDD-0003YU-QM; Mon, 21 Oct 2024 18:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 823911.1237994; Mon, 21 Oct 2024 18: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 1t2xDD-0003YM-NW; Mon, 21 Oct 2024 18:33:03 +0000
Received: by outflank-mailman (input) for mailman id 823911;
 Mon, 21 Oct 2024 18:33: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 1t2xDD-0003YD-B3
 for xen-changelog@lists.xenproject.org; Mon, 21 Oct 2024 18:33: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 1t2xDD-0007Al-7R
 for xen-changelog@lists.xenproject.org; Mon, 21 Oct 2024 18:33:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t2xDD-0007eL-5d
 for xen-changelog@lists.xenproject.org; Mon, 21 Oct 2024 18: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=m+LYKgETzIpWY/YsEKha0SEDPHcGrnrKEBIfgyW406A=; b=FEx4a4CAeQ/fk7LCKnmgVuWiZ8
	IBjBAi1Tgf7FGprruoZ5leKqrCBe45Bm66kFuM/8+ShSFyt/INA3cqwHHhXD/3/bhjTrL6kb/+roP
	+rz2IV70Y7Q5BudDX5SexCpv132isnIBpRuWol1wBsvTV2u5ckclQbduAstiYHGrKIKs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/fpu: Combine fpu_ctxt and xsave_area in arch_vcpu
Message-Id: <E1t2xDD-0007eL-5d@xenbits.xenproject.org>
Date: Mon, 21 Oct 2024 18:33:03 +0000

commit edb48e76458bb93b89daa4bfb621f4419262d370
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Mon Oct 7 16:52:39 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Oct 21 18:28:59 2024 +0100

    x86/fpu: Combine fpu_ctxt and xsave_area in arch_vcpu
    
    fpu_ctxt is either a pointer to the legacy x87/SSE save area (used by FXSAVE) or
    a pointer aliased with xsave_area that points to its fpu_sse subfield. Such
    subfield is at the base and is identical in size and layout to the legacy
    buffer.
    
    This patch merges the 2 pointers in the arch_vcpu into a single XSAVE area. In
    the very rare case in which the host doesn't support XSAVE all we're doing is
    wasting a tiny amount of memory and trading those for a lot more simplicity in
    the code.
    
    While at it, dedup the setup logic in vcpu_init_fpu() and integrate it
    into xstate_alloc_save_area().
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/domctl.c             |  6 +++++-
 xen/arch/x86/hvm/emulate.c        |  4 ++--
 xen/arch/x86/hvm/hvm.c            |  6 +++++-
 xen/arch/x86/i387.c               | 44 ++++++---------------------------------
 xen/arch/x86/include/asm/domain.h |  6 ------
 xen/arch/x86/x86_emulate/blk.c    |  2 +-
 xen/arch/x86/xstate.c             | 12 ++++++++---
 7 files changed, 28 insertions(+), 52 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 37ebcb3abb..5f01111619 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1383,7 +1383,11 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
 #define c(fld) (c.nat->fld)
 #endif
 
-    memcpy(&c.nat->fpu_ctxt, v->arch.fpu_ctxt, sizeof(c.nat->fpu_ctxt));
+    BUILD_BUG_ON(sizeof(c.nat->fpu_ctxt) !=
+                 sizeof(v->arch.xsave_area->fpu_sse));
+    memcpy(&c.nat->fpu_ctxt, &v->arch.xsave_area->fpu_sse,
+           sizeof(c.nat->fpu_ctxt));
+
     if ( is_pv_domain(d) )
         c(flags = v->arch.pv.vgc_flags & ~(VGCF_i387_valid|VGCF_in_kernel));
     else
diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index aa97ca1cbf..f2bc6967df 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2371,7 +2371,7 @@ static int cf_check hvmemul_get_fpu(
         alternative_vcall(hvm_funcs.fpu_dirty_intercept);
     else if ( type == X86EMUL_FPU_fpu )
     {
-        const fpusse_t *fpu_ctxt = curr->arch.fpu_ctxt;
+        const fpusse_t *fpu_ctxt = &curr->arch.xsave_area->fpu_sse;
 
         /*
          * Latch current register state so that we can back out changes
@@ -2411,7 +2411,7 @@ static void cf_check hvmemul_put_fpu(
 
     if ( aux )
     {
-        fpusse_t *fpu_ctxt = curr->arch.fpu_ctxt;
+        fpusse_t *fpu_ctxt = &curr->arch.xsave_area->fpu_sse;
         bool dval = aux->dval;
         int mode = hvm_guest_x86_mode(curr);
 
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 3b803e15e0..000b40d7b1 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -914,7 +914,11 @@ static int cf_check hvm_save_cpu_ctxt(struct vcpu *v, hvm_domain_context_t *h)
 
     if ( v->fpu_initialised )
     {
-        memcpy(ctxt.fpu_regs, v->arch.fpu_ctxt, sizeof(ctxt.fpu_regs));
+        BUILD_BUG_ON(sizeof(ctxt.fpu_regs) !=
+                     sizeof(v->arch.xsave_area->fpu_sse));
+        memcpy(ctxt.fpu_regs, &v->arch.xsave_area->fpu_sse,
+               sizeof(ctxt.fpu_regs));
+
         ctxt.flags = XEN_X86_FPU_INITIALISED;
     }
 
diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index 134e0bece5..b0a50f9489 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 fpusse_t *fpu_ctxt = v->arch.fpu_ctxt;
+    const fpusse_t *fpu_ctxt = &v->arch.xsave_area->fpu_sse;
 
     /*
      * 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)
 {
-    fpusse_t *fpu_ctxt = v->arch.fpu_ctxt;
+    fpusse_t *fpu_ctxt = &v->arch.xsave_area->fpu_sse;
     unsigned int fip_width = v->domain->arch.x87_fip_width;
 
     if ( fip_width != 4 )
@@ -212,7 +212,7 @@ void vcpu_restore_fpu_nonlazy(struct vcpu *v, bool need_stts)
      * above) we also need to restore full state, to prevent subsequently
      * saving state belonging to another vCPU.
      */
-    if ( v->arch.fully_eager_fpu || (v->arch.xsave_area && xstate_all(v)) )
+    if ( v->arch.fully_eager_fpu || xstate_all(v) )
     {
         if ( cpu_has_xsave )
             fpu_xrstor(v, XSTATE_ALL);
@@ -299,44 +299,15 @@ void save_fpu_enable(void)
 /* Initialize FPU's context save area */
 int vcpu_init_fpu(struct vcpu *v)
 {
-    int rc;
-
     v->arch.fully_eager_fpu = opt_eager_fpu;
 
-    if ( (rc = xstate_alloc_save_area(v)) != 0 )
-        return rc;
-
-    if ( v->arch.xsave_area )
-        v->arch.fpu_ctxt = &v->arch.xsave_area->fpu_sse;
-    else
-    {
-        BUILD_BUG_ON(__alignof(v->arch.xsave_area->fpu_sse) < 16);
-        v->arch.fpu_ctxt = _xzalloc(sizeof(v->arch.xsave_area->fpu_sse),
-                                    __alignof(v->arch.xsave_area->fpu_sse));
-        if ( v->arch.fpu_ctxt )
-        {
-            fpusse_t *fpu_sse = v->arch.fpu_ctxt;
-
-            fpu_sse->fcw = FCW_DEFAULT;
-            fpu_sse->mxcsr = MXCSR_DEFAULT;
-        }
-        else
-            rc = -ENOMEM;
-    }
-
-    return rc;
+    return xstate_alloc_save_area(v);
 }
 
 void vcpu_setup_fpu(struct vcpu *v, struct xsave_struct *xsave_area,
                     const void *data, unsigned int fcw_default)
 {
-    /*
-     * For the entire function please note that vcpu_init_fpu() (above) points
-     * v->arch.fpu_ctxt into v->arch.xsave_area when XSAVE is available. Hence
-     * accesses through both pointers alias one another, and the shorter form
-     * is used here.
-     */
-    fpusse_t *fpu_sse = v->arch.fpu_ctxt;
+    fpusse_t *fpu_sse = &v->arch.xsave_area->fpu_sse;
 
     ASSERT(!xsave_area || xsave_area == v->arch.xsave_area);
 
@@ -373,10 +344,7 @@ void vcpu_setup_fpu(struct vcpu *v, struct xsave_struct *xsave_area,
 /* Free FPU's context save area */
 void vcpu_destroy_fpu(struct vcpu *v)
 {
-    if ( v->arch.xsave_area )
-        xstate_free_save_area(v);
-    else
-        xfree(v->arch.fpu_ctxt);
+    xstate_free_save_area(v);
 }
 
 /*
diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index 5219c4fb0f..b79d6badd7 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -591,12 +591,6 @@ struct pv_vcpu
 
 struct arch_vcpu
 {
-    /*
-     * guest context (mirroring struct vcpu_guest_context) common
-     * between pv and hvm guests
-     */
-
-    void              *fpu_ctxt;
     struct cpu_user_regs user_regs;
 
     /* Debug registers. */
diff --git a/xen/arch/x86/x86_emulate/blk.c b/xen/arch/x86/x86_emulate/blk.c
index e790f4f900..08a05f8453 100644
--- a/xen/arch/x86/x86_emulate/blk.c
+++ b/xen/arch/x86/x86_emulate/blk.c
@@ -11,7 +11,7 @@
     !defined(X86EMUL_NO_SIMD)
 # ifdef __XEN__
 #  include <asm/xstate.h>
-#  define FXSAVE_AREA current->arch.fpu_ctxt
+#  define FXSAVE_AREA ((void *)&current->arch.xsave_area->fpu_sse)
 # else
 #  define FXSAVE_AREA get_fpu_save_area()
 # endif
diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 57a0749f0d..af9e345a7a 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -508,9 +508,15 @@ int xstate_alloc_save_area(struct vcpu *v)
     unsigned int size;
 
     if ( !cpu_has_xsave )
-        return 0;
-
-    if ( !is_idle_vcpu(v) || !cpu_has_xsavec )
+    {
+        /*
+         * On non-XSAVE systems, we allocate an XSTATE buffer for simplicity.
+         * XSTATE is backwards compatible to FXSAVE, and only one cacheline
+         * larger.
+         */
+        size = XSTATE_AREA_MIN_SIZE;
+    }
+    else if ( !is_idle_vcpu(v) || !cpu_has_xsavec )
     {
         size = xsave_cntxt_size;
         BUG_ON(size < XSTATE_AREA_MIN_SIZE);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Oct 21 18:33:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 21 Oct 2024 18:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.823912.1237998 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t2xDN-0003a9-Rh; Mon, 21 Oct 2024 18:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 823912.1237998; Mon, 21 Oct 2024 18: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 1t2xDN-0003a1-P1; Mon, 21 Oct 2024 18:33:13 +0000
Received: by outflank-mailman (input) for mailman id 823912;
 Mon, 21 Oct 2024 18: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 1t2xDN-0003Zv-Cx
 for xen-changelog@lists.xenproject.org; Mon, 21 Oct 2024 18: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 1t2xDN-0007At-C8
 for xen-changelog@lists.xenproject.org; Mon, 21 Oct 2024 18:33:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t2xDN-0007f9-9v
 for xen-changelog@lists.xenproject.org; Mon, 21 Oct 2024 18: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=FYpwcexIoM+uvB4yKxNuNPT7szqC+tcPXLic59/DhvE=; b=qu7+OChG4wYEYCzI41nsGLkpFL
	6O7Sp62N+cNCBFDwcEOahK/cqR5+ibl66V0O1vd0VL6qJh6F6H4n53SBAR11hpWc/LN2AptPvnz70
	BAhoRk59U7nnRaI9JAXhxSqyXUQ3cz8w/5BRuOIkd4JWNqOGqdwePKyEljIpmLNv/+qs=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/fpu: Rework fpu_setup_fpu() uses to split it in two
Message-Id: <E1t2xDN-0007f9-9v@xenbits.xenproject.org>
Date: Mon, 21 Oct 2024 18:33:13 +0000

commit 49a068471d77820af5dac5ad062cde7129e3faae
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Mon Oct 7 16:52:40 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Oct 21 18:28:59 2024 +0100

    x86/fpu: Rework fpu_setup_fpu() uses to split it in two
    
    It was trying to do too many things at once and there was no clear way of
    defining what it was meant to do. This commit splits the function in two.
    
      1. A function to return the FPU to power-on reset values.
      2. A x87/SSE state loader (equivalent to the old function when it took
         a data pointer).
    
    The old function also had a concept of "default" values that the FPU
    would be configured for in some cases but not others. This patch removes
    that 3rd vague initial state and replaces it with power-on reset.
    
    While doing this make sure the abridged control tag is consistent with the
    manuals and starts as 0xFF
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domain.c             |  7 +++---
 xen/arch/x86/hvm/hvm.c            | 12 ++++-----
 xen/arch/x86/i387.c               | 51 ++++++++++++++-------------------------
 xen/arch/x86/include/asm/i387.h   | 21 +++++++++++++---
 xen/arch/x86/include/asm/xstate.h |  1 +
 5 files changed, 45 insertions(+), 47 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 89aad7e897..78a13e6812 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1186,9 +1186,10 @@ int arch_set_info_guest(
          is_pv_64bit_domain(d) )
         v->arch.flags &= ~TF_kernel_mode;
 
-    vcpu_setup_fpu(v, v->arch.xsave_area,
-                   flags & VGCF_I387_VALID ? &c.nat->fpu_ctxt : NULL,
-                   FCW_DEFAULT);
+    if ( flags & VGCF_I387_VALID )
+        vcpu_setup_fpu(v, &c.nat->fpu_ctxt);
+    else
+        vcpu_reset_fpu(v);
 
     if ( !compat )
     {
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 000b40d7b1..018d44a08b 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1163,10 +1163,10 @@ static int cf_check hvm_load_cpu_ctxt(struct domain *d, hvm_domain_context_t *h)
     seg.attr = ctxt.ldtr_arbytes;
     hvm_set_segment_register(v, x86_seg_ldtr, &seg);
 
-    /* Cover xsave-absent save file restoration on xsave-capable host. */
-    vcpu_setup_fpu(v, xsave_enabled(v) ? NULL : v->arch.xsave_area,
-                   ctxt.flags & XEN_X86_FPU_INITIALISED ? ctxt.fpu_regs : NULL,
-                   FCW_RESET);
+    if ( ctxt.flags & XEN_X86_FPU_INITIALISED )
+        vcpu_setup_fpu(v, &ctxt.fpu_regs);
+    else
+        vcpu_reset_fpu(v);
 
     v->arch.user_regs.rax = ctxt.rax;
     v->arch.user_regs.rbx = ctxt.rbx;
@@ -4013,9 +4013,7 @@ void hvm_vcpu_reset_state(struct vcpu *v, uint16_t cs, uint16_t ip)
         v->arch.guest_table = pagetable_null();
     }
 
-    if ( v->arch.xsave_area )
-        v->arch.xsave_area->xsave_hdr.xstate_bv = 0;
-    vcpu_setup_fpu(v, v->arch.xsave_area, NULL, FCW_RESET);
+    vcpu_reset_fpu(v);
 
     arch_vcpu_regs_init(v);
     v->arch.user_regs.rip = ip;
diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index b0a50f9489..83f9b2502b 100644
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -304,41 +304,26 @@ int vcpu_init_fpu(struct vcpu *v)
     return xstate_alloc_save_area(v);
 }
 
-void vcpu_setup_fpu(struct vcpu *v, struct xsave_struct *xsave_area,
-                    const void *data, unsigned int fcw_default)
+void vcpu_reset_fpu(struct vcpu *v)
 {
-    fpusse_t *fpu_sse = &v->arch.xsave_area->fpu_sse;
-
-    ASSERT(!xsave_area || xsave_area == v->arch.xsave_area);
-
-    v->fpu_initialised = !!data;
-
-    if ( data )
-    {
-        memcpy(fpu_sse, data, sizeof(*fpu_sse));
-        if ( xsave_area )
-            xsave_area->xsave_hdr.xstate_bv = XSTATE_FP_SSE;
-    }
-    else if ( xsave_area && fcw_default == FCW_DEFAULT )
-    {
-        xsave_area->xsave_hdr.xstate_bv = 0;
-        fpu_sse->mxcsr = MXCSR_DEFAULT;
-    }
-    else
-    {
-        memset(fpu_sse, 0, sizeof(*fpu_sse));
-        fpu_sse->fcw = fcw_default;
-        fpu_sse->mxcsr = MXCSR_DEFAULT;
-        if ( v->arch.xsave_area )
-        {
-            v->arch.xsave_area->xsave_hdr.xstate_bv &= ~XSTATE_FP_SSE;
-            if ( fcw_default != FCW_DEFAULT )
-                v->arch.xsave_area->xsave_hdr.xstate_bv |= X86_XCR0_X87;
-        }
-    }
+    v->fpu_initialised = false;
+    *v->arch.xsave_area = (struct xsave_struct) {
+        .fpu_sse = {
+            .mxcsr = MXCSR_DEFAULT,
+            .fcw = FCW_RESET,
+            .ftw = FXSAVE_FTW_RESET,
+        },
+        .xsave_hdr.xstate_bv = X86_XCR0_X87,
+    };
+}
 
-    if ( xsave_area )
-        xsave_area->xsave_hdr.xcomp_bv = 0;
+void vcpu_setup_fpu(struct vcpu *v, const void *data)
+{
+    v->fpu_initialised = true;
+    *v->arch.xsave_area = (struct xsave_struct) {
+        .fpu_sse = *(const fpusse_t*)data,
+        .xsave_hdr.xstate_bv = XSTATE_FP_SSE,
+    };
 }
 
 /* Free FPU's context save area */
diff --git a/xen/arch/x86/include/asm/i387.h b/xen/arch/x86/include/asm/i387.h
index a783549db9..652d7ad2de 100644
--- a/xen/arch/x86/include/asm/i387.h
+++ b/xen/arch/x86/include/asm/i387.h
@@ -31,10 +31,23 @@ void vcpu_restore_fpu_nonlazy(struct vcpu *v, bool need_stts);
 void vcpu_restore_fpu_lazy(struct vcpu *v);
 void vcpu_save_fpu(struct vcpu *v);
 void save_fpu_enable(void);
-
 int vcpu_init_fpu(struct vcpu *v);
-struct xsave_struct;
-void vcpu_setup_fpu(struct vcpu *v, struct xsave_struct *xsave_area,
-                    const void *data, unsigned int fcw_default);
 void vcpu_destroy_fpu(struct vcpu *v);
+
+/*
+ * Restore v's FPU to power-on reset values
+ *
+ * @param v vCPU containing the FPU
+ */
+void vcpu_reset_fpu(struct vcpu *v);
+
+/*
+ * Load x87/SSE state into v's FPU
+ *
+ * Overrides the XSAVE header to set the state components to be x87 and SSE.
+ *
+ * @param v    vCPU containing the FPU
+ * @param data 512-octet blob for x87/SSE state
+ */
+void vcpu_setup_fpu(struct vcpu *v, const void *data);
 #endif /* __ASM_I386_I387_H */
diff --git a/xen/arch/x86/include/asm/xstate.h b/xen/arch/x86/include/asm/xstate.h
index b4ee555953..07017cc4ed 100644
--- a/xen/arch/x86/include/asm/xstate.h
+++ b/xen/arch/x86/include/asm/xstate.h
@@ -14,6 +14,7 @@
 
 #define FCW_DEFAULT               0x037f
 #define FCW_RESET                 0x0040
+#define FXSAVE_FTW_RESET          0xFF /* Abridged Tag Word format */
 #define MXCSR_DEFAULT             0x1f80
 
 extern uint32_t mxcsr_mask;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Mon Oct 21 22:33:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Mon, 21 Oct 2024 22:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.823971.1238063 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t30xT-0005YI-G4; Mon, 21 Oct 2024 22:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 823971.1238063; Mon, 21 Oct 2024 22: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 1t30xT-0005YA-Cw; Mon, 21 Oct 2024 22:33:03 +0000
Received: by outflank-mailman (input) for mailman id 823971;
 Mon, 21 Oct 2024 22: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 1t30xR-0005Xy-Jt
 for xen-changelog@lists.xenproject.org; Mon, 21 Oct 2024 22: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 1t30xR-00037V-G1
 for xen-changelog@lists.xenproject.org; Mon, 21 Oct 2024 22:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t30xR-0006xr-CV
 for xen-changelog@lists.xenproject.org; Mon, 21 Oct 2024 22: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=+Ks4sYQeMEsOlBR3O0AtcBeauCXTI6dF6uYaNsnaJKM=; b=wv28ya5+dAgmc6o9xqMj9UM5PJ
	LsC2VUdbWOTYXwn1H3v/m8WNToMOs0s1JRX4h/Q6IxK8i9fjSkx7JBmD67KvgPtBmyzsYgg4DvLf3
	wbDY+k0iRSFMWtoqvwiaMk8wAFmWu/QYvt+r0RUgy4rQYmReOP5jpXTy+7662DyAlVJI=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: introduce struct boot_module
Message-Id: <E1t30xR-0006xr-CV@xenbits.xenproject.org>
Date: Mon, 21 Oct 2024 22:33:01 +0000

commit 7cf6e073e47f7c7edfe764ce904df283ec7ddad8
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Sun Oct 20 20:45:36 2024 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Oct 21 10:31:18 2024 +0100

    x86/boot: introduce struct boot_module
    
    This will introduce a new struct boot_module to provide a rich state
    representation around modules provided by the boot loader. Support is for 64
    boot modules, one held in reserve for Xen, and up to 63 can be provided by the
    boot loader. The array of struct boot_modules will be accessible via a
    reference held in struct boot_info.
    
    A temporary `mod` parameter is included in struct boot_module to ease the
    transition from using Multiboot v1 structures over to struct boot_module. Once
    the transition is complete, the parameter will be dropped from the structure.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/bootinfo.h | 10 ++++++++++
 xen/arch/x86/setup.c                | 26 ++++++++++++++++++++++++--
 2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm/bootinfo.h
index e7821e0603..ffa4434067 100644
--- a/xen/arch/x86/include/asm/bootinfo.h
+++ b/xen/arch/x86/include/asm/bootinfo.h
@@ -8,8 +8,17 @@
 #ifndef X86_BOOTINFO_H
 #define X86_BOOTINFO_H
 
+#include <xen/multiboot.h>
 #include <xen/types.h>
 
+/* Max number of boot modules a bootloader can provide in addition to Xen */
+#define MAX_NR_BOOTMODS 63
+
+struct boot_module {
+    /* Transitionary only */
+    module_t *mod;
+};
+
 /*
  * Xen internal representation of information provided by the
  * bootloader/environment, or derived from the information.
@@ -22,6 +31,7 @@ struct boot_info {
     size_t memmap_length;
 
     unsigned int nr_modules;
+    struct boot_module mods[MAX_NR_BOOTMODS + 1];
 };
 
 #endif /* X86_BOOTINFO_H */
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index bfede5064e..db670258d6 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -287,6 +287,8 @@ static struct boot_info *__init multiboot_fill_boot_info(unsigned long mbi_p)
 {
     struct boot_info *bi = &xen_boot_info;
     const multiboot_info_t *mbi = __va(mbi_p);
+    module_t *mods = __va(mbi->mods_addr);
+    unsigned int i;
 
     if ( mbi->flags & MBI_MODULES )
         bi->nr_modules = mbi->mods_count;
@@ -303,6 +305,21 @@ static struct boot_info *__init multiboot_fill_boot_info(unsigned long mbi_p)
         bi->memmap_length = mbi->mmap_length;
     }
 
+    /*
+     * The multiboot entry point will reserve mods_count + 1 instances of
+     * module_t, with the last one being for Xen. First iterate over nr_modules
+     * module_t entries, or MAX_NR_BOOTMODS if more than the max was passed.
+     *
+     * As the Xen entry may be beyond MAX_NR_BOOTMODS, explicitly set the last
+     * entry in mods to point at the last module_t entry which the entry point
+     * reserved for Xen.
+     */
+    for ( i = 0; i < MAX_NR_BOOTMODS && i < bi->nr_modules; i++ )
+        bi->mods[i].mod = &mods[i];
+
+    /* Variable 'i' should be one entry past the last module. */
+    bi->mods[i].mod = &mods[bi->nr_modules];
+
     return bi;
 }
 
@@ -1163,9 +1180,14 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
         panic("dom0 kernel not specified. Check bootloader configuration\n");
 
     /* Check that we don't have a silly number of modules. */
-    if ( bi->nr_modules > sizeof(module_map) * 8 )
+    if ( bi->nr_modules > MAX_NR_BOOTMODS )
     {
-        bi->nr_modules = sizeof(module_map) * 8;
+        /*
+         * Only MAX_NR_BOOTMODS were populated in bootinfo, truncate nr_modules
+         * now that it can be report that an excess number of modules were
+         * passed.
+         */
+        bi->nr_modules = MAX_NR_BOOTMODS;
         printk("Excessive boot modules - using the first %u only\n",
                bi->nr_modules);
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Oct 22 07:00:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 22 Oct 2024 07:00:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824044.1238127 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t38s7-0001pM-6x; Tue, 22 Oct 2024 07:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 824044.1238127; Tue, 22 Oct 2024 07: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 1t38s7-0001oq-3w; Tue, 22 Oct 2024 07:00:03 +0000
Received: by outflank-mailman (input) for mailman id 824044;
 Tue, 22 Oct 2024 07:00: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 1t38s6-0001fh-7Y
 for xen-changelog@lists.xenproject.org; Tue, 22 Oct 2024 07:00: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 1t38s6-0004a2-4M
 for xen-changelog@lists.xenproject.org; Tue, 22 Oct 2024 07:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t38s6-0001VL-2j
 for xen-changelog@lists.xenproject.org; Tue, 22 Oct 2024 07:00:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=Rw1A+Mib/mYon+WKmaQw5bJ6+WjjWGP7K4CEUgdCafQ=; b=AT3+7rlzjrG/Z1k6AKlU0xRskv
	Fq3MbtMLR4hLwfUez5RiAi9A0cyPlbDhxL9uhwEKw4HjWW6Vth7e7cuvgQeFz5XgIbx/+TELjQV9x
	xZdcozfCuJcC/3smbTDmyYYaCrGnbaQuh8GpFpMDT2EdwRYtpzCsFGb0VPL0q+1+9h60=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/fpu: Combine fpu_ctxt and xsave_area in arch_vcpu
Message-Id: <E1t38s6-0001VL-2j@xenbits.xenproject.org>
Date: Tue, 22 Oct 2024 07:00:02 +0000

commit edb48e76458bb93b89daa4bfb621f4419262d370
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Mon Oct 7 16:52:39 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Oct 21 18:28:59 2024 +0100

    x86/fpu: Combine fpu_ctxt and xsave_area in arch_vcpu
    
    fpu_ctxt is either a pointer to the legacy x87/SSE save area (used by FXSAVE) or
    a pointer aliased with xsave_area that points to its fpu_sse subfield. Such
    subfield is at the base and is identical in size and layout to the legacy
    buffer.
    
    This patch merges the 2 pointers in the arch_vcpu into a single XSAVE area. In
    the very rare case in which the host doesn't support XSAVE all we're doing is
    wasting a tiny amount of memory and trading those for a lot more simplicity in
    the code.
    
    While at it, dedup the setup logic in vcpu_init_fpu() and integrate it
    into xstate_alloc_save_area().
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/domctl.c             |  6 +++++-
 xen/arch/x86/hvm/emulate.c        |  4 ++--
 xen/arch/x86/hvm/hvm.c            |  6 +++++-
 xen/arch/x86/i387.c               | 44 ++++++---------------------------------
 xen/arch/x86/include/asm/domain.h |  6 ------
 xen/arch/x86/x86_emulate/blk.c    |  2 +-
 xen/arch/x86/xstate.c             | 12 ++++++++---
 7 files changed, 28 insertions(+), 52 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 37ebcb3abb..5f01111619 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1383,7 +1383,11 @@ void arch_get_info_guest(struct vcpu *v, vcpu_guest_context_u c)
 #define c(fld) (c.nat->fld)
 #endif
 
-    memcpy(&c.nat->fpu_ctxt, v->arch.fpu_ctxt, sizeof(c.nat->fpu_ctxt));
+    BUILD_BUG_ON(sizeof(c.nat->fpu_ctxt) !=
+                 sizeof(v->arch.xsave_area->fpu_sse));
+    memcpy(&c.nat->fpu_ctxt, &v->arch.xsave_area->fpu_sse,
+           sizeof(c.nat->fpu_ctxt));
+
     if ( is_pv_domain(d) )
         c(flags = v->arch.pv.vgc_flags & ~(VGCF_i387_valid|VGCF_in_kernel));
     else
diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index aa97ca1cbf..f2bc6967df 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2371,7 +2371,7 @@ static int cf_check hvmemul_get_fpu(
         alternative_vcall(hvm_funcs.fpu_dirty_intercept);
     else if ( type == X86EMUL_FPU_fpu )
     {
-        const fpusse_t *fpu_ctxt = curr->arch.fpu_ctxt;
+        const fpusse_t *fpu_ctxt = &curr->arch.xsave_area->fpu_sse;
 
         /*
          * Latch current register state so that we can back out changes
@@ -2411,7 +2411,7 @@ static void cf_check hvmemul_put_fpu(
 
     if ( aux )
     {
-        fpusse_t *fpu_ctxt = curr->arch.fpu_ctxt;
+        fpusse_t *fpu_ctxt = &curr->arch.xsave_area->fpu_sse;
         bool dval = aux->dval;
         int mode = hvm_guest_x86_mode(curr);
 
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 3b803e15e0..000b40d7b1 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -914,7 +914,11 @@ static int cf_check hvm_save_cpu_ctxt(struct vcpu *v, hvm_domain_context_t *h)
 
     if ( v->fpu_initialised )
     {
-        memcpy(ctxt.fpu_regs, v->arch.fpu_ctxt, sizeof(ctxt.fpu_regs));
+        BUILD_BUG_ON(sizeof(ctxt.fpu_regs) !=
+                     sizeof(v->arch.xsave_area->fpu_sse));
+        memcpy(ctxt.fpu_regs, &v->arch.xsave_area->fpu_sse,
+               sizeof(ctxt.fpu_regs));
+
         ctxt.flags = XEN_X86_FPU_INITIALISED;
     }
 
diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index 134e0bece5..b0a50f9489 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 fpusse_t *fpu_ctxt = v->arch.fpu_ctxt;
+    const fpusse_t *fpu_ctxt = &v->arch.xsave_area->fpu_sse;
 
     /*
      * 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)
 {
-    fpusse_t *fpu_ctxt = v->arch.fpu_ctxt;
+    fpusse_t *fpu_ctxt = &v->arch.xsave_area->fpu_sse;
     unsigned int fip_width = v->domain->arch.x87_fip_width;
 
     if ( fip_width != 4 )
@@ -212,7 +212,7 @@ void vcpu_restore_fpu_nonlazy(struct vcpu *v, bool need_stts)
      * above) we also need to restore full state, to prevent subsequently
      * saving state belonging to another vCPU.
      */
-    if ( v->arch.fully_eager_fpu || (v->arch.xsave_area && xstate_all(v)) )
+    if ( v->arch.fully_eager_fpu || xstate_all(v) )
     {
         if ( cpu_has_xsave )
             fpu_xrstor(v, XSTATE_ALL);
@@ -299,44 +299,15 @@ void save_fpu_enable(void)
 /* Initialize FPU's context save area */
 int vcpu_init_fpu(struct vcpu *v)
 {
-    int rc;
-
     v->arch.fully_eager_fpu = opt_eager_fpu;
 
-    if ( (rc = xstate_alloc_save_area(v)) != 0 )
-        return rc;
-
-    if ( v->arch.xsave_area )
-        v->arch.fpu_ctxt = &v->arch.xsave_area->fpu_sse;
-    else
-    {
-        BUILD_BUG_ON(__alignof(v->arch.xsave_area->fpu_sse) < 16);
-        v->arch.fpu_ctxt = _xzalloc(sizeof(v->arch.xsave_area->fpu_sse),
-                                    __alignof(v->arch.xsave_area->fpu_sse));
-        if ( v->arch.fpu_ctxt )
-        {
-            fpusse_t *fpu_sse = v->arch.fpu_ctxt;
-
-            fpu_sse->fcw = FCW_DEFAULT;
-            fpu_sse->mxcsr = MXCSR_DEFAULT;
-        }
-        else
-            rc = -ENOMEM;
-    }
-
-    return rc;
+    return xstate_alloc_save_area(v);
 }
 
 void vcpu_setup_fpu(struct vcpu *v, struct xsave_struct *xsave_area,
                     const void *data, unsigned int fcw_default)
 {
-    /*
-     * For the entire function please note that vcpu_init_fpu() (above) points
-     * v->arch.fpu_ctxt into v->arch.xsave_area when XSAVE is available. Hence
-     * accesses through both pointers alias one another, and the shorter form
-     * is used here.
-     */
-    fpusse_t *fpu_sse = v->arch.fpu_ctxt;
+    fpusse_t *fpu_sse = &v->arch.xsave_area->fpu_sse;
 
     ASSERT(!xsave_area || xsave_area == v->arch.xsave_area);
 
@@ -373,10 +344,7 @@ void vcpu_setup_fpu(struct vcpu *v, struct xsave_struct *xsave_area,
 /* Free FPU's context save area */
 void vcpu_destroy_fpu(struct vcpu *v)
 {
-    if ( v->arch.xsave_area )
-        xstate_free_save_area(v);
-    else
-        xfree(v->arch.fpu_ctxt);
+    xstate_free_save_area(v);
 }
 
 /*
diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index 5219c4fb0f..b79d6badd7 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -591,12 +591,6 @@ struct pv_vcpu
 
 struct arch_vcpu
 {
-    /*
-     * guest context (mirroring struct vcpu_guest_context) common
-     * between pv and hvm guests
-     */
-
-    void              *fpu_ctxt;
     struct cpu_user_regs user_regs;
 
     /* Debug registers. */
diff --git a/xen/arch/x86/x86_emulate/blk.c b/xen/arch/x86/x86_emulate/blk.c
index e790f4f900..08a05f8453 100644
--- a/xen/arch/x86/x86_emulate/blk.c
+++ b/xen/arch/x86/x86_emulate/blk.c
@@ -11,7 +11,7 @@
     !defined(X86EMUL_NO_SIMD)
 # ifdef __XEN__
 #  include <asm/xstate.h>
-#  define FXSAVE_AREA current->arch.fpu_ctxt
+#  define FXSAVE_AREA ((void *)&current->arch.xsave_area->fpu_sse)
 # else
 #  define FXSAVE_AREA get_fpu_save_area()
 # endif
diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index 57a0749f0d..af9e345a7a 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -508,9 +508,15 @@ int xstate_alloc_save_area(struct vcpu *v)
     unsigned int size;
 
     if ( !cpu_has_xsave )
-        return 0;
-
-    if ( !is_idle_vcpu(v) || !cpu_has_xsavec )
+    {
+        /*
+         * On non-XSAVE systems, we allocate an XSTATE buffer for simplicity.
+         * XSTATE is backwards compatible to FXSAVE, and only one cacheline
+         * larger.
+         */
+        size = XSTATE_AREA_MIN_SIZE;
+    }
+    else if ( !is_idle_vcpu(v) || !cpu_has_xsavec )
     {
         size = xsave_cntxt_size;
         BUG_ON(size < XSTATE_AREA_MIN_SIZE);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Oct 22 07:00:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 22 Oct 2024 07:00:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824045.1238130 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t38sI-0002TN-9k; Tue, 22 Oct 2024 07:00:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 824045.1238130; Tue, 22 Oct 2024 07: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 1t38sI-0002TG-6l; Tue, 22 Oct 2024 07:00:14 +0000
Received: by outflank-mailman (input) for mailman id 824045;
 Tue, 22 Oct 2024 07:00: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 1t38sG-0002T0-Ag
 for xen-changelog@lists.xenproject.org; Tue, 22 Oct 2024 07:00: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 1t38sG-0004aR-9s
 for xen-changelog@lists.xenproject.org; Tue, 22 Oct 2024 07:00:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t38sG-0002eC-7G
 for xen-changelog@lists.xenproject.org; Tue, 22 Oct 2024 07:00:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=nJO0YwdYS+umUOTmGnHeLBwzHGfN7DenVKKy4Tfu750=; b=THwQOBwtk+BxcDvRXIcro277Ou
	mrDoLGQ2T416j+4D3m7a3IbQCBKA5Zy/mk6K+Qk3rr6MP1O+OsuRZJ418a1MY9UmwuudR68lntezN
	A6mUuvHITIdvn7fLEfNxuW6cwoi4piHqMAv41k25qZaRQyj7hAT4nk/Lt0F0nrnU7zeg=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/fpu: Rework fpu_setup_fpu() uses to split it in two
Message-Id: <E1t38sG-0002eC-7G@xenbits.xenproject.org>
Date: Tue, 22 Oct 2024 07:00:12 +0000

commit 49a068471d77820af5dac5ad062cde7129e3faae
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Mon Oct 7 16:52:40 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Mon Oct 21 18:28:59 2024 +0100

    x86/fpu: Rework fpu_setup_fpu() uses to split it in two
    
    It was trying to do too many things at once and there was no clear way of
    defining what it was meant to do. This commit splits the function in two.
    
      1. A function to return the FPU to power-on reset values.
      2. A x87/SSE state loader (equivalent to the old function when it took
         a data pointer).
    
    The old function also had a concept of "default" values that the FPU
    would be configured for in some cases but not others. This patch removes
    that 3rd vague initial state and replaces it with power-on reset.
    
    While doing this make sure the abridged control tag is consistent with the
    manuals and starts as 0xFF
    
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/domain.c             |  7 +++---
 xen/arch/x86/hvm/hvm.c            | 12 ++++-----
 xen/arch/x86/i387.c               | 51 ++++++++++++++-------------------------
 xen/arch/x86/include/asm/i387.h   | 21 +++++++++++++---
 xen/arch/x86/include/asm/xstate.h |  1 +
 5 files changed, 45 insertions(+), 47 deletions(-)

diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
index 89aad7e897..78a13e6812 100644
--- a/xen/arch/x86/domain.c
+++ b/xen/arch/x86/domain.c
@@ -1186,9 +1186,10 @@ int arch_set_info_guest(
          is_pv_64bit_domain(d) )
         v->arch.flags &= ~TF_kernel_mode;
 
-    vcpu_setup_fpu(v, v->arch.xsave_area,
-                   flags & VGCF_I387_VALID ? &c.nat->fpu_ctxt : NULL,
-                   FCW_DEFAULT);
+    if ( flags & VGCF_I387_VALID )
+        vcpu_setup_fpu(v, &c.nat->fpu_ctxt);
+    else
+        vcpu_reset_fpu(v);
 
     if ( !compat )
     {
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 000b40d7b1..018d44a08b 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -1163,10 +1163,10 @@ static int cf_check hvm_load_cpu_ctxt(struct domain *d, hvm_domain_context_t *h)
     seg.attr = ctxt.ldtr_arbytes;
     hvm_set_segment_register(v, x86_seg_ldtr, &seg);
 
-    /* Cover xsave-absent save file restoration on xsave-capable host. */
-    vcpu_setup_fpu(v, xsave_enabled(v) ? NULL : v->arch.xsave_area,
-                   ctxt.flags & XEN_X86_FPU_INITIALISED ? ctxt.fpu_regs : NULL,
-                   FCW_RESET);
+    if ( ctxt.flags & XEN_X86_FPU_INITIALISED )
+        vcpu_setup_fpu(v, &ctxt.fpu_regs);
+    else
+        vcpu_reset_fpu(v);
 
     v->arch.user_regs.rax = ctxt.rax;
     v->arch.user_regs.rbx = ctxt.rbx;
@@ -4013,9 +4013,7 @@ void hvm_vcpu_reset_state(struct vcpu *v, uint16_t cs, uint16_t ip)
         v->arch.guest_table = pagetable_null();
     }
 
-    if ( v->arch.xsave_area )
-        v->arch.xsave_area->xsave_hdr.xstate_bv = 0;
-    vcpu_setup_fpu(v, v->arch.xsave_area, NULL, FCW_RESET);
+    vcpu_reset_fpu(v);
 
     arch_vcpu_regs_init(v);
     v->arch.user_regs.rip = ip;
diff --git a/xen/arch/x86/i387.c b/xen/arch/x86/i387.c
index b0a50f9489..83f9b2502b 100644
--- a/xen/arch/x86/i387.c
+++ b/xen/arch/x86/i387.c
@@ -304,41 +304,26 @@ int vcpu_init_fpu(struct vcpu *v)
     return xstate_alloc_save_area(v);
 }
 
-void vcpu_setup_fpu(struct vcpu *v, struct xsave_struct *xsave_area,
-                    const void *data, unsigned int fcw_default)
+void vcpu_reset_fpu(struct vcpu *v)
 {
-    fpusse_t *fpu_sse = &v->arch.xsave_area->fpu_sse;
-
-    ASSERT(!xsave_area || xsave_area == v->arch.xsave_area);
-
-    v->fpu_initialised = !!data;
-
-    if ( data )
-    {
-        memcpy(fpu_sse, data, sizeof(*fpu_sse));
-        if ( xsave_area )
-            xsave_area->xsave_hdr.xstate_bv = XSTATE_FP_SSE;
-    }
-    else if ( xsave_area && fcw_default == FCW_DEFAULT )
-    {
-        xsave_area->xsave_hdr.xstate_bv = 0;
-        fpu_sse->mxcsr = MXCSR_DEFAULT;
-    }
-    else
-    {
-        memset(fpu_sse, 0, sizeof(*fpu_sse));
-        fpu_sse->fcw = fcw_default;
-        fpu_sse->mxcsr = MXCSR_DEFAULT;
-        if ( v->arch.xsave_area )
-        {
-            v->arch.xsave_area->xsave_hdr.xstate_bv &= ~XSTATE_FP_SSE;
-            if ( fcw_default != FCW_DEFAULT )
-                v->arch.xsave_area->xsave_hdr.xstate_bv |= X86_XCR0_X87;
-        }
-    }
+    v->fpu_initialised = false;
+    *v->arch.xsave_area = (struct xsave_struct) {
+        .fpu_sse = {
+            .mxcsr = MXCSR_DEFAULT,
+            .fcw = FCW_RESET,
+            .ftw = FXSAVE_FTW_RESET,
+        },
+        .xsave_hdr.xstate_bv = X86_XCR0_X87,
+    };
+}
 
-    if ( xsave_area )
-        xsave_area->xsave_hdr.xcomp_bv = 0;
+void vcpu_setup_fpu(struct vcpu *v, const void *data)
+{
+    v->fpu_initialised = true;
+    *v->arch.xsave_area = (struct xsave_struct) {
+        .fpu_sse = *(const fpusse_t*)data,
+        .xsave_hdr.xstate_bv = XSTATE_FP_SSE,
+    };
 }
 
 /* Free FPU's context save area */
diff --git a/xen/arch/x86/include/asm/i387.h b/xen/arch/x86/include/asm/i387.h
index a783549db9..652d7ad2de 100644
--- a/xen/arch/x86/include/asm/i387.h
+++ b/xen/arch/x86/include/asm/i387.h
@@ -31,10 +31,23 @@ void vcpu_restore_fpu_nonlazy(struct vcpu *v, bool need_stts);
 void vcpu_restore_fpu_lazy(struct vcpu *v);
 void vcpu_save_fpu(struct vcpu *v);
 void save_fpu_enable(void);
-
 int vcpu_init_fpu(struct vcpu *v);
-struct xsave_struct;
-void vcpu_setup_fpu(struct vcpu *v, struct xsave_struct *xsave_area,
-                    const void *data, unsigned int fcw_default);
 void vcpu_destroy_fpu(struct vcpu *v);
+
+/*
+ * Restore v's FPU to power-on reset values
+ *
+ * @param v vCPU containing the FPU
+ */
+void vcpu_reset_fpu(struct vcpu *v);
+
+/*
+ * Load x87/SSE state into v's FPU
+ *
+ * Overrides the XSAVE header to set the state components to be x87 and SSE.
+ *
+ * @param v    vCPU containing the FPU
+ * @param data 512-octet blob for x87/SSE state
+ */
+void vcpu_setup_fpu(struct vcpu *v, const void *data);
 #endif /* __ASM_I386_I387_H */
diff --git a/xen/arch/x86/include/asm/xstate.h b/xen/arch/x86/include/asm/xstate.h
index b4ee555953..07017cc4ed 100644
--- a/xen/arch/x86/include/asm/xstate.h
+++ b/xen/arch/x86/include/asm/xstate.h
@@ -14,6 +14,7 @@
 
 #define FCW_DEFAULT               0x037f
 #define FCW_RESET                 0x0040
+#define FXSAVE_FTW_RESET          0xFF /* Abridged Tag Word format */
 #define MXCSR_DEFAULT             0x1f80
 
 extern uint32_t mxcsr_mask;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Oct 22 15:22:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 22 Oct 2024 15:22:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824239.1238332 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3Ghw-0003EN-6p; Tue, 22 Oct 2024 15:22:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 824239.1238332; Tue, 22 Oct 2024 15:22:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3Ghw-0003EG-4B; Tue, 22 Oct 2024 15:22:04 +0000
Received: by outflank-mailman (input) for mailman id 824239;
 Tue, 22 Oct 2024 15: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 1t3Ghv-0003EA-NM
 for xen-changelog@lists.xenproject.org; Tue, 22 Oct 2024 15: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 1t3Ghv-00068P-LQ
 for xen-changelog@lists.xenproject.org; Tue, 22 Oct 2024 15:22:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3Ghv-0005gv-IO
 for xen-changelog@lists.xenproject.org; Tue, 22 Oct 2024 15: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=xCIJy+Ju+hDxNqbSzRt/OeBXSQ6J1FSRDmGdEf+zSSU=; b=jKW+hEk5OhFv07jbIeqZoCa0WV
	7+ZuRiyehjm7XUQlBCxTr/DMmzx3gScaIjEHqepRJ3CnWhFSm+H5AyjK4X4itEPRx3KfzJRV4dV4K
	WSJeX9g0FAzWoVX63hj4AAA9OHtU+7iN0YN0R9gj9VV03dSv58caKAYokGD+Chr+8NRo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CI: Minor cleanup to qubes-x86-64.sh
Message-Id: <E1t3Ghv-0005gv-IO@xenbits.xenproject.org>
Date: Tue, 22 Oct 2024 15:22:03 +0000

commit 6685a129c7864e3733afef09a2539ccd722a4380
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Oct 21 14:06:24 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 22 16:16:43 2024 +0100

    CI: Minor cleanup to qubes-x86-64.sh
    
     * List all the test_variants and summerise what's going on
     * Use case rather than an if/else chain for $test_variant
     * Adjust indentation inside the case block
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 automation/scripts/qubes-x86-64.sh | 84 +++++++++++++++++++++++---------------
 1 file changed, 50 insertions(+), 34 deletions(-)

diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
index bfa60c912a..306304e921 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -2,6 +2,13 @@
 
 set -ex
 
+# One of:
+#  - ""             PV dom0,  PVH domU
+#  - dom0pvh        PVH dom0, PVH domU
+#  - dom0pvh-hvm    PVH dom0, HVM domU
+#  - pci-hvm        PV dom0,  HVM domU + PCI Passthrough
+#  - pci-pv         PV dom0,  PV domU + PCI Passthrough
+#  - s3             PV dom0,  S3 suspend/resume
 test_variant=$1
 
 ### defaults
@@ -19,17 +26,18 @@ vif = [ "bridge=xenbr0", ]
 disk = [ ]
 '
 
-### test: smoke test & smoke test PVH & smoke test HVM
-if [ -z "${test_variant}" ] || [ "${test_variant}" = "dom0pvh" ] || [ "${test_variant}" = "dom0pvh-hvm" ]; then
-    passed="ping test passed"
-    domU_check="
+case "${test_variant}" in
+    ### test: smoke test & smoke test PVH & smoke test HVM
+    ""|"dom0pvh"|"dom0pvh-hvm")
+        passed="ping test passed"
+        domU_check="
 ifconfig eth0 192.168.0.2
 until ping -c 10 192.168.0.1; do
     sleep 1
 done
 echo \"${passed}\"
 "
-    dom0_check="
+        dom0_check="
 set +x
 until grep -q \"${passed}\" /var/log/xen/console/guest-domU.log; do
     sleep 1
@@ -37,12 +45,12 @@ done
 set -x
 echo \"${passed}\"
 "
-if [ "${test_variant}" = "dom0pvh" ] || [ "${test_variant}" = "dom0pvh-hvm" ]; then
-    extra_xen_opts="dom0=pvh"
-fi
+        if [ "${test_variant}" = "dom0pvh" ] || [ "${test_variant}" = "dom0pvh-hvm" ]; then
+            extra_xen_opts="dom0=pvh"
+        fi
 
-if [ "${test_variant}" = "dom0pvh-hvm" ]; then
-    domU_config='
+        if [ "${test_variant}" = "dom0pvh-hvm" ]; then
+            domU_config='
 type = "hvm"
 name = "domU"
 kernel = "/boot/vmlinuz"
@@ -52,17 +60,18 @@ memory = 512
 vif = [ "bridge=xenbr0", ]
 disk = [ ]
 '
-fi
-
-### test: S3
-elif [ "${test_variant}" = "s3" ]; then
-    passed="suspend test passed"
-    wait_and_wakeup="started, suspending"
-    domU_check="
+        fi
+        ;;
+
+    ### test: S3
+    "s3")
+        passed="suspend test passed"
+        wait_and_wakeup="started, suspending"
+        domU_check="
 ifconfig eth0 192.168.0.2
 echo domU started
 "
-    dom0_check="
+        dom0_check="
 until grep 'domU started' /var/log/xen/console/guest-domU.log; do
     sleep 1
 done
@@ -79,19 +88,20 @@ xl dmesg | grep 'Finishing wakeup from ACPI S3 state' || exit 1
 ping -c 10 192.168.0.2 || exit 1
 echo \"${passed}\"
 "
+        ;;
 
-### test: pci-pv, pci-hvm
-elif [ "${test_variant}" = "pci-pv" ] || [ "${test_variant}" = "pci-hvm" ]; then
+    ### test: pci-pv, pci-hvm
+    "pci-pv"|"pci-hvm")
 
-    if [ -z "$PCIDEV" ]; then
-        echo "Please set 'PCIDEV' variable with BDF of test network adapter" >&2
-        echo "Optionally set also 'PCIDEV_INTR' to 'MSI' or 'MSI-X'" >&2
-        exit 1
-    fi
+        if [ -z "$PCIDEV" ]; then
+            echo "Please set 'PCIDEV' variable with BDF of test network adapter" >&2
+            echo "Optionally set also 'PCIDEV_INTR' to 'MSI' or 'MSI-X'" >&2
+            exit 1
+        fi
 
-    passed="pci test passed"
+        passed="pci test passed"
 
-    domU_config='
+        domU_config='
 type = "'${test_variant#pci-}'"
 name = "domU"
 kernel = "/boot/vmlinuz"
@@ -104,7 +114,7 @@ pci = [ "'$PCIDEV',seize=1" ]
 on_reboot = "destroy"
 '
 
-    domU_check="
+        domU_check="
 set -x -e
 interface=eth0
 ip link set \"\$interface\" up
@@ -115,22 +125,28 @@ echo domU started
 pcidevice=\$(basename \$(readlink /sys/class/net/\$interface/device))
 lspci -vs \$pcidevice
 "
-    if [ -n "$PCIDEV_INTR" ]; then
-        domU_check="$domU_check
+        if [ -n "$PCIDEV_INTR" ]; then
+            domU_check="$domU_check
 lspci -vs \$pcidevice | fgrep '$PCIDEV_INTR: Enable+'
 "
-    fi
-    domU_check="$domU_check
+        fi
+        domU_check="$domU_check
 echo \"${passed}\"
 "
 
-    dom0_check="
+        dom0_check="
 tail -F /var/log/xen/qemu-dm-domU.log &
 until grep -q \"^domU Welcome to Alpine Linux\" /var/log/xen/console/guest-domU.log; do
     sleep 1
 done
 "
-fi
+        ;;
+
+    *)
+        echo "Unrecognised test_variant '${test_variant}'" >&2
+        exit 1
+        ;;
+esac
 
 # DomU
 mkdir -p rootfs
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 22 15:22:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 22 Oct 2024 15:22:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824240.1238336 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3Gi6-0003G0-8j; Tue, 22 Oct 2024 15:22:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 824240.1238336; Tue, 22 Oct 2024 15:22:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3Gi6-0003Fs-5n; Tue, 22 Oct 2024 15:22:14 +0000
Received: by outflank-mailman (input) for mailman id 824240;
 Tue, 22 Oct 2024 15: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 1t3Gi5-0003Fm-RF
 for xen-changelog@lists.xenproject.org; Tue, 22 Oct 2024 15: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 1t3Gi5-00068q-P1
 for xen-changelog@lists.xenproject.org; Tue, 22 Oct 2024 15:22:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3Gi5-0005ig-NX
 for xen-changelog@lists.xenproject.org; Tue, 22 Oct 2024 15: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=jq/cBhERjmjzH1TlypYUeEkGoIvgvvgTCCiiVJeo3YE=; b=Pjhd3+FQ3BWd5HJHsuiupq5DOo
	lg+vCz+JsUragzdTfWP2v2v10g7+6iLfFgbkIHR2P9r2VsqolZNuSP8ItqECrRx9ln+k9P4FwZTxI
	9V+U4ht+HSZu0hj6Bim9jXRXJAPqhq9/3GaiMOT6pTRxymqfTBbviVtm8wJID0Y0KlCU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CI: Rework domU_config generation in qubes-x86-64.sh
Message-Id: <E1t3Gi5-0005ig-NX@xenbits.xenproject.org>
Date: Tue, 22 Oct 2024 15:22:13 +0000

commit 3be3ae07705af77ab1c87c2e442c7646c938ad25
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Oct 21 15:07:54 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 22 16:16:43 2024 +0100

    CI: Rework domU_config generation in qubes-x86-64.sh
    
    Right now, various blocks rewrite domU_config= as a whole, even though it is
    largely the same.
    
     * dom0pvh-hvm does nothing but change the domain type to hvm
     * *-pci sets the domain type, clears vif=[], appends earlyprintk=xen to the
       cmdline, and adds some PCI config.
    
    Refactor this to be domU_type (defaults to pvh), domU_vif (defaults to
    xenbr0), and domU_extra_config (defaults to empty) and use these variables to
    build domU_config= once.
    
    Of note, the default domU_config= now sets cmdline=, and extra= is intended
    for inclusion via domU_extra_config as necessary.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 automation/scripts/qubes-x86-64.sh | 50 ++++++++++++++++----------------------
 1 file changed, 21 insertions(+), 29 deletions(-)

diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
index 306304e921..76fbafac84 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -15,16 +15,9 @@ test_variant=$1
 extra_xen_opts=
 wait_and_wakeup=
 timeout=120
-domU_config='
-type = "pvh"
-name = "domU"
-kernel = "/boot/vmlinuz"
-ramdisk = "/boot/initrd-domU"
-extra = "root=/dev/ram0 console=hvc0"
-memory = 512
-vif = [ "bridge=xenbr0", ]
-disk = [ ]
-'
+domU_type="pvh"
+domU_vif="'bridge=xenbr0',"
+domU_extra_config=
 
 case "${test_variant}" in
     ### test: smoke test & smoke test PVH & smoke test HVM
@@ -50,16 +43,7 @@ echo \"${passed}\"
         fi
 
         if [ "${test_variant}" = "dom0pvh-hvm" ]; then
-            domU_config='
-type = "hvm"
-name = "domU"
-kernel = "/boot/vmlinuz"
-ramdisk = "/boot/initrd-domU"
-extra = "root=/dev/ram0 console=hvc0"
-memory = 512
-vif = [ "bridge=xenbr0", ]
-disk = [ ]
-'
+            domU_type="hvm"
         fi
         ;;
 
@@ -101,15 +85,11 @@ echo \"${passed}\"
 
         passed="pci test passed"
 
-        domU_config='
-type = "'${test_variant#pci-}'"
-name = "domU"
-kernel = "/boot/vmlinuz"
-ramdisk = "/boot/initrd-domU"
-extra = "root=/dev/ram0 console=hvc0 earlyprintk=xen"
-memory = 512
-vif = [ ]
-disk = [ ]
+        domU_type="${test_variant#pci-}"
+        domU_vif=""
+
+        domU_extra_config='
+extra = "earlyprintk=xen"
 pci = [ "'$PCIDEV',seize=1" ]
 on_reboot = "destroy"
 '
@@ -148,6 +128,18 @@ done
         ;;
 esac
 
+domU_config="
+type = '${domU_type}'
+name = 'domU'
+kernel = '/boot/vmlinuz'
+ramdisk = '/boot/initrd-domU'
+cmdline = 'root=/dev/ram0 console=hvc0'
+memory = 512
+vif = [ ${domU_vif} ]
+disk = [ ]
+${domU_extra_config}
+"
+
 # DomU
 mkdir -p rootfs
 cd rootfs
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 22 15:22:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 22 Oct 2024 15:22:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824241.1238340 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3GiH-0003IS-9o; Tue, 22 Oct 2024 15:22:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 824241.1238340; Tue, 22 Oct 2024 15: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 1t3GiH-0003IK-7K; Tue, 22 Oct 2024 15:22:25 +0000
Received: by outflank-mailman (input) for mailman id 824241;
 Tue, 22 Oct 2024 15: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 1t3GiF-0003I7-UN
 for xen-changelog@lists.xenproject.org; Tue, 22 Oct 2024 15: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 1t3GiF-000693-SV
 for xen-changelog@lists.xenproject.org; Tue, 22 Oct 2024 15:22:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3GiF-0005jJ-R4
 for xen-changelog@lists.xenproject.org; Tue, 22 Oct 2024 15: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=y9XV/kxr+j6O9GQRRwhv6lLdvQ/ofFlDlPs89MtZ1Cw=; b=Je8ZNGJv2VdO+X/SBkmHT2/mUz
	eEDY1XP+WhzmxebWoluY/SugbS12PQf0Q5jYi7sL7urmQCif/B+kZfvkxIJ6N7jKAzL5H+HTS10OR
	/tb2hmbqJo+qdSrTsVBMylY/YaY7diAXtINthL370ePn9ttyqR29EdFT+HQ3qTy913Y4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CI: Add {adl,zen3p}-pvshim-* tests
Message-Id: <E1t3GiF-0005jJ-R4@xenbits.xenproject.org>
Date: Tue, 22 Oct 2024 15:22:23 +0000

commit b837d02163ff19e2440cae766e2bc50956da5410
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Oct 21 14:17:56 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 22 16:16:43 2024 +0100

    CI: Add {adl,zen3p}-pvshim-* tests
    
    GitlabCI has no testing of Xen's PVH entrypoint.  Fix this.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 automation/gitlab-ci/test.yaml     | 16 ++++++++++++++++
 automation/scripts/qubes-x86-64.sh |  8 ++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index b27c2be174..e76a37bef3 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -240,6 +240,14 @@ adl-pci-hvm-x86-64-gcc-debug:
     - *x86-64-test-needs
     - alpine-3.18-gcc-debug
 
+adl-pvshim-x86-64-gcc-debug:
+  extends: .adl-x86-64
+  script:
+    - ./automation/scripts/qubes-x86-64.sh pvshim 2>&1 | tee ${LOGFILE}
+  needs:
+    - *x86-64-test-needs
+    - alpine-3.18-gcc-debug
+
 zen3p-smoke-x86-64-gcc-debug:
   extends: .zen3p-x86-64
   script:
@@ -272,6 +280,14 @@ zen3p-pci-hvm-x86-64-gcc-debug:
     - *x86-64-test-needs
     - alpine-3.18-gcc-debug
 
+zen3p-pvshim-x86-64-gcc-debug:
+  extends: .zen3p-x86-64
+  script:
+    - ./automation/scripts/qubes-x86-64.sh pvshim 2>&1 | tee ${LOGFILE}
+  needs:
+    - *x86-64-test-needs
+    - alpine-3.18-gcc-debug
+
 qemu-smoke-dom0-arm64-gcc:
   extends: .qemu-arm64
   script:
diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
index 76fbafac84..8a0b7bfbc0 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -8,6 +8,7 @@ set -ex
 #  - dom0pvh-hvm    PVH dom0, HVM domU
 #  - pci-hvm        PV dom0,  HVM domU + PCI Passthrough
 #  - pci-pv         PV dom0,  PV domU + PCI Passthrough
+#  - pvshim         PV dom0,  PVSHIM domU
 #  - s3             PV dom0,  S3 suspend/resume
 test_variant=$1
 
@@ -20,8 +21,8 @@ domU_vif="'bridge=xenbr0',"
 domU_extra_config=
 
 case "${test_variant}" in
-    ### test: smoke test & smoke test PVH & smoke test HVM
-    ""|"dom0pvh"|"dom0pvh-hvm")
+    ### test: smoke test & smoke test PVH & smoke test HVM & smoke test PVSHIM
+    ""|"dom0pvh"|"dom0pvh-hvm"|"pvshim")
         passed="ping test passed"
         domU_check="
 ifconfig eth0 192.168.0.2
@@ -44,6 +45,9 @@ echo \"${passed}\"
 
         if [ "${test_variant}" = "dom0pvh-hvm" ]; then
             domU_type="hvm"
+        elif [ "${test_variant}" = "pvshim" ]; then
+            domU_type="pvh"
+            domU_extra_config='pvshim = 1'
         fi
         ;;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 22 15:22:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 22 Oct 2024 15:22:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824242.1238344 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3GiR-0003LS-BN; Tue, 22 Oct 2024 15:22:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 824242.1238344; Tue, 22 Oct 2024 15:22: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 1t3GiR-0003LK-8k; Tue, 22 Oct 2024 15:22:35 +0000
Received: by outflank-mailman (input) for mailman id 824242;
 Tue, 22 Oct 2024 15:22: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 1t3GiQ-0003L5-1F
 for xen-changelog@lists.xenproject.org; Tue, 22 Oct 2024 15:22: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 1t3GiP-00069C-Vj
 for xen-changelog@lists.xenproject.org; Tue, 22 Oct 2024 15:22:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3GiP-0005la-Ue
 for xen-changelog@lists.xenproject.org; Tue, 22 Oct 2024 15: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=LVFKgYlNwFeEqkwSj3sKu0SAlWH6Pul/t+jLI0s0CrE=; b=g6fSC86OX68u0YXrE3i2fZW6jO
	oK1cUP22iq2AwLw8YBBulv1wfBKEOnAU8KBKU1RRsrR1iX547A/JShNUrYCm1zcnNsx6zeQNSiJcx
	2rElaKUymGPE4ygFFm07qvXjd/kZzkohMV3zkvDJKiE535dn/eNBayVQOXsfh+fFjhMw=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Fix PVH boot during boot_info transition period
Message-Id: <E1t3GiP-0005la-Ue@xenbits.xenproject.org>
Date: Tue, 22 Oct 2024 15:22:33 +0000

commit 0fe607b2a1440191b59cc6da83a3e717bf3ff7c0
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Oct 22 11:15:26 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 22 16:16:43 2024 +0100

    x86/boot: Fix PVH boot during boot_info transition period
    
    multiboot_fill_boot_info() taking the physical address of the multiboot_info
    structure leads to a subtle use-after-free on the PVH path, with rather less
    subtle fallout.
    
    The pointers used by __start_xen(), mbi and mod, are either:
    
     - MB:  Directmap pointers into the trampoline, or
     - PVH: Xen pointers into .initdata, or
     - EFI: Directmap pointers into Xen.
    
    Critically, these either remain valid across move_xen() (MB, PVH), or rely on
    move_xen() being inhibited (EFI).
    
    The conversion to multiboot_fill_boot_info(), taking only mbi_p, makes the PVH
    path use directmap pointers into Xen, as well as move_xen() which invalidates
    said pointers.
    
    Switch multiboot_fill_boot_info() to consume the same virtual addresses that
    __start_xen() currently uses.  This keeps all the pointers valid for the
    duration of __start_xen(), for all boot protocols.
    
    It can be safely untangled once multiboot_fill_boot_info() takes a full copy
    the multiboot info data, and __start_xen() has been moved over to using the
    new boot_info consistently.
    
    Right now, bi->{loader,cmdline,mods} are problematic.  Nothing uses
    bi->mods[], and nothing uses bi->cmdline after move_xen().
    
    bi->loader is used after move_xen(), although only for cmdline_cook() of
    dom0's cmdline, where it happens to be benign because PVH boot skips the
    inspection of the bootloader name.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/setup.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index db670258d6..20392c2abf 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -283,11 +283,10 @@ struct boot_info __initdata xen_boot_info = {
     .cmdline = "",
 };
 
-static struct boot_info *__init multiboot_fill_boot_info(unsigned long mbi_p)
+static struct boot_info *__init multiboot_fill_boot_info(
+    const multiboot_info_t *mbi, module_t *mods)
 {
     struct boot_info *bi = &xen_boot_info;
-    const multiboot_info_t *mbi = __va(mbi_p);
-    module_t *mods = __va(mbi->mods_addr);
     unsigned int i;
 
     if ( mbi->flags & MBI_MODULES )
@@ -1065,15 +1064,31 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     {
         ASSERT(mbi_p == 0);
         pvh_init(&mbi, &mod);
-        mbi_p = __pa(mbi);
+        /*
+         * mbi and mod are regular pointers to .initdata.  These remain valid
+         * across move_xen().
+         */
     }
     else
     {
         mbi = __va(mbi_p);
         mod = __va(mbi->mods_addr);
+
+        /*
+         * For MB1/2, mbi and mod are directmap pointers into the trampoline.
+         * These remain valid across move_xen().
+         *
+         * For EFI, these are directmap pointers into the Xen image.  They do
+         * not remain valid across move_xen().  EFI boot only functions
+         * because a non-zero xen_phys_start inhibits move_xen().
+         *
+         * Don't be fooled by efi_arch_post_exit_boot() passing "D" (&mbi).
+         * This is a EFI physical-mode (i.e. identity map) pointer.
+         */
+        ASSERT(mbi_p < MB(1) || xen_phys_start);
     }
 
-    bi = multiboot_fill_boot_info(mbi_p);
+    bi = multiboot_fill_boot_info(mbi, mod);
 
     /* Parse the command-line options. */
     if ( (kextra = strstr(bi->cmdline, " -- ")) != NULL )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 22 15:22:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 22 Oct 2024 15:22:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824243.1238348 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3Gib-0003OS-Cg; Tue, 22 Oct 2024 15:22:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 824243.1238348; Tue, 22 Oct 2024 15:22: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 1t3Gib-0003OK-A6; Tue, 22 Oct 2024 15:22:45 +0000
Received: by outflank-mailman (input) for mailman id 824243;
 Tue, 22 Oct 2024 15:22: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 1t3Gia-0003OA-3i
 for xen-changelog@lists.xenproject.org; Tue, 22 Oct 2024 15:22: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 1t3Gia-00069M-2w
 for xen-changelog@lists.xenproject.org; Tue, 22 Oct 2024 15:22:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3Gia-0005mI-1T
 for xen-changelog@lists.xenproject.org; Tue, 22 Oct 2024 15:22: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=2rqzZWORWZgUDrndmXK+vKo+TxBb2Nax+h03HOJ5zpU=; b=6S8wVoGaHoMPrqWSQh5MJTsy80
	arfrtA3hHgCsto1z3VqKusIu76TcoUEOOyf7boJq48s3ETQnHbY/r6HusXU8Sf4Zxy1s3e75XFzoA
	dpc13KQjtnr9KawfXNu8tFLwBPJ1LrgeUFt2+/eWqi0U/71uHT6ZUpwc61m7mHK+MVCY=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/pv: remove unlikely() from BUG_ON() condition in pv_map_ldt_shadow_page()
Message-Id: <E1t3Gia-0005mI-1T@xenbits.xenproject.org>
Date: Tue, 22 Oct 2024 15:22:44 +0000

commit 79560b68a16e5ddd1d2dbda14f3e236bcd3b230f
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Oct 22 13:46:07 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 22 16:16:43 2024 +0100

    x86/pv: remove unlikely() from BUG_ON() condition in pv_map_ldt_shadow_page()
    
    BUG_ON() itself already contains an unlikely() wrapping the bug condition.
    
    No functional change.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/pv/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/pv/mm.c b/xen/arch/x86/pv/mm.c
index 24f0d2e4ff..187f5f6a3e 100644
--- a/xen/arch/x86/pv/mm.c
+++ b/xen/arch/x86/pv/mm.c
@@ -55,7 +55,7 @@ bool pv_map_ldt_shadow_page(unsigned int offset)
     l1_pgentry_t gl1e, *pl1e;
     unsigned long linear = curr->arch.pv.ldt_base + offset;
 
-    BUG_ON(unlikely(in_irq()));
+    BUG_ON(in_irq());
 
     /*
      * Prior limit checking should guarantee this property.  NB. This is
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 22 16:00:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 22 Oct 2024 16:00:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824261.1238362 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3HIj-0000BA-4V; Tue, 22 Oct 2024 16:00:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 824261.1238362; Tue, 22 Oct 2024 16: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 1t3HIj-0000Ao-0r; Tue, 22 Oct 2024 16:00:05 +0000
Received: by outflank-mailman (input) for mailman id 824261;
 Tue, 22 Oct 2024 16: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 1t3HIh-0008Nb-N3
 for xen-changelog@lists.xenproject.org; Tue, 22 Oct 2024 16: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 1t3HIh-0007CL-Jp
 for xen-changelog@lists.xenproject.org; Tue, 22 Oct 2024 16:00:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3HIh-0008S2-IB
 for xen-changelog@lists.xenproject.org; Tue, 22 Oct 2024 16: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=coiUV3uI/WHTGR6SgeCkOx375mUuuU/hnt89Vf9gFwM=; b=L6ShiOAmREx2vhlzu2A1FOHtdv
	5iMVnoGM4hW2jTydUpnUih/G5mV0DFEsfVeMEp5W7hMKtjCwTKzksD+ITpNHulBS2PqdVblUrh0LM
	dEIzw46qFnenP2jPcv+e92MInUlhd8iBgBqnvJSSEHOe/iiNV/k5SvXliiz9dUleVRqU=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/emul: address violations of MISRA C Rule 16.3
Message-Id: <E1t3HIh-0008S2-IB@xenbits.xenproject.org>
Date: Tue, 22 Oct 2024 16:00:03 +0000

commit 70262d59403b5cc94f076addee187f03e30a9687
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Mon Oct 21 11:55:10 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 22 16:49:30 2024 +0100

    x86/emul: address violations of MISRA C Rule 16.3
    
    Add missing break statements to address violations of MISRA C:2012
    Rule 16.3 (An unconditional `break' statement shall terminate
    every switch-clause).
    
    Make explicit unreachability of a program point with
    ASSERT_UNREACHABLE() and add defensive code.
    
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/fpu.c         | 5 +++++
 xen/arch/x86/x86_emulate/x86_emulate.c | 1 +
 2 files changed, 6 insertions(+)

diff --git a/xen/arch/x86/x86_emulate/fpu.c b/xen/arch/x86/x86_emulate/fpu.c
index 480d879657..54c8621421 100644
--- a/xen/arch/x86/x86_emulate/fpu.c
+++ b/xen/arch/x86/x86_emulate/fpu.c
@@ -218,6 +218,7 @@ int x86emul_fpu(struct x86_emulate_state *s,
              */
             if ( dst->type == OP_MEM && !s->fpu_ctrl && !fpu_check_write() )
                 dst->type = OP_NONE;
+            break;
         }
         break;
 
@@ -296,6 +297,7 @@ int x86emul_fpu(struct x86_emulate_state *s,
             default:
                 generate_exception(X86_EXC_UD);
             }
+            break;
         }
         break;
 
@@ -386,6 +388,7 @@ int x86emul_fpu(struct x86_emulate_state *s,
              */
             if ( dst->type == OP_MEM && !s->fpu_ctrl && !fpu_check_write() )
                 dst->type = OP_NONE;
+            break;
         }
         break;
 
@@ -457,6 +460,8 @@ int x86emul_fpu(struct x86_emulate_state *s,
             case 7: /* fistp m64i */
                 goto fpu_memdst64;
             }
+            ASSERT_UNREACHABLE();
+            return X86EMUL_UNHANDLEABLE;
         }
         break;
 
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 6b6b8c8fe4..30674ec301 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -8310,6 +8310,7 @@ x86_emulate(
         }
         if ( rc != 0 )
             goto done;
+        break;
     default:
         break;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 23 02:44:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 23 Oct 2024 02:44:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824382.1238496 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3RLv-0003J3-Qd; Wed, 23 Oct 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 824382.1238496; Wed, 23 Oct 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 1t3RLv-0003Iv-O1; Wed, 23 Oct 2024 02:44:03 +0000
Received: by outflank-mailman (input) for mailman id 824382;
 Wed, 23 Oct 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 1t3RLt-0003Ip-Tn
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 02: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 1t3RLt-0001ll-R6
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 02:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3RLt-0004Fd-OS
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 02: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=NTyYABwHIVbUrs6t/wRSfoFDCo5FFjkgo3em6D6IUoU=; b=PJTnWhKIODwh/NnqahR+h3+Sq6
	x4gGZ0Wl3Nl8F05Be3OosSQ2s1nkVJKPfPqCfZWKCecTks4KTSiMW6zbJc+HVsASu1U0301UcE/Pw
	knNJr0wuureE9UjQQPgFiwLXatXvif7kinikRFdDbA2mMIeMKX/BVS8dgTDDyfHal23s=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Minor cleanup to qubes-x86-64.sh
Message-Id: <E1t3RLt-0004Fd-OS@xenbits.xenproject.org>
Date: Wed, 23 Oct 2024 02:44:01 +0000

commit 6685a129c7864e3733afef09a2539ccd722a4380
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Oct 21 14:06:24 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 22 16:16:43 2024 +0100

    CI: Minor cleanup to qubes-x86-64.sh
    
     * List all the test_variants and summerise what's going on
     * Use case rather than an if/else chain for $test_variant
     * Adjust indentation inside the case block
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 automation/scripts/qubes-x86-64.sh | 84 +++++++++++++++++++++++---------------
 1 file changed, 50 insertions(+), 34 deletions(-)

diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
index bfa60c912a..306304e921 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -2,6 +2,13 @@
 
 set -ex
 
+# One of:
+#  - ""             PV dom0,  PVH domU
+#  - dom0pvh        PVH dom0, PVH domU
+#  - dom0pvh-hvm    PVH dom0, HVM domU
+#  - pci-hvm        PV dom0,  HVM domU + PCI Passthrough
+#  - pci-pv         PV dom0,  PV domU + PCI Passthrough
+#  - s3             PV dom0,  S3 suspend/resume
 test_variant=$1
 
 ### defaults
@@ -19,17 +26,18 @@ vif = [ "bridge=xenbr0", ]
 disk = [ ]
 '
 
-### test: smoke test & smoke test PVH & smoke test HVM
-if [ -z "${test_variant}" ] || [ "${test_variant}" = "dom0pvh" ] || [ "${test_variant}" = "dom0pvh-hvm" ]; then
-    passed="ping test passed"
-    domU_check="
+case "${test_variant}" in
+    ### test: smoke test & smoke test PVH & smoke test HVM
+    ""|"dom0pvh"|"dom0pvh-hvm")
+        passed="ping test passed"
+        domU_check="
 ifconfig eth0 192.168.0.2
 until ping -c 10 192.168.0.1; do
     sleep 1
 done
 echo \"${passed}\"
 "
-    dom0_check="
+        dom0_check="
 set +x
 until grep -q \"${passed}\" /var/log/xen/console/guest-domU.log; do
     sleep 1
@@ -37,12 +45,12 @@ done
 set -x
 echo \"${passed}\"
 "
-if [ "${test_variant}" = "dom0pvh" ] || [ "${test_variant}" = "dom0pvh-hvm" ]; then
-    extra_xen_opts="dom0=pvh"
-fi
+        if [ "${test_variant}" = "dom0pvh" ] || [ "${test_variant}" = "dom0pvh-hvm" ]; then
+            extra_xen_opts="dom0=pvh"
+        fi
 
-if [ "${test_variant}" = "dom0pvh-hvm" ]; then
-    domU_config='
+        if [ "${test_variant}" = "dom0pvh-hvm" ]; then
+            domU_config='
 type = "hvm"
 name = "domU"
 kernel = "/boot/vmlinuz"
@@ -52,17 +60,18 @@ memory = 512
 vif = [ "bridge=xenbr0", ]
 disk = [ ]
 '
-fi
-
-### test: S3
-elif [ "${test_variant}" = "s3" ]; then
-    passed="suspend test passed"
-    wait_and_wakeup="started, suspending"
-    domU_check="
+        fi
+        ;;
+
+    ### test: S3
+    "s3")
+        passed="suspend test passed"
+        wait_and_wakeup="started, suspending"
+        domU_check="
 ifconfig eth0 192.168.0.2
 echo domU started
 "
-    dom0_check="
+        dom0_check="
 until grep 'domU started' /var/log/xen/console/guest-domU.log; do
     sleep 1
 done
@@ -79,19 +88,20 @@ xl dmesg | grep 'Finishing wakeup from ACPI S3 state' || exit 1
 ping -c 10 192.168.0.2 || exit 1
 echo \"${passed}\"
 "
+        ;;
 
-### test: pci-pv, pci-hvm
-elif [ "${test_variant}" = "pci-pv" ] || [ "${test_variant}" = "pci-hvm" ]; then
+    ### test: pci-pv, pci-hvm
+    "pci-pv"|"pci-hvm")
 
-    if [ -z "$PCIDEV" ]; then
-        echo "Please set 'PCIDEV' variable with BDF of test network adapter" >&2
-        echo "Optionally set also 'PCIDEV_INTR' to 'MSI' or 'MSI-X'" >&2
-        exit 1
-    fi
+        if [ -z "$PCIDEV" ]; then
+            echo "Please set 'PCIDEV' variable with BDF of test network adapter" >&2
+            echo "Optionally set also 'PCIDEV_INTR' to 'MSI' or 'MSI-X'" >&2
+            exit 1
+        fi
 
-    passed="pci test passed"
+        passed="pci test passed"
 
-    domU_config='
+        domU_config='
 type = "'${test_variant#pci-}'"
 name = "domU"
 kernel = "/boot/vmlinuz"
@@ -104,7 +114,7 @@ pci = [ "'$PCIDEV',seize=1" ]
 on_reboot = "destroy"
 '
 
-    domU_check="
+        domU_check="
 set -x -e
 interface=eth0
 ip link set \"\$interface\" up
@@ -115,22 +125,28 @@ echo domU started
 pcidevice=\$(basename \$(readlink /sys/class/net/\$interface/device))
 lspci -vs \$pcidevice
 "
-    if [ -n "$PCIDEV_INTR" ]; then
-        domU_check="$domU_check
+        if [ -n "$PCIDEV_INTR" ]; then
+            domU_check="$domU_check
 lspci -vs \$pcidevice | fgrep '$PCIDEV_INTR: Enable+'
 "
-    fi
-    domU_check="$domU_check
+        fi
+        domU_check="$domU_check
 echo \"${passed}\"
 "
 
-    dom0_check="
+        dom0_check="
 tail -F /var/log/xen/qemu-dm-domU.log &
 until grep -q \"^domU Welcome to Alpine Linux\" /var/log/xen/console/guest-domU.log; do
     sleep 1
 done
 "
-fi
+        ;;
+
+    *)
+        echo "Unrecognised test_variant '${test_variant}'" >&2
+        exit 1
+        ;;
+esac
 
 # DomU
 mkdir -p rootfs
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 23 02:44:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 23 Oct 2024 02:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824383.1238502 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3RM5-0003Kq-Si; Wed, 23 Oct 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 824383.1238502; Wed, 23 Oct 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 1t3RM5-0003Ki-PU; Wed, 23 Oct 2024 02:44:13 +0000
Received: by outflank-mailman (input) for mailman id 824383;
 Wed, 23 Oct 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 1t3RM4-0003KU-0J
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 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 1t3RM3-0001lr-Vo
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 02:44:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3RM3-0004IW-TE
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 02: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=vXVfglP/Boid7XXt80mYWybCbfVt2QKBhR09L32tOgQ=; b=F+E2Y4zFhXhI3HB6TuDlQJVkkV
	PXhg24BOJL2i/OHNoV0w6QCkqvh2bzvp1cep28rOVKrxZ72CMr4488Pf+s4PD7zsG8zslagXaZW9l
	+Lhy0bla0oKtJQm743yGyVNIMdAdsffwTk4QDNCmTARhkCwNcO2YawrP8z8wHLwmVez8=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Rework domU_config generation in qubes-x86-64.sh
Message-Id: <E1t3RM3-0004IW-TE@xenbits.xenproject.org>
Date: Wed, 23 Oct 2024 02:44:11 +0000

commit 3be3ae07705af77ab1c87c2e442c7646c938ad25
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Oct 21 15:07:54 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 22 16:16:43 2024 +0100

    CI: Rework domU_config generation in qubes-x86-64.sh
    
    Right now, various blocks rewrite domU_config= as a whole, even though it is
    largely the same.
    
     * dom0pvh-hvm does nothing but change the domain type to hvm
     * *-pci sets the domain type, clears vif=[], appends earlyprintk=xen to the
       cmdline, and adds some PCI config.
    
    Refactor this to be domU_type (defaults to pvh), domU_vif (defaults to
    xenbr0), and domU_extra_config (defaults to empty) and use these variables to
    build domU_config= once.
    
    Of note, the default domU_config= now sets cmdline=, and extra= is intended
    for inclusion via domU_extra_config as necessary.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 automation/scripts/qubes-x86-64.sh | 50 ++++++++++++++++----------------------
 1 file changed, 21 insertions(+), 29 deletions(-)

diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
index 306304e921..76fbafac84 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -15,16 +15,9 @@ test_variant=$1
 extra_xen_opts=
 wait_and_wakeup=
 timeout=120
-domU_config='
-type = "pvh"
-name = "domU"
-kernel = "/boot/vmlinuz"
-ramdisk = "/boot/initrd-domU"
-extra = "root=/dev/ram0 console=hvc0"
-memory = 512
-vif = [ "bridge=xenbr0", ]
-disk = [ ]
-'
+domU_type="pvh"
+domU_vif="'bridge=xenbr0',"
+domU_extra_config=
 
 case "${test_variant}" in
     ### test: smoke test & smoke test PVH & smoke test HVM
@@ -50,16 +43,7 @@ echo \"${passed}\"
         fi
 
         if [ "${test_variant}" = "dom0pvh-hvm" ]; then
-            domU_config='
-type = "hvm"
-name = "domU"
-kernel = "/boot/vmlinuz"
-ramdisk = "/boot/initrd-domU"
-extra = "root=/dev/ram0 console=hvc0"
-memory = 512
-vif = [ "bridge=xenbr0", ]
-disk = [ ]
-'
+            domU_type="hvm"
         fi
         ;;
 
@@ -101,15 +85,11 @@ echo \"${passed}\"
 
         passed="pci test passed"
 
-        domU_config='
-type = "'${test_variant#pci-}'"
-name = "domU"
-kernel = "/boot/vmlinuz"
-ramdisk = "/boot/initrd-domU"
-extra = "root=/dev/ram0 console=hvc0 earlyprintk=xen"
-memory = 512
-vif = [ ]
-disk = [ ]
+        domU_type="${test_variant#pci-}"
+        domU_vif=""
+
+        domU_extra_config='
+extra = "earlyprintk=xen"
 pci = [ "'$PCIDEV',seize=1" ]
 on_reboot = "destroy"
 '
@@ -148,6 +128,18 @@ done
         ;;
 esac
 
+domU_config="
+type = '${domU_type}'
+name = 'domU'
+kernel = '/boot/vmlinuz'
+ramdisk = '/boot/initrd-domU'
+cmdline = 'root=/dev/ram0 console=hvc0'
+memory = 512
+vif = [ ${domU_vif} ]
+disk = [ ]
+${domU_extra_config}
+"
+
 # DomU
 mkdir -p rootfs
 cd rootfs
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 23 02:44:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 23 Oct 2024 02:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824384.1238505 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3RMF-0003Nc-U5; Wed, 23 Oct 2024 02:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 824384.1238505; Wed, 23 Oct 2024 02: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 1t3RMF-0003NS-Qt; Wed, 23 Oct 2024 02:44:23 +0000
Received: by outflank-mailman (input) for mailman id 824384;
 Wed, 23 Oct 2024 02: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 1t3RME-0003NC-5c
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 02: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 1t3RME-0001mK-4o
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 02:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3RME-0004JO-1e
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 02: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=kmuukOJ8I+DYOZ+uohk2eYwohxPUx54yQLlcnGTZBR8=; b=v7fNoDKEaG/L/i3FvHGZ/KNJPN
	Pv5URgDenqFjrpXNvELcnewScdumS/TdUVQxHm5dl3fKF6otltZ4iP2rA5WZDRYa78H4u74LVPQiz
	HBIqQkhTt6TbWriJ9EFzxAdmP6y2H30H0cH8A7v68eGpcZal4N5os7WhGJKd4moeESx4=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Add {adl,zen3p}-pvshim-* tests
Message-Id: <E1t3RME-0004JO-1e@xenbits.xenproject.org>
Date: Wed, 23 Oct 2024 02:44:22 +0000

commit b837d02163ff19e2440cae766e2bc50956da5410
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Oct 21 14:17:56 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 22 16:16:43 2024 +0100

    CI: Add {adl,zen3p}-pvshim-* tests
    
    GitlabCI has no testing of Xen's PVH entrypoint.  Fix this.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 automation/gitlab-ci/test.yaml     | 16 ++++++++++++++++
 automation/scripts/qubes-x86-64.sh |  8 ++++++--
 2 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index b27c2be174..e76a37bef3 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -240,6 +240,14 @@ adl-pci-hvm-x86-64-gcc-debug:
     - *x86-64-test-needs
     - alpine-3.18-gcc-debug
 
+adl-pvshim-x86-64-gcc-debug:
+  extends: .adl-x86-64
+  script:
+    - ./automation/scripts/qubes-x86-64.sh pvshim 2>&1 | tee ${LOGFILE}
+  needs:
+    - *x86-64-test-needs
+    - alpine-3.18-gcc-debug
+
 zen3p-smoke-x86-64-gcc-debug:
   extends: .zen3p-x86-64
   script:
@@ -272,6 +280,14 @@ zen3p-pci-hvm-x86-64-gcc-debug:
     - *x86-64-test-needs
     - alpine-3.18-gcc-debug
 
+zen3p-pvshim-x86-64-gcc-debug:
+  extends: .zen3p-x86-64
+  script:
+    - ./automation/scripts/qubes-x86-64.sh pvshim 2>&1 | tee ${LOGFILE}
+  needs:
+    - *x86-64-test-needs
+    - alpine-3.18-gcc-debug
+
 qemu-smoke-dom0-arm64-gcc:
   extends: .qemu-arm64
   script:
diff --git a/automation/scripts/qubes-x86-64.sh b/automation/scripts/qubes-x86-64.sh
index 76fbafac84..8a0b7bfbc0 100755
--- a/automation/scripts/qubes-x86-64.sh
+++ b/automation/scripts/qubes-x86-64.sh
@@ -8,6 +8,7 @@ set -ex
 #  - dom0pvh-hvm    PVH dom0, HVM domU
 #  - pci-hvm        PV dom0,  HVM domU + PCI Passthrough
 #  - pci-pv         PV dom0,  PV domU + PCI Passthrough
+#  - pvshim         PV dom0,  PVSHIM domU
 #  - s3             PV dom0,  S3 suspend/resume
 test_variant=$1
 
@@ -20,8 +21,8 @@ domU_vif="'bridge=xenbr0',"
 domU_extra_config=
 
 case "${test_variant}" in
-    ### test: smoke test & smoke test PVH & smoke test HVM
-    ""|"dom0pvh"|"dom0pvh-hvm")
+    ### test: smoke test & smoke test PVH & smoke test HVM & smoke test PVSHIM
+    ""|"dom0pvh"|"dom0pvh-hvm"|"pvshim")
         passed="ping test passed"
         domU_check="
 ifconfig eth0 192.168.0.2
@@ -44,6 +45,9 @@ echo \"${passed}\"
 
         if [ "${test_variant}" = "dom0pvh-hvm" ]; then
             domU_type="hvm"
+        elif [ "${test_variant}" = "pvshim" ]; then
+            domU_type="pvh"
+            domU_extra_config='pvshim = 1'
         fi
         ;;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 23 02:44:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 23 Oct 2024 02:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824385.1238507 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3RMP-0003QJ-Uw; Wed, 23 Oct 2024 02:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 824385.1238507; Wed, 23 Oct 2024 02:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3RMP-0003QB-SL; Wed, 23 Oct 2024 02:44:33 +0000
Received: by outflank-mailman (input) for mailman id 824385;
 Wed, 23 Oct 2024 02:44: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 1t3RMO-0003Pv-Al
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 02:44: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 1t3RMO-0001mW-9x
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 02:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3RMO-0004KU-77
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 02:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=X78eHxZHLso6a7fZBbHIP/TuQRrLQrhuLdxrTZfMf1s=; b=J3NsCExD8Ud9h2t7t+EIaDGZ/K
	YslVpRzvis8T1U4eQ6WRm6oafZt3D1j7CDmqxzc8A6+NYlMrkitATSG1Bl2tAEyE+zLQ09GS2ZIJT
	xSfSwcMtsG4S3W5BQUI31BqlogYVh29i93W6+iUInAqgobCxL3AM/Rb0IsfA3p8m4zzo=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Fix PVH boot during boot_info transition period
Message-Id: <E1t3RMO-0004KU-77@xenbits.xenproject.org>
Date: Wed, 23 Oct 2024 02:44:32 +0000

commit 0fe607b2a1440191b59cc6da83a3e717bf3ff7c0
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Oct 22 11:15:26 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 22 16:16:43 2024 +0100

    x86/boot: Fix PVH boot during boot_info transition period
    
    multiboot_fill_boot_info() taking the physical address of the multiboot_info
    structure leads to a subtle use-after-free on the PVH path, with rather less
    subtle fallout.
    
    The pointers used by __start_xen(), mbi and mod, are either:
    
     - MB:  Directmap pointers into the trampoline, or
     - PVH: Xen pointers into .initdata, or
     - EFI: Directmap pointers into Xen.
    
    Critically, these either remain valid across move_xen() (MB, PVH), or rely on
    move_xen() being inhibited (EFI).
    
    The conversion to multiboot_fill_boot_info(), taking only mbi_p, makes the PVH
    path use directmap pointers into Xen, as well as move_xen() which invalidates
    said pointers.
    
    Switch multiboot_fill_boot_info() to consume the same virtual addresses that
    __start_xen() currently uses.  This keeps all the pointers valid for the
    duration of __start_xen(), for all boot protocols.
    
    It can be safely untangled once multiboot_fill_boot_info() takes a full copy
    the multiboot info data, and __start_xen() has been moved over to using the
    new boot_info consistently.
    
    Right now, bi->{loader,cmdline,mods} are problematic.  Nothing uses
    bi->mods[], and nothing uses bi->cmdline after move_xen().
    
    bi->loader is used after move_xen(), although only for cmdline_cook() of
    dom0's cmdline, where it happens to be benign because PVH boot skips the
    inspection of the bootloader name.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/setup.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index db670258d6..20392c2abf 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -283,11 +283,10 @@ struct boot_info __initdata xen_boot_info = {
     .cmdline = "",
 };
 
-static struct boot_info *__init multiboot_fill_boot_info(unsigned long mbi_p)
+static struct boot_info *__init multiboot_fill_boot_info(
+    const multiboot_info_t *mbi, module_t *mods)
 {
     struct boot_info *bi = &xen_boot_info;
-    const multiboot_info_t *mbi = __va(mbi_p);
-    module_t *mods = __va(mbi->mods_addr);
     unsigned int i;
 
     if ( mbi->flags & MBI_MODULES )
@@ -1065,15 +1064,31 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     {
         ASSERT(mbi_p == 0);
         pvh_init(&mbi, &mod);
-        mbi_p = __pa(mbi);
+        /*
+         * mbi and mod are regular pointers to .initdata.  These remain valid
+         * across move_xen().
+         */
     }
     else
     {
         mbi = __va(mbi_p);
         mod = __va(mbi->mods_addr);
+
+        /*
+         * For MB1/2, mbi and mod are directmap pointers into the trampoline.
+         * These remain valid across move_xen().
+         *
+         * For EFI, these are directmap pointers into the Xen image.  They do
+         * not remain valid across move_xen().  EFI boot only functions
+         * because a non-zero xen_phys_start inhibits move_xen().
+         *
+         * Don't be fooled by efi_arch_post_exit_boot() passing "D" (&mbi).
+         * This is a EFI physical-mode (i.e. identity map) pointer.
+         */
+        ASSERT(mbi_p < MB(1) || xen_phys_start);
     }
 
-    bi = multiboot_fill_boot_info(mbi_p);
+    bi = multiboot_fill_boot_info(mbi, mod);
 
     /* Parse the command-line options. */
     if ( (kextra = strstr(bi->cmdline, " -- ")) != NULL )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 23 02:44:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 23 Oct 2024 02:44:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824386.1238512 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3RMa-0003TB-0D; Wed, 23 Oct 2024 02:44:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 824386.1238512; Wed, 23 Oct 2024 02:44:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3RMZ-0003T3-Tj; Wed, 23 Oct 2024 02:44:43 +0000
Received: by outflank-mailman (input) for mailman id 824386;
 Wed, 23 Oct 2024 02:44: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 1t3RMY-0003Sd-GO
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 02:44: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 1t3RMY-0001mf-Eb
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 02:44:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3RMY-0004LN-C3
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 02:44:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=hgwb0GlE1OdbKuoQblgn7tIvf6OmzP05Sk3dVjsdiZ0=; b=fa5dm0FUTRUbPZNaN8jBwZLu5E
	x4tVclmzBK1nvKeRcWt6/RUnnxPmdhzMAzeQaaC2f64EbTcyqiEeZHVR5ezFRnM2B78Ka5MWzMa7K
	pMGYCiHoeW4AjSagya1MuOTrndAyZ9eNvC7yhbTwM/4ZceSxbHvNbTTPntfPvOuwur2c=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/pv: remove unlikely() from BUG_ON() condition in pv_map_ldt_shadow_page()
Message-Id: <E1t3RMY-0004LN-C3@xenbits.xenproject.org>
Date: Wed, 23 Oct 2024 02:44:42 +0000

commit 79560b68a16e5ddd1d2dbda14f3e236bcd3b230f
Author:     Roger Pau Monne <roger.pau@citrix.com>
AuthorDate: Tue Oct 22 13:46:07 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 22 16:16:43 2024 +0100

    x86/pv: remove unlikely() from BUG_ON() condition in pv_map_ldt_shadow_page()
    
    BUG_ON() itself already contains an unlikely() wrapping the bug condition.
    
    No functional change.
    
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/pv/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/pv/mm.c b/xen/arch/x86/pv/mm.c
index 24f0d2e4ff..187f5f6a3e 100644
--- a/xen/arch/x86/pv/mm.c
+++ b/xen/arch/x86/pv/mm.c
@@ -55,7 +55,7 @@ bool pv_map_ldt_shadow_page(unsigned int offset)
     l1_pgentry_t gl1e, *pl1e;
     unsigned long linear = curr->arch.pv.ldt_base + offset;
 
-    BUG_ON(unlikely(in_irq()));
+    BUG_ON(in_irq());
 
     /*
      * Prior limit checking should guarantee this property.  NB. This is
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 23 02:44:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 23 Oct 2024 02:44:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824387.1238517 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3RMk-0003X7-2h; Wed, 23 Oct 2024 02:44:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 824387.1238517; Wed, 23 Oct 2024 02: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 1t3RMj-0003Wx-V6; Wed, 23 Oct 2024 02:44:53 +0000
Received: by outflank-mailman (input) for mailman id 824387;
 Wed, 23 Oct 2024 02:44: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 1t3RMi-0003Wn-JE
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 02:44: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 1t3RMi-0001mu-IV
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 02:44:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3RMi-0004M9-H1
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 02:44:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org;
	s=20200302mail; h=Date:Message-Id:Subject:Reply-To:To:From;
	bh=dzkjIEqfcxtFmSNUPpOFxO/8Sv4EuKhEjUtv5J3nFJk=; b=P1U2Y5qn8CMLLkRq9xK2QX9llo
	LOwQShraWTKPlrjE5FROlYOCQgBOAZkHqibpc8nNiQf8pSGstF9SE0MQL1k+BazplbwlpxdxiXqJo
	OUVlHQhHz34Akl27m7txcZ2rn8+sQt162E/c+BTJwV7mV787w5ROk3a84YBw8uQL31tE=;
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/emul: address violations of MISRA C Rule 16.3
Message-Id: <E1t3RMi-0004M9-H1@xenbits.xenproject.org>
Date: Wed, 23 Oct 2024 02:44:52 +0000

commit 70262d59403b5cc94f076addee187f03e30a9687
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Mon Oct 21 11:55:10 2024 +0200
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 22 16:49:30 2024 +0100

    x86/emul: address violations of MISRA C Rule 16.3
    
    Add missing break statements to address violations of MISRA C:2012
    Rule 16.3 (An unconditional `break' statement shall terminate
    every switch-clause).
    
    Make explicit unreachability of a program point with
    ASSERT_UNREACHABLE() and add defensive code.
    
    No functional change.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/x86_emulate/fpu.c         | 5 +++++
 xen/arch/x86/x86_emulate/x86_emulate.c | 1 +
 2 files changed, 6 insertions(+)

diff --git a/xen/arch/x86/x86_emulate/fpu.c b/xen/arch/x86/x86_emulate/fpu.c
index 480d879657..54c8621421 100644
--- a/xen/arch/x86/x86_emulate/fpu.c
+++ b/xen/arch/x86/x86_emulate/fpu.c
@@ -218,6 +218,7 @@ int x86emul_fpu(struct x86_emulate_state *s,
              */
             if ( dst->type == OP_MEM && !s->fpu_ctrl && !fpu_check_write() )
                 dst->type = OP_NONE;
+            break;
         }
         break;
 
@@ -296,6 +297,7 @@ int x86emul_fpu(struct x86_emulate_state *s,
             default:
                 generate_exception(X86_EXC_UD);
             }
+            break;
         }
         break;
 
@@ -386,6 +388,7 @@ int x86emul_fpu(struct x86_emulate_state *s,
              */
             if ( dst->type == OP_MEM && !s->fpu_ctrl && !fpu_check_write() )
                 dst->type = OP_NONE;
+            break;
         }
         break;
 
@@ -457,6 +460,8 @@ int x86emul_fpu(struct x86_emulate_state *s,
             case 7: /* fistp m64i */
                 goto fpu_memdst64;
             }
+            ASSERT_UNREACHABLE();
+            return X86EMUL_UNHANDLEABLE;
         }
         break;
 
diff --git a/xen/arch/x86/x86_emulate/x86_emulate.c b/xen/arch/x86/x86_emulate/x86_emulate.c
index 6b6b8c8fe4..30674ec301 100644
--- a/xen/arch/x86/x86_emulate/x86_emulate.c
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c
@@ -8310,6 +8310,7 @@ x86_emulate(
         }
         if ( rc != 0 )
             goto done;
+        break;
     default:
         break;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 23 09:55:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 23 Oct 2024 09:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824507.1238630 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3Y52-0000R5-RU; Wed, 23 Oct 2024 09:55:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 824507.1238630; Wed, 23 Oct 2024 09: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 1t3Y52-0000Qx-Ow; Wed, 23 Oct 2024 09:55:04 +0000
Received: by outflank-mailman (input) for mailman id 824507;
 Wed, 23 Oct 2024 09: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 1t3Y51-0000Qr-IV
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 09:55:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3Y51-00036k-1h
 for xen-changelog@lists.xenproject.org;
 Wed, 23 Oct 2024 09:55:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3Y51-0005sx-EH
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 09: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Convert move_memory() to use bootstrap_map_addr()
Message-Id: <E1t3Y51-0005sx-EH@xenbits.xenproject.org>
Date: Wed, 23 Oct 2024 09:55:03 +0000

commit e33e18df05d8238c09fff9c9dcaafe273989c57f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Oct 22 18:33:57 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 23 10:27:36 2024 +0100

    x86/boot: Convert move_memory() to use bootstrap_map_addr()
    
    move_memory() is very complicated, and buggy.  In order to fix the latter, we
    have to address the former.
    
    Given prior cleanup, bootstrap_map() is now implemented in terms of
    bootstrap_map_addr(), meaning that it is counterproductive to plumb the
    mapping through module_t.
    
    Delete mod, and introduce two same-sized/named fields.  At this point in boot,
    neither fields have their named purpose, so indicate the purpose in comments.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/setup.c | 35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 20392c2abf..1199df988d 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -492,26 +492,29 @@ static void __init move_memory(
 
     while ( size )
     {
-        module_t mod;
+        unsigned int start /* frame */;
+        unsigned int end   /* mapsz */;
         unsigned int soffs = src & mask;
         unsigned int doffs = dst & mask;
         unsigned int sz;
         void *d, *s;
 
-        mod.mod_start = (src - soffs) >> PAGE_SHIFT;
-        mod.mod_end = soffs + size;
-        if ( mod.mod_end > blksz )
-            mod.mod_end = blksz;
-        sz = mod.mod_end - soffs;
-        s = bootstrap_map(&mod);
-
-        mod.mod_start = (dst - doffs) >> PAGE_SHIFT;
-        mod.mod_end = doffs + size;
-        if ( mod.mod_end > blksz )
-            mod.mod_end = blksz;
-        if ( sz > mod.mod_end - doffs )
-            sz = mod.mod_end - doffs;
-        d = bootstrap_map(&mod);
+        start = (src - soffs) >> PAGE_SHIFT;
+        end = soffs + size;
+        if ( end > blksz )
+            end = blksz;
+        sz = end - soffs;
+        s = bootstrap_map_addr(pfn_to_paddr(start),
+                               pfn_to_paddr(start) + end);
+
+        start = (dst - doffs) >> PAGE_SHIFT;
+        end = doffs + size;
+        if ( end > blksz )
+            end = blksz;
+        if ( sz > end - doffs )
+            sz = end - doffs;
+        d = bootstrap_map_addr(pfn_to_paddr(start),
+                               pfn_to_paddr(start) + end);
 
         memmove(d + doffs, s + soffs, sz);
 
@@ -519,7 +522,7 @@ static void __init move_memory(
         src += sz;
         size -= sz;
 
-        bootstrap_map(NULL);
+        bootstrap_map_addr(0, 0);
     }
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 23 09:55:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 23 Oct 2024 09:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824508.1238634 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3Y5C-0000Sp-Sw; Wed, 23 Oct 2024 09:55:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 824508.1238634; Wed, 23 Oct 2024 09: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 1t3Y5C-0000Sh-QK; Wed, 23 Oct 2024 09:55:14 +0000
Received: by outflank-mailman (input) for mailman id 824508;
 Wed, 23 Oct 2024 09: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 1t3Y5B-0000SV-M5
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 09:55:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3Y5B-00037D-27
 for xen-changelog@lists.xenproject.org;
 Wed, 23 Oct 2024 09:55:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3Y5B-0005tq-JD
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 09: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Simplify address calculations in move_memory()
Message-Id: <E1t3Y5B-0005tq-JD@xenbits.xenproject.org>
Date: Wed, 23 Oct 2024 09:55:13 +0000

commit c960871c7c43c67e9fad0ac84ab5adca1401ef84
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Oct 22 21:08:53 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 23 10:27:36 2024 +0100

    x86/boot: Simplify address calculations in move_memory()
    
    Given that soffs is the offset into the 2M superpage,
    
      start = (src - soffs) >> PAGE_SIFT
    
    is a complicated expression for the frame address of the containing superpage.
    Except, start is converted straight back to a byte address to use, so the
    shifting is unnecessary too.
    
    The only thing done with the mapped pointer is to have soffs added back on for
    the memmove() call.  bootstrap_map_addr() passes through the offset, so we can
    pass src directly in and simplify the memmove() call too.  For the end mapping
    address, this simplifies to just src + sz too.
    
    The same reasoning holds for dst and doffs.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/setup.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 1199df988d..ce28e77060 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -492,31 +492,26 @@ static void __init move_memory(
 
     while ( size )
     {
-        unsigned int start /* frame */;
         unsigned int end   /* mapsz */;
         unsigned int soffs = src & mask;
         unsigned int doffs = dst & mask;
         unsigned int sz;
         void *d, *s;
 
-        start = (src - soffs) >> PAGE_SHIFT;
         end = soffs + size;
         if ( end > blksz )
             end = blksz;
         sz = end - soffs;
-        s = bootstrap_map_addr(pfn_to_paddr(start),
-                               pfn_to_paddr(start) + end);
+        s = bootstrap_map_addr(src, src + sz);
 
-        start = (dst - doffs) >> PAGE_SHIFT;
         end = doffs + size;
         if ( end > blksz )
             end = blksz;
         if ( sz > end - doffs )
             sz = end - doffs;
-        d = bootstrap_map_addr(pfn_to_paddr(start),
-                               pfn_to_paddr(start) + end);
+        d = bootstrap_map_addr(dst, dst + sz);
 
-        memmove(d + doffs, s + soffs, sz);
+        memmove(d, s, sz);
 
         dst += sz;
         src += sz;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 23 09:55:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 23 Oct 2024 09:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824509.1238638 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3Y5M-0000Vi-UE; Wed, 23 Oct 2024 09:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 824509.1238638; Wed, 23 Oct 2024 09: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 1t3Y5M-0000Va-Rg; Wed, 23 Oct 2024 09:55:24 +0000
Received: by outflank-mailman (input) for mailman id 824509;
 Wed, 23 Oct 2024 09: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 1t3Y5L-0000VQ-Qn
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 09:55:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3Y5L-00037O-2b
 for xen-changelog@lists.xenproject.org;
 Wed, 23 Oct 2024 09:55:23 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3Y5L-0005uo-NS
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 09: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Simplify size calculations in move_memory()
Message-Id: <E1t3Y5L-0005uo-NS@xenbits.xenproject.org>
Date: Wed, 23 Oct 2024 09:55:23 +0000

commit 2c3294775e9578065a096a525efe1b514527d0f5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Oct 22 18:48:30 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 23 10:27:36 2024 +0100

    x86/boot: Simplify size calculations in move_memory()
    
    While both src and dst are similar, src is mapped only accounting for src's
    size, while dst is mapped based on the minimum of both.  This means that in
    some cases, an overly large mapping is requested for src.
    
    Rework the sz calcuation to be symmetric, and leave an explanation of how
    logic works.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/setup.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index ce28e77060..8ad957f3d1 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -492,23 +492,22 @@ static void __init move_memory(
 
     while ( size )
     {
-        unsigned int end   /* mapsz */;
         unsigned int soffs = src & mask;
         unsigned int doffs = dst & mask;
         unsigned int sz;
         void *d, *s;
 
-        end = soffs + size;
-        if ( end > blksz )
-            end = blksz;
-        sz = end - soffs;
-        s = bootstrap_map_addr(src, src + sz);
+        /*
+         * We're copying between two arbitrary buffers, as they fall within
+         * 2M-aligned regions with a maximum bound of blksz.
+         *
+         * For [ds]offs + size <= blksz, sz = size.
+         * For [ds]offs + size >  blksz, sz = blksz - [ds]offs.
+         */
+        sz = max(soffs, doffs);
+        sz = min(sz + size, blksz) - sz;
 
-        end = doffs + size;
-        if ( end > blksz )
-            end = blksz;
-        if ( sz > end - doffs )
-            sz = end - doffs;
+        s = bootstrap_map_addr(src, src + sz);
         d = bootstrap_map_addr(dst, dst + sz);
 
         memmove(d, s, sz);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 23 09:55:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 23 Oct 2024 09:55:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824510.1238642 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3Y5W-0000YR-Vy; Wed, 23 Oct 2024 09:55:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 824510.1238642; Wed, 23 Oct 2024 09: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 1t3Y5W-0000YJ-T8; Wed, 23 Oct 2024 09:55:34 +0000
Received: by outflank-mailman (input) for mailman id 824510;
 Wed, 23 Oct 2024 09: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 1t3Y5V-0000Y7-Ub
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 09:55:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3Y5V-00037W-2w
 for xen-changelog@lists.xenproject.org;
 Wed, 23 Oct 2024 09:55:33 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3Y5V-0005vk-SJ
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 09: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: convert consider_modules to struct boot_module
Message-Id: <E1t3Y5V-0005vk-SJ@xenbits.xenproject.org>
Date: Wed, 23 Oct 2024 09:55:33 +0000

commit be84e7fe58b51f6b6dd907a038f0ef998a1e281e
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Sun Oct 20 20:45:37 2024 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 23 10:27:36 2024 +0100

    x86/boot: convert consider_modules to struct boot_module
    
    To start transitioning consider_modules() over to struct boot_module, begin
    with taking the array of struct boot_modules but use the temporary struct
    element mod.
    
    No functional change intended.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/setup.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 8ad957f3d1..c5b37bd211 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -641,7 +641,7 @@ static void __init noinline move_xen(void)
 #undef BOOTSTRAP_MAP_LIMIT
 
 static uint64_t __init consider_modules(
-    uint64_t s, uint64_t e, uint32_t size, const module_t *mod,
+    uint64_t s, uint64_t e, uint32_t size, const struct boot_module mods[],
     unsigned int nr_mods, unsigned int this_mod)
 {
     unsigned int i;
@@ -651,20 +651,20 @@ static uint64_t __init consider_modules(
 
     for ( i = 0; i < nr_mods ; ++i )
     {
-        uint64_t start = (uint64_t)mod[i].mod_start << PAGE_SHIFT;
-        uint64_t end = start + PAGE_ALIGN(mod[i].mod_end);
+        uint64_t start = pfn_to_paddr(mods[i].mod->mod_start);
+        uint64_t end = start + PAGE_ALIGN(mods[i].mod->mod_end);
 
         if ( i == this_mod )
             continue;
 
         if ( s < end && start < e )
         {
-            end = consider_modules(end, e, size, mod + i + 1,
+            end = consider_modules(end, e, size, &mods[i + 1],
                                    nr_mods - i - 1, this_mod - i - 1);
             if ( end )
                 return end;
 
-            return consider_modules(s, start, size, mod + i + 1,
+            return consider_modules(s, start, size, &mods[i + 1],
                                     nr_mods - i - 1, this_mod - i - 1);
         }
     }
@@ -1463,7 +1463,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
         {
             /* Don't overlap with modules. */
             end = consider_modules(s, e, reloc_size + mask,
-                                   mod, bi->nr_modules, -1);
+                                   bi->mods, bi->nr_modules, -1);
             end &= ~mask;
         }
         else
@@ -1498,7 +1498,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
                 continue;
 
             /* Don't overlap with other modules (or Xen itself). */
-            end = consider_modules(s, e, size, mod,
+            end = consider_modules(s, e, size, bi->mods,
                                    bi->nr_modules + relocated, j);
 
             if ( highmem_start && end > highmem_start )
@@ -1525,7 +1525,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
         while ( !kexec_crash_area.start )
         {
             /* Don't overlap with modules (or Xen itself). */
-            e = consider_modules(s, e, PAGE_ALIGN(kexec_crash_area.size), mod,
+            e = consider_modules(s, e, PAGE_ALIGN(kexec_crash_area.size), bi->mods,
                                  bi->nr_modules + relocated, -1);
             if ( s >= e )
                 break;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 23 15:44:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 23 Oct 2024 15:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824765.1238942 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3dWl-0004KH-Vm; Wed, 23 Oct 2024 15:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 824765.1238942; Wed, 23 Oct 2024 15:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3dWl-0004K9-Sx; Wed, 23 Oct 2024 15:44:03 +0000
Received: by outflank-mailman (input) for mailman id 824765;
 Wed, 23 Oct 2024 15: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 1t3dWk-0004K2-5D
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 15:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3dWk-000AdR-0B
 for xen-changelog@lists.xenproject.org;
 Wed, 23 Oct 2024 15:44:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3dWj-00059j-V9
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 15: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Convert move_memory() to use bootstrap_map_addr()
Message-Id: <E1t3dWj-00059j-V9@xenbits.xenproject.org>
Date: Wed, 23 Oct 2024 15:44:01 +0000

commit e33e18df05d8238c09fff9c9dcaafe273989c57f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Oct 22 18:33:57 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 23 10:27:36 2024 +0100

    x86/boot: Convert move_memory() to use bootstrap_map_addr()
    
    move_memory() is very complicated, and buggy.  In order to fix the latter, we
    have to address the former.
    
    Given prior cleanup, bootstrap_map() is now implemented in terms of
    bootstrap_map_addr(), meaning that it is counterproductive to plumb the
    mapping through module_t.
    
    Delete mod, and introduce two same-sized/named fields.  At this point in boot,
    neither fields have their named purpose, so indicate the purpose in comments.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/setup.c | 35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 20392c2abf..1199df988d 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -492,26 +492,29 @@ static void __init move_memory(
 
     while ( size )
     {
-        module_t mod;
+        unsigned int start /* frame */;
+        unsigned int end   /* mapsz */;
         unsigned int soffs = src & mask;
         unsigned int doffs = dst & mask;
         unsigned int sz;
         void *d, *s;
 
-        mod.mod_start = (src - soffs) >> PAGE_SHIFT;
-        mod.mod_end = soffs + size;
-        if ( mod.mod_end > blksz )
-            mod.mod_end = blksz;
-        sz = mod.mod_end - soffs;
-        s = bootstrap_map(&mod);
-
-        mod.mod_start = (dst - doffs) >> PAGE_SHIFT;
-        mod.mod_end = doffs + size;
-        if ( mod.mod_end > blksz )
-            mod.mod_end = blksz;
-        if ( sz > mod.mod_end - doffs )
-            sz = mod.mod_end - doffs;
-        d = bootstrap_map(&mod);
+        start = (src - soffs) >> PAGE_SHIFT;
+        end = soffs + size;
+        if ( end > blksz )
+            end = blksz;
+        sz = end - soffs;
+        s = bootstrap_map_addr(pfn_to_paddr(start),
+                               pfn_to_paddr(start) + end);
+
+        start = (dst - doffs) >> PAGE_SHIFT;
+        end = doffs + size;
+        if ( end > blksz )
+            end = blksz;
+        if ( sz > end - doffs )
+            sz = end - doffs;
+        d = bootstrap_map_addr(pfn_to_paddr(start),
+                               pfn_to_paddr(start) + end);
 
         memmove(d + doffs, s + soffs, sz);
 
@@ -519,7 +522,7 @@ static void __init move_memory(
         src += sz;
         size -= sz;
 
-        bootstrap_map(NULL);
+        bootstrap_map_addr(0, 0);
     }
 }
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 23 15:55:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 23 Oct 2024 15:55:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824791.1238986 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3dhP-0007qH-RI; Wed, 23 Oct 2024 15:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 824791.1238986; Wed, 23 Oct 2024 15:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3dhP-0007q9-Ob; Wed, 23 Oct 2024 15:55:03 +0000
Received: by outflank-mailman (input) for mailman id 824791;
 Wed, 23 Oct 2024 15: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 1t3dhN-0007q2-UT
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 15:55:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3dhN-000AuU-2o
 for xen-changelog@lists.xenproject.org;
 Wed, 23 Oct 2024 15:55:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3dhN-0005uk-QP
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 15:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Simplify address calculations in move_memory()
Message-Id: <E1t3dhN-0005uk-QP@xenbits.xenproject.org>
Date: Wed, 23 Oct 2024 15:55:01 +0000

commit c960871c7c43c67e9fad0ac84ab5adca1401ef84
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Oct 22 21:08:53 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 23 10:27:36 2024 +0100

    x86/boot: Simplify address calculations in move_memory()
    
    Given that soffs is the offset into the 2M superpage,
    
      start = (src - soffs) >> PAGE_SIFT
    
    is a complicated expression for the frame address of the containing superpage.
    Except, start is converted straight back to a byte address to use, so the
    shifting is unnecessary too.
    
    The only thing done with the mapped pointer is to have soffs added back on for
    the memmove() call.  bootstrap_map_addr() passes through the offset, so we can
    pass src directly in and simplify the memmove() call too.  For the end mapping
    address, this simplifies to just src + sz too.
    
    The same reasoning holds for dst and doffs.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/setup.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 1199df988d..ce28e77060 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -492,31 +492,26 @@ static void __init move_memory(
 
     while ( size )
     {
-        unsigned int start /* frame */;
         unsigned int end   /* mapsz */;
         unsigned int soffs = src & mask;
         unsigned int doffs = dst & mask;
         unsigned int sz;
         void *d, *s;
 
-        start = (src - soffs) >> PAGE_SHIFT;
         end = soffs + size;
         if ( end > blksz )
             end = blksz;
         sz = end - soffs;
-        s = bootstrap_map_addr(pfn_to_paddr(start),
-                               pfn_to_paddr(start) + end);
+        s = bootstrap_map_addr(src, src + sz);
 
-        start = (dst - doffs) >> PAGE_SHIFT;
         end = doffs + size;
         if ( end > blksz )
             end = blksz;
         if ( sz > end - doffs )
             sz = end - doffs;
-        d = bootstrap_map_addr(pfn_to_paddr(start),
-                               pfn_to_paddr(start) + end);
+        d = bootstrap_map_addr(dst, dst + sz);
 
-        memmove(d + doffs, s + soffs, sz);
+        memmove(d, s, sz);
 
         dst += sz;
         src += sz;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 23 15:55:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 23 Oct 2024 15:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824792.1238990 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3dhZ-0007sL-SQ; Wed, 23 Oct 2024 15:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 824792.1238990; Wed, 23 Oct 2024 15:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3dhZ-0007sC-Q5; Wed, 23 Oct 2024 15:55:13 +0000
Received: by outflank-mailman (input) for mailman id 824792;
 Wed, 23 Oct 2024 15: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 1t3dhY-0007s1-1i
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 15:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3dhX-000Av3-3D
 for xen-changelog@lists.xenproject.org;
 Wed, 23 Oct 2024 15:55:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3dhX-0005vN-UR
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 15: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Simplify size calculations in move_memory()
Message-Id: <E1t3dhX-0005vN-UR@xenbits.xenproject.org>
Date: Wed, 23 Oct 2024 15:55:11 +0000

commit 2c3294775e9578065a096a525efe1b514527d0f5
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Oct 22 18:48:30 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 23 10:27:36 2024 +0100

    x86/boot: Simplify size calculations in move_memory()
    
    While both src and dst are similar, src is mapped only accounting for src's
    size, while dst is mapped based on the minimum of both.  This means that in
    some cases, an overly large mapping is requested for src.
    
    Rework the sz calcuation to be symmetric, and leave an explanation of how
    logic works.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/setup.c | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index ce28e77060..8ad957f3d1 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -492,23 +492,22 @@ static void __init move_memory(
 
     while ( size )
     {
-        unsigned int end   /* mapsz */;
         unsigned int soffs = src & mask;
         unsigned int doffs = dst & mask;
         unsigned int sz;
         void *d, *s;
 
-        end = soffs + size;
-        if ( end > blksz )
-            end = blksz;
-        sz = end - soffs;
-        s = bootstrap_map_addr(src, src + sz);
+        /*
+         * We're copying between two arbitrary buffers, as they fall within
+         * 2M-aligned regions with a maximum bound of blksz.
+         *
+         * For [ds]offs + size <= blksz, sz = size.
+         * For [ds]offs + size >  blksz, sz = blksz - [ds]offs.
+         */
+        sz = max(soffs, doffs);
+        sz = min(sz + size, blksz) - sz;
 
-        end = doffs + size;
-        if ( end > blksz )
-            end = blksz;
-        if ( sz > end - doffs )
-            sz = end - doffs;
+        s = bootstrap_map_addr(src, src + sz);
         d = bootstrap_map_addr(dst, dst + sz);
 
         memmove(d, s, sz);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 23 15:55:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 23 Oct 2024 15:55:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824794.1239005 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3dhk-0008BE-5j; Wed, 23 Oct 2024 15:55:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 824794.1239005; Wed, 23 Oct 2024 15: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 1t3dhk-0008B6-2O; Wed, 23 Oct 2024 15:55:24 +0000
Received: by outflank-mailman (input) for mailman id 824794;
 Wed, 23 Oct 2024 15: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 1t3dhi-0008A7-4L
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 15:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3dhi-000AvE-0M
 for xen-changelog@lists.xenproject.org;
 Wed, 23 Oct 2024 15:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3dhi-0005vz-26
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 15: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: convert consider_modules to struct boot_module
Message-Id: <E1t3dhi-0005vz-26@xenbits.xenproject.org>
Date: Wed, 23 Oct 2024 15:55:22 +0000

commit be84e7fe58b51f6b6dd907a038f0ef998a1e281e
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Sun Oct 20 20:45:37 2024 -0400
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 23 10:27:36 2024 +0100

    x86/boot: convert consider_modules to struct boot_module
    
    To start transitioning consider_modules() over to struct boot_module, begin
    with taking the array of struct boot_modules but use the temporary struct
    element mod.
    
    No functional change intended.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Reviewed-by: Jason Andryuk <jason.andryuk@amd.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/setup.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 8ad957f3d1..c5b37bd211 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -641,7 +641,7 @@ static void __init noinline move_xen(void)
 #undef BOOTSTRAP_MAP_LIMIT
 
 static uint64_t __init consider_modules(
-    uint64_t s, uint64_t e, uint32_t size, const module_t *mod,
+    uint64_t s, uint64_t e, uint32_t size, const struct boot_module mods[],
     unsigned int nr_mods, unsigned int this_mod)
 {
     unsigned int i;
@@ -651,20 +651,20 @@ static uint64_t __init consider_modules(
 
     for ( i = 0; i < nr_mods ; ++i )
     {
-        uint64_t start = (uint64_t)mod[i].mod_start << PAGE_SHIFT;
-        uint64_t end = start + PAGE_ALIGN(mod[i].mod_end);
+        uint64_t start = pfn_to_paddr(mods[i].mod->mod_start);
+        uint64_t end = start + PAGE_ALIGN(mods[i].mod->mod_end);
 
         if ( i == this_mod )
             continue;
 
         if ( s < end && start < e )
         {
-            end = consider_modules(end, e, size, mod + i + 1,
+            end = consider_modules(end, e, size, &mods[i + 1],
                                    nr_mods - i - 1, this_mod - i - 1);
             if ( end )
                 return end;
 
-            return consider_modules(s, start, size, mod + i + 1,
+            return consider_modules(s, start, size, &mods[i + 1],
                                     nr_mods - i - 1, this_mod - i - 1);
         }
     }
@@ -1463,7 +1463,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
         {
             /* Don't overlap with modules. */
             end = consider_modules(s, e, reloc_size + mask,
-                                   mod, bi->nr_modules, -1);
+                                   bi->mods, bi->nr_modules, -1);
             end &= ~mask;
         }
         else
@@ -1498,7 +1498,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
                 continue;
 
             /* Don't overlap with other modules (or Xen itself). */
-            end = consider_modules(s, e, size, mod,
+            end = consider_modules(s, e, size, bi->mods,
                                    bi->nr_modules + relocated, j);
 
             if ( highmem_start && end > highmem_start )
@@ -1525,7 +1525,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
         while ( !kexec_crash_area.start )
         {
             /* Don't overlap with modules (or Xen itself). */
-            e = consider_modules(s, e, PAGE_ALIGN(kexec_crash_area.size), mod,
+            e = consider_modules(s, e, PAGE_ALIGN(kexec_crash_area.size), bi->mods,
                                  bi->nr_modules + relocated, -1);
             if ( s >= e )
                 break;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 23 17:22:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 23 Oct 2024 17:22:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824911.1239100 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3f3c-00021H-Dx; Wed, 23 Oct 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 824911.1239100; Wed, 23 Oct 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 1t3f3c-000219-BH; Wed, 23 Oct 2024 17:22:04 +0000
Received: by outflank-mailman (input) for mailman id 824911;
 Wed, 23 Oct 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 1t3f3b-000213-Kk
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 17:22:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3f3b-000D5X-1o
 for xen-changelog@lists.xenproject.org;
 Wed, 23 Oct 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 1t3f3b-000268-G0
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Add a temporary module_map pointer to boot_image
Message-Id: <E1t3f3b-000268-G0@xenbits.xenproject.org>
Date: Wed, 23 Oct 2024 17:22:03 +0000

commit 89f855d5649f86868a9aab27616b1986dece9ac1
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Oct 23 01:53:08 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 23 18:14:24 2024 +0100

    x86/boot: Add a temporary module_map pointer to boot_image
    
    ... in order to untangle parameter handling independently from other logic
    changes.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/include/asm/bootinfo.h | 1 +
 xen/arch/x86/setup.c                | 1 +
 2 files changed, 2 insertions(+)

diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm/bootinfo.h
index ffa4434067..6237da7e4d 100644
--- a/xen/arch/x86/include/asm/bootinfo.h
+++ b/xen/arch/x86/include/asm/bootinfo.h
@@ -31,6 +31,7 @@ struct boot_info {
     size_t memmap_length;
 
     unsigned int nr_modules;
+    unsigned long *module_map; /* Temporary */
     struct boot_module mods[MAX_NR_BOOTMODS + 1];
 };
 
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index c5b37bd211..d8001867c9 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1086,6 +1086,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     }
 
     bi = multiboot_fill_boot_info(mbi, mod);
+    bi->module_map = module_map; /* Temporary */
 
     /* Parse the command-line options. */
     if ( (kextra = strstr(bi->cmdline, " -- ")) != NULL )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 23 17:22:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 23 Oct 2024 17:22:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824912.1239104 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3f3m-000234-FR; Wed, 23 Oct 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 824912.1239104; Wed, 23 Oct 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 1t3f3m-00022w-Cl; Wed, 23 Oct 2024 17:22:14 +0000
Received: by outflank-mailman (input) for mailman id 824912;
 Wed, 23 Oct 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 1t3f3l-00022q-Mj
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 17:22:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3f3l-000D5v-2B
 for xen-changelog@lists.xenproject.org;
 Wed, 23 Oct 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 1t3f3l-00027Y-KY
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Fix microcode module handling during PVH boot
Message-Id: <E1t3f3l-00027Y-KY@xenbits.xenproject.org>
Date: Wed, 23 Oct 2024 17:22:13 +0000

commit 8ddf63a252a6eae6e619ba2df9ad6b6f82e660c1
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Wed Oct 23 02:02:42 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 23 18:14:24 2024 +0100

    x86/boot: Fix microcode module handling during PVH boot
    
    As detailed in commit 0fe607b2a144 ("x86/boot: Fix PVH boot during boot_info
    transition period"), the use of __va(mbi->mods_addr) constitutes a
    use-after-free on the PVH boot path.
    
    This pattern has been in use since before PVH support was added.  Inside a PVH
    VM, it will go unnoticed as long as the microcode container parser doesn't
    choke on the random data it finds.
    
    The use within early_microcode_init() happens to be safe because it's prior to
    move_xen().  microcode_init_cache() is after move_xen(), and therefore unsafe.
    
    Plumb the boot_info pointer down, replacing module_map and mbi.  Importantly,
    bi->mods[].mod is a safe way to access the module list during PVH boot.
    
    Note: microcode_scan_module() is still bogusly stashing a bootstrap_map()'d
          pointer in ucode_blob.data, which constitutes a different
          use-after-free, and only works in general because of a second bug.  This
          is unrelated to PVH, and needs untangling differently.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/microcode/core.c    | 40 +++++++++++++++---------------------
 xen/arch/x86/include/asm/microcode.h |  8 ++++----
 xen/arch/x86/setup.c                 |  4 ++--
 3 files changed, 22 insertions(+), 30 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index 8564e4d2c9..1d58cb0f3b 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -35,6 +35,7 @@
 #include <xen/watchdog.h>
 
 #include <asm/apic.h>
+#include <asm/bootinfo.h>
 #include <asm/cpu-policy.h>
 #include <asm/nmi.h>
 #include <asm/processor.h>
@@ -152,11 +153,8 @@ static int __init cf_check parse_ucode(const char *s)
 }
 custom_param("ucode", parse_ucode);
 
-static void __init microcode_scan_module(
-    unsigned long *module_map,
-    const multiboot_info_t *mbi)
+static void __init microcode_scan_module(struct boot_info *bi)
 {
-    module_t *mod = (module_t *)__va(mbi->mods_addr);
     uint64_t *_blob_start;
     unsigned long _blob_size;
     struct cpio_data cd;
@@ -178,13 +176,13 @@ static void __init microcode_scan_module(
     /*
      * Try all modules and see whichever could be the microcode blob.
      */
-    for ( i = 1 /* Ignore dom0 kernel */; i < mbi->mods_count; i++ )
+    for ( i = 1 /* Ignore dom0 kernel */; i < bi->nr_modules; i++ )
     {
-        if ( !test_bit(i, module_map) )
+        if ( !test_bit(i, bi->module_map) )
             continue;
 
-        _blob_start = bootstrap_map(&mod[i]);
-        _blob_size = mod[i].mod_end;
+        _blob_start = bootstrap_map(bi->mods[i].mod);
+        _blob_size = bi->mods[i].mod->mod_end;
         if ( !_blob_start )
         {
             printk("Could not map multiboot module #%d (size: %ld)\n",
@@ -204,21 +202,17 @@ static void __init microcode_scan_module(
     }
 }
 
-static void __init microcode_grab_module(
-    unsigned long *module_map,
-    const multiboot_info_t *mbi)
+static void __init microcode_grab_module(struct boot_info *bi)
 {
-    module_t *mod = (module_t *)__va(mbi->mods_addr);
-
     if ( ucode_mod_idx < 0 )
-        ucode_mod_idx += mbi->mods_count;
-    if ( ucode_mod_idx <= 0 || ucode_mod_idx >= mbi->mods_count ||
-         !__test_and_clear_bit(ucode_mod_idx, module_map) )
+        ucode_mod_idx += bi->nr_modules;
+    if ( ucode_mod_idx <= 0 || ucode_mod_idx >= bi->nr_modules ||
+         !__test_and_clear_bit(ucode_mod_idx, bi->module_map) )
         goto scan;
-    ucode_mod = mod[ucode_mod_idx];
+    ucode_mod = *bi->mods[ucode_mod_idx].mod;
 scan:
     if ( ucode_scan )
-        microcode_scan_module(module_map, mbi);
+        microcode_scan_module(bi);
 }
 
 static struct microcode_ops __ro_after_init ucode_ops;
@@ -822,8 +816,7 @@ static int __init early_update_cache(const void *data, size_t len)
     return rc;
 }
 
-int __init microcode_init_cache(unsigned long *module_map,
-                                const struct multiboot_info *mbi)
+int __init microcode_init_cache(struct boot_info *bi)
 {
     int rc = 0;
 
@@ -832,7 +825,7 @@ int __init microcode_init_cache(unsigned long *module_map,
 
     if ( ucode_scan )
         /* Need to rescan the modules because they might have been relocated */
-        microcode_scan_module(module_map, mbi);
+        microcode_scan_module(bi);
 
     if ( ucode_mod.mod_end )
         rc = early_update_cache(bootstrap_map(&ucode_mod),
@@ -878,8 +871,7 @@ static int __init early_microcode_update_cpu(void)
     return microcode_update_cpu(patch, 0);
 }
 
-int __init early_microcode_init(unsigned long *module_map,
-                                const struct multiboot_info *mbi)
+int __init early_microcode_init(struct boot_info *bi)
 {
     const struct cpuinfo_x86 *c = &boot_cpu_data;
     int rc = 0;
@@ -922,7 +914,7 @@ int __init early_microcode_init(unsigned long *module_map,
         return -ENODEV;
     }
 
-    microcode_grab_module(module_map, mbi);
+    microcode_grab_module(bi);
 
     if ( ucode_mod.mod_end || ucode_blob.size )
         rc = early_microcode_update_cpu();
diff --git a/xen/arch/x86/include/asm/microcode.h b/xen/arch/x86/include/asm/microcode.h
index 57c08205d4..a278773f8b 100644
--- a/xen/arch/x86/include/asm/microcode.h
+++ b/xen/arch/x86/include/asm/microcode.h
@@ -24,10 +24,10 @@ 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, unsigned int flags);
-int early_microcode_init(unsigned long *module_map,
-                         const struct multiboot_info *mbi);
-int microcode_init_cache(unsigned long *module_map,
-                         const struct multiboot_info *mbi);
 int microcode_update_one(void);
 
+struct boot_info;
+int early_microcode_init(struct boot_info *bi);
+int microcode_init_cache(struct boot_info *bi);
+
 #endif /* ASM_X86__MICROCODE_H */
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index d8001867c9..c75b8f15fa 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1392,7 +1392,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
      * TODO: load ucode earlier once multiboot modules become accessible
      * at an earlier stage.
      */
-    early_microcode_init(module_map, mbi);
+    early_microcode_init(bi);
 
     if ( xen_phys_start )
     {
@@ -1936,7 +1936,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
 
     timer_init();
 
-    microcode_init_cache(module_map, mbi); /* Needs xmalloc() */
+    microcode_init_cache(bi); /* Needs xmalloc() */
 
     tsx_init(); /* Needs microcode.  May change HLE/RTM feature bits. */
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 23 17:22:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 23 Oct 2024 17:22:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824913.1239110 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3f3w-000262-I6; Wed, 23 Oct 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 824913.1239110; Wed, 23 Oct 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 1t3f3w-00025r-EH; Wed, 23 Oct 2024 17:22:24 +0000
Received: by outflank-mailman (input) for mailman id 824913;
 Wed, 23 Oct 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 1t3f3v-00025i-Qc
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 17:22:23 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3f3v-000D69-2Z
 for xen-changelog@lists.xenproject.org;
 Wed, 23 Oct 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 1t3f3v-00028H-OC
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Fix XSM module handling during PVH boot
Message-Id: <E1t3f3v-00028H-OC@xenbits.xenproject.org>
Date: Wed, 23 Oct 2024 17:22:23 +0000

commit 6cf0aaeb8df951fb34679f0408461a5c67cb02c6
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Wed Oct 23 02:03:15 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 23 18:14:24 2024 +0100

    x86/boot: Fix XSM module handling during PVH boot
    
    As detailed in commit 0fe607b2a144 ("x86/boot: Fix PVH boot during boot_info
    transition period"), the use of __va(mbi->mods_addr) constitutes a
    use-after-free on the PVH boot path.
    
    This pattern has been in use since before PVH support was added.  This has
    most likely gone unnoticed because no-one's tried using a detached Flask
    policy in a PVH VM before.
    
    Plumb the boot_info pointer down, replacing module_map and mbi.  Importantly,
    bi->mods[].mod is a safe way to access the module list during PVH boot.
    
    As this is the final non-bi use of mbi in __start_xen(), make the pointer
    unusable once bi has been established, to prevent new uses creeping back in.
    This is a stopgap until mbi can be fully removed.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/setup.c  |  5 ++++-
 xen/include/xsm/xsm.h | 12 +++++-------
 xen/xsm/xsm_core.c    |  7 +++----
 xen/xsm/xsm_policy.c  | 16 +++++++---------
 4 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index c75b8f15fa..8974b0c6ed 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1088,6 +1088,9 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     bi = multiboot_fill_boot_info(mbi, mod);
     bi->module_map = module_map; /* Temporary */
 
+    /* Use bi-> instead */
+#define mbi DO_NOT_USE
+
     /* Parse the command-line options. */
     if ( (kextra = strstr(bi->cmdline, " -- ")) != NULL )
     {
@@ -1862,7 +1865,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     mmio_ro_ranges = rangeset_new(NULL, "r/o mmio ranges",
                                   RANGESETF_prettyprint_hex);
 
-    xsm_multiboot_init(module_map, mbi);
+    xsm_multiboot_init(bi);
 
     /*
      * IOMMU-related ACPI table parsing may require some of the system domains
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 627c0d2731..4dbff9d866 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -17,7 +17,6 @@
 
 #include <xen/alternative-call.h>
 #include <xen/sched.h>
-#include <xen/multiboot.h>
 
 /* policy magic number (defined by XSM_MAGIC) */
 typedef uint32_t xsm_magic_t;
@@ -778,11 +777,10 @@ static inline int xsm_argo_send(const struct domain *d, const struct domain *t)
 #endif /* XSM_NO_WRAPPERS */
 
 #ifdef CONFIG_MULTIBOOT
-int xsm_multiboot_init(
-    unsigned long *module_map, const multiboot_info_t *mbi);
+struct boot_info;
+int xsm_multiboot_init(struct boot_info *bi);
 int xsm_multiboot_policy_init(
-    unsigned long *module_map, const multiboot_info_t *mbi,
-    void **policy_buffer, size_t *policy_size);
+    struct boot_info *bi, void **policy_buffer, size_t *policy_size);
 #endif
 
 #ifdef CONFIG_HAS_DEVICE_TREE
@@ -828,8 +826,8 @@ static const inline struct xsm_ops *silo_init(void)
 #include <xsm/dummy.h>
 
 #ifdef CONFIG_MULTIBOOT
-static inline int xsm_multiboot_init (
-    unsigned long *module_map, const multiboot_info_t *mbi)
+struct boot_info;
+static inline int xsm_multiboot_init(struct boot_info *bi)
 {
     return 0;
 }
diff --git a/xen/xsm/xsm_core.c b/xen/xsm/xsm_core.c
index eaa028109b..6e3fac68c0 100644
--- a/xen/xsm/xsm_core.c
+++ b/xen/xsm/xsm_core.c
@@ -21,6 +21,7 @@
 #ifdef CONFIG_XSM
 
 #ifdef CONFIG_MULTIBOOT
+#include <asm/bootinfo.h>
 #include <asm/setup.h>
 #endif
 
@@ -139,8 +140,7 @@ static int __init xsm_core_init(const void *policy_buffer, size_t policy_size)
 }
 
 #ifdef CONFIG_MULTIBOOT
-int __init xsm_multiboot_init(
-    unsigned long *module_map, const multiboot_info_t *mbi)
+int __init xsm_multiboot_init(struct boot_info *bi)
 {
     int ret = 0;
     void *policy_buffer = NULL;
@@ -150,8 +150,7 @@ int __init xsm_multiboot_init(
 
     if ( XSM_MAGIC )
     {
-        ret = xsm_multiboot_policy_init(module_map, mbi, &policy_buffer,
-                                        &policy_size);
+        ret = xsm_multiboot_policy_init(bi, &policy_buffer, &policy_size);
         if ( ret )
         {
             bootstrap_map(NULL);
diff --git a/xen/xsm/xsm_policy.c b/xen/xsm/xsm_policy.c
index 8dafbc9381..6f799dd28f 100644
--- a/xen/xsm/xsm_policy.c
+++ b/xen/xsm/xsm_policy.c
@@ -20,7 +20,7 @@
 
 #include <xsm/xsm.h>
 #ifdef CONFIG_MULTIBOOT
-#include <xen/multiboot.h>
+#include <asm/bootinfo.h>
 #include <asm/setup.h>
 #endif
 #include <xen/bitops.h>
@@ -31,11 +31,9 @@
 
 #ifdef CONFIG_MULTIBOOT
 int __init xsm_multiboot_policy_init(
-    unsigned long *module_map, const multiboot_info_t *mbi,
-    void **policy_buffer, size_t *policy_size)
+    struct boot_info *bi, void **policy_buffer, size_t *policy_size)
 {
     int i;
-    module_t *mod = (module_t *)__va(mbi->mods_addr);
     int rc = 0;
     u32 *_policy_start;
     unsigned long _policy_len;
@@ -44,13 +42,13 @@ int __init xsm_multiboot_policy_init(
      * Try all modules and see whichever could be the binary policy.
      * Adjust module_map for the module that is the binary policy.
      */
-    for ( i = mbi->mods_count-1; i >= 1; i-- )
+    for ( i = bi->nr_modules - 1; i >= 1; i-- )
     {
-        if ( !test_bit(i, module_map) )
+        if ( !test_bit(i, bi->module_map) )
             continue;
 
-        _policy_start = bootstrap_map(mod + i);
-        _policy_len   = mod[i].mod_end;
+        _policy_start = bootstrap_map(bi->mods[i].mod);
+        _policy_len   = bi->mods[i].mod->mod_end;
 
         if ( (xsm_magic_t)(*_policy_start) == XSM_MAGIC )
         {
@@ -60,7 +58,7 @@ int __init xsm_multiboot_policy_init(
             printk("Policy len %#lx, start at %p.\n",
                    _policy_len,_policy_start);
 
-            __clear_bit(i, module_map);
+            __clear_bit(i, bi->module_map);
             break;
 
         }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 23 17:22:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 23 Oct 2024 17:22:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824914.1239111 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3f46-00029H-Jg; Wed, 23 Oct 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 824914.1239111; Wed, 23 Oct 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 1t3f46-000299-H4; Wed, 23 Oct 2024 17:22:34 +0000
Received: by outflank-mailman (input) for mailman id 824914;
 Wed, 23 Oct 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 1t3f45-000290-Tn
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 17:22:33 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3f45-000D6I-2t
 for xen-changelog@lists.xenproject.org;
 Wed, 23 Oct 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 1t3f45-00028x-S5
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Remove the mbi_p parameter from __start_xen()
Message-Id: <E1t3f45-00028x-S5@xenbits.xenproject.org>
Date: Wed, 23 Oct 2024 17:22:33 +0000

commit a974725a87a1afc8056b41c56dfe7fe272a7169c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Oct 23 14:52:49 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 23 18:14:24 2024 +0100

    x86/boot: Remove the mbi_p parameter from __start_xen()
    
    The use of physical addresses in __start_xen() has proved to be fertile soure
    of bugs.
    
    The MB1/2 path stashes the MBI pointer in multiboot_ptr (a setup.c variable
    even), then re-loads it immediately before calling __start_xen().  For this,
    we can just drop the function parameter and read multiboot_ptr in the one
    place where it's used.
    
    The EFI path also passes this parameter into __start_xen().  Have the EFI path
    set up multiboot_ptr too, and move the explanation of phyiscal-mode pointers.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/boot/x86_64.S       |  2 --
 xen/arch/x86/efi/efi-boot.h      |  9 +++++++--
 xen/arch/x86/include/asm/setup.h |  1 +
 xen/arch/x86/setup.c             | 14 +++++---------
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/boot/x86_64.S b/xen/arch/x86/boot/x86_64.S
index 04bb62ae86..26b9d1c2df 100644
--- a/xen/arch/x86/boot/x86_64.S
+++ b/xen/arch/x86/boot/x86_64.S
@@ -77,8 +77,6 @@ ENTRY(__high_start)
         tailcall start_secondary
 
 .L_bsp:
-        /* Pass off the Multiboot info structure to C land (if applicable). */
-        mov     multiboot_ptr(%rip),%edi
         tailcall __start_xen
 
         .section .data.page_aligned, "aw", @progbits
diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index 94f3443364..3b26f0b0f5 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -248,6 +248,12 @@ static void __init noreturn efi_arch_post_exit_boot(void)
     efi_arch_relocate_image(__XEN_VIRT_START - xen_phys_start);
     memcpy((void *)trampoline_phys, trampoline_start, cfg.size);
 
+    /*
+     * We're in physical mode right now (i.e. identity map), so a regular
+     * pointer is also a phyiscal address to the rest of Xen.
+     */
+    multiboot_ptr = (unsigned long)&mbi;
+
     /* Set system registers and transfer control. */
     asm volatile("pushq $0\n\tpopfq");
     rdmsrl(MSR_EFER, efer);
@@ -279,8 +285,7 @@ static void __init noreturn efi_arch_post_exit_boot(void)
                      [cr4] "+&r" (cr4)
                    : [cr3] "r" (idle_pg_table),
                      [cs] "i" (__HYPERVISOR_CS),
-                     [ds] "r" (__HYPERVISOR_DS),
-                     "D" (&mbi)
+                     [ds] "r" (__HYPERVISOR_DS)
                    : "memory" );
     unreachable();
 }
diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h
index 3d18952118..811855e574 100644
--- a/xen/arch/x86/include/asm/setup.h
+++ b/xen/arch/x86/include/asm/setup.h
@@ -14,6 +14,7 @@ extern unsigned long xenheap_initial_phys_start;
 extern uint64_t boot_tsc_stamp;
 
 extern void *stack_start;
+extern unsigned int multiboot_ptr;
 
 void early_cpu_init(bool verbose);
 void early_time_init(void);
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 8974b0c6ed..fc18ba3e35 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -157,8 +157,8 @@ char asmlinkage __section(".init.bss.stack_aligned") __aligned(STACK_SIZE)
 /* Used by the BSP/AP paths to find the higher half stack mapping to use. */
 void *stack_start = cpu0_stack + STACK_SIZE - sizeof(struct cpu_info);
 
-/* Used by the boot asm to stash the relocated multiboot info pointer. */
-unsigned int asmlinkage __initdata multiboot_ptr;
+/* Used by the boot asm and EFI to stash the multiboot_info paddr. */
+unsigned int __initdata multiboot_ptr;
 
 struct cpuinfo_x86 __read_mostly boot_cpu_data = { 0, 0, 0, 0, -1 };
 
@@ -1014,7 +1014,7 @@ static struct domain *__init create_dom0(const module_t *image,
 /* How much of the directmap is prebuilt at compile time. */
 #define PREBUILT_MAP_LIMIT (1 << L2_PAGETABLE_SHIFT)
 
-void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
+void asmlinkage __init noreturn __start_xen(void)
 {
     const char *memmap_type = NULL;
     char *kextra;
@@ -1059,7 +1059,6 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
 
     if ( pvh_boot )
     {
-        ASSERT(mbi_p == 0);
         pvh_init(&mbi, &mod);
         /*
          * mbi and mod are regular pointers to .initdata.  These remain valid
@@ -1068,7 +1067,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     }
     else
     {
-        mbi = __va(mbi_p);
+        mbi = __va(multiboot_ptr);
         mod = __va(mbi->mods_addr);
 
         /*
@@ -1078,11 +1077,8 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
          * For EFI, these are directmap pointers into the Xen image.  They do
          * not remain valid across move_xen().  EFI boot only functions
          * because a non-zero xen_phys_start inhibits move_xen().
-         *
-         * Don't be fooled by efi_arch_post_exit_boot() passing "D" (&mbi).
-         * This is a EFI physical-mode (i.e. identity map) pointer.
          */
-        ASSERT(mbi_p < MB(1) || xen_phys_start);
+        ASSERT(multiboot_ptr < MB(1) || xen_phys_start);
     }
 
     bi = multiboot_fill_boot_info(mbi, mod);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 23 18:33:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 23 Oct 2024 18:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824920.1239116 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3gAJ-0002nN-2W; Wed, 23 Oct 2024 18:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 824920.1239116; Wed, 23 Oct 2024 18: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 1t3gAI-0002nG-Vz; Wed, 23 Oct 2024 18:33:02 +0000
Received: by outflank-mailman (input) for mailman id 824920;
 Wed, 23 Oct 2024 18: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 1t3gAH-0002nA-O0
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 18:33:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3gAH-000EVF-1y
 for xen-changelog@lists.xenproject.org;
 Wed, 23 Oct 2024 18:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3gAH-0000PZ-Gx
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 18:33:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Add a temporary module_map pointer to boot_image
Message-Id: <E1t3gAH-0000PZ-Gx@xenbits.xenproject.org>
Date: Wed, 23 Oct 2024 18:33:01 +0000

commit 89f855d5649f86868a9aab27616b1986dece9ac1
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Oct 23 01:53:08 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 23 18:14:24 2024 +0100

    x86/boot: Add a temporary module_map pointer to boot_image
    
    ... in order to untangle parameter handling independently from other logic
    changes.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/include/asm/bootinfo.h | 1 +
 xen/arch/x86/setup.c                | 1 +
 2 files changed, 2 insertions(+)

diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm/bootinfo.h
index ffa4434067..6237da7e4d 100644
--- a/xen/arch/x86/include/asm/bootinfo.h
+++ b/xen/arch/x86/include/asm/bootinfo.h
@@ -31,6 +31,7 @@ struct boot_info {
     size_t memmap_length;
 
     unsigned int nr_modules;
+    unsigned long *module_map; /* Temporary */
     struct boot_module mods[MAX_NR_BOOTMODS + 1];
 };
 
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index c5b37bd211..d8001867c9 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1086,6 +1086,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     }
 
     bi = multiboot_fill_boot_info(mbi, mod);
+    bi->module_map = module_map; /* Temporary */
 
     /* Parse the command-line options. */
     if ( (kextra = strstr(bi->cmdline, " -- ")) != NULL )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 23 18:33:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 23 Oct 2024 18:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824921.1239120 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3gAS-0002p6-4X; Wed, 23 Oct 2024 18:33:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 824921.1239120; Wed, 23 Oct 2024 18:33:12 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3gAS-0002oy-1S; Wed, 23 Oct 2024 18:33:12 +0000
Received: by outflank-mailman (input) for mailman id 824921;
 Wed, 23 Oct 2024 18: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 1t3gAR-0002os-PH
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 18:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3gAR-000EVK-2O
 for xen-changelog@lists.xenproject.org;
 Wed, 23 Oct 2024 18:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3gAR-0000QP-M6
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 18: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Fix microcode module handling during PVH boot
Message-Id: <E1t3gAR-0000QP-M6@xenbits.xenproject.org>
Date: Wed, 23 Oct 2024 18:33:11 +0000

commit 8ddf63a252a6eae6e619ba2df9ad6b6f82e660c1
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Wed Oct 23 02:02:42 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 23 18:14:24 2024 +0100

    x86/boot: Fix microcode module handling during PVH boot
    
    As detailed in commit 0fe607b2a144 ("x86/boot: Fix PVH boot during boot_info
    transition period"), the use of __va(mbi->mods_addr) constitutes a
    use-after-free on the PVH boot path.
    
    This pattern has been in use since before PVH support was added.  Inside a PVH
    VM, it will go unnoticed as long as the microcode container parser doesn't
    choke on the random data it finds.
    
    The use within early_microcode_init() happens to be safe because it's prior to
    move_xen().  microcode_init_cache() is after move_xen(), and therefore unsafe.
    
    Plumb the boot_info pointer down, replacing module_map and mbi.  Importantly,
    bi->mods[].mod is a safe way to access the module list during PVH boot.
    
    Note: microcode_scan_module() is still bogusly stashing a bootstrap_map()'d
          pointer in ucode_blob.data, which constitutes a different
          use-after-free, and only works in general because of a second bug.  This
          is unrelated to PVH, and needs untangling differently.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/cpu/microcode/core.c    | 40 +++++++++++++++---------------------
 xen/arch/x86/include/asm/microcode.h |  8 ++++----
 xen/arch/x86/setup.c                 |  4 ++--
 3 files changed, 22 insertions(+), 30 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index 8564e4d2c9..1d58cb0f3b 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -35,6 +35,7 @@
 #include <xen/watchdog.h>
 
 #include <asm/apic.h>
+#include <asm/bootinfo.h>
 #include <asm/cpu-policy.h>
 #include <asm/nmi.h>
 #include <asm/processor.h>
@@ -152,11 +153,8 @@ static int __init cf_check parse_ucode(const char *s)
 }
 custom_param("ucode", parse_ucode);
 
-static void __init microcode_scan_module(
-    unsigned long *module_map,
-    const multiboot_info_t *mbi)
+static void __init microcode_scan_module(struct boot_info *bi)
 {
-    module_t *mod = (module_t *)__va(mbi->mods_addr);
     uint64_t *_blob_start;
     unsigned long _blob_size;
     struct cpio_data cd;
@@ -178,13 +176,13 @@ static void __init microcode_scan_module(
     /*
      * Try all modules and see whichever could be the microcode blob.
      */
-    for ( i = 1 /* Ignore dom0 kernel */; i < mbi->mods_count; i++ )
+    for ( i = 1 /* Ignore dom0 kernel */; i < bi->nr_modules; i++ )
     {
-        if ( !test_bit(i, module_map) )
+        if ( !test_bit(i, bi->module_map) )
             continue;
 
-        _blob_start = bootstrap_map(&mod[i]);
-        _blob_size = mod[i].mod_end;
+        _blob_start = bootstrap_map(bi->mods[i].mod);
+        _blob_size = bi->mods[i].mod->mod_end;
         if ( !_blob_start )
         {
             printk("Could not map multiboot module #%d (size: %ld)\n",
@@ -204,21 +202,17 @@ static void __init microcode_scan_module(
     }
 }
 
-static void __init microcode_grab_module(
-    unsigned long *module_map,
-    const multiboot_info_t *mbi)
+static void __init microcode_grab_module(struct boot_info *bi)
 {
-    module_t *mod = (module_t *)__va(mbi->mods_addr);
-
     if ( ucode_mod_idx < 0 )
-        ucode_mod_idx += mbi->mods_count;
-    if ( ucode_mod_idx <= 0 || ucode_mod_idx >= mbi->mods_count ||
-         !__test_and_clear_bit(ucode_mod_idx, module_map) )
+        ucode_mod_idx += bi->nr_modules;
+    if ( ucode_mod_idx <= 0 || ucode_mod_idx >= bi->nr_modules ||
+         !__test_and_clear_bit(ucode_mod_idx, bi->module_map) )
         goto scan;
-    ucode_mod = mod[ucode_mod_idx];
+    ucode_mod = *bi->mods[ucode_mod_idx].mod;
 scan:
     if ( ucode_scan )
-        microcode_scan_module(module_map, mbi);
+        microcode_scan_module(bi);
 }
 
 static struct microcode_ops __ro_after_init ucode_ops;
@@ -822,8 +816,7 @@ static int __init early_update_cache(const void *data, size_t len)
     return rc;
 }
 
-int __init microcode_init_cache(unsigned long *module_map,
-                                const struct multiboot_info *mbi)
+int __init microcode_init_cache(struct boot_info *bi)
 {
     int rc = 0;
 
@@ -832,7 +825,7 @@ int __init microcode_init_cache(unsigned long *module_map,
 
     if ( ucode_scan )
         /* Need to rescan the modules because they might have been relocated */
-        microcode_scan_module(module_map, mbi);
+        microcode_scan_module(bi);
 
     if ( ucode_mod.mod_end )
         rc = early_update_cache(bootstrap_map(&ucode_mod),
@@ -878,8 +871,7 @@ static int __init early_microcode_update_cpu(void)
     return microcode_update_cpu(patch, 0);
 }
 
-int __init early_microcode_init(unsigned long *module_map,
-                                const struct multiboot_info *mbi)
+int __init early_microcode_init(struct boot_info *bi)
 {
     const struct cpuinfo_x86 *c = &boot_cpu_data;
     int rc = 0;
@@ -922,7 +914,7 @@ int __init early_microcode_init(unsigned long *module_map,
         return -ENODEV;
     }
 
-    microcode_grab_module(module_map, mbi);
+    microcode_grab_module(bi);
 
     if ( ucode_mod.mod_end || ucode_blob.size )
         rc = early_microcode_update_cpu();
diff --git a/xen/arch/x86/include/asm/microcode.h b/xen/arch/x86/include/asm/microcode.h
index 57c08205d4..a278773f8b 100644
--- a/xen/arch/x86/include/asm/microcode.h
+++ b/xen/arch/x86/include/asm/microcode.h
@@ -24,10 +24,10 @@ 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, unsigned int flags);
-int early_microcode_init(unsigned long *module_map,
-                         const struct multiboot_info *mbi);
-int microcode_init_cache(unsigned long *module_map,
-                         const struct multiboot_info *mbi);
 int microcode_update_one(void);
 
+struct boot_info;
+int early_microcode_init(struct boot_info *bi);
+int microcode_init_cache(struct boot_info *bi);
+
 #endif /* ASM_X86__MICROCODE_H */
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index d8001867c9..c75b8f15fa 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1392,7 +1392,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
      * TODO: load ucode earlier once multiboot modules become accessible
      * at an earlier stage.
      */
-    early_microcode_init(module_map, mbi);
+    early_microcode_init(bi);
 
     if ( xen_phys_start )
     {
@@ -1936,7 +1936,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
 
     timer_init();
 
-    microcode_init_cache(module_map, mbi); /* Needs xmalloc() */
+    microcode_init_cache(bi); /* Needs xmalloc() */
 
     tsx_init(); /* Needs microcode.  May change HLE/RTM feature bits. */
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 23 18:33:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 23 Oct 2024 18:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824922.1239125 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3gAd-0002rm-6T; Wed, 23 Oct 2024 18:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 824922.1239125; Wed, 23 Oct 2024 18: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 1t3gAd-0002rf-32; Wed, 23 Oct 2024 18:33:23 +0000
Received: by outflank-mailman (input) for mailman id 824922;
 Wed, 23 Oct 2024 18:33: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 1t3gAb-0002rW-Uc
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 18:33:21 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3gAb-000EXo-2y
 for xen-changelog@lists.xenproject.org;
 Wed, 23 Oct 2024 18:33:21 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3gAb-0000Sf-QI
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 18: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Fix XSM module handling during PVH boot
Message-Id: <E1t3gAb-0000Sf-QI@xenbits.xenproject.org>
Date: Wed, 23 Oct 2024 18:33:21 +0000

commit 6cf0aaeb8df951fb34679f0408461a5c67cb02c6
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Wed Oct 23 02:03:15 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 23 18:14:24 2024 +0100

    x86/boot: Fix XSM module handling during PVH boot
    
    As detailed in commit 0fe607b2a144 ("x86/boot: Fix PVH boot during boot_info
    transition period"), the use of __va(mbi->mods_addr) constitutes a
    use-after-free on the PVH boot path.
    
    This pattern has been in use since before PVH support was added.  This has
    most likely gone unnoticed because no-one's tried using a detached Flask
    policy in a PVH VM before.
    
    Plumb the boot_info pointer down, replacing module_map and mbi.  Importantly,
    bi->mods[].mod is a safe way to access the module list during PVH boot.
    
    As this is the final non-bi use of mbi in __start_xen(), make the pointer
    unusable once bi has been established, to prevent new uses creeping back in.
    This is a stopgap until mbi can be fully removed.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/setup.c  |  5 ++++-
 xen/include/xsm/xsm.h | 12 +++++-------
 xen/xsm/xsm_core.c    |  7 +++----
 xen/xsm/xsm_policy.c  | 16 +++++++---------
 4 files changed, 19 insertions(+), 21 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index c75b8f15fa..8974b0c6ed 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1088,6 +1088,9 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     bi = multiboot_fill_boot_info(mbi, mod);
     bi->module_map = module_map; /* Temporary */
 
+    /* Use bi-> instead */
+#define mbi DO_NOT_USE
+
     /* Parse the command-line options. */
     if ( (kextra = strstr(bi->cmdline, " -- ")) != NULL )
     {
@@ -1862,7 +1865,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     mmio_ro_ranges = rangeset_new(NULL, "r/o mmio ranges",
                                   RANGESETF_prettyprint_hex);
 
-    xsm_multiboot_init(module_map, mbi);
+    xsm_multiboot_init(bi);
 
     /*
      * IOMMU-related ACPI table parsing may require some of the system domains
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 627c0d2731..4dbff9d866 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -17,7 +17,6 @@
 
 #include <xen/alternative-call.h>
 #include <xen/sched.h>
-#include <xen/multiboot.h>
 
 /* policy magic number (defined by XSM_MAGIC) */
 typedef uint32_t xsm_magic_t;
@@ -778,11 +777,10 @@ static inline int xsm_argo_send(const struct domain *d, const struct domain *t)
 #endif /* XSM_NO_WRAPPERS */
 
 #ifdef CONFIG_MULTIBOOT
-int xsm_multiboot_init(
-    unsigned long *module_map, const multiboot_info_t *mbi);
+struct boot_info;
+int xsm_multiboot_init(struct boot_info *bi);
 int xsm_multiboot_policy_init(
-    unsigned long *module_map, const multiboot_info_t *mbi,
-    void **policy_buffer, size_t *policy_size);
+    struct boot_info *bi, void **policy_buffer, size_t *policy_size);
 #endif
 
 #ifdef CONFIG_HAS_DEVICE_TREE
@@ -828,8 +826,8 @@ static const inline struct xsm_ops *silo_init(void)
 #include <xsm/dummy.h>
 
 #ifdef CONFIG_MULTIBOOT
-static inline int xsm_multiboot_init (
-    unsigned long *module_map, const multiboot_info_t *mbi)
+struct boot_info;
+static inline int xsm_multiboot_init(struct boot_info *bi)
 {
     return 0;
 }
diff --git a/xen/xsm/xsm_core.c b/xen/xsm/xsm_core.c
index eaa028109b..6e3fac68c0 100644
--- a/xen/xsm/xsm_core.c
+++ b/xen/xsm/xsm_core.c
@@ -21,6 +21,7 @@
 #ifdef CONFIG_XSM
 
 #ifdef CONFIG_MULTIBOOT
+#include <asm/bootinfo.h>
 #include <asm/setup.h>
 #endif
 
@@ -139,8 +140,7 @@ static int __init xsm_core_init(const void *policy_buffer, size_t policy_size)
 }
 
 #ifdef CONFIG_MULTIBOOT
-int __init xsm_multiboot_init(
-    unsigned long *module_map, const multiboot_info_t *mbi)
+int __init xsm_multiboot_init(struct boot_info *bi)
 {
     int ret = 0;
     void *policy_buffer = NULL;
@@ -150,8 +150,7 @@ int __init xsm_multiboot_init(
 
     if ( XSM_MAGIC )
     {
-        ret = xsm_multiboot_policy_init(module_map, mbi, &policy_buffer,
-                                        &policy_size);
+        ret = xsm_multiboot_policy_init(bi, &policy_buffer, &policy_size);
         if ( ret )
         {
             bootstrap_map(NULL);
diff --git a/xen/xsm/xsm_policy.c b/xen/xsm/xsm_policy.c
index 8dafbc9381..6f799dd28f 100644
--- a/xen/xsm/xsm_policy.c
+++ b/xen/xsm/xsm_policy.c
@@ -20,7 +20,7 @@
 
 #include <xsm/xsm.h>
 #ifdef CONFIG_MULTIBOOT
-#include <xen/multiboot.h>
+#include <asm/bootinfo.h>
 #include <asm/setup.h>
 #endif
 #include <xen/bitops.h>
@@ -31,11 +31,9 @@
 
 #ifdef CONFIG_MULTIBOOT
 int __init xsm_multiboot_policy_init(
-    unsigned long *module_map, const multiboot_info_t *mbi,
-    void **policy_buffer, size_t *policy_size)
+    struct boot_info *bi, void **policy_buffer, size_t *policy_size)
 {
     int i;
-    module_t *mod = (module_t *)__va(mbi->mods_addr);
     int rc = 0;
     u32 *_policy_start;
     unsigned long _policy_len;
@@ -44,13 +42,13 @@ int __init xsm_multiboot_policy_init(
      * Try all modules and see whichever could be the binary policy.
      * Adjust module_map for the module that is the binary policy.
      */
-    for ( i = mbi->mods_count-1; i >= 1; i-- )
+    for ( i = bi->nr_modules - 1; i >= 1; i-- )
     {
-        if ( !test_bit(i, module_map) )
+        if ( !test_bit(i, bi->module_map) )
             continue;
 
-        _policy_start = bootstrap_map(mod + i);
-        _policy_len   = mod[i].mod_end;
+        _policy_start = bootstrap_map(bi->mods[i].mod);
+        _policy_len   = bi->mods[i].mod->mod_end;
 
         if ( (xsm_magic_t)(*_policy_start) == XSM_MAGIC )
         {
@@ -60,7 +58,7 @@ int __init xsm_multiboot_policy_init(
             printk("Policy len %#lx, start at %p.\n",
                    _policy_len,_policy_start);
 
-            __clear_bit(i, module_map);
+            __clear_bit(i, bi->module_map);
             break;
 
         }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 23 18:33:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 23 Oct 2024 18:33:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.824923.1239127 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t3gAn-0002uI-7b; Wed, 23 Oct 2024 18:33:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 824923.1239127; Wed, 23 Oct 2024 18: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 1t3gAn-0002uA-4z; Wed, 23 Oct 2024 18:33:33 +0000
Received: by outflank-mailman (input) for mailman id 824923;
 Wed, 23 Oct 2024 18: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 1t3gAm-0002ty-2B
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 18:33:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3gAm-000EXw-08
 for xen-changelog@lists.xenproject.org;
 Wed, 23 Oct 2024 18:33:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t3gAl-0000Td-W3
 for xen-changelog@lists.xenproject.org; Wed, 23 Oct 2024 18:33:31 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Remove the mbi_p parameter from __start_xen()
Message-Id: <E1t3gAl-0000Td-W3@xenbits.xenproject.org>
Date: Wed, 23 Oct 2024 18:33:31 +0000

commit a974725a87a1afc8056b41c56dfe7fe272a7169c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Oct 23 14:52:49 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 23 18:14:24 2024 +0100

    x86/boot: Remove the mbi_p parameter from __start_xen()
    
    The use of physical addresses in __start_xen() has proved to be fertile soure
    of bugs.
    
    The MB1/2 path stashes the MBI pointer in multiboot_ptr (a setup.c variable
    even), then re-loads it immediately before calling __start_xen().  For this,
    we can just drop the function parameter and read multiboot_ptr in the one
    place where it's used.
    
    The EFI path also passes this parameter into __start_xen().  Have the EFI path
    set up multiboot_ptr too, and move the explanation of phyiscal-mode pointers.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/boot/x86_64.S       |  2 --
 xen/arch/x86/efi/efi-boot.h      |  9 +++++++--
 xen/arch/x86/include/asm/setup.h |  1 +
 xen/arch/x86/setup.c             | 14 +++++---------
 4 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/boot/x86_64.S b/xen/arch/x86/boot/x86_64.S
index 04bb62ae86..26b9d1c2df 100644
--- a/xen/arch/x86/boot/x86_64.S
+++ b/xen/arch/x86/boot/x86_64.S
@@ -77,8 +77,6 @@ ENTRY(__high_start)
         tailcall start_secondary
 
 .L_bsp:
-        /* Pass off the Multiboot info structure to C land (if applicable). */
-        mov     multiboot_ptr(%rip),%edi
         tailcall __start_xen
 
         .section .data.page_aligned, "aw", @progbits
diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index 94f3443364..3b26f0b0f5 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -248,6 +248,12 @@ static void __init noreturn efi_arch_post_exit_boot(void)
     efi_arch_relocate_image(__XEN_VIRT_START - xen_phys_start);
     memcpy((void *)trampoline_phys, trampoline_start, cfg.size);
 
+    /*
+     * We're in physical mode right now (i.e. identity map), so a regular
+     * pointer is also a phyiscal address to the rest of Xen.
+     */
+    multiboot_ptr = (unsigned long)&mbi;
+
     /* Set system registers and transfer control. */
     asm volatile("pushq $0\n\tpopfq");
     rdmsrl(MSR_EFER, efer);
@@ -279,8 +285,7 @@ static void __init noreturn efi_arch_post_exit_boot(void)
                      [cr4] "+&r" (cr4)
                    : [cr3] "r" (idle_pg_table),
                      [cs] "i" (__HYPERVISOR_CS),
-                     [ds] "r" (__HYPERVISOR_DS),
-                     "D" (&mbi)
+                     [ds] "r" (__HYPERVISOR_DS)
                    : "memory" );
     unreachable();
 }
diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h
index 3d18952118..811855e574 100644
--- a/xen/arch/x86/include/asm/setup.h
+++ b/xen/arch/x86/include/asm/setup.h
@@ -14,6 +14,7 @@ extern unsigned long xenheap_initial_phys_start;
 extern uint64_t boot_tsc_stamp;
 
 extern void *stack_start;
+extern unsigned int multiboot_ptr;
 
 void early_cpu_init(bool verbose);
 void early_time_init(void);
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 8974b0c6ed..fc18ba3e35 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -157,8 +157,8 @@ char asmlinkage __section(".init.bss.stack_aligned") __aligned(STACK_SIZE)
 /* Used by the BSP/AP paths to find the higher half stack mapping to use. */
 void *stack_start = cpu0_stack + STACK_SIZE - sizeof(struct cpu_info);
 
-/* Used by the boot asm to stash the relocated multiboot info pointer. */
-unsigned int asmlinkage __initdata multiboot_ptr;
+/* Used by the boot asm and EFI to stash the multiboot_info paddr. */
+unsigned int __initdata multiboot_ptr;
 
 struct cpuinfo_x86 __read_mostly boot_cpu_data = { 0, 0, 0, 0, -1 };
 
@@ -1014,7 +1014,7 @@ static struct domain *__init create_dom0(const module_t *image,
 /* How much of the directmap is prebuilt at compile time. */
 #define PREBUILT_MAP_LIMIT (1 << L2_PAGETABLE_SHIFT)
 
-void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
+void asmlinkage __init noreturn __start_xen(void)
 {
     const char *memmap_type = NULL;
     char *kextra;
@@ -1059,7 +1059,6 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
 
     if ( pvh_boot )
     {
-        ASSERT(mbi_p == 0);
         pvh_init(&mbi, &mod);
         /*
          * mbi and mod are regular pointers to .initdata.  These remain valid
@@ -1068,7 +1067,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     }
     else
     {
-        mbi = __va(mbi_p);
+        mbi = __va(multiboot_ptr);
         mod = __va(mbi->mods_addr);
 
         /*
@@ -1078,11 +1077,8 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
          * For EFI, these are directmap pointers into the Xen image.  They do
          * not remain valid across move_xen().  EFI boot only functions
          * because a non-zero xen_phys_start inhibits move_xen().
-         *
-         * Don't be fooled by efi_arch_post_exit_boot() passing "D" (&mbi).
-         * This is a EFI physical-mode (i.e. identity map) pointer.
          */
-        ASSERT(mbi_p < MB(1) || xen_phys_start);
+        ASSERT(multiboot_ptr < MB(1) || xen_phys_start);
     }
 
     bi = multiboot_fill_boot_info(mbi, mod);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 24 17:00:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 24 Oct 2024 17:00:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.825521.1239756 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t41Bs-0005Mo-S6; Thu, 24 Oct 2024 17:00:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 825521.1239756; Thu, 24 Oct 2024 17: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 1t41Bs-0005MR-PR; Thu, 24 Oct 2024 17:00:04 +0000
Received: by outflank-mailman (input) for mailman id 825521;
 Thu, 24 Oct 2024 17: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 1t41Br-0005Bn-VI
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 17:00:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t41Br-001quo-2f
 for xen-changelog@lists.xenproject.org;
 Thu, 24 Oct 2024 17:00:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t41Br-0002ix-Nb
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 17: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] xen/earlycpio: Drop nextoff parameter
Message-Id: <E1t41Br-0002ix-Nb@xenbits.xenproject.org>
Date: Thu, 24 Oct 2024 17:00:03 +0000

commit 9cbf61445cda7136ffa029de5a14b51181ca0385
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 27 19:33:46 2023 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 24 17:57:59 2024 +0100

    xen/earlycpio: Drop nextoff parameter
    
    This is imported from Linux, but the parameter being signed is dubious in the
    first place and we're not plausibly going to gain a use for the functionality.
    Linux has subsequently made it an optional parameter to avoid forcing callers
    to pass a stack variable they don't care about using.
    
    In the unlikely case that we gain a usecase, we can reintroduce it, but in the
    meantime simplify the single caller.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/microcode/core.c | 3 +--
 xen/common/earlycpio.c            | 8 +-------
 xen/include/xen/earlycpio.h       | 3 +--
 3 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index 1d58cb0f3b..1e5fdd02e4 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -158,7 +158,6 @@ static void __init microcode_scan_module(struct boot_info *bi)
     uint64_t *_blob_start;
     unsigned long _blob_size;
     struct cpio_data cd;
-    long offset;
     const char *p = NULL;
     int i;
 
@@ -191,7 +190,7 @@ static void __init microcode_scan_module(struct boot_info *bi)
         }
         cd.data = NULL;
         cd.size = 0;
-        cd = find_cpio_data(p, _blob_start, _blob_size, &offset /* ignore */);
+        cd = find_cpio_data(p, _blob_start, _blob_size);
         if ( cd.data )
         {
             ucode_blob.size = cd.size;
diff --git a/xen/common/earlycpio.c b/xen/common/earlycpio.c
index 4bcf32a51c..6c76307c25 100644
--- a/xen/common/earlycpio.c
+++ b/xen/common/earlycpio.c
@@ -56,10 +56,6 @@ enum cpio_fields {
  * @path:       The directory to search for, including a slash at the end
  * @data:       Pointer to the the cpio archive or a header inside
  * @len:        Remaining length of the cpio based on data pointer
- * @nextoff:    When a matching file is found, this is the offset from the
- *              beginning of the cpio to the beginning of the next file, not the
- *              matching file itself. It can be used to iterate through the cpio
- *              to find all files inside of a directory path.
  *
  * @return:     struct cpio_data containing the address, length and
  *              filename (with the directory path cut off) of the found file.
@@ -68,8 +64,7 @@ enum cpio_fields {
  *              the match returned an empty filename string.
  */
 
-struct cpio_data __init find_cpio_data(const char *path, void *data,
-				       size_t len,  long *nextoff)
+struct cpio_data __init find_cpio_data(const char *path, void *data, size_t len)
 {
 	const size_t cpio_header_len = 8*C_NFIELDS - 2;
 	struct cpio_data cd = { NULL, 0, "" };
@@ -129,7 +124,6 @@ struct cpio_data __init find_cpio_data(const char *path, void *data,
 		if ((ch[C_MODE] & 0170000) == 0100000 &&
 		    ch[C_NAMESIZE] >= mypathsize &&
 		    !memcmp(p, path, mypathsize)) {
-			*nextoff = (long)nptr - (long)data;
 			if (ch[C_NAMESIZE] - mypathsize >= MAX_CPIO_FILE_NAME) {
 				printk(
 				"File %s exceeding MAX_CPIO_FILE_NAME [%d]\n",
diff --git a/xen/include/xen/earlycpio.h b/xen/include/xen/earlycpio.h
index 16d9404d73..d499203598 100644
--- a/xen/include/xen/earlycpio.h
+++ b/xen/include/xen/earlycpio.h
@@ -9,7 +9,6 @@ struct cpio_data {
 	char name[MAX_CPIO_FILE_NAME];
 };
 
-struct cpio_data find_cpio_data(const char *path, void *data, size_t len,
-				long *offset);
+struct cpio_data find_cpio_data(const char *path, void *data, size_t len);
 
 #endif /* _EARLYCPIO_H */
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 24 17:00:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 24 Oct 2024 17:00:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.825522.1239760 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t41C2-0005l8-TW; Thu, 24 Oct 2024 17:00:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 825522.1239760; Thu, 24 Oct 2024 17: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 1t41C2-0005l0-Qu; Thu, 24 Oct 2024 17:00:14 +0000
Received: by outflank-mailman (input) for mailman id 825522;
 Thu, 24 Oct 2024 17: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 1t41C2-0005ku-09
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 17:00:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t41C1-001qux-3A
 for xen-changelog@lists.xenproject.org;
 Thu, 24 Oct 2024 17:00:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t41C1-0002kQ-Sw
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 17: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/ucode: Explain what microcode_set_module() does
Message-Id: <E1t41C1-0002kQ-Sw@xenbits.xenproject.org>
Date: Thu, 24 Oct 2024 17:00:13 +0000

commit 2802b77abe3a89ab6f60f85b804714a88b4faa1c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 27 15:21:29 2023 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 24 17:57:59 2024 +0100

    x86/ucode: Explain what microcode_set_module() does
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
---
 xen/arch/x86/cpu/microcode/core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index 1e5fdd02e4..2a4c65744f 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -109,6 +109,10 @@ static bool ucode_in_nmi = true;
 /* Protected by microcode_mutex */
 static const struct microcode_patch *microcode_cache;
 
+/*
+ * Used by the EFI path only, when xen.cfg identifies an explicit microcode
+ * file.  Overrides ucode=<int>|scan on the regular command line.
+ */
 void __init microcode_set_module(unsigned int idx)
 {
     ucode_mod_idx = idx;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 24 17:00:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 24 Oct 2024 17:00:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.825523.1239764 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t41CC-0005np-Ut; Thu, 24 Oct 2024 17:00:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 825523.1239764; Thu, 24 Oct 2024 17: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 1t41CC-0005nh-SJ; Thu, 24 Oct 2024 17:00:24 +0000
Received: by outflank-mailman (input) for mailman id 825523;
 Thu, 24 Oct 2024 17: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 1t41CC-0005nU-3m
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 17:00:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t41CC-001qv9-0I
 for xen-changelog@lists.xenproject.org;
 Thu, 24 Oct 2024 17:00:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t41CC-0002lg-1a
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 17: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Drop initial_images pointer
Message-Id: <E1t41CC-0002lg-1a@xenbits.xenproject.org>
Date: Thu, 24 Oct 2024 17:00:24 +0000

commit 980579291dd0f1bd9a3fdcef5cc96fb18d8f89fd
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Mon Oct 21 19:02:42 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 24 17:57:59 2024 +0100

    x86/boot: Drop initial_images pointer
    
    Now that the module list is encapsulated inside boot_info, we can do away with
    the initial_images pointer.
    
    No functional change.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/setup.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index fc18ba3e35..8c10fe51df 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -276,8 +276,6 @@ custom_param("acpi", parse_acpi_param);
 
 static const char *cmdline_cook(const char *p, const char *loader_name);
 
-static const module_t *__initdata initial_images;
-
 struct boot_info __initdata xen_boot_info = {
     .loader = "unknown",
     .cmdline = "",
@@ -332,8 +330,8 @@ unsigned long __init initial_images_nrpages(nodeid_t node)
 
     for ( nr = i = 0; i < bi->nr_modules; ++i )
     {
-        unsigned long start = initial_images[i].mod_start;
-        unsigned long end = start + PFN_UP(initial_images[i].mod_end);
+        unsigned long start = bi->mods[i].mod->mod_start;
+        unsigned long end   = start + PFN_UP(bi->mods[i].mod->mod_end);
 
         if ( end > node_start && node_end > start )
             nr += min(node_end, end) - max(node_start, start);
@@ -349,14 +347,13 @@ void __init discard_initial_images(void)
 
     for ( i = 0; i < bi->nr_modules; ++i )
     {
-        uint64_t start = (uint64_t)initial_images[i].mod_start << PAGE_SHIFT;
+        uint64_t start = pfn_to_paddr(bi->mods[i].mod->mod_start);
 
         init_domheap_pages(start,
-                           start + PAGE_ALIGN(initial_images[i].mod_end));
+                           start + PAGE_ALIGN(bi->mods[i].mod->mod_end));
     }
 
     bi->nr_modules = 0;
-    initial_images = NULL;
 }
 
 static void __init init_idle_domain(void)
@@ -1376,8 +1373,6 @@ void asmlinkage __init noreturn __start_xen(void)
     set_kexec_crash_area_size((u64)nr_pages << PAGE_SHIFT);
     kexec_reserve_area();
 
-    initial_images = mod;
-
     for ( i = 0; !efi_enabled(EFI_LOADER) && i < bi->nr_modules; i++ )
     {
         if ( mod[i].mod_start & (PAGE_SIZE - 1) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 24 17:00:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 24 Oct 2024 17:00:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.825524.1239768 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t41CN-0005qe-0A; Thu, 24 Oct 2024 17:00:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 825524.1239768; Thu, 24 Oct 2024 17: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 1t41CM-0005qW-Ti; Thu, 24 Oct 2024 17:00:34 +0000
Received: by outflank-mailman (input) for mailman id 825524;
 Thu, 24 Oct 2024 17: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 1t41CM-0005qM-8i
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 17:00:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t41CM-001qvY-0k
 for xen-changelog@lists.xenproject.org;
 Thu, 24 Oct 2024 17:00:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t41CM-0002nZ-5S
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 17: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Introduce bootstrap_unmap()
Message-Id: <E1t41CM-0002nZ-5S@xenbits.xenproject.org>
Date: Thu, 24 Oct 2024 17:00:34 +0000

commit 0ba5392e70b366a7a7f280e480eda74ad7ef7220
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Oct 23 16:55:55 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 24 17:57:59 2024 +0100

    x86/boot: Introduce bootstrap_unmap()
    
    We're about to introduce alternative mapping functions, and passing NULL was
    always a slightly weird way to express unmap.  Make an explicit unmap
    function, to avoid having two different valid ways of unmapping.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/cpu/microcode/core.c |  6 +++---
 xen/arch/x86/include/asm/setup.h  |  2 ++
 xen/arch/x86/pv/dom0_build.c      |  2 +-
 xen/arch/x86/setup.c              | 10 ++++++----
 xen/xsm/xsm_core.c                |  4 ++--
 xen/xsm/xsm_policy.c              |  2 +-
 6 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index 2a4c65744f..8d916d891e 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -201,7 +201,7 @@ static void __init microcode_scan_module(struct boot_info *bi)
             ucode_blob.data = cd.data;
             break;
         }
-        bootstrap_map(NULL);
+        bootstrap_unmap();
     }
 }
 
@@ -766,13 +766,13 @@ static int __init cf_check microcode_init(void)
      */
     if ( ucode_blob.size )
     {
-        bootstrap_map(NULL);
+        bootstrap_unmap();
         ucode_blob.size = 0;
         ucode_blob.data = NULL;
     }
     else if ( ucode_mod.mod_end )
     {
-        bootstrap_map(NULL);
+        bootstrap_unmap();
         ucode_mod.mod_end = 0;
     }
 
diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h
index 811855e574..8b7843104f 100644
--- a/xen/arch/x86/include/asm/setup.h
+++ b/xen/arch/x86/include/asm/setup.h
@@ -37,7 +37,9 @@ extern struct boot_info xen_boot_info;
 
 unsigned long initial_images_nrpages(nodeid_t node);
 void discard_initial_images(void);
+
 void *bootstrap_map(const module_t *mod);
+void bootstrap_unmap(void);
 
 int remove_xen_ranges(struct rangeset *r);
 
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index ee9ecdc2ab..cdae17b276 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -830,7 +830,7 @@ static int __init dom0_construct(struct domain *d,
         printk("Failed to load the kernel binary\n");
         goto out;
     }
-    bootstrap_map(NULL);
+    bootstrap_unmap();
 
     if ( UNSET_ADDR != parms.virt_hypercall )
     {
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 8c10fe51df..8e32d6c49c 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -471,13 +471,15 @@ static void *__init bootstrap_map_addr(paddr_t start, paddr_t end)
 
 void *__init bootstrap_map(const module_t *mod)
 {
-    if ( !mod )
-        return bootstrap_map_addr(0, 0);
-
     return bootstrap_map_addr(pfn_to_paddr(mod->mod_start),
                               pfn_to_paddr(mod->mod_start) + mod->mod_end);
 }
 
+void __init bootstrap_unmap(void)
+{
+    bootstrap_map_addr(0, 0);
+}
+
 static void __init move_memory(
     uint64_t dst, uint64_t src, unsigned int size)
 {
@@ -1402,7 +1404,7 @@ void asmlinkage __init noreturn __start_xen(void)
     }
 
     modules_headroom = bzimage_headroom(bootstrap_map(mod), mod->mod_end);
-    bootstrap_map(NULL);
+    bootstrap_unmap();
 
 #ifndef highmem_start
     /* Don't allow split below 4Gb. */
diff --git a/xen/xsm/xsm_core.c b/xen/xsm/xsm_core.c
index 6e3fac68c0..f255fb63bf 100644
--- a/xen/xsm/xsm_core.c
+++ b/xen/xsm/xsm_core.c
@@ -153,14 +153,14 @@ int __init xsm_multiboot_init(struct boot_info *bi)
         ret = xsm_multiboot_policy_init(bi, &policy_buffer, &policy_size);
         if ( ret )
         {
-            bootstrap_map(NULL);
+            bootstrap_unmap();
             printk(XENLOG_ERR "Error %d initializing XSM policy\n", ret);
             return -EINVAL;
         }
     }
 
     ret = xsm_core_init(policy_buffer, policy_size);
-    bootstrap_map(NULL);
+    bootstrap_unmap();
 
     return 0;
 }
diff --git a/xen/xsm/xsm_policy.c b/xen/xsm/xsm_policy.c
index 6f799dd28f..35f36c6f23 100644
--- a/xen/xsm/xsm_policy.c
+++ b/xen/xsm/xsm_policy.c
@@ -63,7 +63,7 @@ int __init xsm_multiboot_policy_init(
 
         }
 
-        bootstrap_map(NULL);
+        bootstrap_unmap();
     }
 
     return rc;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 24 17:00:45 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 24 Oct 2024 17:00:45 +0000
Received: from list by lists.xenproject.org with outflank-mailman.825525.1239771 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t41CX-0005tD-1S; Thu, 24 Oct 2024 17:00:45 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 825525.1239771; Thu, 24 Oct 2024 17: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 1t41CW-0005t5-V7; Thu, 24 Oct 2024 17:00:44 +0000
Received: by outflank-mailman (input) for mailman id 825525;
 Thu, 24 Oct 2024 17: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 1t41CW-0005sx-Bm
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 17:00:44 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t41CW-001qvf-16
 for xen-changelog@lists.xenproject.org;
 Thu, 24 Oct 2024 17:00:44 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t41CW-0002ox-9o
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 17: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Introduce bootstrap_map_bm() to map boot_module's
Message-Id: <E1t41CW-0002ox-9o@xenbits.xenproject.org>
Date: Thu, 24 Oct 2024 17:00:44 +0000

commit 3fd82e09d06a6a7817f79f39eb59742727550134
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Wed Oct 23 17:11:43 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 24 17:57:59 2024 +0100

    x86/boot: Introduce bootstrap_map_bm() to map boot_module's
    
    Convert converting the call to bzimage_headroom(), as well as using
    bi->mod[0].  It will be used externally by later changes.
    
    No functional change.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/include/asm/setup.h | 2 ++
 xen/arch/x86/setup.c             | 9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h
index 8b7843104f..4874ee8936 100644
--- a/xen/arch/x86/include/asm/setup.h
+++ b/xen/arch/x86/include/asm/setup.h
@@ -38,6 +38,8 @@ extern struct boot_info xen_boot_info;
 unsigned long initial_images_nrpages(nodeid_t node);
 void discard_initial_images(void);
 
+struct boot_module;
+void *bootstrap_map_bm(const struct boot_module *bm);
 void *bootstrap_map(const module_t *mod);
 void bootstrap_unmap(void);
 
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 8e32d6c49c..ee03725af3 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -475,6 +475,11 @@ void *__init bootstrap_map(const module_t *mod)
                               pfn_to_paddr(mod->mod_start) + mod->mod_end);
 }
 
+void *__init bootstrap_map_bm(const struct boot_module *bm)
+{
+    return bootstrap_map(bm->mod);
+}
+
 void __init bootstrap_unmap(void)
 {
     bootstrap_map_addr(0, 0);
@@ -1403,7 +1408,9 @@ void asmlinkage __init noreturn __start_xen(void)
         mod[bi->nr_modules].mod_end = __2M_rwdata_end - _stext;
     }
 
-    modules_headroom = bzimage_headroom(bootstrap_map(mod), mod->mod_end);
+    modules_headroom =
+        bzimage_headroom(bootstrap_map_bm(&bi->mods[0]),
+                         bi->mods[0].mod->mod_end);
     bootstrap_unmap();
 
 #ifndef highmem_start
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 24 17:00:55 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 24 Oct 2024 17:00:55 +0000
Received: from list by lists.xenproject.org with outflank-mailman.825526.1239775 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t41Ch-0005vl-2o; Thu, 24 Oct 2024 17:00:55 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 825526.1239775; Thu, 24 Oct 2024 17: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 1t41Ch-0005vd-0E; Thu, 24 Oct 2024 17:00:55 +0000
Received: by outflank-mailman (input) for mailman id 825526;
 Thu, 24 Oct 2024 17: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 1t41Cg-0005vT-Gc
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 17:00:54 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t41Cg-001qvp-1Z
 for xen-changelog@lists.xenproject.org;
 Thu, 24 Oct 2024 17:00:54 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t41Cg-0002qY-DE
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 17: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Convert mod[] to bi->mods[] in __start_xen()
Message-Id: <E1t41Cg-0002qY-DE@xenbits.xenproject.org>
Date: Thu, 24 Oct 2024 17:00:54 +0000

commit d03dfab66a0f9a4f3ebb24fc8b7ae6a145b2c8af
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Mon Oct 21 01:45:39 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 24 17:57:59 2024 +0100

    x86/boot: Convert mod[] to bi->mods[] in __start_xen()
    
    The former is about to disappear.
    
    In some cases, introduce a local struct boot_module pointer.  Judgement on
    where to do this, and on constness, is based on what creates least churn
    overall.
    
    No functional change.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/setup.c | 59 +++++++++++++++++++++++++++++-----------------------
 1 file changed, 33 insertions(+), 26 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index ee03725af3..5413e1c71b 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1382,11 +1382,11 @@ void asmlinkage __init noreturn __start_xen(void)
 
     for ( i = 0; !efi_enabled(EFI_LOADER) && i < bi->nr_modules; i++ )
     {
-        if ( mod[i].mod_start & (PAGE_SIZE - 1) )
+        if ( bi->mods[i].mod->mod_start & (PAGE_SIZE - 1) )
             panic("Bootloader didn't honor module alignment request\n");
-        mod[i].mod_end -= mod[i].mod_start;
-        mod[i].mod_start >>= PAGE_SHIFT;
-        mod[i].reserved = 0;
+        bi->mods[i].mod->mod_end -= bi->mods[i].mod->mod_start;
+        bi->mods[i].mod->mod_start >>= PAGE_SHIFT;
+        bi->mods[i].mod->reserved = 0;
     }
 
     /*
@@ -1397,6 +1397,8 @@ void asmlinkage __init noreturn __start_xen(void)
 
     if ( xen_phys_start )
     {
+        struct boot_module *xen = &bi->mods[bi->nr_modules];
+
         relocated = true;
 
         /*
@@ -1404,8 +1406,8 @@ void asmlinkage __init noreturn __start_xen(void)
          * respective reserve_e820_ram() invocation below. No need to
          * query efi_boot_mem_unused() here, though.
          */
-        mod[bi->nr_modules].mod_start = virt_to_mfn(_stext);
-        mod[bi->nr_modules].mod_end = __2M_rwdata_end - _stext;
+        xen->mod->mod_start = virt_to_mfn(_stext);
+        xen->mod->mod_end   = __2M_rwdata_end - _stext;
     }
 
     modules_headroom =
@@ -1490,15 +1492,17 @@ void asmlinkage __init noreturn __start_xen(void)
         /* Is the region suitable for relocating the multiboot modules? */
         for ( j = bi->nr_modules - 1; j >= 0; j-- )
         {
+            struct boot_module *bm = &bi->mods[j];
+
             /*
              * 'headroom' is a guess for the decompressed size and
              * decompressor overheads of mod[0] (the dom0 kernel).  When we
              * move mod[0], we incorporate this as extra space at the start.
              */
             unsigned long headroom = j ? 0 : modules_headroom;
-            unsigned long size = PAGE_ALIGN(headroom + mod[j].mod_end);
+            unsigned long size = PAGE_ALIGN(headroom + bm->mod->mod_end);
 
-            if ( mod[j].reserved )
+            if ( bm->mod->reserved )
                 continue;
 
             /* Don't overlap with other modules (or Xen itself). */
@@ -1510,14 +1514,13 @@ void asmlinkage __init noreturn __start_xen(void)
 
             if ( s < end &&
                  (headroom ||
-                  ((end - size) >> PAGE_SHIFT) > mod[j].mod_start) )
+                  ((end - size) >> PAGE_SHIFT) > bm->mod->mod_start) )
             {
                 move_memory(end - size + headroom,
-                            (uint64_t)mod[j].mod_start << PAGE_SHIFT,
-                            mod[j].mod_end);
-                mod[j].mod_start = (end - size) >> PAGE_SHIFT;
-                mod[j].mod_end += headroom;
-                mod[j].reserved = 1;
+                            pfn_to_paddr(bm->mod->mod_start), bm->mod->mod_end);
+                bm->mod->mod_start = (end - size) >> PAGE_SHIFT;
+                bm->mod->mod_end += headroom;
+                bm->mod->reserved = 1;
             }
         }
 
@@ -1543,13 +1546,14 @@ void asmlinkage __init noreturn __start_xen(void)
 #endif
     }
 
-    if ( modules_headroom && !mod->reserved )
+    if ( modules_headroom && !bi->mods[0].mod->reserved )
         panic("Not enough memory to relocate the dom0 kernel image\n");
     for ( i = 0; i < bi->nr_modules; ++i )
     {
-        uint64_t s = (uint64_t)mod[i].mod_start << PAGE_SHIFT;
+        const struct boot_module *bm = &bi->mods[i];
+        uint64_t s = pfn_to_paddr(bm->mod->mod_start);
 
-        reserve_e820_ram(&boot_e820, s, s + PAGE_ALIGN(mod[i].mod_end));
+        reserve_e820_ram(&boot_e820, s, s + PAGE_ALIGN(bm->mod->mod_end));
     }
 
     if ( !xen_phys_start )
@@ -1627,8 +1631,8 @@ void asmlinkage __init noreturn __start_xen(void)
                 map_e = boot_e820.map[j].addr + boot_e820.map[j].size;
                 for ( j = 0; j < bi->nr_modules; ++j )
                 {
-                    uint64_t end = pfn_to_paddr(mod[j].mod_start) +
-                                   mod[j].mod_end;
+                    uint64_t end = pfn_to_paddr(bi->mods[j].mod->mod_start) +
+                                   bi->mods[j].mod->mod_end;
 
                     if ( map_e < end )
                         map_e = end;
@@ -1702,11 +1706,13 @@ void asmlinkage __init noreturn __start_xen(void)
 
     for ( i = 0; i < bi->nr_modules; ++i )
     {
-        set_pdx_range(mod[i].mod_start,
-                      mod[i].mod_start + PFN_UP(mod[i].mod_end));
-        map_pages_to_xen((unsigned long)mfn_to_virt(mod[i].mod_start),
-                         _mfn(mod[i].mod_start),
-                         PFN_UP(mod[i].mod_end), PAGE_HYPERVISOR);
+        const struct boot_module *bm = &bi->mods[i];
+
+        set_pdx_range(bm->mod->mod_start,
+                      bm->mod->mod_start + PFN_UP(bm->mod->mod_end));
+        map_pages_to_xen((unsigned long)mfn_to_virt(bm->mod->mod_start),
+                         _mfn(bm->mod->mod_start),
+                         PFN_UP(bm->mod->mod_end), PAGE_HYPERVISOR);
     }
 
 #ifdef CONFIG_KEXEC
@@ -2095,8 +2101,9 @@ void asmlinkage __init noreturn __start_xen(void)
      * We're going to setup domain0 using the module(s) that we stashed safely
      * above our heap. The second module, if present, is an initrd ramdisk.
      */
-    dom0 = create_dom0(mod, modules_headroom,
-                       initrdidx < bi->nr_modules ? mod + initrdidx : NULL,
+    dom0 = create_dom0(bi->mods[0].mod, modules_headroom,
+                       initrdidx < bi->nr_modules ? bi->mods[initrdidx].mod
+                                                  : NULL,
                        kextra, bi->loader);
     if ( !dom0 )
         panic("Could not set up DOM0 guest OS\n");
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 24 17:01:05 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 24 Oct 2024 17:01:05 +0000
Received: from list by lists.xenproject.org with outflank-mailman.825527.1239779 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t41Cr-0005ys-5h; Thu, 24 Oct 2024 17:01:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 825527.1239779; Thu, 24 Oct 2024 17: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 1t41Cr-0005yk-2v; Thu, 24 Oct 2024 17:01:05 +0000
Received: by outflank-mailman (input) for mailman id 825527;
 Thu, 24 Oct 2024 17: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 1t41Cq-0005yd-KO
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 17:01:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t41Cq-001qwD-1y
 for xen-changelog@lists.xenproject.org;
 Thu, 24 Oct 2024 17:01:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t41Cq-0002sQ-I8
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 17: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Drop the mbi and mod pointers in __start_xen()
Message-Id: <E1t41Cq-0002sQ-I8@xenbits.xenproject.org>
Date: Thu, 24 Oct 2024 17:01:04 +0000

commit 83892f6a12a38be4e7fd128a4d3651285bbb9bb4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Oct 23 18:29:15 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 24 17:57:59 2024 +0100

    x86/boot: Drop the mbi and mod pointers in __start_xen()
    
    We can't drop them fully yet, but we can limit their scope to almost nothing,
    which serves the same purpose.
    
    This removes the ability to accidentally reintroduce buggy uses of
    __va(mbi->mods_addr).
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/setup.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 5413e1c71b..511cf5b979 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1026,8 +1026,6 @@ void asmlinkage __init noreturn __start_xen(void)
     struct cpu_info *info = get_cpu_info(), *bsp_info;
     unsigned int initrdidx, num_parked = 0;
     struct boot_info *bi;
-    multiboot_info_t *mbi;
-    module_t *mod;
     unsigned long nr_pages, raw_max_page, modules_headroom, module_map[1];
     int i, j, e820_warn = 0, bytes = 0;
     unsigned long eb_start, eb_end;
@@ -1063,16 +1061,22 @@ void asmlinkage __init noreturn __start_xen(void)
 
     if ( pvh_boot )
     {
+        multiboot_info_t *mbi;
+        module_t *mod;
+
         pvh_init(&mbi, &mod);
         /*
          * mbi and mod are regular pointers to .initdata.  These remain valid
          * across move_xen().
          */
+
+        bi = multiboot_fill_boot_info(mbi, mod);
     }
     else
     {
-        mbi = __va(multiboot_ptr);
-        mod = __va(mbi->mods_addr);
+        multiboot_info_t *mbi = __va(multiboot_ptr);
+
+        bi = multiboot_fill_boot_info(mbi, __va(mbi->mods_addr));
 
         /*
          * For MB1/2, mbi and mod are directmap pointers into the trampoline.
@@ -1085,12 +1089,8 @@ void asmlinkage __init noreturn __start_xen(void)
         ASSERT(multiboot_ptr < MB(1) || xen_phys_start);
     }
 
-    bi = multiboot_fill_boot_info(mbi, mod);
     bi->module_map = module_map; /* Temporary */
 
-    /* Use bi-> instead */
-#define mbi DO_NOT_USE
-
     /* Parse the command-line options. */
     if ( (kextra = strstr(bi->cmdline, " -- ")) != NULL )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 24 17:01:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 24 Oct 2024 17:01:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.825528.1239784 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t41D1-00061W-7B; Thu, 24 Oct 2024 17:01:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 825528.1239784; Thu, 24 Oct 2024 17: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 1t41D1-00061O-4R; Thu, 24 Oct 2024 17:01:15 +0000
Received: by outflank-mailman (input) for mailman id 825528;
 Thu, 24 Oct 2024 17: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 1t41D0-00061I-NU
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 17:01:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t41D0-001qwO-2H
 for xen-changelog@lists.xenproject.org;
 Thu, 24 Oct 2024 17:01:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t41D0-0002tm-M2
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 17: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Explain how discard_initial_images() works
Message-Id: <E1t41D0-0002tm-M2@xenbits.xenproject.org>
Date: Thu, 24 Oct 2024 17:01:14 +0000

commit fa1463cecf59d7419e4c83ed30360c4eb83bde41
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Apr 24 17:33:14 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 24 17:57:59 2024 +0100

    x86/boot: Explain how discard_initial_images() works
    
    discard_initial_images() only works because init_domheap_pages() with ps==pe
    is a no-op.
    
    In dom0_construct(), explaining the significance of setting the initrd length
    to 0, and put an explicit check in discard_initial_images().
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/pv/dom0_build.c |  9 +++++++++
 xen/arch/x86/setup.c         | 13 ++++++++++---
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index cdae17b276..cc882bee61 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -641,6 +641,15 @@ static int __init dom0_construct(struct domain *d,
                 if ( assign_pages(mfn_to_page(_mfn(mfn++)), 1, d, 0) )
                     BUG();
         }
+
+        /*
+         * We have either:
+         * - Mapped the initrd directly into dom0, or
+         * - Copied it and freed the module.
+         *
+         * Either way, tell discard_initial_images() to not free it a second
+         * time.
+         */
         initrd->mod_end = 0;
 
         iommu_memory_setup(d, "initrd", mfn_to_page(_mfn(initrd_mfn)),
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 511cf5b979..177f4024ab 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -340,7 +340,7 @@ unsigned long __init initial_images_nrpages(nodeid_t node)
     return nr;
 }
 
-void __init discard_initial_images(void)
+void __init discard_initial_images(void) /* a.k.a. Free boot modules */
 {
     struct boot_info *bi = &xen_boot_info;
     unsigned int i;
@@ -348,9 +348,16 @@ void __init discard_initial_images(void)
     for ( i = 0; i < bi->nr_modules; ++i )
     {
         uint64_t start = pfn_to_paddr(bi->mods[i].mod->mod_start);
+        uint64_t size  = bi->mods[i].mod->mod_end;
 
-        init_domheap_pages(start,
-                           start + PAGE_ALIGN(bi->mods[i].mod->mod_end));
+        /*
+         * Sometimes the initrd is mapped, rather than copied, into dom0.
+         * Size being 0 is how we're instructed to leave the module alone.
+         */
+        if ( size == 0 )
+            continue;
+
+        init_domheap_pages(start, start + PAGE_ALIGN(size));
     }
 
     bi->nr_modules = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 24 18:11:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 24 Oct 2024 18:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.825537.1239788 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t42Ia-0006St-08; Thu, 24 Oct 2024 18:11:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 825537.1239788; Thu, 24 Oct 2024 18:11:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t42IZ-0006Sl-TV; Thu, 24 Oct 2024 18:11:03 +0000
Received: by outflank-mailman (input) for mailman id 825537;
 Thu, 24 Oct 2024 18: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 1t42IY-0006Sf-8W
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 18:11:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t42IY-001sEV-0d
 for xen-changelog@lists.xenproject.org;
 Thu, 24 Oct 2024 18:11:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t42IY-0001Dx-2g
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 18:11:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] xen/earlycpio: Drop nextoff parameter
Message-Id: <E1t42IY-0001Dx-2g@xenbits.xenproject.org>
Date: Thu, 24 Oct 2024 18:11:02 +0000

commit 9cbf61445cda7136ffa029de5a14b51181ca0385
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 27 19:33:46 2023 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 24 17:57:59 2024 +0100

    xen/earlycpio: Drop nextoff parameter
    
    This is imported from Linux, but the parameter being signed is dubious in the
    first place and we're not plausibly going to gain a use for the functionality.
    Linux has subsequently made it an optional parameter to avoid forcing callers
    to pass a stack variable they don't care about using.
    
    In the unlikely case that we gain a usecase, we can reintroduce it, but in the
    meantime simplify the single caller.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu/microcode/core.c | 3 +--
 xen/common/earlycpio.c            | 8 +-------
 xen/include/xen/earlycpio.h       | 3 +--
 3 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index 1d58cb0f3b..1e5fdd02e4 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -158,7 +158,6 @@ static void __init microcode_scan_module(struct boot_info *bi)
     uint64_t *_blob_start;
     unsigned long _blob_size;
     struct cpio_data cd;
-    long offset;
     const char *p = NULL;
     int i;
 
@@ -191,7 +190,7 @@ static void __init microcode_scan_module(struct boot_info *bi)
         }
         cd.data = NULL;
         cd.size = 0;
-        cd = find_cpio_data(p, _blob_start, _blob_size, &offset /* ignore */);
+        cd = find_cpio_data(p, _blob_start, _blob_size);
         if ( cd.data )
         {
             ucode_blob.size = cd.size;
diff --git a/xen/common/earlycpio.c b/xen/common/earlycpio.c
index 4bcf32a51c..6c76307c25 100644
--- a/xen/common/earlycpio.c
+++ b/xen/common/earlycpio.c
@@ -56,10 +56,6 @@ enum cpio_fields {
  * @path:       The directory to search for, including a slash at the end
  * @data:       Pointer to the the cpio archive or a header inside
  * @len:        Remaining length of the cpio based on data pointer
- * @nextoff:    When a matching file is found, this is the offset from the
- *              beginning of the cpio to the beginning of the next file, not the
- *              matching file itself. It can be used to iterate through the cpio
- *              to find all files inside of a directory path.
  *
  * @return:     struct cpio_data containing the address, length and
  *              filename (with the directory path cut off) of the found file.
@@ -68,8 +64,7 @@ enum cpio_fields {
  *              the match returned an empty filename string.
  */
 
-struct cpio_data __init find_cpio_data(const char *path, void *data,
-				       size_t len,  long *nextoff)
+struct cpio_data __init find_cpio_data(const char *path, void *data, size_t len)
 {
 	const size_t cpio_header_len = 8*C_NFIELDS - 2;
 	struct cpio_data cd = { NULL, 0, "" };
@@ -129,7 +124,6 @@ struct cpio_data __init find_cpio_data(const char *path, void *data,
 		if ((ch[C_MODE] & 0170000) == 0100000 &&
 		    ch[C_NAMESIZE] >= mypathsize &&
 		    !memcmp(p, path, mypathsize)) {
-			*nextoff = (long)nptr - (long)data;
 			if (ch[C_NAMESIZE] - mypathsize >= MAX_CPIO_FILE_NAME) {
 				printk(
 				"File %s exceeding MAX_CPIO_FILE_NAME [%d]\n",
diff --git a/xen/include/xen/earlycpio.h b/xen/include/xen/earlycpio.h
index 16d9404d73..d499203598 100644
--- a/xen/include/xen/earlycpio.h
+++ b/xen/include/xen/earlycpio.h
@@ -9,7 +9,6 @@ struct cpio_data {
 	char name[MAX_CPIO_FILE_NAME];
 };
 
-struct cpio_data find_cpio_data(const char *path, void *data, size_t len,
-				long *offset);
+struct cpio_data find_cpio_data(const char *path, void *data, size_t len);
 
 #endif /* _EARLYCPIO_H */
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 24 18:11:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 24 Oct 2024 18:11:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.825538.1239792 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t42Ik-0006Ud-1A; Thu, 24 Oct 2024 18:11:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 825538.1239792; Thu, 24 Oct 2024 18: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 1t42Ij-0006UV-Uw; Thu, 24 Oct 2024 18:11:13 +0000
Received: by outflank-mailman (input) for mailman id 825538;
 Thu, 24 Oct 2024 18: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 1t42Ii-0006UL-DF
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 18:11:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t42Ii-001sEd-17
 for xen-changelog@lists.xenproject.org;
 Thu, 24 Oct 2024 18:11:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t42Ii-0001Eo-8d
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 18:11:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/ucode: Explain what microcode_set_module() does
Message-Id: <E1t42Ii-0001Eo-8d@xenbits.xenproject.org>
Date: Thu, 24 Oct 2024 18:11:12 +0000

commit 2802b77abe3a89ab6f60f85b804714a88b4faa1c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Mon Mar 27 15:21:29 2023 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 24 17:57:59 2024 +0100

    x86/ucode: Explain what microcode_set_module() does
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
---
 xen/arch/x86/cpu/microcode/core.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index 1e5fdd02e4..2a4c65744f 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -109,6 +109,10 @@ static bool ucode_in_nmi = true;
 /* Protected by microcode_mutex */
 static const struct microcode_patch *microcode_cache;
 
+/*
+ * Used by the EFI path only, when xen.cfg identifies an explicit microcode
+ * file.  Overrides ucode=<int>|scan on the regular command line.
+ */
 void __init microcode_set_module(unsigned int idx)
 {
     ucode_mod_idx = idx;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 24 18:11:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 24 Oct 2024 18:11:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.825539.1239796 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t42Iu-0006XI-2o; Thu, 24 Oct 2024 18:11:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 825539.1239796; Thu, 24 Oct 2024 18: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 1t42Iu-0006XA-03; Thu, 24 Oct 2024 18:11:24 +0000
Received: by outflank-mailman (input) for mailman id 825539;
 Thu, 24 Oct 2024 18: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 1t42Is-0006Wz-H8
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 18:11:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t42Is-001sEo-1d
 for xen-changelog@lists.xenproject.org;
 Thu, 24 Oct 2024 18:11:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t42Is-0001FV-Dc
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 18:11:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Drop initial_images pointer
Message-Id: <E1t42Is-0001FV-Dc@xenbits.xenproject.org>
Date: Thu, 24 Oct 2024 18:11:22 +0000

commit 980579291dd0f1bd9a3fdcef5cc96fb18d8f89fd
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Mon Oct 21 19:02:42 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 24 17:57:59 2024 +0100

    x86/boot: Drop initial_images pointer
    
    Now that the module list is encapsulated inside boot_info, we can do away with
    the initial_images pointer.
    
    No functional change.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/setup.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index fc18ba3e35..8c10fe51df 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -276,8 +276,6 @@ custom_param("acpi", parse_acpi_param);
 
 static const char *cmdline_cook(const char *p, const char *loader_name);
 
-static const module_t *__initdata initial_images;
-
 struct boot_info __initdata xen_boot_info = {
     .loader = "unknown",
     .cmdline = "",
@@ -332,8 +330,8 @@ unsigned long __init initial_images_nrpages(nodeid_t node)
 
     for ( nr = i = 0; i < bi->nr_modules; ++i )
     {
-        unsigned long start = initial_images[i].mod_start;
-        unsigned long end = start + PFN_UP(initial_images[i].mod_end);
+        unsigned long start = bi->mods[i].mod->mod_start;
+        unsigned long end   = start + PFN_UP(bi->mods[i].mod->mod_end);
 
         if ( end > node_start && node_end > start )
             nr += min(node_end, end) - max(node_start, start);
@@ -349,14 +347,13 @@ void __init discard_initial_images(void)
 
     for ( i = 0; i < bi->nr_modules; ++i )
     {
-        uint64_t start = (uint64_t)initial_images[i].mod_start << PAGE_SHIFT;
+        uint64_t start = pfn_to_paddr(bi->mods[i].mod->mod_start);
 
         init_domheap_pages(start,
-                           start + PAGE_ALIGN(initial_images[i].mod_end));
+                           start + PAGE_ALIGN(bi->mods[i].mod->mod_end));
     }
 
     bi->nr_modules = 0;
-    initial_images = NULL;
 }
 
 static void __init init_idle_domain(void)
@@ -1376,8 +1373,6 @@ void asmlinkage __init noreturn __start_xen(void)
     set_kexec_crash_area_size((u64)nr_pages << PAGE_SHIFT);
     kexec_reserve_area();
 
-    initial_images = mod;
-
     for ( i = 0; !efi_enabled(EFI_LOADER) && i < bi->nr_modules; i++ )
     {
         if ( mod[i].mod_start & (PAGE_SIZE - 1) )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 24 18:11:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 24 Oct 2024 18:11:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.825540.1239800 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t42J4-0006ag-4D; Thu, 24 Oct 2024 18:11:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 825540.1239800; Thu, 24 Oct 2024 18: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 1t42J4-0006aY-1a; Thu, 24 Oct 2024 18:11:34 +0000
Received: by outflank-mailman (input) for mailman id 825540;
 Thu, 24 Oct 2024 18: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 1t42J2-0006a9-MH
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 18:11:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t42J2-001sFH-28
 for xen-changelog@lists.xenproject.org;
 Thu, 24 Oct 2024 18:11:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t42J2-0001GF-Io
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 18:11:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Introduce bootstrap_unmap()
Message-Id: <E1t42J2-0001GF-Io@xenbits.xenproject.org>
Date: Thu, 24 Oct 2024 18:11:32 +0000

commit 0ba5392e70b366a7a7f280e480eda74ad7ef7220
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Oct 23 16:55:55 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 24 17:57:59 2024 +0100

    x86/boot: Introduce bootstrap_unmap()
    
    We're about to introduce alternative mapping functions, and passing NULL was
    always a slightly weird way to express unmap.  Make an explicit unmap
    function, to avoid having two different valid ways of unmapping.
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/cpu/microcode/core.c |  6 +++---
 xen/arch/x86/include/asm/setup.h  |  2 ++
 xen/arch/x86/pv/dom0_build.c      |  2 +-
 xen/arch/x86/setup.c              | 10 ++++++----
 xen/xsm/xsm_core.c                |  4 ++--
 xen/xsm/xsm_policy.c              |  2 +-
 6 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index 2a4c65744f..8d916d891e 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -201,7 +201,7 @@ static void __init microcode_scan_module(struct boot_info *bi)
             ucode_blob.data = cd.data;
             break;
         }
-        bootstrap_map(NULL);
+        bootstrap_unmap();
     }
 }
 
@@ -766,13 +766,13 @@ static int __init cf_check microcode_init(void)
      */
     if ( ucode_blob.size )
     {
-        bootstrap_map(NULL);
+        bootstrap_unmap();
         ucode_blob.size = 0;
         ucode_blob.data = NULL;
     }
     else if ( ucode_mod.mod_end )
     {
-        bootstrap_map(NULL);
+        bootstrap_unmap();
         ucode_mod.mod_end = 0;
     }
 
diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h
index 811855e574..8b7843104f 100644
--- a/xen/arch/x86/include/asm/setup.h
+++ b/xen/arch/x86/include/asm/setup.h
@@ -37,7 +37,9 @@ extern struct boot_info xen_boot_info;
 
 unsigned long initial_images_nrpages(nodeid_t node);
 void discard_initial_images(void);
+
 void *bootstrap_map(const module_t *mod);
+void bootstrap_unmap(void);
 
 int remove_xen_ranges(struct rangeset *r);
 
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index ee9ecdc2ab..cdae17b276 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -830,7 +830,7 @@ static int __init dom0_construct(struct domain *d,
         printk("Failed to load the kernel binary\n");
         goto out;
     }
-    bootstrap_map(NULL);
+    bootstrap_unmap();
 
     if ( UNSET_ADDR != parms.virt_hypercall )
     {
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 8c10fe51df..8e32d6c49c 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -471,13 +471,15 @@ static void *__init bootstrap_map_addr(paddr_t start, paddr_t end)
 
 void *__init bootstrap_map(const module_t *mod)
 {
-    if ( !mod )
-        return bootstrap_map_addr(0, 0);
-
     return bootstrap_map_addr(pfn_to_paddr(mod->mod_start),
                               pfn_to_paddr(mod->mod_start) + mod->mod_end);
 }
 
+void __init bootstrap_unmap(void)
+{
+    bootstrap_map_addr(0, 0);
+}
+
 static void __init move_memory(
     uint64_t dst, uint64_t src, unsigned int size)
 {
@@ -1402,7 +1404,7 @@ void asmlinkage __init noreturn __start_xen(void)
     }
 
     modules_headroom = bzimage_headroom(bootstrap_map(mod), mod->mod_end);
-    bootstrap_map(NULL);
+    bootstrap_unmap();
 
 #ifndef highmem_start
     /* Don't allow split below 4Gb. */
diff --git a/xen/xsm/xsm_core.c b/xen/xsm/xsm_core.c
index 6e3fac68c0..f255fb63bf 100644
--- a/xen/xsm/xsm_core.c
+++ b/xen/xsm/xsm_core.c
@@ -153,14 +153,14 @@ int __init xsm_multiboot_init(struct boot_info *bi)
         ret = xsm_multiboot_policy_init(bi, &policy_buffer, &policy_size);
         if ( ret )
         {
-            bootstrap_map(NULL);
+            bootstrap_unmap();
             printk(XENLOG_ERR "Error %d initializing XSM policy\n", ret);
             return -EINVAL;
         }
     }
 
     ret = xsm_core_init(policy_buffer, policy_size);
-    bootstrap_map(NULL);
+    bootstrap_unmap();
 
     return 0;
 }
diff --git a/xen/xsm/xsm_policy.c b/xen/xsm/xsm_policy.c
index 6f799dd28f..35f36c6f23 100644
--- a/xen/xsm/xsm_policy.c
+++ b/xen/xsm/xsm_policy.c
@@ -63,7 +63,7 @@ int __init xsm_multiboot_policy_init(
 
         }
 
-        bootstrap_map(NULL);
+        bootstrap_unmap();
     }
 
     return rc;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 24 18:11:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 24 Oct 2024 18:11:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.825541.1239806 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t42JE-0006dJ-6l; Thu, 24 Oct 2024 18:11:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 825541.1239806; Thu, 24 Oct 2024 18:11: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 1t42JE-0006dB-30; Thu, 24 Oct 2024 18:11:44 +0000
Received: by outflank-mailman (input) for mailman id 825541;
 Thu, 24 Oct 2024 18: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 1t42JC-0006d3-Pw
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 18:11:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t42JC-001sFO-2V
 for xen-changelog@lists.xenproject.org;
 Thu, 24 Oct 2024 18:11:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t42JC-0001Gv-Ne
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 18:11:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Introduce bootstrap_map_bm() to map boot_module's
Message-Id: <E1t42JC-0001Gv-Ne@xenbits.xenproject.org>
Date: Thu, 24 Oct 2024 18:11:42 +0000

commit 3fd82e09d06a6a7817f79f39eb59742727550134
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Wed Oct 23 17:11:43 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 24 17:57:59 2024 +0100

    x86/boot: Introduce bootstrap_map_bm() to map boot_module's
    
    Convert converting the call to bzimage_headroom(), as well as using
    bi->mod[0].  It will be used externally by later changes.
    
    No functional change.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/include/asm/setup.h | 2 ++
 xen/arch/x86/setup.c             | 9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h
index 8b7843104f..4874ee8936 100644
--- a/xen/arch/x86/include/asm/setup.h
+++ b/xen/arch/x86/include/asm/setup.h
@@ -38,6 +38,8 @@ extern struct boot_info xen_boot_info;
 unsigned long initial_images_nrpages(nodeid_t node);
 void discard_initial_images(void);
 
+struct boot_module;
+void *bootstrap_map_bm(const struct boot_module *bm);
 void *bootstrap_map(const module_t *mod);
 void bootstrap_unmap(void);
 
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 8e32d6c49c..ee03725af3 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -475,6 +475,11 @@ void *__init bootstrap_map(const module_t *mod)
                               pfn_to_paddr(mod->mod_start) + mod->mod_end);
 }
 
+void *__init bootstrap_map_bm(const struct boot_module *bm)
+{
+    return bootstrap_map(bm->mod);
+}
+
 void __init bootstrap_unmap(void)
 {
     bootstrap_map_addr(0, 0);
@@ -1403,7 +1408,9 @@ void asmlinkage __init noreturn __start_xen(void)
         mod[bi->nr_modules].mod_end = __2M_rwdata_end - _stext;
     }
 
-    modules_headroom = bzimage_headroom(bootstrap_map(mod), mod->mod_end);
+    modules_headroom =
+        bzimage_headroom(bootstrap_map_bm(&bi->mods[0]),
+                         bi->mods[0].mod->mod_end);
     bootstrap_unmap();
 
 #ifndef highmem_start
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 24 18:11:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 24 Oct 2024 18:11:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.825542.1239807 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t42JO-0006gK-8q; Thu, 24 Oct 2024 18:11:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 825542.1239807; Thu, 24 Oct 2024 18:11:54 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t42JO-0006gD-6L; Thu, 24 Oct 2024 18:11:54 +0000
Received: by outflank-mailman (input) for mailman id 825542;
 Thu, 24 Oct 2024 18:11: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 1t42JM-0006g5-U1
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 18:11:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t42JM-001sFZ-2v
 for xen-changelog@lists.xenproject.org;
 Thu, 24 Oct 2024 18:11:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t42JM-0001JL-RG
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 18:11:52 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Convert mod[] to bi->mods[] in __start_xen()
Message-Id: <E1t42JM-0001JL-RG@xenbits.xenproject.org>
Date: Thu, 24 Oct 2024 18:11:52 +0000

commit d03dfab66a0f9a4f3ebb24fc8b7ae6a145b2c8af
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Mon Oct 21 01:45:39 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 24 17:57:59 2024 +0100

    x86/boot: Convert mod[] to bi->mods[] in __start_xen()
    
    The former is about to disappear.
    
    In some cases, introduce a local struct boot_module pointer.  Judgement on
    where to do this, and on constness, is based on what creates least churn
    overall.
    
    No functional change.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/setup.c | 59 +++++++++++++++++++++++++++++-----------------------
 1 file changed, 33 insertions(+), 26 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index ee03725af3..5413e1c71b 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1382,11 +1382,11 @@ void asmlinkage __init noreturn __start_xen(void)
 
     for ( i = 0; !efi_enabled(EFI_LOADER) && i < bi->nr_modules; i++ )
     {
-        if ( mod[i].mod_start & (PAGE_SIZE - 1) )
+        if ( bi->mods[i].mod->mod_start & (PAGE_SIZE - 1) )
             panic("Bootloader didn't honor module alignment request\n");
-        mod[i].mod_end -= mod[i].mod_start;
-        mod[i].mod_start >>= PAGE_SHIFT;
-        mod[i].reserved = 0;
+        bi->mods[i].mod->mod_end -= bi->mods[i].mod->mod_start;
+        bi->mods[i].mod->mod_start >>= PAGE_SHIFT;
+        bi->mods[i].mod->reserved = 0;
     }
 
     /*
@@ -1397,6 +1397,8 @@ void asmlinkage __init noreturn __start_xen(void)
 
     if ( xen_phys_start )
     {
+        struct boot_module *xen = &bi->mods[bi->nr_modules];
+
         relocated = true;
 
         /*
@@ -1404,8 +1406,8 @@ void asmlinkage __init noreturn __start_xen(void)
          * respective reserve_e820_ram() invocation below. No need to
          * query efi_boot_mem_unused() here, though.
          */
-        mod[bi->nr_modules].mod_start = virt_to_mfn(_stext);
-        mod[bi->nr_modules].mod_end = __2M_rwdata_end - _stext;
+        xen->mod->mod_start = virt_to_mfn(_stext);
+        xen->mod->mod_end   = __2M_rwdata_end - _stext;
     }
 
     modules_headroom =
@@ -1490,15 +1492,17 @@ void asmlinkage __init noreturn __start_xen(void)
         /* Is the region suitable for relocating the multiboot modules? */
         for ( j = bi->nr_modules - 1; j >= 0; j-- )
         {
+            struct boot_module *bm = &bi->mods[j];
+
             /*
              * 'headroom' is a guess for the decompressed size and
              * decompressor overheads of mod[0] (the dom0 kernel).  When we
              * move mod[0], we incorporate this as extra space at the start.
              */
             unsigned long headroom = j ? 0 : modules_headroom;
-            unsigned long size = PAGE_ALIGN(headroom + mod[j].mod_end);
+            unsigned long size = PAGE_ALIGN(headroom + bm->mod->mod_end);
 
-            if ( mod[j].reserved )
+            if ( bm->mod->reserved )
                 continue;
 
             /* Don't overlap with other modules (or Xen itself). */
@@ -1510,14 +1514,13 @@ void asmlinkage __init noreturn __start_xen(void)
 
             if ( s < end &&
                  (headroom ||
-                  ((end - size) >> PAGE_SHIFT) > mod[j].mod_start) )
+                  ((end - size) >> PAGE_SHIFT) > bm->mod->mod_start) )
             {
                 move_memory(end - size + headroom,
-                            (uint64_t)mod[j].mod_start << PAGE_SHIFT,
-                            mod[j].mod_end);
-                mod[j].mod_start = (end - size) >> PAGE_SHIFT;
-                mod[j].mod_end += headroom;
-                mod[j].reserved = 1;
+                            pfn_to_paddr(bm->mod->mod_start), bm->mod->mod_end);
+                bm->mod->mod_start = (end - size) >> PAGE_SHIFT;
+                bm->mod->mod_end += headroom;
+                bm->mod->reserved = 1;
             }
         }
 
@@ -1543,13 +1546,14 @@ void asmlinkage __init noreturn __start_xen(void)
 #endif
     }
 
-    if ( modules_headroom && !mod->reserved )
+    if ( modules_headroom && !bi->mods[0].mod->reserved )
         panic("Not enough memory to relocate the dom0 kernel image\n");
     for ( i = 0; i < bi->nr_modules; ++i )
     {
-        uint64_t s = (uint64_t)mod[i].mod_start << PAGE_SHIFT;
+        const struct boot_module *bm = &bi->mods[i];
+        uint64_t s = pfn_to_paddr(bm->mod->mod_start);
 
-        reserve_e820_ram(&boot_e820, s, s + PAGE_ALIGN(mod[i].mod_end));
+        reserve_e820_ram(&boot_e820, s, s + PAGE_ALIGN(bm->mod->mod_end));
     }
 
     if ( !xen_phys_start )
@@ -1627,8 +1631,8 @@ void asmlinkage __init noreturn __start_xen(void)
                 map_e = boot_e820.map[j].addr + boot_e820.map[j].size;
                 for ( j = 0; j < bi->nr_modules; ++j )
                 {
-                    uint64_t end = pfn_to_paddr(mod[j].mod_start) +
-                                   mod[j].mod_end;
+                    uint64_t end = pfn_to_paddr(bi->mods[j].mod->mod_start) +
+                                   bi->mods[j].mod->mod_end;
 
                     if ( map_e < end )
                         map_e = end;
@@ -1702,11 +1706,13 @@ void asmlinkage __init noreturn __start_xen(void)
 
     for ( i = 0; i < bi->nr_modules; ++i )
     {
-        set_pdx_range(mod[i].mod_start,
-                      mod[i].mod_start + PFN_UP(mod[i].mod_end));
-        map_pages_to_xen((unsigned long)mfn_to_virt(mod[i].mod_start),
-                         _mfn(mod[i].mod_start),
-                         PFN_UP(mod[i].mod_end), PAGE_HYPERVISOR);
+        const struct boot_module *bm = &bi->mods[i];
+
+        set_pdx_range(bm->mod->mod_start,
+                      bm->mod->mod_start + PFN_UP(bm->mod->mod_end));
+        map_pages_to_xen((unsigned long)mfn_to_virt(bm->mod->mod_start),
+                         _mfn(bm->mod->mod_start),
+                         PFN_UP(bm->mod->mod_end), PAGE_HYPERVISOR);
     }
 
 #ifdef CONFIG_KEXEC
@@ -2095,8 +2101,9 @@ void asmlinkage __init noreturn __start_xen(void)
      * We're going to setup domain0 using the module(s) that we stashed safely
      * above our heap. The second module, if present, is an initrd ramdisk.
      */
-    dom0 = create_dom0(mod, modules_headroom,
-                       initrdidx < bi->nr_modules ? mod + initrdidx : NULL,
+    dom0 = create_dom0(bi->mods[0].mod, modules_headroom,
+                       initrdidx < bi->nr_modules ? bi->mods[initrdidx].mod
+                                                  : NULL,
                        kextra, bi->loader);
     if ( !dom0 )
         panic("Could not set up DOM0 guest OS\n");
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 24 18:12:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 24 Oct 2024 18:12:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.825543.1239812 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t42JY-0006iy-Am; Thu, 24 Oct 2024 18:12:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 825543.1239812; Thu, 24 Oct 2024 18:12:04 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t42JY-0006ir-7z; Thu, 24 Oct 2024 18:12:04 +0000
Received: by outflank-mailman (input) for mailman id 825543;
 Thu, 24 Oct 2024 18:12: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 1t42JX-0006ig-1h
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 18:12:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t42JX-001sFr-02
 for xen-changelog@lists.xenproject.org;
 Thu, 24 Oct 2024 18:12:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t42JW-0001LK-VP
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 18:12:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Drop the mbi and mod pointers in __start_xen()
Message-Id: <E1t42JW-0001LK-VP@xenbits.xenproject.org>
Date: Thu, 24 Oct 2024 18:12:02 +0000

commit 83892f6a12a38be4e7fd128a4d3651285bbb9bb4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Oct 23 18:29:15 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 24 17:57:59 2024 +0100

    x86/boot: Drop the mbi and mod pointers in __start_xen()
    
    We can't drop them fully yet, but we can limit their scope to almost nothing,
    which serves the same purpose.
    
    This removes the ability to accidentally reintroduce buggy uses of
    __va(mbi->mods_addr).
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/setup.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 5413e1c71b..511cf5b979 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1026,8 +1026,6 @@ void asmlinkage __init noreturn __start_xen(void)
     struct cpu_info *info = get_cpu_info(), *bsp_info;
     unsigned int initrdidx, num_parked = 0;
     struct boot_info *bi;
-    multiboot_info_t *mbi;
-    module_t *mod;
     unsigned long nr_pages, raw_max_page, modules_headroom, module_map[1];
     int i, j, e820_warn = 0, bytes = 0;
     unsigned long eb_start, eb_end;
@@ -1063,16 +1061,22 @@ void asmlinkage __init noreturn __start_xen(void)
 
     if ( pvh_boot )
     {
+        multiboot_info_t *mbi;
+        module_t *mod;
+
         pvh_init(&mbi, &mod);
         /*
          * mbi and mod are regular pointers to .initdata.  These remain valid
          * across move_xen().
          */
+
+        bi = multiboot_fill_boot_info(mbi, mod);
     }
     else
     {
-        mbi = __va(multiboot_ptr);
-        mod = __va(mbi->mods_addr);
+        multiboot_info_t *mbi = __va(multiboot_ptr);
+
+        bi = multiboot_fill_boot_info(mbi, __va(mbi->mods_addr));
 
         /*
          * For MB1/2, mbi and mod are directmap pointers into the trampoline.
@@ -1085,12 +1089,8 @@ void asmlinkage __init noreturn __start_xen(void)
         ASSERT(multiboot_ptr < MB(1) || xen_phys_start);
     }
 
-    bi = multiboot_fill_boot_info(mbi, mod);
     bi->module_map = module_map; /* Temporary */
 
-    /* Use bi-> instead */
-#define mbi DO_NOT_USE
-
     /* Parse the command-line options. */
     if ( (kextra = strstr(bi->cmdline, " -- ")) != NULL )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 24 18:12:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 24 Oct 2024 18:12:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.825544.1239816 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t42Ji-0006lq-CE; Thu, 24 Oct 2024 18:12:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 825544.1239816; Thu, 24 Oct 2024 18:12:14 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t42Ji-0006lj-9b; Thu, 24 Oct 2024 18:12:14 +0000
Received: by outflank-mailman (input) for mailman id 825544;
 Thu, 24 Oct 2024 18:12: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 1t42Jh-0006lZ-4n
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 18:12:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t42Jh-001sG2-0P
 for xen-changelog@lists.xenproject.org;
 Thu, 24 Oct 2024 18:12:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.92)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t42Jh-0001M0-2j
 for xen-changelog@lists.xenproject.org; Thu, 24 Oct 2024 18:12:13 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Explain how discard_initial_images() works
Message-Id: <E1t42Jh-0001M0-2j@xenbits.xenproject.org>
Date: Thu, 24 Oct 2024 18:12:13 +0000

commit fa1463cecf59d7419e4c83ed30360c4eb83bde41
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Apr 24 17:33:14 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 24 17:57:59 2024 +0100

    x86/boot: Explain how discard_initial_images() works
    
    discard_initial_images() only works because init_domheap_pages() with ps==pe
    is a no-op.
    
    In dom0_construct(), explaining the significance of setting the initrd length
    to 0, and put an explicit check in discard_initial_images().
    
    No functional change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
---
 xen/arch/x86/pv/dom0_build.c |  9 +++++++++
 xen/arch/x86/setup.c         | 13 ++++++++++---
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index cdae17b276..cc882bee61 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -641,6 +641,15 @@ static int __init dom0_construct(struct domain *d,
                 if ( assign_pages(mfn_to_page(_mfn(mfn++)), 1, d, 0) )
                     BUG();
         }
+
+        /*
+         * We have either:
+         * - Mapped the initrd directly into dom0, or
+         * - Copied it and freed the module.
+         *
+         * Either way, tell discard_initial_images() to not free it a second
+         * time.
+         */
         initrd->mod_end = 0;
 
         iommu_memory_setup(d, "initrd", mfn_to_page(_mfn(initrd_mfn)),
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 511cf5b979..177f4024ab 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -340,7 +340,7 @@ unsigned long __init initial_images_nrpages(nodeid_t node)
     return nr;
 }
 
-void __init discard_initial_images(void)
+void __init discard_initial_images(void) /* a.k.a. Free boot modules */
 {
     struct boot_info *bi = &xen_boot_info;
     unsigned int i;
@@ -348,9 +348,16 @@ void __init discard_initial_images(void)
     for ( i = 0; i < bi->nr_modules; ++i )
     {
         uint64_t start = pfn_to_paddr(bi->mods[i].mod->mod_start);
+        uint64_t size  = bi->mods[i].mod->mod_end;
 
-        init_domheap_pages(start,
-                           start + PAGE_ALIGN(bi->mods[i].mod->mod_end));
+        /*
+         * Sometimes the initrd is mapped, rather than copied, into dom0.
+         * Size being 0 is how we're instructed to leave the module alone.
+         */
+        if ( size == 0 )
+            continue;
+
+        init_domheap_pages(start, start + PAGE_ALIGN(size));
     }
 
     bi->nr_modules = 0;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 12:00:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 12:00:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827313.1241898 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5ktH-0003sq-Hz; Tue, 29 Oct 2024 12:00:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827313.1241898; Tue, 29 Oct 2024 12: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 1t5ktH-0003sh-En; Tue, 29 Oct 2024 12:00:03 +0000
Received: by outflank-mailman (input) for mailman id 827313;
 Tue, 29 Oct 2024 12:00: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 1t5ktG-0003kI-HF
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 12:00:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5ktG-009HhA-1O
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 12:00:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5ktG-002VZk-1D
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 12:00:02 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [mini-os master] Add missing symbol exports for grub-pv
Message-Id: <E1t5ktG-002VZk-1D@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 12:00:02 +0000

commit 6d5159e8410be16a47433bac1627e63f8adc7cd9
Author:     Juergen Gross <jgross@suse.com>
AuthorDate: Tue Oct 29 12:41:58 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 29 11:58:49 2024 +0000

    Add missing symbol exports for grub-pv
    
    Grub-pv needs start_info_union and phys_to_machine_mapping to be
    accessible. Export both symbols.
    
    Fixes: 33411a11f848 ("Mini-OS: hide all symbols not exported via EXPORT_SYMBOLS()")
    Reported-by: Natanael Copa <ncopa@alpinelinux.org>
    Signed-off-by: Juergen Gross <jgross@suse.com>
    Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
---
 arch/x86/mm.c    | 1 +
 arch/x86/setup.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/x86/mm.c b/arch/x86/mm.c
index 572e762..3ba6d91 100644
--- a/arch/x86/mm.c
+++ b/arch/x86/mm.c
@@ -55,6 +55,7 @@
 #endif
 
 unsigned long *phys_to_machine_mapping;
+EXPORT_SYMBOL(phys_to_machine_mapping);
 unsigned long mfn_zero;
 pgentry_t *pt_base;
 EXPORT_SYMBOL(pt_base);
diff --git a/arch/x86/setup.c b/arch/x86/setup.c
index b27bbed..b613083 100644
--- a/arch/x86/setup.c
+++ b/arch/x86/setup.c
@@ -41,6 +41,7 @@
  * address of the shared_info structure, and things like that.
  */
 union start_info_union start_info_union;
+EXPORT_SYMBOL(start_info_union);
 #endif
 
 /*
--
generated by git-patchbot for /home/xen/git/mini-os.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:33:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827526.1242171 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oDT-0007OZ-0v; Tue, 29 Oct 2024 15:33:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827526.1242171; Tue, 29 Oct 2024 15: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 1t5oDS-0007OR-UQ; Tue, 29 Oct 2024 15:33:06 +0000
Received: by outflank-mailman (input) for mailman id 827526;
 Tue, 29 Oct 2024 15:33: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 1t5oDR-0007OL-Fj
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:33:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oDR-009M4H-1G
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:33:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oDR-002qLS-0z
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:33: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] xen/ucode: Make Intel's microcode_sanity_check() stricter
Message-Id: <E1t5oDR-002qLS-0z@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:33:05 +0000

commit 84d8fbd883882b6c3ca3e86261bcbd1d3bc2df70
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Tue Oct 29 16:25:07 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:25:07 2024 +0100

    xen/ucode: Make Intel's microcode_sanity_check() stricter
    
    The SDM states that data size must be a multiple of 4, but Xen doesn't check
    this propery.
    
    This is liable to cause a later failures, but should be checked explicitly.
    
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 8752ad83e79754f8109457cff796e5f86f644348
    master date: 2024-09-24 18:57:38 +0100
---
 xen/arch/x86/cpu/microcode/intel.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/intel.c b/xen/arch/x86/cpu/microcode/intel.c
index f505aa1b78..fa3c2bab00 100644
--- a/xen/arch/x86/cpu/microcode/intel.c
+++ b/xen/arch/x86/cpu/microcode/intel.c
@@ -155,10 +155,13 @@ static int microcode_sanity_check(const struct microcode_patch *patch)
     uint32_t sum;
 
     /*
-     * Total size must be a multiple of 1024 bytes.  Data size and the header
-     * must fit within it.
+     * The SDM states:
+     * - Data size must be a multiple of 4.
+     * - Total size must be a multiple of 1024 bytes.  Data size and the
+     *   header must fit within it.
      */
     if ( (total_size & 1023) ||
+         (data_size & 3) ||
          data_size > (total_size - MC_HEADER_SIZE) )
     {
         printk(XENLOG_WARNING "microcode: Bad size\n");
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:33:17 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:33:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827527.1242174 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oDd-0007Qg-29; Tue, 29 Oct 2024 15:33:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827527.1242174; Tue, 29 Oct 2024 15:33: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 1t5oDc-0007QY-Vs; Tue, 29 Oct 2024 15:33:16 +0000
Received: by outflank-mailman (input) for mailman id 827527;
 Tue, 29 Oct 2024 15:33: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 1t5oDb-0007QM-Jw
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:33:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oDb-009M4g-1g
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oDb-002qMy-1R
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:33: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/PV: simplify (and thus correct) guest accessor functions
Message-Id: <E1t5oDb-002qMy-1R@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:33:15 +0000

commit 950e57e0ce74f8284b8aa3f34f15f38c70dbc9ae
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Oct 29 16:26:30 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:26:30 2024 +0100

    x86/PV: simplify (and thus correct) guest accessor functions
    
    Taking a fault on a non-byte-granular insn means that the "number of
    bytes not handled" return value would need extra care in calculating, if
    we want callers to be able to derive e.g. exception context (to be
    injected to the guest) - CR2 for #PF in particular - from the value. To
    simplify things rather than complicating them, reduce inline assembly to
    just byte-granular string insns. On recent CPUs that's also supposed to
    be more efficient anyway.
    
    For singular element accessors, however, alignment checks are added,
    hence slightly complicating the code. Misaligned (user) buffer accesses
    will now be forwarded to copy_{from,to}_guest_ll().
    
    Naturally copy_{from,to}_unsafe_ll() accessors end up being adjusted the
    same way, as they're produced by mere re-processing of the same code.
    Otoh copy_{from,to}_unsafe() aren't similarly adjusted, but have their
    comments made match reality; down the road we may want to change their
    return types, e.g. to bool.
    
    Fixes: 76974398a63c ("Added user-memory accessing functionality for x86_64")
    Fixes: 7b8c36701d26 ("Introduce clear_user and clear_guest")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 67a8e5721e1ea9c28526883036bf08fb2e8a8c9c
    master date: 2024-10-01 09:44:55 +0200
---
 xen/arch/x86/include/asm/uaccess.h | 12 +++----
 xen/arch/x86/usercopy.c            | 66 +++++---------------------------------
 2 files changed, 14 insertions(+), 64 deletions(-)

diff --git a/xen/arch/x86/include/asm/uaccess.h b/xen/arch/x86/include/asm/uaccess.h
index 48b684c19d..c44faf7e5b 100644
--- a/xen/arch/x86/include/asm/uaccess.h
+++ b/xen/arch/x86/include/asm/uaccess.h
@@ -251,7 +251,8 @@ do {                                                                       \
 static always_inline unsigned long
 __copy_to_guest_pv(void __user *to, const void *from, unsigned long n)
 {
-    if (__builtin_constant_p(n)) {
+    if ( __builtin_constant_p(n) && !((unsigned long)to & (n - 1)) )
+    {
         unsigned long ret;
 
         switch (n) {
@@ -291,7 +292,8 @@ __copy_to_guest_pv(void __user *to, const void *from, unsigned long n)
 static always_inline unsigned long
 __copy_from_guest_pv(void *to, const void __user *from, unsigned long n)
 {
-    if (__builtin_constant_p(n)) {
+    if ( __builtin_constant_p(n) && !((unsigned long)from & (n - 1)) )
+    {
         unsigned long ret;
 
         switch (n) {
@@ -321,8 +323,7 @@ __copy_from_guest_pv(void *to, const void __user *from, unsigned long n)
  *
  * Copy data from hypervisor space to a potentially unmapped area.
  *
- * Returns number of bytes that could not be copied.
- * On success, this will be zero.
+ * Returns zero on success and non-zero if some bytes could not be copied.
  */
 static always_inline unsigned int
 copy_to_unsafe(void __user *to, const void *from, unsigned int n)
@@ -358,8 +359,7 @@ copy_to_unsafe(void __user *to, const void *from, unsigned int n)
  *
  * Copy data from a potentially unmapped area space to hypervisor space.
  *
- * Returns number of bytes that could not be copied.
- * On success, this will be zero.
+ * Returns zero on success and non-zero if some bytes could not be copied.
  *
  * If some data could not be copied, this function will pad the copied
  * data to the requested size using zero bytes.
diff --git a/xen/arch/x86/usercopy.c b/xen/arch/x86/usercopy.c
index b8c2d1cc0b..7ab2009efe 100644
--- a/xen/arch/x86/usercopy.c
+++ b/xen/arch/x86/usercopy.c
@@ -16,42 +16,19 @@
 
 unsigned int copy_to_guest_ll(void __user *to, const void *from, unsigned int n)
 {
-    unsigned dummy;
+    GUARD(unsigned dummy);
 
     stac();
     asm volatile (
         GUARD(
         "    guest_access_mask_ptr %[to], %q[scratch1], %q[scratch2]\n"
         )
-        "    cmp  $"STR(2*BYTES_PER_LONG-1)", %[cnt]\n"
-        "    jbe  1f\n"
-        "    mov  %k[to], %[cnt]\n"
-        "    neg  %[cnt]\n"
-        "    and  $"STR(BYTES_PER_LONG-1)", %[cnt]\n"
-        "    sub  %[cnt], %[aux]\n"
-        "4:  rep movsb\n" /* make 'to' address aligned */
-        "    mov  %[aux], %[cnt]\n"
-        "    shr  $"STR(LONG_BYTEORDER)", %[cnt]\n"
-        "    and  $"STR(BYTES_PER_LONG-1)", %[aux]\n"
-        "    .align 2,0x90\n"
-        "0:  rep movs"__OS"\n" /* as many words as possible... */
-        "    mov  %[aux],%[cnt]\n"
-        "1:  rep movsb\n" /* ...remainder copied as bytes */
+        "1:  rep movsb\n"
         "2:\n"
-        ".section .fixup,\"ax\"\n"
-        "5:  add %[aux], %[cnt]\n"
-        "    jmp 2b\n"
-        "3:  lea (%q[aux], %q[cnt], "STR(BYTES_PER_LONG)"), %[cnt]\n"
-        "    jmp 2b\n"
-        ".previous\n"
-        _ASM_EXTABLE(4b, 5b)
-        _ASM_EXTABLE(0b, 3b)
         _ASM_EXTABLE(1b, 2b)
-        : [cnt] "+c" (n), [to] "+D" (to), [from] "+S" (from),
-          [aux] "=&r" (dummy)
+        : [cnt] "+c" (n), [to] "+D" (to), [from] "+S" (from)
           GUARD(, [scratch1] "=&r" (dummy), [scratch2] "=&r" (dummy))
-        : "[aux]" (n)
-        : "memory" );
+        :: "memory" );
     clac();
 
     return n;
@@ -66,25 +43,9 @@ unsigned int copy_from_guest_ll(void *to, const void __user *from, unsigned int
         GUARD(
         "    guest_access_mask_ptr %[from], %q[scratch1], %q[scratch2]\n"
         )
-        "    cmp  $"STR(2*BYTES_PER_LONG-1)", %[cnt]\n"
-        "    jbe  1f\n"
-        "    mov  %k[to], %[cnt]\n"
-        "    neg  %[cnt]\n"
-        "    and  $"STR(BYTES_PER_LONG-1)", %[cnt]\n"
-        "    sub  %[cnt], %[aux]\n"
-        "4:  rep movsb\n" /* make 'to' address aligned */
-        "    mov  %[aux],%[cnt]\n"
-        "    shr  $"STR(LONG_BYTEORDER)", %[cnt]\n"
-        "    and  $"STR(BYTES_PER_LONG-1)", %[aux]\n"
-        "    .align 2,0x90\n"
-        "0:  rep movs"__OS"\n" /* as many words as possible... */
-        "    mov  %[aux], %[cnt]\n"
-        "1:  rep movsb\n" /* ...remainder copied as bytes */
+        "1:  rep movsb\n"
         "2:\n"
         ".section .fixup,\"ax\"\n"
-        "5:  add  %[aux], %[cnt]\n"
-        "    jmp 6f\n"
-        "3:  lea  (%q[aux], %q[cnt], "STR(BYTES_PER_LONG)"), %[cnt]\n"
         "6:  mov  %[cnt], %k[from]\n"
         "    xchg %%eax, %[aux]\n"
         "    xor  %%eax, %%eax\n"
@@ -93,14 +54,11 @@ unsigned int copy_from_guest_ll(void *to, const void __user *from, unsigned int
         "    mov  %k[from], %[cnt]\n"
         "    jmp 2b\n"
         ".previous\n"
-        _ASM_EXTABLE(4b, 5b)
-        _ASM_EXTABLE(0b, 3b)
         _ASM_EXTABLE(1b, 6b)
         : [cnt] "+c" (n), [to] "+D" (to), [from] "+S" (from),
           [aux] "=&r" (dummy)
           GUARD(, [scratch1] "=&r" (dummy), [scratch2] "=&r" (dummy))
-        : "[aux]" (n)
-        : "memory" );
+        :: "memory" );
     clac();
 
     return n;
@@ -145,20 +103,12 @@ unsigned int clear_guest_pv(void __user *to, unsigned int n)
         stac();
         asm volatile (
             "    guest_access_mask_ptr %[to], %[scratch1], %[scratch2]\n"
-            "0:  rep stos"__OS"\n"
-            "    mov  %[bytes], %[cnt]\n"
             "1:  rep stosb\n"
             "2:\n"
-            ".section .fixup,\"ax\"\n"
-            "3:  lea  (%q[bytes], %q[longs], "STR(BYTES_PER_LONG)"), %[cnt]\n"
-            "    jmp  2b\n"
-            ".previous\n"
-            _ASM_EXTABLE(0b,3b)
             _ASM_EXTABLE(1b,2b)
-            : [cnt] "=&c" (n), [to] "+D" (to), [scratch1] "=&r" (dummy),
+            : [cnt] "+c" (n), [to] "+D" (to), [scratch1] "=&r" (dummy),
               [scratch2] "=&r" (dummy)
-            : [bytes] "r" (n & (BYTES_PER_LONG - 1)),
-              [longs] "0" (n / BYTES_PER_LONG), "a" (0) );
+            : "a" (0) );
         clac();
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:33:27 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:33:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827528.1242179 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oDn-0007Tk-3Y; Tue, 29 Oct 2024 15:33:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827528.1242179; Tue, 29 Oct 2024 15:33: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 1t5oDn-0007Td-14; Tue, 29 Oct 2024 15:33:27 +0000
Received: by outflank-mailman (input) for mailman id 827528;
 Tue, 29 Oct 2024 15:33: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 1t5oDl-0007T8-NV
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:33:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oDl-009M6r-23
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:33:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oDl-002qOz-1s
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:33: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/traps: Re-enable interrupts after reading cr2 in the #PF handler
Message-Id: <E1t5oDl-002qOz-1s@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:33:25 +0000

commit 8f9dad658ad7b1a9c2a7f1a0a5e7e7cbe7f87bc3
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Tue Oct 29 16:26:50 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:26:50 2024 +0100

    x86/traps: Re-enable interrupts after reading cr2 in the #PF handler
    
    Hitting a page fault clobbers %cr2, so if a page fault is handled while
    handling a previous page fault then %cr2 will hold the address of the
    latter fault rather than the former. In particular, if a debug key
    handler happens to trigger during #PF and before %cr2 is read, and that
    handler itself encounters a #PF, then %cr2 will be corrupt for the outer #PF
    handler.
    
    This patch makes the page fault path delay re-enabling IRQs until %cr2
    has been read in order to ensure it stays consistent.
    
    A similar argument holds in additional cases, but they happen to be safe:
        * %dr6 inside #DB: Safe because IST exceptions don't re-enable IRQs.
        * MSR_XFD_ERR inside #NM: Safe because AMX isn't used in #NM handler.
    
    While in the area, remove redundant q suffix to a movq in entry.S and
    the space after the comma.
    
    Fixes: a4cd20a19073 ("[XEN] 'd' key dumps both host and guest state.")
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: b06e76db7c35974f1b127762683e7852ca0c8e76
    master date: 2024-10-01 09:45:49 +0200
---
 xen/arch/x86/traps.c        |  8 ++++++++
 xen/arch/x86/x86_64/entry.S | 20 ++++++++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 8e2df3e719..ccb5a37a72 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1603,6 +1603,14 @@ void asmlinkage do_page_fault(struct cpu_user_regs *regs)
 
     addr = read_cr2();
 
+    /*
+     * Don't re-enable interrupts if we were running an IRQ-off region when
+     * we hit the page fault, or we'll break that code.
+     */
+    ASSERT(!local_irq_is_enabled());
+    if ( regs->flags & X86_EFLAGS_IF )
+        local_irq_enable();
+
     /* fixup_page_fault() might change regs->error_code, so cache it here. */
     error_code = regs->error_code;
 
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index b8482de8ee..9b0cdb7640 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -844,9 +844,9 @@ handle_exception_saved:
 #elif !defined(CONFIG_PV)
         ASSERT_CONTEXT_IS_XEN
 #endif /* CONFIG_PV */
-        sti
-1:      movq  %rsp,%rdi
-        movzbl UREGS_entry_vector(%rsp),%eax
+.Ldispatch_exceptions:
+        mov   %rsp, %rdi
+        movzbl UREGS_entry_vector(%rsp), %eax
 #ifdef CONFIG_PERF_COUNTERS
         lea   per_cpu__perfcounters(%rip), %rcx
         add   STACK_CPUINFO_FIELD(per_cpu_offset)(%r14), %rcx
@@ -866,7 +866,19 @@ handle_exception_saved:
         jmp   .L_exn_dispatch_done;    \
 .L_ ## vec ## _done:
 
+        /*
+         * IRQs kept off to derisk being hit by a nested interrupt before
+         * reading %cr2. Otherwise a page fault in the nested interrupt handler
+         * would corrupt %cr2.
+         */
         DISPATCH(X86_EXC_PF, do_page_fault)
+
+        /* Only re-enable IRQs if they were active before taking the fault */
+        testb $X86_EFLAGS_IF >> 8, UREGS_eflags + 1(%rsp)
+        jz    1f
+        sti
+1:
+
         DISPATCH(X86_EXC_GP, do_general_protection)
         DISPATCH(X86_EXC_UD, do_invalid_op)
         DISPATCH(X86_EXC_NM, do_device_not_available)
@@ -911,7 +923,7 @@ exception_with_ints_disabled:
         movq  %rsp,%rdi
         call  search_pre_exception_table
         testq %rax,%rax                 # no fixup code for faulting EIP?
-        jz    1b
+        jz    .Ldispatch_exceptions
         movq  %rax,UREGS_rip(%rsp)      # fixup regular stack
 
 #ifdef CONFIG_XEN_SHSTK
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:33:37 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:33:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827529.1242182 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oDx-0007X3-4w; Tue, 29 Oct 2024 15:33:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827529.1242182; Tue, 29 Oct 2024 15:33: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 1t5oDx-0007Ww-2V; Tue, 29 Oct 2024 15:33:37 +0000
Received: by outflank-mailman (input) for mailman id 827529;
 Tue, 29 Oct 2024 15:33: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 1t5oDv-0007Wm-PJ
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:33:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oDv-009M6z-2P
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:33:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oDv-002qPm-2E
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:33: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/pv: Rework guest_io_okay() to return X86EMUL_*
Message-Id: <E1t5oDv-002qPm-2E@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:33:35 +0000

commit f879df5eb40fb32057e09a78cfa52f9ff08f8030
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Oct 29 16:27:29 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:27:29 2024 +0100

    x86/pv: Rework guest_io_okay() to return X86EMUL_*
    
    In order to fix a bug with guest_io_okay() (subsequent patch), rework
    guest_io_okay() to take in an emulation context, and return X86EMUL_* rather
    than a boolean.
    
    For the failing case, take the opportunity to inject #GP explicitly, rather
    than returning X86EMUL_UNHANDLEABLE.  There is a logical difference between
    "we know what this is, and it's #GP", vs "we don't know what this is".
    
    There is no change in practice as emulation is the final step on general #GP
    resolution, but returning X86EMUL_UNHANDLEABLE would be a latent bug if a
    subsequent action were to appear.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 7429e1cc071b0e20ea9581da4893fb9b2f6d21d4
    master date: 2024-10-01 14:58:18 +0100
---
 xen/arch/x86/pv/emul-priv-op.c | 36 +++++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index b90f745c75..cc66ffbf8e 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -156,14 +156,16 @@ static bool iopl_ok(const struct vcpu *v, const struct cpu_user_regs *regs)
 }
 
 /* Has the guest requested sufficient permission for this I/O access? */
-static bool guest_io_okay(unsigned int port, unsigned int bytes,
-                          struct vcpu *v, struct cpu_user_regs *regs)
+static int guest_io_okay(unsigned int port, unsigned int bytes,
+                         struct x86_emulate_ctxt *ctxt)
 {
+    const struct cpu_user_regs *regs = ctxt->regs;
+    struct vcpu *v = current;
     /* If in user mode, switch to kernel mode just to read I/O bitmap. */
     const bool user_mode = !(v->arch.flags & TF_kernel_mode);
 
     if ( iopl_ok(v, regs) )
-        return true;
+        return X86EMUL_OKAY;
 
     if ( (port + bytes) <= v->arch.pv.iobmp_limit )
     {
@@ -190,10 +192,12 @@ static bool guest_io_okay(unsigned int port, unsigned int bytes,
             toggle_guest_pt(v);
 
         if ( (x.mask & (((1 << bytes) - 1) << (port & 7))) == 0 )
-            return true;
+            return X86EMUL_OKAY;
     }
 
-    return false;
+    x86_emul_hw_exception(X86_EXC_GP, 0, ctxt);
+
+    return X86EMUL_EXCEPTION;
 }
 
 /* Has the administrator granted sufficient permission for this I/O access? */
@@ -353,12 +357,14 @@ static int cf_check read_io(
     struct priv_op_ctxt *poc = container_of(ctxt, struct priv_op_ctxt, ctxt);
     struct vcpu *curr = current;
     struct domain *currd = current->domain;
+    int rc;
 
     /* INS must not come here. */
     ASSERT((ctxt->opcode & ~9) == 0xe4);
 
-    if ( !guest_io_okay(port, bytes, curr, ctxt->regs) )
-        return X86EMUL_UNHANDLEABLE;
+    rc = guest_io_okay(port, bytes, ctxt);
+    if ( rc != X86EMUL_OKAY )
+        return rc;
 
     poc->bpmatch = check_guest_io_breakpoint(curr, port, bytes);
 
@@ -458,12 +464,14 @@ static int cf_check write_io(
     struct priv_op_ctxt *poc = container_of(ctxt, struct priv_op_ctxt, ctxt);
     struct vcpu *curr = current;
     struct domain *currd = current->domain;
+    int rc;
 
     /* OUTS must not come here. */
     ASSERT((ctxt->opcode & ~9) == 0xe6);
 
-    if ( !guest_io_okay(port, bytes, curr, ctxt->regs) )
-        return X86EMUL_UNHANDLEABLE;
+    rc = guest_io_okay(port, bytes, ctxt);
+    if ( rc != X86EMUL_OKAY )
+        return rc;
 
     poc->bpmatch = check_guest_io_breakpoint(curr, port, bytes);
 
@@ -612,8 +620,9 @@ static int cf_check rep_ins(
 
     *reps = 0;
 
-    if ( !guest_io_okay(port, bytes_per_rep, curr, ctxt->regs) )
-        return X86EMUL_UNHANDLEABLE;
+    rc = guest_io_okay(port, bytes_per_rep, ctxt);
+    if ( rc != X86EMUL_OKAY )
+        return rc;
 
     rc = read_segment(x86_seg_es, &sreg, ctxt);
     if ( rc != X86EMUL_OKAY )
@@ -678,8 +687,9 @@ static int cf_check rep_outs(
 
     *reps = 0;
 
-    if ( !guest_io_okay(port, bytes_per_rep, curr, ctxt->regs) )
-        return X86EMUL_UNHANDLEABLE;
+    rc = guest_io_okay(port, bytes_per_rep, ctxt);
+    if ( rc != X86EMUL_OKAY )
+        return rc;
 
     rc = read_segment(seg, &sreg, ctxt);
     if ( rc != X86EMUL_OKAY )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:33:47 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:33:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827530.1242186 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oE7-0007Zj-6o; Tue, 29 Oct 2024 15:33:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827530.1242186; Tue, 29 Oct 2024 15:33: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 1t5oE7-0007Zc-3z; Tue, 29 Oct 2024 15:33:47 +0000
Received: by outflank-mailman (input) for mailman id 827530;
 Tue, 29 Oct 2024 15:33: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 1t5oE5-0007ZM-Sm
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:33:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oE5-009M7C-2j
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:33:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oE5-002qQj-2a
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:33: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/pv: Handle #PF correctly when reading the IO permission bitmap
Message-Id: <E1t5oE5-002qQj-2a@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:33:45 +0000

commit 0cfbae3f860db5f1ec842e12b68f942583e9fb2f
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Oct 29 16:27:41 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:27:41 2024 +0100

    x86/pv: Handle #PF correctly when reading the IO permission bitmap
    
    The switch statement in guest_io_okay() is a very expensive way of
    pre-initialising x with ~0, and performing a partial read into it.
    
    However, the logic isn't correct either.
    
    In a real TSS, the CPU always reads two bytes (like here), and any TSS limit
    violation turns silently into no-access.  But, in-limit accesses trigger #PF
    as usual.  AMD document this property explicitly, and while Intel don't (so
    far as I can tell), they do behave consistently with AMD.
    
    Switch from __copy_from_guest_offset() to __copy_from_guest_pv(), like
    everything else in this file.  This removes code generation setting up
    copy_from_user_hvm() (in the likely path even), and safety LFENCEs from
    evaluate_nospec().
    
    Change the logic to raise #PF if __copy_from_guest_pv() fails, rather than
    disallowing the IO port access.  This brings the behaviour better in line with
    normal x86.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 8a6c495d725408d333c1b47bb8af44615a5bfb18
    master date: 2024-10-01 14:58:18 +0100
---
 xen/arch/x86/pv/emul-priv-op.c | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index cc66ffbf8e..e35285d4ab 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -169,29 +169,26 @@ static int guest_io_okay(unsigned int port, unsigned int bytes,
 
     if ( (port + bytes) <= v->arch.pv.iobmp_limit )
     {
-        union { uint8_t bytes[2]; uint16_t mask; } x;
+        const void *__user addr = v->arch.pv.iobmp.p + (port >> 3);
+        uint16_t mask;
+        int rc;
 
-        /*
-         * Grab permission bytes from guest space. Inaccessible bytes are
-         * read as 0xff (no access allowed).
-         */
+        /* Grab permission bytes from guest space. */
         if ( user_mode )
             toggle_guest_pt(v);
 
-        switch ( __copy_from_guest_offset(x.bytes, v->arch.pv.iobmp,
-                                          port>>3, 2) )
-        {
-        default: x.bytes[0] = ~0;
-            /* fallthrough */
-        case 1:  x.bytes[1] = ~0;
-            /* fallthrough */
-        case 0:  break;
-        }
+        rc = __copy_from_guest_pv(&mask, addr, 2);
 
         if ( user_mode )
             toggle_guest_pt(v);
 
-        if ( (x.mask & (((1 << bytes) - 1) << (port & 7))) == 0 )
+        if ( rc )
+        {
+            x86_emul_pagefault(0, (unsigned long)addr + bytes - rc, ctxt);
+            return X86EMUL_EXCEPTION;
+        }
+
+        if ( (mask & (((1 << bytes) - 1) << (port & 7))) == 0 )
             return X86EMUL_OKAY;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:33:57 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:33:57 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827531.1242191 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oEH-0007cj-AU; Tue, 29 Oct 2024 15:33:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827531.1242191; Tue, 29 Oct 2024 15:33: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 1t5oEH-0007cc-7v; Tue, 29 Oct 2024 15:33:57 +0000
Received: by outflank-mailman (input) for mailman id 827531;
 Tue, 29 Oct 2024 15:33: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 1t5oEG-0007cU-0A
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:33:56 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oEF-009M7M-37
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:33:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oEF-002qRl-2v
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:33: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/pv: Rename pv.iobmp_limit to iobmp_nr and clarify behaviour
Message-Id: <E1t5oEF-002qRl-2v@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:33:55 +0000

commit 8321aa3db828c50c1d514938fb86edd161bb5adc
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Oct 29 16:27:54 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:27:54 2024 +0100

    x86/pv: Rename pv.iobmp_limit to iobmp_nr and clarify behaviour
    
    Ever since it's introduction in commit 013351bd7ab3 ("Define new event-channel
    and physdev hypercalls") in 2006, the public interface was named nr_ports
    while the internal field was called iobmp_limit.
    
    Rename the internal field to iobmp_nr to match the public interface, and
    clarify that, when nonzero, Xen will read 2 bytes.
    
    There isn't a perfect parallel with a real TSS, but iobmp_nr being 0 is the
    paravirt "no IOPB" case, and it is important that no read occurs in this case.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 633ee8b2df963f7e5cb8de1219c1a48bfb4447f6
    master date: 2024-10-01 14:58:18 +0100
---
 xen/arch/x86/include/asm/domain.h | 2 +-
 xen/arch/x86/physdev.c            | 2 +-
 xen/arch/x86/pv/emul-priv-op.c    | 6 +++++-
 xen/include/public/physdev.h      | 3 +++
 4 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index 5d92891e6f..21e6ca90d5 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -573,7 +573,7 @@ struct pv_vcpu
 
     /* I/O-port access bitmap. */
     XEN_GUEST_HANDLE(uint8) iobmp; /* Guest kernel vaddr of the bitmap. */
-    unsigned int iobmp_limit; /* Number of ports represented in the bitmap. */
+    unsigned int iobmp_nr;    /* Number of ports represented in the bitmap. */
 #define IOPL(val) MASK_INSR(val, X86_EFLAGS_IOPL)
     unsigned int iopl;        /* Current IOPL for this VCPU, shifted left by
                                * 12 to match the eflags register. */
diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c
index d6dd622952..69fd42667c 100644
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
@@ -436,7 +436,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 #else
         guest_from_compat_handle(curr->arch.pv.iobmp, set_iobitmap.bitmap);
 #endif
-        curr->arch.pv.iobmp_limit = set_iobitmap.nr_ports;
+        curr->arch.pv.iobmp_nr = set_iobitmap.nr_ports;
         break;
     }
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index e35285d4ab..70150c2722 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -167,7 +167,11 @@ static int guest_io_okay(unsigned int port, unsigned int bytes,
     if ( iopl_ok(v, regs) )
         return X86EMUL_OKAY;
 
-    if ( (port + bytes) <= v->arch.pv.iobmp_limit )
+    /*
+     * When @iobmp_nr is non-zero, Xen, like real CPUs and the TSS IOPB,
+     * always reads 2 bytes from @iobmp, which might be one byte @iobmp_nr.
+     */
+    if ( (port + bytes) <= v->arch.pv.iobmp_nr )
     {
         const void *__user addr = v->arch.pv.iobmp.p + (port >> 3);
         uint16_t mask;
diff --git a/xen/include/public/physdev.h b/xen/include/public/physdev.h
index f0c0d4727c..d694104cd8 100644
--- a/xen/include/public/physdev.h
+++ b/xen/include/public/physdev.h
@@ -87,6 +87,9 @@ DEFINE_XEN_GUEST_HANDLE(physdev_set_iopl_t);
 /*
  * Set the current VCPU's I/O-port permissions bitmap.
  * @arg == pointer to physdev_set_iobitmap structure.
+ *
+ * When @nr_ports is non-zero, Xen, like real CPUs and the TSS IOPB, always
+ * reads 2 bytes from @bitmap, which might be one byte beyond @nr_ports.
  */
 #define PHYSDEVOP_set_iobitmap           7
 struct physdev_set_iobitmap {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:34:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:34:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827532.1242195 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oER-0007fU-CV; Tue, 29 Oct 2024 15:34:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827532.1242195; Tue, 29 Oct 2024 15:34: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 1t5oER-0007fM-9P; Tue, 29 Oct 2024 15:34:07 +0000
Received: by outflank-mailman (input) for mailman id 827532;
 Tue, 29 Oct 2024 15:34: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 1t5oEQ-0007f4-3R
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:34:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oEQ-009M7e-0C
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:34:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oEQ-002qSt-04
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:34: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] stubdom: Fix newlib build with GCC-14
Message-Id: <E1t5oEQ-002qSt-04@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:34:06 +0000

commit 8eb2fdbc5bff333c2cdbe31c65d06ac846893185
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Oct 29 16:28:48 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:28:48 2024 +0100

    stubdom: Fix newlib build with GCC-14
    
    Based on a fix from OpenSUSE, but adjusted to be Clang-compatible too.  Pass
    -Wno-implicit-function-declaration library-wide rather than using local GCC
    pragmas.
    
    Fix of copy_past_newline() to avoid triggering -Wstrict-prototypes.
    
    Link: https://build.opensuse.org/request/show/1178775
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: 444cb9350f2c1cc202b6b86176ddd8e57525e2d9
    master date: 2024-10-03 10:07:25 +0100
---
 stubdom/Makefile                           |  2 ++
 stubdom/newlib-fix-copy_past_newline.patch | 10 ++++++++++
 2 files changed, 12 insertions(+)

diff --git a/stubdom/Makefile b/stubdom/Makefile
index 8c503c2bf8..f8c31fd35d 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -97,10 +97,12 @@ newlib-$(NEWLIB_VERSION): newlib-$(NEWLIB_VERSION).tar.gz
 	patch -d $@ -p1 < newlib-disable-texinfo.patch
 	patch -d $@ -p1 < newlib-cygmon-gmon.patch
 	patch -d $@ -p1 < newlib-makedoc.patch
+	patch -d $@ -p1 < newlib-fix-copy_past_newline.patch
 	find $@ -type f | xargs perl -i.bak \
 		-pe 's/\b_(tzname|daylight|timezone)\b/$$1/g'
 	touch $@
 
+NEWLIB_CFLAGS += -Wno-implicit-function-declaration
 NEWLIB_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libc.a
 .PHONY: cross-newlib
 cross-newlib: $(NEWLIB_STAMPFILE)
diff --git a/stubdom/newlib-fix-copy_past_newline.patch b/stubdom/newlib-fix-copy_past_newline.patch
new file mode 100644
index 0000000000..f8452480bc
--- /dev/null
+++ b/stubdom/newlib-fix-copy_past_newline.patch
@@ -0,0 +1,10 @@
+--- newlib-1.16.0/newlib/doc/makedoc.c.orig
++++ newlib-1.16.0/newlib/doc/makedoc.c
+@@ -798,6 +798,7 @@ DEFUN( iscommand,(ptr, idx),
+ }
+
+
++static unsigned int
+ DEFUN(copy_past_newline,(ptr, idx, dst),
+       string_type *ptr AND
+       unsigned int idx AND
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:34:17 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:34:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827533.1242199 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oEb-0007hr-Da; Tue, 29 Oct 2024 15:34:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827533.1242199; Tue, 29 Oct 2024 15:34: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 1t5oEb-0007hi-Av; Tue, 29 Oct 2024 15:34:17 +0000
Received: by outflank-mailman (input) for mailman id 827533;
 Tue, 29 Oct 2024 15:34: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 1t5oEa-0007hX-6j
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:34:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oEa-009M83-0V
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:34:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oEa-002qTx-0O
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:34: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/dpci: do not leak pending interrupts on CPU offline
Message-Id: <E1t5oEa-002qTx-0O@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:34:16 +0000

commit 8ebd6b066d17b585876c761cee298d1e3384079b
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Oct 29 16:29:12 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:29:12 2024 +0100

    x86/dpci: do not leak pending interrupts on CPU offline
    
    The current dpci logic relies on a softirq being executed as a side effect of
    the cpu_notifier_call_chain() call in the code path that offlines the target
    CPU.  However the call to cpu_notifier_call_chain() won't trigger any softirq
    processing, and even if it did, such processing should be done after all
    interrupts have been migrated off the current CPU, otherwise new pending dpci
    interrupts could still appear.
    
    Currently the ASSERT() in the cpu callback notifier is fairly easy to trigger
    by doing CPU offline from a PVH dom0.
    
    Solve this by instead moving out any dpci interrupts pending processing once
    the CPU is dead.  This might introduce more latency than attempting to drain
    before the CPU is put offline, but it's less complex, and CPU online/offline is
    not a common action.  Any extra introduced latency should be tolerable.
    
    Fixes: f6dd295381f4 ('dpci: replace tasklet with softirq')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 29555668b5725b9d5393b72bfe7ff9a3fa606714
    master date: 2024-10-07 11:10:21 +0200
---
 xen/drivers/passthrough/x86/hvm.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index d3627e4af7..f5faff7a49 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -1105,23 +1105,27 @@ static int cf_check cpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;
+    unsigned long flags;
 
     switch ( action )
     {
     case CPU_UP_PREPARE:
         INIT_LIST_HEAD(&per_cpu(dpci_list, cpu));
         break;
+
     case CPU_UP_CANCELED:
-    case CPU_DEAD:
-        /*
-         * On CPU_DYING this callback is called (on the CPU that is dying)
-         * with an possible HVM_DPIC_SOFTIRQ pending - at which point we can
-         * clear out any outstanding domains (by the virtue of the idle loop
-         * calling the softirq later). In CPU_DEAD case the CPU is deaf and
-         * there are no pending softirqs for us to handle so we can chill.
-         */
         ASSERT(list_empty(&per_cpu(dpci_list, cpu)));
         break;
+
+    case CPU_DEAD:
+        if ( list_empty(&per_cpu(dpci_list, cpu)) )
+            break;
+        /* Take whatever dpci interrupts are pending on the dead CPU. */
+        local_irq_save(flags);
+        list_splice_init(&per_cpu(dpci_list, cpu), &this_cpu(dpci_list));
+        local_irq_restore(flags);
+        raise_softirq(HVM_DPCI_SOFTIRQ);
+        break;
     }
 
     return NOTIFY_DONE;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:34:27 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:34:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827534.1242203 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oEl-0007kh-F3; Tue, 29 Oct 2024 15:34:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827534.1242203; Tue, 29 Oct 2024 15:34: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 1t5oEl-0007kZ-CO; Tue, 29 Oct 2024 15:34:27 +0000
Received: by outflank-mailman (input) for mailman id 827534;
 Tue, 29 Oct 2024 15:34: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 1t5oEk-0007kP-9L
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:34:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oEk-009M8A-0o
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:34:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oEk-002qUV-0g
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:34: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] ioreq: don't wrongly claim "success" in ioreq_send_buffered()
Message-Id: <E1t5oEk-002qUV-0g@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:34:26 +0000

commit d15e9fa3c880d0d2e0a3c19f0fa09ddac01e0ff9
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Oct 29 16:29:47 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:29:47 2024 +0100

    ioreq: don't wrongly claim "success" in ioreq_send_buffered()
    
    Returning a literal number is a bad idea anyway when all other returns
    use IOREQ_STATUS_* values. The function is dead on Arm, and mapping to
    X86EMUL_OKAY is surely wrong on x86.
    
    Fixes: f6bf39f84f82 ("x86/hvm: add support for broadcast of buffered ioreqs...")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: 2e0b545b847df7d4feb07308d50bad708bd35a66
    master date: 2024-10-08 14:36:27 +0200
---
 xen/common/ioreq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/common/ioreq.c b/xen/common/ioreq.c
index 1257a3d972..f5fd30ce12 100644
--- a/xen/common/ioreq.c
+++ b/xen/common/ioreq.c
@@ -1175,7 +1175,7 @@ static int ioreq_send_buffered(struct ioreq_server *s, ioreq_t *p)
         return IOREQ_STATUS_UNHANDLED;
 
     /*
-     * Return 0 for the cases we can't deal with:
+     * Return UNHANDLED for the cases we can't deal with:
      *  - 'addr' is only a 20-bit field, so we cannot address beyond 1MB
      *  - we cannot buffer accesses to guest memory buffers, as the guest
      *    may expect the memory buffer to be synchronously accessed
@@ -1183,7 +1183,7 @@ static int ioreq_send_buffered(struct ioreq_server *s, ioreq_t *p)
      *    support data_is_ptr we do not waste space for the count field either
      */
     if ( (p->addr > 0xfffffUL) || p->data_is_ptr || (p->count != 1) )
-        return 0;
+        return IOREQ_STATUS_UNHANDLED;
 
     switch ( p->size )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:34:37 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:34:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827535.1242207 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oEv-0007nG-GJ; Tue, 29 Oct 2024 15:34:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827535.1242207; Tue, 29 Oct 2024 15:34: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 1t5oEv-0007n9-Dp; Tue, 29 Oct 2024 15:34:37 +0000
Received: by outflank-mailman (input) for mailman id 827535;
 Tue, 29 Oct 2024 15:34: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 1t5oEu-0007mz-Cm
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:34:36 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oEu-009M8J-19
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:34:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oEu-002qVN-0z
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:34: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/domctl: fix maximum number of MSRs in XEN_DOMCTL_{get,set}_vcpu_msrs
Message-Id: <E1t5oEu-002qVN-0z@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:34:36 +0000

commit 05292f914f388868f54429f6feeab8c9b0a1b57d
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Oct 29 16:30:04 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:30:04 2024 +0100

    x86/domctl: fix maximum number of MSRs in XEN_DOMCTL_{get,set}_vcpu_msrs
    
    Since the addition of the MSR_AMD64_DR{1-4}_ADDRESS_MASK MSRs to the
    msrs_to_send array, the calculations for the maximum number of MSRs that
    the hypercall can handle is off by 4.
    
    Remove the addition of 4 to the maximum number of MSRs that
    XEN_DOMCTL_{set,get}_vcpu_msrs supports, as those are already part of the
    array.
    
    A further adjustment could be to subtract 4 from the maximum size if the DBEXT
    CPUID feature is not exposed to the guest, but guest_{rd,wr}msr() will already
    perform that check when fetching or loading the MSRs.  The maximum array is
    used to indicate the caller of the buffer it needs to allocate in the get case,
    and as an early input sanitation in the set case, using a buffer size slightly
    lager than required is not an issue.
    
    Fixes: 86d47adcd3c4 ('x86/msr: Handle MSR_AMD64_DR{0-3}_ADDRESS_MASK in the new MSR infrastructure')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: c95cd5f9c5a8c1c6ab1b0b366d829fa8561958fd
    master date: 2024-10-08 14:37:53 +0200
---
 xen/arch/x86/domctl.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 9190e11faa..8066f28e9d 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1055,10 +1055,6 @@ long arch_do_domctl(
              !is_pv_domain(d) )
             break;
 
-        /* Count maximum number of optional msrs. */
-        if ( boot_cpu_has(X86_FEATURE_DBEXT) )
-            nr_msrs += 4;
-
         if ( domctl->cmd == XEN_DOMCTL_get_vcpu_msrs )
         {
             ret = 0; copyback = true;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:34:48 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:34:48 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827536.1242211 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oF6-0007qO-I9; Tue, 29 Oct 2024 15:34:48 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827536.1242211; Tue, 29 Oct 2024 15:34:48 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oF6-0007q6-FO; Tue, 29 Oct 2024 15:34:48 +0000
Received: by outflank-mailman (input) for mailman id 827536;
 Tue, 29 Oct 2024 15:34: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 1t5oF4-0007pY-Gd
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:34:46 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oF4-009M8S-1X
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:34:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oF4-002qVv-1L
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:34: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] xen/spinlock: Fix UBSAN "load of address with insufficient space" in lock_prof_init()
Message-Id: <E1t5oF4-002qVv-1L@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:34:46 +0000

commit a756c242ea32d3285d5582bc9aca030bafd24f31
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Oct 29 16:30:41 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:30:41 2024 +0100

    xen/spinlock: Fix UBSAN "load of address with insufficient space" in lock_prof_init()
    
    UBSAN complains:
    
      (XEN) ================================================================================
      (XEN) UBSAN: Undefined behaviour in common/spinlock.c:794:10
      (XEN) load of address ffff82d040ae24c8 with insufficient space
      (XEN) for an object of type 'struct lock_profile *'
      (XEN) ----[ Xen-4.20-unstable  x86_64  debug=y ubsan=y  Tainted:   C    ]----
    
    This shows up with GCC-14, but not with GCC-12.  I have not bisected further.
    
    Either way, the types for __lock_profile_{start,end} are incorrect.
    
    They are an array of struct lock_profile pointers.  Correct the extern's
    types, and adjust the loop to match.
    
    No practical change.
    
    Reported-by: Andreas Glashauser <ag@andreasglashauser.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    master commit: 542ac112fc68c66cfafc577e252404c21da4f75b
    master date: 2024-10-14 16:14:26 +0100
---
 xen/common/spinlock.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
index 28c6e9d3ac..e672b1041c 100644
--- a/xen/common/spinlock.c
+++ b/xen/common/spinlock.c
@@ -607,9 +607,6 @@ struct lock_profile_anc {
 typedef void lock_profile_subfunc(struct lock_profile *data, int32_t type,
     int32_t idx, void *par);
 
-extern struct lock_profile *__lock_profile_start;
-extern struct lock_profile *__lock_profile_end;
-
 static s_time_t lock_profile_start;
 static struct lock_profile_anc lock_profile_ancs[] = {
     [LOCKPROF_TYPE_GLOBAL] = { .name = "Global" },
@@ -779,13 +776,16 @@ void _lock_profile_deregister_struct(
     spin_unlock(&lock_profile_lock);
 }
 
+extern struct lock_profile *__lock_profile_start[];
+extern struct lock_profile *__lock_profile_end[];
+
 static int __init cf_check lock_prof_init(void)
 {
     struct lock_profile **q;
 
     BUILD_BUG_ON(ARRAY_SIZE(lock_profile_ancs) != LOCKPROF_TYPE_N);
 
-    for ( q = &__lock_profile_start; q < &__lock_profile_end; q++ )
+    for ( q = __lock_profile_start; q < __lock_profile_end; q++ )
     {
         (*q)->next = lock_profile_glb_q.elem_q;
         lock_profile_glb_q.elem_q = *q;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:34:58 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:34:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827537.1242215 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oFG-0007tu-Jg; Tue, 29 Oct 2024 15:34:58 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827537.1242215; Tue, 29 Oct 2024 15:34:58 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oFG-0007tm-Gq; Tue, 29 Oct 2024 15:34:58 +0000
Received: by outflank-mailman (input) for mailman id 827537;
 Tue, 29 Oct 2024 15:34: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 1t5oFE-0007tX-Jf
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:34:56 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oFE-009M8e-1p
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:34:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oFE-002qWo-1i
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:34: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] iommu/amd-vi: do not error if device referenced in IVMD is not behind any IOMMU
Message-Id: <E1t5oFE-002qWo-1i@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:34:56 +0000

commit eec09073ad1d941669836a94e072cc895d3b560a
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Oct 29 16:30:51 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:30:51 2024 +0100

    iommu/amd-vi: do not error if device referenced in IVMD is not behind any IOMMU
    
    IVMD table contains restrictions about memory which must be mandatory assigned
    to devices (and which permissions it should use), or memory that should be
    never accessible to devices.
    
    Some hardware however contains ranges in IVMD that reference devices outside of
    the IVHD tables (in other words, devices not behind any IOMMU).  Such mismatch
    will cause Xen to fail in register_range_for_device(), ultimately leading to
    the IOMMU being disabled, and Xen crashing as x2APIC support might be already
    enabled and relying on the IOMMU functionality.
    
    Relax IVMD parsing: allow IVMD blocks to reference devices not assigned to any
    IOMMU.  It's impossible for Xen to fulfill the requirement in the IVMD block if
    the device is not behind any IOMMU, but it's no worse than booting without
    IOMMU support, and thus not parsing ACPI IVRS in the first place.
    
    Reported-by: Willi Junga <xenproject@ymy.be>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2defb544900a11f93104ac68d2f8beba89d4bd02
    master date: 2024-10-15 14:23:59 +0200
---
 xen/drivers/passthrough/amd/iommu_acpi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu_acpi.c b/xen/drivers/passthrough/amd/iommu_acpi.c
index 3f5508eba0..c416120326 100644
--- a/xen/drivers/passthrough/amd/iommu_acpi.c
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c
@@ -248,8 +248,9 @@ static int __init register_range_for_device(
     iommu = find_iommu_for_device(seg, bdf);
     if ( !iommu )
     {
-        AMD_IOMMU_ERROR("IVMD: no IOMMU for Dev_Id %#x\n", bdf);
-        return -ENODEV;
+        AMD_IOMMU_WARN("IVMD: no IOMMU for device %pp - ignoring constrain\n",
+                       &PCI_SBDF(seg, bdf));
+        return 0;
     }
     req = ivrs_mappings[bdf].dte_requestor_id;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:35:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:35:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827538.1242220 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oFQ-0007wS-Lc; Tue, 29 Oct 2024 15:35:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827538.1242220; Tue, 29 Oct 2024 15:35:08 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oFQ-0007wJ-II; Tue, 29 Oct 2024 15:35:08 +0000
Received: by outflank-mailman (input) for mailman id 827538;
 Tue, 29 Oct 2024 15:35: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 1t5oFO-0007w8-Mx
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:35:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oFO-009M8w-2A
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:35:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oFO-002qXr-21
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:35: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/boot: Fix microcode module handling during PVH boot
Message-Id: <E1t5oFO-002qXr-21@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:35:06 +0000

commit 8e157210c022a8ec061a1cec44ac255961e6739e
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Tue Oct 29 16:31:25 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:31:25 2024 +0100

    x86/boot: Fix microcode module handling during PVH boot
    
    As detailed in commit 0fe607b2a144 ("x86/boot: Fix PVH boot during boot_info
    transition period"), the use of __va(mbi->mods_addr) constitutes a
    use-after-free on the PVH boot path.
    
    This pattern has been in use since before PVH support was added.  Inside a PVH
    VM, it will go unnoticed as long as the microcode container parser doesn't
    choke on the random data it finds.
    
    The use within early_microcode_init() happens to be safe because it's prior to
    move_xen().  microcode_init_cache() is after move_xen(), and therefore unsafe.
    
    Plumb the boot_info pointer down, replacing module_map and mbi.  Importantly,
    bi->mods[].mod is a safe way to access the module list during PVH boot.
    
    Note: microcode_scan_module() is still bogusly stashing a bootstrap_map()'d
          pointer in ucode_blob.data, which constitutes a different
          use-after-free, and only works in general because of a second bug.  This
          is unrelated to PVH, and needs untangling differently.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 8ddf63a252a6eae6e619ba2df9ad6b6f82e660c1
    master date: 2024-10-23 18:14:24 +0100
---
 xen/arch/x86/cpu/microcode/core.c    | 21 +++++++++++----------
 xen/arch/x86/include/asm/microcode.h |  7 +++++--
 xen/arch/x86/setup.c                 |  4 ++--
 3 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index e90055772a..655bc41e07 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -151,9 +151,9 @@ custom_param("ucode", parse_ucode);
 
 static void __init microcode_scan_module(
     unsigned long *module_map,
-    const multiboot_info_t *mbi)
+    const multiboot_info_t *mbi,
+    const module_t mod[])
 {
-    module_t *mod = (module_t *)__va(mbi->mods_addr);
     uint64_t *_blob_start;
     unsigned long _blob_size;
     struct cpio_data cd;
@@ -203,10 +203,9 @@ static void __init microcode_scan_module(
 
 static void __init microcode_grab_module(
     unsigned long *module_map,
-    const multiboot_info_t *mbi)
+    const multiboot_info_t *mbi,
+    const module_t mod[])
 {
-    module_t *mod = (module_t *)__va(mbi->mods_addr);
-
     if ( ucode_mod_idx < 0 )
         ucode_mod_idx += mbi->mods_count;
     if ( ucode_mod_idx <= 0 || ucode_mod_idx >= mbi->mods_count ||
@@ -215,7 +214,7 @@ static void __init microcode_grab_module(
     ucode_mod = mod[ucode_mod_idx];
 scan:
     if ( ucode_scan )
-        microcode_scan_module(module_map, mbi);
+        microcode_scan_module(module_map, mbi, mod);
 }
 
 static struct microcode_ops __ro_after_init ucode_ops;
@@ -801,7 +800,8 @@ static int __init early_update_cache(const void *data, size_t len)
 }
 
 int __init microcode_init_cache(unsigned long *module_map,
-                                const struct multiboot_info *mbi)
+                                const struct multiboot_info *mbi,
+                                const module_t mods[])
 {
     int rc = 0;
 
@@ -810,7 +810,7 @@ int __init microcode_init_cache(unsigned long *module_map,
 
     if ( ucode_scan )
         /* Need to rescan the modules because they might have been relocated */
-        microcode_scan_module(module_map, mbi);
+        microcode_scan_module(module_map, mbi, mods);
 
     if ( ucode_mod.mod_end )
         rc = early_update_cache(bootstrap_map(&ucode_mod),
@@ -857,7 +857,8 @@ static int __init early_microcode_update_cpu(void)
 }
 
 int __init early_microcode_init(unsigned long *module_map,
-                                const struct multiboot_info *mbi)
+                                const struct multiboot_info *mbi,
+                                const module_t mods[])
 {
     const struct cpuinfo_x86 *c = &boot_cpu_data;
     int rc = 0;
@@ -900,7 +901,7 @@ int __init early_microcode_init(unsigned long *module_map,
         return -ENODEV;
     }
 
-    microcode_grab_module(module_map, mbi);
+    microcode_grab_module(module_map, mbi, mods);
 
     if ( ucode_mod.mod_end || ucode_blob.size )
         rc = early_microcode_update_cpu();
diff --git a/xen/arch/x86/include/asm/microcode.h b/xen/arch/x86/include/asm/microcode.h
index 8f59b20b02..1c9a4aa7d7 100644
--- a/xen/arch/x86/include/asm/microcode.h
+++ b/xen/arch/x86/include/asm/microcode.h
@@ -3,6 +3,7 @@
 
 #include <xen/types.h>
 #include <xen/percpu.h>
+#include <xen/multiboot.h>
 
 #include <public/xen.h>
 
@@ -24,9 +25,11 @@ 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 early_microcode_init(unsigned long *module_map,
-                         const struct multiboot_info *mbi);
+                         const struct multiboot_info *mbi,
+                         const module_t mods[]);
 int microcode_init_cache(unsigned long *module_map,
-                         const struct multiboot_info *mbi);
+                         const struct multiboot_info *mbi,
+                         const module_t mods[]);
 int microcode_update_one(void);
 
 #endif /* ASM_X86__MICROCODE_H */
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index f1076c7203..9e5e871b31 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1322,7 +1322,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
      * TODO: load ucode earlier once multiboot modules become accessible
      * at an earlier stage.
      */
-    early_microcode_init(module_map, mbi);
+    early_microcode_init(module_map, mbi, mod);
 
     if ( xen_phys_start )
     {
@@ -1866,7 +1866,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
 
     timer_init();
 
-    microcode_init_cache(module_map, mbi); /* Needs xmalloc() */
+    microcode_init_cache(module_map, mbi, mod); /* Needs xmalloc() */
 
     tsx_init(); /* Needs microcode.  May change HLE/RTM feature bits. */
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:35:18 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:35:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827539.1242223 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oFa-000800-ON; Tue, 29 Oct 2024 15:35:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827539.1242223; Tue, 29 Oct 2024 15:35:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oFa-0007zs-LW; Tue, 29 Oct 2024 15:35:18 +0000
Received: by outflank-mailman (input) for mailman id 827539;
 Tue, 29 Oct 2024 15:35: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 1t5oFY-0007zF-QO
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:35:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oFY-009M9Q-2W
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:35:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oFY-002qYf-2M
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:35: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.19] x86/boot: Fix XSM module handling during PVH boot
Message-Id: <E1t5oFY-002qYf-2M@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:35:16 +0000

commit fadbc7e32e42f1a4199b854a895744f026803320
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Tue Oct 29 16:31:38 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:31:38 2024 +0100

    x86/boot: Fix XSM module handling during PVH boot
    
    As detailed in commit 0fe607b2a144 ("x86/boot: Fix PVH boot during boot_info
    transition period"), the use of __va(mbi->mods_addr) constitutes a
    use-after-free on the PVH boot path.
    
    This pattern has been in use since before PVH support was added.  This has
    most likely gone unnoticed because no-one's tried using a detached Flask
    policy in a PVH VM before.
    
    Plumb the boot_info pointer down, replacing module_map and mbi.  Importantly,
    bi->mods[].mod is a safe way to access the module list during PVH boot.
    
    As this is the final non-bi use of mbi in __start_xen(), make the pointer
    unusable once bi has been established, to prevent new uses creeping back in.
    This is a stopgap until mbi can be fully removed.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 6cf0aaeb8df951fb34679f0408461a5c67cb02c6
    master date: 2024-10-23 18:14:24 +0100
---
 xen/arch/x86/setup.c  | 2 +-
 xen/include/xsm/xsm.h | 7 +++++--
 xen/xsm/xsm_core.c    | 7 ++++---
 xen/xsm/xsm_policy.c  | 2 +-
 4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 9e5e871b31..89482140cf 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1792,7 +1792,7 @@ void asmlinkage __init noreturn __start_xen(unsigned long mbi_p)
     mmio_ro_ranges = rangeset_new(NULL, "r/o mmio ranges",
                                   RANGESETF_prettyprint_hex);
 
-    xsm_multiboot_init(module_map, mbi);
+    xsm_multiboot_init(module_map, mbi, mod);
 
     /*
      * IOMMU-related ACPI table parsing may require some of the system domains
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 627c0d2731..5867ccceaf 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -779,9 +779,11 @@ static inline int xsm_argo_send(const struct domain *d, const struct domain *t)
 
 #ifdef CONFIG_MULTIBOOT
 int xsm_multiboot_init(
-    unsigned long *module_map, const multiboot_info_t *mbi);
+    unsigned long *module_map, const multiboot_info_t *mbi,
+    const module_t mods[]);
 int xsm_multiboot_policy_init(
     unsigned long *module_map, const multiboot_info_t *mbi,
+    const module_t mods[],
     void **policy_buffer, size_t *policy_size);
 #endif
 
@@ -829,7 +831,8 @@ static const inline struct xsm_ops *silo_init(void)
 
 #ifdef CONFIG_MULTIBOOT
 static inline int xsm_multiboot_init (
-    unsigned long *module_map, const multiboot_info_t *mbi)
+    unsigned long *module_map, const multiboot_info_t *mbi,
+    const module_t mods[])
 {
     return 0;
 }
diff --git a/xen/xsm/xsm_core.c b/xen/xsm/xsm_core.c
index eaa028109b..82b0d76d40 100644
--- a/xen/xsm/xsm_core.c
+++ b/xen/xsm/xsm_core.c
@@ -140,7 +140,8 @@ static int __init xsm_core_init(const void *policy_buffer, size_t policy_size)
 
 #ifdef CONFIG_MULTIBOOT
 int __init xsm_multiboot_init(
-    unsigned long *module_map, const multiboot_info_t *mbi)
+    unsigned long *module_map, const multiboot_info_t *mbi,
+    const module_t mods[])
 {
     int ret = 0;
     void *policy_buffer = NULL;
@@ -150,8 +151,8 @@ int __init xsm_multiboot_init(
 
     if ( XSM_MAGIC )
     {
-        ret = xsm_multiboot_policy_init(module_map, mbi, &policy_buffer,
-                                        &policy_size);
+        ret = xsm_multiboot_policy_init(module_map, mbi, mods,
+                                        &policy_buffer, &policy_size);
         if ( ret )
         {
             bootstrap_map(NULL);
diff --git a/xen/xsm/xsm_policy.c b/xen/xsm/xsm_policy.c
index 8dafbc9381..9244a3612d 100644
--- a/xen/xsm/xsm_policy.c
+++ b/xen/xsm/xsm_policy.c
@@ -32,10 +32,10 @@
 #ifdef CONFIG_MULTIBOOT
 int __init xsm_multiboot_policy_init(
     unsigned long *module_map, const multiboot_info_t *mbi,
+    const module_t mod[],
     void **policy_buffer, size_t *policy_size)
 {
     int i;
-    module_t *mod = (module_t *)__va(mbi->mods_addr);
     int rc = 0;
     u32 *_policy_start;
     unsigned long _policy_len;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.19


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:44:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:44:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827541.1242227 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oO6-00016k-CX; Tue, 29 Oct 2024 15:44:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827541.1242227; Tue, 29 Oct 2024 15:44: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 1t5oO6-000169-9Z; Tue, 29 Oct 2024 15:44:06 +0000
Received: by outflank-mailman (input) for mailman id 827541;
 Tue, 29 Oct 2024 15:44: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 1t5oO5-000163-By
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:44:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oO5-009MJD-0u
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oO5-002rNv-0V
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:44: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] xen/ucode: Make Intel's microcode_sanity_check() stricter
Message-Id: <E1t5oO5-002rNv-0V@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:44:05 +0000

commit a897560155a58b36bec721eb3b994a62a0432996
Author:     Demi Marie Obenour <demi@invisiblethingslab.com>
AuthorDate: Tue Oct 29 16:35:52 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:35:52 2024 +0100

    xen/ucode: Make Intel's microcode_sanity_check() stricter
    
    The SDM states that data size must be a multiple of 4, but Xen doesn't check
    this propery.
    
    This is liable to cause a later failures, but should be checked explicitly.
    
    Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 8752ad83e79754f8109457cff796e5f86f644348
    master date: 2024-09-24 18:57:38 +0100
---
 xen/arch/x86/cpu/microcode/intel.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/intel.c b/xen/arch/x86/cpu/microcode/intel.c
index a2d88e3ac0..bd15236709 100644
--- a/xen/arch/x86/cpu/microcode/intel.c
+++ b/xen/arch/x86/cpu/microcode/intel.c
@@ -155,10 +155,13 @@ static int microcode_sanity_check(const struct microcode_patch *patch)
     uint32_t sum;
 
     /*
-     * Total size must be a multiple of 1024 bytes.  Data size and the header
-     * must fit within it.
+     * The SDM states:
+     * - Data size must be a multiple of 4.
+     * - Total size must be a multiple of 1024 bytes.  Data size and the
+     *   header must fit within it.
      */
     if ( (total_size & 1023) ||
+         (data_size & 3) ||
          data_size > (total_size - MC_HEADER_SIZE) )
     {
         printk(XENLOG_WARNING "microcode: Bad size\n");
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:44:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827542.1242230 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oOG-00018k-Df; Tue, 29 Oct 2024 15:44:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827542.1242230; Tue, 29 Oct 2024 15:44: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 1t5oOG-00018a-Ay; Tue, 29 Oct 2024 15:44:16 +0000
Received: by outflank-mailman (input) for mailman id 827542;
 Tue, 29 Oct 2024 15:44: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 1t5oOF-00018Q-FL
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:44:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oOF-009MJb-1P
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oOF-002rP0-16
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:44: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/PV: simplify (and thus correct) guest accessor functions
Message-Id: <E1t5oOF-002rP0-16@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:44:15 +0000

commit 0902958b51a6135ce43bee2c9eadd43f481e311d
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Oct 29 16:37:12 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:37:12 2024 +0100

    x86/PV: simplify (and thus correct) guest accessor functions
    
    Taking a fault on a non-byte-granular insn means that the "number of
    bytes not handled" return value would need extra care in calculating, if
    we want callers to be able to derive e.g. exception context (to be
    injected to the guest) - CR2 for #PF in particular - from the value. To
    simplify things rather than complicating them, reduce inline assembly to
    just byte-granular string insns. On recent CPUs that's also supposed to
    be more efficient anyway.
    
    For singular element accessors, however, alignment checks are added,
    hence slightly complicating the code. Misaligned (user) buffer accesses
    will now be forwarded to copy_{from,to}_guest_ll().
    
    Naturally copy_{from,to}_unsafe_ll() accessors end up being adjusted the
    same way, as they're produced by mere re-processing of the same code.
    Otoh copy_{from,to}_unsafe() aren't similarly adjusted, but have their
    comments made match reality; down the road we may want to change their
    return types, e.g. to bool.
    
    Fixes: 76974398a63c ("Added user-memory accessing functionality for x86_64")
    Fixes: 7b8c36701d26 ("Introduce clear_user and clear_guest")
    Reported-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Tested-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 67a8e5721e1ea9c28526883036bf08fb2e8a8c9c
    master date: 2024-10-01 09:44:55 +0200
---
 xen/arch/x86/include/asm/uaccess.h | 12 +++----
 xen/arch/x86/usercopy.c            | 66 +++++---------------------------------
 2 files changed, 14 insertions(+), 64 deletions(-)

diff --git a/xen/arch/x86/include/asm/uaccess.h b/xen/arch/x86/include/asm/uaccess.h
index 74bb222c03..633eb79797 100644
--- a/xen/arch/x86/include/asm/uaccess.h
+++ b/xen/arch/x86/include/asm/uaccess.h
@@ -251,7 +251,8 @@ do {                                                                       \
 static always_inline unsigned long
 __copy_to_guest_pv(void __user *to, const void *from, unsigned long n)
 {
-    if (__builtin_constant_p(n)) {
+    if ( __builtin_constant_p(n) && !((unsigned long)to & (n - 1)) )
+    {
         unsigned long ret;
 
         switch (n) {
@@ -291,7 +292,8 @@ __copy_to_guest_pv(void __user *to, const void *from, unsigned long n)
 static always_inline unsigned long
 __copy_from_guest_pv(void *to, const void __user *from, unsigned long n)
 {
-    if (__builtin_constant_p(n)) {
+    if ( __builtin_constant_p(n) && !((unsigned long)from & (n - 1)) )
+    {
         unsigned long ret;
 
         switch (n) {
@@ -321,8 +323,7 @@ __copy_from_guest_pv(void *to, const void __user *from, unsigned long n)
  *
  * Copy data from hypervisor space to a potentially unmapped area.
  *
- * Returns number of bytes that could not be copied.
- * On success, this will be zero.
+ * Returns zero on success and non-zero if some bytes could not be copied.
  */
 static always_inline unsigned int
 copy_to_unsafe(void __user *to, const void *from, unsigned int n)
@@ -358,8 +359,7 @@ copy_to_unsafe(void __user *to, const void *from, unsigned int n)
  *
  * Copy data from a potentially unmapped area space to hypervisor space.
  *
- * Returns number of bytes that could not be copied.
- * On success, this will be zero.
+ * Returns zero on success and non-zero if some bytes could not be copied.
  *
  * If some data could not be copied, this function will pad the copied
  * data to the requested size using zero bytes.
diff --git a/xen/arch/x86/usercopy.c b/xen/arch/x86/usercopy.c
index b8c2d1cc0b..7ab2009efe 100644
--- a/xen/arch/x86/usercopy.c
+++ b/xen/arch/x86/usercopy.c
@@ -16,42 +16,19 @@
 
 unsigned int copy_to_guest_ll(void __user *to, const void *from, unsigned int n)
 {
-    unsigned dummy;
+    GUARD(unsigned dummy);
 
     stac();
     asm volatile (
         GUARD(
         "    guest_access_mask_ptr %[to], %q[scratch1], %q[scratch2]\n"
         )
-        "    cmp  $"STR(2*BYTES_PER_LONG-1)", %[cnt]\n"
-        "    jbe  1f\n"
-        "    mov  %k[to], %[cnt]\n"
-        "    neg  %[cnt]\n"
-        "    and  $"STR(BYTES_PER_LONG-1)", %[cnt]\n"
-        "    sub  %[cnt], %[aux]\n"
-        "4:  rep movsb\n" /* make 'to' address aligned */
-        "    mov  %[aux], %[cnt]\n"
-        "    shr  $"STR(LONG_BYTEORDER)", %[cnt]\n"
-        "    and  $"STR(BYTES_PER_LONG-1)", %[aux]\n"
-        "    .align 2,0x90\n"
-        "0:  rep movs"__OS"\n" /* as many words as possible... */
-        "    mov  %[aux],%[cnt]\n"
-        "1:  rep movsb\n" /* ...remainder copied as bytes */
+        "1:  rep movsb\n"
         "2:\n"
-        ".section .fixup,\"ax\"\n"
-        "5:  add %[aux], %[cnt]\n"
-        "    jmp 2b\n"
-        "3:  lea (%q[aux], %q[cnt], "STR(BYTES_PER_LONG)"), %[cnt]\n"
-        "    jmp 2b\n"
-        ".previous\n"
-        _ASM_EXTABLE(4b, 5b)
-        _ASM_EXTABLE(0b, 3b)
         _ASM_EXTABLE(1b, 2b)
-        : [cnt] "+c" (n), [to] "+D" (to), [from] "+S" (from),
-          [aux] "=&r" (dummy)
+        : [cnt] "+c" (n), [to] "+D" (to), [from] "+S" (from)
           GUARD(, [scratch1] "=&r" (dummy), [scratch2] "=&r" (dummy))
-        : "[aux]" (n)
-        : "memory" );
+        :: "memory" );
     clac();
 
     return n;
@@ -66,25 +43,9 @@ unsigned int copy_from_guest_ll(void *to, const void __user *from, unsigned int
         GUARD(
         "    guest_access_mask_ptr %[from], %q[scratch1], %q[scratch2]\n"
         )
-        "    cmp  $"STR(2*BYTES_PER_LONG-1)", %[cnt]\n"
-        "    jbe  1f\n"
-        "    mov  %k[to], %[cnt]\n"
-        "    neg  %[cnt]\n"
-        "    and  $"STR(BYTES_PER_LONG-1)", %[cnt]\n"
-        "    sub  %[cnt], %[aux]\n"
-        "4:  rep movsb\n" /* make 'to' address aligned */
-        "    mov  %[aux],%[cnt]\n"
-        "    shr  $"STR(LONG_BYTEORDER)", %[cnt]\n"
-        "    and  $"STR(BYTES_PER_LONG-1)", %[aux]\n"
-        "    .align 2,0x90\n"
-        "0:  rep movs"__OS"\n" /* as many words as possible... */
-        "    mov  %[aux], %[cnt]\n"
-        "1:  rep movsb\n" /* ...remainder copied as bytes */
+        "1:  rep movsb\n"
         "2:\n"
         ".section .fixup,\"ax\"\n"
-        "5:  add  %[aux], %[cnt]\n"
-        "    jmp 6f\n"
-        "3:  lea  (%q[aux], %q[cnt], "STR(BYTES_PER_LONG)"), %[cnt]\n"
         "6:  mov  %[cnt], %k[from]\n"
         "    xchg %%eax, %[aux]\n"
         "    xor  %%eax, %%eax\n"
@@ -93,14 +54,11 @@ unsigned int copy_from_guest_ll(void *to, const void __user *from, unsigned int
         "    mov  %k[from], %[cnt]\n"
         "    jmp 2b\n"
         ".previous\n"
-        _ASM_EXTABLE(4b, 5b)
-        _ASM_EXTABLE(0b, 3b)
         _ASM_EXTABLE(1b, 6b)
         : [cnt] "+c" (n), [to] "+D" (to), [from] "+S" (from),
           [aux] "=&r" (dummy)
           GUARD(, [scratch1] "=&r" (dummy), [scratch2] "=&r" (dummy))
-        : "[aux]" (n)
-        : "memory" );
+        :: "memory" );
     clac();
 
     return n;
@@ -145,20 +103,12 @@ unsigned int clear_guest_pv(void __user *to, unsigned int n)
         stac();
         asm volatile (
             "    guest_access_mask_ptr %[to], %[scratch1], %[scratch2]\n"
-            "0:  rep stos"__OS"\n"
-            "    mov  %[bytes], %[cnt]\n"
             "1:  rep stosb\n"
             "2:\n"
-            ".section .fixup,\"ax\"\n"
-            "3:  lea  (%q[bytes], %q[longs], "STR(BYTES_PER_LONG)"), %[cnt]\n"
-            "    jmp  2b\n"
-            ".previous\n"
-            _ASM_EXTABLE(0b,3b)
             _ASM_EXTABLE(1b,2b)
-            : [cnt] "=&c" (n), [to] "+D" (to), [scratch1] "=&r" (dummy),
+            : [cnt] "+c" (n), [to] "+D" (to), [scratch1] "=&r" (dummy),
               [scratch2] "=&r" (dummy)
-            : [bytes] "r" (n & (BYTES_PER_LONG - 1)),
-              [longs] "0" (n / BYTES_PER_LONG), "a" (0) );
+            : "a" (0) );
         clac();
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:44:26 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:44:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827543.1242234 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oOQ-0001BZ-F3; Tue, 29 Oct 2024 15:44:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827543.1242234; Tue, 29 Oct 2024 15: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 1t5oOQ-0001BS-CO; Tue, 29 Oct 2024 15:44:26 +0000
Received: by outflank-mailman (input) for mailman id 827543;
 Tue, 29 Oct 2024 15:44: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 1t5oOP-0001B0-Ke
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:44:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oOP-009MJj-1t
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:44:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oOP-002rRr-1b
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:44: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/traps: Re-enable interrupts after reading cr2 in the #PF handler
Message-Id: <E1t5oOP-002rRr-1b@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:44:25 +0000

commit a5823065558b98f2c8ae78dfa882f2293e1a8a2f
Author:     Alejandro Vallejo <alejandro.vallejo@cloud.com>
AuthorDate: Tue Oct 29 16:37:32 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:37:32 2024 +0100

    x86/traps: Re-enable interrupts after reading cr2 in the #PF handler
    
    Hitting a page fault clobbers %cr2, so if a page fault is handled while
    handling a previous page fault then %cr2 will hold the address of the
    latter fault rather than the former. In particular, if a debug key
    handler happens to trigger during #PF and before %cr2 is read, and that
    handler itself encounters a #PF, then %cr2 will be corrupt for the outer #PF
    handler.
    
    This patch makes the page fault path delay re-enabling IRQs until %cr2
    has been read in order to ensure it stays consistent.
    
    A similar argument holds in additional cases, but they happen to be safe:
        * %dr6 inside #DB: Safe because IST exceptions don't re-enable IRQs.
        * MSR_XFD_ERR inside #NM: Safe because AMX isn't used in #NM handler.
    
    While in the area, remove redundant q suffix to a movq in entry.S and
    the space after the comma.
    
    Fixes: a4cd20a19073 ("[XEN] 'd' key dumps both host and guest state.")
    Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: b06e76db7c35974f1b127762683e7852ca0c8e76
    master date: 2024-10-01 09:45:49 +0200
---
 xen/arch/x86/traps.c        |  8 ++++++++
 xen/arch/x86/x86_64/entry.S | 20 ++++++++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index abd3019976..d702ffd38c 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -1628,6 +1628,14 @@ void do_page_fault(struct cpu_user_regs *regs)
 
     addr = read_cr2();
 
+    /*
+     * Don't re-enable interrupts if we were running an IRQ-off region when
+     * we hit the page fault, or we'll break that code.
+     */
+    ASSERT(!local_irq_is_enabled());
+    if ( regs->flags & X86_EFLAGS_IF )
+        local_irq_enable();
+
     /* fixup_page_fault() might change regs->error_code, so cache it here. */
     error_code = regs->error_code;
 
diff --git a/xen/arch/x86/x86_64/entry.S b/xen/arch/x86/x86_64/entry.S
index d3def49ea3..df3f3b4ea7 100644
--- a/xen/arch/x86/x86_64/entry.S
+++ b/xen/arch/x86/x86_64/entry.S
@@ -832,9 +832,9 @@ handle_exception_saved:
 #elif !defined(CONFIG_PV)
         ASSERT_CONTEXT_IS_XEN
 #endif /* CONFIG_PV */
-        sti
-1:      movq  %rsp,%rdi
-        movzbl UREGS_entry_vector(%rsp),%eax
+.Ldispatch_exceptions:
+        mov   %rsp, %rdi
+        movzbl UREGS_entry_vector(%rsp), %eax
 #ifdef CONFIG_PERF_COUNTERS
         lea   per_cpu__perfcounters(%rip), %rcx
         add   STACK_CPUINFO_FIELD(per_cpu_offset)(%r14), %rcx
@@ -854,7 +854,19 @@ handle_exception_saved:
         jmp   .L_exn_dispatch_done;    \
 .L_ ## vec ## _done:
 
+        /*
+         * IRQs kept off to derisk being hit by a nested interrupt before
+         * reading %cr2. Otherwise a page fault in the nested interrupt handler
+         * would corrupt %cr2.
+         */
         DISPATCH(X86_EXC_PF, do_page_fault)
+
+        /* Only re-enable IRQs if they were active before taking the fault */
+        testb $X86_EFLAGS_IF >> 8, UREGS_eflags + 1(%rsp)
+        jz    1f
+        sti
+1:
+
         DISPATCH(X86_EXC_GP, do_general_protection)
         DISPATCH(X86_EXC_UD, do_invalid_op)
         DISPATCH(X86_EXC_NM, do_device_not_available)
@@ -899,7 +911,7 @@ exception_with_ints_disabled:
         movq  %rsp,%rdi
         call  search_pre_exception_table
         testq %rax,%rax                 # no fixup code for faulting EIP?
-        jz    1b
+        jz    .Ldispatch_exceptions
         movq  %rax,UREGS_rip(%rsp)      # fixup regular stack
 
 #ifdef CONFIG_XEN_SHSTK
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:44:36 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:44:36 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827544.1242240 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oOa-0001EG-HO; Tue, 29 Oct 2024 15:44:36 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827544.1242240; Tue, 29 Oct 2024 15: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 1t5oOa-0001E6-Du; Tue, 29 Oct 2024 15:44:36 +0000
Received: by outflank-mailman (input) for mailman id 827544;
 Tue, 29 Oct 2024 15:44: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 1t5oOZ-0001Dx-My
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:44:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oOZ-009MJs-2C
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:44:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oOZ-002rSe-24
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:44: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/pv: Rework guest_io_okay() to return X86EMUL_*
Message-Id: <E1t5oOZ-002rSe-24@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:44:35 +0000

commit 0f23a771b02bd07296d7f7be784ef5e1e4040800
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Oct 29 16:38:17 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:38:17 2024 +0100

    x86/pv: Rework guest_io_okay() to return X86EMUL_*
    
    In order to fix a bug with guest_io_okay() (subsequent patch), rework
    guest_io_okay() to take in an emulation context, and return X86EMUL_* rather
    than a boolean.
    
    For the failing case, take the opportunity to inject #GP explicitly, rather
    than returning X86EMUL_UNHANDLEABLE.  There is a logical difference between
    "we know what this is, and it's #GP", vs "we don't know what this is".
    
    There is no change in practice as emulation is the final step on general #GP
    resolution, but returning X86EMUL_UNHANDLEABLE would be a latent bug if a
    subsequent action were to appear.
    
    No practical change.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 7429e1cc071b0e20ea9581da4893fb9b2f6d21d4
    master date: 2024-10-01 14:58:18 +0100
---
 xen/arch/x86/pv/emul-priv-op.c | 36 +++++++++++++++++++++++-------------
 1 file changed, 23 insertions(+), 13 deletions(-)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index b90f745c75..cc66ffbf8e 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -156,14 +156,16 @@ static bool iopl_ok(const struct vcpu *v, const struct cpu_user_regs *regs)
 }
 
 /* Has the guest requested sufficient permission for this I/O access? */
-static bool guest_io_okay(unsigned int port, unsigned int bytes,
-                          struct vcpu *v, struct cpu_user_regs *regs)
+static int guest_io_okay(unsigned int port, unsigned int bytes,
+                         struct x86_emulate_ctxt *ctxt)
 {
+    const struct cpu_user_regs *regs = ctxt->regs;
+    struct vcpu *v = current;
     /* If in user mode, switch to kernel mode just to read I/O bitmap. */
     const bool user_mode = !(v->arch.flags & TF_kernel_mode);
 
     if ( iopl_ok(v, regs) )
-        return true;
+        return X86EMUL_OKAY;
 
     if ( (port + bytes) <= v->arch.pv.iobmp_limit )
     {
@@ -190,10 +192,12 @@ static bool guest_io_okay(unsigned int port, unsigned int bytes,
             toggle_guest_pt(v);
 
         if ( (x.mask & (((1 << bytes) - 1) << (port & 7))) == 0 )
-            return true;
+            return X86EMUL_OKAY;
     }
 
-    return false;
+    x86_emul_hw_exception(X86_EXC_GP, 0, ctxt);
+
+    return X86EMUL_EXCEPTION;
 }
 
 /* Has the administrator granted sufficient permission for this I/O access? */
@@ -353,12 +357,14 @@ static int cf_check read_io(
     struct priv_op_ctxt *poc = container_of(ctxt, struct priv_op_ctxt, ctxt);
     struct vcpu *curr = current;
     struct domain *currd = current->domain;
+    int rc;
 
     /* INS must not come here. */
     ASSERT((ctxt->opcode & ~9) == 0xe4);
 
-    if ( !guest_io_okay(port, bytes, curr, ctxt->regs) )
-        return X86EMUL_UNHANDLEABLE;
+    rc = guest_io_okay(port, bytes, ctxt);
+    if ( rc != X86EMUL_OKAY )
+        return rc;
 
     poc->bpmatch = check_guest_io_breakpoint(curr, port, bytes);
 
@@ -458,12 +464,14 @@ static int cf_check write_io(
     struct priv_op_ctxt *poc = container_of(ctxt, struct priv_op_ctxt, ctxt);
     struct vcpu *curr = current;
     struct domain *currd = current->domain;
+    int rc;
 
     /* OUTS must not come here. */
     ASSERT((ctxt->opcode & ~9) == 0xe6);
 
-    if ( !guest_io_okay(port, bytes, curr, ctxt->regs) )
-        return X86EMUL_UNHANDLEABLE;
+    rc = guest_io_okay(port, bytes, ctxt);
+    if ( rc != X86EMUL_OKAY )
+        return rc;
 
     poc->bpmatch = check_guest_io_breakpoint(curr, port, bytes);
 
@@ -612,8 +620,9 @@ static int cf_check rep_ins(
 
     *reps = 0;
 
-    if ( !guest_io_okay(port, bytes_per_rep, curr, ctxt->regs) )
-        return X86EMUL_UNHANDLEABLE;
+    rc = guest_io_okay(port, bytes_per_rep, ctxt);
+    if ( rc != X86EMUL_OKAY )
+        return rc;
 
     rc = read_segment(x86_seg_es, &sreg, ctxt);
     if ( rc != X86EMUL_OKAY )
@@ -678,8 +687,9 @@ static int cf_check rep_outs(
 
     *reps = 0;
 
-    if ( !guest_io_okay(port, bytes_per_rep, curr, ctxt->regs) )
-        return X86EMUL_UNHANDLEABLE;
+    rc = guest_io_okay(port, bytes_per_rep, ctxt);
+    if ( rc != X86EMUL_OKAY )
+        return rc;
 
     rc = read_segment(seg, &sreg, ctxt);
     if ( rc != X86EMUL_OKAY )
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:44:46 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:44:46 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827545.1242244 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oOk-0001HP-JK; Tue, 29 Oct 2024 15:44:46 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827545.1242244; Tue, 29 Oct 2024 15: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 1t5oOk-0001HH-Ga; Tue, 29 Oct 2024 15:44:46 +0000
Received: by outflank-mailman (input) for mailman id 827545;
 Tue, 29 Oct 2024 15:44: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 1t5oOj-0001H6-QJ
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:44:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oOj-009MK1-2V
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:44:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oOj-002rTC-2N
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:44: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/pv: Handle #PF correctly when reading the IO permission bitmap
Message-Id: <E1t5oOj-002rTC-2N@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:44:45 +0000

commit 008808ac9523efcbdc514d8ae35b4db07bca16ec
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Oct 29 16:38:29 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:38:29 2024 +0100

    x86/pv: Handle #PF correctly when reading the IO permission bitmap
    
    The switch statement in guest_io_okay() is a very expensive way of
    pre-initialising x with ~0, and performing a partial read into it.
    
    However, the logic isn't correct either.
    
    In a real TSS, the CPU always reads two bytes (like here), and any TSS limit
    violation turns silently into no-access.  But, in-limit accesses trigger #PF
    as usual.  AMD document this property explicitly, and while Intel don't (so
    far as I can tell), they do behave consistently with AMD.
    
    Switch from __copy_from_guest_offset() to __copy_from_guest_pv(), like
    everything else in this file.  This removes code generation setting up
    copy_from_user_hvm() (in the likely path even), and safety LFENCEs from
    evaluate_nospec().
    
    Change the logic to raise #PF if __copy_from_guest_pv() fails, rather than
    disallowing the IO port access.  This brings the behaviour better in line with
    normal x86.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 8a6c495d725408d333c1b47bb8af44615a5bfb18
    master date: 2024-10-01 14:58:18 +0100
---
 xen/arch/x86/pv/emul-priv-op.c | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index cc66ffbf8e..e35285d4ab 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -169,29 +169,26 @@ static int guest_io_okay(unsigned int port, unsigned int bytes,
 
     if ( (port + bytes) <= v->arch.pv.iobmp_limit )
     {
-        union { uint8_t bytes[2]; uint16_t mask; } x;
+        const void *__user addr = v->arch.pv.iobmp.p + (port >> 3);
+        uint16_t mask;
+        int rc;
 
-        /*
-         * Grab permission bytes from guest space. Inaccessible bytes are
-         * read as 0xff (no access allowed).
-         */
+        /* Grab permission bytes from guest space. */
         if ( user_mode )
             toggle_guest_pt(v);
 
-        switch ( __copy_from_guest_offset(x.bytes, v->arch.pv.iobmp,
-                                          port>>3, 2) )
-        {
-        default: x.bytes[0] = ~0;
-            /* fallthrough */
-        case 1:  x.bytes[1] = ~0;
-            /* fallthrough */
-        case 0:  break;
-        }
+        rc = __copy_from_guest_pv(&mask, addr, 2);
 
         if ( user_mode )
             toggle_guest_pt(v);
 
-        if ( (x.mask & (((1 << bytes) - 1) << (port & 7))) == 0 )
+        if ( rc )
+        {
+            x86_emul_pagefault(0, (unsigned long)addr + bytes - rc, ctxt);
+            return X86EMUL_EXCEPTION;
+        }
+
+        if ( (mask & (((1 << bytes) - 1) << (port & 7))) == 0 )
             return X86EMUL_OKAY;
     }
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:44:56 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:44:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827546.1242247 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oOu-0001LF-Kq; Tue, 29 Oct 2024 15:44:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827546.1242247; Tue, 29 Oct 2024 15: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 1t5oOu-0001L7-Hy; Tue, 29 Oct 2024 15:44:56 +0000
Received: by outflank-mailman (input) for mailman id 827546;
 Tue, 29 Oct 2024 15:44: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 1t5oOt-0001Kz-U3
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:44:55 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oOt-009MKA-2t
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:44:55 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oOt-002rTm-2h
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:44: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/pv: Rename pv.iobmp_limit to iobmp_nr and clarify behaviour
Message-Id: <E1t5oOt-002rTm-2h@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:44:55 +0000

commit 313ff5a2d5d24feb21cb98f5329d834e413446c4
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Oct 29 16:38:41 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:38:41 2024 +0100

    x86/pv: Rename pv.iobmp_limit to iobmp_nr and clarify behaviour
    
    Ever since it's introduction in commit 013351bd7ab3 ("Define new event-channel
    and physdev hypercalls") in 2006, the public interface was named nr_ports
    while the internal field was called iobmp_limit.
    
    Rename the internal field to iobmp_nr to match the public interface, and
    clarify that, when nonzero, Xen will read 2 bytes.
    
    There isn't a perfect parallel with a real TSS, but iobmp_nr being 0 is the
    paravirt "no IOPB" case, and it is important that no read occurs in this case.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: 633ee8b2df963f7e5cb8de1219c1a48bfb4447f6
    master date: 2024-10-01 14:58:18 +0100
---
 xen/arch/x86/include/asm/domain.h | 2 +-
 xen/arch/x86/physdev.c            | 2 +-
 xen/arch/x86/pv/emul-priv-op.c    | 6 +++++-
 xen/include/public/physdev.h      | 3 +++
 4 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/domain.h
index 53876472fe..0d2d2b6623 100644
--- a/xen/arch/x86/include/asm/domain.h
+++ b/xen/arch/x86/include/asm/domain.h
@@ -574,7 +574,7 @@ struct pv_vcpu
 
     /* I/O-port access bitmap. */
     XEN_GUEST_HANDLE(uint8) iobmp; /* Guest kernel vaddr of the bitmap. */
-    unsigned int iobmp_limit; /* Number of ports represented in the bitmap. */
+    unsigned int iobmp_nr;    /* Number of ports represented in the bitmap. */
 #define IOPL(val) MASK_INSR(val, X86_EFLAGS_IOPL)
     unsigned int iopl;        /* Current IOPL for this VCPU, shifted left by
                                * 12 to match the eflags register. */
diff --git a/xen/arch/x86/physdev.c b/xen/arch/x86/physdev.c
index 2f1d955a96..39967cf2e5 100644
--- a/xen/arch/x86/physdev.c
+++ b/xen/arch/x86/physdev.c
@@ -433,7 +433,7 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
 #else
         guest_from_compat_handle(curr->arch.pv.iobmp, set_iobitmap.bitmap);
 #endif
-        curr->arch.pv.iobmp_limit = set_iobitmap.nr_ports;
+        curr->arch.pv.iobmp_nr = set_iobitmap.nr_ports;
         break;
     }
 
diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-op.c
index e35285d4ab..70150c2722 100644
--- a/xen/arch/x86/pv/emul-priv-op.c
+++ b/xen/arch/x86/pv/emul-priv-op.c
@@ -167,7 +167,11 @@ static int guest_io_okay(unsigned int port, unsigned int bytes,
     if ( iopl_ok(v, regs) )
         return X86EMUL_OKAY;
 
-    if ( (port + bytes) <= v->arch.pv.iobmp_limit )
+    /*
+     * When @iobmp_nr is non-zero, Xen, like real CPUs and the TSS IOPB,
+     * always reads 2 bytes from @iobmp, which might be one byte @iobmp_nr.
+     */
+    if ( (port + bytes) <= v->arch.pv.iobmp_nr )
     {
         const void *__user addr = v->arch.pv.iobmp.p + (port >> 3);
         uint16_t mask;
diff --git a/xen/include/public/physdev.h b/xen/include/public/physdev.h
index f0c0d4727c..d694104cd8 100644
--- a/xen/include/public/physdev.h
+++ b/xen/include/public/physdev.h
@@ -87,6 +87,9 @@ DEFINE_XEN_GUEST_HANDLE(physdev_set_iopl_t);
 /*
  * Set the current VCPU's I/O-port permissions bitmap.
  * @arg == pointer to physdev_set_iobitmap structure.
+ *
+ * When @nr_ports is non-zero, Xen, like real CPUs and the TSS IOPB, always
+ * reads 2 bytes from @bitmap, which might be one byte beyond @nr_ports.
  */
 #define PHYSDEVOP_set_iobitmap           7
 struct physdev_set_iobitmap {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:45:06 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:45:06 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827547.1242252 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oP4-0001NC-MM; Tue, 29 Oct 2024 15:45:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827547.1242252; Tue, 29 Oct 2024 15: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 1t5oP4-0001N3-JP; Tue, 29 Oct 2024 15:45:06 +0000
Received: by outflank-mailman (input) for mailman id 827547;
 Tue, 29 Oct 2024 15:45: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 1t5oP4-0001Mw-1J
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:45:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oP4-009MKd-00
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:45:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oP3-002rUq-33
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:45: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] stubdom: Fix newlib build with GCC-14
Message-Id: <E1t5oP3-002rUq-33@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:45:05 +0000

commit 706da365c23d5d93aef377f15002942faaf73f2e
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Oct 29 16:39:22 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:39:22 2024 +0100

    stubdom: Fix newlib build with GCC-14
    
    Based on a fix from OpenSUSE, but adjusted to be Clang-compatible too.  Pass
    -Wno-implicit-function-declaration library-wide rather than using local GCC
    pragmas.
    
    Fix of copy_past_newline() to avoid triggering -Wstrict-prototypes.
    
    Link: https://build.opensuse.org/request/show/1178775
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    master commit: 444cb9350f2c1cc202b6b86176ddd8e57525e2d9
    master date: 2024-10-03 10:07:25 +0100
---
 stubdom/Makefile                           |  2 ++
 stubdom/newlib-fix-copy_past_newline.patch | 10 ++++++++++
 2 files changed, 12 insertions(+)

diff --git a/stubdom/Makefile b/stubdom/Makefile
index 888fa20d72..52c345a940 100644
--- a/stubdom/Makefile
+++ b/stubdom/Makefile
@@ -97,10 +97,12 @@ newlib-$(NEWLIB_VERSION): newlib-$(NEWLIB_VERSION).tar.gz
 	patch -d $@ -p1 < newlib-disable-texinfo.patch
 	patch -d $@ -p1 < newlib-cygmon-gmon.patch
 	patch -d $@ -p1 < newlib-makedoc.patch
+	patch -d $@ -p1 < newlib-fix-copy_past_newline.patch
 	find $@ -type f | xargs perl -i.bak \
 		-pe 's/\b_(tzname|daylight|timezone)\b/$$1/g'
 	touch $@
 
+NEWLIB_CFLAGS += -Wno-implicit-function-declaration
 NEWLIB_STAMPFILE=$(CROSS_ROOT)/$(GNU_TARGET_ARCH)-xen-elf/lib/libc.a
 .PHONY: cross-newlib
 cross-newlib: $(NEWLIB_STAMPFILE)
diff --git a/stubdom/newlib-fix-copy_past_newline.patch b/stubdom/newlib-fix-copy_past_newline.patch
new file mode 100644
index 0000000000..f8452480bc
--- /dev/null
+++ b/stubdom/newlib-fix-copy_past_newline.patch
@@ -0,0 +1,10 @@
+--- newlib-1.16.0/newlib/doc/makedoc.c.orig
++++ newlib-1.16.0/newlib/doc/makedoc.c
+@@ -798,6 +798,7 @@ DEFUN( iscommand,(ptr, idx),
+ }
+
+
++static unsigned int
+ DEFUN(copy_past_newline,(ptr, idx, dst),
+       string_type *ptr AND
+       unsigned int idx AND
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:45:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:45:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827548.1242255 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oPE-0001Pc-NS; Tue, 29 Oct 2024 15:45:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827548.1242255; Tue, 29 Oct 2024 15:45: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 1t5oPE-0001PU-Ko; Tue, 29 Oct 2024 15:45:16 +0000
Received: by outflank-mailman (input) for mailman id 827548;
 Tue, 29 Oct 2024 15:45: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 1t5oPE-0001PM-4W
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:45:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oPE-009ML7-0L
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:45:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oPE-002rVg-0B
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:45: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/dpci: do not leak pending interrupts on CPU offline
Message-Id: <E1t5oPE-002rVg-0B@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:45:16 +0000

commit 9cf2b44c8eb506f72de34ce0e65751472740da78
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Oct 29 16:39:43 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:39:43 2024 +0100

    x86/dpci: do not leak pending interrupts on CPU offline
    
    The current dpci logic relies on a softirq being executed as a side effect of
    the cpu_notifier_call_chain() call in the code path that offlines the target
    CPU.  However the call to cpu_notifier_call_chain() won't trigger any softirq
    processing, and even if it did, such processing should be done after all
    interrupts have been migrated off the current CPU, otherwise new pending dpci
    interrupts could still appear.
    
    Currently the ASSERT() in the cpu callback notifier is fairly easy to trigger
    by doing CPU offline from a PVH dom0.
    
    Solve this by instead moving out any dpci interrupts pending processing once
    the CPU is dead.  This might introduce more latency than attempting to drain
    before the CPU is put offline, but it's less complex, and CPU online/offline is
    not a common action.  Any extra introduced latency should be tolerable.
    
    Fixes: f6dd295381f4 ('dpci: replace tasklet with softirq')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
    master commit: 29555668b5725b9d5393b72bfe7ff9a3fa606714
    master date: 2024-10-07 11:10:21 +0200
---
 xen/drivers/passthrough/x86/hvm.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/xen/drivers/passthrough/x86/hvm.c b/xen/drivers/passthrough/x86/hvm.c
index 8175ba629a..f73292fd6c 100644
--- a/xen/drivers/passthrough/x86/hvm.c
+++ b/xen/drivers/passthrough/x86/hvm.c
@@ -1105,23 +1105,27 @@ static int cf_check cpu_callback(
     struct notifier_block *nfb, unsigned long action, void *hcpu)
 {
     unsigned int cpu = (unsigned long)hcpu;
+    unsigned long flags;
 
     switch ( action )
     {
     case CPU_UP_PREPARE:
         INIT_LIST_HEAD(&per_cpu(dpci_list, cpu));
         break;
+
     case CPU_UP_CANCELED:
-    case CPU_DEAD:
-        /*
-         * On CPU_DYING this callback is called (on the CPU that is dying)
-         * with an possible HVM_DPIC_SOFTIRQ pending - at which point we can
-         * clear out any outstanding domains (by the virtue of the idle loop
-         * calling the softirq later). In CPU_DEAD case the CPU is deaf and
-         * there are no pending softirqs for us to handle so we can chill.
-         */
         ASSERT(list_empty(&per_cpu(dpci_list, cpu)));
         break;
+
+    case CPU_DEAD:
+        if ( list_empty(&per_cpu(dpci_list, cpu)) )
+            break;
+        /* Take whatever dpci interrupts are pending on the dead CPU. */
+        local_irq_save(flags);
+        list_splice_init(&per_cpu(dpci_list, cpu), &this_cpu(dpci_list));
+        local_irq_restore(flags);
+        raise_softirq(HVM_DPCI_SOFTIRQ);
+        break;
     }
 
     return NOTIFY_DONE;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:45:26 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:45:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827549.1242260 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oPO-0001Sx-PO; Tue, 29 Oct 2024 15:45:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827549.1242260; Tue, 29 Oct 2024 15:45: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 1t5oPO-0001Sp-MC; Tue, 29 Oct 2024 15:45:26 +0000
Received: by outflank-mailman (input) for mailman id 827549;
 Tue, 29 Oct 2024 15:45: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 1t5oPO-0001SJ-7W
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:45:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oPO-009MLE-0d
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:45:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oPO-002rWz-0W
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:45: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] ioreq: don't wrongly claim "success" in ioreq_send_buffered()
Message-Id: <E1t5oPO-002rWz-0W@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:45:26 +0000

commit ea63850c0a12c80bde4b76996ddf425acd5030a8
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Tue Oct 29 16:40:46 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:40:46 2024 +0100

    ioreq: don't wrongly claim "success" in ioreq_send_buffered()
    
    Returning a literal number is a bad idea anyway when all other returns
    use IOREQ_STATUS_* values. The function is dead on Arm, and mapping to
    X86EMUL_OKAY is surely wrong on x86.
    
    Fixes: f6bf39f84f82 ("x86/hvm: add support for broadcast of buffered ioreqs...")
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Julien Grall <jgrall@amazon.com>
    master commit: 2e0b545b847df7d4feb07308d50bad708bd35a66
    master date: 2024-10-08 14:36:27 +0200
---
 xen/common/ioreq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/common/ioreq.c b/xen/common/ioreq.c
index 62b907f4c4..1e8e5e885e 100644
--- a/xen/common/ioreq.c
+++ b/xen/common/ioreq.c
@@ -1175,7 +1175,7 @@ static int ioreq_send_buffered(struct ioreq_server *s, ioreq_t *p)
         return IOREQ_STATUS_UNHANDLED;
 
     /*
-     * Return 0 for the cases we can't deal with:
+     * Return UNHANDLED for the cases we can't deal with:
      *  - 'addr' is only a 20-bit field, so we cannot address beyond 1MB
      *  - we cannot buffer accesses to guest memory buffers, as the guest
      *    may expect the memory buffer to be synchronously accessed
@@ -1183,7 +1183,7 @@ static int ioreq_send_buffered(struct ioreq_server *s, ioreq_t *p)
      *    support data_is_ptr we do not waste space for the count field either
      */
     if ( (p->addr > 0xfffffUL) || p->data_is_ptr || (p->count != 1) )
-        return 0;
+        return IOREQ_STATUS_UNHANDLED;
 
     switch ( p->size )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:45:37 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:45:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827550.1242264 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oPZ-0001X0-Qu; Tue, 29 Oct 2024 15:45:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827550.1242264; Tue, 29 Oct 2024 15:45: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 1t5oPZ-0001Ws-Nr; Tue, 29 Oct 2024 15:45:37 +0000
Received: by outflank-mailman (input) for mailman id 827550;
 Tue, 29 Oct 2024 15:45: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 1t5oPY-0001Wi-AS
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:45:36 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oPY-009MLL-0v
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:45:36 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oPY-002rXX-0o
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:45: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/domctl: fix maximum number of MSRs in XEN_DOMCTL_{get,set}_vcpu_msrs
Message-Id: <E1t5oPY-002rXX-0o@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:45:36 +0000

commit 2f5fc982f5e7193e5e22baeaa23df3a2f4b1e399
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Oct 29 16:40:58 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:40:58 2024 +0100

    x86/domctl: fix maximum number of MSRs in XEN_DOMCTL_{get,set}_vcpu_msrs
    
    Since the addition of the MSR_AMD64_DR{1-4}_ADDRESS_MASK MSRs to the
    msrs_to_send array, the calculations for the maximum number of MSRs that
    the hypercall can handle is off by 4.
    
    Remove the addition of 4 to the maximum number of MSRs that
    XEN_DOMCTL_{set,get}_vcpu_msrs supports, as those are already part of the
    array.
    
    A further adjustment could be to subtract 4 from the maximum size if the DBEXT
    CPUID feature is not exposed to the guest, but guest_{rd,wr}msr() will already
    perform that check when fetching or loading the MSRs.  The maximum array is
    used to indicate the caller of the buffer it needs to allocate in the get case,
    and as an early input sanitation in the set case, using a buffer size slightly
    lager than required is not an issue.
    
    Fixes: 86d47adcd3c4 ('x86/msr: Handle MSR_AMD64_DR{0-3}_ADDRESS_MASK in the new MSR infrastructure')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    master commit: c95cd5f9c5a8c1c6ab1b0b366d829fa8561958fd
    master date: 2024-10-08 14:37:53 +0200
---
 xen/arch/x86/domctl.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c
index 1a8b4cff48..9bb90a83cf 100644
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -1110,10 +1110,6 @@ long arch_do_domctl(
              !is_pv_domain(d) )
             break;
 
-        /* Count maximum number of optional msrs. */
-        if ( boot_cpu_has(X86_FEATURE_DBEXT) )
-            nr_msrs += 4;
-
         if ( domctl->cmd == XEN_DOMCTL_get_vcpu_msrs )
         {
             ret = 0; copyback = true;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:45:47 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:45:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827551.1242267 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oPj-0001ZK-Rw; Tue, 29 Oct 2024 15:45:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827551.1242267; Tue, 29 Oct 2024 15:45: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 1t5oPj-0001ZC-PN; Tue, 29 Oct 2024 15:45:47 +0000
Received: by outflank-mailman (input) for mailman id 827551;
 Tue, 29 Oct 2024 15:45: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 1t5oPi-0001Z4-FA
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:45:46 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oPi-009MLT-1P
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:45:46 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oPi-002rY6-16
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:45: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] xen/spinlock: Fix UBSAN "load of address with insufficient space" in lock_prof_init()
Message-Id: <E1t5oPi-002rY6-16@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:45:46 +0000

commit c2b8041904378ef5ecc8182fed4b904b1b30f021
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Oct 29 16:41:30 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:41:30 2024 +0100

    xen/spinlock: Fix UBSAN "load of address with insufficient space" in lock_prof_init()
    
    UBSAN complains:
    
      (XEN) ================================================================================
      (XEN) UBSAN: Undefined behaviour in common/spinlock.c:794:10
      (XEN) load of address ffff82d040ae24c8 with insufficient space
      (XEN) for an object of type 'struct lock_profile *'
      (XEN) ----[ Xen-4.20-unstable  x86_64  debug=y ubsan=y  Tainted:   C    ]----
    
    This shows up with GCC-14, but not with GCC-12.  I have not bisected further.
    
    Either way, the types for __lock_profile_{start,end} are incorrect.
    
    They are an array of struct lock_profile pointers.  Correct the extern's
    types, and adjust the loop to match.
    
    No practical change.
    
    Reported-by: Andreas Glashauser <ag@andreasglashauser.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Juergen Gross <jgross@suse.com>
    master commit: 542ac112fc68c66cfafc577e252404c21da4f75b
    master date: 2024-10-14 16:14:26 +0100
---
 xen/common/spinlock.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
index 7f453234a9..4fc6f00177 100644
--- a/xen/common/spinlock.c
+++ b/xen/common/spinlock.c
@@ -501,9 +501,6 @@ struct lock_profile_anc {
 typedef void lock_profile_subfunc(
     struct lock_profile *, int32_t, int32_t, void *);
 
-extern struct lock_profile *__lock_profile_start;
-extern struct lock_profile *__lock_profile_end;
-
 static s_time_t lock_profile_start;
 static struct lock_profile_anc lock_profile_ancs[] = {
     [LOCKPROF_TYPE_GLOBAL] = { .name = "Global" },
@@ -659,13 +656,16 @@ void _lock_profile_deregister_struct(
     spin_unlock(&lock_profile_lock);
 }
 
+extern struct lock_profile *__lock_profile_start[];
+extern struct lock_profile *__lock_profile_end[];
+
 static int __init cf_check lock_prof_init(void)
 {
     struct lock_profile **q;
 
     BUILD_BUG_ON(ARRAY_SIZE(lock_profile_ancs) != LOCKPROF_TYPE_N);
 
-    for ( q = &__lock_profile_start; q < &__lock_profile_end; q++ )
+    for ( q = __lock_profile_start; q < __lock_profile_end; q++ )
     {
         (*q)->next = lock_profile_glb_q.elem_q;
         lock_profile_glb_q.elem_q = *q;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:45:58 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:45:58 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827552.1242270 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oPt-0001cX-Uc; Tue, 29 Oct 2024 15:45:57 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827552.1242270; Tue, 29 Oct 2024 15:45: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 1t5oPt-0001cP-SA; Tue, 29 Oct 2024 15:45:57 +0000
Received: by outflank-mailman (input) for mailman id 827552;
 Tue, 29 Oct 2024 15:45: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 1t5oPs-0001c2-IG
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:45:56 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oPs-009MLc-1h
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:45:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oPs-002rYi-1a
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:45: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] iommu/amd-vi: do not error if device referenced in IVMD is not behind any IOMMU
Message-Id: <E1t5oPs-002rYi-1a@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:45:56 +0000

commit b9bf85b5fd9106f4d9e27867ffd1d02bb3ff264b
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Tue Oct 29 16:41:42 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:41:42 2024 +0100

    iommu/amd-vi: do not error if device referenced in IVMD is not behind any IOMMU
    
    IVMD table contains restrictions about memory which must be mandatory assigned
    to devices (and which permissions it should use), or memory that should be
    never accessible to devices.
    
    Some hardware however contains ranges in IVMD that reference devices outside of
    the IVHD tables (in other words, devices not behind any IOMMU).  Such mismatch
    will cause Xen to fail in register_range_for_device(), ultimately leading to
    the IOMMU being disabled, and Xen crashing as x2APIC support might be already
    enabled and relying on the IOMMU functionality.
    
    Relax IVMD parsing: allow IVMD blocks to reference devices not assigned to any
    IOMMU.  It's impossible for Xen to fulfill the requirement in the IVMD block if
    the device is not behind any IOMMU, but it's no worse than booting without
    IOMMU support, and thus not parsing ACPI IVRS in the first place.
    
    Reported-by: Willi Junga <xenproject@ymy.be>
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
    master commit: 2defb544900a11f93104ac68d2f8beba89d4bd02
    master date: 2024-10-15 14:23:59 +0200
---
 xen/drivers/passthrough/amd/iommu_acpi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu_acpi.c b/xen/drivers/passthrough/amd/iommu_acpi.c
index 96d8879e7b..59d30a4a2c 100644
--- a/xen/drivers/passthrough/amd/iommu_acpi.c
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c
@@ -248,8 +248,9 @@ static int __init register_range_for_device(
     iommu = find_iommu_for_device(seg, bdf);
     if ( !iommu )
     {
-        AMD_IOMMU_ERROR("IVMD: no IOMMU for Dev_Id %#x\n", bdf);
-        return -ENODEV;
+        AMD_IOMMU_WARN("IVMD: no IOMMU for device %pp - ignoring constrain\n",
+                       &PCI_SBDF(seg, bdf));
+        return 0;
     }
     req = ivrs_mappings[bdf].dte_requestor_id;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:46:08 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:46:08 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827553.1242274 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oQ3-0001fX-WD; Tue, 29 Oct 2024 15:46:08 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827553.1242274; Tue, 29 Oct 2024 15:46: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 1t5oQ3-0001fP-Tc; Tue, 29 Oct 2024 15:46:07 +0000
Received: by outflank-mailman (input) for mailman id 827553;
 Tue, 29 Oct 2024 15:46: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 1t5oQ2-0001fB-LL
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:46:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oQ2-009MM0-20
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:46:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oQ2-002ra5-1u
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:46: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/boot: Fix microcode module handling during PVH boot
Message-Id: <E1t5oQ2-002ra5-1u@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:46:06 +0000

commit 9043f31c4085c4f7db7b5fb0bdbf7a2eae0408ce
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Tue Oct 29 16:42:16 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:42:16 2024 +0100

    x86/boot: Fix microcode module handling during PVH boot
    
    As detailed in commit 0fe607b2a144 ("x86/boot: Fix PVH boot during boot_info
    transition period"), the use of __va(mbi->mods_addr) constitutes a
    use-after-free on the PVH boot path.
    
    This pattern has been in use since before PVH support was added.  Inside a PVH
    VM, it will go unnoticed as long as the microcode container parser doesn't
    choke on the random data it finds.
    
    The use within early_microcode_init() happens to be safe because it's prior to
    move_xen().  microcode_init_cache() is after move_xen(), and therefore unsafe.
    
    Plumb the boot_info pointer down, replacing module_map and mbi.  Importantly,
    bi->mods[].mod is a safe way to access the module list during PVH boot.
    
    Note: microcode_scan_module() is still bogusly stashing a bootstrap_map()'d
          pointer in ucode_blob.data, which constitutes a different
          use-after-free, and only works in general because of a second bug.  This
          is unrelated to PVH, and needs untangling differently.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 8ddf63a252a6eae6e619ba2df9ad6b6f82e660c1
    master date: 2024-10-23 18:14:24 +0100
---
 xen/arch/x86/cpu/microcode/core.c    | 21 +++++++++++----------
 xen/arch/x86/include/asm/microcode.h |  7 +++++--
 xen/arch/x86/setup.c                 |  4 ++--
 3 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode/core.c
index 8a47f4471f..2ee0db5b21 100644
--- a/xen/arch/x86/cpu/microcode/core.c
+++ b/xen/arch/x86/cpu/microcode/core.c
@@ -151,9 +151,9 @@ custom_param("ucode", parse_ucode);
 
 static void __init microcode_scan_module(
     unsigned long *module_map,
-    const multiboot_info_t *mbi)
+    const multiboot_info_t *mbi,
+    const module_t mod[])
 {
-    module_t *mod = (module_t *)__va(mbi->mods_addr);
     uint64_t *_blob_start;
     unsigned long _blob_size;
     struct cpio_data cd;
@@ -203,10 +203,9 @@ static void __init microcode_scan_module(
 
 static void __init microcode_grab_module(
     unsigned long *module_map,
-    const multiboot_info_t *mbi)
+    const multiboot_info_t *mbi,
+    const module_t mod[])
 {
-    module_t *mod = (module_t *)__va(mbi->mods_addr);
-
     if ( ucode_mod_idx < 0 )
         ucode_mod_idx += mbi->mods_count;
     if ( ucode_mod_idx <= 0 || ucode_mod_idx >= mbi->mods_count ||
@@ -215,7 +214,7 @@ static void __init microcode_grab_module(
     ucode_mod = mod[ucode_mod_idx];
 scan:
     if ( ucode_scan )
-        microcode_scan_module(module_map, mbi);
+        microcode_scan_module(module_map, mbi, mod);
 }
 
 static struct microcode_ops __ro_after_init ucode_ops;
@@ -801,7 +800,8 @@ static int __init early_update_cache(const void *data, size_t len)
 }
 
 int __init microcode_init_cache(unsigned long *module_map,
-                                const struct multiboot_info *mbi)
+                                const struct multiboot_info *mbi,
+                                const module_t mods[])
 {
     int rc = 0;
 
@@ -810,7 +810,7 @@ int __init microcode_init_cache(unsigned long *module_map,
 
     if ( ucode_scan )
         /* Need to rescan the modules because they might have been relocated */
-        microcode_scan_module(module_map, mbi);
+        microcode_scan_module(module_map, mbi, mods);
 
     if ( ucode_mod.mod_end )
         rc = early_update_cache(bootstrap_map(&ucode_mod),
@@ -857,7 +857,8 @@ static int __init early_microcode_update_cpu(void)
 }
 
 int __init early_microcode_init(unsigned long *module_map,
-                                const struct multiboot_info *mbi)
+                                const struct multiboot_info *mbi,
+                                const module_t mods[])
 {
     const struct cpuinfo_x86 *c = &boot_cpu_data;
     int rc = 0;
@@ -906,7 +907,7 @@ int __init early_microcode_init(unsigned long *module_map,
         return -ENODEV;
     }
 
-    microcode_grab_module(module_map, mbi);
+    microcode_grab_module(module_map, mbi, mods);
 
     if ( ucode_mod.mod_end || ucode_blob.size )
         rc = early_microcode_update_cpu();
diff --git a/xen/arch/x86/include/asm/microcode.h b/xen/arch/x86/include/asm/microcode.h
index 62ce3418f7..bfb1820d21 100644
--- a/xen/arch/x86/include/asm/microcode.h
+++ b/xen/arch/x86/include/asm/microcode.h
@@ -3,6 +3,7 @@
 
 #include <xen/types.h>
 #include <xen/percpu.h>
+#include <xen/multiboot.h>
 
 #include <public/xen.h>
 
@@ -24,9 +25,11 @@ DECLARE_PER_CPU(struct cpu_signature, cpu_sig);
 void microcode_set_module(unsigned int idx);
 int microcode_update(XEN_GUEST_HANDLE(const_void), unsigned long len);
 int early_microcode_init(unsigned long *module_map,
-                         const struct multiboot_info *mbi);
+                         const struct multiboot_info *mbi,
+                         const module_t mods[]);
 int microcode_init_cache(unsigned long *module_map,
-                         const struct multiboot_info *mbi);
+                         const struct multiboot_info *mbi,
+                         const module_t mods[]);
 int microcode_update_one(void);
 
 #endif /* ASM_X86__MICROCODE_H */
diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 18503300e7..1d5d3f8a66 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1316,7 +1316,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
      * TODO: load ucode earlier once multiboot modules become accessible
      * at an earlier stage.
      */
-    early_microcode_init(module_map, mbi);
+    early_microcode_init(module_map, mbi, mod);
 
     if ( xen_phys_start )
     {
@@ -1842,7 +1842,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
 
     timer_init();
 
-    microcode_init_cache(module_map, mbi); /* Needs xmalloc() */
+    microcode_init_cache(module_map, mbi, mod); /* Needs xmalloc() */
 
     tsx_init(); /* Needs microcode.  May change HLE/RTM feature bits. */
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 15:46:18 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 15:46:18 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827554.1242279 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oQE-0001iN-1T; Tue, 29 Oct 2024 15:46:18 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827554.1242279; Tue, 29 Oct 2024 15:46:18 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5oQD-0001iF-Uz; Tue, 29 Oct 2024 15:46:17 +0000
Received: by outflank-mailman (input) for mailman id 827554;
 Tue, 29 Oct 2024 15:46: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 1t5oQC-0001i5-Oi
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 15:46:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oQC-009MMO-2M
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:46:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5oQC-002rax-2C
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 15:46: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging-4.18] x86/boot: Fix XSM module handling during PVH boot
Message-Id: <E1t5oQC-002rax-2C@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 15:46:16 +0000

commit 2b18f341cb5c66bbc3260a8e0dd9f42b2f58d78c
Author:     Daniel P. Smith <dpsmith@apertussolutions.com>
AuthorDate: Tue Oct 29 16:42:29 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Tue Oct 29 16:42:29 2024 +0100

    x86/boot: Fix XSM module handling during PVH boot
    
    As detailed in commit 0fe607b2a144 ("x86/boot: Fix PVH boot during boot_info
    transition period"), the use of __va(mbi->mods_addr) constitutes a
    use-after-free on the PVH boot path.
    
    This pattern has been in use since before PVH support was added.  This has
    most likely gone unnoticed because no-one's tried using a detached Flask
    policy in a PVH VM before.
    
    Plumb the boot_info pointer down, replacing module_map and mbi.  Importantly,
    bi->mods[].mod is a safe way to access the module list during PVH boot.
    
    As this is the final non-bi use of mbi in __start_xen(), make the pointer
    unusable once bi has been established, to prevent new uses creeping back in.
    This is a stopgap until mbi can be fully removed.
    
    Signed-off-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Daniel P. Smith <dpsmith@apertussolutions.com>
    Acked-by: Roger Pau Monné <roger.pau@citrix.com>
    master commit: 6cf0aaeb8df951fb34679f0408461a5c67cb02c6
    master date: 2024-10-23 18:14:24 +0100
---
 xen/arch/x86/setup.c  | 2 +-
 xen/include/xsm/xsm.h | 7 +++++--
 xen/xsm/xsm_core.c    | 7 ++++---
 xen/xsm/xsm_policy.c  | 2 +-
 4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index 1d5d3f8a66..689f828d6a 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -1771,7 +1771,7 @@ void __init noreturn __start_xen(unsigned long mbi_p)
     mmio_ro_ranges = rangeset_new(NULL, "r/o mmio ranges",
                                   RANGESETF_prettyprint_hex);
 
-    xsm_multiboot_init(module_map, mbi);
+    xsm_multiboot_init(module_map, mbi, mod);
 
     /*
      * IOMMU-related ACPI table parsing may require some of the system domains
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 627c0d2731..5867ccceaf 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -779,9 +779,11 @@ static inline int xsm_argo_send(const struct domain *d, const struct domain *t)
 
 #ifdef CONFIG_MULTIBOOT
 int xsm_multiboot_init(
-    unsigned long *module_map, const multiboot_info_t *mbi);
+    unsigned long *module_map, const multiboot_info_t *mbi,
+    const module_t mods[]);
 int xsm_multiboot_policy_init(
     unsigned long *module_map, const multiboot_info_t *mbi,
+    const module_t mods[],
     void **policy_buffer, size_t *policy_size);
 #endif
 
@@ -829,7 +831,8 @@ static const inline struct xsm_ops *silo_init(void)
 
 #ifdef CONFIG_MULTIBOOT
 static inline int xsm_multiboot_init (
-    unsigned long *module_map, const multiboot_info_t *mbi)
+    unsigned long *module_map, const multiboot_info_t *mbi,
+    const module_t mods[])
 {
     return 0;
 }
diff --git a/xen/xsm/xsm_core.c b/xen/xsm/xsm_core.c
index eaa028109b..82b0d76d40 100644
--- a/xen/xsm/xsm_core.c
+++ b/xen/xsm/xsm_core.c
@@ -140,7 +140,8 @@ static int __init xsm_core_init(const void *policy_buffer, size_t policy_size)
 
 #ifdef CONFIG_MULTIBOOT
 int __init xsm_multiboot_init(
-    unsigned long *module_map, const multiboot_info_t *mbi)
+    unsigned long *module_map, const multiboot_info_t *mbi,
+    const module_t mods[])
 {
     int ret = 0;
     void *policy_buffer = NULL;
@@ -150,8 +151,8 @@ int __init xsm_multiboot_init(
 
     if ( XSM_MAGIC )
     {
-        ret = xsm_multiboot_policy_init(module_map, mbi, &policy_buffer,
-                                        &policy_size);
+        ret = xsm_multiboot_policy_init(module_map, mbi, mods,
+                                        &policy_buffer, &policy_size);
         if ( ret )
         {
             bootstrap_map(NULL);
diff --git a/xen/xsm/xsm_policy.c b/xen/xsm/xsm_policy.c
index 8dafbc9381..9244a3612d 100644
--- a/xen/xsm/xsm_policy.c
+++ b/xen/xsm/xsm_policy.c
@@ -32,10 +32,10 @@
 #ifdef CONFIG_MULTIBOOT
 int __init xsm_multiboot_policy_init(
     unsigned long *module_map, const multiboot_info_t *mbi,
+    const module_t mod[],
     void **policy_buffer, size_t *policy_size)
 {
     int i;
-    module_t *mod = (module_t *)__va(mbi->mods_addr);
     int rc = 0;
     u32 *_policy_start;
     unsigned long _policy_len;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.18


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 16:33:09 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 16:33:09 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827704.1242371 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5p9V-00088f-Ce; Tue, 29 Oct 2024 16:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827704.1242371; Tue, 29 Oct 2024 16: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 1t5p9V-00088X-9k; Tue, 29 Oct 2024 16:33:05 +0000
Received: by outflank-mailman (input) for mailman id 827704;
 Tue, 29 Oct 2024 16: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 1t5p9U-00088R-J0
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 16:33:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5p9U-009NjR-1j
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 16:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5p9U-002wbP-1L
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 16: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Rework how 32bit C is linked/included for early boot
Message-Id: <E1t5p9U-002wbP-1L@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 16:33:04 +0000

commit aa9045e771307f5e2f2b6bf210420ac5be4c6af9
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Tue Oct 29 10:29:38 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 29 15:10:16 2024 +0000

    x86/boot: Rework how 32bit C is linked/included for early boot
    
    Right now, the two functions which were really too complicated to write
    in asm are compiled as 32bit PIC, linked to a blob and included
    directly, using global asm() to arrange for them to have function semantics.
    
    This is limiting and fragile; the use of data relocations will compile
    fine but malfunction when used, creating hard-to-debug bugs.
    
    Furthermore, we would like to increase the amount of C, to
    deduplicate/unify Xen's boot logic, as well as making it easier to
    follow.  Therefore, rework how the 32bit objects are included.
    
    Link all 32bit objects together first.  This allows for sharing of logic
    between translation units.  Use differential linking and explicit
    imports/exports to confirm that we only have the expected relocations,
    and write the object back out as an assembly file so it can be linked
    again as if it were 64bit, to integrate with the rest of Xen.
    
    This allows for the use of external references (e.g. access to global
    variables) with reasonable assurance of doing so safely.
    
    No functional change.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/.gitignore      |   6 +-
 xen/arch/x86/boot/Makefile        |  66 ++++++++++--
 xen/arch/x86/boot/build32.lds     |  66 ------------
 xen/arch/x86/boot/build32.lds.S   |  95 ++++++++++++++++
 xen/arch/x86/boot/cmdline.c       |  12 ---
 xen/arch/x86/boot/head.S          |  12 ---
 xen/arch/x86/boot/reloc.c         |  14 ---
 xen/tools/combine_two_binaries.py | 220 ++++++++++++++++++++++++++++++++++++++
 8 files changed, 377 insertions(+), 114 deletions(-)

diff --git a/xen/arch/x86/boot/.gitignore b/xen/arch/x86/boot/.gitignore
index a379db7988..595cef6a2c 100644
--- a/xen/arch/x86/boot/.gitignore
+++ b/xen/arch/x86/boot/.gitignore
@@ -1,3 +1,5 @@
 /mkelf32
-/*.bin
-/*.lnk
+/build32.*.lds
+/built-in-32.*.bin
+/built-in-32.*.map
+/built-in-32.S
diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index 1199291d2b..230a99a1e5 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -1,4 +1,5 @@
 obj-bin-y += head.o
+obj-bin-y += built-in-32.o
 
 obj32 := cmdline.32.o
 obj32 += reloc.32.o
@@ -9,9 +10,6 @@ targets   += $(obj32)
 
 obj32 := $(addprefix $(obj)/,$(obj32))
 
-$(obj)/head.o: AFLAGS-y += -Wa$(comma)-I$(obj)
-$(obj)/head.o: $(obj32:.32.o=.bin)
-
 CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS))
 $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
 CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float -mregparm=3
@@ -25,14 +23,66 @@ $(obj32): XEN_CFLAGS := $(CFLAGS_x86_32) -fpic
 $(obj)/%.32.o: $(src)/%.c FORCE
 	$(call if_changed_rule,cc_o_c)
 
+orphan-handling-$(call ld-option,--orphan-handling=error) := --orphan-handling=error
 LDFLAGS_DIRECT-$(call ld-option,--warn-rwx-segments) := --no-warn-rwx-segments
 LDFLAGS_DIRECT += $(LDFLAGS_DIRECT-y)
 LD32 := $(LD) $(subst x86_64,i386,$(LDFLAGS_DIRECT))
 
-%.bin: %.lnk
-	$(OBJCOPY) -j .text -O binary $< $@
+# The parameters below tweak the generated linker scripts:
+# - text_gap: padding between .text section external symbols and code.
+# - text_diff: address of the .text section.
+#
+# Note external symbols are only affected by text_diff, while internal symbols
+# are affected by both text_diff and text_gap.  Ensure the sum of gap and diff
+# is greater than 2^16 so that any 16bit relocations if present in the object
+# file turns into a build-time error.
+text_gap := 0x010200
+text_diff := 0x408020
+
+$(obj)/build32.base.lds: AFLAGS-y += -DGAP=$(text_gap) -DTEXT_DIFF=$(text_diff)
+$(obj)/build32.offset.lds: AFLAGS-y += -DGAP=$(text_gap) -DTEXT_DIFF=$(text_diff) -DFINAL
+$(obj)/build32.base.lds $(obj)/build32.offset.lds: $(src)/build32.lds.S FORCE
+	$(call if_changed_dep,cpp_lds_S)
+
+targets += build32.offset.lds build32.base.lds
+
+# Generate a single 32bit object.
+#
+# Resolve any relocations resulting from references between the translation
+# units.  This ensures the same combined object file can be used to generate
+# multiple images with slightly different linker scripts.
+$(obj)/built-in-32.tmp.o: $(obj32)
+	$(LD32) -r -o $@ $^
+
+# Link bundle with a given layout and extract a binary from it.
+# The linker will allocate GOP and resolve symbols specified in the linker
+# script.
+# The conversion to binary avoids polluting global symbols not used externally;
+# also removes conflict with needed 64 bit GOP.
+# If possible we use --orphan-handling=error option to make sure we account
+# for all possible sections from C code.
+$(obj)/built-in-32.%.bin: $(obj)/build32.%.lds $(obj)/built-in-32.tmp.o
+	$(LD32) $(orphan-handling-y) -N -T $< -Map $(@:bin=map) -o $(@:bin=o) $(filter %.o,$^)
+	$(OBJCOPY) -j .text -O binary $(@:bin=o) $@
+	rm -f $(@:bin=o)
+
+quiet_cmd_combine = GEN     $@
+cmd_combine = \
+    $(PYTHON) $(srctree)/tools/combine_two_binaries.py \
+              --gap       $(text_gap) \
+              --text-diff $(text_diff) \
+              --script    $(obj)/build32.offset.lds \
+              --bin1      $(obj)/built-in-32.base.bin \
+              --bin2      $(obj)/built-in-32.offset.bin \
+              --map       $(obj)/built-in-32.offset.map \
+              --exports   cmdline_parse_early,reloc \
+              --output    $@
+
+targets += built-in-32.S
 
-%.lnk: %.32.o $(src)/build32.lds
-	$(LD32) -N -T $(filter %.lds,$^) -o $@ $<
+# generate final object file combining and checking above binaries
+$(obj)/built-in-32.S: $(obj)/built-in-32.base.bin $(obj)/built-in-32.offset.bin \
+                      $(srctree)/tools/combine_two_binaries.py FORCE
+	$(call if_changed,combine)
 
-clean-files := *.lnk *.bin
+clean-files := built-in-32.*.bin built-in-32.*.map build32.*.lds
diff --git a/xen/arch/x86/boot/build32.lds b/xen/arch/x86/boot/build32.lds
deleted file mode 100644
index 56edaa727b..0000000000
--- a/xen/arch/x86/boot/build32.lds
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-ENTRY(_start)
-
-SECTIONS
-{
-  /* Merge code and data into one section. */
-  .text : {
-        *(.text)
-        *(.text.*)
-        *(.data)
-        *(.data.*)
-        *(.rodata)
-        *(.rodata.*)
-        *(.bss)
-        *(.bss.*)
-  }
-
-  /* Dynamic linkage sections.  Collected simply so we can check they're empty. */
-  .got : {
-        *(.got)
-  }
-  .got.plt : {
-        *(.got.plt)
-  }
-  .igot.plt : {
-        *(.igot.plt)
-  }
-  .iplt : {
-        *(.iplt)
-  }
-  .plt : {
-        *(.plt)
-  }
-  .rel : {
-        *(.rel.*)
-  }
-}
-
-ASSERT(SIZEOF(.got) == 0,         ".got non-empty")
-/*
- * At least GNU ld 2.30 and earlier fail to discard the generic part of
- * .got.plt when no actual entries were allocated. Permit this case alongside
- * the section being empty.
- */
-ASSERT(SIZEOF(.got.plt) == 0 ||
-       SIZEOF(.got.plt) == 3 * 4, "unexpected .got.plt size")
-ASSERT(SIZEOF(.igot.plt) == 0,    ".igot.plt non-empty")
-ASSERT(SIZEOF(.iplt) == 0,        ".iplt non-empty")
-ASSERT(SIZEOF(.plt) == 0,         ".plt non-empty")
-ASSERT(SIZEOF(.rel) == 0,         "leftover relocations")
diff --git a/xen/arch/x86/boot/build32.lds.S b/xen/arch/x86/boot/build32.lds.S
new file mode 100644
index 0000000000..d1b9dc6689
--- /dev/null
+++ b/xen/arch/x86/boot/build32.lds.S
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifdef FINAL
+# undef GAP
+# define GAP 0
+# define MULT 0
+# define TEXT_START
+#else
+# define MULT 1
+# define TEXT_START TEXT_DIFF
+#endif
+#define DECLARE_IMPORT(name) name = . + (__LINE__ * MULT)
+
+ENTRY(dummy_start)
+
+SECTIONS
+{
+  /* Merge code and data into one section. */
+  .text TEXT_START : {
+        /* Silence linker warning, we are not going to use it */
+        dummy_start = .;
+
+        /*
+         * Any symbols used should be declared below, this ensures which
+         * symbols are visible to the 32bit C boot code.
+         * With the exception of using external 32 bit function (maybe
+         * exported by head.S) they should point all to variables.
+         * Attention should be paid to pointers taking care of possible later
+         * relocation.
+         */
+        DECLARE_IMPORT(__base_relocs_start);
+        DECLARE_IMPORT(__base_relocs_end);
+        . = . + GAP;
+        *(.text)
+        *(.text.*)
+        *(.data)
+        *(.data.*)
+        *(.rodata)
+        *(.rodata.*)
+        *(.bss)
+        *(.bss.*)
+  }
+  /DISCARD/ : {
+       *(.comment)
+       *(.comment.*)
+       *(.note.*)
+  }
+  /* Dynamic linkage sections.  Collected simply so we can check they're empty. */
+  .got : {
+        *(.got)
+  }
+  .got.plt : {
+        *(.got.plt)
+  }
+  .igot.plt : {
+        *(.igot.plt)
+  }
+  .iplt : {
+        *(.iplt)
+  }
+  .plt : {
+        *(.plt)
+  }
+  .rel : {
+        *(.rel.*)
+  }
+}
+
+ASSERT(SIZEOF(.got) == 0,         ".got non-empty")
+/*
+ * At least GNU ld 2.30 and earlier fail to discard the generic part of
+ * .got.plt when no actual entries were allocated. Permit this case alongside
+ * the section being empty.
+ */
+ASSERT(SIZEOF(.got.plt) == 0 ||
+       SIZEOF(.got.plt) == 3 * 4, "unexpected .got.plt size")
+ASSERT(SIZEOF(.igot.plt) == 0,    ".igot.plt non-empty")
+ASSERT(SIZEOF(.iplt) == 0,        ".iplt non-empty")
+ASSERT(SIZEOF(.plt) == 0,         ".plt non-empty")
+ASSERT(SIZEOF(.rel) == 0,         "leftover relocations")
diff --git a/xen/arch/x86/boot/cmdline.c b/xen/arch/x86/boot/cmdline.c
index fc9241ede9..196c580e91 100644
--- a/xen/arch/x86/boot/cmdline.c
+++ b/xen/arch/x86/boot/cmdline.c
@@ -18,18 +18,6 @@
  * Linux kernel source (linux/lib/string.c).
  */
 
-/*
- * This entry point is entered from xen/arch/x86/boot/head.S with:
- *   - %eax      = &cmdline,
- *   - %edx      = &early_boot_opts.
- */
-asm (
-    "    .text                         \n"
-    "    .globl _start                 \n"
-    "_start:                           \n"
-    "    jmp  cmdline_parse_early      \n"
-    );
-
 #include <xen/compiler.h>
 #include <xen/kconfig.h>
 #include <xen/macros.h>
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index c4de1dfab5..e0776e3896 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -759,18 +759,6 @@ trampoline_setup:
         /* Jump into the relocated trampoline. */
         lret
 
-        /*
-         * cmdline and reloc are written in C, and linked to be 32bit PIC with
-         * entrypoints at 0 and using the fastcall convention.
-         */
-FUNC_LOCAL(cmdline_parse_early)
-        .incbin "cmdline.bin"
-END(cmdline_parse_early)
-
-FUNC_LOCAL(reloc)
-        .incbin "reloc.bin"
-END(reloc)
-
 ENTRY(trampoline_start)
 #include "trampoline.S"
 ENTRY(trampoline_end)
diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index 8c58affcd9..94b078d7b1 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -12,20 +12,6 @@
  *    Daniel Kiper <daniel.kiper@oracle.com>
  */
 
-/*
- * This entry point is entered from xen/arch/x86/boot/head.S with:
- *   - %eax       = MAGIC,
- *   - %edx       = INFORMATION_ADDRESS,
- *   - %ecx       = TOPMOST_LOW_MEMORY_STACK_ADDRESS.
- *   - 0x04(%esp) = BOOT_VIDEO_INFO_ADDRESS.
- */
-asm (
-    "    .text                         \n"
-    "    .globl _start                 \n"
-    "_start:                           \n"
-    "    jmp  reloc                    \n"
-    );
-
 #include <xen/compiler.h>
 #include <xen/macros.h>
 #include <xen/types.h>
diff --git a/xen/tools/combine_two_binaries.py b/xen/tools/combine_two_binaries.py
new file mode 100755
index 0000000000..447c0d3bdb
--- /dev/null
+++ b/xen/tools/combine_two_binaries.py
@@ -0,0 +1,220 @@
+#!/usr/bin/env python3
+
+from __future__ import print_function
+import argparse
+import functools
+import re
+import struct
+import sys
+
+parser = argparse.ArgumentParser(description='Generate assembly file to merge into other code.')
+auto_int = functools.update_wrapper(lambda x: int(x, 0), int) # allows hex
+parser.add_argument('--script', dest='script',
+                    required=True,
+                    help='Linker script for extracting symbols')
+parser.add_argument('--bin1', dest='bin1',
+                    required=True,
+                    help='First binary')
+parser.add_argument('--bin2', dest='bin2',
+                    required=True,
+                    help='Second binary')
+parser.add_argument('--gap', dest='gap',
+                    required=True,
+                    type=auto_int,
+                    help='Gap inserted at the start of code section')
+parser.add_argument('--text-diff', dest='text_diff',
+                    required=True,
+                    type=auto_int,
+                    help='Difference between code section start')
+parser.add_argument('--output', dest='output',
+                    help='Output file')
+parser.add_argument('--map', dest='mapfile',
+                    help='Map file to read for symbols to export')
+parser.add_argument('--exports', dest='exports',
+                    help='Symbols to export')
+parser.add_argument('--section-header', dest='section_header',
+                    default='.section .init.text, "ax", @progbits',
+                    help='Section header declaration')
+parser.add_argument('-v', '--verbose',
+                    action='store_true')
+args = parser.parse_args()
+
+gap = args.gap
+text_diff = args.text_diff
+
+# Parse linker script for external symbols to use.
+# Next regex matches expanded DECLARE_IMPORT lines in linker script.
+symbol_re = re.compile(r'\s+(\S+)\s*=\s*\.\s*\+\s*\((\d+)\s*\*\s*0\s*\)\s*;')
+symbols = {}
+lines = {}
+for line in open(args.script):
+    m = symbol_re.match(line)
+    if not m:
+        continue
+    (name, line_num) = (m.group(1), int(m.group(2)))
+    if line_num == 0:
+        raise Exception("Invalid line number found:\n\t" + line)
+    if line_num in symbols:
+        raise Exception("Symbol with this line already present:\n\t" + line)
+    if name in lines:
+        raise Exception("Symbol with this name already present:\n\t" + name)
+    symbols[line_num] = name
+    lines[name] = line_num
+
+exports = []
+if args.exports is not None:
+    exports = dict([(name, None) for name in args.exports.split(',')])
+
+# Parse mapfile, look for ther symbols we want to export.
+if args.mapfile is not None:
+    symbol_re = re.compile(r'\s{15,}0x([0-9a-f]+)\s+(\S+)\n')
+    for line in open(args.mapfile):
+        m = symbol_re.match(line)
+        if not m or m.group(2) not in exports:
+            continue
+        addr = int(m.group(1), 16)
+        exports[m.group(2)] = addr
+for (name, addr) in exports.items():
+    if addr is None:
+        raise Exception("Required export symbols %s not found" % name)
+
+file1 = open(args.bin1, 'rb')
+file2 = open(args.bin2, 'rb')
+file1.seek(0, 2)
+size1 = file1.tell()
+file2.seek(0, 2)
+size2 = file2.tell()
+if size1 > size2:
+    file1, file2 = file2, file1
+    size1, size2 = size2, size1
+if size2 != size1 + gap:
+    raise Exception('File sizes do not match')
+del size2
+
+file1.seek(0, 0)
+data1 = file1.read(size1)
+del file1
+file2.seek(gap, 0)
+data2 = file2.read(size1)
+del file2
+
+max_line = max(symbols.keys())
+
+def to_int32(n):
+    '''Convert a number to signed 32 bit integer truncating if needed'''
+    mask = (1 << 32) - 1
+    h = 1 << 31
+    return (n & mask) ^ h - h
+
+i = 0
+references = {}
+internals = 0
+while i <= size1 - 4:
+    n1 = struct.unpack('<I', data1[i:i+4])[0]
+    n2 = struct.unpack('<I', data2[i:i+4])[0]
+    i += 1
+    # The two numbers are the same, no problems
+    if n1 == n2:
+        continue
+    # Try to understand why they are different
+    diff = to_int32(n1 - n2)
+    if diff == -gap: # this is an internal relocation
+        pos = i - 1
+        print("Internal relocation found at position %#x "
+              "n1=%#x n2=%#x diff=%#x" % (pos, n1, n2, diff),
+              file=sys.stderr)
+        i += 3
+        internals += 1
+        if internals >= 10:
+            break
+        continue
+    # This is a relative relocation to a symbol, accepted, code/data is
+    # relocatable.
+    if diff < gap and diff >= gap - max_line:
+        n = gap - diff
+        symbol = symbols.get(n)
+        # check we have a symbol
+        if symbol is None:
+            raise Exception("Cannot find symbol for line %d" % n)
+        pos = i - 1
+        if args.verbose:
+            print('Position %#x %d %s' % (pos, n, symbol), file=sys.stderr)
+        i += 3
+        references[pos] = symbol
+        continue
+    # First byte is the same, move to next byte
+    if diff & 0xff == 0 and i <= size1 - 4:
+       continue
+    # Probably a type of relocation we don't want or support
+    pos = i - 1
+    suggestion = ''
+    symbol = symbols.get(-diff - text_diff)
+    if symbol is not None:
+        suggestion = " Maybe %s is not defined as hidden?" % symbol
+    raise Exception("Unexpected difference found at %#x "
+                    "n1=%#x n2=%#x diff=%#x gap=%#x.%s" % \
+                    (pos, n1, n2, diff, gap, suggestion))
+if internals != 0:
+    raise Exception("Previous relocations found")
+
+def line_bytes(buf, out):
+    '''Output an assembly line with all bytes in "buf"'''
+    # Python 2 compatibility
+    if type(buf) == str:
+        print("\t.byte " + ','.join([str(ord(c)) for c in buf]), file=out)
+    else:
+        print("\t.byte " + ','.join([str(n) for n in buf]), file=out)
+
+def part(start, end, out):
+    '''Output bytes of "data" from "start" to "end"'''
+    while start < end:
+        e = min(start + 16, end)
+        line_bytes(data1[start:e], out)
+        start = e
+
+def reference(pos, out):
+    name = references[pos]
+    n = struct.unpack('<I', data1[pos:pos+4])[0]
+    sign = '+'
+    if n >= (1 << 31):
+        n -= (1 << 32)
+    n += pos
+    if n < 0:
+        n = -n
+        sign = '-'
+    print("\t.hidden %s\n"
+          "\t.long %s %s %#x - ." % (name, name, sign, n),
+          file=out)
+
+def output(out):
+    prev = 0
+    exports_by_addr = {}
+    for (sym, addr) in exports.items():
+        exports_by_addr.setdefault(addr, []).append(sym)
+    positions = list(references.keys())
+    positions += list(exports_by_addr.keys())
+    for pos in sorted(positions):
+        part(prev, pos, out)
+        prev = pos
+        if pos in references:
+            reference(pos, out)
+            prev = pos + 4
+        if pos in exports_by_addr:
+            for sym in exports_by_addr[pos]:
+                print("\t.global %s\n"
+                      "\t.hidden %s\n"
+                      "%s:" % (sym, sym, sym),
+                      file=out)
+    part(prev, size1, out)
+
+out = sys.stdout
+if args.output is not None:
+    out = open(args.output, 'w')
+print('''/*
+ * File autogenerated by combine_two_binaries.py DO NOT EDIT
+ */''', file=out)
+print('\t' + args.section_header, file=out)
+print('obj32_start:', file=out)
+output(out)
+print('\n\t.section .note.GNU-stack,"",@progbits', file=out)
+out.flush()
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 16:33:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 16:33:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827705.1242374 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5p9f-0008BS-F8; Tue, 29 Oct 2024 16:33:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827705.1242374; Tue, 29 Oct 2024 16: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 1t5p9f-0008BL-Cf; Tue, 29 Oct 2024 16:33:15 +0000
Received: by outflank-mailman (input) for mailman id 827705;
 Tue, 29 Oct 2024 16: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 1t5p9e-0008BF-Lk
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 16:33:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5p9e-009Njq-25
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 16:33:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5p9e-002wc9-1v
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 16: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Reuse code to relocate trampoline
Message-Id: <E1t5p9e-002wc9-1v@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 16:33:14 +0000

commit db8acf31f96bd0778283300f743571b0985b1918
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Tue Oct 29 10:29:39 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 29 15:10:17 2024 +0000

    x86/boot: Reuse code to relocate trampoline
    
    Move code from efi-boot.h to a separate, new, reloc-trampoline.c file.
    Reuse this new code, compiling it for 32bit as well, to replace assembly
    code in head.S doing the same thing.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/arch/x86/boot/Makefile           | 10 +++++++---
 xen/arch/x86/boot/build32.lds.S      |  5 +++++
 xen/arch/x86/boot/head.S             | 23 +----------------------
 xen/arch/x86/boot/reloc-trampoline.c | 36 ++++++++++++++++++++++++++++++++++++
 xen/arch/x86/efi/efi-boot.h          | 15 ++-------------
 5 files changed, 51 insertions(+), 38 deletions(-)

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index 230a99a1e5..e102bd8c70 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -1,11 +1,15 @@
 obj-bin-y += head.o
 obj-bin-y += built-in-32.o
+obj-bin-y += $(obj64)
 
 obj32 := cmdline.32.o
 obj32 += reloc.32.o
+obj32 += reloc-trampoline.32.o
 
-nocov-y   += $(obj32)
-noubsan-y += $(obj32)
+obj64 := reloc-trampoline.o
+
+nocov-y   += $(obj32) $(obj64)
+noubsan-y += $(obj32) $(obj64)
 targets   += $(obj32)
 
 obj32 := $(addprefix $(obj)/,$(obj32))
@@ -75,7 +79,7 @@ cmd_combine = \
               --bin1      $(obj)/built-in-32.base.bin \
               --bin2      $(obj)/built-in-32.offset.bin \
               --map       $(obj)/built-in-32.offset.map \
-              --exports   cmdline_parse_early,reloc \
+              --exports   cmdline_parse_early,reloc,reloc_trampoline32 \
               --output    $@
 
 targets += built-in-32.S
diff --git a/xen/arch/x86/boot/build32.lds.S b/xen/arch/x86/boot/build32.lds.S
index d1b9dc6689..27f0d7ac3c 100644
--- a/xen/arch/x86/boot/build32.lds.S
+++ b/xen/arch/x86/boot/build32.lds.S
@@ -45,6 +45,11 @@ SECTIONS
          */
         DECLARE_IMPORT(__base_relocs_start);
         DECLARE_IMPORT(__base_relocs_end);
+        DECLARE_IMPORT(__trampoline_rel_start);
+        DECLARE_IMPORT(__trampoline_rel_stop);
+        DECLARE_IMPORT(__trampoline_seg_start);
+        DECLARE_IMPORT(__trampoline_seg_stop);
+        DECLARE_IMPORT(trampoline_phys);
         . = . + GAP;
         *(.text)
         *(.text.*)
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index e0776e3896..ade2c5c43d 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -706,28 +706,7 @@ trampoline_setup:
         mov     %edx, sym_offs(l1_bootmap)(%esi, %ecx, 8)
 
         /* Apply relocations to bootstrap trampoline. */
-        mov     sym_esi(trampoline_phys), %edx
-        lea     sym_esi(__trampoline_rel_start), %edi
-        lea     sym_esi(__trampoline_rel_stop), %ecx
-1:
-        mov     (%edi), %eax
-        add     %edx, (%edi, %eax)
-        add     $4,%edi
-
-        cmp     %ecx, %edi
-        jb      1b
-
-        /* Patch in the trampoline segment. */
-        shr     $4,%edx
-        lea     sym_esi(__trampoline_seg_start), %edi
-        lea     sym_esi(__trampoline_seg_stop), %ecx
-1:
-        mov     (%edi), %eax
-        mov     %dx, (%edi, %eax)
-        add     $4,%edi
-
-        cmp     %ecx, %edi
-        jb      1b
+        call    reloc_trampoline32
 
         /* Do not parse command line on EFI platform here. */
         cmpb    $0, sym_esi(efi_platform)
diff --git a/xen/arch/x86/boot/reloc-trampoline.c b/xen/arch/x86/boot/reloc-trampoline.c
new file mode 100644
index 0000000000..0a74c1e75a
--- /dev/null
+++ b/xen/arch/x86/boot/reloc-trampoline.c
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <xen/compiler.h>
+#include <xen/stdint.h>
+#include <asm/trampoline.h>
+
+extern const int32_t __trampoline_rel_start[], __trampoline_rel_stop[];
+extern const int32_t __trampoline_seg_start[], __trampoline_seg_stop[];
+
+#if defined(__i386__)
+void reloc_trampoline32(void)
+#elif defined (__x86_64__)
+void reloc_trampoline64(void)
+#else
+#error Unknown architecture
+#endif
+{
+    unsigned long phys = trampoline_phys;
+    const int32_t *trampoline_ptr;
+
+    /*
+     * Apply relocations to trampoline.
+     *
+     * This modifies the trampoline in place within Xen, so that it will
+     * operate correctly when copied into place.
+     */
+    for ( trampoline_ptr = __trampoline_rel_start;
+          trampoline_ptr < __trampoline_rel_stop;
+          ++trampoline_ptr )
+        *(uint32_t *)(*trampoline_ptr + (long)trampoline_ptr) += phys;
+
+    for ( trampoline_ptr = __trampoline_seg_start;
+          trampoline_ptr < __trampoline_seg_stop;
+          ++trampoline_ptr )
+        *(uint16_t *)(*trampoline_ptr + (long)trampoline_ptr) = phys >> 4;
+}
diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index 3b26f0b0f5..3133985c88 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -103,27 +103,16 @@ static void __init efi_arch_relocate_image(unsigned long delta)
     }
 }
 
-extern const int32_t __trampoline_rel_start[], __trampoline_rel_stop[];
-extern const int32_t __trampoline_seg_start[], __trampoline_seg_stop[];
+void reloc_trampoline64(void);
 
 static void __init relocate_trampoline(unsigned long phys)
 {
-    const int32_t *trampoline_ptr;
-
     trampoline_phys = phys;
 
     if ( !efi_enabled(EFI_LOADER) )
         return;
 
-    /* Apply relocations to trampoline. */
-    for ( trampoline_ptr = __trampoline_rel_start;
-          trampoline_ptr < __trampoline_rel_stop;
-          ++trampoline_ptr )
-        *(u32 *)(*trampoline_ptr + (long)trampoline_ptr) += phys;
-    for ( trampoline_ptr = __trampoline_seg_start;
-          trampoline_ptr < __trampoline_seg_stop;
-          ++trampoline_ptr )
-        *(u16 *)(*trampoline_ptr + (long)trampoline_ptr) = phys >> 4;
+    reloc_trampoline64();
 }
 
 static void __init place_string(u32 *addr, const char *s)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 16:33:25 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 16:33:25 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827706.1242380 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5p9p-0008Ei-H0; Tue, 29 Oct 2024 16:33:25 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827706.1242380; Tue, 29 Oct 2024 16: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 1t5p9p-0008Ea-E9; Tue, 29 Oct 2024 16:33:25 +0000
Received: by outflank-mailman (input) for mailman id 827706;
 Tue, 29 Oct 2024 16: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 1t5p9o-0008EK-Ou
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 16:33:24 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5p9o-009Nm3-2M
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 16:33:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5p9o-002wgF-2F
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 16: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Use boot_vid_info variable directly from C code
Message-Id: <E1t5p9o-002wgF-2F@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 16:33:24 +0000

commit d5a73cdc6b90eb4bed55994588ea3f4c0070fc7d
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Tue Oct 29 10:29:40 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 29 15:10:17 2024 +0000

    x86/boot: Use boot_vid_info variable directly from C code
    
    No more need to pass from assembly code.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/build32.lds.S |  1 +
 xen/arch/x86/boot/head.S        | 10 +---------
 xen/arch/x86/boot/reloc.c       | 13 +++++--------
 3 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/boot/build32.lds.S b/xen/arch/x86/boot/build32.lds.S
index 27f0d7ac3c..f20fc18977 100644
--- a/xen/arch/x86/boot/build32.lds.S
+++ b/xen/arch/x86/boot/build32.lds.S
@@ -50,6 +50,7 @@ SECTIONS
         DECLARE_IMPORT(__trampoline_seg_start);
         DECLARE_IMPORT(__trampoline_seg_stop);
         DECLARE_IMPORT(trampoline_phys);
+        DECLARE_IMPORT(boot_vid_info);
         . = . + GAP;
         *(.text)
         *(.text.*)
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index ade2c5c43d..5da7ac138f 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -514,18 +514,10 @@ trampoline_setup:
         mov     sym_esi(trampoline_phys), %ecx
         add     $TRAMPOLINE_SPACE,%ecx
 
-#ifdef CONFIG_VIDEO
-        lea     sym_esi(boot_vid_info), %edx
-#else
-        xor     %edx, %edx
-#endif
-
         /* Save Multiboot / PVH info struct (after relocation) for later use. */
-        push    %edx                /* Boot video info to be filled from MB2. */
         mov     %ebx, %edx          /* Multiboot / PVH information address. */
-        /*      reloc(magic/eax, info/edx, trampoline/ecx, video/stk) using fastcall. */
+        /*      reloc(magic/eax, info/edx, trampoline/ecx) using fastcall. */
         call    reloc
-        add     $4, %esp
 
 #ifdef CONFIG_PVH_GUEST
         cmpb    $0, sym_esi(pvh_boot)
diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index 94b078d7b1..707d9c5f15 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -176,7 +176,7 @@ static multiboot_info_t *mbi_reloc(uint32_t mbi_in, memctx *ctx)
     return mbi_out;
 }
 
-static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out, memctx *ctx)
+static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, memctx *ctx)
 {
     const multiboot2_fixed_t *mbi_fix = _p(mbi_in);
     const multiboot2_memory_map_t *mmap_src;
@@ -185,7 +185,7 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out, memctx
     memory_map_t *mmap_dst;
     multiboot_info_t *mbi_out;
 #ifdef CONFIG_VIDEO
-    struct boot_video_info *video = NULL;
+    struct boot_video_info *video = &boot_vid_info;
 #endif
     uint32_t ptr;
     unsigned int i, mod_idx = 0;
@@ -290,12 +290,11 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out, memctx
 
 #ifdef CONFIG_VIDEO
         case MULTIBOOT2_TAG_TYPE_VBE:
-            if ( video_out )
+            if ( video )
             {
                 const struct vesa_ctrl_info *ci;
                 const struct vesa_mode_info *mi;
 
-                video = _p(video_out);
                 ci = (const void *)get_mb2_data(tag, vbe, vbe_control_info);
                 mi = (const void *)get_mb2_data(tag, vbe, vbe_mode_info);
 
@@ -321,7 +320,6 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out, memctx
             if ( (get_mb2_data(tag, framebuffer, framebuffer_type) !=
                   MULTIBOOT2_FRAMEBUFFER_TYPE_RGB) )
             {
-                video_out = 0;
                 video = NULL;
             }
             break;
@@ -346,8 +344,7 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out, memctx
 }
 
 /* SAF-1-safe */
-void *reloc(uint32_t magic, uint32_t in, uint32_t trampoline,
-            uint32_t video_info)
+void *reloc(uint32_t magic, uint32_t in, uint32_t trampoline)
 {
     memctx ctx = { trampoline };
 
@@ -357,7 +354,7 @@ void *reloc(uint32_t magic, uint32_t in, uint32_t trampoline,
         return mbi_reloc(in, &ctx);
 
     case MULTIBOOT2_BOOTLOADER_MAGIC:
-        return mbi2_reloc(in, video_info, &ctx);
+        return mbi2_reloc(in, &ctx);
 
     case XEN_HVM_START_MAGIC_VALUE:
         if ( IS_ENABLED(CONFIG_PVH_GUEST) )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 16:33:35 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 16:33:35 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827707.1242383 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5p9z-0008IP-IH; Tue, 29 Oct 2024 16:33:35 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827707.1242383; Tue, 29 Oct 2024 16:33: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 1t5p9z-0008IF-FX; Tue, 29 Oct 2024 16:33:35 +0000
Received: by outflank-mailman (input) for mailman id 827707;
 Tue, 29 Oct 2024 16:33: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 1t5p9y-0008I8-Vc
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 16:33:34 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5p9y-009NmC-2t
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 16:33:34 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5p9y-002wgz-2W
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 16:33: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/boot: Use trampoline_phys variable directly from C code
Message-Id: <E1t5p9y-002wgz-2W@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 16:33:34 +0000

commit 56bd76925ec35085528d778e46123b9d10a66018
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Tue Oct 29 10:29:41 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 29 15:10:17 2024 +0000

    x86/boot: Use trampoline_phys variable directly from C code
    
    No more need to pass from assembly code.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/head.S  | 6 +-----
 xen/arch/x86/boot/reloc.c | 8 ++++++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 5da7ac138f..dcda91cfda 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -510,13 +510,9 @@ trampoline_setup:
         mov     %esi, sym_esi(xen_phys_start)
         mov     %esi, sym_esi(trampoline_xen_phys_start)
 
-        /* Get bottom-most low-memory stack address. */
-        mov     sym_esi(trampoline_phys), %ecx
-        add     $TRAMPOLINE_SPACE,%ecx
-
         /* Save Multiboot / PVH info struct (after relocation) for later use. */
         mov     %ebx, %edx          /* Multiboot / PVH information address. */
-        /*      reloc(magic/eax, info/edx, trampoline/ecx) using fastcall. */
+        /*      reloc(magic/eax, info/edx) using fastcall. */
         call    reloc
 
 #ifdef CONFIG_PVH_GUEST
diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index 707d9c5f15..e50e161b27 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -19,6 +19,9 @@
 #include <xen/kconfig.h>
 #include <xen/multiboot.h>
 #include <xen/multiboot2.h>
+#include <xen/page-size.h>
+
+#include <asm/trampoline.h>
 
 #include <public/arch-x86/hvm/start_info.h>
 
@@ -344,9 +347,10 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, memctx *ctx)
 }
 
 /* SAF-1-safe */
-void *reloc(uint32_t magic, uint32_t in, uint32_t trampoline)
+void *reloc(uint32_t magic, uint32_t in)
 {
-    memctx ctx = { trampoline };
+    /* Get bottom-most low-memory stack address. */
+    memctx ctx = { trampoline_phys + TRAMPOLINE_SPACE };
 
     switch ( magic )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 18:44:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 18:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827855.1242601 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5rCP-0000Lf-JH; Tue, 29 Oct 2024 18:44:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827855.1242601; Tue, 29 Oct 2024 18:44:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5rCP-0000LY-Gt; Tue, 29 Oct 2024 18:44:13 +0000
Received: by outflank-mailman (input) for mailman id 827855;
 Tue, 29 Oct 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 1t5rCO-0000LQ-0w
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 18:44:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5rCO-009QHu-00
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 18:44:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5rCN-003FgY-34
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Reuse code to relocate trampoline
Message-Id: <E1t5rCN-003FgY-34@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 18:44:11 +0000

commit db8acf31f96bd0778283300f743571b0985b1918
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Tue Oct 29 10:29:39 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 29 15:10:17 2024 +0000

    x86/boot: Reuse code to relocate trampoline
    
    Move code from efi-boot.h to a separate, new, reloc-trampoline.c file.
    Reuse this new code, compiling it for 32bit as well, to replace assembly
    code in head.S doing the same thing.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
 xen/arch/x86/boot/Makefile           | 10 +++++++---
 xen/arch/x86/boot/build32.lds.S      |  5 +++++
 xen/arch/x86/boot/head.S             | 23 +----------------------
 xen/arch/x86/boot/reloc-trampoline.c | 36 ++++++++++++++++++++++++++++++++++++
 xen/arch/x86/efi/efi-boot.h          | 15 ++-------------
 5 files changed, 51 insertions(+), 38 deletions(-)

diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index 230a99a1e5..e102bd8c70 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -1,11 +1,15 @@
 obj-bin-y += head.o
 obj-bin-y += built-in-32.o
+obj-bin-y += $(obj64)
 
 obj32 := cmdline.32.o
 obj32 += reloc.32.o
+obj32 += reloc-trampoline.32.o
 
-nocov-y   += $(obj32)
-noubsan-y += $(obj32)
+obj64 := reloc-trampoline.o
+
+nocov-y   += $(obj32) $(obj64)
+noubsan-y += $(obj32) $(obj64)
 targets   += $(obj32)
 
 obj32 := $(addprefix $(obj)/,$(obj32))
@@ -75,7 +79,7 @@ cmd_combine = \
               --bin1      $(obj)/built-in-32.base.bin \
               --bin2      $(obj)/built-in-32.offset.bin \
               --map       $(obj)/built-in-32.offset.map \
-              --exports   cmdline_parse_early,reloc \
+              --exports   cmdline_parse_early,reloc,reloc_trampoline32 \
               --output    $@
 
 targets += built-in-32.S
diff --git a/xen/arch/x86/boot/build32.lds.S b/xen/arch/x86/boot/build32.lds.S
index d1b9dc6689..27f0d7ac3c 100644
--- a/xen/arch/x86/boot/build32.lds.S
+++ b/xen/arch/x86/boot/build32.lds.S
@@ -45,6 +45,11 @@ SECTIONS
          */
         DECLARE_IMPORT(__base_relocs_start);
         DECLARE_IMPORT(__base_relocs_end);
+        DECLARE_IMPORT(__trampoline_rel_start);
+        DECLARE_IMPORT(__trampoline_rel_stop);
+        DECLARE_IMPORT(__trampoline_seg_start);
+        DECLARE_IMPORT(__trampoline_seg_stop);
+        DECLARE_IMPORT(trampoline_phys);
         . = . + GAP;
         *(.text)
         *(.text.*)
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index e0776e3896..ade2c5c43d 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -706,28 +706,7 @@ trampoline_setup:
         mov     %edx, sym_offs(l1_bootmap)(%esi, %ecx, 8)
 
         /* Apply relocations to bootstrap trampoline. */
-        mov     sym_esi(trampoline_phys), %edx
-        lea     sym_esi(__trampoline_rel_start), %edi
-        lea     sym_esi(__trampoline_rel_stop), %ecx
-1:
-        mov     (%edi), %eax
-        add     %edx, (%edi, %eax)
-        add     $4,%edi
-
-        cmp     %ecx, %edi
-        jb      1b
-
-        /* Patch in the trampoline segment. */
-        shr     $4,%edx
-        lea     sym_esi(__trampoline_seg_start), %edi
-        lea     sym_esi(__trampoline_seg_stop), %ecx
-1:
-        mov     (%edi), %eax
-        mov     %dx, (%edi, %eax)
-        add     $4,%edi
-
-        cmp     %ecx, %edi
-        jb      1b
+        call    reloc_trampoline32
 
         /* Do not parse command line on EFI platform here. */
         cmpb    $0, sym_esi(efi_platform)
diff --git a/xen/arch/x86/boot/reloc-trampoline.c b/xen/arch/x86/boot/reloc-trampoline.c
new file mode 100644
index 0000000000..0a74c1e75a
--- /dev/null
+++ b/xen/arch/x86/boot/reloc-trampoline.c
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <xen/compiler.h>
+#include <xen/stdint.h>
+#include <asm/trampoline.h>
+
+extern const int32_t __trampoline_rel_start[], __trampoline_rel_stop[];
+extern const int32_t __trampoline_seg_start[], __trampoline_seg_stop[];
+
+#if defined(__i386__)
+void reloc_trampoline32(void)
+#elif defined (__x86_64__)
+void reloc_trampoline64(void)
+#else
+#error Unknown architecture
+#endif
+{
+    unsigned long phys = trampoline_phys;
+    const int32_t *trampoline_ptr;
+
+    /*
+     * Apply relocations to trampoline.
+     *
+     * This modifies the trampoline in place within Xen, so that it will
+     * operate correctly when copied into place.
+     */
+    for ( trampoline_ptr = __trampoline_rel_start;
+          trampoline_ptr < __trampoline_rel_stop;
+          ++trampoline_ptr )
+        *(uint32_t *)(*trampoline_ptr + (long)trampoline_ptr) += phys;
+
+    for ( trampoline_ptr = __trampoline_seg_start;
+          trampoline_ptr < __trampoline_seg_stop;
+          ++trampoline_ptr )
+        *(uint16_t *)(*trampoline_ptr + (long)trampoline_ptr) = phys >> 4;
+}
diff --git a/xen/arch/x86/efi/efi-boot.h b/xen/arch/x86/efi/efi-boot.h
index 3b26f0b0f5..3133985c88 100644
--- a/xen/arch/x86/efi/efi-boot.h
+++ b/xen/arch/x86/efi/efi-boot.h
@@ -103,27 +103,16 @@ static void __init efi_arch_relocate_image(unsigned long delta)
     }
 }
 
-extern const int32_t __trampoline_rel_start[], __trampoline_rel_stop[];
-extern const int32_t __trampoline_seg_start[], __trampoline_seg_stop[];
+void reloc_trampoline64(void);
 
 static void __init relocate_trampoline(unsigned long phys)
 {
-    const int32_t *trampoline_ptr;
-
     trampoline_phys = phys;
 
     if ( !efi_enabled(EFI_LOADER) )
         return;
 
-    /* Apply relocations to trampoline. */
-    for ( trampoline_ptr = __trampoline_rel_start;
-          trampoline_ptr < __trampoline_rel_stop;
-          ++trampoline_ptr )
-        *(u32 *)(*trampoline_ptr + (long)trampoline_ptr) += phys;
-    for ( trampoline_ptr = __trampoline_seg_start;
-          trampoline_ptr < __trampoline_seg_stop;
-          ++trampoline_ptr )
-        *(u16 *)(*trampoline_ptr + (long)trampoline_ptr) = phys >> 4;
+    reloc_trampoline64();
 }
 
 static void __init place_string(u32 *addr, const char *s)
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 18:44:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 18:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827854.1242596 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5rCF-0000Jd-GD; Tue, 29 Oct 2024 18:44:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827854.1242596; Tue, 29 Oct 2024 18:44:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5rCF-0000JW-DR; Tue, 29 Oct 2024 18:44:03 +0000
Received: by outflank-mailman (input) for mailman id 827854;
 Tue, 29 Oct 2024 18: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 1t5rCE-0000JQ-1F
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 18:44:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5rCD-009QHq-2s
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 18:44:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5rCD-003FfR-2f
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Rework how 32bit C is linked/included for early boot
Message-Id: <E1t5rCD-003FfR-2f@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 18:44:01 +0000

commit aa9045e771307f5e2f2b6bf210420ac5be4c6af9
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Tue Oct 29 10:29:38 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 29 15:10:16 2024 +0000

    x86/boot: Rework how 32bit C is linked/included for early boot
    
    Right now, the two functions which were really too complicated to write
    in asm are compiled as 32bit PIC, linked to a blob and included
    directly, using global asm() to arrange for them to have function semantics.
    
    This is limiting and fragile; the use of data relocations will compile
    fine but malfunction when used, creating hard-to-debug bugs.
    
    Furthermore, we would like to increase the amount of C, to
    deduplicate/unify Xen's boot logic, as well as making it easier to
    follow.  Therefore, rework how the 32bit objects are included.
    
    Link all 32bit objects together first.  This allows for sharing of logic
    between translation units.  Use differential linking and explicit
    imports/exports to confirm that we only have the expected relocations,
    and write the object back out as an assembly file so it can be linked
    again as if it were 64bit, to integrate with the rest of Xen.
    
    This allows for the use of external references (e.g. access to global
    variables) with reasonable assurance of doing so safely.
    
    No functional change.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Anthony PERARD <anthony.perard@vates.tech>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/.gitignore      |   6 +-
 xen/arch/x86/boot/Makefile        |  66 ++++++++++--
 xen/arch/x86/boot/build32.lds     |  66 ------------
 xen/arch/x86/boot/build32.lds.S   |  95 ++++++++++++++++
 xen/arch/x86/boot/cmdline.c       |  12 ---
 xen/arch/x86/boot/head.S          |  12 ---
 xen/arch/x86/boot/reloc.c         |  14 ---
 xen/tools/combine_two_binaries.py | 220 ++++++++++++++++++++++++++++++++++++++
 8 files changed, 377 insertions(+), 114 deletions(-)

diff --git a/xen/arch/x86/boot/.gitignore b/xen/arch/x86/boot/.gitignore
index a379db7988..595cef6a2c 100644
--- a/xen/arch/x86/boot/.gitignore
+++ b/xen/arch/x86/boot/.gitignore
@@ -1,3 +1,5 @@
 /mkelf32
-/*.bin
-/*.lnk
+/build32.*.lds
+/built-in-32.*.bin
+/built-in-32.*.map
+/built-in-32.S
diff --git a/xen/arch/x86/boot/Makefile b/xen/arch/x86/boot/Makefile
index 1199291d2b..230a99a1e5 100644
--- a/xen/arch/x86/boot/Makefile
+++ b/xen/arch/x86/boot/Makefile
@@ -1,4 +1,5 @@
 obj-bin-y += head.o
+obj-bin-y += built-in-32.o
 
 obj32 := cmdline.32.o
 obj32 += reloc.32.o
@@ -9,9 +10,6 @@ targets   += $(obj32)
 
 obj32 := $(addprefix $(obj)/,$(obj32))
 
-$(obj)/head.o: AFLAGS-y += -Wa$(comma)-I$(obj)
-$(obj)/head.o: $(obj32:.32.o=.bin)
-
 CFLAGS_x86_32 := $(subst -m64,-m32 -march=i686,$(XEN_TREEWIDE_CFLAGS))
 $(call cc-options-add,CFLAGS_x86_32,CC,$(EMBEDDED_EXTRA_CFLAGS))
 CFLAGS_x86_32 += -Werror -fno-builtin -g0 -msoft-float -mregparm=3
@@ -25,14 +23,66 @@ $(obj32): XEN_CFLAGS := $(CFLAGS_x86_32) -fpic
 $(obj)/%.32.o: $(src)/%.c FORCE
 	$(call if_changed_rule,cc_o_c)
 
+orphan-handling-$(call ld-option,--orphan-handling=error) := --orphan-handling=error
 LDFLAGS_DIRECT-$(call ld-option,--warn-rwx-segments) := --no-warn-rwx-segments
 LDFLAGS_DIRECT += $(LDFLAGS_DIRECT-y)
 LD32 := $(LD) $(subst x86_64,i386,$(LDFLAGS_DIRECT))
 
-%.bin: %.lnk
-	$(OBJCOPY) -j .text -O binary $< $@
+# The parameters below tweak the generated linker scripts:
+# - text_gap: padding between .text section external symbols and code.
+# - text_diff: address of the .text section.
+#
+# Note external symbols are only affected by text_diff, while internal symbols
+# are affected by both text_diff and text_gap.  Ensure the sum of gap and diff
+# is greater than 2^16 so that any 16bit relocations if present in the object
+# file turns into a build-time error.
+text_gap := 0x010200
+text_diff := 0x408020
+
+$(obj)/build32.base.lds: AFLAGS-y += -DGAP=$(text_gap) -DTEXT_DIFF=$(text_diff)
+$(obj)/build32.offset.lds: AFLAGS-y += -DGAP=$(text_gap) -DTEXT_DIFF=$(text_diff) -DFINAL
+$(obj)/build32.base.lds $(obj)/build32.offset.lds: $(src)/build32.lds.S FORCE
+	$(call if_changed_dep,cpp_lds_S)
+
+targets += build32.offset.lds build32.base.lds
+
+# Generate a single 32bit object.
+#
+# Resolve any relocations resulting from references between the translation
+# units.  This ensures the same combined object file can be used to generate
+# multiple images with slightly different linker scripts.
+$(obj)/built-in-32.tmp.o: $(obj32)
+	$(LD32) -r -o $@ $^
+
+# Link bundle with a given layout and extract a binary from it.
+# The linker will allocate GOP and resolve symbols specified in the linker
+# script.
+# The conversion to binary avoids polluting global symbols not used externally;
+# also removes conflict with needed 64 bit GOP.
+# If possible we use --orphan-handling=error option to make sure we account
+# for all possible sections from C code.
+$(obj)/built-in-32.%.bin: $(obj)/build32.%.lds $(obj)/built-in-32.tmp.o
+	$(LD32) $(orphan-handling-y) -N -T $< -Map $(@:bin=map) -o $(@:bin=o) $(filter %.o,$^)
+	$(OBJCOPY) -j .text -O binary $(@:bin=o) $@
+	rm -f $(@:bin=o)
+
+quiet_cmd_combine = GEN     $@
+cmd_combine = \
+    $(PYTHON) $(srctree)/tools/combine_two_binaries.py \
+              --gap       $(text_gap) \
+              --text-diff $(text_diff) \
+              --script    $(obj)/build32.offset.lds \
+              --bin1      $(obj)/built-in-32.base.bin \
+              --bin2      $(obj)/built-in-32.offset.bin \
+              --map       $(obj)/built-in-32.offset.map \
+              --exports   cmdline_parse_early,reloc \
+              --output    $@
+
+targets += built-in-32.S
 
-%.lnk: %.32.o $(src)/build32.lds
-	$(LD32) -N -T $(filter %.lds,$^) -o $@ $<
+# generate final object file combining and checking above binaries
+$(obj)/built-in-32.S: $(obj)/built-in-32.base.bin $(obj)/built-in-32.offset.bin \
+                      $(srctree)/tools/combine_two_binaries.py FORCE
+	$(call if_changed,combine)
 
-clean-files := *.lnk *.bin
+clean-files := built-in-32.*.bin built-in-32.*.map build32.*.lds
diff --git a/xen/arch/x86/boot/build32.lds b/xen/arch/x86/boot/build32.lds
deleted file mode 100644
index 56edaa727b..0000000000
--- a/xen/arch/x86/boot/build32.lds
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-
-ENTRY(_start)
-
-SECTIONS
-{
-  /* Merge code and data into one section. */
-  .text : {
-        *(.text)
-        *(.text.*)
-        *(.data)
-        *(.data.*)
-        *(.rodata)
-        *(.rodata.*)
-        *(.bss)
-        *(.bss.*)
-  }
-
-  /* Dynamic linkage sections.  Collected simply so we can check they're empty. */
-  .got : {
-        *(.got)
-  }
-  .got.plt : {
-        *(.got.plt)
-  }
-  .igot.plt : {
-        *(.igot.plt)
-  }
-  .iplt : {
-        *(.iplt)
-  }
-  .plt : {
-        *(.plt)
-  }
-  .rel : {
-        *(.rel.*)
-  }
-}
-
-ASSERT(SIZEOF(.got) == 0,         ".got non-empty")
-/*
- * At least GNU ld 2.30 and earlier fail to discard the generic part of
- * .got.plt when no actual entries were allocated. Permit this case alongside
- * the section being empty.
- */
-ASSERT(SIZEOF(.got.plt) == 0 ||
-       SIZEOF(.got.plt) == 3 * 4, "unexpected .got.plt size")
-ASSERT(SIZEOF(.igot.plt) == 0,    ".igot.plt non-empty")
-ASSERT(SIZEOF(.iplt) == 0,        ".iplt non-empty")
-ASSERT(SIZEOF(.plt) == 0,         ".plt non-empty")
-ASSERT(SIZEOF(.rel) == 0,         "leftover relocations")
diff --git a/xen/arch/x86/boot/build32.lds.S b/xen/arch/x86/boot/build32.lds.S
new file mode 100644
index 0000000000..d1b9dc6689
--- /dev/null
+++ b/xen/arch/x86/boot/build32.lds.S
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifdef FINAL
+# undef GAP
+# define GAP 0
+# define MULT 0
+# define TEXT_START
+#else
+# define MULT 1
+# define TEXT_START TEXT_DIFF
+#endif
+#define DECLARE_IMPORT(name) name = . + (__LINE__ * MULT)
+
+ENTRY(dummy_start)
+
+SECTIONS
+{
+  /* Merge code and data into one section. */
+  .text TEXT_START : {
+        /* Silence linker warning, we are not going to use it */
+        dummy_start = .;
+
+        /*
+         * Any symbols used should be declared below, this ensures which
+         * symbols are visible to the 32bit C boot code.
+         * With the exception of using external 32 bit function (maybe
+         * exported by head.S) they should point all to variables.
+         * Attention should be paid to pointers taking care of possible later
+         * relocation.
+         */
+        DECLARE_IMPORT(__base_relocs_start);
+        DECLARE_IMPORT(__base_relocs_end);
+        . = . + GAP;
+        *(.text)
+        *(.text.*)
+        *(.data)
+        *(.data.*)
+        *(.rodata)
+        *(.rodata.*)
+        *(.bss)
+        *(.bss.*)
+  }
+  /DISCARD/ : {
+       *(.comment)
+       *(.comment.*)
+       *(.note.*)
+  }
+  /* Dynamic linkage sections.  Collected simply so we can check they're empty. */
+  .got : {
+        *(.got)
+  }
+  .got.plt : {
+        *(.got.plt)
+  }
+  .igot.plt : {
+        *(.igot.plt)
+  }
+  .iplt : {
+        *(.iplt)
+  }
+  .plt : {
+        *(.plt)
+  }
+  .rel : {
+        *(.rel.*)
+  }
+}
+
+ASSERT(SIZEOF(.got) == 0,         ".got non-empty")
+/*
+ * At least GNU ld 2.30 and earlier fail to discard the generic part of
+ * .got.plt when no actual entries were allocated. Permit this case alongside
+ * the section being empty.
+ */
+ASSERT(SIZEOF(.got.plt) == 0 ||
+       SIZEOF(.got.plt) == 3 * 4, "unexpected .got.plt size")
+ASSERT(SIZEOF(.igot.plt) == 0,    ".igot.plt non-empty")
+ASSERT(SIZEOF(.iplt) == 0,        ".iplt non-empty")
+ASSERT(SIZEOF(.plt) == 0,         ".plt non-empty")
+ASSERT(SIZEOF(.rel) == 0,         "leftover relocations")
diff --git a/xen/arch/x86/boot/cmdline.c b/xen/arch/x86/boot/cmdline.c
index fc9241ede9..196c580e91 100644
--- a/xen/arch/x86/boot/cmdline.c
+++ b/xen/arch/x86/boot/cmdline.c
@@ -18,18 +18,6 @@
  * Linux kernel source (linux/lib/string.c).
  */
 
-/*
- * This entry point is entered from xen/arch/x86/boot/head.S with:
- *   - %eax      = &cmdline,
- *   - %edx      = &early_boot_opts.
- */
-asm (
-    "    .text                         \n"
-    "    .globl _start                 \n"
-    "_start:                           \n"
-    "    jmp  cmdline_parse_early      \n"
-    );
-
 #include <xen/compiler.h>
 #include <xen/kconfig.h>
 #include <xen/macros.h>
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index c4de1dfab5..e0776e3896 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -759,18 +759,6 @@ trampoline_setup:
         /* Jump into the relocated trampoline. */
         lret
 
-        /*
-         * cmdline and reloc are written in C, and linked to be 32bit PIC with
-         * entrypoints at 0 and using the fastcall convention.
-         */
-FUNC_LOCAL(cmdline_parse_early)
-        .incbin "cmdline.bin"
-END(cmdline_parse_early)
-
-FUNC_LOCAL(reloc)
-        .incbin "reloc.bin"
-END(reloc)
-
 ENTRY(trampoline_start)
 #include "trampoline.S"
 ENTRY(trampoline_end)
diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index 8c58affcd9..94b078d7b1 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -12,20 +12,6 @@
  *    Daniel Kiper <daniel.kiper@oracle.com>
  */
 
-/*
- * This entry point is entered from xen/arch/x86/boot/head.S with:
- *   - %eax       = MAGIC,
- *   - %edx       = INFORMATION_ADDRESS,
- *   - %ecx       = TOPMOST_LOW_MEMORY_STACK_ADDRESS.
- *   - 0x04(%esp) = BOOT_VIDEO_INFO_ADDRESS.
- */
-asm (
-    "    .text                         \n"
-    "    .globl _start                 \n"
-    "_start:                           \n"
-    "    jmp  reloc                    \n"
-    );
-
 #include <xen/compiler.h>
 #include <xen/macros.h>
 #include <xen/types.h>
diff --git a/xen/tools/combine_two_binaries.py b/xen/tools/combine_two_binaries.py
new file mode 100755
index 0000000000..447c0d3bdb
--- /dev/null
+++ b/xen/tools/combine_two_binaries.py
@@ -0,0 +1,220 @@
+#!/usr/bin/env python3
+
+from __future__ import print_function
+import argparse
+import functools
+import re
+import struct
+import sys
+
+parser = argparse.ArgumentParser(description='Generate assembly file to merge into other code.')
+auto_int = functools.update_wrapper(lambda x: int(x, 0), int) # allows hex
+parser.add_argument('--script', dest='script',
+                    required=True,
+                    help='Linker script for extracting symbols')
+parser.add_argument('--bin1', dest='bin1',
+                    required=True,
+                    help='First binary')
+parser.add_argument('--bin2', dest='bin2',
+                    required=True,
+                    help='Second binary')
+parser.add_argument('--gap', dest='gap',
+                    required=True,
+                    type=auto_int,
+                    help='Gap inserted at the start of code section')
+parser.add_argument('--text-diff', dest='text_diff',
+                    required=True,
+                    type=auto_int,
+                    help='Difference between code section start')
+parser.add_argument('--output', dest='output',
+                    help='Output file')
+parser.add_argument('--map', dest='mapfile',
+                    help='Map file to read for symbols to export')
+parser.add_argument('--exports', dest='exports',
+                    help='Symbols to export')
+parser.add_argument('--section-header', dest='section_header',
+                    default='.section .init.text, "ax", @progbits',
+                    help='Section header declaration')
+parser.add_argument('-v', '--verbose',
+                    action='store_true')
+args = parser.parse_args()
+
+gap = args.gap
+text_diff = args.text_diff
+
+# Parse linker script for external symbols to use.
+# Next regex matches expanded DECLARE_IMPORT lines in linker script.
+symbol_re = re.compile(r'\s+(\S+)\s*=\s*\.\s*\+\s*\((\d+)\s*\*\s*0\s*\)\s*;')
+symbols = {}
+lines = {}
+for line in open(args.script):
+    m = symbol_re.match(line)
+    if not m:
+        continue
+    (name, line_num) = (m.group(1), int(m.group(2)))
+    if line_num == 0:
+        raise Exception("Invalid line number found:\n\t" + line)
+    if line_num in symbols:
+        raise Exception("Symbol with this line already present:\n\t" + line)
+    if name in lines:
+        raise Exception("Symbol with this name already present:\n\t" + name)
+    symbols[line_num] = name
+    lines[name] = line_num
+
+exports = []
+if args.exports is not None:
+    exports = dict([(name, None) for name in args.exports.split(',')])
+
+# Parse mapfile, look for ther symbols we want to export.
+if args.mapfile is not None:
+    symbol_re = re.compile(r'\s{15,}0x([0-9a-f]+)\s+(\S+)\n')
+    for line in open(args.mapfile):
+        m = symbol_re.match(line)
+        if not m or m.group(2) not in exports:
+            continue
+        addr = int(m.group(1), 16)
+        exports[m.group(2)] = addr
+for (name, addr) in exports.items():
+    if addr is None:
+        raise Exception("Required export symbols %s not found" % name)
+
+file1 = open(args.bin1, 'rb')
+file2 = open(args.bin2, 'rb')
+file1.seek(0, 2)
+size1 = file1.tell()
+file2.seek(0, 2)
+size2 = file2.tell()
+if size1 > size2:
+    file1, file2 = file2, file1
+    size1, size2 = size2, size1
+if size2 != size1 + gap:
+    raise Exception('File sizes do not match')
+del size2
+
+file1.seek(0, 0)
+data1 = file1.read(size1)
+del file1
+file2.seek(gap, 0)
+data2 = file2.read(size1)
+del file2
+
+max_line = max(symbols.keys())
+
+def to_int32(n):
+    '''Convert a number to signed 32 bit integer truncating if needed'''
+    mask = (1 << 32) - 1
+    h = 1 << 31
+    return (n & mask) ^ h - h
+
+i = 0
+references = {}
+internals = 0
+while i <= size1 - 4:
+    n1 = struct.unpack('<I', data1[i:i+4])[0]
+    n2 = struct.unpack('<I', data2[i:i+4])[0]
+    i += 1
+    # The two numbers are the same, no problems
+    if n1 == n2:
+        continue
+    # Try to understand why they are different
+    diff = to_int32(n1 - n2)
+    if diff == -gap: # this is an internal relocation
+        pos = i - 1
+        print("Internal relocation found at position %#x "
+              "n1=%#x n2=%#x diff=%#x" % (pos, n1, n2, diff),
+              file=sys.stderr)
+        i += 3
+        internals += 1
+        if internals >= 10:
+            break
+        continue
+    # This is a relative relocation to a symbol, accepted, code/data is
+    # relocatable.
+    if diff < gap and diff >= gap - max_line:
+        n = gap - diff
+        symbol = symbols.get(n)
+        # check we have a symbol
+        if symbol is None:
+            raise Exception("Cannot find symbol for line %d" % n)
+        pos = i - 1
+        if args.verbose:
+            print('Position %#x %d %s' % (pos, n, symbol), file=sys.stderr)
+        i += 3
+        references[pos] = symbol
+        continue
+    # First byte is the same, move to next byte
+    if diff & 0xff == 0 and i <= size1 - 4:
+       continue
+    # Probably a type of relocation we don't want or support
+    pos = i - 1
+    suggestion = ''
+    symbol = symbols.get(-diff - text_diff)
+    if symbol is not None:
+        suggestion = " Maybe %s is not defined as hidden?" % symbol
+    raise Exception("Unexpected difference found at %#x "
+                    "n1=%#x n2=%#x diff=%#x gap=%#x.%s" % \
+                    (pos, n1, n2, diff, gap, suggestion))
+if internals != 0:
+    raise Exception("Previous relocations found")
+
+def line_bytes(buf, out):
+    '''Output an assembly line with all bytes in "buf"'''
+    # Python 2 compatibility
+    if type(buf) == str:
+        print("\t.byte " + ','.join([str(ord(c)) for c in buf]), file=out)
+    else:
+        print("\t.byte " + ','.join([str(n) for n in buf]), file=out)
+
+def part(start, end, out):
+    '''Output bytes of "data" from "start" to "end"'''
+    while start < end:
+        e = min(start + 16, end)
+        line_bytes(data1[start:e], out)
+        start = e
+
+def reference(pos, out):
+    name = references[pos]
+    n = struct.unpack('<I', data1[pos:pos+4])[0]
+    sign = '+'
+    if n >= (1 << 31):
+        n -= (1 << 32)
+    n += pos
+    if n < 0:
+        n = -n
+        sign = '-'
+    print("\t.hidden %s\n"
+          "\t.long %s %s %#x - ." % (name, name, sign, n),
+          file=out)
+
+def output(out):
+    prev = 0
+    exports_by_addr = {}
+    for (sym, addr) in exports.items():
+        exports_by_addr.setdefault(addr, []).append(sym)
+    positions = list(references.keys())
+    positions += list(exports_by_addr.keys())
+    for pos in sorted(positions):
+        part(prev, pos, out)
+        prev = pos
+        if pos in references:
+            reference(pos, out)
+            prev = pos + 4
+        if pos in exports_by_addr:
+            for sym in exports_by_addr[pos]:
+                print("\t.global %s\n"
+                      "\t.hidden %s\n"
+                      "%s:" % (sym, sym, sym),
+                      file=out)
+    part(prev, size1, out)
+
+out = sys.stdout
+if args.output is not None:
+    out = open(args.output, 'w')
+print('''/*
+ * File autogenerated by combine_two_binaries.py DO NOT EDIT
+ */''', file=out)
+print('\t' + args.section_header, file=out)
+print('obj32_start:', file=out)
+output(out)
+print('\n\t.section .note.GNU-stack,"",@progbits', file=out)
+out.flush()
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 18:44:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 18:44:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827856.1242605 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5rCZ-0000OD-Kz; Tue, 29 Oct 2024 18:44:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827856.1242605; Tue, 29 Oct 2024 18: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 1t5rCZ-0000O6-IK; Tue, 29 Oct 2024 18:44:23 +0000
Received: by outflank-mailman (input) for mailman id 827856;
 Tue, 29 Oct 2024 18: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 1t5rCY-0000No-4B
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 18:44:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5rCY-009QII-0K
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 18:44:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5rCY-003FhF-0A
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 18: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Use boot_vid_info variable directly from C code
Message-Id: <E1t5rCY-003FhF-0A@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 18:44:22 +0000

commit d5a73cdc6b90eb4bed55994588ea3f4c0070fc7d
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Tue Oct 29 10:29:40 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 29 15:10:17 2024 +0000

    x86/boot: Use boot_vid_info variable directly from C code
    
    No more need to pass from assembly code.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/build32.lds.S |  1 +
 xen/arch/x86/boot/head.S        | 10 +---------
 xen/arch/x86/boot/reloc.c       | 13 +++++--------
 3 files changed, 7 insertions(+), 17 deletions(-)

diff --git a/xen/arch/x86/boot/build32.lds.S b/xen/arch/x86/boot/build32.lds.S
index 27f0d7ac3c..f20fc18977 100644
--- a/xen/arch/x86/boot/build32.lds.S
+++ b/xen/arch/x86/boot/build32.lds.S
@@ -50,6 +50,7 @@ SECTIONS
         DECLARE_IMPORT(__trampoline_seg_start);
         DECLARE_IMPORT(__trampoline_seg_stop);
         DECLARE_IMPORT(trampoline_phys);
+        DECLARE_IMPORT(boot_vid_info);
         . = . + GAP;
         *(.text)
         *(.text.*)
diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index ade2c5c43d..5da7ac138f 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -514,18 +514,10 @@ trampoline_setup:
         mov     sym_esi(trampoline_phys), %ecx
         add     $TRAMPOLINE_SPACE,%ecx
 
-#ifdef CONFIG_VIDEO
-        lea     sym_esi(boot_vid_info), %edx
-#else
-        xor     %edx, %edx
-#endif
-
         /* Save Multiboot / PVH info struct (after relocation) for later use. */
-        push    %edx                /* Boot video info to be filled from MB2. */
         mov     %ebx, %edx          /* Multiboot / PVH information address. */
-        /*      reloc(magic/eax, info/edx, trampoline/ecx, video/stk) using fastcall. */
+        /*      reloc(magic/eax, info/edx, trampoline/ecx) using fastcall. */
         call    reloc
-        add     $4, %esp
 
 #ifdef CONFIG_PVH_GUEST
         cmpb    $0, sym_esi(pvh_boot)
diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index 94b078d7b1..707d9c5f15 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -176,7 +176,7 @@ static multiboot_info_t *mbi_reloc(uint32_t mbi_in, memctx *ctx)
     return mbi_out;
 }
 
-static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out, memctx *ctx)
+static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, memctx *ctx)
 {
     const multiboot2_fixed_t *mbi_fix = _p(mbi_in);
     const multiboot2_memory_map_t *mmap_src;
@@ -185,7 +185,7 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out, memctx
     memory_map_t *mmap_dst;
     multiboot_info_t *mbi_out;
 #ifdef CONFIG_VIDEO
-    struct boot_video_info *video = NULL;
+    struct boot_video_info *video = &boot_vid_info;
 #endif
     uint32_t ptr;
     unsigned int i, mod_idx = 0;
@@ -290,12 +290,11 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out, memctx
 
 #ifdef CONFIG_VIDEO
         case MULTIBOOT2_TAG_TYPE_VBE:
-            if ( video_out )
+            if ( video )
             {
                 const struct vesa_ctrl_info *ci;
                 const struct vesa_mode_info *mi;
 
-                video = _p(video_out);
                 ci = (const void *)get_mb2_data(tag, vbe, vbe_control_info);
                 mi = (const void *)get_mb2_data(tag, vbe, vbe_mode_info);
 
@@ -321,7 +320,6 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out, memctx
             if ( (get_mb2_data(tag, framebuffer, framebuffer_type) !=
                   MULTIBOOT2_FRAMEBUFFER_TYPE_RGB) )
             {
-                video_out = 0;
                 video = NULL;
             }
             break;
@@ -346,8 +344,7 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, uint32_t video_out, memctx
 }
 
 /* SAF-1-safe */
-void *reloc(uint32_t magic, uint32_t in, uint32_t trampoline,
-            uint32_t video_info)
+void *reloc(uint32_t magic, uint32_t in, uint32_t trampoline)
 {
     memctx ctx = { trampoline };
 
@@ -357,7 +354,7 @@ void *reloc(uint32_t magic, uint32_t in, uint32_t trampoline,
         return mbi_reloc(in, &ctx);
 
     case MULTIBOOT2_BOOTLOADER_MAGIC:
-        return mbi2_reloc(in, video_info, &ctx);
+        return mbi2_reloc(in, &ctx);
 
     case XEN_HVM_START_MAGIC_VALUE:
         if ( IS_ENABLED(CONFIG_PVH_GUEST) )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Tue Oct 29 18:44:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Tue, 29 Oct 2024 18:44:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827857.1242609 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5rCj-0000Rj-MM; Tue, 29 Oct 2024 18:44:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827857.1242609; Tue, 29 Oct 2024 18:44:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5rCj-0000RZ-Jh; Tue, 29 Oct 2024 18:44:33 +0000
Received: by outflank-mailman (input) for mailman id 827857;
 Tue, 29 Oct 2024 18:44: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 1t5rCi-0000RG-7f
 for xen-changelog@lists.xenproject.org; Tue, 29 Oct 2024 18:44:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5rCi-009QIU-0g
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 18:44:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5rCi-003Fi7-0V
 for xen-changelog@lists.xenproject.org;
 Tue, 29 Oct 2024 18:44:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/boot: Use trampoline_phys variable directly from C code
Message-Id: <E1t5rCi-003Fi7-0V@xenbits.xenproject.org>
Date: Tue, 29 Oct 2024 18:44:32 +0000

commit 56bd76925ec35085528d778e46123b9d10a66018
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Tue Oct 29 10:29:41 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Tue Oct 29 15:10:17 2024 +0000

    x86/boot: Use trampoline_phys variable directly from C code
    
    No more need to pass from assembly code.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/boot/head.S  | 6 +-----
 xen/arch/x86/boot/reloc.c | 8 ++++++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/xen/arch/x86/boot/head.S b/xen/arch/x86/boot/head.S
index 5da7ac138f..dcda91cfda 100644
--- a/xen/arch/x86/boot/head.S
+++ b/xen/arch/x86/boot/head.S
@@ -510,13 +510,9 @@ trampoline_setup:
         mov     %esi, sym_esi(xen_phys_start)
         mov     %esi, sym_esi(trampoline_xen_phys_start)
 
-        /* Get bottom-most low-memory stack address. */
-        mov     sym_esi(trampoline_phys), %ecx
-        add     $TRAMPOLINE_SPACE,%ecx
-
         /* Save Multiboot / PVH info struct (after relocation) for later use. */
         mov     %ebx, %edx          /* Multiboot / PVH information address. */
-        /*      reloc(magic/eax, info/edx, trampoline/ecx) using fastcall. */
+        /*      reloc(magic/eax, info/edx) using fastcall. */
         call    reloc
 
 #ifdef CONFIG_PVH_GUEST
diff --git a/xen/arch/x86/boot/reloc.c b/xen/arch/x86/boot/reloc.c
index 707d9c5f15..e50e161b27 100644
--- a/xen/arch/x86/boot/reloc.c
+++ b/xen/arch/x86/boot/reloc.c
@@ -19,6 +19,9 @@
 #include <xen/kconfig.h>
 #include <xen/multiboot.h>
 #include <xen/multiboot2.h>
+#include <xen/page-size.h>
+
+#include <asm/trampoline.h>
 
 #include <public/arch-x86/hvm/start_info.h>
 
@@ -344,9 +347,10 @@ static multiboot_info_t *mbi2_reloc(uint32_t mbi_in, memctx *ctx)
 }
 
 /* SAF-1-safe */
-void *reloc(uint32_t magic, uint32_t in, uint32_t trampoline)
+void *reloc(uint32_t magic, uint32_t in)
 {
-    memctx ctx = { trampoline };
+    /* Get bottom-most low-memory stack address. */
+    memctx ctx = { trampoline_phys + TRAMPOLINE_SPACE };
 
     switch ( magic )
     {
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 30 00:33:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 30 Oct 2024 00:33:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827891.1242643 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5we1-0007Ol-TU; Wed, 30 Oct 2024 00:33:05 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827891.1242643; Wed, 30 Oct 2024 00: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 1t5we1-0007Od-QL; Wed, 30 Oct 2024 00:33:05 +0000
Received: by outflank-mailman (input) for mailman id 827891;
 Wed, 30 Oct 2024 00:33: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 1t5we0-0007OX-VI
 for xen-changelog@lists.xenproject.org; Wed, 30 Oct 2024 00:33:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5we0-009XbP-30
 for xen-changelog@lists.xenproject.org;
 Wed, 30 Oct 2024 00:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5we0-003qXj-2h
 for xen-changelog@lists.xenproject.org;
 Wed, 30 Oct 2024 00: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation: add x86_64 test (linux argo)
Message-Id: <E1t5we0-003qXj-2h@xenbits.xenproject.org>
Date: Wed, 30 Oct 2024 00:33:04 +0000

commit 6d7c26a0059e2502c122af1156da926d4c7f00d9
Author:     Victor Lira <victorm.lira@amd.com>
AuthorDate: Mon Oct 28 16:55:35 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Oct 29 17:28:12 2024 -0700

    automation: add x86_64 test (linux argo)
    
    Add x86_64 hardware test that creates a Xen Argo communication
    connection between two PVH domains. In the test, dom0 creates a domU and
    listens for messages sent by the domU through Argo.
    
    To accomplish this, build Xen with CONFIG_ARGO=y and create a CI test job.
    
    Update the xilinx x86_64 test script to support the new test, and add
    "sync_console" to command line to avoid an issue with console messages
    being lost.
    
    Requested-by: Stefano Stabellini <sstabellini@kernel.org>
    Signed-off-by: Victor Lira <victorm.lira@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/build.yaml                |  4 ++
 automation/gitlab-ci/test.yaml                 | 16 ++++++
 automation/scripts/xilinx-smoke-dom0-x86_64.sh | 76 +++++++++++++++++---------
 3 files changed, 71 insertions(+), 25 deletions(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 09dd9e6ccb..af2b1ceba3 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -340,6 +340,10 @@ alpine-3.18-gcc-debug:
   variables:
     CONTAINER: alpine:3.18
     BUILD_QEMU_XEN: y
+    EXTRA_XEN_CONFIG: |
+      CONFIG_EXPERT=y
+      CONFIG_UNSUPPORTED=y
+      CONFIG_ARGO=y
 
 debian-bookworm-gcc-debug:
   extends: .gcc-x86-64-build-debug
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index e76a37bef3..e8f57e87bd 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -192,6 +192,22 @@ xilinx-smoke-dom0-x86_64-gcc-debug:
     - *x86-64-test-needs
     - alpine-3.18-gcc-debug
 
+xilinx-smoke-dom0-x86_64-gcc-debug-argo:
+  extends: .xilinx-x86_64
+  script:
+    - ./automation/scripts/xilinx-smoke-dom0-x86_64.sh argo 2>&1 | tee ${LOGFILE}
+  needs:
+    - alpine-3.18-gcc-debug
+    - project: xen-project/hardware/test-artifacts
+      job: x86_64-kernel-linux-6.6.56
+      ref: master
+    - project: xen-project/hardware/test-artifacts
+      job: x86_64-rootfs-alpine-3.18
+      ref: master
+    - project: xen-project/hardware/test-artifacts
+      job: x86_64-argo-linux-6.6.56
+      ref: master
+
 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
index 7027f083ba..f70cfdc155 100755
--- a/automation/scripts/xilinx-smoke-dom0-x86_64.sh
+++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
@@ -9,6 +9,8 @@ fatal() {
     exit 1
 }
 
+WORKDIR="${PWD}"
+
 # Test parameter defaults.
 TEST="$1"
 PASS_MSG="Test passed: ${TEST}"
@@ -24,9 +26,10 @@ kernel = "/boot/vmlinuz"
 ramdisk = "/boot/initrd-domU"
 extra = "root=/dev/ram0 console=hvc0"
 memory = 512
-vif = [ "bridge=xenbr0", ]
-disk = [ ]
 '
+DOMU_CFG_EXTRA=""
+copy_domU_files () { :; }
+copy_dom0_files () { :; }
 
 # Select test variant.
 if [ "${TEST}" = "ping" ]; then
@@ -39,6 +42,14 @@ done
 echo \"${DOMU_MSG}\"
 "
     DOM0_CMD="
+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
 set +x
 until grep -q \"${DOMU_MSG}\" /var/log/xen/console/guest-domU.log; do
     sleep 1
@@ -46,6 +57,34 @@ done
 set -x
 echo \"${PASS_MSG}\"
 "
+    DOMU_CFG_EXTRA='
+vif = [ "bridge=xenbr0", ]
+disk = [ ]
+'
+elif [ "${TEST}" = "argo" ]
+then
+    PASS_MSG="TEST: Message from DOMU"
+    XEN_CMD_EXTRA="argo=1,mac-permissive=1"
+    DOMU_CMD="
+insmod /root/xen-argo.ko
+until false
+do
+  echo \"${PASS_MSG}\"
+  sleep 1
+done | argo-exec -p 28333 -d 0 -- /bin/echo
+"
+    DOM0_CMD="
+insmod /root/xen-argo.ko
+xl create /etc/xen/domU.cfg
+argo-exec -l -p 28333 -- /bin/echo
+"
+copy_dom0_files ()
+{
+    cp "${WORKDIR}/binaries/xen-argo.ko" "root/"
+    cp -ar "${WORKDIR}/binaries/lib/"* "usr/local/lib/"
+    cp "${WORKDIR}/binaries/argo-exec" "usr/local/bin/"
+}
+copy_domU_files () { copy_dom0_files; }
 else
     fatal "Unknown test: ${TEST}"
 fi
@@ -54,18 +93,18 @@ fi
 mkdir -p rootfs
 cd rootfs
 tar xzf ../binaries/initrd.tar.gz
-mkdir proc
-mkdir run
-mkdir srv
-mkdir sys
+mkdir proc run srv sys
 rm var/run
 echo "#!/bin/sh
-
+set -x
+export LD_LIBRARY_PATH=/usr/local/lib
+PATH=/usr/local/bin:/usr/local/sbin:\$PATH
 ${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
+copy_domU_files
 find . | cpio -H newc -o | gzip > ../binaries/domU-rootfs.cpio.gz
 cd ..
 rm -rf rootfs
@@ -74,37 +113,24 @@ rm -rf rootfs
 mkdir -p rootfs
 cd rootfs
 tar xzf ../binaries/initrd.tar.gz
-mkdir boot
-mkdir proc
-mkdir run
-mkdir srv
-mkdir sys
+mkdir boot proc run srv sys
 rm var/run
 cp -ar ../binaries/dist/install/* .
 echo "#!/bin/bash
-
+set -x
 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 "${DOMU_CFG}${DOMU_CFG_EXTRA}" > 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
+copy_dom0_files
 find . | cpio -H newc -o | gzip > ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
@@ -116,7 +142,7 @@ 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)/${TEST_BOARD}/xen ${XEN_CMDLINE}
+multiboot2 (tftp)/${TEST_BOARD}/xen ${XEN_CMDLINE} sync_console
 module2 (tftp)/${TEST_BOARD}/vmlinuz console=hvc0 root=/dev/ram0 earlyprintk=xen
 module2 (tftp)/${TEST_BOARD}/initrd-dom0
 boot
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 30 00:33:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 30 Oct 2024 00:33:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827892.1242647 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5weB-0007QK-UQ; Wed, 30 Oct 2024 00:33:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827892.1242647; Wed, 30 Oct 2024 00: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 1t5weB-0007QC-Rm; Wed, 30 Oct 2024 00:33:15 +0000
Received: by outflank-mailman (input) for mailman id 827892;
 Wed, 30 Oct 2024 00:33: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 1t5weB-0007Q6-1y
 for xen-changelog@lists.xenproject.org; Wed, 30 Oct 2024 00:33:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5weB-009XbT-06
 for xen-changelog@lists.xenproject.org;
 Wed, 30 Oct 2024 00:33:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5weA-003qYZ-3B
 for xen-changelog@lists.xenproject.org;
 Wed, 30 Oct 2024 00: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] automation/eclair: monitor Rules 11.2 and 18.1 and update configuration
Message-Id: <E1t5weA-003qYZ-3B@xenbits.xenproject.org>
Date: Wed, 30 Oct 2024 00:33:14 +0000

commit bb7296d77f171c7bfbafab30ed51e9be29660e39
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Tue Oct 29 11:05:00 2024 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Oct 29 17:29:51 2024 -0700

    automation/eclair: monitor Rules 11.2 and 18.1 and update configuration
    
    Add Rule 11.2 and Rule 18.1 to the monitored set.
    
    Tag Rule 7.3 as clean.
    Tag Rule 11.2 and Rule 20.7 as clean only for arm.
    
    Rule 2.2, Rule 9.5 and Directive 4.12 are not accepted: do not enable
    them and do not tag them as clean. Same for D4.3.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/monitored.ecl | 5 ++---
 automation/eclair_analysis/ECLAIR/tagging.ecl   | 7 +++----
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/monitored.ecl b/automation/eclair_analysis/ECLAIR/monitored.ecl
index 4d9ef1bd83..4e1deef7a7 100644
--- a/automation/eclair_analysis/ECLAIR/monitored.ecl
+++ b/automation/eclair_analysis/ECLAIR/monitored.ecl
@@ -6,13 +6,11 @@
 -enable=MC3R1.D4.7
 -enable=MC3R1.D4.10
 -enable=MC3R1.D4.11
--enable=MC3R1.D4.12
 -enable=MC3R1.D4.14
 -enable=MC3R1.R1.1
 -enable=MC3R1.R1.3
 -enable=MC3R1.R1.4
 -enable=MC3R1.R2.1
--enable=MC3R1.R2.2
 -enable=MC3R1.R2.6
 -enable=MC3R1.R3.1
 -enable=MC3R1.R3.2
@@ -43,10 +41,10 @@
 -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.2
 -enable=MC3R1.R11.7
 -enable=MC3R1.R11.8
 -enable=MC3R1.R11.9
@@ -66,6 +64,7 @@
 -enable=MC3R1.R17.4
 -enable=MC3R1.R17.5
 -enable=MC3R1.R17.6
+-enable=MC3R1.R18.1
 -enable=MC3R1.R18.2
 -enable=MC3R1.R18.6
 -enable=MC3R1.R18.8
diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index 76032b1fe1..e1d4ed012a 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -28,7 +28,6 @@ MC3R1.D4.14||
 MC3R1.R1.1||
 MC3R1.R1.3||
 MC3R1.R1.4||
-MC3R1.R2.2||
 MC3R1.R2.6||
 MC3R1.R3.1||
 MC3R1.R3.2||
@@ -42,6 +41,7 @@ MC3R1.R6.1||
 MC3R1.R6.2||
 MC3R1.R7.1||
 MC3R1.R7.2||
+MC3R1.R7.3||
 MC3R1.R7.4||
 MC3R1.R8.1||
 MC3R1.R8.2||
@@ -54,7 +54,6 @@ MC3R1.R8.14||
 MC3R1.R9.2||
 MC3R1.R9.3||
 MC3R1.R9.4||
-MC3R1.R9.5||
 MC3R1.R10.2||
 MC3R1.R11.6||
 MC3R1.R11.7||
@@ -109,11 +108,11 @@ MC3R1.R22.10"
 -setq=target,getenv("XEN_TARGET_ARCH")
 
 if(string_equal(target,"x86_64"),
-    service_selector({"additional_clean_guidelines","MC3R1.D4.3"})
+    service_selector({"additional_clean_guidelines","none()"})
 )
 
 if(string_equal(target,"arm64"),
-    service_selector({"additional_clean_guidelines","MC3R1.R2.1||MC3R1.R5.3||MC3R1.R7.3||MC3R1.R16.3||MC3R1.R16.6"})
+    service_selector({"additional_clean_guidelines","MC3R1.R2.1||MC3R1.R5.3||MC3.R11.2||MC3R1.R16.3||MC3R1.R16.6||MC3R1.R20.7"})
 )
 
 -reports+={clean:added,"service(clean_guidelines_common||additional_clean_guidelines)"}
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 30 02:00:10 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 30 Oct 2024 02:00:10 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827895.1242651 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5y0A-0008UZ-Rc; Wed, 30 Oct 2024 02:00:02 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827895.1242651; Wed, 30 Oct 2024 02: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 1t5y0A-0008UA-OO; Wed, 30 Oct 2024 02:00:02 +0000
Received: by outflank-mailman (input) for mailman id 827895;
 Wed, 30 Oct 2024 02: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 1t5y09-0008FH-Qo
 for xen-changelog@lists.xenproject.org; Wed, 30 Oct 2024 02:00:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5y09-00AbNA-2I
 for xen-changelog@lists.xenproject.org;
 Wed, 30 Oct 2024 02:00:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5y09-003ycz-1w
 for xen-changelog@lists.xenproject.org;
 Wed, 30 Oct 2024 02: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation: add x86_64 test (linux argo)
Message-Id: <E1t5y09-003ycz-1w@xenbits.xenproject.org>
Date: Wed, 30 Oct 2024 02:00:01 +0000

commit 6d7c26a0059e2502c122af1156da926d4c7f00d9
Author:     Victor Lira <victorm.lira@amd.com>
AuthorDate: Mon Oct 28 16:55:35 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Oct 29 17:28:12 2024 -0700

    automation: add x86_64 test (linux argo)
    
    Add x86_64 hardware test that creates a Xen Argo communication
    connection between two PVH domains. In the test, dom0 creates a domU and
    listens for messages sent by the domU through Argo.
    
    To accomplish this, build Xen with CONFIG_ARGO=y and create a CI test job.
    
    Update the xilinx x86_64 test script to support the new test, and add
    "sync_console" to command line to avoid an issue with console messages
    being lost.
    
    Requested-by: Stefano Stabellini <sstabellini@kernel.org>
    Signed-off-by: Victor Lira <victorm.lira@amd.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/gitlab-ci/build.yaml                |  4 ++
 automation/gitlab-ci/test.yaml                 | 16 ++++++
 automation/scripts/xilinx-smoke-dom0-x86_64.sh | 76 +++++++++++++++++---------
 3 files changed, 71 insertions(+), 25 deletions(-)

diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index 09dd9e6ccb..af2b1ceba3 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -340,6 +340,10 @@ alpine-3.18-gcc-debug:
   variables:
     CONTAINER: alpine:3.18
     BUILD_QEMU_XEN: y
+    EXTRA_XEN_CONFIG: |
+      CONFIG_EXPERT=y
+      CONFIG_UNSUPPORTED=y
+      CONFIG_ARGO=y
 
 debian-bookworm-gcc-debug:
   extends: .gcc-x86-64-build-debug
diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index e76a37bef3..e8f57e87bd 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -192,6 +192,22 @@ xilinx-smoke-dom0-x86_64-gcc-debug:
     - *x86-64-test-needs
     - alpine-3.18-gcc-debug
 
+xilinx-smoke-dom0-x86_64-gcc-debug-argo:
+  extends: .xilinx-x86_64
+  script:
+    - ./automation/scripts/xilinx-smoke-dom0-x86_64.sh argo 2>&1 | tee ${LOGFILE}
+  needs:
+    - alpine-3.18-gcc-debug
+    - project: xen-project/hardware/test-artifacts
+      job: x86_64-kernel-linux-6.6.56
+      ref: master
+    - project: xen-project/hardware/test-artifacts
+      job: x86_64-rootfs-alpine-3.18
+      ref: master
+    - project: xen-project/hardware/test-artifacts
+      job: x86_64-argo-linux-6.6.56
+      ref: master
+
 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
index 7027f083ba..f70cfdc155 100755
--- a/automation/scripts/xilinx-smoke-dom0-x86_64.sh
+++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
@@ -9,6 +9,8 @@ fatal() {
     exit 1
 }
 
+WORKDIR="${PWD}"
+
 # Test parameter defaults.
 TEST="$1"
 PASS_MSG="Test passed: ${TEST}"
@@ -24,9 +26,10 @@ kernel = "/boot/vmlinuz"
 ramdisk = "/boot/initrd-domU"
 extra = "root=/dev/ram0 console=hvc0"
 memory = 512
-vif = [ "bridge=xenbr0", ]
-disk = [ ]
 '
+DOMU_CFG_EXTRA=""
+copy_domU_files () { :; }
+copy_dom0_files () { :; }
 
 # Select test variant.
 if [ "${TEST}" = "ping" ]; then
@@ -39,6 +42,14 @@ done
 echo \"${DOMU_MSG}\"
 "
     DOM0_CMD="
+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
 set +x
 until grep -q \"${DOMU_MSG}\" /var/log/xen/console/guest-domU.log; do
     sleep 1
@@ -46,6 +57,34 @@ done
 set -x
 echo \"${PASS_MSG}\"
 "
+    DOMU_CFG_EXTRA='
+vif = [ "bridge=xenbr0", ]
+disk = [ ]
+'
+elif [ "${TEST}" = "argo" ]
+then
+    PASS_MSG="TEST: Message from DOMU"
+    XEN_CMD_EXTRA="argo=1,mac-permissive=1"
+    DOMU_CMD="
+insmod /root/xen-argo.ko
+until false
+do
+  echo \"${PASS_MSG}\"
+  sleep 1
+done | argo-exec -p 28333 -d 0 -- /bin/echo
+"
+    DOM0_CMD="
+insmod /root/xen-argo.ko
+xl create /etc/xen/domU.cfg
+argo-exec -l -p 28333 -- /bin/echo
+"
+copy_dom0_files ()
+{
+    cp "${WORKDIR}/binaries/xen-argo.ko" "root/"
+    cp -ar "${WORKDIR}/binaries/lib/"* "usr/local/lib/"
+    cp "${WORKDIR}/binaries/argo-exec" "usr/local/bin/"
+}
+copy_domU_files () { copy_dom0_files; }
 else
     fatal "Unknown test: ${TEST}"
 fi
@@ -54,18 +93,18 @@ fi
 mkdir -p rootfs
 cd rootfs
 tar xzf ../binaries/initrd.tar.gz
-mkdir proc
-mkdir run
-mkdir srv
-mkdir sys
+mkdir proc run srv sys
 rm var/run
 echo "#!/bin/sh
-
+set -x
+export LD_LIBRARY_PATH=/usr/local/lib
+PATH=/usr/local/bin:/usr/local/sbin:\$PATH
 ${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
+copy_domU_files
 find . | cpio -H newc -o | gzip > ../binaries/domU-rootfs.cpio.gz
 cd ..
 rm -rf rootfs
@@ -74,37 +113,24 @@ rm -rf rootfs
 mkdir -p rootfs
 cd rootfs
 tar xzf ../binaries/initrd.tar.gz
-mkdir boot
-mkdir proc
-mkdir run
-mkdir srv
-mkdir sys
+mkdir boot proc run srv sys
 rm var/run
 cp -ar ../binaries/dist/install/* .
 echo "#!/bin/bash
-
+set -x
 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 "${DOMU_CFG}${DOMU_CFG_EXTRA}" > 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
+copy_dom0_files
 find . | cpio -H newc -o | gzip > ../binaries/dom0-rootfs.cpio.gz
 cd ..
 
@@ -116,7 +142,7 @@ 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)/${TEST_BOARD}/xen ${XEN_CMDLINE}
+multiboot2 (tftp)/${TEST_BOARD}/xen ${XEN_CMDLINE} sync_console
 module2 (tftp)/${TEST_BOARD}/vmlinuz console=hvc0 root=/dev/ram0 earlyprintk=xen
 module2 (tftp)/${TEST_BOARD}/initrd-dom0
 boot
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 30 02:00:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 30 Oct 2024 02:00:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.827896.1242654 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t5y0K-00017c-Sc; Wed, 30 Oct 2024 02:00:12 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 827896.1242654; Wed, 30 Oct 2024 02: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 1t5y0K-00017U-Px; Wed, 30 Oct 2024 02:00:12 +0000
Received: by outflank-mailman (input) for mailman id 827896;
 Wed, 30 Oct 2024 02: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 1t5y0J-00017M-RI
 for xen-changelog@lists.xenproject.org; Wed, 30 Oct 2024 02:00:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5y0J-00AboP-2c
 for xen-changelog@lists.xenproject.org;
 Wed, 30 Oct 2024 02:00:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t5y0J-003yfH-2T
 for xen-changelog@lists.xenproject.org;
 Wed, 30 Oct 2024 02: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] automation/eclair: monitor Rules 11.2 and 18.1 and update configuration
Message-Id: <E1t5y0J-003yfH-2T@xenbits.xenproject.org>
Date: Wed, 30 Oct 2024 02:00:11 +0000

commit bb7296d77f171c7bfbafab30ed51e9be29660e39
Author:     Federico Serafini <federico.serafini@bugseng.com>
AuthorDate: Tue Oct 29 11:05:00 2024 +0100
Commit:     Stefano Stabellini <stefano.stabellini@amd.com>
CommitDate: Tue Oct 29 17:29:51 2024 -0700

    automation/eclair: monitor Rules 11.2 and 18.1 and update configuration
    
    Add Rule 11.2 and Rule 18.1 to the monitored set.
    
    Tag Rule 7.3 as clean.
    Tag Rule 11.2 and Rule 20.7 as clean only for arm.
    
    Rule 2.2, Rule 9.5 and Directive 4.12 are not accepted: do not enable
    them and do not tag them as clean. Same for D4.3.
    
    Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 automation/eclair_analysis/ECLAIR/monitored.ecl | 5 ++---
 automation/eclair_analysis/ECLAIR/tagging.ecl   | 7 +++----
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/automation/eclair_analysis/ECLAIR/monitored.ecl b/automation/eclair_analysis/ECLAIR/monitored.ecl
index 4d9ef1bd83..4e1deef7a7 100644
--- a/automation/eclair_analysis/ECLAIR/monitored.ecl
+++ b/automation/eclair_analysis/ECLAIR/monitored.ecl
@@ -6,13 +6,11 @@
 -enable=MC3R1.D4.7
 -enable=MC3R1.D4.10
 -enable=MC3R1.D4.11
--enable=MC3R1.D4.12
 -enable=MC3R1.D4.14
 -enable=MC3R1.R1.1
 -enable=MC3R1.R1.3
 -enable=MC3R1.R1.4
 -enable=MC3R1.R2.1
--enable=MC3R1.R2.2
 -enable=MC3R1.R2.6
 -enable=MC3R1.R3.1
 -enable=MC3R1.R3.2
@@ -43,10 +41,10 @@
 -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.2
 -enable=MC3R1.R11.7
 -enable=MC3R1.R11.8
 -enable=MC3R1.R11.9
@@ -66,6 +64,7 @@
 -enable=MC3R1.R17.4
 -enable=MC3R1.R17.5
 -enable=MC3R1.R17.6
+-enable=MC3R1.R18.1
 -enable=MC3R1.R18.2
 -enable=MC3R1.R18.6
 -enable=MC3R1.R18.8
diff --git a/automation/eclair_analysis/ECLAIR/tagging.ecl b/automation/eclair_analysis/ECLAIR/tagging.ecl
index 76032b1fe1..e1d4ed012a 100644
--- a/automation/eclair_analysis/ECLAIR/tagging.ecl
+++ b/automation/eclair_analysis/ECLAIR/tagging.ecl
@@ -28,7 +28,6 @@ MC3R1.D4.14||
 MC3R1.R1.1||
 MC3R1.R1.3||
 MC3R1.R1.4||
-MC3R1.R2.2||
 MC3R1.R2.6||
 MC3R1.R3.1||
 MC3R1.R3.2||
@@ -42,6 +41,7 @@ MC3R1.R6.1||
 MC3R1.R6.2||
 MC3R1.R7.1||
 MC3R1.R7.2||
+MC3R1.R7.3||
 MC3R1.R7.4||
 MC3R1.R8.1||
 MC3R1.R8.2||
@@ -54,7 +54,6 @@ MC3R1.R8.14||
 MC3R1.R9.2||
 MC3R1.R9.3||
 MC3R1.R9.4||
-MC3R1.R9.5||
 MC3R1.R10.2||
 MC3R1.R11.6||
 MC3R1.R11.7||
@@ -109,11 +108,11 @@ MC3R1.R22.10"
 -setq=target,getenv("XEN_TARGET_ARCH")
 
 if(string_equal(target,"x86_64"),
-    service_selector({"additional_clean_guidelines","MC3R1.D4.3"})
+    service_selector({"additional_clean_guidelines","none()"})
 )
 
 if(string_equal(target,"arm64"),
-    service_selector({"additional_clean_guidelines","MC3R1.R2.1||MC3R1.R5.3||MC3R1.R7.3||MC3R1.R16.3||MC3R1.R16.6"})
+    service_selector({"additional_clean_guidelines","MC3R1.R2.1||MC3R1.R5.3||MC3.R11.2||MC3R1.R16.3||MC3R1.R16.6||MC3R1.R20.7"})
 )
 
 -reports+={clean:added,"service(clean_guidelines_common||additional_clean_guidelines)"}
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Wed Oct 30 18:55:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 30 Oct 2024 18:55:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828404.1243258 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6DqU-0007qK-0b; Wed, 30 Oct 2024 18:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828404.1243258; Wed, 30 Oct 2024 18: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 1t6DqT-0007qC-Ty; Wed, 30 Oct 2024 18:55:05 +0000
Received: by outflank-mailman (input) for mailman id 828404;
 Wed, 30 Oct 2024 18:55: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 1t6DqT-0007q6-36
 for xen-changelog@lists.xenproject.org; Wed, 30 Oct 2024 18:55:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6DqS-00AwdS-2S
 for xen-changelog@lists.xenproject.org;
 Wed, 30 Oct 2024 18:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6DqS-005lyT-25
 for xen-changelog@lists.xenproject.org;
 Wed, 30 Oct 2024 18: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/cpu-policy: Extend the guest max policy max leaf/subleaves
Message-Id: <E1t6DqS-005lyT-25@xenbits.xenproject.org>
Date: Wed, 30 Oct 2024 18:55:04 +0000

commit fa2d8318033e468a4ded1fc3d721dc3e019e449b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Oct 29 17:21:08 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 30 17:34:32 2024 +0000

    x86/cpu-policy: Extend the guest max policy max leaf/subleaves
    
    We already have one migration case opencoded (feat.max_subleaf).  A more
    recent discovery is that we advertise x2APIC to guests without ensuring that
    we provide max_leaf >= 0xb.
    
    In general, any leaf known to Xen can be safely configured by the toolstack if
    it doesn't violate other constraints.
    
    Therefore, introduce guest_common_{max,default}_leaves() to generalise the
    special case we currently have for feat.max_subleaf, in preparation to be able
    to provide x2APIC topology in leaf 0xb even on older hardware.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu-policy.c | 39 +++++++++++++++++++++++++--------------
 1 file changed, 25 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/cpu-policy.c b/xen/arch/x86/cpu-policy.c
index b6d9fad567..78bc9872b0 100644
--- a/xen/arch/x86/cpu-policy.c
+++ b/xen/arch/x86/cpu-policy.c
@@ -391,6 +391,27 @@ static void __init calculate_host_policy(void)
     p->platform_info.cpuid_faulting = cpu_has_cpuid_faulting;
 }
 
+/*
+ * Guest max policies can have any max leaf/subleaf within bounds.
+ *
+ * - Some incoming VMs have a larger-than-necessary feat max_subleaf.
+ * - Some VMs we'd like to synthesise leaves not present on the host.
+ */
+static void __init guest_common_max_leaves(struct cpu_policy *p)
+{
+    p->basic.max_leaf       = ARRAY_SIZE(p->basic.raw) - 1;
+    p->feat.max_subleaf     = ARRAY_SIZE(p->feat.raw) - 1;
+    p->extd.max_leaf        = 0x80000000U + ARRAY_SIZE(p->extd.raw) - 1;
+}
+
+/* Guest default policies inherit the host max leaf/subleaf settings. */
+static void __init guest_common_default_leaves(struct cpu_policy *p)
+{
+    p->basic.max_leaf       = host_cpu_policy.basic.max_leaf;
+    p->feat.max_subleaf     = host_cpu_policy.feat.max_subleaf;
+    p->extd.max_leaf        = host_cpu_policy.extd.max_leaf;
+}
+
 static void __init guest_common_max_feature_adjustments(uint32_t *fs)
 {
     if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
@@ -579,11 +600,7 @@ static void __init calculate_pv_max_policy(void)
 
     *p = host_cpu_policy;
 
-    /*
-     * Some VMs may have a larger-than-necessary feat max_subleaf.  Allow them
-     * to migrate in.
-     */
-    p->feat.max_subleaf = ARRAY_SIZE(p->feat.raw) - 1;
+    guest_common_max_leaves(p);
 
     x86_cpu_policy_to_featureset(p, fs);
 
@@ -626,8 +643,7 @@ static void __init calculate_pv_def_policy(void)
 
     *p = pv_max_cpu_policy;
 
-    /* Default to the same max_subleaf as the host. */
-    p->feat.max_subleaf = host_cpu_policy.feat.max_subleaf;
+    guest_common_default_leaves(p);
 
     x86_cpu_policy_to_featureset(p, fs);
 
@@ -666,11 +682,7 @@ static void __init calculate_hvm_max_policy(void)
 
     *p = host_cpu_policy;
 
-    /*
-     * Some VMs may have a larger-than-necessary feat max_subleaf.  Allow them
-     * to migrate in.
-     */
-    p->feat.max_subleaf = ARRAY_SIZE(p->feat.raw) - 1;
+    guest_common_max_leaves(p);
 
     x86_cpu_policy_to_featureset(p, fs);
 
@@ -790,8 +802,7 @@ static void __init calculate_hvm_def_policy(void)
 
     *p = hvm_max_cpu_policy;
 
-    /* Default to the same max_subleaf as the host. */
-    p->feat.max_subleaf = host_cpu_policy.feat.max_subleaf;
+    guest_common_default_leaves(p);
 
     x86_cpu_policy_to_featureset(p, fs);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 30 18:55:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 30 Oct 2024 18:55:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828405.1243261 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6Dqe-0007sM-1u; Wed, 30 Oct 2024 18:55:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828405.1243261; Wed, 30 Oct 2024 18: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 1t6Dqd-0007sE-VX; Wed, 30 Oct 2024 18:55:15 +0000
Received: by outflank-mailman (input) for mailman id 828405;
 Wed, 30 Oct 2024 18: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 1t6Dqc-0007s8-Th
 for xen-changelog@lists.xenproject.org; Wed, 30 Oct 2024 18:55:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6Dqc-00Awdb-2q
 for xen-changelog@lists.xenproject.org;
 Wed, 30 Oct 2024 18:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6Dqc-005lzM-2e
 for xen-changelog@lists.xenproject.org;
 Wed, 30 Oct 2024 18: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/setup: Make setup.h header self contained
Message-Id: <E1t6Dqc-005lzM-2e@xenbits.xenproject.org>
Date: Wed, 30 Oct 2024 18:55:14 +0000

commit aa4ad424f066f3ccb4de4e40092b0cd821840268
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Wed Oct 30 14:13:41 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 30 17:34:32 2024 +0000

    x86/setup: Make setup.h header self contained
    
    The header uses rangeset structure pointer.
    Forward declare the structure.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/setup.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h
index 4874ee8936..d7ed4f4002 100644
--- a/xen/arch/x86/include/asm/setup.h
+++ b/xen/arch/x86/include/asm/setup.h
@@ -43,6 +43,7 @@ void *bootstrap_map_bm(const struct boot_module *bm);
 void *bootstrap_map(const module_t *mod);
 void bootstrap_unmap(void);
 
+struct rangeset;
 int remove_xen_ranges(struct rangeset *r);
 
 int cf_check stub_selftest(void);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Wed Oct 30 18:55:26 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Wed, 30 Oct 2024 18:55:26 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828406.1243264 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6Dqo-0007v7-3P; Wed, 30 Oct 2024 18:55:26 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828406.1243264; Wed, 30 Oct 2024 18:55: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 1t6Dqo-0007uy-0e; Wed, 30 Oct 2024 18:55:26 +0000
Received: by outflank-mailman (input) for mailman id 828406;
 Wed, 30 Oct 2024 18:55: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 1t6Dqn-0007uc-0X
 for xen-changelog@lists.xenproject.org; Wed, 30 Oct 2024 18:55:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6Dqm-00Awdm-3C
 for xen-changelog@lists.xenproject.org;
 Wed, 30 Oct 2024 18:55:24 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6Dqm-005m03-30
 for xen-changelog@lists.xenproject.org;
 Wed, 30 Oct 2024 18: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mm: Use standard C types for sized integers
Message-Id: <E1t6Dqm-005m03-30@xenbits.xenproject.org>
Date: Wed, 30 Oct 2024 18:55:24 +0000

commit 9a2a50d5de7647bfb529867fdce47ec64b07f06a
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Wed Oct 30 10:44:06 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 30 17:34:32 2024 +0000

    x86/mm: Use standard C types for sized integers
    
    The header is already using these types.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/mm.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/mm.h b/xen/arch/x86/include/asm/mm.h
index 2a837f3d59..71a29b2cb3 100644
--- a/xen/arch/x86/include/asm/mm.h
+++ b/xen/arch/x86/include/asm/mm.h
@@ -230,7 +230,7 @@ struct page_info
          * Only valid for: a) free pages, and b) pages with zero type count
          * (except page table pages when the guest is in shadow mode).
          */
-        u32 tlbflush_timestamp;
+        uint32_t tlbflush_timestamp;
 
         /*
          * When PGT_partial is true then the first two fields are valid and
@@ -284,8 +284,8 @@ struct page_info
          *   in use.
          */
         struct {
-            u16 nr_validated_ptes:PAGETABLE_ORDER + 1;
-            u16 :16 - PAGETABLE_ORDER - 1 - 1;
+            uint16_t nr_validated_ptes:PAGETABLE_ORDER + 1;
+            uint16_t :16 - PAGETABLE_ORDER - 1 - 1;
             uint16_t partial_flags:1;
             int16_t linear_pt_count;
         };
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 09:33:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 09:33:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828540.1243448 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6RY7-0005sF-4p; Thu, 31 Oct 2024 09:33:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828540.1243448; Thu, 31 Oct 2024 09: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 1t6RY7-0005s7-2F; Thu, 31 Oct 2024 09:33:03 +0000
Received: by outflank-mailman (input) for mailman id 828540;
 Thu, 31 Oct 2024 09: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 1t6RY6-0005s1-3o
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 09:33:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6RY5-00CH3T-2Y
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 09:33:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6RY5-0079bJ-2O
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 09: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/cpu-policy: Extend the guest max policy max leaf/subleaves
Message-Id: <E1t6RY5-0079bJ-2O@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 09:33:01 +0000

commit fa2d8318033e468a4ded1fc3d721dc3e019e449b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Tue Oct 29 17:21:08 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 30 17:34:32 2024 +0000

    x86/cpu-policy: Extend the guest max policy max leaf/subleaves
    
    We already have one migration case opencoded (feat.max_subleaf).  A more
    recent discovery is that we advertise x2APIC to guests without ensuring that
    we provide max_leaf >= 0xb.
    
    In general, any leaf known to Xen can be safely configured by the toolstack if
    it doesn't violate other constraints.
    
    Therefore, introduce guest_common_{max,default}_leaves() to generalise the
    special case we currently have for feat.max_subleaf, in preparation to be able
    to provide x2APIC topology in leaf 0xb even on older hardware.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/cpu-policy.c | 39 +++++++++++++++++++++++++--------------
 1 file changed, 25 insertions(+), 14 deletions(-)

diff --git a/xen/arch/x86/cpu-policy.c b/xen/arch/x86/cpu-policy.c
index b6d9fad567..78bc9872b0 100644
--- a/xen/arch/x86/cpu-policy.c
+++ b/xen/arch/x86/cpu-policy.c
@@ -391,6 +391,27 @@ static void __init calculate_host_policy(void)
     p->platform_info.cpuid_faulting = cpu_has_cpuid_faulting;
 }
 
+/*
+ * Guest max policies can have any max leaf/subleaf within bounds.
+ *
+ * - Some incoming VMs have a larger-than-necessary feat max_subleaf.
+ * - Some VMs we'd like to synthesise leaves not present on the host.
+ */
+static void __init guest_common_max_leaves(struct cpu_policy *p)
+{
+    p->basic.max_leaf       = ARRAY_SIZE(p->basic.raw) - 1;
+    p->feat.max_subleaf     = ARRAY_SIZE(p->feat.raw) - 1;
+    p->extd.max_leaf        = 0x80000000U + ARRAY_SIZE(p->extd.raw) - 1;
+}
+
+/* Guest default policies inherit the host max leaf/subleaf settings. */
+static void __init guest_common_default_leaves(struct cpu_policy *p)
+{
+    p->basic.max_leaf       = host_cpu_policy.basic.max_leaf;
+    p->feat.max_subleaf     = host_cpu_policy.feat.max_subleaf;
+    p->extd.max_leaf        = host_cpu_policy.extd.max_leaf;
+}
+
 static void __init guest_common_max_feature_adjustments(uint32_t *fs)
 {
     if ( boot_cpu_data.x86_vendor == X86_VENDOR_INTEL )
@@ -579,11 +600,7 @@ static void __init calculate_pv_max_policy(void)
 
     *p = host_cpu_policy;
 
-    /*
-     * Some VMs may have a larger-than-necessary feat max_subleaf.  Allow them
-     * to migrate in.
-     */
-    p->feat.max_subleaf = ARRAY_SIZE(p->feat.raw) - 1;
+    guest_common_max_leaves(p);
 
     x86_cpu_policy_to_featureset(p, fs);
 
@@ -626,8 +643,7 @@ static void __init calculate_pv_def_policy(void)
 
     *p = pv_max_cpu_policy;
 
-    /* Default to the same max_subleaf as the host. */
-    p->feat.max_subleaf = host_cpu_policy.feat.max_subleaf;
+    guest_common_default_leaves(p);
 
     x86_cpu_policy_to_featureset(p, fs);
 
@@ -666,11 +682,7 @@ static void __init calculate_hvm_max_policy(void)
 
     *p = host_cpu_policy;
 
-    /*
-     * Some VMs may have a larger-than-necessary feat max_subleaf.  Allow them
-     * to migrate in.
-     */
-    p->feat.max_subleaf = ARRAY_SIZE(p->feat.raw) - 1;
+    guest_common_max_leaves(p);
 
     x86_cpu_policy_to_featureset(p, fs);
 
@@ -790,8 +802,7 @@ static void __init calculate_hvm_def_policy(void)
 
     *p = hvm_max_cpu_policy;
 
-    /* Default to the same max_subleaf as the host. */
-    p->feat.max_subleaf = host_cpu_policy.feat.max_subleaf;
+    guest_common_default_leaves(p);
 
     x86_cpu_policy_to_featureset(p, fs);
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 09:33:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 09:33:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828541.1243454 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6RYH-0005u1-6k; Thu, 31 Oct 2024 09:33:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828541.1243454; Thu, 31 Oct 2024 09: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 1t6RYH-0005tt-3c; Thu, 31 Oct 2024 09:33:13 +0000
Received: by outflank-mailman (input) for mailman id 828541;
 Thu, 31 Oct 2024 09: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 1t6RYF-0005tf-Ts
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 09:33:11 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6RYF-00CH3Y-2s
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 09:33:11 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6RYF-0079d6-2j
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 09: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/setup: Make setup.h header self contained
Message-Id: <E1t6RYF-0079d6-2j@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 09:33:11 +0000

commit aa4ad424f066f3ccb4de4e40092b0cd821840268
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Wed Oct 30 14:13:41 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 30 17:34:32 2024 +0000

    x86/setup: Make setup.h header self contained
    
    The header uses rangeset structure pointer.
    Forward declare the structure.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/include/asm/setup.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/xen/arch/x86/include/asm/setup.h b/xen/arch/x86/include/asm/setup.h
index 4874ee8936..d7ed4f4002 100644
--- a/xen/arch/x86/include/asm/setup.h
+++ b/xen/arch/x86/include/asm/setup.h
@@ -43,6 +43,7 @@ void *bootstrap_map_bm(const struct boot_module *bm);
 void *bootstrap_map(const module_t *mod);
 void bootstrap_unmap(void);
 
+struct rangeset;
 int remove_xen_ranges(struct rangeset *r);
 
 int cf_check stub_selftest(void);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 09:33:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 09:33:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828542.1243457 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6RYR-0005x4-7r; Thu, 31 Oct 2024 09:33:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828542.1243457; Thu, 31 Oct 2024 09: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 1t6RYR-0005ww-4y; Thu, 31 Oct 2024 09:33:23 +0000
Received: by outflank-mailman (input) for mailman id 828542;
 Thu, 31 Oct 2024 09: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 1t6RYQ-0005wb-1s
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 09:33:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6RYQ-00CH5j-05
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 09:33:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6RYP-0079fv-33
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 09: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mm: Use standard C types for sized integers
Message-Id: <E1t6RYP-0079fv-33@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 09:33:21 +0000

commit 9a2a50d5de7647bfb529867fdce47ec64b07f06a
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Wed Oct 30 10:44:06 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Wed Oct 30 17:34:32 2024 +0000

    x86/mm: Use standard C types for sized integers
    
    The header is already using these types.
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/include/asm/mm.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/include/asm/mm.h b/xen/arch/x86/include/asm/mm.h
index 2a837f3d59..71a29b2cb3 100644
--- a/xen/arch/x86/include/asm/mm.h
+++ b/xen/arch/x86/include/asm/mm.h
@@ -230,7 +230,7 @@ struct page_info
          * Only valid for: a) free pages, and b) pages with zero type count
          * (except page table pages when the guest is in shadow mode).
          */
-        u32 tlbflush_timestamp;
+        uint32_t tlbflush_timestamp;
 
         /*
          * When PGT_partial is true then the first two fields are valid and
@@ -284,8 +284,8 @@ struct page_info
          *   in use.
          */
         struct {
-            u16 nr_validated_ptes:PAGETABLE_ORDER + 1;
-            u16 :16 - PAGETABLE_ORDER - 1 - 1;
+            uint16_t nr_validated_ptes:PAGETABLE_ORDER + 1;
+            uint16_t :16 - PAGETABLE_ORDER - 1 - 1;
             uint16_t partial_flags:1;
             int16_t linear_pt_count;
         };
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 10:44:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 10:44:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828595.1243531 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6Set-0004Wh-OG; Thu, 31 Oct 2024 10:44:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828595.1243531; Thu, 31 Oct 2024 10:44: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 1t6Set-0004WZ-Li; Thu, 31 Oct 2024 10:44:07 +0000
Received: by outflank-mailman (input) for mailman id 828595;
 Thu, 31 Oct 2024 10:44: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 1t6Ses-0004WT-3g
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 10:44:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6Ser-00CISZ-0U
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 10:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6Ser-007GtH-08
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 10:44: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] scripts: Fix git-checkout.sh to work with branches other than master
Message-Id: <E1t6Ser-007GtH-08@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 10:44:05 +0000

commit c554ec124b12f9c0d8bfb2b564ca239bd676037c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Oct 30 19:03:42 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 31 10:34:13 2024 +0000

    scripts: Fix git-checkout.sh to work with branches other than master
    
    Xen uses master for QEMU_UPSTREAM_REVISION, and has done for other trees too
    in the path.  Apparently we've never specified a different branch, because the
    git-clone rune only pulls in the master branch; it does not pull in diverging
    branches.  Fix this by stating which branch/tag is wanted.
    
    $TAG is really a committish, and git-clone's -b/--branch takes a committish
    too.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 scripts/git-checkout.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/git-checkout.sh b/scripts/git-checkout.sh
index fd4425ac4e..3796cbfe39 100755
--- a/scripts/git-checkout.sh
+++ b/scripts/git-checkout.sh
@@ -14,7 +14,7 @@ set -e
 if test \! -d $DIR-remote; then
 	rm -rf $DIR-remote $DIR-remote.tmp
 	mkdir -p $DIR-remote.tmp; rmdir $DIR-remote.tmp
-	$GIT clone $TREE $DIR-remote.tmp
+	$GIT clone -b $TAG $TREE $DIR-remote.tmp
 	if test "$TAG" ; then
 		cd $DIR-remote.tmp
 		$GIT branch -D dummy >/dev/null 2>&1 ||:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 10:44:16 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 10:44:16 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828596.1243535 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6Sf2-0004YN-Pl; Thu, 31 Oct 2024 10:44:16 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828596.1243535; Thu, 31 Oct 2024 10:44: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 1t6Sf2-0004YG-N6; Thu, 31 Oct 2024 10:44:16 +0000
Received: by outflank-mailman (input) for mailman id 828596;
 Thu, 31 Oct 2024 10:44: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 1t6Sf1-0004Y8-Cm
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 10:44:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6Sf1-00CISf-10
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 10:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6Sf1-007Gvh-0f
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 10:44: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Config: Update MiniOS revision
Message-Id: <E1t6Sf1-007Gvh-0f@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 10:44:15 +0000

commit eb4042e3c53befdc49b3ebdae2d526ccb3500c0b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Oct 30 17:57:59 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 31 10:34:13 2024 +0000

    Config: Update MiniOS revision
    
    Commit 6d5159e8410b ("Add missing symbol exports for grub-pv")
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index 6dd2f9439c..f1eab9a20a 100644
--- a/Config.mk
+++ b/Config.mk
@@ -224,7 +224,7 @@ QEMU_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/qemu-xen.git
 QEMU_UPSTREAM_REVISION ?= master
 
 MINIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/mini-os.git
-MINIOS_UPSTREAM_REVISION ?= 80ef70f92cb7b95ef48deea1157f2194b10b8c05
+MINIOS_UPSTREAM_REVISION ?= 6d5159e8410be16a47433bac1627e63f8adc7cd9
 
 SEABIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/seabios.git
 SEABIOS_UPSTREAM_REVISION ?= rel-1.16.3
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 11:44:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 11:44:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828636.1243590 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6Tax-0008DY-2J; Thu, 31 Oct 2024 11:44:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828636.1243590; Thu, 31 Oct 2024 11:44: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 1t6Taw-0008DQ-VE; Thu, 31 Oct 2024 11:44:06 +0000
Received: by outflank-mailman (input) for mailman id 828636;
 Thu, 31 Oct 2024 11:44: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 1t6Tav-0008DK-HB
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 11:44:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6Tav-00CJeT-12
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 11:44:05 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6Tav-007NGr-0t
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 11:44: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] MAINTAINERS: minor file line update
Message-Id: <E1t6Tav-007NGr-0t@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 11:44:05 +0000

commit 3eb037fbbc606ed9b4d67e4919aa57e2930a04cb
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Fri Oct 25 10:28:15 2024 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Oct 31 11:35:33 2024 +0000

    MAINTAINERS: minor file line update
    
    "xen/arch/arm/include/asm/tee" is a directory and should be terminated
    by a slash ("/").
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 3bba2c8c31..17fc5f9eec 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -518,7 +518,7 @@ TEE MEDIATORS
 M:	Volodymyr Babchuk <volodymyr_babchuk@epam.com>
 M:	Bertrand Marquis <bertrand.marquis@arm.com>
 S:	Supported
-F:	xen/arch/arm/include/asm/tee
+F:	xen/arch/arm/include/asm/tee/
 F:	xen/arch/arm/tee/
 
 TOOLSTACK
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 11:44:17 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 11:44:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828637.1243593 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6Tb7-0008Fg-4z; Thu, 31 Oct 2024 11:44:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828637.1243593; Thu, 31 Oct 2024 11:44: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 1t6Tb7-0008FY-2J; Thu, 31 Oct 2024 11:44:17 +0000
Received: by outflank-mailman (input) for mailman id 828637;
 Thu, 31 Oct 2024 11:44: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 1t6Tb5-0008FS-K7
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 11:44:15 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6Tb5-00CJeZ-1k
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 11:44:15 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6Tb5-007NIO-1D
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 11:44: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] byteorder: replace __u16
Message-Id: <E1t6Tb5-007NIO-1D@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 11:44:15 +0000

commit 61ea18e39acce4db43d173da148b071d1a591faa
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Oct 31 12:39:23 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 31 12:39:23 2024 +0100

    byteorder: replace __u16
    
    In {big,little}_endian.h the changes are entirely mechanical, except for
    dealing with casting away of const from pointers-to-const on lines
    touched anyway.
    
    In swab.h the casting of constants is done away with as well - I simply
    don't see what the respective comment is concerned about in our
    environment (sizeof(int) >= 4, sizeof(long) >= {4,8} depending on
    architecture, sizeof(long long) >= 8). The comment is certainly relevant
    in more general cases. Excess parentheses are dropped as well,
    ___swab16()'s local variable is renamed, and __arch__swab16()'s is
    dropped as being redundant with ___swab16()'s.
    
    With that no uses of the type remain, so it moves to linux-compat.h.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Frediano Ziglio <frediano.ziglio@cloud.com>
---
 xen/include/xen/byteorder/big_endian.h    | 24 ++++++++++++------------
 xen/include/xen/byteorder/little_endian.h | 24 ++++++++++++------------
 xen/include/xen/byteorder/swab.h          | 29 +++++++++++++++--------------
 xen/include/xen/linux-compat.h            |  1 +
 xen/include/xen/types.h                   |  6 +++---
 5 files changed, 43 insertions(+), 41 deletions(-)

diff --git a/xen/include/xen/byteorder/big_endian.h b/xen/include/xen/byteorder/big_endian.h
index 40eb80a390..c6e1bb22fb 100644
--- a/xen/include/xen/byteorder/big_endian.h
+++ b/xen/include/xen/byteorder/big_endian.h
@@ -16,25 +16,25 @@
 #define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x)))
 #define __constant_le32_to_cpu(x) ___constant_swab32((__force __u32)(__le32)(x))
 #define __constant_cpu_to_le16(x) ((__force __le16)___constant_swab16((x)))
-#define __constant_le16_to_cpu(x) ___constant_swab16((__force __u16)(__le16)(x))
+#define __constant_le16_to_cpu(x) ___constant_swab16((__force uint16_t)(__le16)(x))
 #define __constant_cpu_to_be64(x) ((__force __be64)(__u64)(x))
 #define __constant_be64_to_cpu(x) ((__force __u64)(__be64)(x))
 #define __constant_cpu_to_be32(x) ((__force __be32)(__u32)(x))
 #define __constant_be32_to_cpu(x) ((__force __u32)(__be32)(x))
-#define __constant_cpu_to_be16(x) ((__force __be16)(__u16)(x))
-#define __constant_be16_to_cpu(x) ((__force __u16)(__be16)(x))
+#define __constant_cpu_to_be16(x) ((__force __be16)(uint16_t)(x))
+#define __constant_be16_to_cpu(x) ((__force uint16_t)(__be16)(x))
 #define __cpu_to_le64(x) ((__force __le64)__swab64((x)))
 #define __le64_to_cpu(x) __swab64((__force __u64)(__le64)(x))
 #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
 #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
 #define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
-#define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
+#define __le16_to_cpu(x) __swab16((__force uint16_t)(__le16)(x))
 #define __cpu_to_be64(x) ((__force __be64)(__u64)(x))
 #define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
 #define __cpu_to_be32(x) ((__force __be32)(__u32)(x))
 #define __be32_to_cpu(x) ((__force __u32)(__be32)(x))
-#define __cpu_to_be16(x) ((__force __be16)(__u16)(x))
-#define __be16_to_cpu(x) ((__force __u16)(__be16)(x))
+#define __cpu_to_be16(x) ((__force __be16)(uint16_t)(x))
+#define __be16_to_cpu(x) ((__force uint16_t)(__be16)(x))
 
 static inline __le64 __cpu_to_le64p(const __u64 *p)
 {
@@ -52,13 +52,13 @@ static inline __u32 __le32_to_cpup(const __le32 *p)
 {
     return __swab32p((__u32 *)p);
 }
-static inline __le16 __cpu_to_le16p(const __u16 *p)
+static inline __le16 __cpu_to_le16p(const uint16_t *p)
 {
     return (__force __le16)__swab16p(p);
 }
-static inline __u16 __le16_to_cpup(const __le16 *p)
+static inline uint16_t __le16_to_cpup(const __le16 *p)
 {
-    return __swab16p((__u16 *)p);
+    return __swab16p((const uint16_t *)p);
 }
 static inline __be64 __cpu_to_be64p(const __u64 *p)
 {
@@ -76,13 +76,13 @@ static inline __u32 __be32_to_cpup(const __be32 *p)
 {
     return (__force __u32)*p;
 }
-static inline __be16 __cpu_to_be16p(const __u16 *p)
+static inline __be16 __cpu_to_be16p(const uint16_t *p)
 {
     return (__force __be16)*p;
 }
-static inline __u16 __be16_to_cpup(const __be16 *p)
+static inline uint16_t __be16_to_cpup(const __be16 *p)
 {
-    return (__force __u16)*p;
+    return (__force uint16_t)*p;
 }
 #define __cpu_to_le64s(x) __swab64s((x))
 #define __le64_to_cpus(x) __swab64s((x))
diff --git a/xen/include/xen/byteorder/little_endian.h b/xen/include/xen/byteorder/little_endian.h
index 4955632793..501fb9ec7f 100644
--- a/xen/include/xen/byteorder/little_endian.h
+++ b/xen/include/xen/byteorder/little_endian.h
@@ -15,26 +15,26 @@
 #define __constant_le64_to_cpu(x) ((__force __u64)(__le64)(x))
 #define __constant_cpu_to_le32(x) ((__force __le32)(__u32)(x))
 #define __constant_le32_to_cpu(x) ((__force __u32)(__le32)(x))
-#define __constant_cpu_to_le16(x) ((__force __le16)(__u16)(x))
-#define __constant_le16_to_cpu(x) ((__force __u16)(__le16)(x))
+#define __constant_cpu_to_le16(x) ((__force __le16)(uint16_t)(x))
+#define __constant_le16_to_cpu(x) ((__force uint16_t)(__le16)(x))
 #define __constant_cpu_to_be64(x) ((__force __be64)___constant_swab64((x)))
 #define __constant_be64_to_cpu(x) ___constant_swab64((__force __u64)(__be64)(x))
 #define __constant_cpu_to_be32(x) ((__force __be32)___constant_swab32((x)))
 #define __constant_be32_to_cpu(x) ___constant_swab32((__force __u32)(__be32)(x))
 #define __constant_cpu_to_be16(x) ((__force __be16)___constant_swab16((x)))
-#define __constant_be16_to_cpu(x) ___constant_swab16((__force __u16)(__be16)(x))
+#define __constant_be16_to_cpu(x) ___constant_swab16((__force uint16_t)(__be16)(x))
 #define __cpu_to_le64(x) ((__force __le64)(__u64)(x))
 #define __le64_to_cpu(x) ((__force __u64)(__le64)(x))
 #define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
 #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
-#define __cpu_to_le16(x) ((__force __le16)(__u16)(x))
-#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
+#define __cpu_to_le16(x) ((__force __le16)(uint16_t)(x))
+#define __le16_to_cpu(x) ((__force uint16_t)(__le16)(x))
 #define __cpu_to_be64(x) ((__force __be64)__swab64((x)))
 #define __be64_to_cpu(x) __swab64((__force __u64)(__be64)(x))
 #define __cpu_to_be32(x) ((__force __be32)__swab32((x)))
 #define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x))
 #define __cpu_to_be16(x) ((__force __be16)__swab16((x)))
-#define __be16_to_cpu(x) __swab16((__force __u16)(__be16)(x))
+#define __be16_to_cpu(x) __swab16((__force uint16_t)(__be16)(x))
 
 static inline __le64 __cpu_to_le64p(const __u64 *p)
 {
@@ -52,13 +52,13 @@ static inline __u32 __le32_to_cpup(const __le32 *p)
 {
     return (__force __u32)*p;
 }
-static inline __le16 __cpu_to_le16p(const __u16 *p)
+static inline __le16 __cpu_to_le16p(const uint16_t *p)
 {
     return (__force __le16)*p;
 }
-static inline __u16 __le16_to_cpup(const __le16 *p)
+static inline uint16_t __le16_to_cpup(const __le16 *p)
 {
-    return (__force __u16)*p;
+    return (__force uint16_t)*p;
 }
 static inline __be64 __cpu_to_be64p(const __u64 *p)
 {
@@ -76,13 +76,13 @@ static inline __u32 __be32_to_cpup(const __be32 *p)
 {
     return __swab32p((__u32 *)p);
 }
-static inline __be16 __cpu_to_be16p(const __u16 *p)
+static inline __be16 __cpu_to_be16p(const uint16_t *p)
 {
     return (__force __be16)__swab16p(p);
 }
-static inline __u16 __be16_to_cpup(const __be16 *p)
+static inline uint16_t __be16_to_cpup(const __be16 *p)
 {
-    return __swab16p((__u16 *)p);
+    return __swab16p((const uint16_t *)p);
 }
 #define __cpu_to_le64s(x) do {} while (0)
 #define __le64_to_cpus(x) do {} while (0)
diff --git a/xen/include/xen/byteorder/swab.h b/xen/include/xen/byteorder/swab.h
index 9f817e3c44..ff2c7ec71e 100644
--- a/xen/include/xen/byteorder/swab.h
+++ b/xen/include/xen/byteorder/swab.h
@@ -10,15 +10,16 @@
  *    to clean up support for bizarre-endian architectures.
  */
 
-/* casts are necessary for constants, because we never know how for sure
- * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way.
+/*
+ * Casts are necessary for constants, because we never know for sure how
+ * U/UL/ULL map to __u32, __u64. At least not in a portable way.
  */
 #define ___swab16(x)                                    \
 ({                                                      \
-    __u16 __x = (x);                                    \
-    ((__u16)(                                           \
-        (((__u16)(__x) & (__u16)0x00ffU) << 8) |        \
-        (((__u16)(__x) & (__u16)0xff00U) >> 8) ));      \
+    uint16_t x_ = (x);                                  \
+    (uint16_t)(                                         \
+        (((uint16_t)(x_) & 0x00ffU) << 8) |             \
+        (((uint16_t)(x_) & 0xff00U) >> 8));             \
 })
 
 #define ___swab32(x)                                            \
@@ -46,9 +47,9 @@
 })
 
 #define ___constant_swab16(x)                   \
-    ((__u16)(                                   \
-        (((__u16)(x) & (__u16)0x00ffU) << 8) |  \
-        (((__u16)(x) & (__u16)0xff00U) >> 8) ))
+    ((uint16_t)(                                \
+        (((uint16_t)(x) & 0x00ffU) << 8) |      \
+        (((uint16_t)(x) & 0xff00U) >> 8)))
 #define ___constant_swab32(x)                           \
     ((__u32)(                                           \
         (((__u32)(x) & (__u32)0x000000ffUL) << 24) |    \
@@ -70,7 +71,7 @@
  * provide defaults when no architecture-specific optimization is detected
  */
 #ifndef __arch__swab16
-#  define __arch__swab16(x) ({ __u16 __tmp = (x) ; ___swab16(__tmp); })
+#  define __arch__swab16(x) ___swab16(x)
 #endif
 #ifndef __arch__swab32
 #  define __arch__swab32(x) ({ __u32 __tmp = (x) ; ___swab32(__tmp); })
@@ -105,7 +106,7 @@
  */
 #if defined(__GNUC__) && defined(__OPTIMIZE__)
 #  define __swab16(x) \
-(__builtin_constant_p((__u16)(x)) ? \
+(__builtin_constant_p((uint16_t)(x)) ? \
  ___swab16((x)) : \
  __fswab16((x)))
 #  define __swab32(x) \
@@ -123,15 +124,15 @@
 #endif /* OPTIMIZE */
 
 
-static inline attr_const __u16 __fswab16(__u16 x)
+static inline attr_const uint16_t __fswab16(uint16_t x)
 {
     return __arch__swab16(x);
 }
-static inline __u16 __swab16p(const __u16 *x)
+static inline uint16_t __swab16p(const uint16_t *x)
 {
     return __arch__swab16p(x);
 }
-static inline void __swab16s(__u16 *addr)
+static inline void __swab16s(uint16_t *addr)
 {
     __arch__swab16s(addr);
 }
diff --git a/xen/include/xen/linux-compat.h b/xen/include/xen/linux-compat.h
index 656fff883e..59ba1e94bc 100644
--- a/xen/include/xen/linux-compat.h
+++ b/xen/include/xen/linux-compat.h
@@ -14,6 +14,7 @@
 typedef int8_t  s8, __s8;
 typedef uint8_t __u8;
 typedef int16_t s16, __s16;
+typedef uint16_t __u16;
 typedef int32_t s32, __s32;
 typedef int64_t s64, __s64;
 
diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h
index 7cb8d2388d..f4b5d9206a 100644
--- a/xen/include/xen/types.h
+++ b/xen/include/xen/types.h
@@ -6,7 +6,7 @@
 
 /* Linux inherited types which are being phased out */
 typedef uint8_t u8;
-typedef uint16_t u16, __u16;
+typedef uint16_t u16;
 typedef uint32_t u32, __u32;
 typedef uint64_t u64, __u64;
 
@@ -51,8 +51,8 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
 #define LONG_MIN        (-LONG_MAX - 1)
 #define ULONG_MAX       (~0UL)
 
-typedef __u16 __le16;
-typedef __u16 __be16;
+typedef uint16_t __le16;
+typedef uint16_t __be16;
 typedef __u32 __le32;
 typedef __u32 __be32;
 typedef __u64 __le64;
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 11:44:27 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 11:44:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828638.1243597 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6TbH-0008IJ-6I; Thu, 31 Oct 2024 11:44:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828638.1243597; Thu, 31 Oct 2024 11:44: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 1t6TbH-0008IB-3h; Thu, 31 Oct 2024 11:44:27 +0000
Received: by outflank-mailman (input) for mailman id 828638;
 Thu, 31 Oct 2024 11:44: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 1t6TbF-0008Hy-O0
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 11:44:25 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6TbF-00CJep-28
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 11:44:25 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6TbF-007NJF-1v
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 11:44: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] byteorder: replace __u32
Message-Id: <E1t6TbF-007NJF-1v@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 11:44:25 +0000

commit 60db1b1ccd8dd5ac9e442e236d6b23e69cfb248b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Oct 31 12:39:33 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 31 12:39:33 2024 +0100

    byteorder: replace __u32
    
    In {big,little}_endian.h the changes are entirely mechanical, except for
    dealing with casting away of const from pointers-to-const on lines
    touched anyway.
    
    In swab.h the casting of constants is done away with as well - I simply
    don't see what the respective comment is concerned about in our
    environment (sizeof(int) >= 4, sizeof(long) >= {4,8} depending on
    architecture, sizeof(long long) >= 8). The comment is certainly relevant
    in more general cases. Excess parentheses are dropped as well,
    ___swab32()'s local variable is renamed, and __arch__swab32()'s is
    dropped as being redundant with ___swab32()'s.
    
    The masking operation is also dropped from __fswab64().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Frediano Ziglio <frediano.ziglio@cloud.com>
---
 xen/include/xen/byteorder/big_endian.h    | 24 ++++++++++----------
 xen/include/xen/byteorder/little_endian.h | 24 ++++++++++----------
 xen/include/xen/byteorder/swab.h          | 37 +++++++++++++++----------------
 3 files changed, 42 insertions(+), 43 deletions(-)

diff --git a/xen/include/xen/byteorder/big_endian.h b/xen/include/xen/byteorder/big_endian.h
index c6e1bb22fb..4790162ce1 100644
--- a/xen/include/xen/byteorder/big_endian.h
+++ b/xen/include/xen/byteorder/big_endian.h
@@ -14,25 +14,25 @@
 #define __constant_cpu_to_le64(x) ((__force __le64)___constant_swab64((x)))
 #define __constant_le64_to_cpu(x) ___constant_swab64((__force __u64)(__le64)(x))
 #define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x)))
-#define __constant_le32_to_cpu(x) ___constant_swab32((__force __u32)(__le32)(x))
+#define __constant_le32_to_cpu(x) ___constant_swab32((__force uint32_t)(__le32)(x))
 #define __constant_cpu_to_le16(x) ((__force __le16)___constant_swab16((x)))
 #define __constant_le16_to_cpu(x) ___constant_swab16((__force uint16_t)(__le16)(x))
 #define __constant_cpu_to_be64(x) ((__force __be64)(__u64)(x))
 #define __constant_be64_to_cpu(x) ((__force __u64)(__be64)(x))
-#define __constant_cpu_to_be32(x) ((__force __be32)(__u32)(x))
-#define __constant_be32_to_cpu(x) ((__force __u32)(__be32)(x))
+#define __constant_cpu_to_be32(x) ((__force __be32)(uint32_t)(x))
+#define __constant_be32_to_cpu(x) ((__force uint32_t)(__be32)(x))
 #define __constant_cpu_to_be16(x) ((__force __be16)(uint16_t)(x))
 #define __constant_be16_to_cpu(x) ((__force uint16_t)(__be16)(x))
 #define __cpu_to_le64(x) ((__force __le64)__swab64((x)))
 #define __le64_to_cpu(x) __swab64((__force __u64)(__le64)(x))
 #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
-#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
+#define __le32_to_cpu(x) __swab32((__force uint32_t)(__le32)(x))
 #define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
 #define __le16_to_cpu(x) __swab16((__force uint16_t)(__le16)(x))
 #define __cpu_to_be64(x) ((__force __be64)(__u64)(x))
 #define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
-#define __cpu_to_be32(x) ((__force __be32)(__u32)(x))
-#define __be32_to_cpu(x) ((__force __u32)(__be32)(x))
+#define __cpu_to_be32(x) ((__force __be32)(uint32_t)(x))
+#define __be32_to_cpu(x) ((__force uint32_t)(__be32)(x))
 #define __cpu_to_be16(x) ((__force __be16)(uint16_t)(x))
 #define __be16_to_cpu(x) ((__force uint16_t)(__be16)(x))
 
@@ -44,13 +44,13 @@ static inline __u64 __le64_to_cpup(const __le64 *p)
 {
     return __swab64p((__u64 *)p);
 }
-static inline __le32 __cpu_to_le32p(const __u32 *p)
+static inline __le32 __cpu_to_le32p(const uint32_t *p)
 {
     return (__force __le32)__swab32p(p);
 }
-static inline __u32 __le32_to_cpup(const __le32 *p)
+static inline uint32_t __le32_to_cpup(const __le32 *p)
 {
-    return __swab32p((__u32 *)p);
+    return __swab32p((const uint32_t *)p);
 }
 static inline __le16 __cpu_to_le16p(const uint16_t *p)
 {
@@ -68,13 +68,13 @@ static inline __u64 __be64_to_cpup(const __be64 *p)
 {
     return (__force __u64)*p;
 }
-static inline __be32 __cpu_to_be32p(const __u32 *p)
+static inline __be32 __cpu_to_be32p(const uint32_t *p)
 {
     return (__force __be32)*p;
 }
-static inline __u32 __be32_to_cpup(const __be32 *p)
+static inline uint32_t __be32_to_cpup(const __be32 *p)
 {
-    return (__force __u32)*p;
+    return (__force uint32_t)*p;
 }
 static inline __be16 __cpu_to_be16p(const uint16_t *p)
 {
diff --git a/xen/include/xen/byteorder/little_endian.h b/xen/include/xen/byteorder/little_endian.h
index 501fb9ec7f..91a9f3005e 100644
--- a/xen/include/xen/byteorder/little_endian.h
+++ b/xen/include/xen/byteorder/little_endian.h
@@ -13,26 +13,26 @@
 
 #define __constant_cpu_to_le64(x) ((__force __le64)(__u64)(x))
 #define __constant_le64_to_cpu(x) ((__force __u64)(__le64)(x))
-#define __constant_cpu_to_le32(x) ((__force __le32)(__u32)(x))
-#define __constant_le32_to_cpu(x) ((__force __u32)(__le32)(x))
+#define __constant_cpu_to_le32(x) ((__force __le32)(uint32_t)(x))
+#define __constant_le32_to_cpu(x) ((__force uint32_t)(__le32)(x))
 #define __constant_cpu_to_le16(x) ((__force __le16)(uint16_t)(x))
 #define __constant_le16_to_cpu(x) ((__force uint16_t)(__le16)(x))
 #define __constant_cpu_to_be64(x) ((__force __be64)___constant_swab64((x)))
 #define __constant_be64_to_cpu(x) ___constant_swab64((__force __u64)(__be64)(x))
 #define __constant_cpu_to_be32(x) ((__force __be32)___constant_swab32((x)))
-#define __constant_be32_to_cpu(x) ___constant_swab32((__force __u32)(__be32)(x))
+#define __constant_be32_to_cpu(x) ___constant_swab32((__force uint32_t)(__be32)(x))
 #define __constant_cpu_to_be16(x) ((__force __be16)___constant_swab16((x)))
 #define __constant_be16_to_cpu(x) ___constant_swab16((__force uint16_t)(__be16)(x))
 #define __cpu_to_le64(x) ((__force __le64)(__u64)(x))
 #define __le64_to_cpu(x) ((__force __u64)(__le64)(x))
-#define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
-#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
+#define __cpu_to_le32(x) ((__force __le32)(uint32_t)(x))
+#define __le32_to_cpu(x) ((__force uint32_t)(__le32)(x))
 #define __cpu_to_le16(x) ((__force __le16)(uint16_t)(x))
 #define __le16_to_cpu(x) ((__force uint16_t)(__le16)(x))
 #define __cpu_to_be64(x) ((__force __be64)__swab64((x)))
 #define __be64_to_cpu(x) __swab64((__force __u64)(__be64)(x))
 #define __cpu_to_be32(x) ((__force __be32)__swab32((x)))
-#define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x))
+#define __be32_to_cpu(x) __swab32((__force uint32_t)(__be32)(x))
 #define __cpu_to_be16(x) ((__force __be16)__swab16((x)))
 #define __be16_to_cpu(x) __swab16((__force uint16_t)(__be16)(x))
 
@@ -44,13 +44,13 @@ static inline __u64 __le64_to_cpup(const __le64 *p)
 {
     return (__force __u64)*p;
 }
-static inline __le32 __cpu_to_le32p(const __u32 *p)
+static inline __le32 __cpu_to_le32p(const uint32_t *p)
 {
     return (__force __le32)*p;
 }
-static inline __u32 __le32_to_cpup(const __le32 *p)
+static inline uint32_t __le32_to_cpup(const __le32 *p)
 {
-    return (__force __u32)*p;
+    return (__force uint32_t)*p;
 }
 static inline __le16 __cpu_to_le16p(const uint16_t *p)
 {
@@ -68,13 +68,13 @@ static inline __u64 __be64_to_cpup(const __be64 *p)
 {
     return __swab64p((__u64 *)p);
 }
-static inline __be32 __cpu_to_be32p(const __u32 *p)
+static inline __be32 __cpu_to_be32p(const uint32_t *p)
 {
     return (__force __be32)__swab32p(p);
 }
-static inline __u32 __be32_to_cpup(const __be32 *p)
+static inline uint32_t __be32_to_cpup(const __be32 *p)
 {
-    return __swab32p((__u32 *)p);
+    return __swab32p((const uint32_t *)p);
 }
 static inline __be16 __cpu_to_be16p(const uint16_t *p)
 {
diff --git a/xen/include/xen/byteorder/swab.h b/xen/include/xen/byteorder/swab.h
index ff2c7ec71e..aca08af03f 100644
--- a/xen/include/xen/byteorder/swab.h
+++ b/xen/include/xen/byteorder/swab.h
@@ -12,7 +12,7 @@
 
 /*
  * Casts are necessary for constants, because we never know for sure how
- * U/UL/ULL map to __u32, __u64. At least not in a portable way.
+ * UL/ULL map to __u64. At least not in a portable way.
  */
 #define ___swab16(x)                                    \
 ({                                                      \
@@ -24,12 +24,12 @@
 
 #define ___swab32(x)                                            \
 ({                                                              \
-    __u32 __x = (x);                                            \
-    ((__u32)(                                                   \
-        (((__u32)(__x) & (__u32)0x000000ffUL) << 24) |          \
-        (((__u32)(__x) & (__u32)0x0000ff00UL) <<  8) |          \
-        (((__u32)(__x) & (__u32)0x00ff0000UL) >>  8) |          \
-        (((__u32)(__x) & (__u32)0xff000000UL) >> 24) ));        \
+    uint32_t x_ = (x);                                          \
+    (uint32_t)(                                                 \
+        (((uint32_t)(x_) & 0x000000ffU) << 24) |                \
+        (((uint32_t)(x_) & 0x0000ff00U) <<  8) |                \
+        (((uint32_t)(x_) & 0x00ff0000U) >>  8) |                \
+        (((uint32_t)(x_) & 0xff000000U) >> 24));                \
 })
 
 #define ___swab64(x)                                                       \
@@ -51,11 +51,11 @@
         (((uint16_t)(x) & 0x00ffU) << 8) |      \
         (((uint16_t)(x) & 0xff00U) >> 8)))
 #define ___constant_swab32(x)                           \
-    ((__u32)(                                           \
-        (((__u32)(x) & (__u32)0x000000ffUL) << 24) |    \
-        (((__u32)(x) & (__u32)0x0000ff00UL) <<  8) |    \
-        (((__u32)(x) & (__u32)0x00ff0000UL) >>  8) |    \
-        (((__u32)(x) & (__u32)0xff000000UL) >> 24) ))
+    ((uint32_t)(                                        \
+        (((uint32_t)(x) & 0x000000ffU) << 24) |         \
+        (((uint32_t)(x) & 0x0000ff00U) <<  8) |         \
+        (((uint32_t)(x) & 0x00ff0000U) >>  8) |         \
+        (((uint32_t)(x) & 0xff000000U) >> 24)))
 #define ___constant_swab64(x)                                            \
     ((__u64)(                                                            \
         (__u64)(((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) |     \
@@ -74,7 +74,7 @@
 #  define __arch__swab16(x) ___swab16(x)
 #endif
 #ifndef __arch__swab32
-#  define __arch__swab32(x) ({ __u32 __tmp = (x) ; ___swab32(__tmp); })
+#  define __arch__swab32(x) ___swab32(x)
 #endif
 #ifndef __arch__swab64
 #  define __arch__swab64(x) ({ __u64 __tmp = (x) ; ___swab64(__tmp); })
@@ -110,7 +110,7 @@
  ___swab16((x)) : \
  __fswab16((x)))
 #  define __swab32(x) \
-(__builtin_constant_p((__u32)(x)) ? \
+(__builtin_constant_p((uint32_t)(x)) ? \
  ___swab32((x)) : \
  __fswab32((x)))
 #  define __swab64(x) \
@@ -137,15 +137,15 @@ static inline void __swab16s(uint16_t *addr)
     __arch__swab16s(addr);
 }
 
-static inline attr_const __u32 __fswab32(__u32 x)
+static inline attr_const uint32_t __fswab32(uint32_t x)
 {
     return __arch__swab32(x);
 }
-static inline __u32 __swab32p(const __u32 *x)
+static inline uint32_t __swab32p(const uint32_t *x)
 {
     return __arch__swab32p(x);
 }
-static inline void __swab32s(__u32 *addr)
+static inline void __swab32s(uint32_t *addr)
 {
     __arch__swab32s(addr);
 }
@@ -154,8 +154,7 @@ static inline void __swab32s(__u32 *addr)
 static inline attr_const __u64 __fswab64(__u64 x)
 {
 #  ifdef __SWAB_64_THRU_32__
-    __u32 h = x >> 32;
-        __u32 l = x & ((1ULL<<32)-1);
+    uint32_t h = x >> 32, l = x;
         return (((__u64)__swab32(l)) << 32) | ((__u64)(__swab32(h)));
 #  else
     return __arch__swab64(x);
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 11:44:37 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 11:44:37 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828639.1243601 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6TbR-0008Ka-7m; Thu, 31 Oct 2024 11:44:37 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828639.1243601; Thu, 31 Oct 2024 11:44: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 1t6TbR-0008KS-59; Thu, 31 Oct 2024 11:44:37 +0000
Received: by outflank-mailman (input) for mailman id 828639;
 Thu, 31 Oct 2024 11:44: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 1t6TbP-0008KG-Pj
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 11:44:35 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6TbP-00CJey-2U
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 11:44:35 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6TbP-007NL6-2J
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 11:44: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86: modernize swab64()
Message-Id: <E1t6TbP-007NL6-2J@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 11:44:35 +0000

commit 0d87ca02378a56fef83c62fd17f25e10be40b36b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Oct 31 12:40:13 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 31 12:40:13 2024 +0100

    x86: modernize swab64()
    
    For quite a while we didn't need to be concerned of 32-bit code
    generation anymore: Simply use the 64-bit form of BSWAP here.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Frediano Ziglio <frediano.ziglio@cloud.com>
---
 xen/arch/x86/include/asm/byteorder.h | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/include/asm/byteorder.h b/xen/arch/x86/include/asm/byteorder.h
index a877c07f67..f3330af67e 100644
--- a/xen/arch/x86/include/asm/byteorder.h
+++ b/xen/arch/x86/include/asm/byteorder.h
@@ -10,17 +10,10 @@ static inline attr_const __u32 ___arch__swab32(__u32 x)
     return x;
 }
 
-static inline attr_const __u64 ___arch__swab64(__u64 val)
+static inline attr_const uint64_t ___arch__swab64(uint64_t x)
 { 
-    union { 
-        struct { __u32 a,b; } s;
-        __u64 u;
-    } v;
-    v.u = val;
-    asm("bswapl %0 ; bswapl %1 ; xchgl %0,%1" 
-        : "=r" (v.s.a), "=r" (v.s.b) 
-        : "0" (v.s.a), "1" (v.s.b)); 
-    return v.u;
+    asm ( "bswap %0" : "+r" (x) );
+    return x;
 } 
 
 /* Do not define swab16.  Gcc is smart enough to recognize "C" version and
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 11:44:47 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 11:44:47 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828640.1243605 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6Tbb-0008NW-9d; Thu, 31 Oct 2024 11:44:47 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828640.1243605; Thu, 31 Oct 2024 11:44: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 1t6Tbb-0008NO-6c; Thu, 31 Oct 2024 11:44:47 +0000
Received: by outflank-mailman (input) for mailman id 828640;
 Thu, 31 Oct 2024 11:44: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 1t6TbZ-0008NE-Ur
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 11:44:45 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6TbZ-00CJfB-30
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 11:44:45 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6TbZ-007NLm-2e
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 11:44: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] types: replace remaining uses of __u32
Message-Id: <E1t6TbZ-007NLm-2e@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 11:44:45 +0000

commit 517cf3dbfd8195aac0fa08de9e2ccb22518ce828
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Oct 31 12:40:58 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 31 12:40:58 2024 +0100

    types: replace remaining uses of __u32
    
    ... and move the type itself to linux-compat.h.
    
    While doing so drop casts (instead of modiyfing them) from x86'es
    wrmsrl().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Frediano Ziglio <frediano.ziglio@cloud.com>
---
 xen/arch/x86/include/asm/byteorder.h | 2 +-
 xen/arch/x86/include/asm/msr.h       | 5 ++---
 xen/include/xen/bitops.h             | 4 ++--
 xen/include/xen/linux-compat.h       | 1 +
 xen/include/xen/types.h              | 6 +++---
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/include/asm/byteorder.h b/xen/arch/x86/include/asm/byteorder.h
index f3330af67e..44c240376d 100644
--- a/xen/arch/x86/include/asm/byteorder.h
+++ b/xen/arch/x86/include/asm/byteorder.h
@@ -4,7 +4,7 @@
 #include <xen/types.h>
 #include <xen/compiler.h>
 
-static inline attr_const __u32 ___arch__swab32(__u32 x)
+static inline attr_const uint32_t ___arch__swab32(uint32_t x)
 {
     asm("bswap %0" : "=r" (x) : "0" (x));
     return x;
diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index 355fb324ec..7ad66083a6 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -33,9 +33,8 @@
 
 static inline void wrmsrl(unsigned int msr, __u64 val)
 {
-        __u32 lo, hi;
-        lo = (__u32)val;
-        hi = (__u32)(val >> 32);
+        uint32_t lo = val, hi = val >> 32;
+
         wrmsr(msr, lo, hi);
 }
 
diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index 12eb88fb12..79615fb89d 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -413,7 +413,7 @@ static inline int get_count_order(unsigned int count)
  * @word: value to rotate
  * @shift: bits to roll
  */
-static inline __u32 rol32(__u32 word, unsigned int shift)
+static inline uint32_t rol32(uint32_t word, unsigned int shift)
 {
     return (word << shift) | (word >> (32 - shift));
 }
@@ -424,7 +424,7 @@ static inline __u32 rol32(__u32 word, unsigned int shift)
  * @word: value to rotate
  * @shift: bits to roll
  */
-static inline __u32 ror32(__u32 word, unsigned int shift)
+static inline uint32_t ror32(uint32_t word, unsigned int shift)
 {
     return (word >> shift) | (word << (32 - shift));
 }
diff --git a/xen/include/xen/linux-compat.h b/xen/include/xen/linux-compat.h
index 59ba1e94bc..4f2b36a954 100644
--- a/xen/include/xen/linux-compat.h
+++ b/xen/include/xen/linux-compat.h
@@ -16,6 +16,7 @@ typedef uint8_t __u8;
 typedef int16_t s16, __s16;
 typedef uint16_t __u16;
 typedef int32_t s32, __s32;
+typedef uint32_t __u32;
 typedef int64_t s64, __s64;
 
 typedef paddr_t phys_addr_t;
diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h
index f4b5d9206a..a03ab1d1ef 100644
--- a/xen/include/xen/types.h
+++ b/xen/include/xen/types.h
@@ -7,7 +7,7 @@
 /* Linux inherited types which are being phased out */
 typedef uint8_t u8;
 typedef uint16_t u16;
-typedef uint32_t u32, __u32;
+typedef uint32_t u32;
 typedef uint64_t u64, __u64;
 
 #include <asm/types.h>
@@ -53,8 +53,8 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
 
 typedef uint16_t __le16;
 typedef uint16_t __be16;
-typedef __u32 __le32;
-typedef __u32 __be32;
+typedef uint32_t __le32;
+typedef uint32_t __be32;
 typedef __u64 __le64;
 typedef __u64 __be64;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 11:44:56 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 11:44:56 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828641.1243610 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6Tbk-0008Sl-Dl; Thu, 31 Oct 2024 11:44:56 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828641.1243610; Thu, 31 Oct 2024 11: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 1t6Tbk-0008Se-9h; Thu, 31 Oct 2024 11:44:56 +0000
Received: by outflank-mailman (input) for mailman id 828641;
 Thu, 31 Oct 2024 11:44: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 1t6Tbk-0008SV-3h
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 11:44:56 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6Tbk-00CJfm-0H
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 11:44:56 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6Tbj-007NMg-3B
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 11:44: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] byteorder: replace __u64
Message-Id: <E1t6Tbj-007NMg-3B@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 11:44:55 +0000

commit cdbaca6faa8317a8e4e0886e597e19742082f042
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Oct 31 12:41:18 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 31 12:41:18 2024 +0100

    byteorder: replace __u64
    
    In {big,little}_endian.h the changes are entirely mechanical, except for
    dealing with casting away of const from pointers-to-const on lines
    touched anyway.
    
    In swab.h the casting of constants is done away with as well - I simply
    don't see what the respective comment is concerned about in our
    environment (sizeof(int) >= 4, sizeof(long) >= {4,8} depending on
    architecture, sizeof(long long) >= 8). The comment is certainly relevant
    in more general cases. Excess parentheses are dropped as well,
    ___swab64()'s local variable is renamed, and __arch__swab64()'s is
    dropped as being redundant with ___swab64()'s.
    
    Excessive casts compared to ___{,constant_}swab{16,32}() are also
    dropped. Much like excessive ones in __fswab64().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Frediano Ziglio <frediano.ziglio@cloud.com>
---
 xen/include/xen/byteorder/big_endian.h    | 24 +++++++-------
 xen/include/xen/byteorder/little_endian.h | 24 +++++++-------
 xen/include/xen/byteorder/swab.h          | 54 ++++++++++++++-----------------
 3 files changed, 49 insertions(+), 53 deletions(-)

diff --git a/xen/include/xen/byteorder/big_endian.h b/xen/include/xen/byteorder/big_endian.h
index 4790162ce1..ce395a17f6 100644
--- a/xen/include/xen/byteorder/big_endian.h
+++ b/xen/include/xen/byteorder/big_endian.h
@@ -12,37 +12,37 @@
 #include <xen/byteorder/swab.h>
 
 #define __constant_cpu_to_le64(x) ((__force __le64)___constant_swab64((x)))
-#define __constant_le64_to_cpu(x) ___constant_swab64((__force __u64)(__le64)(x))
+#define __constant_le64_to_cpu(x) ___constant_swab64((__force uint64_t)(__le64)(x))
 #define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x)))
 #define __constant_le32_to_cpu(x) ___constant_swab32((__force uint32_t)(__le32)(x))
 #define __constant_cpu_to_le16(x) ((__force __le16)___constant_swab16((x)))
 #define __constant_le16_to_cpu(x) ___constant_swab16((__force uint16_t)(__le16)(x))
-#define __constant_cpu_to_be64(x) ((__force __be64)(__u64)(x))
-#define __constant_be64_to_cpu(x) ((__force __u64)(__be64)(x))
+#define __constant_cpu_to_be64(x) ((__force __be64)(uint64_t)(x))
+#define __constant_be64_to_cpu(x) ((__force uint64_t)(__be64)(x))
 #define __constant_cpu_to_be32(x) ((__force __be32)(uint32_t)(x))
 #define __constant_be32_to_cpu(x) ((__force uint32_t)(__be32)(x))
 #define __constant_cpu_to_be16(x) ((__force __be16)(uint16_t)(x))
 #define __constant_be16_to_cpu(x) ((__force uint16_t)(__be16)(x))
 #define __cpu_to_le64(x) ((__force __le64)__swab64((x)))
-#define __le64_to_cpu(x) __swab64((__force __u64)(__le64)(x))
+#define __le64_to_cpu(x) __swab64((__force uint64_t)(__le64)(x))
 #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
 #define __le32_to_cpu(x) __swab32((__force uint32_t)(__le32)(x))
 #define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
 #define __le16_to_cpu(x) __swab16((__force uint16_t)(__le16)(x))
-#define __cpu_to_be64(x) ((__force __be64)(__u64)(x))
-#define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
+#define __cpu_to_be64(x) ((__force __be64)(uint64_t)(x))
+#define __be64_to_cpu(x) ((__force uint64_t)(__be64)(x))
 #define __cpu_to_be32(x) ((__force __be32)(uint32_t)(x))
 #define __be32_to_cpu(x) ((__force uint32_t)(__be32)(x))
 #define __cpu_to_be16(x) ((__force __be16)(uint16_t)(x))
 #define __be16_to_cpu(x) ((__force uint16_t)(__be16)(x))
 
-static inline __le64 __cpu_to_le64p(const __u64 *p)
+static inline __le64 __cpu_to_le64p(const uint64_t *p)
 {
     return (__force __le64)__swab64p(p);
 }
-static inline __u64 __le64_to_cpup(const __le64 *p)
+static inline uint64_t __le64_to_cpup(const __le64 *p)
 {
-    return __swab64p((__u64 *)p);
+    return __swab64p((const uint64_t *)p);
 }
 static inline __le32 __cpu_to_le32p(const uint32_t *p)
 {
@@ -60,13 +60,13 @@ static inline uint16_t __le16_to_cpup(const __le16 *p)
 {
     return __swab16p((const uint16_t *)p);
 }
-static inline __be64 __cpu_to_be64p(const __u64 *p)
+static inline __be64 __cpu_to_be64p(const uint64_t *p)
 {
     return (__force __be64)*p;
 }
-static inline __u64 __be64_to_cpup(const __be64 *p)
+static inline uint64_t __be64_to_cpup(const __be64 *p)
 {
-    return (__force __u64)*p;
+    return (__force uint64_t)*p;
 }
 static inline __be32 __cpu_to_be32p(const uint32_t *p)
 {
diff --git a/xen/include/xen/byteorder/little_endian.h b/xen/include/xen/byteorder/little_endian.h
index 91a9f3005e..8b118afba5 100644
--- a/xen/include/xen/byteorder/little_endian.h
+++ b/xen/include/xen/byteorder/little_endian.h
@@ -11,38 +11,38 @@
 #include <xen/types.h>
 #include <xen/byteorder/swab.h>
 
-#define __constant_cpu_to_le64(x) ((__force __le64)(__u64)(x))
-#define __constant_le64_to_cpu(x) ((__force __u64)(__le64)(x))
+#define __constant_cpu_to_le64(x) ((__force __le64)(uint64_t)(x))
+#define __constant_le64_to_cpu(x) ((__force uint64_t)(__le64)(x))
 #define __constant_cpu_to_le32(x) ((__force __le32)(uint32_t)(x))
 #define __constant_le32_to_cpu(x) ((__force uint32_t)(__le32)(x))
 #define __constant_cpu_to_le16(x) ((__force __le16)(uint16_t)(x))
 #define __constant_le16_to_cpu(x) ((__force uint16_t)(__le16)(x))
 #define __constant_cpu_to_be64(x) ((__force __be64)___constant_swab64((x)))
-#define __constant_be64_to_cpu(x) ___constant_swab64((__force __u64)(__be64)(x))
+#define __constant_be64_to_cpu(x) ___constant_swab64((__force uint64_t)(__be64)(x))
 #define __constant_cpu_to_be32(x) ((__force __be32)___constant_swab32((x)))
 #define __constant_be32_to_cpu(x) ___constant_swab32((__force uint32_t)(__be32)(x))
 #define __constant_cpu_to_be16(x) ((__force __be16)___constant_swab16((x)))
 #define __constant_be16_to_cpu(x) ___constant_swab16((__force uint16_t)(__be16)(x))
-#define __cpu_to_le64(x) ((__force __le64)(__u64)(x))
-#define __le64_to_cpu(x) ((__force __u64)(__le64)(x))
+#define __cpu_to_le64(x) ((__force __le64)(uint64_t)(x))
+#define __le64_to_cpu(x) ((__force uint64_t)(__le64)(x))
 #define __cpu_to_le32(x) ((__force __le32)(uint32_t)(x))
 #define __le32_to_cpu(x) ((__force uint32_t)(__le32)(x))
 #define __cpu_to_le16(x) ((__force __le16)(uint16_t)(x))
 #define __le16_to_cpu(x) ((__force uint16_t)(__le16)(x))
 #define __cpu_to_be64(x) ((__force __be64)__swab64((x)))
-#define __be64_to_cpu(x) __swab64((__force __u64)(__be64)(x))
+#define __be64_to_cpu(x) __swab64((__force uint64_t)(__be64)(x))
 #define __cpu_to_be32(x) ((__force __be32)__swab32((x)))
 #define __be32_to_cpu(x) __swab32((__force uint32_t)(__be32)(x))
 #define __cpu_to_be16(x) ((__force __be16)__swab16((x)))
 #define __be16_to_cpu(x) __swab16((__force uint16_t)(__be16)(x))
 
-static inline __le64 __cpu_to_le64p(const __u64 *p)
+static inline __le64 __cpu_to_le64p(const uint64_t *p)
 {
     return (__force __le64)*p;
 }
-static inline __u64 __le64_to_cpup(const __le64 *p)
+static inline uint64_t __le64_to_cpup(const __le64 *p)
 {
-    return (__force __u64)*p;
+    return (__force uint64_t)*p;
 }
 static inline __le32 __cpu_to_le32p(const uint32_t *p)
 {
@@ -60,13 +60,13 @@ static inline uint16_t __le16_to_cpup(const __le16 *p)
 {
     return (__force uint16_t)*p;
 }
-static inline __be64 __cpu_to_be64p(const __u64 *p)
+static inline __be64 __cpu_to_be64p(const uint64_t *p)
 {
     return (__force __be64)__swab64p(p);
 }
-static inline __u64 __be64_to_cpup(const __be64 *p)
+static inline uint64_t __be64_to_cpup(const __be64 *p)
 {
-    return __swab64p((__u64 *)p);
+    return __swab64p((const uint64_t *)p);
 }
 static inline __be32 __cpu_to_be32p(const uint32_t *p)
 {
diff --git a/xen/include/xen/byteorder/swab.h b/xen/include/xen/byteorder/swab.h
index aca08af03f..ffcf1cf800 100644
--- a/xen/include/xen/byteorder/swab.h
+++ b/xen/include/xen/byteorder/swab.h
@@ -10,10 +10,6 @@
  *    to clean up support for bizarre-endian architectures.
  */
 
-/*
- * Casts are necessary for constants, because we never know for sure how
- * UL/ULL map to __u64. At least not in a portable way.
- */
 #define ___swab16(x)                                    \
 ({                                                      \
     uint16_t x_ = (x);                                  \
@@ -34,16 +30,16 @@
 
 #define ___swab64(x)                                                       \
 ({                                                                         \
-    __u64 __x = (x);                                                       \
-    ((__u64)(                                                              \
-        (__u64)(((__u64)(__x) & (__u64)0x00000000000000ffULL) << 56) |     \
-        (__u64)(((__u64)(__x) & (__u64)0x000000000000ff00ULL) << 40) |     \
-        (__u64)(((__u64)(__x) & (__u64)0x0000000000ff0000ULL) << 24) |     \
-        (__u64)(((__u64)(__x) & (__u64)0x00000000ff000000ULL) <<  8) |     \
-            (__u64)(((__u64)(__x) & (__u64)0x000000ff00000000ULL) >>  8) | \
-        (__u64)(((__u64)(__x) & (__u64)0x0000ff0000000000ULL) >> 24) |     \
-        (__u64)(((__u64)(__x) & (__u64)0x00ff000000000000ULL) >> 40) |     \
-        (__u64)(((__u64)(__x) & (__u64)0xff00000000000000ULL) >> 56) ));   \
+    uint64_t x_ = (x);                                                     \
+    (uint64_t)(                                                            \
+        (((uint64_t)(x_) & 0x00000000000000ffULL) << 56) |                 \
+        (((uint64_t)(x_) & 0x000000000000ff00ULL) << 40) |                 \
+        (((uint64_t)(x_) & 0x0000000000ff0000ULL) << 24) |                 \
+        (((uint64_t)(x_) & 0x00000000ff000000ULL) <<  8) |                 \
+        (((uint64_t)(x_) & 0x000000ff00000000ULL) >>  8) |                 \
+        (((uint64_t)(x_) & 0x0000ff0000000000ULL) >> 24) |                 \
+        (((uint64_t)(x_) & 0x00ff000000000000ULL) >> 40) |                 \
+        (((uint64_t)(x_) & 0xff00000000000000ULL) >> 56));                 \
 })
 
 #define ___constant_swab16(x)                   \
@@ -57,15 +53,15 @@
         (((uint32_t)(x) & 0x00ff0000U) >>  8) |         \
         (((uint32_t)(x) & 0xff000000U) >> 24)))
 #define ___constant_swab64(x)                                            \
-    ((__u64)(                                                            \
-        (__u64)(((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) |     \
-        (__u64)(((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) |     \
-        (__u64)(((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) |     \
-        (__u64)(((__u64)(x) & (__u64)0x00000000ff000000ULL) <<  8) |     \
-            (__u64)(((__u64)(x) & (__u64)0x000000ff00000000ULL) >>  8) | \
-        (__u64)(((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) |     \
-        (__u64)(((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) |     \
-        (__u64)(((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56) ))
+    ((uint64_t)(                                                         \
+        (((uint64_t)(x) & 0x00000000000000ffULL) << 56) |                \
+        (((uint64_t)(x) & 0x000000000000ff00ULL) << 40) |                \
+        (((uint64_t)(x) & 0x0000000000ff0000ULL) << 24) |                \
+        (((uint64_t)(x) & 0x00000000ff000000ULL) <<  8) |                \
+        (((uint64_t)(x) & 0x000000ff00000000ULL) >>  8) |                \
+        (((uint64_t)(x) & 0x0000ff0000000000ULL) >> 24) |                \
+        (((uint64_t)(x) & 0x00ff000000000000ULL) >> 40) |                \
+        (((uint64_t)(x) & 0xff00000000000000ULL) >> 56)))
 
 /*
  * provide defaults when no architecture-specific optimization is detected
@@ -77,7 +73,7 @@
 #  define __arch__swab32(x) ___swab32(x)
 #endif
 #ifndef __arch__swab64
-#  define __arch__swab64(x) ({ __u64 __tmp = (x) ; ___swab64(__tmp); })
+#  define __arch__swab64(x) ___swab64(x)
 #endif
 
 #ifndef __arch__swab16p
@@ -114,7 +110,7 @@
  ___swab32((x)) : \
  __fswab32((x)))
 #  define __swab64(x) \
-(__builtin_constant_p((__u64)(x)) ? \
+(__builtin_constant_p((uint64_t)(x)) ? \
  ___swab64((x)) : \
  __fswab64((x)))
 #else
@@ -151,20 +147,20 @@ static inline void __swab32s(uint32_t *addr)
 }
 
 #ifdef __BYTEORDER_HAS_U64__
-static inline attr_const __u64 __fswab64(__u64 x)
+static inline attr_const uint64_t __fswab64(uint64_t x)
 {
 #  ifdef __SWAB_64_THRU_32__
     uint32_t h = x >> 32, l = x;
-        return (((__u64)__swab32(l)) << 32) | ((__u64)(__swab32(h)));
+    return ((uint64_t)__swab32(l) << 32) | __swab32(h);
 #  else
     return __arch__swab64(x);
 #  endif
 }
-static inline __u64 __swab64p(const __u64 *x)
+static inline uint64_t __swab64p(const uint64_t *x)
 {
     return __arch__swab64p(x);
 }
-static inline void __swab64s(__u64 *addr)
+static inline void __swab64s(uint64_t *addr)
 {
     __arch__swab64s(addr);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 11:45:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 11:45:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828642.1243613 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6Tbv-0008VM-EG; Thu, 31 Oct 2024 11:45:07 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828642.1243613; Thu, 31 Oct 2024 11:45: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 1t6Tbv-0008VE-BI; Thu, 31 Oct 2024 11:45:07 +0000
Received: by outflank-mailman (input) for mailman id 828642;
 Thu, 31 Oct 2024 11:45: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 1t6Tbu-0008V5-6c
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 11:45:06 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6Tbu-00CJgU-0Z
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 11:45:06 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6Tbu-007NNg-0S
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 11:45: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] types: replace remaining use of __u64
Message-Id: <E1t6Tbu-007NNg-0S@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 11:45:06 +0000

commit bd01fffef2b1f7b60b21046fdd3177c646716080
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Oct 31 12:41:36 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 31 12:41:36 2024 +0100

    types: replace remaining use of __u64
    
    ... and move the type itself to linux-compat.h.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Frediano Ziglio <frediano.ziglio@cloud.com>
---
 xen/arch/x86/include/asm/msr.h | 2 +-
 xen/include/xen/linux-compat.h | 1 +
 xen/include/xen/types.h        | 6 +++---
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index 7ad66083a6..7b00a4db5d 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -31,7 +31,7 @@
 			  : /* no outputs */ \
 			  : "c" (msr), "a" (val1), "d" (val2))
 
-static inline void wrmsrl(unsigned int msr, __u64 val)
+static inline void wrmsrl(unsigned int msr, uint64_t val)
 {
         uint32_t lo = val, hi = val >> 32;
 
diff --git a/xen/include/xen/linux-compat.h b/xen/include/xen/linux-compat.h
index 4f2b36a954..cdbc0dfde0 100644
--- a/xen/include/xen/linux-compat.h
+++ b/xen/include/xen/linux-compat.h
@@ -18,6 +18,7 @@ typedef uint16_t __u16;
 typedef int32_t s32, __s32;
 typedef uint32_t __u32;
 typedef int64_t s64, __s64;
+typedef uint64_t __u64;
 
 typedef paddr_t phys_addr_t;
 
diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h
index a03ab1d1ef..543bfb2159 100644
--- a/xen/include/xen/types.h
+++ b/xen/include/xen/types.h
@@ -8,7 +8,7 @@
 typedef uint8_t u8;
 typedef uint16_t u16;
 typedef uint32_t u32;
-typedef uint64_t u64, __u64;
+typedef uint64_t u64;
 
 #include <asm/types.h>
 
@@ -55,8 +55,8 @@ typedef uint16_t __le16;
 typedef uint16_t __be16;
 typedef uint32_t __le32;
 typedef uint32_t __be32;
-typedef __u64 __le64;
-typedef __u64 __be64;
+typedef uint64_t __le64;
+typedef uint64_t __be64;
 
 typedef unsigned int __attribute__((__mode__(__pointer__))) uintptr_t;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 11:45:17 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 11:45:17 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828643.1243617 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6Tc5-00006Q-FU; Thu, 31 Oct 2024 11:45:17 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828643.1243617; Thu, 31 Oct 2024 11:45: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 1t6Tc5-00006J-Cj; Thu, 31 Oct 2024 11:45:17 +0000
Received: by outflank-mailman (input) for mailman id 828643;
 Thu, 31 Oct 2024 11:45: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 1t6Tc4-000067-9p
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 11:45:16 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6Tc4-00CJgf-0t
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 11:45:16 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6Tc4-007NPP-0k
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 11:45: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/msi: harden stale pdev handling
Message-Id: <E1t6Tc4-007NPP-0k@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 11:45:16 +0000

commit c01855bec572bb81d3934e0d217dd9671a6b4e54
Author:     Stewart Hildebrand <stewart.hildebrand@amd.com>
AuthorDate: Thu Oct 31 12:42:51 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 31 12:42:51 2024 +0100

    x86/msi: harden stale pdev handling
    
    Dom0 normally informs Xen of PCI device removal via
    PHYSDEVOP_pci_device_remove, e.g. in response to SR-IOV disable or
    hot-unplug. We might find ourselves with stale pdevs if a buggy dom0
    fails to report removal via PHYSDEVOP_pci_device_remove. In this case,
    attempts to access the config space of the stale pdevs would be invalid
    and return all 1s.
    
    Some possible conditions leading to this are:
    
    1. Dom0 disables SR-IOV without reporting VF removal to Xen.
    
    The Linux SR-IOV subsystem normally reports VF removal when a PF driver
    disables SR-IOV. In case of a buggy dom0 SR-IOV subsystem, SR-IOV could
    become disabled with stale dangling VF pdevs in both dom0 Linux and Xen.
    
    2. Dom0 reporting PF removal without reporting VF removal.
    
    During SR-IOV PF removal (hot-unplug), a buggy PF driver may fail to
    disable SR-IOV, thus failing to remove the VFs, leaving stale dangling
    VFs behind in both Xen and Linux. At least Linux warns in this case:
    
    [  100.000000]  0000:01:00.0: driver left SR-IOV enabled after remove
    
    In either case, Xen is left with stale VF pdevs, risking invalid PCI
    config space accesses.
    
    When Xen is built with CONFIG_DEBUG=y, the following Xen crashes were
    observed when dom0 attempted to access the config space of a stale VF:
    
    (XEN) Assertion 'pos' failed at arch/x86/msi.c:1274
    (XEN) ----[ Xen-4.20-unstable  x86_64  debug=y  Tainted:   C    ]----
    ...
    (XEN) Xen call trace:
    (XEN)    [<ffff82d040346834>] R pci_msi_conf_write_intercept+0xa2/0x1de
    (XEN)    [<ffff82d04035d6b4>] F pci_conf_write_intercept+0x68/0x78
    (XEN)    [<ffff82d0403264e5>] F arch/x86/pv/emul-priv-op.c#pci_cfg_ok+0xa0/0x114
    (XEN)    [<ffff82d04032660e>] F arch/x86/pv/emul-priv-op.c#guest_io_write+0xb5/0x1c8
    (XEN)    [<ffff82d0403267bb>] F arch/x86/pv/emul-priv-op.c#write_io+0x9a/0xe0
    (XEN)    [<ffff82d04037c77a>] F x86_emulate+0x100e5/0x25f1e
    (XEN)    [<ffff82d0403941a8>] F x86_emulate_wrapper+0x29/0x64
    (XEN)    [<ffff82d04032802b>] F pv_emulate_privileged_op+0x12e/0x217
    (XEN)    [<ffff82d040369f12>] F do_general_protection+0xc2/0x1b8
    (XEN)    [<ffff82d040201aa7>] F x86_64/entry.S#handle_exception_saved+0x2b/0x8c
    
    (XEN) Assertion 'pos' failed at arch/x86/msi.c:1246
    (XEN) ----[ Xen-4.20-unstable  x86_64  debug=y  Tainted:   C    ]----
    ...
    (XEN) Xen call trace:
    (XEN)    [<ffff82d040346b0a>] R pci_reset_msix_state+0x47/0x50
    (XEN)    [<ffff82d040287eec>] F pdev_msix_assign+0x19/0x35
    (XEN)    [<ffff82d040286184>] F drivers/passthrough/pci.c#assign_device+0x181/0x471
    (XEN)    [<ffff82d040287c36>] F iommu_do_pci_domctl+0x248/0x2ec
    (XEN)    [<ffff82d040284e1f>] F iommu_do_domctl+0x26/0x44
    (XEN)    [<ffff82d0402483b8>] F do_domctl+0x8c1/0x1660
    (XEN)    [<ffff82d04032977e>] F pv_hypercall+0x5ce/0x6af
    (XEN)    [<ffff82d0402012d3>] F lstar_enter+0x143/0x150
    
    These ASSERTs triggered because the MSI-X capability position can't be
    found for a stale pdev.
    
    Latch the capability positions of MSI and MSI-X during device init, and
    replace instances of pci_find_cap_offset(..., PCI_CAP_ID_MSI{,X}) with
    the stored value. Introduce one additional ASSERT, while the two
    existing ASSERTs in question continue to work as intended, even with a
    stale pdev.
    
    Fixes: 484d7c852e4f ("x86/MSI-X: track host and guest mask-all requests separately")
    Fixes: 575e18d54d19 ("pci: clear {host/guest}_maskall field on assign")
    Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/msi.c            | 19 +++++++++----------
 xen/drivers/passthrough/msi.c |  3 +++
 xen/drivers/vpci/msi.c        |  2 +-
 xen/drivers/vpci/msix.c       |  2 +-
 xen/include/xen/pci.h         |  3 +++
 5 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index ff2e3d8687..677fd83218 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -278,23 +278,21 @@ void __msi_set_enable(u16 seg, u8 bus, u8 slot, u8 func, int pos, int enable)
 
 static void msi_set_enable(struct pci_dev *dev, int enable)
 {
-    int pos;
+    unsigned int pos = dev->msi_pos;
     u16 seg = dev->seg;
     u8 bus = dev->bus;
     u8 slot = PCI_SLOT(dev->devfn);
     u8 func = PCI_FUNC(dev->devfn);
 
-    pos = pci_find_cap_offset(dev->sbdf, PCI_CAP_ID_MSI);
     if ( pos )
         __msi_set_enable(seg, bus, slot, func, pos, enable);
 }
 
 static void msix_set_enable(struct pci_dev *dev, int enable)
 {
-    int pos;
+    unsigned int pos = dev->msix_pos;
     uint16_t control;
 
-    pos = pci_find_cap_offset(dev->sbdf, PCI_CAP_ID_MSIX);
     if ( pos )
     {
         control = pci_conf_read16(dev->sbdf, msix_control_reg(pos));
@@ -601,7 +599,7 @@ static int msi_capability_init(struct pci_dev *dev,
     uint16_t control;
 
     ASSERT_PDEV_LIST_IS_READ_LOCKED(dev->domain);
-    pos = pci_find_cap_offset(dev->sbdf, PCI_CAP_ID_MSI);
+    pos = dev->msi_pos;
     if ( !pos )
         return -ENODEV;
     control = pci_conf_read16(dev->sbdf, msi_control_reg(pos));
@@ -764,7 +762,7 @@ static int msix_capability_init(struct pci_dev *dev,
     u8 slot = PCI_SLOT(dev->devfn);
     u8 func = PCI_FUNC(dev->devfn);
     bool maskall = msix->host_maskall, zap_on_error = false;
-    unsigned int pos = pci_find_cap_offset(dev->sbdf, PCI_CAP_ID_MSIX);
+    unsigned int pos = dev->msix_pos;
 
     if ( !pos )
         return -ENODEV;
@@ -1133,11 +1131,13 @@ static void _pci_cleanup_msix(struct arch_msix *msix)
 static void __pci_disable_msix(struct msi_desc *entry)
 {
     struct pci_dev *dev = entry->dev;
-    unsigned int pos = pci_find_cap_offset(dev->sbdf, PCI_CAP_ID_MSIX);
+    unsigned int pos = dev->msix_pos;
     u16 control = pci_conf_read16(dev->sbdf,
                                   msix_control_reg(entry->msi_attrib.pos));
     bool maskall = dev->msix->host_maskall;
 
+    ASSERT(pos);
+
     if ( unlikely(!(control & PCI_MSIX_FLAGS_ENABLE)) )
     {
         dev->msix->host_maskall = 1;
@@ -1241,7 +1241,7 @@ void pci_cleanup_msi(struct pci_dev *pdev)
 
 int pci_reset_msix_state(struct pci_dev *pdev)
 {
-    unsigned int pos = pci_find_cap_offset(pdev->sbdf, PCI_CAP_ID_MSIX);
+    unsigned int pos = pdev->msix_pos;
 
     ASSERT(pos);
     /*
@@ -1269,8 +1269,7 @@ int pci_msi_conf_write_intercept(struct pci_dev *pdev, unsigned int reg,
     if ( pdev->msix )
     {
         entry = find_msi_entry(pdev, -1, PCI_CAP_ID_MSIX);
-        pos = entry ? entry->msi_attrib.pos
-                    : pci_find_cap_offset(pdev->sbdf, PCI_CAP_ID_MSIX);
+        pos = entry ? entry->msi_attrib.pos : pdev->msix_pos;
         ASSERT(pos);
 
         if ( reg >= pos && reg < msix_pba_offset_reg(pos) + 4 )
diff --git a/xen/drivers/passthrough/msi.c b/xen/drivers/passthrough/msi.c
index 13d904692e..ed2bc7ebe6 100644
--- a/xen/drivers/passthrough/msi.c
+++ b/xen/drivers/passthrough/msi.c
@@ -29,6 +29,7 @@ int pdev_msi_init(struct pci_dev *pdev)
     {
         uint16_t ctrl = pci_conf_read16(pdev->sbdf, msi_control_reg(pos));
 
+        pdev->msi_pos = pos;
         pdev->msi_maxvec = multi_msi_capable(ctrl);
     }
 
@@ -41,6 +42,8 @@ int pdev_msi_init(struct pci_dev *pdev)
         if ( !msix )
             return -ENOMEM;
 
+        pdev->msix_pos = pos;
+
         spin_lock_init(&msix->table_lock);
 
         ctrl = pci_conf_read16(pdev->sbdf, msix_control_reg(pos));
diff --git a/xen/drivers/vpci/msi.c b/xen/drivers/vpci/msi.c
index dd6620ec56..66e5a8a116 100644
--- a/xen/drivers/vpci/msi.c
+++ b/xen/drivers/vpci/msi.c
@@ -195,7 +195,7 @@ static void cf_check mask_write(
 
 static int cf_check init_msi(struct pci_dev *pdev)
 {
-    unsigned int pos = pci_find_cap_offset(pdev->sbdf, PCI_CAP_ID_MSI);
+    unsigned int pos = pdev->msi_pos;
     uint16_t control;
     int ret;
 
diff --git a/xen/drivers/vpci/msix.c b/xen/drivers/vpci/msix.c
index 5bb4444ce2..6bd8c55bb4 100644
--- a/xen/drivers/vpci/msix.c
+++ b/xen/drivers/vpci/msix.c
@@ -711,7 +711,7 @@ static int cf_check init_msix(struct pci_dev *pdev)
     struct vpci_msix *msix;
     int rc;
 
-    msix_offset = pci_find_cap_offset(pdev->sbdf, PCI_CAP_ID_MSIX);
+    msix_offset = pdev->msix_pos;
     if ( !msix_offset )
         return 0;
 
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index 63e49f0117..1e4fe68c60 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -113,6 +113,9 @@ struct pci_dev {
         pci_sbdf_t sbdf;
     };
 
+    uint8_t msi_pos;
+    uint8_t msix_pos;
+
     uint8_t msi_maxvec;
     uint8_t phantom_stride;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 11:45:27 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 11:45:27 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828644.1243620 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6TcF-000092-Gz; Thu, 31 Oct 2024 11:45:27 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828644.1243620; Thu, 31 Oct 2024 11:45: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 1t6TcF-00008u-EN; Thu, 31 Oct 2024 11:45:27 +0000
Received: by outflank-mailman (input) for mailman id 828644;
 Thu, 31 Oct 2024 11:45: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 1t6TcE-00008m-Cd
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 11:45:26 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6TcE-00CJgm-1B
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 11:45:26 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6TcE-007NQQ-15
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 11:45: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] x86/mm: ensure L2 is always freed if empty
Message-Id: <E1t6TcE-007NQQ-15@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 11:45:26 +0000

commit a6dba2761e2ecaa7ffc3d3bb3c85685d232bbe68
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Oct 31 12:43:10 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 31 12:43:10 2024 +0100

    x86/mm: ensure L2 is always freed if empty
    
    The current logic in modify_xen_mappings() allows for fully empty L2 tables to
    not be freed and unhooked from the parent L3 if the last L2 slot is not
    populated.
    
    Ensure that even when an L2 slot is empty the logic to check whether the whole
    L2 can be removed is not skipped.
    
    Fixes: 4376c05c3113 ('x86-64: use 1GB pages in 1:1 mapping if available')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index d537a799bc..0f53dcebad 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5717,7 +5717,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
 
             v += 1UL << L2_PAGETABLE_SHIFT;
             v &= ~((1UL << L2_PAGETABLE_SHIFT) - 1);
-            continue;
+            goto check_l3;
         }
 
         if ( l2e_get_flags(*pl2e) & _PAGE_PSE )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 15:33:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 15:33:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828813.1243839 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6XAY-0006Rx-J2; Thu, 31 Oct 2024 15:33:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828813.1243839; Thu, 31 Oct 2024 15: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 1t6XAY-0006Rp-Fr; Thu, 31 Oct 2024 15:33:06 +0000
Received: by outflank-mailman (input) for mailman id 828813;
 Thu, 31 Oct 2024 15:33: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 1t6XAX-0006Rj-7J
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 15:33:05 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6XAW-00CPx9-2s
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 15:33:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6XAW-007gHg-2P
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 15: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Revert "scripts: Fix git-checkout.sh to work with branches other than master"
Message-Id: <E1t6XAW-007gHg-2P@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 15:33:04 +0000

commit 2478bed83fc6d8be1d129d9a9617eda2ab3c9790
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Oct 31 15:21:54 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 31 15:21:54 2024 +0000

    Revert "scripts: Fix git-checkout.sh to work with branches other than master"
    
    While it does work with branches, it breaks working with full SHAs.
    
    This reverts commit c554ec124b12f9c0d8bfb2b564ca239bd676037c.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 scripts/git-checkout.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/git-checkout.sh b/scripts/git-checkout.sh
index 3796cbfe39..fd4425ac4e 100755
--- a/scripts/git-checkout.sh
+++ b/scripts/git-checkout.sh
@@ -14,7 +14,7 @@ set -e
 if test \! -d $DIR-remote; then
 	rm -rf $DIR-remote $DIR-remote.tmp
 	mkdir -p $DIR-remote.tmp; rmdir $DIR-remote.tmp
-	$GIT clone -b $TAG $TREE $DIR-remote.tmp
+	$GIT clone $TREE $DIR-remote.tmp
 	if test "$TAG" ; then
 		cd $DIR-remote.tmp
 		$GIT branch -D dummy >/dev/null 2>&1 ||:
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 18:55:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 18:55:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828875.1243904 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6aK2-00047e-Ry; Thu, 31 Oct 2024 18:55:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828875.1243904; Thu, 31 Oct 2024 18:55: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 1t6aK2-00047W-PP; Thu, 31 Oct 2024 18:55:06 +0000
Received: by outflank-mailman (input) for mailman id 828875;
 Thu, 31 Oct 2024 18:55: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 1t6aK0-00047Q-VB
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 18:55:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6aK0-00CXFM-1r
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 18:55:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6aK0-007wJC-1h
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 18: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] Revert "x86/mm: ensure L2 is always freed if empty"
Message-Id: <E1t6aK0-007wJC-1h@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 18:55:04 +0000

commit 7a88871aac3feb9736dedc1f7e3c343166b676d2
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Oct 31 17:11:04 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 31 17:11:04 2024 +0000

    Revert "x86/mm: ensure L2 is always freed if empty"
    
    CI says no:
    
      https://gitlab.com/xen-project/hardware/xen/-/jobs/8240163332
    
    This reverts commit a6dba2761e2ecaa7ffc3d3bb3c85685d232bbe68.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 0f53dcebad..d537a799bc 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5717,7 +5717,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
 
             v += 1UL << L2_PAGETABLE_SHIFT;
             v &= ~((1UL << L2_PAGETABLE_SHIFT) - 1);
-            goto check_l3;
+            continue;
         }
 
         if ( l2e_get_flags(*pl2e) & _PAGE_PSE )
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 18:55:15 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 18:55:15 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828876.1243909 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6aKB-00049E-TU; Thu, 31 Oct 2024 18:55:15 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828876.1243909; Thu, 31 Oct 2024 18: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 1t6aKB-000496-Ql; Thu, 31 Oct 2024 18:55:15 +0000
Received: by outflank-mailman (input) for mailman id 828876;
 Thu, 31 Oct 2024 18: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 1t6aKA-00048k-R2
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 18:55:14 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6aKA-00CXFm-2b
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 18:55:14 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6aKA-007wJn-22
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 18: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] CI: Fix cppcheck parallel build more
Message-Id: <E1t6aKA-007wJn-22@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 18:55:14 +0000

commit e27436fba7f52ddc00c33e569ef91a07da433067
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Oct 31 16:14:40 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 31 17:25:40 2024 +0000

    CI: Fix cppcheck parallel build more
    
    A recent cppcheck run was found to fail:
    
      https://gitlab.com/xen-project/people/andyhhp/xen/-/jobs/8237167472
    
    with:
    
      "type mismatch! call is<type>() before get<type>()" && is<std::string>()
      make[3]: *** [arch/x86/boot/Makefile:28: arch/x86/boot/reloc-trampoline.32.o] Error 1
    
    This turns out to be a parallel build issue, combined with a recent change to
    x86.  Notably, we now have a case where we build both:
    
      CC      arch/x86/boot/reloc-trampoline.32.o
      CC      arch/x86/boot/reloc-trampoline.o
    
    from the same original C file, and cppcheck uses the source C file as the key
    for generating it's intermediate files.
    
    Switch cppcheck to use the object file as the unique key instead.
    
    Fixes: 45bfff651173 ("xen/misra: xen-analysis.py: fix parallel analysis Cppcheck errors")
    Fixes: db8acf31f96b ("x86/boot: Reuse code to relocate trampoline")
    Suggested-by: Luca Fancellu <luca.fancellu@arm.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com>
---
 xen/tools/cppcheck-cc.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/xen/tools/cppcheck-cc.sh b/xen/tools/cppcheck-cc.sh
index 16a965edb7..8a58c3aa86 100755
--- a/xen/tools/cppcheck-cc.sh
+++ b/xen/tools/cppcheck-cc.sh
@@ -26,6 +26,7 @@ EOF
 
 BUILD_DIR=""
 CC_FILE=""
+OBJ_FILE=""
 COMPILER=""
 CPPCHECK_HTML="n"
 CPPCHECK_PLAT_PATH=""
@@ -56,6 +57,7 @@ do
         then
             # This must be the path to the obj file, turn off flag and save path
             OBJTREE_PATH="$(dirname "${OPTION}")"
+            OBJ_FILE="$(basename "${OPTION}")"
             obj_arg_content="n"
         fi
         # Forward any argument to the compiler
@@ -177,12 +179,12 @@ then
     done
     if [ "${IGNORE_PATH}" = "n" ]
     then
-        JDB_FILE="${OBJTREE_PATH}/$(basename "${CC_FILE}".json)"
+        JDB_FILE="${OBJTREE_PATH}/${OBJ_FILE}.json"
 
         # Prepare the Json Compilation Database for the file
         create_jcd "${COMPILER} ${FORWARD_FLAGS}"
 
-        out_file="${OBJTREE_PATH}/$(basename "${CC_FILE%.c}".cppcheck.txt)"
+        out_file="${OBJTREE_PATH}/${OBJ_FILE}.cppcheck.txt"
 
         # Select the right target platform, ARCH is generated from Xen Makefile
         case ${ARCH} in
@@ -211,7 +213,7 @@ then
         fi
 
         # Generate build directory for the analysed file
-        cppcheck_build_dir="${BUILD_DIR}/${OBJTREE_PATH}"
+        cppcheck_build_dir="${BUILD_DIR}/${OBJTREE_PATH}/${OBJ_FILE}"
         mkdir -p "${cppcheck_build_dir}"
 
         # Shellcheck complains about missing quotes on CPPCHECK_TOOL_ARGS, but
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 19:11:11 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 19:11:11 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828888.1243934 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6aZW-0007fj-E4; Thu, 31 Oct 2024 19:11:06 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828888.1243934; Thu, 31 Oct 2024 19: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 1t6aZW-0007fb-AC; Thu, 31 Oct 2024 19:11:06 +0000
Received: by outflank-mailman (input) for mailman id 828888;
 Thu, 31 Oct 2024 19: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 1t6aZU-0007fV-PV
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 19:11:04 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6aZU-00CXvh-20
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 19:11:04 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6aZU-007xGv-1q
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 19: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen staging] SUPPORT.md: Argo: Upgrade status to Tech Preview
Message-Id: <E1t6aZU-007xGv-1q@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 19:11:04 +0000

commit a6d71d59ca33906ed29f9bce0d9888a4d8403159
Author:     Christopher Clark <christopher.w.clark@gmail.com>
AuthorDate: Sat Oct 19 20:06:52 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 31 19:04:59 2024 +0000

    SUPPORT.md: Argo: Upgrade status to Tech Preview
    
    Recent patches to xen-devel indicate active interest in Argo within the Xen
    community, and as the feature has been documented and in use by
    OpenXT for multiple years, update the Xen SUPPORT.md statement of status.
    
    This has also been discussed at several XenSummits, with general agreement to
    the status upgrade.
    
    Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 SUPPORT.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 23dd7e6424..4f56094356 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -848,7 +848,7 @@ This feature is not security supported: see https://xenbits.xen.org/xsa/advisory
 
 ### Argo: Inter-domain message delivery by hypercall
 
-    Status: Experimental
+    Status: Tech Preview
 
 ### x86/PCI Device Passthrough
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 20:55:12 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 20:55:12 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828892.1243938 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6cC7-0005Dn-9R; Thu, 31 Oct 2024 20:55:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828892.1243938; Thu, 31 Oct 2024 20:55:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6cC7-0005Df-6T; Thu, 31 Oct 2024 20:55:03 +0000
Received: by outflank-mailman (input) for mailman id 828892;
 Thu, 31 Oct 2024 20: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 1t6cC6-0005DZ-A8
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 20:55:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cC6-00Cc2H-01
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20:55:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cC5-0083Cb-30
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20:55:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] scripts: Fix git-checkout.sh to work with branches other than master
Message-Id: <E1t6cC5-0083Cb-30@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 20:55:01 +0000

commit c554ec124b12f9c0d8bfb2b564ca239bd676037c
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Oct 30 19:03:42 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 31 10:34:13 2024 +0000

    scripts: Fix git-checkout.sh to work with branches other than master
    
    Xen uses master for QEMU_UPSTREAM_REVISION, and has done for other trees too
    in the path.  Apparently we've never specified a different branch, because the
    git-clone rune only pulls in the master branch; it does not pull in diverging
    branches.  Fix this by stating which branch/tag is wanted.
    
    $TAG is really a committish, and git-clone's -b/--branch takes a committish
    too.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
---
 scripts/git-checkout.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/git-checkout.sh b/scripts/git-checkout.sh
index fd4425ac4e..3796cbfe39 100755
--- a/scripts/git-checkout.sh
+++ b/scripts/git-checkout.sh
@@ -14,7 +14,7 @@ set -e
 if test \! -d $DIR-remote; then
 	rm -rf $DIR-remote $DIR-remote.tmp
 	mkdir -p $DIR-remote.tmp; rmdir $DIR-remote.tmp
-	$GIT clone $TREE $DIR-remote.tmp
+	$GIT clone -b $TAG $TREE $DIR-remote.tmp
 	if test "$TAG" ; then
 		cd $DIR-remote.tmp
 		$GIT branch -D dummy >/dev/null 2>&1 ||:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 20:55:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 20:55:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828893.1243940 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6cCH-0005Fp-AP; Thu, 31 Oct 2024 20:55:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828893.1243940; Thu, 31 Oct 2024 20:55:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6cCH-0005Fh-7q; Thu, 31 Oct 2024 20:55:13 +0000
Received: by outflank-mailman (input) for mailman id 828893;
 Thu, 31 Oct 2024 20: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 1t6cCG-0005FP-4U
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 20:55:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cCG-00Cc2d-0M
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20:55:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cCG-0083D3-0C
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20:55:12 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Config: Update MiniOS revision
Message-Id: <E1t6cCG-0083D3-0C@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 20:55:12 +0000

commit eb4042e3c53befdc49b3ebdae2d526ccb3500c0b
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Wed Oct 30 17:57:59 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 31 10:34:13 2024 +0000

    Config: Update MiniOS revision
    
    Commit 6d5159e8410b ("Add missing symbol exports for grub-pv")
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Acked-by: Jan Beulich <jbeulich@suse.com>
---
 Config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index 6dd2f9439c..f1eab9a20a 100644
--- a/Config.mk
+++ b/Config.mk
@@ -224,7 +224,7 @@ QEMU_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/qemu-xen.git
 QEMU_UPSTREAM_REVISION ?= master
 
 MINIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/mini-os.git
-MINIOS_UPSTREAM_REVISION ?= 80ef70f92cb7b95ef48deea1157f2194b10b8c05
+MINIOS_UPSTREAM_REVISION ?= 6d5159e8410be16a47433bac1627e63f8adc7cd9
 
 SEABIOS_UPSTREAM_URL ?= https://xenbits.xen.org/git-http/seabios.git
 SEABIOS_UPSTREAM_REVISION ?= rel-1.16.3
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 20:55:23 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 20:55:23 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828894.1243946 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6cCR-0005Jr-DF; Thu, 31 Oct 2024 20:55:23 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828894.1243946; Thu, 31 Oct 2024 20:55:23 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6cCR-0005Jj-9D; Thu, 31 Oct 2024 20:55:23 +0000
Received: by outflank-mailman (input) for mailman id 828894;
 Thu, 31 Oct 2024 20: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 1t6cCQ-0005JT-80
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 20:55:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cCQ-00Cc33-0f
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20:55:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cCQ-0083DT-0X
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20:55:22 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] MAINTAINERS: minor file line update
Message-Id: <E1t6cCQ-0083DT-0X@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 20:55:22 +0000

commit 3eb037fbbc606ed9b4d67e4919aa57e2930a04cb
Author:     Frediano Ziglio <frediano.ziglio@cloud.com>
AuthorDate: Fri Oct 25 10:28:15 2024 +0100
Commit:     Julien Grall <jgrall@amazon.com>
CommitDate: Thu Oct 31 11:35:33 2024 +0000

    MAINTAINERS: minor file line update
    
    "xen/arch/arm/include/asm/tee" is a directory and should be terminated
    by a slash ("/").
    
    Signed-off-by: Frediano Ziglio <frediano.ziglio@cloud.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
    Acked-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 3bba2c8c31..17fc5f9eec 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -518,7 +518,7 @@ TEE MEDIATORS
 M:	Volodymyr Babchuk <volodymyr_babchuk@epam.com>
 M:	Bertrand Marquis <bertrand.marquis@arm.com>
 S:	Supported
-F:	xen/arch/arm/include/asm/tee
+F:	xen/arch/arm/include/asm/tee/
 F:	xen/arch/arm/tee/
 
 TOOLSTACK
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 20:55:33 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 20:55:33 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828895.1243949 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6cCb-0005Ns-DM; Thu, 31 Oct 2024 20:55:33 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828895.1243949; Thu, 31 Oct 2024 20:55:33 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6cCb-0005Nl-Ah; Thu, 31 Oct 2024 20:55:33 +0000
Received: by outflank-mailman (input) for mailman id 828895;
 Thu, 31 Oct 2024 20: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 1t6cCa-0005NZ-AF
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 20:55:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cCa-00Cc49-0w
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20:55:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cCa-0083EA-0r
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20:55:32 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] byteorder: replace __u16
Message-Id: <E1t6cCa-0083EA-0r@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 20:55:32 +0000

commit 61ea18e39acce4db43d173da148b071d1a591faa
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Oct 31 12:39:23 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 31 12:39:23 2024 +0100

    byteorder: replace __u16
    
    In {big,little}_endian.h the changes are entirely mechanical, except for
    dealing with casting away of const from pointers-to-const on lines
    touched anyway.
    
    In swab.h the casting of constants is done away with as well - I simply
    don't see what the respective comment is concerned about in our
    environment (sizeof(int) >= 4, sizeof(long) >= {4,8} depending on
    architecture, sizeof(long long) >= 8). The comment is certainly relevant
    in more general cases. Excess parentheses are dropped as well,
    ___swab16()'s local variable is renamed, and __arch__swab16()'s is
    dropped as being redundant with ___swab16()'s.
    
    With that no uses of the type remain, so it moves to linux-compat.h.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Frediano Ziglio <frediano.ziglio@cloud.com>
---
 xen/include/xen/byteorder/big_endian.h    | 24 ++++++++++++------------
 xen/include/xen/byteorder/little_endian.h | 24 ++++++++++++------------
 xen/include/xen/byteorder/swab.h          | 29 +++++++++++++++--------------
 xen/include/xen/linux-compat.h            |  1 +
 xen/include/xen/types.h                   |  6 +++---
 5 files changed, 43 insertions(+), 41 deletions(-)

diff --git a/xen/include/xen/byteorder/big_endian.h b/xen/include/xen/byteorder/big_endian.h
index 40eb80a390..c6e1bb22fb 100644
--- a/xen/include/xen/byteorder/big_endian.h
+++ b/xen/include/xen/byteorder/big_endian.h
@@ -16,25 +16,25 @@
 #define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x)))
 #define __constant_le32_to_cpu(x) ___constant_swab32((__force __u32)(__le32)(x))
 #define __constant_cpu_to_le16(x) ((__force __le16)___constant_swab16((x)))
-#define __constant_le16_to_cpu(x) ___constant_swab16((__force __u16)(__le16)(x))
+#define __constant_le16_to_cpu(x) ___constant_swab16((__force uint16_t)(__le16)(x))
 #define __constant_cpu_to_be64(x) ((__force __be64)(__u64)(x))
 #define __constant_be64_to_cpu(x) ((__force __u64)(__be64)(x))
 #define __constant_cpu_to_be32(x) ((__force __be32)(__u32)(x))
 #define __constant_be32_to_cpu(x) ((__force __u32)(__be32)(x))
-#define __constant_cpu_to_be16(x) ((__force __be16)(__u16)(x))
-#define __constant_be16_to_cpu(x) ((__force __u16)(__be16)(x))
+#define __constant_cpu_to_be16(x) ((__force __be16)(uint16_t)(x))
+#define __constant_be16_to_cpu(x) ((__force uint16_t)(__be16)(x))
 #define __cpu_to_le64(x) ((__force __le64)__swab64((x)))
 #define __le64_to_cpu(x) __swab64((__force __u64)(__le64)(x))
 #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
 #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
 #define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
-#define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
+#define __le16_to_cpu(x) __swab16((__force uint16_t)(__le16)(x))
 #define __cpu_to_be64(x) ((__force __be64)(__u64)(x))
 #define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
 #define __cpu_to_be32(x) ((__force __be32)(__u32)(x))
 #define __be32_to_cpu(x) ((__force __u32)(__be32)(x))
-#define __cpu_to_be16(x) ((__force __be16)(__u16)(x))
-#define __be16_to_cpu(x) ((__force __u16)(__be16)(x))
+#define __cpu_to_be16(x) ((__force __be16)(uint16_t)(x))
+#define __be16_to_cpu(x) ((__force uint16_t)(__be16)(x))
 
 static inline __le64 __cpu_to_le64p(const __u64 *p)
 {
@@ -52,13 +52,13 @@ static inline __u32 __le32_to_cpup(const __le32 *p)
 {
     return __swab32p((__u32 *)p);
 }
-static inline __le16 __cpu_to_le16p(const __u16 *p)
+static inline __le16 __cpu_to_le16p(const uint16_t *p)
 {
     return (__force __le16)__swab16p(p);
 }
-static inline __u16 __le16_to_cpup(const __le16 *p)
+static inline uint16_t __le16_to_cpup(const __le16 *p)
 {
-    return __swab16p((__u16 *)p);
+    return __swab16p((const uint16_t *)p);
 }
 static inline __be64 __cpu_to_be64p(const __u64 *p)
 {
@@ -76,13 +76,13 @@ static inline __u32 __be32_to_cpup(const __be32 *p)
 {
     return (__force __u32)*p;
 }
-static inline __be16 __cpu_to_be16p(const __u16 *p)
+static inline __be16 __cpu_to_be16p(const uint16_t *p)
 {
     return (__force __be16)*p;
 }
-static inline __u16 __be16_to_cpup(const __be16 *p)
+static inline uint16_t __be16_to_cpup(const __be16 *p)
 {
-    return (__force __u16)*p;
+    return (__force uint16_t)*p;
 }
 #define __cpu_to_le64s(x) __swab64s((x))
 #define __le64_to_cpus(x) __swab64s((x))
diff --git a/xen/include/xen/byteorder/little_endian.h b/xen/include/xen/byteorder/little_endian.h
index 4955632793..501fb9ec7f 100644
--- a/xen/include/xen/byteorder/little_endian.h
+++ b/xen/include/xen/byteorder/little_endian.h
@@ -15,26 +15,26 @@
 #define __constant_le64_to_cpu(x) ((__force __u64)(__le64)(x))
 #define __constant_cpu_to_le32(x) ((__force __le32)(__u32)(x))
 #define __constant_le32_to_cpu(x) ((__force __u32)(__le32)(x))
-#define __constant_cpu_to_le16(x) ((__force __le16)(__u16)(x))
-#define __constant_le16_to_cpu(x) ((__force __u16)(__le16)(x))
+#define __constant_cpu_to_le16(x) ((__force __le16)(uint16_t)(x))
+#define __constant_le16_to_cpu(x) ((__force uint16_t)(__le16)(x))
 #define __constant_cpu_to_be64(x) ((__force __be64)___constant_swab64((x)))
 #define __constant_be64_to_cpu(x) ___constant_swab64((__force __u64)(__be64)(x))
 #define __constant_cpu_to_be32(x) ((__force __be32)___constant_swab32((x)))
 #define __constant_be32_to_cpu(x) ___constant_swab32((__force __u32)(__be32)(x))
 #define __constant_cpu_to_be16(x) ((__force __be16)___constant_swab16((x)))
-#define __constant_be16_to_cpu(x) ___constant_swab16((__force __u16)(__be16)(x))
+#define __constant_be16_to_cpu(x) ___constant_swab16((__force uint16_t)(__be16)(x))
 #define __cpu_to_le64(x) ((__force __le64)(__u64)(x))
 #define __le64_to_cpu(x) ((__force __u64)(__le64)(x))
 #define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
 #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
-#define __cpu_to_le16(x) ((__force __le16)(__u16)(x))
-#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
+#define __cpu_to_le16(x) ((__force __le16)(uint16_t)(x))
+#define __le16_to_cpu(x) ((__force uint16_t)(__le16)(x))
 #define __cpu_to_be64(x) ((__force __be64)__swab64((x)))
 #define __be64_to_cpu(x) __swab64((__force __u64)(__be64)(x))
 #define __cpu_to_be32(x) ((__force __be32)__swab32((x)))
 #define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x))
 #define __cpu_to_be16(x) ((__force __be16)__swab16((x)))
-#define __be16_to_cpu(x) __swab16((__force __u16)(__be16)(x))
+#define __be16_to_cpu(x) __swab16((__force uint16_t)(__be16)(x))
 
 static inline __le64 __cpu_to_le64p(const __u64 *p)
 {
@@ -52,13 +52,13 @@ static inline __u32 __le32_to_cpup(const __le32 *p)
 {
     return (__force __u32)*p;
 }
-static inline __le16 __cpu_to_le16p(const __u16 *p)
+static inline __le16 __cpu_to_le16p(const uint16_t *p)
 {
     return (__force __le16)*p;
 }
-static inline __u16 __le16_to_cpup(const __le16 *p)
+static inline uint16_t __le16_to_cpup(const __le16 *p)
 {
-    return (__force __u16)*p;
+    return (__force uint16_t)*p;
 }
 static inline __be64 __cpu_to_be64p(const __u64 *p)
 {
@@ -76,13 +76,13 @@ static inline __u32 __be32_to_cpup(const __be32 *p)
 {
     return __swab32p((__u32 *)p);
 }
-static inline __be16 __cpu_to_be16p(const __u16 *p)
+static inline __be16 __cpu_to_be16p(const uint16_t *p)
 {
     return (__force __be16)__swab16p(p);
 }
-static inline __u16 __be16_to_cpup(const __be16 *p)
+static inline uint16_t __be16_to_cpup(const __be16 *p)
 {
-    return __swab16p((__u16 *)p);
+    return __swab16p((const uint16_t *)p);
 }
 #define __cpu_to_le64s(x) do {} while (0)
 #define __le64_to_cpus(x) do {} while (0)
diff --git a/xen/include/xen/byteorder/swab.h b/xen/include/xen/byteorder/swab.h
index 9f817e3c44..ff2c7ec71e 100644
--- a/xen/include/xen/byteorder/swab.h
+++ b/xen/include/xen/byteorder/swab.h
@@ -10,15 +10,16 @@
  *    to clean up support for bizarre-endian architectures.
  */
 
-/* casts are necessary for constants, because we never know how for sure
- * how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way.
+/*
+ * Casts are necessary for constants, because we never know for sure how
+ * U/UL/ULL map to __u32, __u64. At least not in a portable way.
  */
 #define ___swab16(x)                                    \
 ({                                                      \
-    __u16 __x = (x);                                    \
-    ((__u16)(                                           \
-        (((__u16)(__x) & (__u16)0x00ffU) << 8) |        \
-        (((__u16)(__x) & (__u16)0xff00U) >> 8) ));      \
+    uint16_t x_ = (x);                                  \
+    (uint16_t)(                                         \
+        (((uint16_t)(x_) & 0x00ffU) << 8) |             \
+        (((uint16_t)(x_) & 0xff00U) >> 8));             \
 })
 
 #define ___swab32(x)                                            \
@@ -46,9 +47,9 @@
 })
 
 #define ___constant_swab16(x)                   \
-    ((__u16)(                                   \
-        (((__u16)(x) & (__u16)0x00ffU) << 8) |  \
-        (((__u16)(x) & (__u16)0xff00U) >> 8) ))
+    ((uint16_t)(                                \
+        (((uint16_t)(x) & 0x00ffU) << 8) |      \
+        (((uint16_t)(x) & 0xff00U) >> 8)))
 #define ___constant_swab32(x)                           \
     ((__u32)(                                           \
         (((__u32)(x) & (__u32)0x000000ffUL) << 24) |    \
@@ -70,7 +71,7 @@
  * provide defaults when no architecture-specific optimization is detected
  */
 #ifndef __arch__swab16
-#  define __arch__swab16(x) ({ __u16 __tmp = (x) ; ___swab16(__tmp); })
+#  define __arch__swab16(x) ___swab16(x)
 #endif
 #ifndef __arch__swab32
 #  define __arch__swab32(x) ({ __u32 __tmp = (x) ; ___swab32(__tmp); })
@@ -105,7 +106,7 @@
  */
 #if defined(__GNUC__) && defined(__OPTIMIZE__)
 #  define __swab16(x) \
-(__builtin_constant_p((__u16)(x)) ? \
+(__builtin_constant_p((uint16_t)(x)) ? \
  ___swab16((x)) : \
  __fswab16((x)))
 #  define __swab32(x) \
@@ -123,15 +124,15 @@
 #endif /* OPTIMIZE */
 
 
-static inline attr_const __u16 __fswab16(__u16 x)
+static inline attr_const uint16_t __fswab16(uint16_t x)
 {
     return __arch__swab16(x);
 }
-static inline __u16 __swab16p(const __u16 *x)
+static inline uint16_t __swab16p(const uint16_t *x)
 {
     return __arch__swab16p(x);
 }
-static inline void __swab16s(__u16 *addr)
+static inline void __swab16s(uint16_t *addr)
 {
     __arch__swab16s(addr);
 }
diff --git a/xen/include/xen/linux-compat.h b/xen/include/xen/linux-compat.h
index 656fff883e..59ba1e94bc 100644
--- a/xen/include/xen/linux-compat.h
+++ b/xen/include/xen/linux-compat.h
@@ -14,6 +14,7 @@
 typedef int8_t  s8, __s8;
 typedef uint8_t __u8;
 typedef int16_t s16, __s16;
+typedef uint16_t __u16;
 typedef int32_t s32, __s32;
 typedef int64_t s64, __s64;
 
diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h
index 7cb8d2388d..f4b5d9206a 100644
--- a/xen/include/xen/types.h
+++ b/xen/include/xen/types.h
@@ -6,7 +6,7 @@
 
 /* Linux inherited types which are being phased out */
 typedef uint8_t u8;
-typedef uint16_t u16, __u16;
+typedef uint16_t u16;
 typedef uint32_t u32, __u32;
 typedef uint64_t u64, __u64;
 
@@ -51,8 +51,8 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
 #define LONG_MIN        (-LONG_MAX - 1)
 #define ULONG_MAX       (~0UL)
 
-typedef __u16 __le16;
-typedef __u16 __be16;
+typedef uint16_t __le16;
+typedef uint16_t __be16;
 typedef __u32 __le32;
 typedef __u32 __be32;
 typedef __u64 __le64;
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 20:55:43 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 20:55:43 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828896.1243953 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6cCl-0005RI-GB; Thu, 31 Oct 2024 20:55:43 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828896.1243953; Thu, 31 Oct 2024 20:55:43 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6cCl-0005RA-DX; Thu, 31 Oct 2024 20:55:43 +0000
Received: by outflank-mailman (input) for mailman id 828896;
 Thu, 31 Oct 2024 20: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 1t6cCk-0005Qz-D4
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 20:55:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cCk-00Cc4U-1D
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20:55:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cCk-0083EW-17
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20:55:42 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] byteorder: replace __u32
Message-Id: <E1t6cCk-0083EW-17@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 20:55:42 +0000

commit 60db1b1ccd8dd5ac9e442e236d6b23e69cfb248b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Oct 31 12:39:33 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 31 12:39:33 2024 +0100

    byteorder: replace __u32
    
    In {big,little}_endian.h the changes are entirely mechanical, except for
    dealing with casting away of const from pointers-to-const on lines
    touched anyway.
    
    In swab.h the casting of constants is done away with as well - I simply
    don't see what the respective comment is concerned about in our
    environment (sizeof(int) >= 4, sizeof(long) >= {4,8} depending on
    architecture, sizeof(long long) >= 8). The comment is certainly relevant
    in more general cases. Excess parentheses are dropped as well,
    ___swab32()'s local variable is renamed, and __arch__swab32()'s is
    dropped as being redundant with ___swab32()'s.
    
    The masking operation is also dropped from __fswab64().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Frediano Ziglio <frediano.ziglio@cloud.com>
---
 xen/include/xen/byteorder/big_endian.h    | 24 ++++++++++----------
 xen/include/xen/byteorder/little_endian.h | 24 ++++++++++----------
 xen/include/xen/byteorder/swab.h          | 37 +++++++++++++++----------------
 3 files changed, 42 insertions(+), 43 deletions(-)

diff --git a/xen/include/xen/byteorder/big_endian.h b/xen/include/xen/byteorder/big_endian.h
index c6e1bb22fb..4790162ce1 100644
--- a/xen/include/xen/byteorder/big_endian.h
+++ b/xen/include/xen/byteorder/big_endian.h
@@ -14,25 +14,25 @@
 #define __constant_cpu_to_le64(x) ((__force __le64)___constant_swab64((x)))
 #define __constant_le64_to_cpu(x) ___constant_swab64((__force __u64)(__le64)(x))
 #define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x)))
-#define __constant_le32_to_cpu(x) ___constant_swab32((__force __u32)(__le32)(x))
+#define __constant_le32_to_cpu(x) ___constant_swab32((__force uint32_t)(__le32)(x))
 #define __constant_cpu_to_le16(x) ((__force __le16)___constant_swab16((x)))
 #define __constant_le16_to_cpu(x) ___constant_swab16((__force uint16_t)(__le16)(x))
 #define __constant_cpu_to_be64(x) ((__force __be64)(__u64)(x))
 #define __constant_be64_to_cpu(x) ((__force __u64)(__be64)(x))
-#define __constant_cpu_to_be32(x) ((__force __be32)(__u32)(x))
-#define __constant_be32_to_cpu(x) ((__force __u32)(__be32)(x))
+#define __constant_cpu_to_be32(x) ((__force __be32)(uint32_t)(x))
+#define __constant_be32_to_cpu(x) ((__force uint32_t)(__be32)(x))
 #define __constant_cpu_to_be16(x) ((__force __be16)(uint16_t)(x))
 #define __constant_be16_to_cpu(x) ((__force uint16_t)(__be16)(x))
 #define __cpu_to_le64(x) ((__force __le64)__swab64((x)))
 #define __le64_to_cpu(x) __swab64((__force __u64)(__le64)(x))
 #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
-#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
+#define __le32_to_cpu(x) __swab32((__force uint32_t)(__le32)(x))
 #define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
 #define __le16_to_cpu(x) __swab16((__force uint16_t)(__le16)(x))
 #define __cpu_to_be64(x) ((__force __be64)(__u64)(x))
 #define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
-#define __cpu_to_be32(x) ((__force __be32)(__u32)(x))
-#define __be32_to_cpu(x) ((__force __u32)(__be32)(x))
+#define __cpu_to_be32(x) ((__force __be32)(uint32_t)(x))
+#define __be32_to_cpu(x) ((__force uint32_t)(__be32)(x))
 #define __cpu_to_be16(x) ((__force __be16)(uint16_t)(x))
 #define __be16_to_cpu(x) ((__force uint16_t)(__be16)(x))
 
@@ -44,13 +44,13 @@ static inline __u64 __le64_to_cpup(const __le64 *p)
 {
     return __swab64p((__u64 *)p);
 }
-static inline __le32 __cpu_to_le32p(const __u32 *p)
+static inline __le32 __cpu_to_le32p(const uint32_t *p)
 {
     return (__force __le32)__swab32p(p);
 }
-static inline __u32 __le32_to_cpup(const __le32 *p)
+static inline uint32_t __le32_to_cpup(const __le32 *p)
 {
-    return __swab32p((__u32 *)p);
+    return __swab32p((const uint32_t *)p);
 }
 static inline __le16 __cpu_to_le16p(const uint16_t *p)
 {
@@ -68,13 +68,13 @@ static inline __u64 __be64_to_cpup(const __be64 *p)
 {
     return (__force __u64)*p;
 }
-static inline __be32 __cpu_to_be32p(const __u32 *p)
+static inline __be32 __cpu_to_be32p(const uint32_t *p)
 {
     return (__force __be32)*p;
 }
-static inline __u32 __be32_to_cpup(const __be32 *p)
+static inline uint32_t __be32_to_cpup(const __be32 *p)
 {
-    return (__force __u32)*p;
+    return (__force uint32_t)*p;
 }
 static inline __be16 __cpu_to_be16p(const uint16_t *p)
 {
diff --git a/xen/include/xen/byteorder/little_endian.h b/xen/include/xen/byteorder/little_endian.h
index 501fb9ec7f..91a9f3005e 100644
--- a/xen/include/xen/byteorder/little_endian.h
+++ b/xen/include/xen/byteorder/little_endian.h
@@ -13,26 +13,26 @@
 
 #define __constant_cpu_to_le64(x) ((__force __le64)(__u64)(x))
 #define __constant_le64_to_cpu(x) ((__force __u64)(__le64)(x))
-#define __constant_cpu_to_le32(x) ((__force __le32)(__u32)(x))
-#define __constant_le32_to_cpu(x) ((__force __u32)(__le32)(x))
+#define __constant_cpu_to_le32(x) ((__force __le32)(uint32_t)(x))
+#define __constant_le32_to_cpu(x) ((__force uint32_t)(__le32)(x))
 #define __constant_cpu_to_le16(x) ((__force __le16)(uint16_t)(x))
 #define __constant_le16_to_cpu(x) ((__force uint16_t)(__le16)(x))
 #define __constant_cpu_to_be64(x) ((__force __be64)___constant_swab64((x)))
 #define __constant_be64_to_cpu(x) ___constant_swab64((__force __u64)(__be64)(x))
 #define __constant_cpu_to_be32(x) ((__force __be32)___constant_swab32((x)))
-#define __constant_be32_to_cpu(x) ___constant_swab32((__force __u32)(__be32)(x))
+#define __constant_be32_to_cpu(x) ___constant_swab32((__force uint32_t)(__be32)(x))
 #define __constant_cpu_to_be16(x) ((__force __be16)___constant_swab16((x)))
 #define __constant_be16_to_cpu(x) ___constant_swab16((__force uint16_t)(__be16)(x))
 #define __cpu_to_le64(x) ((__force __le64)(__u64)(x))
 #define __le64_to_cpu(x) ((__force __u64)(__le64)(x))
-#define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
-#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
+#define __cpu_to_le32(x) ((__force __le32)(uint32_t)(x))
+#define __le32_to_cpu(x) ((__force uint32_t)(__le32)(x))
 #define __cpu_to_le16(x) ((__force __le16)(uint16_t)(x))
 #define __le16_to_cpu(x) ((__force uint16_t)(__le16)(x))
 #define __cpu_to_be64(x) ((__force __be64)__swab64((x)))
 #define __be64_to_cpu(x) __swab64((__force __u64)(__be64)(x))
 #define __cpu_to_be32(x) ((__force __be32)__swab32((x)))
-#define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x))
+#define __be32_to_cpu(x) __swab32((__force uint32_t)(__be32)(x))
 #define __cpu_to_be16(x) ((__force __be16)__swab16((x)))
 #define __be16_to_cpu(x) __swab16((__force uint16_t)(__be16)(x))
 
@@ -44,13 +44,13 @@ static inline __u64 __le64_to_cpup(const __le64 *p)
 {
     return (__force __u64)*p;
 }
-static inline __le32 __cpu_to_le32p(const __u32 *p)
+static inline __le32 __cpu_to_le32p(const uint32_t *p)
 {
     return (__force __le32)*p;
 }
-static inline __u32 __le32_to_cpup(const __le32 *p)
+static inline uint32_t __le32_to_cpup(const __le32 *p)
 {
-    return (__force __u32)*p;
+    return (__force uint32_t)*p;
 }
 static inline __le16 __cpu_to_le16p(const uint16_t *p)
 {
@@ -68,13 +68,13 @@ static inline __u64 __be64_to_cpup(const __be64 *p)
 {
     return __swab64p((__u64 *)p);
 }
-static inline __be32 __cpu_to_be32p(const __u32 *p)
+static inline __be32 __cpu_to_be32p(const uint32_t *p)
 {
     return (__force __be32)__swab32p(p);
 }
-static inline __u32 __be32_to_cpup(const __be32 *p)
+static inline uint32_t __be32_to_cpup(const __be32 *p)
 {
-    return __swab32p((__u32 *)p);
+    return __swab32p((const uint32_t *)p);
 }
 static inline __be16 __cpu_to_be16p(const uint16_t *p)
 {
diff --git a/xen/include/xen/byteorder/swab.h b/xen/include/xen/byteorder/swab.h
index ff2c7ec71e..aca08af03f 100644
--- a/xen/include/xen/byteorder/swab.h
+++ b/xen/include/xen/byteorder/swab.h
@@ -12,7 +12,7 @@
 
 /*
  * Casts are necessary for constants, because we never know for sure how
- * U/UL/ULL map to __u32, __u64. At least not in a portable way.
+ * UL/ULL map to __u64. At least not in a portable way.
  */
 #define ___swab16(x)                                    \
 ({                                                      \
@@ -24,12 +24,12 @@
 
 #define ___swab32(x)                                            \
 ({                                                              \
-    __u32 __x = (x);                                            \
-    ((__u32)(                                                   \
-        (((__u32)(__x) & (__u32)0x000000ffUL) << 24) |          \
-        (((__u32)(__x) & (__u32)0x0000ff00UL) <<  8) |          \
-        (((__u32)(__x) & (__u32)0x00ff0000UL) >>  8) |          \
-        (((__u32)(__x) & (__u32)0xff000000UL) >> 24) ));        \
+    uint32_t x_ = (x);                                          \
+    (uint32_t)(                                                 \
+        (((uint32_t)(x_) & 0x000000ffU) << 24) |                \
+        (((uint32_t)(x_) & 0x0000ff00U) <<  8) |                \
+        (((uint32_t)(x_) & 0x00ff0000U) >>  8) |                \
+        (((uint32_t)(x_) & 0xff000000U) >> 24));                \
 })
 
 #define ___swab64(x)                                                       \
@@ -51,11 +51,11 @@
         (((uint16_t)(x) & 0x00ffU) << 8) |      \
         (((uint16_t)(x) & 0xff00U) >> 8)))
 #define ___constant_swab32(x)                           \
-    ((__u32)(                                           \
-        (((__u32)(x) & (__u32)0x000000ffUL) << 24) |    \
-        (((__u32)(x) & (__u32)0x0000ff00UL) <<  8) |    \
-        (((__u32)(x) & (__u32)0x00ff0000UL) >>  8) |    \
-        (((__u32)(x) & (__u32)0xff000000UL) >> 24) ))
+    ((uint32_t)(                                        \
+        (((uint32_t)(x) & 0x000000ffU) << 24) |         \
+        (((uint32_t)(x) & 0x0000ff00U) <<  8) |         \
+        (((uint32_t)(x) & 0x00ff0000U) >>  8) |         \
+        (((uint32_t)(x) & 0xff000000U) >> 24)))
 #define ___constant_swab64(x)                                            \
     ((__u64)(                                                            \
         (__u64)(((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) |     \
@@ -74,7 +74,7 @@
 #  define __arch__swab16(x) ___swab16(x)
 #endif
 #ifndef __arch__swab32
-#  define __arch__swab32(x) ({ __u32 __tmp = (x) ; ___swab32(__tmp); })
+#  define __arch__swab32(x) ___swab32(x)
 #endif
 #ifndef __arch__swab64
 #  define __arch__swab64(x) ({ __u64 __tmp = (x) ; ___swab64(__tmp); })
@@ -110,7 +110,7 @@
  ___swab16((x)) : \
  __fswab16((x)))
 #  define __swab32(x) \
-(__builtin_constant_p((__u32)(x)) ? \
+(__builtin_constant_p((uint32_t)(x)) ? \
  ___swab32((x)) : \
  __fswab32((x)))
 #  define __swab64(x) \
@@ -137,15 +137,15 @@ static inline void __swab16s(uint16_t *addr)
     __arch__swab16s(addr);
 }
 
-static inline attr_const __u32 __fswab32(__u32 x)
+static inline attr_const uint32_t __fswab32(uint32_t x)
 {
     return __arch__swab32(x);
 }
-static inline __u32 __swab32p(const __u32 *x)
+static inline uint32_t __swab32p(const uint32_t *x)
 {
     return __arch__swab32p(x);
 }
-static inline void __swab32s(__u32 *addr)
+static inline void __swab32s(uint32_t *addr)
 {
     __arch__swab32s(addr);
 }
@@ -154,8 +154,7 @@ static inline void __swab32s(__u32 *addr)
 static inline attr_const __u64 __fswab64(__u64 x)
 {
 #  ifdef __SWAB_64_THRU_32__
-    __u32 h = x >> 32;
-        __u32 l = x & ((1ULL<<32)-1);
+    uint32_t h = x >> 32, l = x;
         return (((__u64)__swab32(l)) << 32) | ((__u64)(__swab32(h)));
 #  else
     return __arch__swab64(x);
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 20:55:53 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 20:55:53 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828897.1243957 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6cCv-0005Ut-HS; Thu, 31 Oct 2024 20:55:53 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828897.1243957; Thu, 31 Oct 2024 20: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 1t6cCv-0005Ul-Ew; Thu, 31 Oct 2024 20:55:53 +0000
Received: by outflank-mailman (input) for mailman id 828897;
 Thu, 31 Oct 2024 20: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 1t6cCu-0005Ud-GB
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 20:55:52 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cCu-00Cc4r-1X
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20:55:52 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cCu-0083Es-1O
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86: modernize swab64()
Message-Id: <E1t6cCu-0083Es-1O@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 20:55:52 +0000

commit 0d87ca02378a56fef83c62fd17f25e10be40b36b
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Oct 31 12:40:13 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 31 12:40:13 2024 +0100

    x86: modernize swab64()
    
    For quite a while we didn't need to be concerned of 32-bit code
    generation anymore: Simply use the 64-bit form of BSWAP here.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Frediano Ziglio <frediano.ziglio@cloud.com>
---
 xen/arch/x86/include/asm/byteorder.h | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/xen/arch/x86/include/asm/byteorder.h b/xen/arch/x86/include/asm/byteorder.h
index a877c07f67..f3330af67e 100644
--- a/xen/arch/x86/include/asm/byteorder.h
+++ b/xen/arch/x86/include/asm/byteorder.h
@@ -10,17 +10,10 @@ static inline attr_const __u32 ___arch__swab32(__u32 x)
     return x;
 }
 
-static inline attr_const __u64 ___arch__swab64(__u64 val)
+static inline attr_const uint64_t ___arch__swab64(uint64_t x)
 { 
-    union { 
-        struct { __u32 a,b; } s;
-        __u64 u;
-    } v;
-    v.u = val;
-    asm("bswapl %0 ; bswapl %1 ; xchgl %0,%1" 
-        : "=r" (v.s.a), "=r" (v.s.b) 
-        : "0" (v.s.a), "1" (v.s.b)); 
-    return v.u;
+    asm ( "bswap %0" : "+r" (x) );
+    return x;
 } 
 
 /* Do not define swab16.  Gcc is smart enough to recognize "C" version and
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 20:56:03 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 20:56:03 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828898.1243960 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6cD5-0005Ya-Im; Thu, 31 Oct 2024 20:56:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828898.1243960; Thu, 31 Oct 2024 20: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 1t6cD5-0005YT-GL; Thu, 31 Oct 2024 20:56:03 +0000
Received: by outflank-mailman (input) for mailman id 828898;
 Thu, 31 Oct 2024 20: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 1t6cD4-0005YD-J4
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 20:56:02 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cD4-00Cc5n-1p
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20:56:02 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cD4-0083GE-1i
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] types: replace remaining uses of __u32
Message-Id: <E1t6cD4-0083GE-1i@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 20:56:02 +0000

commit 517cf3dbfd8195aac0fa08de9e2ccb22518ce828
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Oct 31 12:40:58 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 31 12:40:58 2024 +0100

    types: replace remaining uses of __u32
    
    ... and move the type itself to linux-compat.h.
    
    While doing so drop casts (instead of modiyfing them) from x86'es
    wrmsrl().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Frediano Ziglio <frediano.ziglio@cloud.com>
---
 xen/arch/x86/include/asm/byteorder.h | 2 +-
 xen/arch/x86/include/asm/msr.h       | 5 ++---
 xen/include/xen/bitops.h             | 4 ++--
 xen/include/xen/linux-compat.h       | 1 +
 xen/include/xen/types.h              | 6 +++---
 5 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/xen/arch/x86/include/asm/byteorder.h b/xen/arch/x86/include/asm/byteorder.h
index f3330af67e..44c240376d 100644
--- a/xen/arch/x86/include/asm/byteorder.h
+++ b/xen/arch/x86/include/asm/byteorder.h
@@ -4,7 +4,7 @@
 #include <xen/types.h>
 #include <xen/compiler.h>
 
-static inline attr_const __u32 ___arch__swab32(__u32 x)
+static inline attr_const uint32_t ___arch__swab32(uint32_t x)
 {
     asm("bswap %0" : "=r" (x) : "0" (x));
     return x;
diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index 355fb324ec..7ad66083a6 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -33,9 +33,8 @@
 
 static inline void wrmsrl(unsigned int msr, __u64 val)
 {
-        __u32 lo, hi;
-        lo = (__u32)val;
-        hi = (__u32)(val >> 32);
+        uint32_t lo = val, hi = val >> 32;
+
         wrmsr(msr, lo, hi);
 }
 
diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h
index 12eb88fb12..79615fb89d 100644
--- a/xen/include/xen/bitops.h
+++ b/xen/include/xen/bitops.h
@@ -413,7 +413,7 @@ static inline int get_count_order(unsigned int count)
  * @word: value to rotate
  * @shift: bits to roll
  */
-static inline __u32 rol32(__u32 word, unsigned int shift)
+static inline uint32_t rol32(uint32_t word, unsigned int shift)
 {
     return (word << shift) | (word >> (32 - shift));
 }
@@ -424,7 +424,7 @@ static inline __u32 rol32(__u32 word, unsigned int shift)
  * @word: value to rotate
  * @shift: bits to roll
  */
-static inline __u32 ror32(__u32 word, unsigned int shift)
+static inline uint32_t ror32(uint32_t word, unsigned int shift)
 {
     return (word >> shift) | (word << (32 - shift));
 }
diff --git a/xen/include/xen/linux-compat.h b/xen/include/xen/linux-compat.h
index 59ba1e94bc..4f2b36a954 100644
--- a/xen/include/xen/linux-compat.h
+++ b/xen/include/xen/linux-compat.h
@@ -16,6 +16,7 @@ typedef uint8_t __u8;
 typedef int16_t s16, __s16;
 typedef uint16_t __u16;
 typedef int32_t s32, __s32;
+typedef uint32_t __u32;
 typedef int64_t s64, __s64;
 
 typedef paddr_t phys_addr_t;
diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h
index f4b5d9206a..a03ab1d1ef 100644
--- a/xen/include/xen/types.h
+++ b/xen/include/xen/types.h
@@ -7,7 +7,7 @@
 /* Linux inherited types which are being phased out */
 typedef uint8_t u8;
 typedef uint16_t u16;
-typedef uint32_t u32, __u32;
+typedef uint32_t u32;
 typedef uint64_t u64, __u64;
 
 #include <asm/types.h>
@@ -53,8 +53,8 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
 
 typedef uint16_t __le16;
 typedef uint16_t __be16;
-typedef __u32 __le32;
-typedef __u32 __be32;
+typedef uint32_t __le32;
+typedef uint32_t __be32;
 typedef __u64 __le64;
 typedef __u64 __be64;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 20:56:13 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 20:56:13 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828899.1243966 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6cDF-0005bA-LM; Thu, 31 Oct 2024 20:56:13 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828899.1243966; Thu, 31 Oct 2024 20:56:13 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6cDF-0005b3-Hn; Thu, 31 Oct 2024 20:56:13 +0000
Received: by outflank-mailman (input) for mailman id 828899;
 Thu, 31 Oct 2024 20: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 1t6cDE-0005at-MF
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 20:56:12 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cDE-00Cc6E-25
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20:56:12 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cDE-0083Gq-20
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] byteorder: replace __u64
Message-Id: <E1t6cDE-0083Gq-20@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 20:56:12 +0000

commit cdbaca6faa8317a8e4e0886e597e19742082f042
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Oct 31 12:41:18 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 31 12:41:18 2024 +0100

    byteorder: replace __u64
    
    In {big,little}_endian.h the changes are entirely mechanical, except for
    dealing with casting away of const from pointers-to-const on lines
    touched anyway.
    
    In swab.h the casting of constants is done away with as well - I simply
    don't see what the respective comment is concerned about in our
    environment (sizeof(int) >= 4, sizeof(long) >= {4,8} depending on
    architecture, sizeof(long long) >= 8). The comment is certainly relevant
    in more general cases. Excess parentheses are dropped as well,
    ___swab64()'s local variable is renamed, and __arch__swab64()'s is
    dropped as being redundant with ___swab64()'s.
    
    Excessive casts compared to ___{,constant_}swab{16,32}() are also
    dropped. Much like excessive ones in __fswab64().
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Frediano Ziglio <frediano.ziglio@cloud.com>
---
 xen/include/xen/byteorder/big_endian.h    | 24 +++++++-------
 xen/include/xen/byteorder/little_endian.h | 24 +++++++-------
 xen/include/xen/byteorder/swab.h          | 54 ++++++++++++++-----------------
 3 files changed, 49 insertions(+), 53 deletions(-)

diff --git a/xen/include/xen/byteorder/big_endian.h b/xen/include/xen/byteorder/big_endian.h
index 4790162ce1..ce395a17f6 100644
--- a/xen/include/xen/byteorder/big_endian.h
+++ b/xen/include/xen/byteorder/big_endian.h
@@ -12,37 +12,37 @@
 #include <xen/byteorder/swab.h>
 
 #define __constant_cpu_to_le64(x) ((__force __le64)___constant_swab64((x)))
-#define __constant_le64_to_cpu(x) ___constant_swab64((__force __u64)(__le64)(x))
+#define __constant_le64_to_cpu(x) ___constant_swab64((__force uint64_t)(__le64)(x))
 #define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x)))
 #define __constant_le32_to_cpu(x) ___constant_swab32((__force uint32_t)(__le32)(x))
 #define __constant_cpu_to_le16(x) ((__force __le16)___constant_swab16((x)))
 #define __constant_le16_to_cpu(x) ___constant_swab16((__force uint16_t)(__le16)(x))
-#define __constant_cpu_to_be64(x) ((__force __be64)(__u64)(x))
-#define __constant_be64_to_cpu(x) ((__force __u64)(__be64)(x))
+#define __constant_cpu_to_be64(x) ((__force __be64)(uint64_t)(x))
+#define __constant_be64_to_cpu(x) ((__force uint64_t)(__be64)(x))
 #define __constant_cpu_to_be32(x) ((__force __be32)(uint32_t)(x))
 #define __constant_be32_to_cpu(x) ((__force uint32_t)(__be32)(x))
 #define __constant_cpu_to_be16(x) ((__force __be16)(uint16_t)(x))
 #define __constant_be16_to_cpu(x) ((__force uint16_t)(__be16)(x))
 #define __cpu_to_le64(x) ((__force __le64)__swab64((x)))
-#define __le64_to_cpu(x) __swab64((__force __u64)(__le64)(x))
+#define __le64_to_cpu(x) __swab64((__force uint64_t)(__le64)(x))
 #define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
 #define __le32_to_cpu(x) __swab32((__force uint32_t)(__le32)(x))
 #define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
 #define __le16_to_cpu(x) __swab16((__force uint16_t)(__le16)(x))
-#define __cpu_to_be64(x) ((__force __be64)(__u64)(x))
-#define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
+#define __cpu_to_be64(x) ((__force __be64)(uint64_t)(x))
+#define __be64_to_cpu(x) ((__force uint64_t)(__be64)(x))
 #define __cpu_to_be32(x) ((__force __be32)(uint32_t)(x))
 #define __be32_to_cpu(x) ((__force uint32_t)(__be32)(x))
 #define __cpu_to_be16(x) ((__force __be16)(uint16_t)(x))
 #define __be16_to_cpu(x) ((__force uint16_t)(__be16)(x))
 
-static inline __le64 __cpu_to_le64p(const __u64 *p)
+static inline __le64 __cpu_to_le64p(const uint64_t *p)
 {
     return (__force __le64)__swab64p(p);
 }
-static inline __u64 __le64_to_cpup(const __le64 *p)
+static inline uint64_t __le64_to_cpup(const __le64 *p)
 {
-    return __swab64p((__u64 *)p);
+    return __swab64p((const uint64_t *)p);
 }
 static inline __le32 __cpu_to_le32p(const uint32_t *p)
 {
@@ -60,13 +60,13 @@ static inline uint16_t __le16_to_cpup(const __le16 *p)
 {
     return __swab16p((const uint16_t *)p);
 }
-static inline __be64 __cpu_to_be64p(const __u64 *p)
+static inline __be64 __cpu_to_be64p(const uint64_t *p)
 {
     return (__force __be64)*p;
 }
-static inline __u64 __be64_to_cpup(const __be64 *p)
+static inline uint64_t __be64_to_cpup(const __be64 *p)
 {
-    return (__force __u64)*p;
+    return (__force uint64_t)*p;
 }
 static inline __be32 __cpu_to_be32p(const uint32_t *p)
 {
diff --git a/xen/include/xen/byteorder/little_endian.h b/xen/include/xen/byteorder/little_endian.h
index 91a9f3005e..8b118afba5 100644
--- a/xen/include/xen/byteorder/little_endian.h
+++ b/xen/include/xen/byteorder/little_endian.h
@@ -11,38 +11,38 @@
 #include <xen/types.h>
 #include <xen/byteorder/swab.h>
 
-#define __constant_cpu_to_le64(x) ((__force __le64)(__u64)(x))
-#define __constant_le64_to_cpu(x) ((__force __u64)(__le64)(x))
+#define __constant_cpu_to_le64(x) ((__force __le64)(uint64_t)(x))
+#define __constant_le64_to_cpu(x) ((__force uint64_t)(__le64)(x))
 #define __constant_cpu_to_le32(x) ((__force __le32)(uint32_t)(x))
 #define __constant_le32_to_cpu(x) ((__force uint32_t)(__le32)(x))
 #define __constant_cpu_to_le16(x) ((__force __le16)(uint16_t)(x))
 #define __constant_le16_to_cpu(x) ((__force uint16_t)(__le16)(x))
 #define __constant_cpu_to_be64(x) ((__force __be64)___constant_swab64((x)))
-#define __constant_be64_to_cpu(x) ___constant_swab64((__force __u64)(__be64)(x))
+#define __constant_be64_to_cpu(x) ___constant_swab64((__force uint64_t)(__be64)(x))
 #define __constant_cpu_to_be32(x) ((__force __be32)___constant_swab32((x)))
 #define __constant_be32_to_cpu(x) ___constant_swab32((__force uint32_t)(__be32)(x))
 #define __constant_cpu_to_be16(x) ((__force __be16)___constant_swab16((x)))
 #define __constant_be16_to_cpu(x) ___constant_swab16((__force uint16_t)(__be16)(x))
-#define __cpu_to_le64(x) ((__force __le64)(__u64)(x))
-#define __le64_to_cpu(x) ((__force __u64)(__le64)(x))
+#define __cpu_to_le64(x) ((__force __le64)(uint64_t)(x))
+#define __le64_to_cpu(x) ((__force uint64_t)(__le64)(x))
 #define __cpu_to_le32(x) ((__force __le32)(uint32_t)(x))
 #define __le32_to_cpu(x) ((__force uint32_t)(__le32)(x))
 #define __cpu_to_le16(x) ((__force __le16)(uint16_t)(x))
 #define __le16_to_cpu(x) ((__force uint16_t)(__le16)(x))
 #define __cpu_to_be64(x) ((__force __be64)__swab64((x)))
-#define __be64_to_cpu(x) __swab64((__force __u64)(__be64)(x))
+#define __be64_to_cpu(x) __swab64((__force uint64_t)(__be64)(x))
 #define __cpu_to_be32(x) ((__force __be32)__swab32((x)))
 #define __be32_to_cpu(x) __swab32((__force uint32_t)(__be32)(x))
 #define __cpu_to_be16(x) ((__force __be16)__swab16((x)))
 #define __be16_to_cpu(x) __swab16((__force uint16_t)(__be16)(x))
 
-static inline __le64 __cpu_to_le64p(const __u64 *p)
+static inline __le64 __cpu_to_le64p(const uint64_t *p)
 {
     return (__force __le64)*p;
 }
-static inline __u64 __le64_to_cpup(const __le64 *p)
+static inline uint64_t __le64_to_cpup(const __le64 *p)
 {
-    return (__force __u64)*p;
+    return (__force uint64_t)*p;
 }
 static inline __le32 __cpu_to_le32p(const uint32_t *p)
 {
@@ -60,13 +60,13 @@ static inline uint16_t __le16_to_cpup(const __le16 *p)
 {
     return (__force uint16_t)*p;
 }
-static inline __be64 __cpu_to_be64p(const __u64 *p)
+static inline __be64 __cpu_to_be64p(const uint64_t *p)
 {
     return (__force __be64)__swab64p(p);
 }
-static inline __u64 __be64_to_cpup(const __be64 *p)
+static inline uint64_t __be64_to_cpup(const __be64 *p)
 {
-    return __swab64p((__u64 *)p);
+    return __swab64p((const uint64_t *)p);
 }
 static inline __be32 __cpu_to_be32p(const uint32_t *p)
 {
diff --git a/xen/include/xen/byteorder/swab.h b/xen/include/xen/byteorder/swab.h
index aca08af03f..ffcf1cf800 100644
--- a/xen/include/xen/byteorder/swab.h
+++ b/xen/include/xen/byteorder/swab.h
@@ -10,10 +10,6 @@
  *    to clean up support for bizarre-endian architectures.
  */
 
-/*
- * Casts are necessary for constants, because we never know for sure how
- * UL/ULL map to __u64. At least not in a portable way.
- */
 #define ___swab16(x)                                    \
 ({                                                      \
     uint16_t x_ = (x);                                  \
@@ -34,16 +30,16 @@
 
 #define ___swab64(x)                                                       \
 ({                                                                         \
-    __u64 __x = (x);                                                       \
-    ((__u64)(                                                              \
-        (__u64)(((__u64)(__x) & (__u64)0x00000000000000ffULL) << 56) |     \
-        (__u64)(((__u64)(__x) & (__u64)0x000000000000ff00ULL) << 40) |     \
-        (__u64)(((__u64)(__x) & (__u64)0x0000000000ff0000ULL) << 24) |     \
-        (__u64)(((__u64)(__x) & (__u64)0x00000000ff000000ULL) <<  8) |     \
-            (__u64)(((__u64)(__x) & (__u64)0x000000ff00000000ULL) >>  8) | \
-        (__u64)(((__u64)(__x) & (__u64)0x0000ff0000000000ULL) >> 24) |     \
-        (__u64)(((__u64)(__x) & (__u64)0x00ff000000000000ULL) >> 40) |     \
-        (__u64)(((__u64)(__x) & (__u64)0xff00000000000000ULL) >> 56) ));   \
+    uint64_t x_ = (x);                                                     \
+    (uint64_t)(                                                            \
+        (((uint64_t)(x_) & 0x00000000000000ffULL) << 56) |                 \
+        (((uint64_t)(x_) & 0x000000000000ff00ULL) << 40) |                 \
+        (((uint64_t)(x_) & 0x0000000000ff0000ULL) << 24) |                 \
+        (((uint64_t)(x_) & 0x00000000ff000000ULL) <<  8) |                 \
+        (((uint64_t)(x_) & 0x000000ff00000000ULL) >>  8) |                 \
+        (((uint64_t)(x_) & 0x0000ff0000000000ULL) >> 24) |                 \
+        (((uint64_t)(x_) & 0x00ff000000000000ULL) >> 40) |                 \
+        (((uint64_t)(x_) & 0xff00000000000000ULL) >> 56));                 \
 })
 
 #define ___constant_swab16(x)                   \
@@ -57,15 +53,15 @@
         (((uint32_t)(x) & 0x00ff0000U) >>  8) |         \
         (((uint32_t)(x) & 0xff000000U) >> 24)))
 #define ___constant_swab64(x)                                            \
-    ((__u64)(                                                            \
-        (__u64)(((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) |     \
-        (__u64)(((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) |     \
-        (__u64)(((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) |     \
-        (__u64)(((__u64)(x) & (__u64)0x00000000ff000000ULL) <<  8) |     \
-            (__u64)(((__u64)(x) & (__u64)0x000000ff00000000ULL) >>  8) | \
-        (__u64)(((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) |     \
-        (__u64)(((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) |     \
-        (__u64)(((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56) ))
+    ((uint64_t)(                                                         \
+        (((uint64_t)(x) & 0x00000000000000ffULL) << 56) |                \
+        (((uint64_t)(x) & 0x000000000000ff00ULL) << 40) |                \
+        (((uint64_t)(x) & 0x0000000000ff0000ULL) << 24) |                \
+        (((uint64_t)(x) & 0x00000000ff000000ULL) <<  8) |                \
+        (((uint64_t)(x) & 0x000000ff00000000ULL) >>  8) |                \
+        (((uint64_t)(x) & 0x0000ff0000000000ULL) >> 24) |                \
+        (((uint64_t)(x) & 0x00ff000000000000ULL) >> 40) |                \
+        (((uint64_t)(x) & 0xff00000000000000ULL) >> 56)))
 
 /*
  * provide defaults when no architecture-specific optimization is detected
@@ -77,7 +73,7 @@
 #  define __arch__swab32(x) ___swab32(x)
 #endif
 #ifndef __arch__swab64
-#  define __arch__swab64(x) ({ __u64 __tmp = (x) ; ___swab64(__tmp); })
+#  define __arch__swab64(x) ___swab64(x)
 #endif
 
 #ifndef __arch__swab16p
@@ -114,7 +110,7 @@
  ___swab32((x)) : \
  __fswab32((x)))
 #  define __swab64(x) \
-(__builtin_constant_p((__u64)(x)) ? \
+(__builtin_constant_p((uint64_t)(x)) ? \
  ___swab64((x)) : \
  __fswab64((x)))
 #else
@@ -151,20 +147,20 @@ static inline void __swab32s(uint32_t *addr)
 }
 
 #ifdef __BYTEORDER_HAS_U64__
-static inline attr_const __u64 __fswab64(__u64 x)
+static inline attr_const uint64_t __fswab64(uint64_t x)
 {
 #  ifdef __SWAB_64_THRU_32__
     uint32_t h = x >> 32, l = x;
-        return (((__u64)__swab32(l)) << 32) | ((__u64)(__swab32(h)));
+    return ((uint64_t)__swab32(l) << 32) | __swab32(h);
 #  else
     return __arch__swab64(x);
 #  endif
 }
-static inline __u64 __swab64p(const __u64 *x)
+static inline uint64_t __swab64p(const uint64_t *x)
 {
     return __arch__swab64p(x);
 }
-static inline void __swab64s(__u64 *addr)
+static inline void __swab64s(uint64_t *addr)
 {
     __arch__swab64s(addr);
 }
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 20:56:24 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 20:56:24 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828900.1243969 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6cDQ-0005ef-NT; Thu, 31 Oct 2024 20:56:24 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828900.1243969; Thu, 31 Oct 2024 20: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 1t6cDQ-0005eY-Kj; Thu, 31 Oct 2024 20:56:24 +0000
Received: by outflank-mailman (input) for mailman id 828900;
 Thu, 31 Oct 2024 20: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 1t6cDO-0005eO-PZ
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 20:56:22 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cDO-00Cc6a-2Q
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20:56:22 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cDO-0083HC-2H
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] types: replace remaining use of __u64
Message-Id: <E1t6cDO-0083HC-2H@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 20:56:22 +0000

commit bd01fffef2b1f7b60b21046fdd3177c646716080
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Thu Oct 31 12:41:36 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 31 12:41:36 2024 +0100

    types: replace remaining use of __u64
    
    ... and move the type itself to linux-compat.h.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Frediano Ziglio <frediano.ziglio@cloud.com>
---
 xen/arch/x86/include/asm/msr.h | 2 +-
 xen/include/xen/linux-compat.h | 1 +
 xen/include/xen/types.h        | 6 +++---
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/include/asm/msr.h b/xen/arch/x86/include/asm/msr.h
index 7ad66083a6..7b00a4db5d 100644
--- a/xen/arch/x86/include/asm/msr.h
+++ b/xen/arch/x86/include/asm/msr.h
@@ -31,7 +31,7 @@
 			  : /* no outputs */ \
 			  : "c" (msr), "a" (val1), "d" (val2))
 
-static inline void wrmsrl(unsigned int msr, __u64 val)
+static inline void wrmsrl(unsigned int msr, uint64_t val)
 {
         uint32_t lo = val, hi = val >> 32;
 
diff --git a/xen/include/xen/linux-compat.h b/xen/include/xen/linux-compat.h
index 4f2b36a954..cdbc0dfde0 100644
--- a/xen/include/xen/linux-compat.h
+++ b/xen/include/xen/linux-compat.h
@@ -18,6 +18,7 @@ typedef uint16_t __u16;
 typedef int32_t s32, __s32;
 typedef uint32_t __u32;
 typedef int64_t s64, __s64;
+typedef uint64_t __u64;
 
 typedef paddr_t phys_addr_t;
 
diff --git a/xen/include/xen/types.h b/xen/include/xen/types.h
index a03ab1d1ef..543bfb2159 100644
--- a/xen/include/xen/types.h
+++ b/xen/include/xen/types.h
@@ -8,7 +8,7 @@
 typedef uint8_t u8;
 typedef uint16_t u16;
 typedef uint32_t u32;
-typedef uint64_t u64, __u64;
+typedef uint64_t u64;
 
 #include <asm/types.h>
 
@@ -55,8 +55,8 @@ typedef uint16_t __le16;
 typedef uint16_t __be16;
 typedef uint32_t __le32;
 typedef uint32_t __be32;
-typedef __u64 __le64;
-typedef __u64 __be64;
+typedef uint64_t __le64;
+typedef uint64_t __be64;
 
 typedef unsigned int __attribute__((__mode__(__pointer__))) uintptr_t;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 20:56:34 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 20:56:34 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828901.1243973 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6cDa-0005iB-P8; Thu, 31 Oct 2024 20:56:34 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828901.1243973; Thu, 31 Oct 2024 20: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 1t6cDa-0005i3-MT; Thu, 31 Oct 2024 20:56:34 +0000
Received: by outflank-mailman (input) for mailman id 828901;
 Thu, 31 Oct 2024 20: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 1t6cDY-0005hL-SP
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 20:56:32 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cDY-00Cc6t-2l
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20:56:32 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cDY-0083HY-2c
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/msi: harden stale pdev handling
Message-Id: <E1t6cDY-0083HY-2c@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 20:56:32 +0000

commit c01855bec572bb81d3934e0d217dd9671a6b4e54
Author:     Stewart Hildebrand <stewart.hildebrand@amd.com>
AuthorDate: Thu Oct 31 12:42:51 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 31 12:42:51 2024 +0100

    x86/msi: harden stale pdev handling
    
    Dom0 normally informs Xen of PCI device removal via
    PHYSDEVOP_pci_device_remove, e.g. in response to SR-IOV disable or
    hot-unplug. We might find ourselves with stale pdevs if a buggy dom0
    fails to report removal via PHYSDEVOP_pci_device_remove. In this case,
    attempts to access the config space of the stale pdevs would be invalid
    and return all 1s.
    
    Some possible conditions leading to this are:
    
    1. Dom0 disables SR-IOV without reporting VF removal to Xen.
    
    The Linux SR-IOV subsystem normally reports VF removal when a PF driver
    disables SR-IOV. In case of a buggy dom0 SR-IOV subsystem, SR-IOV could
    become disabled with stale dangling VF pdevs in both dom0 Linux and Xen.
    
    2. Dom0 reporting PF removal without reporting VF removal.
    
    During SR-IOV PF removal (hot-unplug), a buggy PF driver may fail to
    disable SR-IOV, thus failing to remove the VFs, leaving stale dangling
    VFs behind in both Xen and Linux. At least Linux warns in this case:
    
    [  100.000000]  0000:01:00.0: driver left SR-IOV enabled after remove
    
    In either case, Xen is left with stale VF pdevs, risking invalid PCI
    config space accesses.
    
    When Xen is built with CONFIG_DEBUG=y, the following Xen crashes were
    observed when dom0 attempted to access the config space of a stale VF:
    
    (XEN) Assertion 'pos' failed at arch/x86/msi.c:1274
    (XEN) ----[ Xen-4.20-unstable  x86_64  debug=y  Tainted:   C    ]----
    ...
    (XEN) Xen call trace:
    (XEN)    [<ffff82d040346834>] R pci_msi_conf_write_intercept+0xa2/0x1de
    (XEN)    [<ffff82d04035d6b4>] F pci_conf_write_intercept+0x68/0x78
    (XEN)    [<ffff82d0403264e5>] F arch/x86/pv/emul-priv-op.c#pci_cfg_ok+0xa0/0x114
    (XEN)    [<ffff82d04032660e>] F arch/x86/pv/emul-priv-op.c#guest_io_write+0xb5/0x1c8
    (XEN)    [<ffff82d0403267bb>] F arch/x86/pv/emul-priv-op.c#write_io+0x9a/0xe0
    (XEN)    [<ffff82d04037c77a>] F x86_emulate+0x100e5/0x25f1e
    (XEN)    [<ffff82d0403941a8>] F x86_emulate_wrapper+0x29/0x64
    (XEN)    [<ffff82d04032802b>] F pv_emulate_privileged_op+0x12e/0x217
    (XEN)    [<ffff82d040369f12>] F do_general_protection+0xc2/0x1b8
    (XEN)    [<ffff82d040201aa7>] F x86_64/entry.S#handle_exception_saved+0x2b/0x8c
    
    (XEN) Assertion 'pos' failed at arch/x86/msi.c:1246
    (XEN) ----[ Xen-4.20-unstable  x86_64  debug=y  Tainted:   C    ]----
    ...
    (XEN) Xen call trace:
    (XEN)    [<ffff82d040346b0a>] R pci_reset_msix_state+0x47/0x50
    (XEN)    [<ffff82d040287eec>] F pdev_msix_assign+0x19/0x35
    (XEN)    [<ffff82d040286184>] F drivers/passthrough/pci.c#assign_device+0x181/0x471
    (XEN)    [<ffff82d040287c36>] F iommu_do_pci_domctl+0x248/0x2ec
    (XEN)    [<ffff82d040284e1f>] F iommu_do_domctl+0x26/0x44
    (XEN)    [<ffff82d0402483b8>] F do_domctl+0x8c1/0x1660
    (XEN)    [<ffff82d04032977e>] F pv_hypercall+0x5ce/0x6af
    (XEN)    [<ffff82d0402012d3>] F lstar_enter+0x143/0x150
    
    These ASSERTs triggered because the MSI-X capability position can't be
    found for a stale pdev.
    
    Latch the capability positions of MSI and MSI-X during device init, and
    replace instances of pci_find_cap_offset(..., PCI_CAP_ID_MSI{,X}) with
    the stored value. Introduce one additional ASSERT, while the two
    existing ASSERTs in question continue to work as intended, even with a
    stale pdev.
    
    Fixes: 484d7c852e4f ("x86/MSI-X: track host and guest mask-all requests separately")
    Fixes: 575e18d54d19 ("pci: clear {host/guest}_maskall field on assign")
    Signed-off-by: Stewart Hildebrand <stewart.hildebrand@amd.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/arch/x86/msi.c            | 19 +++++++++----------
 xen/drivers/passthrough/msi.c |  3 +++
 xen/drivers/vpci/msi.c        |  2 +-
 xen/drivers/vpci/msix.c       |  2 +-
 xen/include/xen/pci.h         |  3 +++
 5 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c
index ff2e3d8687..677fd83218 100644
--- a/xen/arch/x86/msi.c
+++ b/xen/arch/x86/msi.c
@@ -278,23 +278,21 @@ void __msi_set_enable(u16 seg, u8 bus, u8 slot, u8 func, int pos, int enable)
 
 static void msi_set_enable(struct pci_dev *dev, int enable)
 {
-    int pos;
+    unsigned int pos = dev->msi_pos;
     u16 seg = dev->seg;
     u8 bus = dev->bus;
     u8 slot = PCI_SLOT(dev->devfn);
     u8 func = PCI_FUNC(dev->devfn);
 
-    pos = pci_find_cap_offset(dev->sbdf, PCI_CAP_ID_MSI);
     if ( pos )
         __msi_set_enable(seg, bus, slot, func, pos, enable);
 }
 
 static void msix_set_enable(struct pci_dev *dev, int enable)
 {
-    int pos;
+    unsigned int pos = dev->msix_pos;
     uint16_t control;
 
-    pos = pci_find_cap_offset(dev->sbdf, PCI_CAP_ID_MSIX);
     if ( pos )
     {
         control = pci_conf_read16(dev->sbdf, msix_control_reg(pos));
@@ -601,7 +599,7 @@ static int msi_capability_init(struct pci_dev *dev,
     uint16_t control;
 
     ASSERT_PDEV_LIST_IS_READ_LOCKED(dev->domain);
-    pos = pci_find_cap_offset(dev->sbdf, PCI_CAP_ID_MSI);
+    pos = dev->msi_pos;
     if ( !pos )
         return -ENODEV;
     control = pci_conf_read16(dev->sbdf, msi_control_reg(pos));
@@ -764,7 +762,7 @@ static int msix_capability_init(struct pci_dev *dev,
     u8 slot = PCI_SLOT(dev->devfn);
     u8 func = PCI_FUNC(dev->devfn);
     bool maskall = msix->host_maskall, zap_on_error = false;
-    unsigned int pos = pci_find_cap_offset(dev->sbdf, PCI_CAP_ID_MSIX);
+    unsigned int pos = dev->msix_pos;
 
     if ( !pos )
         return -ENODEV;
@@ -1133,11 +1131,13 @@ static void _pci_cleanup_msix(struct arch_msix *msix)
 static void __pci_disable_msix(struct msi_desc *entry)
 {
     struct pci_dev *dev = entry->dev;
-    unsigned int pos = pci_find_cap_offset(dev->sbdf, PCI_CAP_ID_MSIX);
+    unsigned int pos = dev->msix_pos;
     u16 control = pci_conf_read16(dev->sbdf,
                                   msix_control_reg(entry->msi_attrib.pos));
     bool maskall = dev->msix->host_maskall;
 
+    ASSERT(pos);
+
     if ( unlikely(!(control & PCI_MSIX_FLAGS_ENABLE)) )
     {
         dev->msix->host_maskall = 1;
@@ -1241,7 +1241,7 @@ void pci_cleanup_msi(struct pci_dev *pdev)
 
 int pci_reset_msix_state(struct pci_dev *pdev)
 {
-    unsigned int pos = pci_find_cap_offset(pdev->sbdf, PCI_CAP_ID_MSIX);
+    unsigned int pos = pdev->msix_pos;
 
     ASSERT(pos);
     /*
@@ -1269,8 +1269,7 @@ int pci_msi_conf_write_intercept(struct pci_dev *pdev, unsigned int reg,
     if ( pdev->msix )
     {
         entry = find_msi_entry(pdev, -1, PCI_CAP_ID_MSIX);
-        pos = entry ? entry->msi_attrib.pos
-                    : pci_find_cap_offset(pdev->sbdf, PCI_CAP_ID_MSIX);
+        pos = entry ? entry->msi_attrib.pos : pdev->msix_pos;
         ASSERT(pos);
 
         if ( reg >= pos && reg < msix_pba_offset_reg(pos) + 4 )
diff --git a/xen/drivers/passthrough/msi.c b/xen/drivers/passthrough/msi.c
index 13d904692e..ed2bc7ebe6 100644
--- a/xen/drivers/passthrough/msi.c
+++ b/xen/drivers/passthrough/msi.c
@@ -29,6 +29,7 @@ int pdev_msi_init(struct pci_dev *pdev)
     {
         uint16_t ctrl = pci_conf_read16(pdev->sbdf, msi_control_reg(pos));
 
+        pdev->msi_pos = pos;
         pdev->msi_maxvec = multi_msi_capable(ctrl);
     }
 
@@ -41,6 +42,8 @@ int pdev_msi_init(struct pci_dev *pdev)
         if ( !msix )
             return -ENOMEM;
 
+        pdev->msix_pos = pos;
+
         spin_lock_init(&msix->table_lock);
 
         ctrl = pci_conf_read16(pdev->sbdf, msix_control_reg(pos));
diff --git a/xen/drivers/vpci/msi.c b/xen/drivers/vpci/msi.c
index dd6620ec56..66e5a8a116 100644
--- a/xen/drivers/vpci/msi.c
+++ b/xen/drivers/vpci/msi.c
@@ -195,7 +195,7 @@ static void cf_check mask_write(
 
 static int cf_check init_msi(struct pci_dev *pdev)
 {
-    unsigned int pos = pci_find_cap_offset(pdev->sbdf, PCI_CAP_ID_MSI);
+    unsigned int pos = pdev->msi_pos;
     uint16_t control;
     int ret;
 
diff --git a/xen/drivers/vpci/msix.c b/xen/drivers/vpci/msix.c
index 5bb4444ce2..6bd8c55bb4 100644
--- a/xen/drivers/vpci/msix.c
+++ b/xen/drivers/vpci/msix.c
@@ -711,7 +711,7 @@ static int cf_check init_msix(struct pci_dev *pdev)
     struct vpci_msix *msix;
     int rc;
 
-    msix_offset = pci_find_cap_offset(pdev->sbdf, PCI_CAP_ID_MSIX);
+    msix_offset = pdev->msix_pos;
     if ( !msix_offset )
         return 0;
 
diff --git a/xen/include/xen/pci.h b/xen/include/xen/pci.h
index 63e49f0117..1e4fe68c60 100644
--- a/xen/include/xen/pci.h
+++ b/xen/include/xen/pci.h
@@ -113,6 +113,9 @@ struct pci_dev {
         pci_sbdf_t sbdf;
     };
 
+    uint8_t msi_pos;
+    uint8_t msix_pos;
+
     uint8_t msi_maxvec;
     uint8_t phantom_stride;
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 20:56:44 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 20:56:44 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828902.1243977 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6cDk-0005kn-QZ; Thu, 31 Oct 2024 20:56:44 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828902.1243977; Thu, 31 Oct 2024 20: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 1t6cDk-0005kf-Nx; Thu, 31 Oct 2024 20:56:44 +0000
Received: by outflank-mailman (input) for mailman id 828902;
 Thu, 31 Oct 2024 20: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 1t6cDi-0005kM-Vf
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 20:56:42 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cDi-00Cc7H-35
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20:56:42 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cDi-0083In-2x
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] x86/mm: ensure L2 is always freed if empty
Message-Id: <E1t6cDi-0083In-2x@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 20:56:42 +0000

commit a6dba2761e2ecaa7ffc3d3bb3c85685d232bbe68
Author:     Roger Pau Monné <roger.pau@citrix.com>
AuthorDate: Thu Oct 31 12:43:10 2024 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Thu Oct 31 12:43:10 2024 +0100

    x86/mm: ensure L2 is always freed if empty
    
    The current logic in modify_xen_mappings() allows for fully empty L2 tables to
    not be freed and unhooked from the parent L3 if the last L2 slot is not
    populated.
    
    Ensure that even when an L2 slot is empty the logic to check whether the whole
    L2 can be removed is not skipped.
    
    Fixes: 4376c05c3113 ('x86-64: use 1GB pages in 1:1 mapping if available')
    Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
    Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
 xen/arch/x86/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index d537a799bc..0f53dcebad 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5717,7 +5717,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
 
             v += 1UL << L2_PAGETABLE_SHIFT;
             v &= ~((1UL << L2_PAGETABLE_SHIFT) - 1);
-            continue;
+            goto check_l3;
         }
 
         if ( l2e_get_flags(*pl2e) & _PAGE_PSE )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 20:56:54 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 20:56:54 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828903.1243981 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6cDu-0005ni-Rp; Thu, 31 Oct 2024 20:56:54 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828903.1243981; Thu, 31 Oct 2024 20: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 1t6cDu-0005na-PK; Thu, 31 Oct 2024 20:56:54 +0000
Received: by outflank-mailman (input) for mailman id 828903;
 Thu, 31 Oct 2024 20: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 1t6cDt-0005nO-2X
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 20:56:53 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cDt-00Cc7f-0A
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20:56:53 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cDt-0083J9-01
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Revert "scripts: Fix git-checkout.sh to work with branches other than master"
Message-Id: <E1t6cDt-0083J9-01@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 20:56:53 +0000

commit 2478bed83fc6d8be1d129d9a9617eda2ab3c9790
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Oct 31 15:21:54 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 31 15:21:54 2024 +0000

    Revert "scripts: Fix git-checkout.sh to work with branches other than master"
    
    While it does work with branches, it breaks working with full SHAs.
    
    This reverts commit c554ec124b12f9c0d8bfb2b564ca239bd676037c.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 scripts/git-checkout.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/git-checkout.sh b/scripts/git-checkout.sh
index 3796cbfe39..fd4425ac4e 100755
--- a/scripts/git-checkout.sh
+++ b/scripts/git-checkout.sh
@@ -14,7 +14,7 @@ set -e
 if test \! -d $DIR-remote; then
 	rm -rf $DIR-remote $DIR-remote.tmp
 	mkdir -p $DIR-remote.tmp; rmdir $DIR-remote.tmp
-	$GIT clone -b $TAG $TREE $DIR-remote.tmp
+	$GIT clone $TREE $DIR-remote.tmp
 	if test "$TAG" ; then
 		cd $DIR-remote.tmp
 		$GIT branch -D dummy >/dev/null 2>&1 ||:
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 20:57:04 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 20:57:04 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828904.1243985 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6cE4-0005qZ-Tg; Thu, 31 Oct 2024 20:57:04 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828904.1243985; Thu, 31 Oct 2024 20: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 1t6cE4-0005qR-Qn; Thu, 31 Oct 2024 20:57:04 +0000
Received: by outflank-mailman (input) for mailman id 828904;
 Thu, 31 Oct 2024 20: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 1t6cE3-0005qG-5N
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 20:57:03 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cE3-00Cc8R-0S
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20:57:03 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cE3-0083Jx-0M
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] Revert "x86/mm: ensure L2 is always freed if empty"
Message-Id: <E1t6cE3-0083Jx-0M@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 20:57:03 +0000

commit 7a88871aac3feb9736dedc1f7e3c343166b676d2
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Oct 31 17:11:04 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 31 17:11:04 2024 +0000

    Revert "x86/mm: ensure L2 is always freed if empty"
    
    CI says no:
    
      https://gitlab.com/xen-project/hardware/xen/-/jobs/8240163332
    
    This reverts commit a6dba2761e2ecaa7ffc3d3bb3c85685d232bbe68.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 xen/arch/x86/mm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index 0f53dcebad..d537a799bc 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -5717,7 +5717,7 @@ int modify_xen_mappings(unsigned long s, unsigned long e, unsigned int nf)
 
             v += 1UL << L2_PAGETABLE_SHIFT;
             v &= ~((1UL << L2_PAGETABLE_SHIFT) - 1);
-            goto check_l3;
+            continue;
         }
 
         if ( l2e_get_flags(*pl2e) & _PAGE_PSE )
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 20:57:14 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 20:57:14 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828905.1243989 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6cEE-0005ta-Uz; Thu, 31 Oct 2024 20:57:14 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828905.1243989; Thu, 31 Oct 2024 20: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 1t6cEE-0005tS-SG; Thu, 31 Oct 2024 20:57:14 +0000
Received: by outflank-mailman (input) for mailman id 828905;
 Thu, 31 Oct 2024 20: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 1t6cED-0005tF-7y
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 20:57:13 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cED-00Cc8o-0i
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20:57:13 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6cED-0083KN-0c
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 20: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>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] CI: Fix cppcheck parallel build more
Message-Id: <E1t6cED-0083KN-0c@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 20:57:13 +0000

commit e27436fba7f52ddc00c33e569ef91a07da433067
Author:     Andrew Cooper <andrew.cooper3@citrix.com>
AuthorDate: Thu Oct 31 16:14:40 2024 +0000
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 31 17:25:40 2024 +0000

    CI: Fix cppcheck parallel build more
    
    A recent cppcheck run was found to fail:
    
      https://gitlab.com/xen-project/people/andyhhp/xen/-/jobs/8237167472
    
    with:
    
      "type mismatch! call is<type>() before get<type>()" && is<std::string>()
      make[3]: *** [arch/x86/boot/Makefile:28: arch/x86/boot/reloc-trampoline.32.o] Error 1
    
    This turns out to be a parallel build issue, combined with a recent change to
    x86.  Notably, we now have a case where we build both:
    
      CC      arch/x86/boot/reloc-trampoline.32.o
      CC      arch/x86/boot/reloc-trampoline.o
    
    from the same original C file, and cppcheck uses the source C file as the key
    for generating it's intermediate files.
    
    Switch cppcheck to use the object file as the unique key instead.
    
    Fixes: 45bfff651173 ("xen/misra: xen-analysis.py: fix parallel analysis Cppcheck errors")
    Fixes: db8acf31f96b ("x86/boot: Reuse code to relocate trampoline")
    Suggested-by: Luca Fancellu <luca.fancellu@arm.com>
    Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
    Tested-by: Luca Fancellu <luca.fancellu@arm.com>
---
 xen/tools/cppcheck-cc.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/xen/tools/cppcheck-cc.sh b/xen/tools/cppcheck-cc.sh
index 16a965edb7..8a58c3aa86 100755
--- a/xen/tools/cppcheck-cc.sh
+++ b/xen/tools/cppcheck-cc.sh
@@ -26,6 +26,7 @@ EOF
 
 BUILD_DIR=""
 CC_FILE=""
+OBJ_FILE=""
 COMPILER=""
 CPPCHECK_HTML="n"
 CPPCHECK_PLAT_PATH=""
@@ -56,6 +57,7 @@ do
         then
             # This must be the path to the obj file, turn off flag and save path
             OBJTREE_PATH="$(dirname "${OPTION}")"
+            OBJ_FILE="$(basename "${OPTION}")"
             obj_arg_content="n"
         fi
         # Forward any argument to the compiler
@@ -177,12 +179,12 @@ then
     done
     if [ "${IGNORE_PATH}" = "n" ]
     then
-        JDB_FILE="${OBJTREE_PATH}/$(basename "${CC_FILE}".json)"
+        JDB_FILE="${OBJTREE_PATH}/${OBJ_FILE}.json"
 
         # Prepare the Json Compilation Database for the file
         create_jcd "${COMPILER} ${FORWARD_FLAGS}"
 
-        out_file="${OBJTREE_PATH}/$(basename "${CC_FILE%.c}".cppcheck.txt)"
+        out_file="${OBJTREE_PATH}/${OBJ_FILE}.cppcheck.txt"
 
         # Select the right target platform, ARCH is generated from Xen Makefile
         case ${ARCH} in
@@ -211,7 +213,7 @@ then
         fi
 
         # Generate build directory for the analysed file
-        cppcheck_build_dir="${BUILD_DIR}/${OBJTREE_PATH}"
+        cppcheck_build_dir="${BUILD_DIR}/${OBJTREE_PATH}/${OBJ_FILE}"
         mkdir -p "${cppcheck_build_dir}"
 
         # Shellcheck complains about missing quotes on CPPCHECK_TOOL_ARGS, but
--
generated by git-patchbot for /home/xen/git/xen.git#master


From xen-changelog-bounces@lists.xenproject.org Thu Oct 31 21:22:07 2024
Return-path: <xen-changelog-bounces@lists.xenproject.org>
Envelope-to: archives@lists.xen.org
Delivery-date: Thu, 31 Oct 2024 21:22:07 +0000
Received: from list by lists.xenproject.org with outflank-mailman.828906.1243992 (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6ccF-0001OG-Lt; Thu, 31 Oct 2024 21:22:03 +0000
X-Outflank-Mailman: Message body and most headers restored to incoming version
Received: by outflank-mailman (output) from mailman id 828906.1243992; Thu, 31 Oct 2024 21:22:03 +0000
Received: from localhost ([127.0.0.1] helo=lists.xenproject.org)
	by lists.xenproject.org with esmtp (Exim 4.92)
	(envelope-from <xen-changelog-bounces@lists.xenproject.org>)
	id 1t6ccF-0001O9-Iq; Thu, 31 Oct 2024 21:22:03 +0000
Received: by outflank-mailman (input) for mailman id 828906;
 Thu, 31 Oct 2024 21: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 1t6ccD-0001Nb-Kb
 for xen-changelog@lists.xenproject.org; Thu, 31 Oct 2024 21:22:01 +0000
Received: from xenbits.xenproject.org ([104.239.192.120])
 by mail.xenproject.org with esmtp (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6ccD-00Cd16-1W
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 21:22:01 +0000
Received: from xen by xenbits.xenproject.org with local (Exim 4.96)
 (envelope-from <ian.jackson@eu.citrix.com>) id 1t6ccD-0084gc-1M
 for xen-changelog@lists.xenproject.org;
 Thu, 31 Oct 2024 21:22:01 +0000
X-BeenThere: xen-changelog@lists.xenproject.org
List-Id: "Change log for Mercurial \(receive only\)"
 <xen-changelog.lists.xenproject.org>
List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xenproject.org>
List-Help: <mailto:xen-changelog-request@lists.xenproject.org?subject=help>
List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-changelog>, 
 <mailto:xen-changelog-request@lists.xenproject.org?subject=subscribe>
Errors-To: xen-changelog-bounces@lists.xenproject.org
Precedence: list
Sender: "Xen-changelog" <xen-changelog-bounces@lists.xenproject.org>
From: patchbot@xen.org
To: xen-changelog@lists.xenproject.org
Reply-To: xen-devel@lists.xenproject.org
Subject: [xen master] SUPPORT.md: Argo: Upgrade status to Tech Preview
Message-Id: <E1t6ccD-0084gc-1M@xenbits.xenproject.org>
Date: Thu, 31 Oct 2024 21:22:01 +0000

commit a6d71d59ca33906ed29f9bce0d9888a4d8403159
Author:     Christopher Clark <christopher.w.clark@gmail.com>
AuthorDate: Sat Oct 19 20:06:52 2024 +0100
Commit:     Andrew Cooper <andrew.cooper3@citrix.com>
CommitDate: Thu Oct 31 19:04:59 2024 +0000

    SUPPORT.md: Argo: Upgrade status to Tech Preview
    
    Recent patches to xen-devel indicate active interest in Argo within the Xen
    community, and as the feature has been documented and in use by
    OpenXT for multiple years, update the Xen SUPPORT.md statement of status.
    
    This has also been discussed at several XenSummits, with general agreement to
    the status upgrade.
    
    Signed-off-by: Christopher Clark <christopher.w.clark@gmail.com>
    Acked-by: Julien Grall <jgrall@amazon.com>
    Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
 SUPPORT.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/SUPPORT.md b/SUPPORT.md
index 23dd7e6424..4f56094356 100644
--- a/SUPPORT.md
+++ b/SUPPORT.md
@@ -848,7 +848,7 @@ This feature is not security supported: see https://xenbits.xen.org/xsa/advisory
 
 ### Argo: Inter-domain message delivery by hypercall
 
-    Status: Experimental
+    Status: Tech Preview
 
 ### x86/PCI Device Passthrough
 
--
generated by git-patchbot for /home/xen/git/xen.git#master


